loro-crdt 1.10.1 → 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.
@@ -236,6 +236,78 @@ 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
+
244
+ /**
245
+ * Get the version of Loro
246
+ * @returns {string}
247
+ */
248
+ module.exports.LORO_VERSION = function() {
249
+ let deferred1_0;
250
+ let deferred1_1;
251
+ try {
252
+ const ret = wasm.LORO_VERSION();
253
+ deferred1_0 = ret[0];
254
+ deferred1_1 = ret[1];
255
+ return getStringFromWasm0(ret[0], ret[1]);
256
+ } finally {
257
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
258
+ }
259
+ };
260
+
261
+ /**
262
+ * Enable debug info of Loro
263
+ */
264
+ module.exports.setDebug = function() {
265
+ wasm.setDebug();
266
+ };
267
+
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;
291
+ };
292
+
293
+ /**
294
+ * @param {Uint8Array} bytes
295
+ * @returns {{ peer: PeerID, counter: number }[]}
296
+ */
297
+ module.exports.decodeFrontiers = function(bytes) {
298
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
299
+ const len0 = WASM_VECTOR_LEN;
300
+ const ret = wasm.decodeFrontiers(ptr0, len0);
301
+ if (ret[2]) {
302
+ throw takeFromExternrefTable0(ret[1]);
303
+ }
304
+ return takeFromExternrefTable0(ret[0]);
305
+ };
306
+
307
+ module.exports.run = function() {
308
+ wasm.run();
309
+ };
310
+
239
311
  /**
240
312
  * Redacts sensitive content in JSON updates within the specified version range.
241
313
  *
@@ -291,83 +363,12 @@ module.exports.decodeImportBlobMeta = function(blob, check_checksum) {
291
363
  return takeFromExternrefTable0(ret[0]);
292
364
  };
293
365
 
294
- /**
295
- * @param {Uint8Array} bytes
296
- * @returns {{ peer: PeerID, counter: number }[]}
297
- */
298
- module.exports.decodeFrontiers = function(bytes) {
299
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
300
- const len0 = WASM_VECTOR_LEN;
301
- const ret = wasm.decodeFrontiers(ptr0, len0);
302
- if (ret[2]) {
303
- throw takeFromExternrefTable0(ret[1]);
304
- }
305
- return takeFromExternrefTable0(ret[0]);
306
- };
307
-
308
- module.exports.run = function() {
309
- wasm.run();
310
- };
311
-
312
- function passArrayJsValueToWasm0(array, malloc) {
313
- const ptr = malloc(array.length * 4, 4) >>> 0;
314
- for (let i = 0; i < array.length; i++) {
315
- const add = addToExternrefTable0(array[i]);
316
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
317
- }
318
- WASM_VECTOR_LEN = array.length;
319
- return ptr;
320
- }
321
- /**
322
- * @param {({ peer: PeerID, counter: number })[]} frontiers
323
- * @returns {Uint8Array}
324
- */
325
- module.exports.encodeFrontiers = function(frontiers) {
326
- const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
327
- const len0 = WASM_VECTOR_LEN;
328
- const ret = wasm.encodeFrontiers(ptr0, len0);
329
- if (ret[3]) {
330
- throw takeFromExternrefTable0(ret[2]);
331
- }
332
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
333
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
334
- return v2;
335
- };
336
-
337
- /**
338
- * Enable debug info of Loro
339
- */
340
- module.exports.setDebug = function() {
341
- wasm.setDebug();
342
- };
343
-
344
- module.exports.callPendingEvents = function() {
345
- wasm.callPendingEvents();
346
- };
347
-
348
- /**
349
- * Get the version of Loro
350
- * @returns {string}
351
- */
352
- module.exports.LORO_VERSION = function() {
353
- let deferred1_0;
354
- let deferred1_1;
355
- try {
356
- const ret = wasm.LORO_VERSION();
357
- deferred1_0 = ret[0];
358
- deferred1_1 = ret[1];
359
- return getStringFromWasm0(ret[0], ret[1]);
360
- } finally {
361
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
362
- }
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__hb782650185ad08f4(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_f6ddbf3300c73fe1 = 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_3c0d0f235e1c209c = 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_e3fad33818dd84d2 = 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__hb782650185ad08f4: (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.1",
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",
@@ -1,5 +1,17 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function callPendingEvents(): void;
4
+ /**
5
+ * Get the version of Loro
6
+ */
7
+ export function LORO_VERSION(): string;
8
+ /**
9
+ * Enable debug info of Loro
10
+ */
11
+ export function setDebug(): void;
12
+ export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
13
+ export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
14
+ export function run(): void;
3
15
  /**
4
16
  * Redacts sensitive content in JSON updates within the specified version range.
5
17
  *
@@ -33,18 +45,6 @@ export function redactJsonUpdates(json_updates: string | JsonSchema, version_ran
33
45
  * - changeNum
34
46
  */
35
47
  export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
36
- export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
37
- export function run(): void;
38
- export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
39
- /**
40
- * Enable debug info of Loro
41
- */
42
- export function setDebug(): void;
43
- export function callPendingEvents(): void;
44
- /**
45
- * Get the version of Loro
46
- */
47
- export function LORO_VERSION(): string;
48
48
 
49
49
  /**
50
50
  * Container types supported by loro.
@@ -63,6 +63,7 @@ export function LORO_VERSION(): string;
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
  *
@@ -3905,6 +3923,7 @@ export interface InitOutput {
3905
3923
  readonly loromovablelist_toJSON: (a: number) => any;
3906
3924
  readonly lorotext_applyDelta: (a: number, b: any) => [number, number];
3907
3925
  readonly lorotext_charAt: (a: number, b: number) => [number, number, number];
3926
+ readonly lorotext_convertPos: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
3908
3927
  readonly lorotext_delete: (a: number, b: number, c: number) => [number, number];
3909
3928
  readonly lorotext_deleteUtf8: (a: number, b: number, c: number) => [number, number];
3910
3929
  readonly lorotext_getAttached: (a: number) => any;
@@ -4017,7 +4036,7 @@ export interface InitOutput {
4017
4036
  readonly __externref_table_dealloc: (a: number) => void;
4018
4037
  readonly __externref_drop_slice: (a: number, b: number) => void;
4019
4038
  readonly closure11_externref_shim: (a: number, b: number, c: any) => void;
4020
- readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb782650185ad08f4: (a: number, b: number) => void;
4039
+ readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha7d67e25add7f151: (a: number, b: number) => void;
4021
4040
  readonly __wbindgen_start: () => void;
4022
4041
  }
4023
4042
 
package/web/loro_wasm.js CHANGED
@@ -232,6 +232,78 @@ function getArrayJsValueFromWasm0(ptr, len) {
232
232
  wasm.__externref_drop_slice(ptr, len);
233
233
  return result;
234
234
  }
235
+
236
+ export function callPendingEvents() {
237
+ wasm.callPendingEvents();
238
+ }
239
+
240
+ /**
241
+ * Get the version of Loro
242
+ * @returns {string}
243
+ */
244
+ export function LORO_VERSION() {
245
+ let deferred1_0;
246
+ let deferred1_1;
247
+ try {
248
+ const ret = wasm.LORO_VERSION();
249
+ deferred1_0 = ret[0];
250
+ deferred1_1 = ret[1];
251
+ return getStringFromWasm0(ret[0], ret[1]);
252
+ } finally {
253
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
254
+ }
255
+ }
256
+
257
+ /**
258
+ * Enable debug info of Loro
259
+ */
260
+ export function setDebug() {
261
+ wasm.setDebug();
262
+ }
263
+
264
+ function passArrayJsValueToWasm0(array, malloc) {
265
+ const ptr = malloc(array.length * 4, 4) >>> 0;
266
+ for (let i = 0; i < array.length; i++) {
267
+ const add = addToExternrefTable0(array[i]);
268
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
269
+ }
270
+ WASM_VECTOR_LEN = array.length;
271
+ return ptr;
272
+ }
273
+ /**
274
+ * @param {({ peer: PeerID, counter: number })[]} frontiers
275
+ * @returns {Uint8Array}
276
+ */
277
+ export function encodeFrontiers(frontiers) {
278
+ const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
279
+ const len0 = WASM_VECTOR_LEN;
280
+ const ret = wasm.encodeFrontiers(ptr0, len0);
281
+ if (ret[3]) {
282
+ throw takeFromExternrefTable0(ret[2]);
283
+ }
284
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
285
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
286
+ return v2;
287
+ }
288
+
289
+ /**
290
+ * @param {Uint8Array} bytes
291
+ * @returns {{ peer: PeerID, counter: number }[]}
292
+ */
293
+ export function decodeFrontiers(bytes) {
294
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
295
+ const len0 = WASM_VECTOR_LEN;
296
+ const ret = wasm.decodeFrontiers(ptr0, len0);
297
+ if (ret[2]) {
298
+ throw takeFromExternrefTable0(ret[1]);
299
+ }
300
+ return takeFromExternrefTable0(ret[0]);
301
+ }
302
+
303
+ export function run() {
304
+ wasm.run();
305
+ }
306
+
235
307
  /**
236
308
  * Redacts sensitive content in JSON updates within the specified version range.
237
309
  *
@@ -287,83 +359,12 @@ export function decodeImportBlobMeta(blob, check_checksum) {
287
359
  return takeFromExternrefTable0(ret[0]);
288
360
  }
289
361
 
290
- /**
291
- * @param {Uint8Array} bytes
292
- * @returns {{ peer: PeerID, counter: number }[]}
293
- */
294
- export function decodeFrontiers(bytes) {
295
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
296
- const len0 = WASM_VECTOR_LEN;
297
- const ret = wasm.decodeFrontiers(ptr0, len0);
298
- if (ret[2]) {
299
- throw takeFromExternrefTable0(ret[1]);
300
- }
301
- return takeFromExternrefTable0(ret[0]);
302
- }
303
-
304
- export function run() {
305
- wasm.run();
306
- }
307
-
308
- function passArrayJsValueToWasm0(array, malloc) {
309
- const ptr = malloc(array.length * 4, 4) >>> 0;
310
- for (let i = 0; i < array.length; i++) {
311
- const add = addToExternrefTable0(array[i]);
312
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
313
- }
314
- WASM_VECTOR_LEN = array.length;
315
- return ptr;
316
- }
317
- /**
318
- * @param {({ peer: PeerID, counter: number })[]} frontiers
319
- * @returns {Uint8Array}
320
- */
321
- export function encodeFrontiers(frontiers) {
322
- const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
323
- const len0 = WASM_VECTOR_LEN;
324
- const ret = wasm.encodeFrontiers(ptr0, len0);
325
- if (ret[3]) {
326
- throw takeFromExternrefTable0(ret[2]);
327
- }
328
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
329
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
330
- return v2;
331
- }
332
-
333
- /**
334
- * Enable debug info of Loro
335
- */
336
- export function setDebug() {
337
- wasm.setDebug();
338
- }
339
-
340
- export function callPendingEvents() {
341
- wasm.callPendingEvents();
342
- }
343
-
344
- /**
345
- * Get the version of Loro
346
- * @returns {string}
347
- */
348
- export function LORO_VERSION() {
349
- let deferred1_0;
350
- let deferred1_1;
351
- try {
352
- const ret = wasm.LORO_VERSION();
353
- deferred1_0 = ret[0];
354
- deferred1_1 = ret[1];
355
- return getStringFromWasm0(ret[0], ret[1]);
356
- } finally {
357
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
358
- }
359
- }
360
-
361
362
  function __wbg_adapter_62(arg0, arg1, arg2) {
362
363
  wasm.closure11_externref_shim(arg0, arg1, arg2);
363
364
  }
364
365
 
365
366
  function __wbg_adapter_65(arg0, arg1) {
366
- wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb782650185ad08f4(arg0, arg1);
367
+ wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha7d67e25add7f151(arg0, arg1);
367
368
  }
368
369
 
369
370
  const AwarenessWasmFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -3895,6 +3896,25 @@ export class LoroText {
3895
3896
  throw takeFromExternrefTable0(ret[0]);
3896
3897
  }
3897
3898
  }
3899
+ /**
3900
+ * Convert a position between coordinate systems.
3901
+ *
3902
+ * Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
3903
+ *
3904
+ * Returns `undefined` when out of bounds or unsupported.
3905
+ * @param {number} index
3906
+ * @param {string} from
3907
+ * @param {string} to
3908
+ * @returns {any}
3909
+ */
3910
+ convertPos(index, from, to) {
3911
+ const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3912
+ const len0 = WASM_VECTOR_LEN;
3913
+ const ptr1 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3914
+ const len1 = WASM_VECTOR_LEN;
3915
+ const ret = wasm.lorotext_convertPos(this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
3916
+ return ret;
3917
+ }
3898
3918
  /**
3899
3919
  * Delete elements from index to utf-8 index + len
3900
3920
  *
@@ -5521,6 +5541,9 @@ function __wbg_get_imports() {
5521
5541
  const ret = arg0.entries();
5522
5542
  return ret;
5523
5543
  };
5544
+ imports.wbg.__wbg_error_4ac2b4fe53215e85 = function(arg0, arg1) {
5545
+ console.error(getStringFromWasm0(arg0, arg1));
5546
+ };
5524
5547
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
5525
5548
  let deferred0_0;
5526
5549
  let deferred0_1;
@@ -5532,9 +5555,6 @@ function __wbg_get_imports() {
5532
5555
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5533
5556
  }
5534
5557
  };
5535
- imports.wbg.__wbg_error_f6ddbf3300c73fe1 = function(arg0, arg1) {
5536
- console.error(getStringFromWasm0(arg0, arg1));
5537
- };
5538
5558
  imports.wbg.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
5539
5559
  const ret = Array.from(arg0);
5540
5560
  return ret;
@@ -5633,7 +5653,7 @@ function __wbg_get_imports() {
5633
5653
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5634
5654
  }
5635
5655
  };
5636
- imports.wbg.__wbg_log_3c0d0f235e1c209c = function(arg0, arg1) {
5656
+ imports.wbg.__wbg_log_bd9aa71b996755d3 = function(arg0, arg1) {
5637
5657
  console.log(getStringFromWasm0(arg0, arg1));
5638
5658
  };
5639
5659
  imports.wbg.__wbg_log_cb9e190acc5753fb = function(arg0, arg1) {
@@ -5836,7 +5856,7 @@ function __wbg_get_imports() {
5836
5856
  const ret = VersionVector.__wrap(arg0);
5837
5857
  return ret;
5838
5858
  };
5839
- imports.wbg.__wbg_warn_e3fad33818dd84d2 = function(arg0, arg1) {
5859
+ imports.wbg.__wbg_warn_ba32d63a72098111 = function(arg0, arg1) {
5840
5860
  console.warn(getStringFromWasm0(arg0, arg1));
5841
5861
  };
5842
5862
  imports.wbg.__wbindgen_as_number = function(arg0) {
@@ -5875,7 +5895,7 @@ function __wbg_get_imports() {
5875
5895
  const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_62);
5876
5896
  return ret;
5877
5897
  };
5878
- imports.wbg.__wbindgen_closure_wrapper720 = function(arg0, arg1, arg2) {
5898
+ imports.wbg.__wbindgen_closure_wrapper721 = function(arg0, arg1, arg2) {
5879
5899
  const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_65);
5880
5900
  return ret;
5881
5901
  };
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__hb782650185ad08f4: (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;