loro-crdt 1.10.0 → 1.10.2

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.
@@ -1,5 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function callPendingEvents(): void;
3
4
  /**
4
5
  * Get the version of Loro
5
6
  */
@@ -8,8 +9,9 @@ export function LORO_VERSION(): string;
8
9
  * Enable debug info of Loro
9
10
  */
10
11
  export function setDebug(): void;
11
- export function run(): void;
12
+ export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
12
13
  export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
14
+ export function run(): void;
13
15
  /**
14
16
  * Redacts sensitive content in JSON updates within the specified version range.
15
17
  *
@@ -43,8 +45,6 @@ export function redactJsonUpdates(json_updates: string | JsonSchema, version_ran
43
45
  * - changeNum
44
46
  */
45
47
  export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
46
- export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
47
- export function callPendingEvents(): void;
48
48
 
49
49
  /**
50
50
  * Container types supported by loro.
@@ -63,6 +63,7 @@ export function callPendingEvents(): void;
63
63
  export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList" | "Counter";
64
64
 
65
65
  export type PeerID = `${number}`;
66
+ export type TextPosType = "unicode" | "utf16" | "utf8";
66
67
  /**
67
68
  * The unique id of each container.
68
69
  *
@@ -338,7 +339,7 @@ interface LoroDoc {
338
339
  export type Delta<T> =
339
340
  | {
340
341
  insert: T;
341
- attributes?: { [key in string]: {} };
342
+ attributes?: { [key in string]: Value };
342
343
  retain?: undefined;
343
344
  delete?: undefined;
344
345
  }
@@ -350,7 +351,7 @@ export type Delta<T> =
350
351
  }
351
352
  | {
352
353
  retain: number;
353
- attributes?: { [key in string]: {} };
354
+ attributes?: { [key in string]: Value };
354
355
  delete?: undefined;
355
356
  insert?: undefined;
356
357
  };
@@ -450,6 +451,11 @@ export interface ImportBlobMetadata {
450
451
  }
451
452
 
452
453
  interface LoroText {
454
+ /**
455
+ * Convert a position between coordinate systems.
456
+ */
457
+ convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
458
+
453
459
  /**
454
460
  * Get the cursor position at the given pos.
455
461
  *
@@ -1264,6 +1270,10 @@ interface LoroText {
1264
1270
  insert(pos: number, text: string): void;
1265
1271
  delete(pos: number, len: number): void;
1266
1272
  subscribe(listener: Listener): Subscription;
1273
+ /**
1274
+ * Convert a position between coordinate systems.
1275
+ */
1276
+ convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
1267
1277
  /**
1268
1278
  * Update the current text to the target text.
1269
1279
  *
@@ -3035,6 +3045,14 @@ export class LoroText {
3035
3045
  * ```
3036
3046
  */
3037
3047
  applyDelta(delta: Delta<string>[]): void;
3048
+ /**
3049
+ * Convert a position between coordinate systems.
3050
+ *
3051
+ * Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
3052
+ *
3053
+ * Returns `undefined` when out of bounds or unsupported.
3054
+ */
3055
+ convertPos(index: number, from: string, to: string): any;
3038
3056
  /**
3039
3057
  * Delete elements from index to utf-8 index + len
3040
3058
  *
@@ -1,5 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function callPendingEvents(): void;
3
4
  /**
4
5
  * Get the version of Loro
5
6
  */
@@ -8,8 +9,9 @@ export function LORO_VERSION(): string;
8
9
  * Enable debug info of Loro
9
10
  */
10
11
  export function setDebug(): void;
11
- export function run(): void;
12
+ export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
12
13
  export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
14
+ export function run(): void;
13
15
  /**
14
16
  * Redacts sensitive content in JSON updates within the specified version range.
15
17
  *
@@ -43,8 +45,6 @@ export function redactJsonUpdates(json_updates: string | JsonSchema, version_ran
43
45
  * - changeNum
44
46
  */
45
47
  export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
46
- export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
47
- export function callPendingEvents(): void;
48
48
 
49
49
  /**
50
50
  * Container types supported by loro.
@@ -63,6 +63,7 @@ export function callPendingEvents(): void;
63
63
  export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList" | "Counter";
64
64
 
65
65
  export type PeerID = `${number}`;
66
+ export type TextPosType = "unicode" | "utf16" | "utf8";
66
67
  /**
67
68
  * The unique id of each container.
68
69
  *
@@ -338,7 +339,7 @@ interface LoroDoc {
338
339
  export type Delta<T> =
339
340
  | {
340
341
  insert: T;
341
- attributes?: { [key in string]: {} };
342
+ attributes?: { [key in string]: Value };
342
343
  retain?: undefined;
343
344
  delete?: undefined;
344
345
  }
@@ -350,7 +351,7 @@ export type Delta<T> =
350
351
  }
351
352
  | {
352
353
  retain: number;
353
- attributes?: { [key in string]: {} };
354
+ attributes?: { [key in string]: Value };
354
355
  delete?: undefined;
355
356
  insert?: undefined;
356
357
  };
@@ -450,6 +451,11 @@ export interface ImportBlobMetadata {
450
451
  }
451
452
 
452
453
  interface LoroText {
454
+ /**
455
+ * Convert a position between coordinate systems.
456
+ */
457
+ convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
458
+
453
459
  /**
454
460
  * Get the cursor position at the given pos.
455
461
  *
@@ -1264,6 +1270,10 @@ interface LoroText {
1264
1270
  insert(pos: number, text: string): void;
1265
1271
  delete(pos: number, len: number): void;
1266
1272
  subscribe(listener: Listener): Subscription;
1273
+ /**
1274
+ * Convert a position between coordinate systems.
1275
+ */
1276
+ convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
1267
1277
  /**
1268
1278
  * Update the current text to the target text.
1269
1279
  *
@@ -3035,6 +3045,14 @@ export class LoroText {
3035
3045
  * ```
3036
3046
  */
3037
3047
  applyDelta(delta: Delta<string>[]): void;
3048
+ /**
3049
+ * Convert a position between coordinate systems.
3050
+ *
3051
+ * Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
3052
+ *
3053
+ * Returns `undefined` when out of bounds or unsupported.
3054
+ */
3055
+ convertPos(index: number, from: string, to: string): any;
3038
3056
  /**
3039
3057
  * Delete elements from index to utf-8 index + len
3040
3058
  *
@@ -240,6 +240,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
240
240
  wasm.__externref_drop_slice(ptr, len);
241
241
  return result;
242
242
  }
243
+
244
+ export function callPendingEvents() {
245
+ wasm.callPendingEvents();
246
+ }
247
+
243
248
  /**
244
249
  * Get the version of Loro
245
250
  * @returns {string}
@@ -264,8 +269,29 @@ export function setDebug() {
264
269
  wasm.setDebug();
265
270
  }
266
271
 
267
- export function run() {
268
- wasm.run();
272
+ function passArrayJsValueToWasm0(array, malloc) {
273
+ const ptr = malloc(array.length * 4, 4) >>> 0;
274
+ for (let i = 0; i < array.length; i++) {
275
+ const add = addToExternrefTable0(array[i]);
276
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
277
+ }
278
+ WASM_VECTOR_LEN = array.length;
279
+ return ptr;
280
+ }
281
+ /**
282
+ * @param {({ peer: PeerID, counter: number })[]} frontiers
283
+ * @returns {Uint8Array}
284
+ */
285
+ export function encodeFrontiers(frontiers) {
286
+ const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
287
+ const len0 = WASM_VECTOR_LEN;
288
+ const ret = wasm.encodeFrontiers(ptr0, len0);
289
+ if (ret[3]) {
290
+ throw takeFromExternrefTable0(ret[2]);
291
+ }
292
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
293
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
294
+ return v2;
269
295
  }
270
296
 
271
297
  /**
@@ -282,6 +308,10 @@ export function decodeFrontiers(bytes) {
282
308
  return takeFromExternrefTable0(ret[0]);
283
309
  }
284
310
 
311
+ export function run() {
312
+ wasm.run();
313
+ }
314
+
285
315
  /**
286
316
  * Redacts sensitive content in JSON updates within the specified version range.
287
317
  *
@@ -337,41 +367,12 @@ export function decodeImportBlobMeta(blob, check_checksum) {
337
367
  return takeFromExternrefTable0(ret[0]);
338
368
  }
339
369
 
340
- function passArrayJsValueToWasm0(array, malloc) {
341
- const ptr = malloc(array.length * 4, 4) >>> 0;
342
- for (let i = 0; i < array.length; i++) {
343
- const add = addToExternrefTable0(array[i]);
344
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
345
- }
346
- WASM_VECTOR_LEN = array.length;
347
- return ptr;
348
- }
349
- /**
350
- * @param {({ peer: PeerID, counter: number })[]} frontiers
351
- * @returns {Uint8Array}
352
- */
353
- export function encodeFrontiers(frontiers) {
354
- const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
355
- const len0 = WASM_VECTOR_LEN;
356
- const ret = wasm.encodeFrontiers(ptr0, len0);
357
- if (ret[3]) {
358
- throw takeFromExternrefTable0(ret[2]);
359
- }
360
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
361
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
362
- return v2;
363
- }
364
-
365
- export function callPendingEvents() {
366
- wasm.callPendingEvents();
367
- }
368
-
369
370
  function __wbg_adapter_62(arg0, arg1, arg2) {
370
371
  wasm.closure11_externref_shim(arg0, arg1, arg2);
371
372
  }
372
373
 
373
374
  function __wbg_adapter_65(arg0, arg1) {
374
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h87f1268ec3b8423e(arg0, arg1);
375
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha7d67e25add7f151(arg0, arg1);
375
376
  }
376
377
 
377
378
  const AwarenessWasmFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -3903,6 +3904,25 @@ export class LoroText {
3903
3904
  throw takeFromExternrefTable0(ret[0]);
3904
3905
  }
3905
3906
  }
3907
+ /**
3908
+ * Convert a position between coordinate systems.
3909
+ *
3910
+ * Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
3911
+ *
3912
+ * Returns `undefined` when out of bounds or unsupported.
3913
+ * @param {number} index
3914
+ * @param {string} from
3915
+ * @param {string} to
3916
+ * @returns {any}
3917
+ */
3918
+ convertPos(index, from, to) {
3919
+ const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3920
+ const len0 = WASM_VECTOR_LEN;
3921
+ const ptr1 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3922
+ const len1 = WASM_VECTOR_LEN;
3923
+ const ret = wasm.lorotext_convertPos(this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
3924
+ return ret;
3925
+ }
3906
3926
  /**
3907
3927
  * Delete elements from index to utf-8 index + len
3908
3928
  *
@@ -5509,6 +5529,10 @@ export function __wbg_entries_c8a90a7ed73e84ce(arg0) {
5509
5529
  return ret;
5510
5530
  };
5511
5531
 
5532
+ export function __wbg_error_4ac2b4fe53215e85(arg0, arg1) {
5533
+ console.error(getStringFromWasm0(arg0, arg1));
5534
+ };
5535
+
5512
5536
  export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
5513
5537
  let deferred0_0;
5514
5538
  let deferred0_1;
@@ -5521,10 +5545,6 @@ export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
5521
5545
  }
5522
5546
  };
5523
5547
 
5524
- export function __wbg_error_d3c8fa5665ed2ac9(arg0, arg1) {
5525
- console.error(getStringFromWasm0(arg0, arg1));
5526
- };
5527
-
5528
5548
  export function __wbg_from_2a5d3e218e67aa85(arg0) {
5529
5549
  const ret = Array.from(arg0);
5530
5550
  return ret;
@@ -5640,7 +5660,7 @@ export function __wbg_log_0cc1b7768397bcfe(arg0, arg1, arg2, arg3, arg4, arg5, a
5640
5660
  }
5641
5661
  };
5642
5662
 
5643
- export function __wbg_log_5f802740a68181b2(arg0, arg1) {
5663
+ export function __wbg_log_bd9aa71b996755d3(arg0, arg1) {
5644
5664
  console.log(getStringFromWasm0(arg0, arg1));
5645
5665
  };
5646
5666
 
@@ -5890,7 +5910,7 @@ export function __wbg_versionvector_new(arg0) {
5890
5910
  return ret;
5891
5911
  };
5892
5912
 
5893
- export function __wbg_warn_13f0ef2de338c601(arg0, arg1) {
5913
+ export function __wbg_warn_ba32d63a72098111(arg0, arg1) {
5894
5914
  console.warn(getStringFromWasm0(arg0, arg1));
5895
5915
  };
5896
5916
 
@@ -5937,7 +5957,7 @@ export function __wbindgen_closure_wrapper718(arg0, arg1, arg2) {
5937
5957
  return ret;
5938
5958
  };
5939
5959
 
5940
- export function __wbindgen_closure_wrapper720(arg0, arg1, arg2) {
5960
+ export function __wbindgen_closure_wrapper721(arg0, arg1, arg2) {
5941
5961
  const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_65);
5942
5962
  return ret;
5943
5963
  };
Binary file
@@ -212,6 +212,7 @@ export const loromovablelist_toArray: (a: number) => [number, number];
212
212
  export const loromovablelist_toJSON: (a: number) => any;
213
213
  export const lorotext_applyDelta: (a: number, b: any) => [number, number];
214
214
  export const lorotext_charAt: (a: number, b: number) => [number, number, number];
215
+ export const lorotext_convertPos: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
215
216
  export const lorotext_delete: (a: number, b: number, c: number) => [number, number];
216
217
  export const lorotext_deleteUtf8: (a: number, b: number, c: number) => [number, number];
217
218
  export const lorotext_getAttached: (a: number) => any;
@@ -324,5 +325,5 @@ export const __wbindgen_export_6: WebAssembly.Table;
324
325
  export const __externref_table_dealloc: (a: number) => void;
325
326
  export const __externref_drop_slice: (a: number, b: number) => void;
326
327
  export const closure11_externref_shim: (a: number, b: number, c: any) => void;
327
- export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h87f1268ec3b8423e: (a: number, b: number) => void;
328
+ export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha7d67e25add7f151: (a: number, b: number) => void;
328
329
  export const __wbindgen_start: () => void;
@@ -1,5 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function callPendingEvents(): void;
3
4
  /**
4
5
  * Get the version of Loro
5
6
  */
@@ -8,8 +9,9 @@ export function LORO_VERSION(): string;
8
9
  * Enable debug info of Loro
9
10
  */
10
11
  export function setDebug(): void;
11
- export function run(): void;
12
+ export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
12
13
  export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
14
+ export function run(): void;
13
15
  /**
14
16
  * Redacts sensitive content in JSON updates within the specified version range.
15
17
  *
@@ -43,8 +45,6 @@ export function redactJsonUpdates(json_updates: string | JsonSchema, version_ran
43
45
  * - changeNum
44
46
  */
45
47
  export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
46
- export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
47
- export function callPendingEvents(): void;
48
48
 
49
49
  /**
50
50
  * Container types supported by loro.
@@ -63,6 +63,7 @@ export function callPendingEvents(): void;
63
63
  export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList" | "Counter";
64
64
 
65
65
  export type PeerID = `${number}`;
66
+ export type TextPosType = "unicode" | "utf16" | "utf8";
66
67
  /**
67
68
  * The unique id of each container.
68
69
  *
@@ -338,7 +339,7 @@ interface LoroDoc {
338
339
  export type Delta<T> =
339
340
  | {
340
341
  insert: T;
341
- attributes?: { [key in string]: {} };
342
+ attributes?: { [key in string]: Value };
342
343
  retain?: undefined;
343
344
  delete?: undefined;
344
345
  }
@@ -350,7 +351,7 @@ export type Delta<T> =
350
351
  }
351
352
  | {
352
353
  retain: number;
353
- attributes?: { [key in string]: {} };
354
+ attributes?: { [key in string]: Value };
354
355
  delete?: undefined;
355
356
  insert?: undefined;
356
357
  };
@@ -450,6 +451,11 @@ export interface ImportBlobMetadata {
450
451
  }
451
452
 
452
453
  interface LoroText {
454
+ /**
455
+ * Convert a position between coordinate systems.
456
+ */
457
+ convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
458
+
453
459
  /**
454
460
  * Get the cursor position at the given pos.
455
461
  *
@@ -1264,6 +1270,10 @@ interface LoroText {
1264
1270
  insert(pos: number, text: string): void;
1265
1271
  delete(pos: number, len: number): void;
1266
1272
  subscribe(listener: Listener): Subscription;
1273
+ /**
1274
+ * Convert a position between coordinate systems.
1275
+ */
1276
+ convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
1267
1277
  /**
1268
1278
  * Update the current text to the target text.
1269
1279
  *
@@ -3035,6 +3045,14 @@ export class LoroText {
3035
3045
  * ```
3036
3046
  */
3037
3047
  applyDelta(delta: Delta<string>[]): void;
3048
+ /**
3049
+ * Convert a position between coordinate systems.
3050
+ *
3051
+ * Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
3052
+ *
3053
+ * Returns `undefined` when out of bounds or unsupported.
3054
+ */
3055
+ convertPos(index: number, from: string, to: string): any;
3038
3056
  /**
3039
3057
  * Delete elements from index to utf-8 index + len
3040
3058
  *
@@ -236,6 +236,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
236
236
  wasm.__externref_drop_slice(ptr, len);
237
237
  return result;
238
238
  }
239
+
240
+ module.exports.callPendingEvents = function() {
241
+ wasm.callPendingEvents();
242
+ };
243
+
239
244
  /**
240
245
  * Get the version of Loro
241
246
  * @returns {string}
@@ -260,8 +265,29 @@ module.exports.setDebug = function() {
260
265
  wasm.setDebug();
261
266
  };
262
267
 
263
- module.exports.run = function() {
264
- wasm.run();
268
+ function passArrayJsValueToWasm0(array, malloc) {
269
+ const ptr = malloc(array.length * 4, 4) >>> 0;
270
+ for (let i = 0; i < array.length; i++) {
271
+ const add = addToExternrefTable0(array[i]);
272
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
273
+ }
274
+ WASM_VECTOR_LEN = array.length;
275
+ return ptr;
276
+ }
277
+ /**
278
+ * @param {({ peer: PeerID, counter: number })[]} frontiers
279
+ * @returns {Uint8Array}
280
+ */
281
+ module.exports.encodeFrontiers = function(frontiers) {
282
+ const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
283
+ const len0 = WASM_VECTOR_LEN;
284
+ const ret = wasm.encodeFrontiers(ptr0, len0);
285
+ if (ret[3]) {
286
+ throw takeFromExternrefTable0(ret[2]);
287
+ }
288
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
289
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
290
+ return v2;
265
291
  };
266
292
 
267
293
  /**
@@ -278,6 +304,10 @@ module.exports.decodeFrontiers = function(bytes) {
278
304
  return takeFromExternrefTable0(ret[0]);
279
305
  };
280
306
 
307
+ module.exports.run = function() {
308
+ wasm.run();
309
+ };
310
+
281
311
  /**
282
312
  * Redacts sensitive content in JSON updates within the specified version range.
283
313
  *
@@ -333,41 +363,12 @@ module.exports.decodeImportBlobMeta = function(blob, check_checksum) {
333
363
  return takeFromExternrefTable0(ret[0]);
334
364
  };
335
365
 
336
- function passArrayJsValueToWasm0(array, malloc) {
337
- const ptr = malloc(array.length * 4, 4) >>> 0;
338
- for (let i = 0; i < array.length; i++) {
339
- const add = addToExternrefTable0(array[i]);
340
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
341
- }
342
- WASM_VECTOR_LEN = array.length;
343
- return ptr;
344
- }
345
- /**
346
- * @param {({ peer: PeerID, counter: number })[]} frontiers
347
- * @returns {Uint8Array}
348
- */
349
- module.exports.encodeFrontiers = function(frontiers) {
350
- const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
351
- const len0 = WASM_VECTOR_LEN;
352
- const ret = wasm.encodeFrontiers(ptr0, len0);
353
- if (ret[3]) {
354
- throw takeFromExternrefTable0(ret[2]);
355
- }
356
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
357
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
358
- return v2;
359
- };
360
-
361
- module.exports.callPendingEvents = function() {
362
- wasm.callPendingEvents();
363
- };
364
-
365
366
  function __wbg_adapter_62(arg0, arg1, arg2) {
366
367
  wasm.closure11_externref_shim(arg0, arg1, arg2);
367
368
  }
368
369
 
369
370
  function __wbg_adapter_65(arg0, arg1) {
370
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h87f1268ec3b8423e(arg0, arg1);
371
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha7d67e25add7f151(arg0, arg1);
371
372
  }
372
373
 
373
374
  const AwarenessWasmFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -3908,6 +3909,25 @@ class LoroText {
3908
3909
  throw takeFromExternrefTable0(ret[0]);
3909
3910
  }
3910
3911
  }
3912
+ /**
3913
+ * Convert a position between coordinate systems.
3914
+ *
3915
+ * Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
3916
+ *
3917
+ * Returns `undefined` when out of bounds or unsupported.
3918
+ * @param {number} index
3919
+ * @param {string} from
3920
+ * @param {string} to
3921
+ * @returns {any}
3922
+ */
3923
+ convertPos(index, from, to) {
3924
+ const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3925
+ const len0 = WASM_VECTOR_LEN;
3926
+ const ptr1 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3927
+ const len1 = WASM_VECTOR_LEN;
3928
+ const ret = wasm.lorotext_convertPos(this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
3929
+ return ret;
3930
+ }
3911
3931
  /**
3912
3932
  * Delete elements from index to utf-8 index + len
3913
3933
  *
@@ -5519,6 +5539,10 @@ module.exports.__wbg_entries_c8a90a7ed73e84ce = function(arg0) {
5519
5539
  return ret;
5520
5540
  };
5521
5541
 
5542
+ module.exports.__wbg_error_4ac2b4fe53215e85 = function(arg0, arg1) {
5543
+ console.error(getStringFromWasm0(arg0, arg1));
5544
+ };
5545
+
5522
5546
  module.exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
5523
5547
  let deferred0_0;
5524
5548
  let deferred0_1;
@@ -5531,10 +5555,6 @@ module.exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
5531
5555
  }
5532
5556
  };
5533
5557
 
5534
- module.exports.__wbg_error_d3c8fa5665ed2ac9 = function(arg0, arg1) {
5535
- console.error(getStringFromWasm0(arg0, arg1));
5536
- };
5537
-
5538
5558
  module.exports.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
5539
5559
  const ret = Array.from(arg0);
5540
5560
  return ret;
@@ -5650,7 +5670,7 @@ module.exports.__wbg_log_0cc1b7768397bcfe = function(arg0, arg1, arg2, arg3, arg
5650
5670
  }
5651
5671
  };
5652
5672
 
5653
- module.exports.__wbg_log_5f802740a68181b2 = function(arg0, arg1) {
5673
+ module.exports.__wbg_log_bd9aa71b996755d3 = function(arg0, arg1) {
5654
5674
  console.log(getStringFromWasm0(arg0, arg1));
5655
5675
  };
5656
5676
 
@@ -5900,7 +5920,7 @@ module.exports.__wbg_versionvector_new = function(arg0) {
5900
5920
  return ret;
5901
5921
  };
5902
5922
 
5903
- module.exports.__wbg_warn_13f0ef2de338c601 = function(arg0, arg1) {
5923
+ module.exports.__wbg_warn_ba32d63a72098111 = function(arg0, arg1) {
5904
5924
  console.warn(getStringFromWasm0(arg0, arg1));
5905
5925
  };
5906
5926
 
@@ -5947,7 +5967,7 @@ module.exports.__wbindgen_closure_wrapper718 = function(arg0, arg1, arg2) {
5947
5967
  return ret;
5948
5968
  };
5949
5969
 
5950
- module.exports.__wbindgen_closure_wrapper720 = function(arg0, arg1, arg2) {
5970
+ module.exports.__wbindgen_closure_wrapper721 = function(arg0, arg1, arg2) {
5951
5971
  const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_65);
5952
5972
  return ret;
5953
5973
  };
Binary file
@@ -212,6 +212,7 @@ export const loromovablelist_toArray: (a: number) => [number, number];
212
212
  export const loromovablelist_toJSON: (a: number) => any;
213
213
  export const lorotext_applyDelta: (a: number, b: any) => [number, number];
214
214
  export const lorotext_charAt: (a: number, b: number) => [number, number, number];
215
+ export const lorotext_convertPos: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
215
216
  export const lorotext_delete: (a: number, b: number, c: number) => [number, number];
216
217
  export const lorotext_deleteUtf8: (a: number, b: number, c: number) => [number, number];
217
218
  export const lorotext_getAttached: (a: number) => any;
@@ -324,5 +325,5 @@ export const __wbindgen_export_6: WebAssembly.Table;
324
325
  export const __externref_table_dealloc: (a: number) => void;
325
326
  export const __externref_drop_slice: (a: number, b: number) => void;
326
327
  export const closure11_externref_shim: (a: number, b: number, c: any) => void;
327
- export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h87f1268ec3b8423e: (a: number, b: number) => void;
328
+ export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha7d67e25add7f151: (a: number, b: number) => void;
328
329
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loro-crdt",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
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",