loro-crdt 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/base64/index.js +50 -40
- package/base64/loro_wasm.d.ts +24 -12
- package/base64/loro_wasm_bg-9dd33f4d.js +64 -0
- package/bundler/loro_wasm.d.ts +24 -12
- package/bundler/loro_wasm_bg.js +43 -33
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +3 -2
- package/nodejs/loro_wasm.d.ts +24 -12
- package/nodejs/loro_wasm.js +43 -33
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +3 -2
- package/package.json +1 -1
- package/web/loro_wasm.d.ts +27 -14
- package/web/loro_wasm.js +43 -33
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +3 -2
- package/base64/loro_wasm_bg-b0221709.js +0 -64
package/bundler/loro_wasm.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean):
|
|
|
48
48
|
* const text = list.insertContainer(1, new LoroText());
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList";
|
|
51
|
+
export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList" | "Counter";
|
|
52
52
|
|
|
53
53
|
export type PeerID = `${number}`;
|
|
54
54
|
/**
|
|
@@ -292,7 +292,7 @@ export type UndoConfig = {
|
|
|
292
292
|
onPush?: (isUndo: boolean, counterRange: { start: number, end: number }, event?: LoroEventBatch) => { value: Value, cursors: Cursor[] },
|
|
293
293
|
onPop?: (isUndo: boolean, value: { value: Value, cursors: Cursor[] }, counterRange: { start: number, end: number }) => void
|
|
294
294
|
};
|
|
295
|
-
export type Container = LoroList | LoroMap | LoroText | LoroTree | LoroMovableList;
|
|
295
|
+
export type Container = LoroList | LoroMap | LoroText | LoroTree | LoroMovableList | LoroCounter;
|
|
296
296
|
|
|
297
297
|
export interface ImportBlobMetadata {
|
|
298
298
|
/**
|
|
@@ -1023,6 +1023,7 @@ interface LoroMovableList<T = unknown> {
|
|
|
1023
1023
|
*/
|
|
1024
1024
|
setContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
|
|
1025
1025
|
}
|
|
1026
|
+
|
|
1026
1027
|
interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
1027
1028
|
new(): LoroMap<T>;
|
|
1028
1029
|
/**
|
|
@@ -1076,9 +1077,13 @@ interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
|
1076
1077
|
*/
|
|
1077
1078
|
get<Key extends keyof T>(key: Key): T[Key];
|
|
1078
1079
|
/**
|
|
1079
|
-
*
|
|
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
|
-
*
|
|
1085
|
+
* > **Note**: When calling `map.set(key, value)` on a LoroMap, if `map.get(key)` already returns `value`,
|
|
1086
|
+
* > the operation will be a no-op (no operation recorded) to avoid unnecessary updates.
|
|
1082
1087
|
*
|
|
1083
1088
|
* @example
|
|
1084
1089
|
* ```ts
|
|
@@ -1155,7 +1160,7 @@ interface LoroTree<T extends Record<string, unknown> = Record<string, unknown>>
|
|
|
1155
1160
|
/**
|
|
1156
1161
|
* Get LoroTreeNode by the TreeID.
|
|
1157
1162
|
*/
|
|
1158
|
-
getNodeByID(target: TreeID): LoroTreeNode<T
|
|
1163
|
+
getNodeByID(target: TreeID): LoroTreeNode<T> | undefined;
|
|
1159
1164
|
subscribe(listener: Listener): Subscription;
|
|
1160
1165
|
toArray(): TreeNodeValue[];
|
|
1161
1166
|
getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode<T>[];
|
|
@@ -1378,7 +1383,7 @@ export class Cursor {
|
|
|
1378
1383
|
kind(): any;
|
|
1379
1384
|
}
|
|
1380
1385
|
/**
|
|
1381
|
-
* The handler of a
|
|
1386
|
+
* The handler of a counter container.
|
|
1382
1387
|
*/
|
|
1383
1388
|
export class LoroCounter {
|
|
1384
1389
|
free(): void;
|
|
@@ -1387,6 +1392,11 @@ export class LoroCounter {
|
|
|
1387
1392
|
*/
|
|
1388
1393
|
constructor();
|
|
1389
1394
|
/**
|
|
1395
|
+
* "Counter"
|
|
1396
|
+
* @returns {'Counter'}
|
|
1397
|
+
*/
|
|
1398
|
+
kind(): 'Counter';
|
|
1399
|
+
/**
|
|
1390
1400
|
* Increment the counter by the given value.
|
|
1391
1401
|
* @param {number} value
|
|
1392
1402
|
*/
|
|
@@ -1431,6 +1441,10 @@ export class LoroCounter {
|
|
|
1431
1441
|
*/
|
|
1432
1442
|
getShallowValue(): number;
|
|
1433
1443
|
/**
|
|
1444
|
+
* The container id of this handler.
|
|
1445
|
+
*/
|
|
1446
|
+
readonly id: ContainerID;
|
|
1447
|
+
/**
|
|
1434
1448
|
* Get the value of the counter.
|
|
1435
1449
|
*/
|
|
1436
1450
|
readonly value: number;
|
|
@@ -1440,6 +1454,10 @@ export class LoroCounter {
|
|
|
1440
1454
|
* [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
|
|
1441
1455
|
* you could build all kind of applications by these.
|
|
1442
1456
|
*
|
|
1457
|
+
* **Important:** Loro is a pure library and does not handle network protocols.
|
|
1458
|
+
* It is the responsibility of the user to manage the storage, loading, and synchronization
|
|
1459
|
+
* of the bytes exported by Loro in a manner suitable for their specific environment.
|
|
1460
|
+
*
|
|
1443
1461
|
* @example
|
|
1444
1462
|
* ```ts
|
|
1445
1463
|
* import { LoroDoc } from "loro-crdt"
|
|
@@ -3498,12 +3516,6 @@ export class UndoManager {
|
|
|
3498
3516
|
*/
|
|
3499
3517
|
addExcludeOriginPrefix(prefix: string): void;
|
|
3500
3518
|
/**
|
|
3501
|
-
* Check if the undo manager is bound to the given document.
|
|
3502
|
-
* @param {LoroDoc} doc
|
|
3503
|
-
* @returns {boolean}
|
|
3504
|
-
*/
|
|
3505
|
-
checkBinding(doc: LoroDoc): boolean;
|
|
3506
|
-
/**
|
|
3507
3519
|
*/
|
|
3508
3520
|
clear(): void;
|
|
3509
3521
|
}
|
package/bundler/loro_wasm_bg.js
CHANGED
|
@@ -736,7 +736,7 @@ const LoroCounterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
736
736
|
? { register: () => {}, unregister: () => {} }
|
|
737
737
|
: new FinalizationRegistry(ptr => wasm.__wbg_lorocounter_free(ptr >>> 0));
|
|
738
738
|
/**
|
|
739
|
-
* The handler of a
|
|
739
|
+
* The handler of a counter container.
|
|
740
740
|
*/
|
|
741
741
|
export class LoroCounter {
|
|
742
742
|
|
|
@@ -768,6 +768,22 @@ export class LoroCounter {
|
|
|
768
768
|
return this;
|
|
769
769
|
}
|
|
770
770
|
/**
|
|
771
|
+
* "Counter"
|
|
772
|
+
* @returns {'Counter'}
|
|
773
|
+
*/
|
|
774
|
+
kind() {
|
|
775
|
+
const ret = wasm.lorocounter_kind(this.__wbg_ptr);
|
|
776
|
+
return takeObject(ret);
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* The container id of this handler.
|
|
780
|
+
* @returns {ContainerID}
|
|
781
|
+
*/
|
|
782
|
+
get id() {
|
|
783
|
+
const ret = wasm.lorocounter_id(this.__wbg_ptr);
|
|
784
|
+
return takeObject(ret);
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
771
787
|
* Increment the counter by the given value.
|
|
772
788
|
* @param {number} value
|
|
773
789
|
*/
|
|
@@ -879,6 +895,10 @@ const LoroDocFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
879
895
|
* [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
|
|
880
896
|
* you could build all kind of applications by these.
|
|
881
897
|
*
|
|
898
|
+
* **Important:** Loro is a pure library and does not handle network protocols.
|
|
899
|
+
* It is the responsibility of the user to manage the storage, loading, and synchronization
|
|
900
|
+
* of the bytes exported by Loro in a manner suitable for their specific environment.
|
|
901
|
+
*
|
|
882
902
|
* @example
|
|
883
903
|
* ```ts
|
|
884
904
|
* import { LoroDoc } from "loro-crdt"
|
|
@@ -2095,7 +2115,7 @@ export class LoroDoc {
|
|
|
2095
2115
|
importUpdateBatch(data) {
|
|
2096
2116
|
try {
|
|
2097
2117
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2098
|
-
wasm.
|
|
2118
|
+
wasm.lorodoc_importBatch(retptr, this.__wbg_ptr, addHeapObject(data));
|
|
2099
2119
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2100
2120
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2101
2121
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -5723,16 +5743,6 @@ export class UndoManager {
|
|
|
5723
5743
|
wasm.undomanager_addExcludeOriginPrefix(this.__wbg_ptr, ptr0, len0);
|
|
5724
5744
|
}
|
|
5725
5745
|
/**
|
|
5726
|
-
* Check if the undo manager is bound to the given document.
|
|
5727
|
-
* @param {LoroDoc} doc
|
|
5728
|
-
* @returns {boolean}
|
|
5729
|
-
*/
|
|
5730
|
-
checkBinding(doc) {
|
|
5731
|
-
_assertClass(doc, LoroDoc);
|
|
5732
|
-
const ret = wasm.undomanager_checkBinding(this.__wbg_ptr, doc.__wbg_ptr);
|
|
5733
|
-
return ret !== 0;
|
|
5734
|
-
}
|
|
5735
|
-
/**
|
|
5736
5746
|
* Set the on push event listener.
|
|
5737
5747
|
*
|
|
5738
5748
|
* Every time an undo step or redo step is pushed, the on push event listener will be called.
|
|
@@ -5978,8 +5988,8 @@ export function __wbindgen_object_drop_ref(arg0) {
|
|
|
5978
5988
|
takeObject(arg0);
|
|
5979
5989
|
};
|
|
5980
5990
|
|
|
5981
|
-
export function
|
|
5982
|
-
const ret =
|
|
5991
|
+
export function __wbg_lorotreenode_new(arg0) {
|
|
5992
|
+
const ret = LoroTreeNode.__wrap(arg0);
|
|
5983
5993
|
return addHeapObject(ret);
|
|
5984
5994
|
};
|
|
5985
5995
|
|
|
@@ -5988,33 +5998,33 @@ export function __wbg_lorocounter_new(arg0) {
|
|
|
5988
5998
|
return addHeapObject(ret);
|
|
5989
5999
|
};
|
|
5990
6000
|
|
|
5991
|
-
export function
|
|
5992
|
-
const ret =
|
|
6001
|
+
export function __wbg_lorotext_new(arg0) {
|
|
6002
|
+
const ret = LoroText.__wrap(arg0);
|
|
5993
6003
|
return addHeapObject(ret);
|
|
5994
6004
|
};
|
|
5995
6005
|
|
|
5996
|
-
export function
|
|
5997
|
-
const ret =
|
|
6006
|
+
export function __wbg_lorolist_new(arg0) {
|
|
6007
|
+
const ret = LoroList.__wrap(arg0);
|
|
5998
6008
|
return addHeapObject(ret);
|
|
5999
6009
|
};
|
|
6000
6010
|
|
|
6001
|
-
export function
|
|
6002
|
-
const ret =
|
|
6011
|
+
export function __wbg_loromap_new(arg0) {
|
|
6012
|
+
const ret = LoroMap.__wrap(arg0);
|
|
6003
6013
|
return addHeapObject(ret);
|
|
6004
6014
|
};
|
|
6005
6015
|
|
|
6006
|
-
export function
|
|
6007
|
-
const ret =
|
|
6016
|
+
export function __wbg_cursor_new(arg0) {
|
|
6017
|
+
const ret = Cursor.__wrap(arg0);
|
|
6008
6018
|
return addHeapObject(ret);
|
|
6009
6019
|
};
|
|
6010
6020
|
|
|
6011
|
-
export function
|
|
6012
|
-
const ret =
|
|
6021
|
+
export function __wbg_loromovablelist_new(arg0) {
|
|
6022
|
+
const ret = LoroMovableList.__wrap(arg0);
|
|
6013
6023
|
return addHeapObject(ret);
|
|
6014
6024
|
};
|
|
6015
6025
|
|
|
6016
|
-
export function
|
|
6017
|
-
const ret =
|
|
6026
|
+
export function __wbg_lorotree_new(arg0) {
|
|
6027
|
+
const ret = LoroTree.__wrap(arg0);
|
|
6018
6028
|
return addHeapObject(ret);
|
|
6019
6029
|
};
|
|
6020
6030
|
|
|
@@ -6141,11 +6151,11 @@ export function __wbindgen_typeof(arg0) {
|
|
|
6141
6151
|
return addHeapObject(ret);
|
|
6142
6152
|
};
|
|
6143
6153
|
|
|
6144
|
-
export function
|
|
6154
|
+
export function __wbg_error_9384d761bf46409d(arg0, arg1) {
|
|
6145
6155
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
6146
6156
|
};
|
|
6147
6157
|
|
|
6148
|
-
export function
|
|
6158
|
+
export function __wbg_log_c86c3e1bf097ba35(arg0, arg1) {
|
|
6149
6159
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
6150
6160
|
};
|
|
6151
6161
|
|
|
@@ -6246,7 +6256,7 @@ export function __wbg_error_f851667af71bcfc6(arg0, arg1) {
|
|
|
6246
6256
|
}
|
|
6247
6257
|
};
|
|
6248
6258
|
|
|
6249
|
-
export const
|
|
6259
|
+
export const __wbg_now_6dd635953150ee31 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
|
|
6250
6260
|
|
|
6251
6261
|
export function __wbg_crypto_1d1f22824a6a080c(arg0) {
|
|
6252
6262
|
const ret = getObject(arg0).crypto;
|
|
@@ -6570,13 +6580,13 @@ export function __wbindgen_memory() {
|
|
|
6570
6580
|
return addHeapObject(ret);
|
|
6571
6581
|
};
|
|
6572
6582
|
|
|
6573
|
-
export function
|
|
6574
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6583
|
+
export function __wbindgen_closure_wrapper482(arg0, arg1, arg2) {
|
|
6584
|
+
const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_60);
|
|
6575
6585
|
return addHeapObject(ret);
|
|
6576
6586
|
};
|
|
6577
6587
|
|
|
6578
|
-
export function
|
|
6579
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6588
|
+
export function __wbindgen_closure_wrapper484(arg0, arg1, arg2) {
|
|
6589
|
+
const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
|
|
6580
6590
|
return addHeapObject(ret);
|
|
6581
6591
|
};
|
|
6582
6592
|
|
|
Binary file
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export function __wbg_lorocounter_free(a: number): void;
|
|
5
5
|
export function lorocounter_new(): number;
|
|
6
|
+
export function lorocounter_kind(a: number): number;
|
|
7
|
+
export function lorocounter_id(a: number): number;
|
|
6
8
|
export function lorocounter_increment(a: number, b: number, c: number): void;
|
|
7
9
|
export function lorocounter_decrement(a: number, b: number, c: number): void;
|
|
8
10
|
export function lorocounter_value(a: number): number;
|
|
@@ -78,7 +80,6 @@ export function lorodoc_exportJsonUpdates(a: number, b: number, c: number, d: nu
|
|
|
78
80
|
export function lorodoc_exportJsonInIdSpan(a: number, b: number, c: number): void;
|
|
79
81
|
export function lorodoc_importJsonUpdates(a: number, b: number, c: number): void;
|
|
80
82
|
export function lorodoc_import(a: number, b: number, c: number, d: number): void;
|
|
81
|
-
export function lorodoc_importUpdateBatch(a: number, b: number, c: number): void;
|
|
82
83
|
export function lorodoc_importBatch(a: number, b: number, c: number): void;
|
|
83
84
|
export function lorodoc_getShallowValue(a: number, b: number): void;
|
|
84
85
|
export function lorodoc_toJSON(a: number, b: number): void;
|
|
@@ -253,7 +254,6 @@ export function undomanager_canRedo(a: number): number;
|
|
|
253
254
|
export function undomanager_setMaxUndoSteps(a: number, b: number): void;
|
|
254
255
|
export function undomanager_setMergeInterval(a: number, b: number): void;
|
|
255
256
|
export function undomanager_addExcludeOriginPrefix(a: number, b: number, c: number): void;
|
|
256
|
-
export function undomanager_checkBinding(a: number, b: number): number;
|
|
257
257
|
export function undomanager_setOnPush(a: number, b: number): void;
|
|
258
258
|
export function undomanager_setOnPop(a: number, b: number): void;
|
|
259
259
|
export function undomanager_clear(a: number): void;
|
|
@@ -271,6 +271,7 @@ export function versionvector_remove(a: number, b: number, c: number): void;
|
|
|
271
271
|
export function versionvector_length(a: number): number;
|
|
272
272
|
export function decodeImportBlobMeta(a: number, b: number, c: number, d: number): void;
|
|
273
273
|
export function __wbg_loromovablelist_free(a: number): void;
|
|
274
|
+
export function lorodoc_importUpdateBatch(a: number, b: number, c: number): void;
|
|
274
275
|
export function loromovablelist_parent(a: number): number;
|
|
275
276
|
export function lorotext_isAttached(a: number): number;
|
|
276
277
|
export function loromap_isAttached(a: number): number;
|
package/nodejs/loro_wasm.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean):
|
|
|
48
48
|
* const text = list.insertContainer(1, new LoroText());
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList";
|
|
51
|
+
export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList" | "Counter";
|
|
52
52
|
|
|
53
53
|
export type PeerID = `${number}`;
|
|
54
54
|
/**
|
|
@@ -292,7 +292,7 @@ export type UndoConfig = {
|
|
|
292
292
|
onPush?: (isUndo: boolean, counterRange: { start: number, end: number }, event?: LoroEventBatch) => { value: Value, cursors: Cursor[] },
|
|
293
293
|
onPop?: (isUndo: boolean, value: { value: Value, cursors: Cursor[] }, counterRange: { start: number, end: number }) => void
|
|
294
294
|
};
|
|
295
|
-
export type Container = LoroList | LoroMap | LoroText | LoroTree | LoroMovableList;
|
|
295
|
+
export type Container = LoroList | LoroMap | LoroText | LoroTree | LoroMovableList | LoroCounter;
|
|
296
296
|
|
|
297
297
|
export interface ImportBlobMetadata {
|
|
298
298
|
/**
|
|
@@ -1023,6 +1023,7 @@ interface LoroMovableList<T = unknown> {
|
|
|
1023
1023
|
*/
|
|
1024
1024
|
setContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
|
|
1025
1025
|
}
|
|
1026
|
+
|
|
1026
1027
|
interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
1027
1028
|
new(): LoroMap<T>;
|
|
1028
1029
|
/**
|
|
@@ -1076,9 +1077,13 @@ interface LoroMap<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
|
1076
1077
|
*/
|
|
1077
1078
|
get<Key extends keyof T>(key: Key): T[Key];
|
|
1078
1079
|
/**
|
|
1079
|
-
*
|
|
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
|
-
*
|
|
1085
|
+
* > **Note**: When calling `map.set(key, value)` on a LoroMap, if `map.get(key)` already returns `value`,
|
|
1086
|
+
* > the operation will be a no-op (no operation recorded) to avoid unnecessary updates.
|
|
1082
1087
|
*
|
|
1083
1088
|
* @example
|
|
1084
1089
|
* ```ts
|
|
@@ -1155,7 +1160,7 @@ interface LoroTree<T extends Record<string, unknown> = Record<string, unknown>>
|
|
|
1155
1160
|
/**
|
|
1156
1161
|
* Get LoroTreeNode by the TreeID.
|
|
1157
1162
|
*/
|
|
1158
|
-
getNodeByID(target: TreeID): LoroTreeNode<T
|
|
1163
|
+
getNodeByID(target: TreeID): LoroTreeNode<T> | undefined;
|
|
1159
1164
|
subscribe(listener: Listener): Subscription;
|
|
1160
1165
|
toArray(): TreeNodeValue[];
|
|
1161
1166
|
getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode<T>[];
|
|
@@ -1378,7 +1383,7 @@ export class Cursor {
|
|
|
1378
1383
|
kind(): any;
|
|
1379
1384
|
}
|
|
1380
1385
|
/**
|
|
1381
|
-
* The handler of a
|
|
1386
|
+
* The handler of a counter container.
|
|
1382
1387
|
*/
|
|
1383
1388
|
export class LoroCounter {
|
|
1384
1389
|
free(): void;
|
|
@@ -1387,6 +1392,11 @@ export class LoroCounter {
|
|
|
1387
1392
|
*/
|
|
1388
1393
|
constructor();
|
|
1389
1394
|
/**
|
|
1395
|
+
* "Counter"
|
|
1396
|
+
* @returns {'Counter'}
|
|
1397
|
+
*/
|
|
1398
|
+
kind(): 'Counter';
|
|
1399
|
+
/**
|
|
1390
1400
|
* Increment the counter by the given value.
|
|
1391
1401
|
* @param {number} value
|
|
1392
1402
|
*/
|
|
@@ -1431,6 +1441,10 @@ export class LoroCounter {
|
|
|
1431
1441
|
*/
|
|
1432
1442
|
getShallowValue(): number;
|
|
1433
1443
|
/**
|
|
1444
|
+
* The container id of this handler.
|
|
1445
|
+
*/
|
|
1446
|
+
readonly id: ContainerID;
|
|
1447
|
+
/**
|
|
1434
1448
|
* Get the value of the counter.
|
|
1435
1449
|
*/
|
|
1436
1450
|
readonly value: number;
|
|
@@ -1440,6 +1454,10 @@ export class LoroCounter {
|
|
|
1440
1454
|
* [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
|
|
1441
1455
|
* you could build all kind of applications by these.
|
|
1442
1456
|
*
|
|
1457
|
+
* **Important:** Loro is a pure library and does not handle network protocols.
|
|
1458
|
+
* It is the responsibility of the user to manage the storage, loading, and synchronization
|
|
1459
|
+
* of the bytes exported by Loro in a manner suitable for their specific environment.
|
|
1460
|
+
*
|
|
1443
1461
|
* @example
|
|
1444
1462
|
* ```ts
|
|
1445
1463
|
* import { LoroDoc } from "loro-crdt"
|
|
@@ -3498,12 +3516,6 @@ export class UndoManager {
|
|
|
3498
3516
|
*/
|
|
3499
3517
|
addExcludeOriginPrefix(prefix: string): void;
|
|
3500
3518
|
/**
|
|
3501
|
-
* Check if the undo manager is bound to the given document.
|
|
3502
|
-
* @param {LoroDoc} doc
|
|
3503
|
-
* @returns {boolean}
|
|
3504
|
-
*/
|
|
3505
|
-
checkBinding(doc: LoroDoc): boolean;
|
|
3506
|
-
/**
|
|
3507
3519
|
*/
|
|
3508
3520
|
clear(): void;
|
|
3509
3521
|
}
|
package/nodejs/loro_wasm.js
CHANGED
|
@@ -733,7 +733,7 @@ const LoroCounterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
733
733
|
? { register: () => {}, unregister: () => {} }
|
|
734
734
|
: new FinalizationRegistry(ptr => wasm.__wbg_lorocounter_free(ptr >>> 0));
|
|
735
735
|
/**
|
|
736
|
-
* The handler of a
|
|
736
|
+
* The handler of a counter container.
|
|
737
737
|
*/
|
|
738
738
|
class LoroCounter {
|
|
739
739
|
|
|
@@ -765,6 +765,22 @@ class LoroCounter {
|
|
|
765
765
|
return this;
|
|
766
766
|
}
|
|
767
767
|
/**
|
|
768
|
+
* "Counter"
|
|
769
|
+
* @returns {'Counter'}
|
|
770
|
+
*/
|
|
771
|
+
kind() {
|
|
772
|
+
const ret = wasm.lorocounter_kind(this.__wbg_ptr);
|
|
773
|
+
return takeObject(ret);
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* The container id of this handler.
|
|
777
|
+
* @returns {ContainerID}
|
|
778
|
+
*/
|
|
779
|
+
get id() {
|
|
780
|
+
const ret = wasm.lorocounter_id(this.__wbg_ptr);
|
|
781
|
+
return takeObject(ret);
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
768
784
|
* Increment the counter by the given value.
|
|
769
785
|
* @param {number} value
|
|
770
786
|
*/
|
|
@@ -877,6 +893,10 @@ const LoroDocFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
877
893
|
* [**RichText**](LoroText), [**Map**](LoroMap) and [**Movable Tree**](LoroTree),
|
|
878
894
|
* you could build all kind of applications by these.
|
|
879
895
|
*
|
|
896
|
+
* **Important:** Loro is a pure library and does not handle network protocols.
|
|
897
|
+
* It is the responsibility of the user to manage the storage, loading, and synchronization
|
|
898
|
+
* of the bytes exported by Loro in a manner suitable for their specific environment.
|
|
899
|
+
*
|
|
880
900
|
* @example
|
|
881
901
|
* ```ts
|
|
882
902
|
* import { LoroDoc } from "loro-crdt"
|
|
@@ -2093,7 +2113,7 @@ class LoroDoc {
|
|
|
2093
2113
|
importUpdateBatch(data) {
|
|
2094
2114
|
try {
|
|
2095
2115
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2096
|
-
wasm.
|
|
2116
|
+
wasm.lorodoc_importBatch(retptr, this.__wbg_ptr, addHeapObject(data));
|
|
2097
2117
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2098
2118
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2099
2119
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -5728,16 +5748,6 @@ class UndoManager {
|
|
|
5728
5748
|
wasm.undomanager_addExcludeOriginPrefix(this.__wbg_ptr, ptr0, len0);
|
|
5729
5749
|
}
|
|
5730
5750
|
/**
|
|
5731
|
-
* Check if the undo manager is bound to the given document.
|
|
5732
|
-
* @param {LoroDoc} doc
|
|
5733
|
-
* @returns {boolean}
|
|
5734
|
-
*/
|
|
5735
|
-
checkBinding(doc) {
|
|
5736
|
-
_assertClass(doc, LoroDoc);
|
|
5737
|
-
const ret = wasm.undomanager_checkBinding(this.__wbg_ptr, doc.__wbg_ptr);
|
|
5738
|
-
return ret !== 0;
|
|
5739
|
-
}
|
|
5740
|
-
/**
|
|
5741
5751
|
* Set the on push event listener.
|
|
5742
5752
|
*
|
|
5743
5753
|
* Every time an undo step or redo step is pushed, the on push event listener will be called.
|
|
@@ -5985,8 +5995,8 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
5985
5995
|
takeObject(arg0);
|
|
5986
5996
|
};
|
|
5987
5997
|
|
|
5988
|
-
module.exports.
|
|
5989
|
-
const ret =
|
|
5998
|
+
module.exports.__wbg_lorotreenode_new = function(arg0) {
|
|
5999
|
+
const ret = LoroTreeNode.__wrap(arg0);
|
|
5990
6000
|
return addHeapObject(ret);
|
|
5991
6001
|
};
|
|
5992
6002
|
|
|
@@ -5995,33 +6005,33 @@ module.exports.__wbg_lorocounter_new = function(arg0) {
|
|
|
5995
6005
|
return addHeapObject(ret);
|
|
5996
6006
|
};
|
|
5997
6007
|
|
|
5998
|
-
module.exports.
|
|
5999
|
-
const ret =
|
|
6008
|
+
module.exports.__wbg_lorotext_new = function(arg0) {
|
|
6009
|
+
const ret = LoroText.__wrap(arg0);
|
|
6000
6010
|
return addHeapObject(ret);
|
|
6001
6011
|
};
|
|
6002
6012
|
|
|
6003
|
-
module.exports.
|
|
6004
|
-
const ret =
|
|
6013
|
+
module.exports.__wbg_lorolist_new = function(arg0) {
|
|
6014
|
+
const ret = LoroList.__wrap(arg0);
|
|
6005
6015
|
return addHeapObject(ret);
|
|
6006
6016
|
};
|
|
6007
6017
|
|
|
6008
|
-
module.exports.
|
|
6009
|
-
const ret =
|
|
6018
|
+
module.exports.__wbg_loromap_new = function(arg0) {
|
|
6019
|
+
const ret = LoroMap.__wrap(arg0);
|
|
6010
6020
|
return addHeapObject(ret);
|
|
6011
6021
|
};
|
|
6012
6022
|
|
|
6013
|
-
module.exports.
|
|
6014
|
-
const ret =
|
|
6023
|
+
module.exports.__wbg_cursor_new = function(arg0) {
|
|
6024
|
+
const ret = Cursor.__wrap(arg0);
|
|
6015
6025
|
return addHeapObject(ret);
|
|
6016
6026
|
};
|
|
6017
6027
|
|
|
6018
|
-
module.exports.
|
|
6019
|
-
const ret =
|
|
6028
|
+
module.exports.__wbg_loromovablelist_new = function(arg0) {
|
|
6029
|
+
const ret = LoroMovableList.__wrap(arg0);
|
|
6020
6030
|
return addHeapObject(ret);
|
|
6021
6031
|
};
|
|
6022
6032
|
|
|
6023
|
-
module.exports.
|
|
6024
|
-
const ret =
|
|
6033
|
+
module.exports.__wbg_lorotree_new = function(arg0) {
|
|
6034
|
+
const ret = LoroTree.__wrap(arg0);
|
|
6025
6035
|
return addHeapObject(ret);
|
|
6026
6036
|
};
|
|
6027
6037
|
|
|
@@ -6148,11 +6158,11 @@ module.exports.__wbindgen_typeof = function(arg0) {
|
|
|
6148
6158
|
return addHeapObject(ret);
|
|
6149
6159
|
};
|
|
6150
6160
|
|
|
6151
|
-
module.exports.
|
|
6161
|
+
module.exports.__wbg_error_9384d761bf46409d = function(arg0, arg1) {
|
|
6152
6162
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
6153
6163
|
};
|
|
6154
6164
|
|
|
6155
|
-
module.exports.
|
|
6165
|
+
module.exports.__wbg_log_c86c3e1bf097ba35 = function(arg0, arg1) {
|
|
6156
6166
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
6157
6167
|
};
|
|
6158
6168
|
|
|
@@ -6253,7 +6263,7 @@ module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
|
6253
6263
|
}
|
|
6254
6264
|
};
|
|
6255
6265
|
|
|
6256
|
-
module.exports.
|
|
6266
|
+
module.exports.__wbg_now_6dd635953150ee31 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
|
|
6257
6267
|
|
|
6258
6268
|
module.exports.__wbg_crypto_1d1f22824a6a080c = function(arg0) {
|
|
6259
6269
|
const ret = getObject(arg0).crypto;
|
|
@@ -6577,13 +6587,13 @@ module.exports.__wbindgen_memory = function() {
|
|
|
6577
6587
|
return addHeapObject(ret);
|
|
6578
6588
|
};
|
|
6579
6589
|
|
|
6580
|
-
module.exports.
|
|
6581
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6590
|
+
module.exports.__wbindgen_closure_wrapper482 = function(arg0, arg1, arg2) {
|
|
6591
|
+
const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_60);
|
|
6582
6592
|
return addHeapObject(ret);
|
|
6583
6593
|
};
|
|
6584
6594
|
|
|
6585
|
-
module.exports.
|
|
6586
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6595
|
+
module.exports.__wbindgen_closure_wrapper484 = function(arg0, arg1, arg2) {
|
|
6596
|
+
const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
|
|
6587
6597
|
return addHeapObject(ret);
|
|
6588
6598
|
};
|
|
6589
6599
|
|
package/nodejs/loro_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export function __wbg_lorocounter_free(a: number): void;
|
|
5
5
|
export function lorocounter_new(): number;
|
|
6
|
+
export function lorocounter_kind(a: number): number;
|
|
7
|
+
export function lorocounter_id(a: number): number;
|
|
6
8
|
export function lorocounter_increment(a: number, b: number, c: number): void;
|
|
7
9
|
export function lorocounter_decrement(a: number, b: number, c: number): void;
|
|
8
10
|
export function lorocounter_value(a: number): number;
|
|
@@ -78,7 +80,6 @@ export function lorodoc_exportJsonUpdates(a: number, b: number, c: number, d: nu
|
|
|
78
80
|
export function lorodoc_exportJsonInIdSpan(a: number, b: number, c: number): void;
|
|
79
81
|
export function lorodoc_importJsonUpdates(a: number, b: number, c: number): void;
|
|
80
82
|
export function lorodoc_import(a: number, b: number, c: number, d: number): void;
|
|
81
|
-
export function lorodoc_importUpdateBatch(a: number, b: number, c: number): void;
|
|
82
83
|
export function lorodoc_importBatch(a: number, b: number, c: number): void;
|
|
83
84
|
export function lorodoc_getShallowValue(a: number, b: number): void;
|
|
84
85
|
export function lorodoc_toJSON(a: number, b: number): void;
|
|
@@ -253,7 +254,6 @@ export function undomanager_canRedo(a: number): number;
|
|
|
253
254
|
export function undomanager_setMaxUndoSteps(a: number, b: number): void;
|
|
254
255
|
export function undomanager_setMergeInterval(a: number, b: number): void;
|
|
255
256
|
export function undomanager_addExcludeOriginPrefix(a: number, b: number, c: number): void;
|
|
256
|
-
export function undomanager_checkBinding(a: number, b: number): number;
|
|
257
257
|
export function undomanager_setOnPush(a: number, b: number): void;
|
|
258
258
|
export function undomanager_setOnPop(a: number, b: number): void;
|
|
259
259
|
export function undomanager_clear(a: number): void;
|
|
@@ -271,6 +271,7 @@ export function versionvector_remove(a: number, b: number, c: number): void;
|
|
|
271
271
|
export function versionvector_length(a: number): number;
|
|
272
272
|
export function decodeImportBlobMeta(a: number, b: number, c: number, d: number): void;
|
|
273
273
|
export function __wbg_loromovablelist_free(a: number): void;
|
|
274
|
+
export function lorodoc_importUpdateBatch(a: number, b: number, c: number): void;
|
|
274
275
|
export function loromovablelist_parent(a: number): number;
|
|
275
276
|
export function lorotext_isAttached(a: number): number;
|
|
276
277
|
export function loromap_isAttached(a: number): number;
|
package/package.json
CHANGED