loro-crdt 1.3.5 → 1.4.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.
@@ -155,36 +155,55 @@ interface LoroDoc {
155
155
  * ```
156
156
  */
157
157
  subscribeLocalUpdates(f: (bytes: Uint8Array) => void): () => void
158
+
158
159
  /**
159
160
  * Convert the document to a JSON value with a custom replacer function.
160
- *
161
+ *
161
162
  * This method works similarly to `JSON.stringify`'s replacer parameter.
162
163
  * The replacer function is called for each value in the document and can transform
163
164
  * how values are serialized to JSON.
164
- *
165
+ *
165
166
  * @param replacer - A function that takes a key and value, and returns how that value
166
- * should be serialized. Similar to JSON.stringify's replacer.
167
+ * should be serialized. Similar to JSON.stringify's replacer.
167
168
  * If return undefined, the value will be skipped.
168
169
  * @returns The JSON representation of the document after applying the replacer function.
169
- *
170
+ *
170
171
  * @example
171
172
  * ```ts
172
173
  * const doc = new LoroDoc();
173
174
  * const text = doc.getText("text");
174
175
  * text.insert(0, "Hello");
175
176
  * text.mark({ start: 0, end: 2 }, "bold", true);
176
- *
177
+ *
177
178
  * // Use delta to represent text
178
179
  * const json = doc.toJsonWithReplacer((key, value) => {
179
180
  * if (value instanceof LoroText) {
180
181
  * return value.toDelta();
181
- * }
182
- *
182
+ * }
183
+ *
183
184
  * return value;
184
185
  * });
185
186
  * ```
186
187
  */
187
188
  toJsonWithReplacer(replacer: (key: string | index, value: Value | Container) => Value | Container | undefined): Value;
189
+
190
+ /**
191
+ * Calculate the differences between two frontiers
192
+ *
193
+ * The entries in the returned object are sorted by causal order: the creation of a child container will be
194
+ * presented before its use.
195
+ *
196
+ * @param from - The source frontier to diff from. A frontier represents a consistent version of the document.
197
+ * @param to - The target frontier to diff to. A frontier represents a consistent version of the document.
198
+ * @param for_json - Controls the diff format:
199
+ * - If true, returns JsonDiff format suitable for JSON serialization
200
+ * - If false, returns Diff format that shares the same type as LoroEvent
201
+ * - The default value is `true`
202
+ */
203
+ diff(from: OpId[], to: OpId[], for_json: false): [ContainerID, Diff][];
204
+ diff(from: OpId[], to: OpId[], for_json: true): [ContainerID, JsonDiff][];
205
+ diff(from: OpId[], to: OpId[], for_json: undefined): [ContainerID, JsonDiff][];
206
+ diff(from: OpId[], to: OpId[], for_json?: boolean): [ContainerID, JsonDiff|Diff][];
188
207
  }
189
208
 
190
209
  /**
@@ -672,6 +691,11 @@ export type ListDiff = {
672
691
  diff: Delta<(Value | Container)[]>[];
673
692
  };
674
693
 
694
+ export type ListJsonDiff = {
695
+ type: "list";
696
+ diff: Delta<(Value | JsonContainerID )[]>[];
697
+ };
698
+
675
699
  export type TextDiff = {
676
700
  type: "text";
677
701
  diff: Delta<string>[];
@@ -682,6 +706,11 @@ export type MapDiff = {
682
706
  updated: Record<string, Value | Container | undefined>;
683
707
  };
684
708
 
709
+ export type MapJsonDiff = {
710
+ type: "map";
711
+ updated: Record<string, Value | JsonContainerID | undefined>;
712
+ };
713
+
685
714
  export type TreeDiffItem =
686
715
  | {
687
716
  target: TreeID;
@@ -717,6 +746,7 @@ export type CounterDiff = {
717
746
  };
718
747
 
719
748
  export type Diff = ListDiff | TextDiff | MapDiff | TreeDiff | CounterDiff;
749
+ export type JsonDiff = ListJsonDiff | TextDiff | MapJsonDiff | CounterDiff | TreeDiff;
720
750
  export type Subscription = () => void;
721
751
  type NonNullableType<T> = Exclude<T, null | undefined>;
722
752
  export type AwarenessListener = (
@@ -1082,7 +1112,7 @@ interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
1082
1112
  * If the key already exists, its value will be updated. If the key doesn't exist,
1083
1113
  * a new key-value pair will be created.
1084
1114
  *
1085
- * > **Note**: When calling `map.set(key, value)` on a LoroMap, if `map.get(key)` already returns `value`,
1115
+ * > **Note**: When calling `map.set(key, value)` on a LoroMap, if `map.get(key)` already returns `value`,
1086
1116
  * > the operation will be a no-op (no operation recorded) to avoid unnecessary updates.
1087
1117
  *
1088
1118
  * @example
@@ -2318,20 +2348,34 @@ export class LoroDoc {
2318
2348
  */
2319
2349
  revertTo(frontiers: ({ peer: PeerID, counter: number })[]): void;
2320
2350
  /**
2321
- * Apply a diff batch to the document
2322
- * @param {Record<ContainerID, Diff>} diff
2323
- */
2324
- applyDiff(diff: Record<ContainerID, Diff>): void;
2325
- /**
2326
- * Calculate the differences between two frontiers
2351
+ * Apply a batch of diff to the document
2327
2352
  *
2328
- * The entries in the returned object are sorted by causal order: the creation of a child container will be
2329
- * presented before its use.
2330
- * @param {({ peer: PeerID, counter: number })[]} from
2331
- * @param {({ peer: PeerID, counter: number })[]} to
2332
- * @returns {Record<ContainerID, Diff>}
2353
+ * A diff batch represents a set of changes between two versions of the document.
2354
+ * You can calculate a diff batch using `doc.diff()`.
2355
+ *
2356
+ * Changes are associated with container IDs. During diff application, if new containers were created in the source
2357
+ * document, they will be assigned fresh IDs in the target document. Loro automatically handles remapping these
2358
+ * container IDs from their original IDs to the new IDs as the diff is applied.
2359
+ *
2360
+ * @example
2361
+ * ```ts
2362
+ * const doc1 = new LoroDoc();
2363
+ * const doc2 = new LoroDoc();
2364
+ *
2365
+ * // Make some changes to doc1
2366
+ * const text = doc1.getText("text");
2367
+ * text.insert(0, "Hello");
2368
+ *
2369
+ * // Calculate diff between empty and current state
2370
+ * const diff = doc1.diff([], doc1.frontiers());
2371
+ *
2372
+ * // Apply changes to doc2
2373
+ * doc2.applyDiff(diff);
2374
+ * console.log(doc2.getText("text").toString()); // "Hello"
2375
+ * ```
2376
+ * @param {[ContainerID, Diff|JsonDiff][]} diff
2333
2377
  */
2334
- diff(from: ({ peer: PeerID, counter: number })[], to: ({ peer: PeerID, counter: number })[]): Record<ContainerID, Diff>;
2378
+ applyDiff(diff: [ContainerID, Diff|JsonDiff][]): void;
2335
2379
  /**
2336
2380
  * Peer ID of the current writer.
2337
2381
  */
@@ -2610,8 +2610,32 @@ export class LoroDoc {
2610
2610
  }
2611
2611
  }
2612
2612
  /**
2613
- * Apply a diff batch to the document
2614
- * @param {Record<ContainerID, Diff>} diff
2613
+ * Apply a batch of diff to the document
2614
+ *
2615
+ * A diff batch represents a set of changes between two versions of the document.
2616
+ * You can calculate a diff batch using `doc.diff()`.
2617
+ *
2618
+ * Changes are associated with container IDs. During diff application, if new containers were created in the source
2619
+ * document, they will be assigned fresh IDs in the target document. Loro automatically handles remapping these
2620
+ * container IDs from their original IDs to the new IDs as the diff is applied.
2621
+ *
2622
+ * @example
2623
+ * ```ts
2624
+ * const doc1 = new LoroDoc();
2625
+ * const doc2 = new LoroDoc();
2626
+ *
2627
+ * // Make some changes to doc1
2628
+ * const text = doc1.getText("text");
2629
+ * text.insert(0, "Hello");
2630
+ *
2631
+ * // Calculate diff between empty and current state
2632
+ * const diff = doc1.diff([], doc1.frontiers());
2633
+ *
2634
+ * // Apply changes to doc2
2635
+ * doc2.applyDiff(diff);
2636
+ * console.log(doc2.getText("text").toString()); // "Hello"
2637
+ * ```
2638
+ * @param {[ContainerID, Diff|JsonDiff][]} diff
2615
2639
  */
2616
2640
  applyDiff(diff) {
2617
2641
  try {
@@ -2633,16 +2657,17 @@ export class LoroDoc {
2633
2657
  * presented before its use.
2634
2658
  * @param {({ peer: PeerID, counter: number })[]} from
2635
2659
  * @param {({ peer: PeerID, counter: number })[]} to
2636
- * @returns {Record<ContainerID, Diff>}
2660
+ * @param {boolean | undefined} [for_json]
2661
+ * @returns {[ContainerID, Diff|JsonDiff][]}
2637
2662
  */
2638
- diff(from, to) {
2663
+ diff(from, to, for_json) {
2639
2664
  try {
2640
2665
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2641
2666
  const ptr0 = passArrayJsValueToWasm0(from, wasm.__wbindgen_export_0);
2642
2667
  const len0 = WASM_VECTOR_LEN;
2643
2668
  const ptr1 = passArrayJsValueToWasm0(to, wasm.__wbindgen_export_0);
2644
2669
  const len1 = WASM_VECTOR_LEN;
2645
- wasm.lorodoc_diff(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
2670
+ wasm.lorodoc_diff(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(for_json) ? 0xFFFFFF : for_json ? 1 : 0);
2646
2671
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2647
2672
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2648
2673
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -5993,18 +6018,18 @@ export function __wbg_lorotreenode_new(arg0) {
5993
6018
  return addHeapObject(ret);
5994
6019
  };
5995
6020
 
5996
- export function __wbg_lorocounter_new(arg0) {
5997
- const ret = LoroCounter.__wrap(arg0);
6021
+ export function __wbg_lorotree_new(arg0) {
6022
+ const ret = LoroTree.__wrap(arg0);
5998
6023
  return addHeapObject(ret);
5999
6024
  };
6000
6025
 
6001
- export function __wbg_lorotext_new(arg0) {
6002
- const ret = LoroText.__wrap(arg0);
6026
+ export function __wbg_lorolist_new(arg0) {
6027
+ const ret = LoroList.__wrap(arg0);
6003
6028
  return addHeapObject(ret);
6004
6029
  };
6005
6030
 
6006
- export function __wbg_lorolist_new(arg0) {
6007
- const ret = LoroList.__wrap(arg0);
6031
+ export function __wbg_lorocounter_new(arg0) {
6032
+ const ret = LoroCounter.__wrap(arg0);
6008
6033
  return addHeapObject(ret);
6009
6034
  };
6010
6035
 
@@ -6013,18 +6038,18 @@ export function __wbg_loromap_new(arg0) {
6013
6038
  return addHeapObject(ret);
6014
6039
  };
6015
6040
 
6016
- export function __wbg_cursor_new(arg0) {
6017
- const ret = Cursor.__wrap(arg0);
6041
+ export function __wbg_loromovablelist_new(arg0) {
6042
+ const ret = LoroMovableList.__wrap(arg0);
6018
6043
  return addHeapObject(ret);
6019
6044
  };
6020
6045
 
6021
- export function __wbg_loromovablelist_new(arg0) {
6022
- const ret = LoroMovableList.__wrap(arg0);
6046
+ export function __wbg_lorotext_new(arg0) {
6047
+ const ret = LoroText.__wrap(arg0);
6023
6048
  return addHeapObject(ret);
6024
6049
  };
6025
6050
 
6026
- export function __wbg_lorotree_new(arg0) {
6027
- const ret = LoroTree.__wrap(arg0);
6051
+ export function __wbg_cursor_new(arg0) {
6052
+ const ret = Cursor.__wrap(arg0);
6028
6053
  return addHeapObject(ret);
6029
6054
  };
6030
6055
 
@@ -6256,7 +6281,7 @@ export function __wbg_error_f851667af71bcfc6(arg0, arg1) {
6256
6281
  }
6257
6282
  };
6258
6283
 
6259
- export const __wbg_now_6dd635953150ee31 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6284
+ export const __wbg_now_bc6f749123583eb9 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6260
6285
 
6261
6286
  export function __wbg_crypto_1d1f22824a6a080c(arg0) {
6262
6287
  const ret = getObject(arg0).crypto;
@@ -6581,12 +6606,12 @@ export function __wbindgen_memory() {
6581
6606
  };
6582
6607
 
6583
6608
  export function __wbindgen_closure_wrapper482(arg0, arg1, arg2) {
6584
- const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_60);
6609
+ const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_60);
6585
6610
  return addHeapObject(ret);
6586
6611
  };
6587
6612
 
6588
- export function __wbindgen_closure_wrapper484(arg0, arg1, arg2) {
6589
- const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
6613
+ export function __wbindgen_closure_wrapper485(arg0, arg1, arg2) {
6614
+ const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_63);
6590
6615
  return addHeapObject(ret);
6591
6616
  };
6592
6617
 
Binary file
@@ -99,7 +99,7 @@ export function lorodoc_getCursorPos(a: number, b: number, c: number): void;
99
99
  export function lorodoc_getChangedContainersIn(a: number, b: number, c: number, d: number): void;
100
100
  export function lorodoc_revertTo(a: number, b: number, c: number, d: number): void;
101
101
  export function lorodoc_applyDiff(a: number, b: number, c: number): void;
102
- export function lorodoc_diff(a: number, b: number, c: number, d: number, e: number, f: number): void;
102
+ export function lorodoc_diff(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void;
103
103
  export function __wbg_lorotext_free(a: number): void;
104
104
  export function lorotext_new(): number;
105
105
  export function lorotext_kind(a: number): number;
@@ -155,36 +155,55 @@ interface LoroDoc {
155
155
  * ```
156
156
  */
157
157
  subscribeLocalUpdates(f: (bytes: Uint8Array) => void): () => void
158
+
158
159
  /**
159
160
  * Convert the document to a JSON value with a custom replacer function.
160
- *
161
+ *
161
162
  * This method works similarly to `JSON.stringify`'s replacer parameter.
162
163
  * The replacer function is called for each value in the document and can transform
163
164
  * how values are serialized to JSON.
164
- *
165
+ *
165
166
  * @param replacer - A function that takes a key and value, and returns how that value
166
- * should be serialized. Similar to JSON.stringify's replacer.
167
+ * should be serialized. Similar to JSON.stringify's replacer.
167
168
  * If return undefined, the value will be skipped.
168
169
  * @returns The JSON representation of the document after applying the replacer function.
169
- *
170
+ *
170
171
  * @example
171
172
  * ```ts
172
173
  * const doc = new LoroDoc();
173
174
  * const text = doc.getText("text");
174
175
  * text.insert(0, "Hello");
175
176
  * text.mark({ start: 0, end: 2 }, "bold", true);
176
- *
177
+ *
177
178
  * // Use delta to represent text
178
179
  * const json = doc.toJsonWithReplacer((key, value) => {
179
180
  * if (value instanceof LoroText) {
180
181
  * return value.toDelta();
181
- * }
182
- *
182
+ * }
183
+ *
183
184
  * return value;
184
185
  * });
185
186
  * ```
186
187
  */
187
188
  toJsonWithReplacer(replacer: (key: string | index, value: Value | Container) => Value | Container | undefined): Value;
189
+
190
+ /**
191
+ * Calculate the differences between two frontiers
192
+ *
193
+ * The entries in the returned object are sorted by causal order: the creation of a child container will be
194
+ * presented before its use.
195
+ *
196
+ * @param from - The source frontier to diff from. A frontier represents a consistent version of the document.
197
+ * @param to - The target frontier to diff to. A frontier represents a consistent version of the document.
198
+ * @param for_json - Controls the diff format:
199
+ * - If true, returns JsonDiff format suitable for JSON serialization
200
+ * - If false, returns Diff format that shares the same type as LoroEvent
201
+ * - The default value is `true`
202
+ */
203
+ diff(from: OpId[], to: OpId[], for_json: false): [ContainerID, Diff][];
204
+ diff(from: OpId[], to: OpId[], for_json: true): [ContainerID, JsonDiff][];
205
+ diff(from: OpId[], to: OpId[], for_json: undefined): [ContainerID, JsonDiff][];
206
+ diff(from: OpId[], to: OpId[], for_json?: boolean): [ContainerID, JsonDiff|Diff][];
188
207
  }
189
208
 
190
209
  /**
@@ -672,6 +691,11 @@ export type ListDiff = {
672
691
  diff: Delta<(Value | Container)[]>[];
673
692
  };
674
693
 
694
+ export type ListJsonDiff = {
695
+ type: "list";
696
+ diff: Delta<(Value | JsonContainerID )[]>[];
697
+ };
698
+
675
699
  export type TextDiff = {
676
700
  type: "text";
677
701
  diff: Delta<string>[];
@@ -682,6 +706,11 @@ export type MapDiff = {
682
706
  updated: Record<string, Value | Container | undefined>;
683
707
  };
684
708
 
709
+ export type MapJsonDiff = {
710
+ type: "map";
711
+ updated: Record<string, Value | JsonContainerID | undefined>;
712
+ };
713
+
685
714
  export type TreeDiffItem =
686
715
  | {
687
716
  target: TreeID;
@@ -717,6 +746,7 @@ export type CounterDiff = {
717
746
  };
718
747
 
719
748
  export type Diff = ListDiff | TextDiff | MapDiff | TreeDiff | CounterDiff;
749
+ export type JsonDiff = ListJsonDiff | TextDiff | MapJsonDiff | CounterDiff | TreeDiff;
720
750
  export type Subscription = () => void;
721
751
  type NonNullableType<T> = Exclude<T, null | undefined>;
722
752
  export type AwarenessListener = (
@@ -1082,7 +1112,7 @@ interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
1082
1112
  * If the key already exists, its value will be updated. If the key doesn't exist,
1083
1113
  * a new key-value pair will be created.
1084
1114
  *
1085
- * > **Note**: When calling `map.set(key, value)` on a LoroMap, if `map.get(key)` already returns `value`,
1115
+ * > **Note**: When calling `map.set(key, value)` on a LoroMap, if `map.get(key)` already returns `value`,
1086
1116
  * > the operation will be a no-op (no operation recorded) to avoid unnecessary updates.
1087
1117
  *
1088
1118
  * @example
@@ -2318,20 +2348,34 @@ export class LoroDoc {
2318
2348
  */
2319
2349
  revertTo(frontiers: ({ peer: PeerID, counter: number })[]): void;
2320
2350
  /**
2321
- * Apply a diff batch to the document
2322
- * @param {Record<ContainerID, Diff>} diff
2323
- */
2324
- applyDiff(diff: Record<ContainerID, Diff>): void;
2325
- /**
2326
- * Calculate the differences between two frontiers
2351
+ * Apply a batch of diff to the document
2327
2352
  *
2328
- * The entries in the returned object are sorted by causal order: the creation of a child container will be
2329
- * presented before its use.
2330
- * @param {({ peer: PeerID, counter: number })[]} from
2331
- * @param {({ peer: PeerID, counter: number })[]} to
2332
- * @returns {Record<ContainerID, Diff>}
2353
+ * A diff batch represents a set of changes between two versions of the document.
2354
+ * You can calculate a diff batch using `doc.diff()`.
2355
+ *
2356
+ * Changes are associated with container IDs. During diff application, if new containers were created in the source
2357
+ * document, they will be assigned fresh IDs in the target document. Loro automatically handles remapping these
2358
+ * container IDs from their original IDs to the new IDs as the diff is applied.
2359
+ *
2360
+ * @example
2361
+ * ```ts
2362
+ * const doc1 = new LoroDoc();
2363
+ * const doc2 = new LoroDoc();
2364
+ *
2365
+ * // Make some changes to doc1
2366
+ * const text = doc1.getText("text");
2367
+ * text.insert(0, "Hello");
2368
+ *
2369
+ * // Calculate diff between empty and current state
2370
+ * const diff = doc1.diff([], doc1.frontiers());
2371
+ *
2372
+ * // Apply changes to doc2
2373
+ * doc2.applyDiff(diff);
2374
+ * console.log(doc2.getText("text").toString()); // "Hello"
2375
+ * ```
2376
+ * @param {[ContainerID, Diff|JsonDiff][]} diff
2333
2377
  */
2334
- diff(from: ({ peer: PeerID, counter: number })[], to: ({ peer: PeerID, counter: number })[]): Record<ContainerID, Diff>;
2378
+ applyDiff(diff: [ContainerID, Diff|JsonDiff][]): void;
2335
2379
  /**
2336
2380
  * Peer ID of the current writer.
2337
2381
  */
@@ -2608,8 +2608,32 @@ class LoroDoc {
2608
2608
  }
2609
2609
  }
2610
2610
  /**
2611
- * Apply a diff batch to the document
2612
- * @param {Record<ContainerID, Diff>} diff
2611
+ * Apply a batch of diff to the document
2612
+ *
2613
+ * A diff batch represents a set of changes between two versions of the document.
2614
+ * You can calculate a diff batch using `doc.diff()`.
2615
+ *
2616
+ * Changes are associated with container IDs. During diff application, if new containers were created in the source
2617
+ * document, they will be assigned fresh IDs in the target document. Loro automatically handles remapping these
2618
+ * container IDs from their original IDs to the new IDs as the diff is applied.
2619
+ *
2620
+ * @example
2621
+ * ```ts
2622
+ * const doc1 = new LoroDoc();
2623
+ * const doc2 = new LoroDoc();
2624
+ *
2625
+ * // Make some changes to doc1
2626
+ * const text = doc1.getText("text");
2627
+ * text.insert(0, "Hello");
2628
+ *
2629
+ * // Calculate diff between empty and current state
2630
+ * const diff = doc1.diff([], doc1.frontiers());
2631
+ *
2632
+ * // Apply changes to doc2
2633
+ * doc2.applyDiff(diff);
2634
+ * console.log(doc2.getText("text").toString()); // "Hello"
2635
+ * ```
2636
+ * @param {[ContainerID, Diff|JsonDiff][]} diff
2613
2637
  */
2614
2638
  applyDiff(diff) {
2615
2639
  try {
@@ -2631,16 +2655,17 @@ class LoroDoc {
2631
2655
  * presented before its use.
2632
2656
  * @param {({ peer: PeerID, counter: number })[]} from
2633
2657
  * @param {({ peer: PeerID, counter: number })[]} to
2634
- * @returns {Record<ContainerID, Diff>}
2658
+ * @param {boolean | undefined} [for_json]
2659
+ * @returns {[ContainerID, Diff|JsonDiff][]}
2635
2660
  */
2636
- diff(from, to) {
2661
+ diff(from, to, for_json) {
2637
2662
  try {
2638
2663
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2639
2664
  const ptr0 = passArrayJsValueToWasm0(from, wasm.__wbindgen_export_0);
2640
2665
  const len0 = WASM_VECTOR_LEN;
2641
2666
  const ptr1 = passArrayJsValueToWasm0(to, wasm.__wbindgen_export_0);
2642
2667
  const len1 = WASM_VECTOR_LEN;
2643
- wasm.lorodoc_diff(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
2668
+ wasm.lorodoc_diff(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(for_json) ? 0xFFFFFF : for_json ? 1 : 0);
2644
2669
  var r0 = getInt32Memory0()[retptr / 4 + 0];
2645
2670
  var r1 = getInt32Memory0()[retptr / 4 + 1];
2646
2671
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -6000,18 +6025,18 @@ module.exports.__wbg_lorotreenode_new = function(arg0) {
6000
6025
  return addHeapObject(ret);
6001
6026
  };
6002
6027
 
6003
- module.exports.__wbg_lorocounter_new = function(arg0) {
6004
- const ret = LoroCounter.__wrap(arg0);
6028
+ module.exports.__wbg_lorotree_new = function(arg0) {
6029
+ const ret = LoroTree.__wrap(arg0);
6005
6030
  return addHeapObject(ret);
6006
6031
  };
6007
6032
 
6008
- module.exports.__wbg_lorotext_new = function(arg0) {
6009
- const ret = LoroText.__wrap(arg0);
6033
+ module.exports.__wbg_lorolist_new = function(arg0) {
6034
+ const ret = LoroList.__wrap(arg0);
6010
6035
  return addHeapObject(ret);
6011
6036
  };
6012
6037
 
6013
- module.exports.__wbg_lorolist_new = function(arg0) {
6014
- const ret = LoroList.__wrap(arg0);
6038
+ module.exports.__wbg_lorocounter_new = function(arg0) {
6039
+ const ret = LoroCounter.__wrap(arg0);
6015
6040
  return addHeapObject(ret);
6016
6041
  };
6017
6042
 
@@ -6020,18 +6045,18 @@ module.exports.__wbg_loromap_new = function(arg0) {
6020
6045
  return addHeapObject(ret);
6021
6046
  };
6022
6047
 
6023
- module.exports.__wbg_cursor_new = function(arg0) {
6024
- const ret = Cursor.__wrap(arg0);
6048
+ module.exports.__wbg_loromovablelist_new = function(arg0) {
6049
+ const ret = LoroMovableList.__wrap(arg0);
6025
6050
  return addHeapObject(ret);
6026
6051
  };
6027
6052
 
6028
- module.exports.__wbg_loromovablelist_new = function(arg0) {
6029
- const ret = LoroMovableList.__wrap(arg0);
6053
+ module.exports.__wbg_lorotext_new = function(arg0) {
6054
+ const ret = LoroText.__wrap(arg0);
6030
6055
  return addHeapObject(ret);
6031
6056
  };
6032
6057
 
6033
- module.exports.__wbg_lorotree_new = function(arg0) {
6034
- const ret = LoroTree.__wrap(arg0);
6058
+ module.exports.__wbg_cursor_new = function(arg0) {
6059
+ const ret = Cursor.__wrap(arg0);
6035
6060
  return addHeapObject(ret);
6036
6061
  };
6037
6062
 
@@ -6263,7 +6288,7 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
6263
6288
  }
6264
6289
  };
6265
6290
 
6266
- module.exports.__wbg_now_6dd635953150ee31 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6291
+ module.exports.__wbg_now_bc6f749123583eb9 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
6267
6292
 
6268
6293
  module.exports.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
6269
6294
  const ret = getObject(arg0).crypto;
@@ -6588,12 +6613,12 @@ module.exports.__wbindgen_memory = function() {
6588
6613
  };
6589
6614
 
6590
6615
  module.exports.__wbindgen_closure_wrapper482 = function(arg0, arg1, arg2) {
6591
- const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_60);
6616
+ const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_60);
6592
6617
  return addHeapObject(ret);
6593
6618
  };
6594
6619
 
6595
- module.exports.__wbindgen_closure_wrapper484 = function(arg0, arg1, arg2) {
6596
- const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
6620
+ module.exports.__wbindgen_closure_wrapper485 = function(arg0, arg1, arg2) {
6621
+ const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_63);
6597
6622
  return addHeapObject(ret);
6598
6623
  };
6599
6624
 
Binary file
@@ -99,7 +99,7 @@ export function lorodoc_getCursorPos(a: number, b: number, c: number): void;
99
99
  export function lorodoc_getChangedContainersIn(a: number, b: number, c: number, d: number): void;
100
100
  export function lorodoc_revertTo(a: number, b: number, c: number, d: number): void;
101
101
  export function lorodoc_applyDiff(a: number, b: number, c: number): void;
102
- export function lorodoc_diff(a: number, b: number, c: number, d: number, e: number, f: number): void;
102
+ export function lorodoc_diff(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void;
103
103
  export function __wbg_lorotext_free(a: number): void;
104
104
  export function lorotext_new(): number;
105
105
  export function lorotext_kind(a: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loro-crdt",
3
- "version": "1.3.5",
3
+ "version": "1.4.1",
4
4
  "description": "Loro CRDTs is a high-performance CRDT framework that makes your app state synchronized, collaborative and maintainable effortlessly.",
5
5
  "keywords": [
6
6
  "crdt",