loro-crdt 1.3.0 β 1.3.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.
- package/CHANGELOG.md +13 -0
- package/README.md +1 -3
- package/base64/index.js +44 -38
- package/base64/loro_wasm.d.ts +12 -9
- package/base64/loro_wasm_bg-0d85a13f.js +64 -0
- package/bundler/loro_wasm.d.ts +12 -9
- package/bundler/loro_wasm_bg.js +39 -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 +12 -9
- package/nodejs/loro_wasm.js +39 -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 +15 -11
- package/web/loro_wasm.js +37 -31
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +3 -2
- package/base64/loro_wasm_bg-faa2e3e4.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a168063: refactor: hold doc reference in handler (#624)
|
|
8
|
+
- a168063: fix: a few LoroCounter errors (#626)
|
|
9
|
+
|
|
10
|
+
## 1.3.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 07500da: fix: map.keys() may return keys from deleted entries #618
|
|
15
|
+
|
|
3
16
|
## 1.3.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Loro is a [CRDTs(Conflict-free Replicated Data Types)](https://crdt.tech/) libra
|
|
|
56
56
|
**Supported CRDT Algorithms**
|
|
57
57
|
|
|
58
58
|
- π Text Editing with [Fugue]
|
|
59
|
-
- π [
|
|
59
|
+
- π [Rich Text CRDT](https://loro.dev/blog/loro-richtext)
|
|
60
60
|
- π² [Moveable Tree](https://loro.dev/docs/tutorial/tree)
|
|
61
61
|
- π [Moveable List](https://loro.dev/docs/tutorial/list)
|
|
62
62
|
- πΊοΈ [Last-Write-Wins Map](https://loro.dev/docs/tutorial/map)
|
|
@@ -137,7 +137,6 @@ test('sync example', () => {
|
|
|
137
137
|
|
|
138
138
|
Loro draws inspiration from the innovative work of the following projects and individuals:
|
|
139
139
|
|
|
140
|
-
- [Ink & Switch](https://inkandswitch.com/): The principles of Local-first Software have greatly influenced this project. The [Peritext](https://www.inkandswitch.com/peritext/) project has also shaped our approach to rich text CRDTs.
|
|
141
140
|
- [Diamond-types](https://github.com/josephg/diamond-types): The [Event Graph Walker (Eg-walker)](https://loro.dev/docs/advanced/event_graph_walker) algorithm from @josephg has been adapted to reduce the computation and space usage of CRDTs.
|
|
142
141
|
- [Automerge](https://github.com/automerge/automerge): Their use of columnar encoding for CRDTs has informed our strategies for efficient data encoding.
|
|
143
142
|
- [Yjs](https://github.com/yjs/yjs): We have incorporated a similar algorithm for effectively merging collaborative editing operations, thanks to their pioneering work.
|
|
@@ -147,4 +146,3 @@ Loro draws inspiration from the innovative work of the following projects and in
|
|
|
147
146
|
|
|
148
147
|
[local-first]: https://www.inkandswitch.com/local-first/
|
|
149
148
|
[Fugue]: https://arxiv.org/abs/2305.00583
|
|
150
|
-
[Peritext]: https://www.inkandswitch.com/peritext/
|
package/base64/index.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
|
class LoroCounter {
|
|
742
742
|
|
|
@@ -768,6 +768,22 @@ 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
|
*/
|
|
@@ -2095,7 +2111,7 @@ class LoroDoc {
|
|
|
2095
2111
|
importUpdateBatch(data) {
|
|
2096
2112
|
try {
|
|
2097
2113
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2098
|
-
wasm.
|
|
2114
|
+
wasm.lorodoc_importBatch(retptr, this.__wbg_ptr, addHeapObject(data));
|
|
2099
2115
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
2100
2116
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
2101
2117
|
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
@@ -5723,16 +5739,6 @@ class UndoManager {
|
|
|
5723
5739
|
wasm.undomanager_addExcludeOriginPrefix(this.__wbg_ptr, ptr0, len0);
|
|
5724
5740
|
}
|
|
5725
5741
|
/**
|
|
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
5742
|
* Set the on push event listener.
|
|
5737
5743
|
*
|
|
5738
5744
|
* Every time an undo step or redo step is pushed, the on push event listener will be called.
|
|
@@ -5977,12 +5983,20 @@ class VersionVector {
|
|
|
5977
5983
|
function __wbindgen_object_drop_ref(arg0) {
|
|
5978
5984
|
takeObject(arg0);
|
|
5979
5985
|
}
|
|
5986
|
+
function __wbg_lorotree_new(arg0) {
|
|
5987
|
+
const ret = LoroTree.__wrap(arg0);
|
|
5988
|
+
return addHeapObject(ret);
|
|
5989
|
+
}
|
|
5980
5990
|
function __wbg_lorolist_new(arg0) {
|
|
5981
5991
|
const ret = LoroList.__wrap(arg0);
|
|
5982
5992
|
return addHeapObject(ret);
|
|
5983
5993
|
}
|
|
5984
|
-
function
|
|
5985
|
-
const ret =
|
|
5994
|
+
function __wbg_lorotext_new(arg0) {
|
|
5995
|
+
const ret = LoroText.__wrap(arg0);
|
|
5996
|
+
return addHeapObject(ret);
|
|
5997
|
+
}
|
|
5998
|
+
function __wbg_cursor_new(arg0) {
|
|
5999
|
+
const ret = Cursor.__wrap(arg0);
|
|
5986
6000
|
return addHeapObject(ret);
|
|
5987
6001
|
}
|
|
5988
6002
|
function __wbg_loromap_new(arg0) {
|
|
@@ -5993,22 +6007,14 @@ function __wbg_lorotreenode_new(arg0) {
|
|
|
5993
6007
|
const ret = LoroTreeNode.__wrap(arg0);
|
|
5994
6008
|
return addHeapObject(ret);
|
|
5995
6009
|
}
|
|
5996
|
-
function
|
|
5997
|
-
const ret =
|
|
6010
|
+
function __wbg_lorocounter_new(arg0) {
|
|
6011
|
+
const ret = LoroCounter.__wrap(arg0);
|
|
5998
6012
|
return addHeapObject(ret);
|
|
5999
6013
|
}
|
|
6000
6014
|
function __wbg_loromovablelist_new(arg0) {
|
|
6001
6015
|
const ret = LoroMovableList.__wrap(arg0);
|
|
6002
6016
|
return addHeapObject(ret);
|
|
6003
6017
|
}
|
|
6004
|
-
function __wbg_cursor_new(arg0) {
|
|
6005
|
-
const ret = Cursor.__wrap(arg0);
|
|
6006
|
-
return addHeapObject(ret);
|
|
6007
|
-
}
|
|
6008
|
-
function __wbg_lorotext_new(arg0) {
|
|
6009
|
-
const ret = LoroText.__wrap(arg0);
|
|
6010
|
-
return addHeapObject(ret);
|
|
6011
|
-
}
|
|
6012
6018
|
function __wbg_versionvector_new(arg0) {
|
|
6013
6019
|
const ret = VersionVector.__wrap(arg0);
|
|
6014
6020
|
return addHeapObject(ret);
|
|
@@ -6110,10 +6116,10 @@ function __wbindgen_typeof(arg0) {
|
|
|
6110
6116
|
const ret = typeof getObject(arg0);
|
|
6111
6117
|
return addHeapObject(ret);
|
|
6112
6118
|
}
|
|
6113
|
-
function
|
|
6119
|
+
function __wbg_error_9384d761bf46409d(arg0, arg1) {
|
|
6114
6120
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
6115
6121
|
}
|
|
6116
|
-
function
|
|
6122
|
+
function __wbg_log_c86c3e1bf097ba35(arg0, arg1) {
|
|
6117
6123
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
6118
6124
|
}
|
|
6119
6125
|
function __wbindgen_is_falsy(arg0) {
|
|
@@ -6201,7 +6207,7 @@ function __wbg_error_f851667af71bcfc6(arg0, arg1) {
|
|
|
6201
6207
|
wasm.__wbindgen_export_5(deferred0_0, deferred0_1, 1);
|
|
6202
6208
|
}
|
|
6203
6209
|
}
|
|
6204
|
-
const
|
|
6210
|
+
const __wbg_now_2d57022b1935b215 = typeof Date.now == 'function' ? Date.now : notDefined('Date.now');
|
|
6205
6211
|
|
|
6206
6212
|
function __wbg_crypto_1d1f22824a6a080c(arg0) {
|
|
6207
6213
|
const ret = getObject(arg0).crypto;
|
|
@@ -6465,12 +6471,12 @@ function __wbindgen_memory() {
|
|
|
6465
6471
|
const ret = wasm.memory;
|
|
6466
6472
|
return addHeapObject(ret);
|
|
6467
6473
|
}
|
|
6468
|
-
function
|
|
6469
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6474
|
+
function __wbindgen_closure_wrapper482(arg0, arg1, arg2) {
|
|
6475
|
+
const ret = makeMutClosure(arg0, arg1, 8, __wbg_adapter_60);
|
|
6470
6476
|
return addHeapObject(ret);
|
|
6471
6477
|
}
|
|
6472
|
-
function
|
|
6473
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
6478
|
+
function __wbindgen_closure_wrapper485(arg0, arg1, arg2) {
|
|
6479
|
+
const ret = makeMutClosure(arg0, arg1, 10, __wbg_adapter_63);
|
|
6474
6480
|
return addHeapObject(ret);
|
|
6475
6481
|
}
|
|
6476
6482
|
|
|
@@ -6500,7 +6506,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6500
6506
|
__wbg_done_298b57d23c0fc80c: __wbg_done_298b57d23c0fc80c,
|
|
6501
6507
|
__wbg_entries_95cc2c823b285a09: __wbg_entries_95cc2c823b285a09,
|
|
6502
6508
|
__wbg_entries_ce844941d0c51880: __wbg_entries_ce844941d0c51880,
|
|
6503
|
-
|
|
6509
|
+
__wbg_error_9384d761bf46409d: __wbg_error_9384d761bf46409d,
|
|
6504
6510
|
__wbg_error_f851667af71bcfc6: __wbg_error_f851667af71bcfc6,
|
|
6505
6511
|
__wbg_from_89e3fc3ba5e6fb48: __wbg_from_89e3fc3ba5e6fb48,
|
|
6506
6512
|
__wbg_getRandomValues_3aa56aa6edec874c: __wbg_getRandomValues_3aa56aa6edec874c,
|
|
@@ -6520,8 +6526,8 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6520
6526
|
__wbg_length_c20a40f15020d68a: __wbg_length_c20a40f15020d68a,
|
|
6521
6527
|
__wbg_length_cd7af8117672b8b8: __wbg_length_cd7af8117672b8b8,
|
|
6522
6528
|
__wbg_log_aba5996d9bde071f: __wbg_log_aba5996d9bde071f,
|
|
6529
|
+
__wbg_log_c86c3e1bf097ba35: __wbg_log_c86c3e1bf097ba35,
|
|
6523
6530
|
__wbg_log_c9486ca5d8e2cbe8: __wbg_log_c9486ca5d8e2cbe8,
|
|
6524
|
-
__wbg_log_d8fdbde28117925d: __wbg_log_d8fdbde28117925d,
|
|
6525
6531
|
__wbg_lorocounter_new: __wbg_lorocounter_new,
|
|
6526
6532
|
__wbg_lorolist_new: __wbg_lorolist_new,
|
|
6527
6533
|
__wbg_loromap_new: __wbg_loromap_new,
|
|
@@ -6544,7 +6550,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6544
6550
|
__wbg_next_196c84450b364254: __wbg_next_196c84450b364254,
|
|
6545
6551
|
__wbg_next_40fc327bfc8770e6: __wbg_next_40fc327bfc8770e6,
|
|
6546
6552
|
__wbg_node_104a2ff8d6ea03a2: __wbg_node_104a2ff8d6ea03a2,
|
|
6547
|
-
|
|
6553
|
+
__wbg_now_2d57022b1935b215: __wbg_now_2d57022b1935b215,
|
|
6548
6554
|
__wbg_ownKeys_658942b7f28d1fe9: __wbg_ownKeys_658942b7f28d1fe9,
|
|
6549
6555
|
__wbg_process_4a72847cc503995b: __wbg_process_4a72847cc503995b,
|
|
6550
6556
|
__wbg_push_a5b05aedc7234f9f: __wbg_push_a5b05aedc7234f9f,
|
|
@@ -6572,8 +6578,8 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6572
6578
|
__wbindgen_bigint_get_as_i64: __wbindgen_bigint_get_as_i64,
|
|
6573
6579
|
__wbindgen_boolean_get: __wbindgen_boolean_get,
|
|
6574
6580
|
__wbindgen_cb_drop: __wbindgen_cb_drop,
|
|
6575
|
-
|
|
6576
|
-
|
|
6581
|
+
__wbindgen_closure_wrapper482: __wbindgen_closure_wrapper482,
|
|
6582
|
+
__wbindgen_closure_wrapper485: __wbindgen_closure_wrapper485,
|
|
6577
6583
|
__wbindgen_debug_string: __wbindgen_debug_string,
|
|
6578
6584
|
__wbindgen_error_new: __wbindgen_error_new,
|
|
6579
6585
|
__wbindgen_in: __wbindgen_in,
|
|
@@ -6608,7 +6614,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6608
6614
|
// Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
|
|
6609
6615
|
|
|
6610
6616
|
|
|
6611
|
-
import loro_wasm_bg_js from './loro_wasm_bg-
|
|
6617
|
+
import loro_wasm_bg_js from './loro_wasm_bg-0d85a13f.js';
|
|
6612
6618
|
const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
|
|
6613
6619
|
"./loro_wasm_bg.js": imports,
|
|
6614
6620
|
});
|
|
@@ -6813,4 +6819,4 @@ LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
|
|
|
6813
6819
|
return run(layer);
|
|
6814
6820
|
};
|
|
6815
6821
|
|
|
6816
|
-
export { Awareness, AwarenessWasm, Cursor, Loro, LoroCounter, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, LoroTreeNode, UndoManager, VersionVector, __wbg_String_b9412f8799faab3e, __wbg_apply_0a5aa603881e6d79, __wbg_buffer_12d079cc21e14bdb, __wbg_call_27c0f87801dedf93, __wbg_call_8e7cb608789c2528, __wbg_call_938992c832f74314, __wbg_call_b3ca7c6051f9bec1, __wbg_crypto_1d1f22824a6a080c, __wbg_cursor_new, __wbg_done_298b57d23c0fc80c, __wbg_entries_95cc2c823b285a09, __wbg_entries_ce844941d0c51880,
|
|
6822
|
+
export { Awareness, AwarenessWasm, Cursor, Loro, LoroCounter, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, LoroTreeNode, UndoManager, VersionVector, __wbg_String_b9412f8799faab3e, __wbg_apply_0a5aa603881e6d79, __wbg_buffer_12d079cc21e14bdb, __wbg_call_27c0f87801dedf93, __wbg_call_8e7cb608789c2528, __wbg_call_938992c832f74314, __wbg_call_b3ca7c6051f9bec1, __wbg_crypto_1d1f22824a6a080c, __wbg_cursor_new, __wbg_done_298b57d23c0fc80c, __wbg_entries_95cc2c823b285a09, __wbg_entries_ce844941d0c51880, __wbg_error_9384d761bf46409d, __wbg_error_f851667af71bcfc6, __wbg_from_89e3fc3ba5e6fb48, __wbg_getRandomValues_3aa56aa6edec874c, __wbg_get_bd8e338fbd5f5cc8, __wbg_get_e3c254076557e348, __wbg_getindex_03d06b4e7ea3475e, __wbg_getwithrefkey_edc2c8960f0f1191, __wbg_globalThis_d1e6af4856ba331b, __wbg_global_207b558942527489, __wbg_instanceof_ArrayBuffer_836825be07d4c9d2, __wbg_instanceof_Map_87917e0a7aaf4012, __wbg_instanceof_Object_71ca3c0a59266746, __wbg_instanceof_Uint8Array_2b3bbecd033d19f6, __wbg_isArray_2ab64d95e09ea0ae, __wbg_isSafeInteger_f7b04ef02296c4d2, __wbg_iterator_2cee6dadfd956dfa, __wbg_length_c20a40f15020d68a, __wbg_length_cd7af8117672b8b8, __wbg_log_aba5996d9bde071f, __wbg_log_c86c3e1bf097ba35, __wbg_log_c9486ca5d8e2cbe8, __wbg_lorocounter_new, __wbg_lorolist_new, __wbg_loromap_new, __wbg_loromovablelist_new, __wbg_lorotext_new, __wbg_lorotree_new, __wbg_lorotreenode_new, __wbg_mark_40e050a77cc39fea, __wbg_measure_aa7a73f17813f708, __wbg_msCrypto_eb05e62b530a1508, __wbg_new_16b304a2cfa7ff4a, __wbg_new_63b92bc8671ed464, __wbg_new_72fb9a18b5ae2624, __wbg_new_abda76e883ba8a5f, __wbg_new_d9bc3a0147634640, __wbg_newnoargs_e258087cd0daa0ea, __wbg_newwithbyteoffsetandlength_aa4a17c33a06e5cb, __wbg_newwithlength_66ae46612e7f0234, __wbg_newwithlength_e9b4878cebadb3d3, __wbg_next_196c84450b364254, __wbg_next_40fc327bfc8770e6, __wbg_node_104a2ff8d6ea03a2, __wbg_now_2d57022b1935b215, __wbg_ownKeys_658942b7f28d1fe9, __wbg_process_4a72847cc503995b, __wbg_push_a5b05aedc7234f9f, __wbg_randomFillSync_5c9c955aa56b6049, __wbg_require_cca90b1a94a0255b, __wbg_resolve_b0083a7967828ec8, __wbg_self_ce0dbfc45cf2f5be, __wbg_set_1f9b04f170055d33, __wbg_set_8417257aaedc936b, __wbg_set_a47bac70306a19a7, __wbg_set_d4638f722068f043, __wbg_set_f975102236d3c502, __wbg_set_wasm, __wbg_setindex_0b7ede192dc5eca8, __wbg_stack_658279fe44541cf6, __wbg_subarray_a1f73cd4b5b42fe1, __wbg_then_0c86a60e8fcfe9f6, __wbg_value_d93c65011f51a456, __wbg_versions_f686565e586dd935, __wbg_versionvector_new, __wbg_window_c6fb939a7f436783, __wbindgen_as_number, __wbindgen_bigint_from_i64, __wbindgen_bigint_from_u64, __wbindgen_bigint_get_as_i64, __wbindgen_boolean_get, __wbindgen_cb_drop, __wbindgen_closure_wrapper482, __wbindgen_closure_wrapper485, __wbindgen_debug_string, __wbindgen_error_new, __wbindgen_in, __wbindgen_is_array, __wbindgen_is_bigint, __wbindgen_is_falsy, __wbindgen_is_function, __wbindgen_is_null, __wbindgen_is_object, __wbindgen_is_string, __wbindgen_is_undefined, __wbindgen_jsval_eq, __wbindgen_jsval_loose_eq, __wbindgen_memory, __wbindgen_number_get, __wbindgen_number_new, __wbindgen_object_clone_ref, __wbindgen_object_drop_ref, __wbindgen_rethrow, __wbindgen_string_get, __wbindgen_string_new, __wbindgen_throw, __wbindgen_typeof, decodeFrontiers, decodeImportBlobMeta, encodeFrontiers, getType, isContainer, isContainerId, newContainerID, newRootContainerID, run, setDebug };
|
package/base64/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
|
/**
|
|
@@ -1378,7 +1378,7 @@ export class Cursor {
|
|
|
1378
1378
|
kind(): any;
|
|
1379
1379
|
}
|
|
1380
1380
|
/**
|
|
1381
|
-
* The handler of a
|
|
1381
|
+
* The handler of a counter container.
|
|
1382
1382
|
*/
|
|
1383
1383
|
export class LoroCounter {
|
|
1384
1384
|
free(): void;
|
|
@@ -1387,6 +1387,11 @@ export class LoroCounter {
|
|
|
1387
1387
|
*/
|
|
1388
1388
|
constructor();
|
|
1389
1389
|
/**
|
|
1390
|
+
* "Counter"
|
|
1391
|
+
* @returns {'Counter'}
|
|
1392
|
+
*/
|
|
1393
|
+
kind(): 'Counter';
|
|
1394
|
+
/**
|
|
1390
1395
|
* Increment the counter by the given value.
|
|
1391
1396
|
* @param {number} value
|
|
1392
1397
|
*/
|
|
@@ -1431,6 +1436,10 @@ export class LoroCounter {
|
|
|
1431
1436
|
*/
|
|
1432
1437
|
getShallowValue(): number;
|
|
1433
1438
|
/**
|
|
1439
|
+
* The container id of this handler.
|
|
1440
|
+
*/
|
|
1441
|
+
readonly id: ContainerID;
|
|
1442
|
+
/**
|
|
1434
1443
|
* Get the value of the counter.
|
|
1435
1444
|
*/
|
|
1436
1445
|
readonly value: number;
|
|
@@ -3498,12 +3507,6 @@ export class UndoManager {
|
|
|
3498
3507
|
*/
|
|
3499
3508
|
addExcludeOriginPrefix(prefix: string): void;
|
|
3500
3509
|
/**
|
|
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
3510
|
*/
|
|
3508
3511
|
clear(): void;
|
|
3509
3512
|
}
|