loro-crdt 1.6.0 → 1.7.0
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 +23 -0
- package/base64/index.js +29 -4
- package/base64/loro_wasm.d.ts +17 -0
- package/base64/loro_wasm_bg-ce6cdb00.js +64 -0
- package/bundler/loro_wasm.d.ts +17 -0
- package/bundler/loro_wasm_bg.js +26 -1
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +2 -0
- package/nodejs/loro_wasm.d.ts +17 -0
- package/nodejs/loro_wasm.js +26 -1
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +2 -0
- package/package.json +1 -1
- package/web/loro_wasm.d.ts +19 -0
- package/web/loro_wasm.js +26 -1
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +2 -0
- package/base64/loro_wasm_bg-654bb6e4.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3a0db5b: feat: add APIs to fetch values associated with the top Undo and Redo stack entries (#790)
|
|
8
|
+
- JS/WASM: `undo.topUndoValue()` and `undo.topRedoValue()` return the `value` from the top undo/redo item (or `undefined` when empty).
|
|
9
|
+
- Rust: `UndoManager::{top_undo_meta, top_redo_meta, top_undo_value, top_redo_value}` to inspect top-of-stack metadata and values.
|
|
10
|
+
- Internal: stack now supports peeking the top item metadata without mutation.
|
|
11
|
+
|
|
12
|
+
This enables attaching human-readable labels via `onPush`/`onPop` and retrieving them to keep Undo/Redo menu items up to date.
|
|
13
|
+
|
|
14
|
+
- 9a98e8d: Distinguish explicit vs implicit empty commit behavior for commit options.
|
|
15
|
+
- Explicit commits (user-invoked `commit()` / `commit_with(...)`): if the transaction is empty, commit options (message/timestamp/origin) are swallowed and will NOT carry over.
|
|
16
|
+
- Implicit commits (e.g., `export`, `checkout` internal barriers): if the transaction is empty, message/timestamp/origin are preserved for the next transaction.
|
|
17
|
+
|
|
18
|
+
Rationale: align behavior with intent. Explicit commits “finalize now”, so empty commits should not leak options. Implicit commits act as processing barriers and should not destroy user-provided options for the next real change.
|
|
19
|
+
|
|
20
|
+
Note: This refines behavior without changing the API.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 0fe9681: fix: handle default values for fractionalIndex and index in LoroTreeNode
|
|
25
|
+
|
|
3
26
|
## 1.6.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/base64/index.js
CHANGED
|
@@ -1683,6 +1683,13 @@ class LoroDoc {
|
|
|
1683
1683
|
* the largest existing timestamp will be used instead.
|
|
1684
1684
|
*
|
|
1685
1685
|
* NOTE: The `origin` will not be persisted, but the `message` will.
|
|
1686
|
+
*
|
|
1687
|
+
* Behavior on empty commits:
|
|
1688
|
+
* - This method is an explicit commit. If the pending transaction is empty, any provided
|
|
1689
|
+
* options (message/timestamp/origin) are swallowed and will not carry over to the next commit.
|
|
1690
|
+
* - Implicit commits triggered by `export`/`checkout` act as processing barriers. If the
|
|
1691
|
+
* transaction is empty in those cases, `message`/`timestamp`/`origin` are preserved for the
|
|
1692
|
+
* next commit.
|
|
1686
1693
|
* @param {{ origin?: string, timestamp?: number, message?: string } | null} [options]
|
|
1687
1694
|
*/
|
|
1688
1695
|
commit(options) {
|
|
@@ -6222,6 +6229,24 @@ class UndoManager {
|
|
|
6222
6229
|
const ret = wasm.undomanager_canRedo(this.__wbg_ptr);
|
|
6223
6230
|
return ret !== 0;
|
|
6224
6231
|
}
|
|
6232
|
+
/**
|
|
6233
|
+
* Get the value associated with the top undo stack item, if any.
|
|
6234
|
+
* Returns `undefined` if there is no undo item.
|
|
6235
|
+
* @returns {Value | undefined}
|
|
6236
|
+
*/
|
|
6237
|
+
topUndoValue() {
|
|
6238
|
+
const ret = wasm.undomanager_topUndoValue(this.__wbg_ptr);
|
|
6239
|
+
return takeObject(ret);
|
|
6240
|
+
}
|
|
6241
|
+
/**
|
|
6242
|
+
* Get the value associated with the top redo stack item, if any.
|
|
6243
|
+
* Returns `undefined` if there is no redo item.
|
|
6244
|
+
* @returns {Value | undefined}
|
|
6245
|
+
*/
|
|
6246
|
+
topRedoValue() {
|
|
6247
|
+
const ret = wasm.undomanager_topRedoValue(this.__wbg_ptr);
|
|
6248
|
+
return takeObject(ret);
|
|
6249
|
+
}
|
|
6225
6250
|
/**
|
|
6226
6251
|
* The number of max undo steps.
|
|
6227
6252
|
* If the number of undo steps exceeds this number, the oldest undo step will be removed.
|
|
@@ -6767,7 +6792,7 @@ function __wbg_node_02999533c4ea02e3(arg0) {
|
|
|
6767
6792
|
const ret = getObject(arg0).node;
|
|
6768
6793
|
return addHeapObject(ret);
|
|
6769
6794
|
}
|
|
6770
|
-
function
|
|
6795
|
+
function __wbg_now_bbd8229e4a52638e() {
|
|
6771
6796
|
const ret = Date.now();
|
|
6772
6797
|
return ret;
|
|
6773
6798
|
}
|
|
@@ -7063,7 +7088,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
7063
7088
|
__wbg_next_928df8c15fc0c9b0: __wbg_next_928df8c15fc0c9b0,
|
|
7064
7089
|
__wbg_next_9dc0926f351c7090: __wbg_next_9dc0926f351c7090,
|
|
7065
7090
|
__wbg_node_02999533c4ea02e3: __wbg_node_02999533c4ea02e3,
|
|
7066
|
-
|
|
7091
|
+
__wbg_now_bbd8229e4a52638e: __wbg_now_bbd8229e4a52638e,
|
|
7067
7092
|
__wbg_ownKeys_b16312a839a4152c: __wbg_ownKeys_b16312a839a4152c,
|
|
7068
7093
|
__wbg_process_5c1d670bc53614b8: __wbg_process_5c1d670bc53614b8,
|
|
7069
7094
|
__wbg_push_e7d7247e69dad3ee: __wbg_push_e7d7247e69dad3ee,
|
|
@@ -7128,7 +7153,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
7128
7153
|
// Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
|
|
7129
7154
|
|
|
7130
7155
|
if (!('Bun' in globalThis))
|
|
7131
|
-
import loro_wasm_bg_js from './loro_wasm_bg-
|
|
7156
|
+
import loro_wasm_bg_js from './loro_wasm_bg-ce6cdb00.js';
|
|
7132
7157
|
const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
|
|
7133
7158
|
"./loro_wasm_bg.js": imports,
|
|
7134
7159
|
});
|
|
@@ -7440,4 +7465,4 @@ function idStrToId(idStr) {
|
|
|
7440
7465
|
};
|
|
7441
7466
|
}
|
|
7442
7467
|
|
|
7443
|
-
export { Awareness, AwarenessWasm, ChangeModifier, Cursor, EphemeralStore, EphemeralStoreWasm, LORO_VERSION, Loro, LoroCounter, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, LoroTreeNode, UndoManager, VersionVector, __wbg_String_8f0eb39a4a4c2f66, __wbg_apply_9bb7fe8fff013a3f, __wbg_buffer_ef9774282e5dab94, __wbg_call_0ad083564791763a, __wbg_call_a34b6b4765f27be0, __wbg_call_d00953b926be4879, __wbg_call_efe5a4db7065d1a2, __wbg_changemodifier_new, __wbg_crypto_ed58b8e10a292839, __wbg_cursor_new, __wbg_done_f4c254830a095eaf, __wbg_entries_4dce6361e3ba6fbc, __wbg_entries_83beb641792ccb9c, __wbg_error_7534b8e9a36f1ab4, __wbg_error_9912f7d6d7835a4b, __wbg_from_3aa0fcaa8eef0104, __wbg_getRandomValues_bcb4912f16000dc4, __wbg_get_0c3cc364764a0b98, __wbg_get_b996a12be035ef4f, __wbg_getindex_a471648b3037c750, __wbg_getwithrefkey_1dc361bd10053bfe, __wbg_globalThis_6b4d52a0b6aaeaea, __wbg_global_49324ce12193de77, __wbg_instanceof_ArrayBuffer_ff40e55b5978e215, __wbg_instanceof_Map_0f3f3653f757ced1, __wbg_instanceof_Object_9108547bac1f91b1, __wbg_instanceof_Uint8Array_db97368f94b1373f, __wbg_isArray_8738f1062fa88586, __wbg_isSafeInteger_a1b3e0811faecf2f, __wbg_iterator_c0c688f37fa815e6, __wbg_length_12246a78d2f65d3a, __wbg_length_c24da17096edfe57, __wbg_log_0cc1b7768397bcfe, __wbg_log_0fd6c49475c7bece, __wbg_log_cb9e190acc5753fb, __wbg_lorocounter_new, __wbg_lorolist_new, __wbg_loromap_new, __wbg_loromovablelist_new, __wbg_lorotext_new, __wbg_lorotree_new, __wbg_lorotreenode_new, __wbg_mark_7438147ce31e9d4b, __wbg_measure_fb7825c11612c823, __wbg_msCrypto_0a36e2ec3a343d26, __wbg_new_518e2184725aa711, __wbg_new_59845962d1127937, __wbg_new_67abf4a77618ee3e, __wbg_new_8a6f238a6ece86ea, __wbg_new_e2d07398d7689006, __wbg_newnoargs_a136448eeb7d48ac, __wbg_newwithbyteoffsetandlength_84908302a4c137cf, __wbg_newwithlength_4c216eaaf23f2f9a, __wbg_newwithlength_88b49de1eb24d63e, __wbg_next_928df8c15fc0c9b0, __wbg_next_9dc0926f351c7090, __wbg_node_02999533c4ea02e3,
|
|
7468
|
+
export { Awareness, AwarenessWasm, ChangeModifier, Cursor, EphemeralStore, EphemeralStoreWasm, LORO_VERSION, Loro, LoroCounter, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, LoroTreeNode, UndoManager, VersionVector, __wbg_String_8f0eb39a4a4c2f66, __wbg_apply_9bb7fe8fff013a3f, __wbg_buffer_ef9774282e5dab94, __wbg_call_0ad083564791763a, __wbg_call_a34b6b4765f27be0, __wbg_call_d00953b926be4879, __wbg_call_efe5a4db7065d1a2, __wbg_changemodifier_new, __wbg_crypto_ed58b8e10a292839, __wbg_cursor_new, __wbg_done_f4c254830a095eaf, __wbg_entries_4dce6361e3ba6fbc, __wbg_entries_83beb641792ccb9c, __wbg_error_7534b8e9a36f1ab4, __wbg_error_9912f7d6d7835a4b, __wbg_from_3aa0fcaa8eef0104, __wbg_getRandomValues_bcb4912f16000dc4, __wbg_get_0c3cc364764a0b98, __wbg_get_b996a12be035ef4f, __wbg_getindex_a471648b3037c750, __wbg_getwithrefkey_1dc361bd10053bfe, __wbg_globalThis_6b4d52a0b6aaeaea, __wbg_global_49324ce12193de77, __wbg_instanceof_ArrayBuffer_ff40e55b5978e215, __wbg_instanceof_Map_0f3f3653f757ced1, __wbg_instanceof_Object_9108547bac1f91b1, __wbg_instanceof_Uint8Array_db97368f94b1373f, __wbg_isArray_8738f1062fa88586, __wbg_isSafeInteger_a1b3e0811faecf2f, __wbg_iterator_c0c688f37fa815e6, __wbg_length_12246a78d2f65d3a, __wbg_length_c24da17096edfe57, __wbg_log_0cc1b7768397bcfe, __wbg_log_0fd6c49475c7bece, __wbg_log_cb9e190acc5753fb, __wbg_lorocounter_new, __wbg_lorolist_new, __wbg_loromap_new, __wbg_loromovablelist_new, __wbg_lorotext_new, __wbg_lorotree_new, __wbg_lorotreenode_new, __wbg_mark_7438147ce31e9d4b, __wbg_measure_fb7825c11612c823, __wbg_msCrypto_0a36e2ec3a343d26, __wbg_new_518e2184725aa711, __wbg_new_59845962d1127937, __wbg_new_67abf4a77618ee3e, __wbg_new_8a6f238a6ece86ea, __wbg_new_e2d07398d7689006, __wbg_newnoargs_a136448eeb7d48ac, __wbg_newwithbyteoffsetandlength_84908302a4c137cf, __wbg_newwithlength_4c216eaaf23f2f9a, __wbg_newwithlength_88b49de1eb24d63e, __wbg_next_928df8c15fc0c9b0, __wbg_next_9dc0926f351c7090, __wbg_node_02999533c4ea02e3, __wbg_now_bbd8229e4a52638e, __wbg_ownKeys_b16312a839a4152c, __wbg_process_5c1d670bc53614b8, __wbg_push_e7d7247e69dad3ee, __wbg_randomFillSync_ab2cfe79ebbf2740, __wbg_require_79b1e9274cde3c87, __wbg_resolve_267ff08e7e1d2ce4, __wbg_self_cca3ca60d61220f4, __wbg_set_1b50d2de855a9d50, __wbg_set_393f510a6b7e9da5, __wbg_set_3f1d0b984ed272ed, __wbg_set_5deee49b10b2b780, __wbg_set_93ba9407b5476ec6, __wbg_set_wasm, __wbg_setindex_e0b7b31bfc87ba3f, __wbg_stack_0ed75d68575b0f3c, __wbg_subarray_2dc34705c0dc7cdb, __wbg_then_84907e7a6730461e, __wbg_value_51f8a88d4a1805fb, __wbg_versions_c71aa1626a93e0a1, __wbg_versionvector_new, __wbg_window_2aba046d3fc4ad7c, __wbindgen_as_number, __wbindgen_bigint_from_i64, __wbindgen_bigint_from_u64, __wbindgen_bigint_get_as_i64, __wbindgen_boolean_get, __wbindgen_cb_drop, __wbindgen_closure_wrapper563, __wbindgen_closure_wrapper565, __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, idStrToId, isContainer, isContainerId, newContainerID, newRootContainerID, redactJsonUpdates, run, setDebug };
|
package/base64/loro_wasm.d.ts
CHANGED
|
@@ -2001,6 +2001,13 @@ export class LoroDoc {
|
|
|
2001
2001
|
* the largest existing timestamp will be used instead.
|
|
2002
2002
|
*
|
|
2003
2003
|
* NOTE: The `origin` will not be persisted, but the `message` will.
|
|
2004
|
+
*
|
|
2005
|
+
* Behavior on empty commits:
|
|
2006
|
+
* - This method is an explicit commit. If the pending transaction is empty, any provided
|
|
2007
|
+
* options (message/timestamp/origin) are swallowed and will not carry over to the next commit.
|
|
2008
|
+
* - Implicit commits triggered by `export`/`checkout` act as processing barriers. If the
|
|
2009
|
+
* transaction is empty in those cases, `message`/`timestamp`/`origin` are preserved for the
|
|
2010
|
+
* next commit.
|
|
2004
2011
|
*/
|
|
2005
2012
|
commit(options?: { origin?: string, timestamp?: number, message?: string } | null): void;
|
|
2006
2013
|
/**
|
|
@@ -3621,6 +3628,16 @@ export class UndoManager {
|
|
|
3621
3628
|
* Can redo the last operation.
|
|
3622
3629
|
*/
|
|
3623
3630
|
canRedo(): boolean;
|
|
3631
|
+
/**
|
|
3632
|
+
* Get the value associated with the top undo stack item, if any.
|
|
3633
|
+
* Returns `undefined` if there is no undo item.
|
|
3634
|
+
*/
|
|
3635
|
+
topUndoValue(): Value | undefined;
|
|
3636
|
+
/**
|
|
3637
|
+
* Get the value associated with the top redo stack item, if any.
|
|
3638
|
+
* Returns `undefined` if there is no redo item.
|
|
3639
|
+
*/
|
|
3640
|
+
topRedoValue(): Value | undefined;
|
|
3624
3641
|
/**
|
|
3625
3642
|
* The number of max undo steps.
|
|
3626
3643
|
* If the number of undo steps exceeds this number, the oldest undo step will be removed.
|