loro-crdt 1.6.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1640,6 +1640,7 @@ export class LoroCounter {
1640
1640
  * Get the value of the counter.
1641
1641
  */
1642
1642
  getShallowValue(): number;
1643
+ toJSON(): number;
1643
1644
  /**
1644
1645
  * The container id of this handler.
1645
1646
  */
@@ -2001,6 +2002,13 @@ export class LoroDoc {
2001
2002
  * the largest existing timestamp will be used instead.
2002
2003
  *
2003
2004
  * NOTE: The `origin` will not be persisted, but the `message` will.
2005
+ *
2006
+ * Behavior on empty commits:
2007
+ * - This method is an explicit commit. If the pending transaction is empty, any provided
2008
+ * options (message/timestamp/origin) are swallowed and will not carry over to the next commit.
2009
+ * - Implicit commits triggered by `export`/`checkout` act as processing barriers. If the
2010
+ * transaction is empty in those cases, `message`/`timestamp`/`origin` are preserved for the
2011
+ * next commit.
2004
2012
  */
2005
2013
  commit(options?: { origin?: string, timestamp?: number, message?: string } | null): void;
2006
2014
  /**
@@ -3621,6 +3629,16 @@ export class UndoManager {
3621
3629
  * Can redo the last operation.
3622
3630
  */
3623
3631
  canRedo(): boolean;
3632
+ /**
3633
+ * Get the value associated with the top undo stack item, if any.
3634
+ * Returns `undefined` if there is no undo item.
3635
+ */
3636
+ topUndoValue(): Value | undefined;
3637
+ /**
3638
+ * Get the value associated with the top redo stack item, if any.
3639
+ * Returns `undefined` if there is no redo item.
3640
+ */
3641
+ topRedoValue(): Value | undefined;
3624
3642
  /**
3625
3643
  * The number of max undo steps.
3626
3644
  * If the number of undo steps exceeds this number, the oldest undo step will be removed.
@@ -1122,6 +1122,13 @@ export class LoroCounter {
1122
1122
  const ret = wasm.lorocounter_getShallowValue(this.__wbg_ptr);
1123
1123
  return ret;
1124
1124
  }
1125
+ /**
1126
+ * @returns {number}
1127
+ */
1128
+ toJSON() {
1129
+ const ret = wasm.lorocounter_toJSON(this.__wbg_ptr);
1130
+ return ret;
1131
+ }
1125
1132
  }
1126
1133
 
1127
1134
  const LoroDocFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -1683,6 +1690,13 @@ export class LoroDoc {
1683
1690
  * the largest existing timestamp will be used instead.
1684
1691
  *
1685
1692
  * NOTE: The `origin` will not be persisted, but the `message` will.
1693
+ *
1694
+ * Behavior on empty commits:
1695
+ * - This method is an explicit commit. If the pending transaction is empty, any provided
1696
+ * options (message/timestamp/origin) are swallowed and will not carry over to the next commit.
1697
+ * - Implicit commits triggered by `export`/`checkout` act as processing barriers. If the
1698
+ * transaction is empty in those cases, `message`/`timestamp`/`origin` are preserved for the
1699
+ * next commit.
1686
1700
  * @param {{ origin?: string, timestamp?: number, message?: string } | null} [options]
1687
1701
  */
1688
1702
  commit(options) {
@@ -6222,6 +6236,24 @@ export class UndoManager {
6222
6236
  const ret = wasm.undomanager_canRedo(this.__wbg_ptr);
6223
6237
  return ret !== 0;
6224
6238
  }
6239
+ /**
6240
+ * Get the value associated with the top undo stack item, if any.
6241
+ * Returns `undefined` if there is no undo item.
6242
+ * @returns {Value | undefined}
6243
+ */
6244
+ topUndoValue() {
6245
+ const ret = wasm.undomanager_topUndoValue(this.__wbg_ptr);
6246
+ return takeObject(ret);
6247
+ }
6248
+ /**
6249
+ * Get the value associated with the top redo stack item, if any.
6250
+ * Returns `undefined` if there is no redo item.
6251
+ * @returns {Value | undefined}
6252
+ */
6253
+ topRedoValue() {
6254
+ const ret = wasm.undomanager_topRedoValue(this.__wbg_ptr);
6255
+ return takeObject(ret);
6256
+ }
6225
6257
  /**
6226
6258
  * The number of max undo steps.
6227
6259
  * If the number of undo steps exceeds this number, the oldest undo step will be removed.
@@ -6824,7 +6856,7 @@ export function __wbg_node_02999533c4ea02e3(arg0) {
6824
6856
  return addHeapObject(ret);
6825
6857
  };
6826
6858
 
6827
- export function __wbg_now_4f8b2820be8a682c() {
6859
+ export function __wbg_now_bbd8229e4a52638e() {
6828
6860
  const ret = Date.now();
6829
6861
  return ret;
6830
6862
  };
Binary file
@@ -13,6 +13,7 @@ export const lorocounter_parent: (a: number) => number;
13
13
  export const lorocounter_isAttached: (a: number) => number;
14
14
  export const lorocounter_getAttached: (a: number) => number;
15
15
  export const lorocounter_getShallowValue: (a: number) => number;
16
+ export const lorocounter_toJSON: (a: number) => number;
16
17
  export const __wbg_awarenesswasm_free: (a: number, b: number) => void;
17
18
  export const awarenesswasm_new: (a: number, b: number) => number;
18
19
  export const awarenesswasm_encode: (a: number, b: number, c: number) => void;
@@ -285,6 +286,8 @@ export const undomanager_groupStart: (a: number, b: number) => void;
285
286
  export const undomanager_groupEnd: (a: number) => void;
286
287
  export const undomanager_canUndo: (a: number) => number;
287
288
  export const undomanager_canRedo: (a: number) => number;
289
+ export const undomanager_topUndoValue: (a: number) => number;
290
+ export const undomanager_topRedoValue: (a: number) => number;
288
291
  export const undomanager_setMaxUndoSteps: (a: number, b: number) => void;
289
292
  export const undomanager_setMergeInterval: (a: number, b: number) => void;
290
293
  export const undomanager_addExcludeOriginPrefix: (a: number, b: number, c: number) => void;
@@ -1640,6 +1640,7 @@ export class LoroCounter {
1640
1640
  * Get the value of the counter.
1641
1641
  */
1642
1642
  getShallowValue(): number;
1643
+ toJSON(): number;
1643
1644
  /**
1644
1645
  * The container id of this handler.
1645
1646
  */
@@ -2001,6 +2002,13 @@ export class LoroDoc {
2001
2002
  * the largest existing timestamp will be used instead.
2002
2003
  *
2003
2004
  * NOTE: The `origin` will not be persisted, but the `message` will.
2005
+ *
2006
+ * Behavior on empty commits:
2007
+ * - This method is an explicit commit. If the pending transaction is empty, any provided
2008
+ * options (message/timestamp/origin) are swallowed and will not carry over to the next commit.
2009
+ * - Implicit commits triggered by `export`/`checkout` act as processing barriers. If the
2010
+ * transaction is empty in those cases, `message`/`timestamp`/`origin` are preserved for the
2011
+ * next commit.
2004
2012
  */
2005
2013
  commit(options?: { origin?: string, timestamp?: number, message?: string } | null): void;
2006
2014
  /**
@@ -3621,6 +3629,16 @@ export class UndoManager {
3621
3629
  * Can redo the last operation.
3622
3630
  */
3623
3631
  canRedo(): boolean;
3632
+ /**
3633
+ * Get the value associated with the top undo stack item, if any.
3634
+ * Returns `undefined` if there is no undo item.
3635
+ */
3636
+ topUndoValue(): Value | undefined;
3637
+ /**
3638
+ * Get the value associated with the top redo stack item, if any.
3639
+ * Returns `undefined` if there is no redo item.
3640
+ */
3641
+ topRedoValue(): Value | undefined;
3624
3642
  /**
3625
3643
  * The number of max undo steps.
3626
3644
  * If the number of undo steps exceeds this number, the oldest undo step will be removed.
@@ -1122,6 +1122,13 @@ class LoroCounter {
1122
1122
  const ret = wasm.lorocounter_getShallowValue(this.__wbg_ptr);
1123
1123
  return ret;
1124
1124
  }
1125
+ /**
1126
+ * @returns {number}
1127
+ */
1128
+ toJSON() {
1129
+ const ret = wasm.lorocounter_toJSON(this.__wbg_ptr);
1130
+ return ret;
1131
+ }
1125
1132
  }
1126
1133
  module.exports.LoroCounter = LoroCounter;
1127
1134
 
@@ -1684,6 +1691,13 @@ class LoroDoc {
1684
1691
  * the largest existing timestamp will be used instead.
1685
1692
  *
1686
1693
  * NOTE: The `origin` will not be persisted, but the `message` will.
1694
+ *
1695
+ * Behavior on empty commits:
1696
+ * - This method is an explicit commit. If the pending transaction is empty, any provided
1697
+ * options (message/timestamp/origin) are swallowed and will not carry over to the next commit.
1698
+ * - Implicit commits triggered by `export`/`checkout` act as processing barriers. If the
1699
+ * transaction is empty in those cases, `message`/`timestamp`/`origin` are preserved for the
1700
+ * next commit.
1687
1701
  * @param {{ origin?: string, timestamp?: number, message?: string } | null} [options]
1688
1702
  */
1689
1703
  commit(options) {
@@ -6230,6 +6244,24 @@ class UndoManager {
6230
6244
  const ret = wasm.undomanager_canRedo(this.__wbg_ptr);
6231
6245
  return ret !== 0;
6232
6246
  }
6247
+ /**
6248
+ * Get the value associated with the top undo stack item, if any.
6249
+ * Returns `undefined` if there is no undo item.
6250
+ * @returns {Value | undefined}
6251
+ */
6252
+ topUndoValue() {
6253
+ const ret = wasm.undomanager_topUndoValue(this.__wbg_ptr);
6254
+ return takeObject(ret);
6255
+ }
6256
+ /**
6257
+ * Get the value associated with the top redo stack item, if any.
6258
+ * Returns `undefined` if there is no redo item.
6259
+ * @returns {Value | undefined}
6260
+ */
6261
+ topRedoValue() {
6262
+ const ret = wasm.undomanager_topRedoValue(this.__wbg_ptr);
6263
+ return takeObject(ret);
6264
+ }
6233
6265
  /**
6234
6266
  * The number of max undo steps.
6235
6267
  * If the number of undo steps exceeds this number, the oldest undo step will be removed.
@@ -6834,7 +6866,7 @@ module.exports.__wbg_node_02999533c4ea02e3 = function(arg0) {
6834
6866
  return addHeapObject(ret);
6835
6867
  };
6836
6868
 
6837
- module.exports.__wbg_now_4f8b2820be8a682c = function() {
6869
+ module.exports.__wbg_now_bbd8229e4a52638e = function() {
6838
6870
  const ret = Date.now();
6839
6871
  return ret;
6840
6872
  };
Binary file
@@ -13,6 +13,7 @@ export const lorocounter_parent: (a: number) => number;
13
13
  export const lorocounter_isAttached: (a: number) => number;
14
14
  export const lorocounter_getAttached: (a: number) => number;
15
15
  export const lorocounter_getShallowValue: (a: number) => number;
16
+ export const lorocounter_toJSON: (a: number) => number;
16
17
  export const __wbg_awarenesswasm_free: (a: number, b: number) => void;
17
18
  export const awarenesswasm_new: (a: number, b: number) => number;
18
19
  export const awarenesswasm_encode: (a: number, b: number, c: number) => void;
@@ -285,6 +286,8 @@ export const undomanager_groupStart: (a: number, b: number) => void;
285
286
  export const undomanager_groupEnd: (a: number) => void;
286
287
  export const undomanager_canUndo: (a: number) => number;
287
288
  export const undomanager_canRedo: (a: number) => number;
289
+ export const undomanager_topUndoValue: (a: number) => number;
290
+ export const undomanager_topRedoValue: (a: number) => number;
288
291
  export const undomanager_setMaxUndoSteps: (a: number, b: number) => void;
289
292
  export const undomanager_setMergeInterval: (a: number, b: number) => void;
290
293
  export const undomanager_addExcludeOriginPrefix: (a: number, b: number, c: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loro-crdt",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "description": "Loro CRDTs is a high-performance CRDT framework that makes your app state synchronized, collaborative and maintainable effortlessly.",
5
5
  "keywords": [
6
6
  "crdt",
@@ -1640,6 +1640,7 @@ export class LoroCounter {
1640
1640
  * Get the value of the counter.
1641
1641
  */
1642
1642
  getShallowValue(): number;
1643
+ toJSON(): number;
1643
1644
  /**
1644
1645
  * The container id of this handler.
1645
1646
  */
@@ -2001,6 +2002,13 @@ export class LoroDoc {
2001
2002
  * the largest existing timestamp will be used instead.
2002
2003
  *
2003
2004
  * NOTE: The `origin` will not be persisted, but the `message` will.
2005
+ *
2006
+ * Behavior on empty commits:
2007
+ * - This method is an explicit commit. If the pending transaction is empty, any provided
2008
+ * options (message/timestamp/origin) are swallowed and will not carry over to the next commit.
2009
+ * - Implicit commits triggered by `export`/`checkout` act as processing barriers. If the
2010
+ * transaction is empty in those cases, `message`/`timestamp`/`origin` are preserved for the
2011
+ * next commit.
2004
2012
  */
2005
2013
  commit(options?: { origin?: string, timestamp?: number, message?: string } | null): void;
2006
2014
  /**
@@ -3621,6 +3629,16 @@ export class UndoManager {
3621
3629
  * Can redo the last operation.
3622
3630
  */
3623
3631
  canRedo(): boolean;
3632
+ /**
3633
+ * Get the value associated with the top undo stack item, if any.
3634
+ * Returns `undefined` if there is no undo item.
3635
+ */
3636
+ topUndoValue(): Value | undefined;
3637
+ /**
3638
+ * Get the value associated with the top redo stack item, if any.
3639
+ * Returns `undefined` if there is no redo item.
3640
+ */
3641
+ topRedoValue(): Value | undefined;
3624
3642
  /**
3625
3643
  * The number of max undo steps.
3626
3644
  * If the number of undo steps exceeds this number, the oldest undo step will be removed.
@@ -3707,6 +3725,7 @@ export interface InitOutput {
3707
3725
  readonly lorocounter_isAttached: (a: number) => number;
3708
3726
  readonly lorocounter_getAttached: (a: number) => number;
3709
3727
  readonly lorocounter_getShallowValue: (a: number) => number;
3728
+ readonly lorocounter_toJSON: (a: number) => number;
3710
3729
  readonly __wbg_awarenesswasm_free: (a: number, b: number) => void;
3711
3730
  readonly awarenesswasm_new: (a: number, b: number) => number;
3712
3731
  readonly awarenesswasm_encode: (a: number, b: number, c: number) => void;
@@ -3979,6 +3998,8 @@ export interface InitOutput {
3979
3998
  readonly undomanager_groupEnd: (a: number) => void;
3980
3999
  readonly undomanager_canUndo: (a: number) => number;
3981
4000
  readonly undomanager_canRedo: (a: number) => number;
4001
+ readonly undomanager_topUndoValue: (a: number) => number;
4002
+ readonly undomanager_topRedoValue: (a: number) => number;
3982
4003
  readonly undomanager_setMaxUndoSteps: (a: number, b: number) => void;
3983
4004
  readonly undomanager_setMergeInterval: (a: number, b: number) => void;
3984
4005
  readonly undomanager_addExcludeOriginPrefix: (a: number, b: number, c: number) => void;
package/web/loro_wasm.js CHANGED
@@ -1114,6 +1114,13 @@ export class LoroCounter {
1114
1114
  const ret = wasm.lorocounter_getShallowValue(this.__wbg_ptr);
1115
1115
  return ret;
1116
1116
  }
1117
+ /**
1118
+ * @returns {number}
1119
+ */
1120
+ toJSON() {
1121
+ const ret = wasm.lorocounter_toJSON(this.__wbg_ptr);
1122
+ return ret;
1123
+ }
1117
1124
  }
1118
1125
 
1119
1126
  const LoroDocFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -1675,6 +1682,13 @@ export class LoroDoc {
1675
1682
  * the largest existing timestamp will be used instead.
1676
1683
  *
1677
1684
  * NOTE: The `origin` will not be persisted, but the `message` will.
1685
+ *
1686
+ * Behavior on empty commits:
1687
+ * - This method is an explicit commit. If the pending transaction is empty, any provided
1688
+ * options (message/timestamp/origin) are swallowed and will not carry over to the next commit.
1689
+ * - Implicit commits triggered by `export`/`checkout` act as processing barriers. If the
1690
+ * transaction is empty in those cases, `message`/`timestamp`/`origin` are preserved for the
1691
+ * next commit.
1678
1692
  * @param {{ origin?: string, timestamp?: number, message?: string } | null} [options]
1679
1693
  */
1680
1694
  commit(options) {
@@ -6214,6 +6228,24 @@ export class UndoManager {
6214
6228
  const ret = wasm.undomanager_canRedo(this.__wbg_ptr);
6215
6229
  return ret !== 0;
6216
6230
  }
6231
+ /**
6232
+ * Get the value associated with the top undo stack item, if any.
6233
+ * Returns `undefined` if there is no undo item.
6234
+ * @returns {Value | undefined}
6235
+ */
6236
+ topUndoValue() {
6237
+ const ret = wasm.undomanager_topUndoValue(this.__wbg_ptr);
6238
+ return takeObject(ret);
6239
+ }
6240
+ /**
6241
+ * Get the value associated with the top redo stack item, if any.
6242
+ * Returns `undefined` if there is no redo item.
6243
+ * @returns {Value | undefined}
6244
+ */
6245
+ topRedoValue() {
6246
+ const ret = wasm.undomanager_topRedoValue(this.__wbg_ptr);
6247
+ return takeObject(ret);
6248
+ }
6217
6249
  /**
6218
6250
  * The number of max undo steps.
6219
6251
  * If the number of undo steps exceeds this number, the oldest undo step will be removed.
@@ -6793,7 +6825,7 @@ function __wbg_get_imports() {
6793
6825
  const ret = getObject(arg0).node;
6794
6826
  return addHeapObject(ret);
6795
6827
  };
6796
- imports.wbg.__wbg_now_4f8b2820be8a682c = function() {
6828
+ imports.wbg.__wbg_now_bbd8229e4a52638e = function() {
6797
6829
  const ret = Date.now();
6798
6830
  return ret;
6799
6831
  };
Binary file
@@ -13,6 +13,7 @@ export const lorocounter_parent: (a: number) => number;
13
13
  export const lorocounter_isAttached: (a: number) => number;
14
14
  export const lorocounter_getAttached: (a: number) => number;
15
15
  export const lorocounter_getShallowValue: (a: number) => number;
16
+ export const lorocounter_toJSON: (a: number) => number;
16
17
  export const __wbg_awarenesswasm_free: (a: number, b: number) => void;
17
18
  export const awarenesswasm_new: (a: number, b: number) => number;
18
19
  export const awarenesswasm_encode: (a: number, b: number, c: number) => void;
@@ -285,6 +286,8 @@ export const undomanager_groupStart: (a: number, b: number) => void;
285
286
  export const undomanager_groupEnd: (a: number) => void;
286
287
  export const undomanager_canUndo: (a: number) => number;
287
288
  export const undomanager_canRedo: (a: number) => number;
289
+ export const undomanager_topUndoValue: (a: number) => number;
290
+ export const undomanager_topRedoValue: (a: number) => number;
288
291
  export const undomanager_setMaxUndoSteps: (a: number, b: number) => void;
289
292
  export const undomanager_setMergeInterval: (a: number, b: number) => void;
290
293
  export const undomanager_addExcludeOriginPrefix: (a: number, b: number, c: number) => void;