loro-crdt 1.16.3 → 1.16.4
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 +65 -0
- package/base64/index.js +59 -32
- package/base64/loro_wasm.d.ts +50 -1
- package/browser/index.js +14 -14
- package/browser/loro_wasm.d.ts +50 -1
- package/browser/loro_wasm.js +42 -42
- package/browser/loro_wasm_bg.js +44 -17
- package/browser/loro_wasm_bg.wasm +0 -0
- package/browser/loro_wasm_bg.wasm.d.ts +1 -1
- package/bundler/index.js +14 -14
- package/bundler/loro_wasm.d.ts +50 -1
- package/bundler/loro_wasm_bg.js +44 -17
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +1 -1
- package/nodejs/loro_wasm.d.ts +50 -1
- package/nodejs/loro_wasm.js +44 -17
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +1 -1
- package/package.json +1 -1
- package/web/loro_wasm.d.ts +51 -2
- package/web/loro_wasm.js +44 -17
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +1 -1
- /package/browser/snippets/{loro-wasm-c600d14705866f8f → loro-wasm-704a44faa43c032c}/inline0.js +0 -0
- /package/bundler/snippets/{loro-wasm-c600d14705866f8f → loro-wasm-704a44faa43c032c}/inline0.js +0 -0
- /package/nodejs/snippets/{loro-wasm-c600d14705866f8f → loro-wasm-704a44faa43c032c}/inline0.js +0 -0
- /package/web/snippets/{loro-wasm-c600d14705866f8f → loro-wasm-704a44faa43c032c}/inline0.js +0 -0
package/base64/loro_wasm.d.ts
CHANGED
|
@@ -322,6 +322,29 @@ interface LoroDoc {
|
|
|
322
322
|
diff(from: OpId[], to: OpId[], for_json?: boolean): [ContainerID, JsonDiff|Diff][];
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Options for `LoroDoc.applyDiff`.
|
|
327
|
+
*/
|
|
328
|
+
export interface ApplyDiffOptions {
|
|
329
|
+
/**
|
|
330
|
+
* Read the batch as the result of `doc.diff()`: a mergeable child that the batch makes
|
|
331
|
+
* visible again carries its full content, which is aligned with whatever hidden state the
|
|
332
|
+
* target document keeps for it (none, the same, or different).
|
|
333
|
+
*
|
|
334
|
+
* Only use it for `doc.diff()` results (also after a JSON round trip), or for events from
|
|
335
|
+
* `import`/`checkout`, which report a revived child with its full content.
|
|
336
|
+
*
|
|
337
|
+
* Never use it for events from local commits. A local re-activation (such as
|
|
338
|
+
* `ensureMergeableCounter` over a deleted key) reports only the parent map change plus the
|
|
339
|
+
* commit's own ops, because the child's content did not change. With `fullState`, a
|
|
340
|
+
* missing child entry means "empty" and an entry means the whole content, so the hidden
|
|
341
|
+
* child would be cleared or overwritten (e.g. a counter at 7 becomes 0). Leave it unset
|
|
342
|
+
* (the default) for such events: their entries are increments, which is right when the
|
|
343
|
+
* target shares the source's hidden state.
|
|
344
|
+
*/
|
|
345
|
+
fullState?: boolean;
|
|
346
|
+
}
|
|
347
|
+
|
|
325
348
|
/**
|
|
326
349
|
* Represents a `Delta` type which is a union of different operations that can be performed.
|
|
327
350
|
*
|
|
@@ -1949,8 +1972,25 @@ export class LoroDoc {
|
|
|
1949
1972
|
* doc2.applyDiff(diff);
|
|
1950
1973
|
* console.log(doc2.getText("text").toString()); // "Hello"
|
|
1951
1974
|
* ```
|
|
1975
|
+
*
|
|
1976
|
+
* Pass `{ fullState: true }` when applying the result of `doc.diff()` to a document that may
|
|
1977
|
+
* keep hidden state for a mergeable child the diff makes visible again (e.g. applying
|
|
1978
|
+
* `doc.diff(afterDelete, beforeDelete)` to `doc` itself or to a copy of it). The child's
|
|
1979
|
+
* entry is then read as its full content and aligned with that hidden state. Without it
|
|
1980
|
+
* (the default), entries are applied as increments, which is right for events forwarded to
|
|
1981
|
+
* a document that shares the source's hidden state. Never pass it for events from local
|
|
1982
|
+
* commits; see `ApplyDiffOptions.fullState`.
|
|
1983
|
+
*
|
|
1984
|
+
* ```ts
|
|
1985
|
+
* const text = doc.getMap("m").ensureMergeableText("t");
|
|
1986
|
+
* text.insert(0, "hello");
|
|
1987
|
+
* const before = doc.frontiers();
|
|
1988
|
+
* doc.getMap("m").delete("t");
|
|
1989
|
+
* doc.applyDiff(doc.diff(doc.frontiers(), before), { fullState: true });
|
|
1990
|
+
* console.log(doc.getMap("m").get("t").toString()); // "hello"
|
|
1991
|
+
* ```
|
|
1952
1992
|
*/
|
|
1953
|
-
applyDiff(diff: [ContainerID, Diff|JsonDiff][]): void;
|
|
1993
|
+
applyDiff(diff: [ContainerID, Diff|JsonDiff][], options?: ApplyDiffOptions | null): void;
|
|
1954
1994
|
/**
|
|
1955
1995
|
* Check if the doc contains the full history.
|
|
1956
1996
|
*/
|
|
@@ -3979,10 +4019,19 @@ export class UndoManager {
|
|
|
3979
4019
|
peer(): PeerID;
|
|
3980
4020
|
/**
|
|
3981
4021
|
* Redo the last undone operation.
|
|
4022
|
+
*
|
|
4023
|
+
* Throws like `undo` on steps that would recreate a container of an
|
|
4024
|
+
* unknown type.
|
|
3982
4025
|
*/
|
|
3983
4026
|
redo(): boolean;
|
|
3984
4027
|
/**
|
|
3985
4028
|
* Undo the last operation.
|
|
4029
|
+
*
|
|
4030
|
+
* Throws without changing the doc if the step would have to recreate a
|
|
4031
|
+
* container of a type unknown to this version (created by a newer
|
|
4032
|
+
* loro-crdt). That step, with every edit merged into it, is dropped and its
|
|
4033
|
+
* edits stay; the next call undoes the step before it, rebased over the
|
|
4034
|
+
* dropped step's edits like over a remote peer's.
|
|
3986
4035
|
*/
|
|
3987
4036
|
undo(): boolean;
|
|
3988
4037
|
clear(): void;
|
package/browser/index.js
CHANGED
|
@@ -409,7 +409,7 @@ export {
|
|
|
409
409
|
__wbg_done_769e5ede4b31c67b,
|
|
410
410
|
__wbg_entries_3265d4158b33e5dc,
|
|
411
411
|
__wbg_entries_c8a90a7ed73e84ce,
|
|
412
|
-
|
|
412
|
+
__wbg_error_1d6f2b3f2c5a33ec,
|
|
413
413
|
__wbg_from_2a5d3e218e67aa85,
|
|
414
414
|
__wbg_getOwnPropertySymbols_97eebed6fe6e08be,
|
|
415
415
|
__wbg_getRandomValues_b8f5dbd5f3995a9e,
|
|
@@ -428,7 +428,7 @@ export {
|
|
|
428
428
|
__wbg_length_e2d2a49132c1b256,
|
|
429
429
|
__wbg_log_0cc1b7768397bcfe,
|
|
430
430
|
__wbg_log_cb9e190acc5753fb,
|
|
431
|
-
|
|
431
|
+
__wbg_log_f665cabe523a97df,
|
|
432
432
|
__wbg_lorocounter_new,
|
|
433
433
|
__wbg_lorolist_new,
|
|
434
434
|
__wbg_loromap_new,
|
|
@@ -465,15 +465,15 @@ export {
|
|
|
465
465
|
__wbg_set_bb8cecf6a62b9f46,
|
|
466
466
|
__wbg_set_wasm,
|
|
467
467
|
__wbg_setindex_dcd71eabf405bde1,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
468
|
+
__wbg_stateBinary_9e1da8a4daa74bc6,
|
|
469
|
+
__wbg_stateCid_c43ea762fb462319,
|
|
470
|
+
__wbg_stateContainer_cd983f42c6fe987d,
|
|
471
|
+
__wbg_stateIndex_1fbac6394e58cff9,
|
|
472
|
+
__wbg_stateOptions_dcb483514d1b925d,
|
|
473
|
+
__wbg_stateRootCid_9198769cdd9f37d5,
|
|
474
|
+
__wbg_stateSet_a3e74b27d3d26f9d,
|
|
475
|
+
__wbg_stateSlice_aafffe8ecba122b8,
|
|
476
|
+
__wbg_stateValue_8ed644fcdb61558c,
|
|
477
477
|
__wbg_static_accessor_GLOBAL_88a902d13a557d07,
|
|
478
478
|
__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0,
|
|
479
479
|
__wbg_static_accessor_SELF_37c5d418e4bf5819,
|
|
@@ -483,15 +483,15 @@ export {
|
|
|
483
483
|
__wbg_value_cd1ffa7b1ab794f1,
|
|
484
484
|
__wbg_versions_c01dfd4722a88165,
|
|
485
485
|
__wbg_versionvector_new,
|
|
486
|
-
|
|
486
|
+
__wbg_warn_52b319b1b6be3d2f,
|
|
487
487
|
__wbindgen_as_number,
|
|
488
488
|
__wbindgen_bigint_from_i64,
|
|
489
489
|
__wbindgen_bigint_from_u64,
|
|
490
490
|
__wbindgen_bigint_get_as_i64,
|
|
491
491
|
__wbindgen_boolean_get,
|
|
492
492
|
__wbindgen_cb_drop,
|
|
493
|
-
|
|
494
|
-
|
|
493
|
+
__wbindgen_closure_wrapper285,
|
|
494
|
+
__wbindgen_closure_wrapper544,
|
|
495
495
|
__wbindgen_debug_string,
|
|
496
496
|
__wbindgen_error_new,
|
|
497
497
|
__wbindgen_in,
|
package/browser/loro_wasm.d.ts
CHANGED
|
@@ -322,6 +322,29 @@ interface LoroDoc {
|
|
|
322
322
|
diff(from: OpId[], to: OpId[], for_json?: boolean): [ContainerID, JsonDiff|Diff][];
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Options for `LoroDoc.applyDiff`.
|
|
327
|
+
*/
|
|
328
|
+
export interface ApplyDiffOptions {
|
|
329
|
+
/**
|
|
330
|
+
* Read the batch as the result of `doc.diff()`: a mergeable child that the batch makes
|
|
331
|
+
* visible again carries its full content, which is aligned with whatever hidden state the
|
|
332
|
+
* target document keeps for it (none, the same, or different).
|
|
333
|
+
*
|
|
334
|
+
* Only use it for `doc.diff()` results (also after a JSON round trip), or for events from
|
|
335
|
+
* `import`/`checkout`, which report a revived child with its full content.
|
|
336
|
+
*
|
|
337
|
+
* Never use it for events from local commits. A local re-activation (such as
|
|
338
|
+
* `ensureMergeableCounter` over a deleted key) reports only the parent map change plus the
|
|
339
|
+
* commit's own ops, because the child's content did not change. With `fullState`, a
|
|
340
|
+
* missing child entry means "empty" and an entry means the whole content, so the hidden
|
|
341
|
+
* child would be cleared or overwritten (e.g. a counter at 7 becomes 0). Leave it unset
|
|
342
|
+
* (the default) for such events: their entries are increments, which is right when the
|
|
343
|
+
* target shares the source's hidden state.
|
|
344
|
+
*/
|
|
345
|
+
fullState?: boolean;
|
|
346
|
+
}
|
|
347
|
+
|
|
325
348
|
/**
|
|
326
349
|
* Represents a `Delta` type which is a union of different operations that can be performed.
|
|
327
350
|
*
|
|
@@ -1949,8 +1972,25 @@ export class LoroDoc {
|
|
|
1949
1972
|
* doc2.applyDiff(diff);
|
|
1950
1973
|
* console.log(doc2.getText("text").toString()); // "Hello"
|
|
1951
1974
|
* ```
|
|
1975
|
+
*
|
|
1976
|
+
* Pass `{ fullState: true }` when applying the result of `doc.diff()` to a document that may
|
|
1977
|
+
* keep hidden state for a mergeable child the diff makes visible again (e.g. applying
|
|
1978
|
+
* `doc.diff(afterDelete, beforeDelete)` to `doc` itself or to a copy of it). The child's
|
|
1979
|
+
* entry is then read as its full content and aligned with that hidden state. Without it
|
|
1980
|
+
* (the default), entries are applied as increments, which is right for events forwarded to
|
|
1981
|
+
* a document that shares the source's hidden state. Never pass it for events from local
|
|
1982
|
+
* commits; see `ApplyDiffOptions.fullState`.
|
|
1983
|
+
*
|
|
1984
|
+
* ```ts
|
|
1985
|
+
* const text = doc.getMap("m").ensureMergeableText("t");
|
|
1986
|
+
* text.insert(0, "hello");
|
|
1987
|
+
* const before = doc.frontiers();
|
|
1988
|
+
* doc.getMap("m").delete("t");
|
|
1989
|
+
* doc.applyDiff(doc.diff(doc.frontiers(), before), { fullState: true });
|
|
1990
|
+
* console.log(doc.getMap("m").get("t").toString()); // "hello"
|
|
1991
|
+
* ```
|
|
1952
1992
|
*/
|
|
1953
|
-
applyDiff(diff: [ContainerID, Diff|JsonDiff][]): void;
|
|
1993
|
+
applyDiff(diff: [ContainerID, Diff|JsonDiff][], options?: ApplyDiffOptions | null): void;
|
|
1954
1994
|
/**
|
|
1955
1995
|
* Check if the doc contains the full history.
|
|
1956
1996
|
*/
|
|
@@ -3979,10 +4019,19 @@ export class UndoManager {
|
|
|
3979
4019
|
peer(): PeerID;
|
|
3980
4020
|
/**
|
|
3981
4021
|
* Redo the last undone operation.
|
|
4022
|
+
*
|
|
4023
|
+
* Throws like `undo` on steps that would recreate a container of an
|
|
4024
|
+
* unknown type.
|
|
3982
4025
|
*/
|
|
3983
4026
|
redo(): boolean;
|
|
3984
4027
|
/**
|
|
3985
4028
|
* Undo the last operation.
|
|
4029
|
+
*
|
|
4030
|
+
* Throws without changing the doc if the step would have to recreate a
|
|
4031
|
+
* container of a type unknown to this version (created by a newer
|
|
4032
|
+
* loro-crdt). That step, with every edit merged into it, is dropped and its
|
|
4033
|
+
* edits stay; the next call undoes the step before it, rebased over the
|
|
4034
|
+
* dropped step's edits like over a remote peer's.
|
|
3986
4035
|
*/
|
|
3987
4036
|
undo(): boolean;
|
|
3988
4037
|
clear(): void;
|
package/browser/loro_wasm.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
__wbg_done_769e5ede4b31c67b,
|
|
29
29
|
__wbg_entries_3265d4158b33e5dc,
|
|
30
30
|
__wbg_entries_c8a90a7ed73e84ce,
|
|
31
|
-
|
|
31
|
+
__wbg_error_1d6f2b3f2c5a33ec,
|
|
32
32
|
__wbg_from_2a5d3e218e67aa85,
|
|
33
33
|
__wbg_getOwnPropertySymbols_97eebed6fe6e08be,
|
|
34
34
|
__wbg_getRandomValues_b8f5dbd5f3995a9e,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
__wbg_length_e2d2a49132c1b256,
|
|
48
48
|
__wbg_log_0cc1b7768397bcfe,
|
|
49
49
|
__wbg_log_cb9e190acc5753fb,
|
|
50
|
-
|
|
50
|
+
__wbg_log_f665cabe523a97df,
|
|
51
51
|
__wbg_lorocounter_new,
|
|
52
52
|
__wbg_lorolist_new,
|
|
53
53
|
__wbg_loromap_new,
|
|
@@ -84,15 +84,15 @@ import {
|
|
|
84
84
|
__wbg_set_bb8cecf6a62b9f46,
|
|
85
85
|
__wbg_set_wasm,
|
|
86
86
|
__wbg_setindex_dcd71eabf405bde1,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
__wbg_stateBinary_9e1da8a4daa74bc6,
|
|
88
|
+
__wbg_stateCid_c43ea762fb462319,
|
|
89
|
+
__wbg_stateContainer_cd983f42c6fe987d,
|
|
90
|
+
__wbg_stateIndex_1fbac6394e58cff9,
|
|
91
|
+
__wbg_stateOptions_dcb483514d1b925d,
|
|
92
|
+
__wbg_stateRootCid_9198769cdd9f37d5,
|
|
93
|
+
__wbg_stateSet_a3e74b27d3d26f9d,
|
|
94
|
+
__wbg_stateSlice_aafffe8ecba122b8,
|
|
95
|
+
__wbg_stateValue_8ed644fcdb61558c,
|
|
96
96
|
__wbg_static_accessor_GLOBAL_88a902d13a557d07,
|
|
97
97
|
__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0,
|
|
98
98
|
__wbg_static_accessor_SELF_37c5d418e4bf5819,
|
|
@@ -102,15 +102,15 @@ import {
|
|
|
102
102
|
__wbg_value_cd1ffa7b1ab794f1,
|
|
103
103
|
__wbg_versions_c01dfd4722a88165,
|
|
104
104
|
__wbg_versionvector_new,
|
|
105
|
-
|
|
105
|
+
__wbg_warn_52b319b1b6be3d2f,
|
|
106
106
|
__wbindgen_as_number,
|
|
107
107
|
__wbindgen_bigint_from_i64,
|
|
108
108
|
__wbindgen_bigint_from_u64,
|
|
109
109
|
__wbindgen_bigint_get_as_i64,
|
|
110
110
|
__wbindgen_boolean_get,
|
|
111
111
|
__wbindgen_cb_drop,
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
__wbindgen_closure_wrapper285,
|
|
113
|
+
__wbindgen_closure_wrapper544,
|
|
114
114
|
__wbindgen_debug_string,
|
|
115
115
|
__wbindgen_error_new,
|
|
116
116
|
__wbindgen_in,
|
|
@@ -176,7 +176,7 @@ const imports = {
|
|
|
176
176
|
__wbg_done_769e5ede4b31c67b,
|
|
177
177
|
__wbg_entries_3265d4158b33e5dc,
|
|
178
178
|
__wbg_entries_c8a90a7ed73e84ce,
|
|
179
|
-
|
|
179
|
+
__wbg_error_1d6f2b3f2c5a33ec,
|
|
180
180
|
__wbg_from_2a5d3e218e67aa85,
|
|
181
181
|
__wbg_getOwnPropertySymbols_97eebed6fe6e08be,
|
|
182
182
|
__wbg_getRandomValues_b8f5dbd5f3995a9e,
|
|
@@ -195,7 +195,7 @@ const imports = {
|
|
|
195
195
|
__wbg_length_e2d2a49132c1b256,
|
|
196
196
|
__wbg_log_0cc1b7768397bcfe,
|
|
197
197
|
__wbg_log_cb9e190acc5753fb,
|
|
198
|
-
|
|
198
|
+
__wbg_log_f665cabe523a97df,
|
|
199
199
|
__wbg_lorocounter_new,
|
|
200
200
|
__wbg_lorolist_new,
|
|
201
201
|
__wbg_loromap_new,
|
|
@@ -232,15 +232,15 @@ const imports = {
|
|
|
232
232
|
__wbg_set_bb8cecf6a62b9f46,
|
|
233
233
|
__wbg_set_wasm,
|
|
234
234
|
__wbg_setindex_dcd71eabf405bde1,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
235
|
+
__wbg_stateBinary_9e1da8a4daa74bc6,
|
|
236
|
+
__wbg_stateCid_c43ea762fb462319,
|
|
237
|
+
__wbg_stateContainer_cd983f42c6fe987d,
|
|
238
|
+
__wbg_stateIndex_1fbac6394e58cff9,
|
|
239
|
+
__wbg_stateOptions_dcb483514d1b925d,
|
|
240
|
+
__wbg_stateRootCid_9198769cdd9f37d5,
|
|
241
|
+
__wbg_stateSet_a3e74b27d3d26f9d,
|
|
242
|
+
__wbg_stateSlice_aafffe8ecba122b8,
|
|
243
|
+
__wbg_stateValue_8ed644fcdb61558c,
|
|
244
244
|
__wbg_static_accessor_GLOBAL_88a902d13a557d07,
|
|
245
245
|
__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0,
|
|
246
246
|
__wbg_static_accessor_SELF_37c5d418e4bf5819,
|
|
@@ -250,15 +250,15 @@ const imports = {
|
|
|
250
250
|
__wbg_value_cd1ffa7b1ab794f1,
|
|
251
251
|
__wbg_versions_c01dfd4722a88165,
|
|
252
252
|
__wbg_versionvector_new,
|
|
253
|
-
|
|
253
|
+
__wbg_warn_52b319b1b6be3d2f,
|
|
254
254
|
__wbindgen_as_number,
|
|
255
255
|
__wbindgen_bigint_from_i64,
|
|
256
256
|
__wbindgen_bigint_from_u64,
|
|
257
257
|
__wbindgen_bigint_get_as_i64,
|
|
258
258
|
__wbindgen_boolean_get,
|
|
259
259
|
__wbindgen_cb_drop,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
__wbindgen_closure_wrapper285,
|
|
261
|
+
__wbindgen_closure_wrapper544,
|
|
262
262
|
__wbindgen_debug_string,
|
|
263
263
|
__wbindgen_error_new,
|
|
264
264
|
__wbindgen_in,
|
|
@@ -378,7 +378,7 @@ export {
|
|
|
378
378
|
__wbg_done_769e5ede4b31c67b,
|
|
379
379
|
__wbg_entries_3265d4158b33e5dc,
|
|
380
380
|
__wbg_entries_c8a90a7ed73e84ce,
|
|
381
|
-
|
|
381
|
+
__wbg_error_1d6f2b3f2c5a33ec,
|
|
382
382
|
__wbg_from_2a5d3e218e67aa85,
|
|
383
383
|
__wbg_getOwnPropertySymbols_97eebed6fe6e08be,
|
|
384
384
|
__wbg_getRandomValues_b8f5dbd5f3995a9e,
|
|
@@ -397,7 +397,7 @@ export {
|
|
|
397
397
|
__wbg_length_e2d2a49132c1b256,
|
|
398
398
|
__wbg_log_0cc1b7768397bcfe,
|
|
399
399
|
__wbg_log_cb9e190acc5753fb,
|
|
400
|
-
|
|
400
|
+
__wbg_log_f665cabe523a97df,
|
|
401
401
|
__wbg_lorocounter_new,
|
|
402
402
|
__wbg_lorolist_new,
|
|
403
403
|
__wbg_loromap_new,
|
|
@@ -434,15 +434,15 @@ export {
|
|
|
434
434
|
__wbg_set_bb8cecf6a62b9f46,
|
|
435
435
|
__wbg_set_wasm,
|
|
436
436
|
__wbg_setindex_dcd71eabf405bde1,
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
437
|
+
__wbg_stateBinary_9e1da8a4daa74bc6,
|
|
438
|
+
__wbg_stateCid_c43ea762fb462319,
|
|
439
|
+
__wbg_stateContainer_cd983f42c6fe987d,
|
|
440
|
+
__wbg_stateIndex_1fbac6394e58cff9,
|
|
441
|
+
__wbg_stateOptions_dcb483514d1b925d,
|
|
442
|
+
__wbg_stateRootCid_9198769cdd9f37d5,
|
|
443
|
+
__wbg_stateSet_a3e74b27d3d26f9d,
|
|
444
|
+
__wbg_stateSlice_aafffe8ecba122b8,
|
|
445
|
+
__wbg_stateValue_8ed644fcdb61558c,
|
|
446
446
|
__wbg_static_accessor_GLOBAL_88a902d13a557d07,
|
|
447
447
|
__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0,
|
|
448
448
|
__wbg_static_accessor_SELF_37c5d418e4bf5819,
|
|
@@ -452,15 +452,15 @@ export {
|
|
|
452
452
|
__wbg_value_cd1ffa7b1ab794f1,
|
|
453
453
|
__wbg_versions_c01dfd4722a88165,
|
|
454
454
|
__wbg_versionvector_new,
|
|
455
|
-
|
|
455
|
+
__wbg_warn_52b319b1b6be3d2f,
|
|
456
456
|
__wbindgen_as_number,
|
|
457
457
|
__wbindgen_bigint_from_i64,
|
|
458
458
|
__wbindgen_bigint_from_u64,
|
|
459
459
|
__wbindgen_bigint_get_as_i64,
|
|
460
460
|
__wbindgen_boolean_get,
|
|
461
461
|
__wbindgen_cb_drop,
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
__wbindgen_closure_wrapper285,
|
|
463
|
+
__wbindgen_closure_wrapper544,
|
|
464
464
|
__wbindgen_debug_string,
|
|
465
465
|
__wbindgen_error_new,
|
|
466
466
|
__wbindgen_in,
|
package/browser/loro_wasm_bg.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stateBinary, stateCid, stateContainer, stateIndex, stateOptions, stateRootCid, stateSet, stateSlice, stateValue } from './snippets/loro-wasm-
|
|
1
|
+
import { stateBinary, stateCid, stateContainer, stateIndex, stateOptions, stateRootCid, stateSet, stateSlice, stateValue } from './snippets/loro-wasm-704a44faa43c032c/inline0.js';
|
|
2
2
|
|
|
3
3
|
let wasm;
|
|
4
4
|
export function __wbg_set_wasm(val) {
|
|
@@ -1360,12 +1360,30 @@ export class LoroDoc {
|
|
|
1360
1360
|
* doc2.applyDiff(diff);
|
|
1361
1361
|
* console.log(doc2.getText("text").toString()); // "Hello"
|
|
1362
1362
|
* ```
|
|
1363
|
+
*
|
|
1364
|
+
* Pass `{ fullState: true }` when applying the result of `doc.diff()` to a document that may
|
|
1365
|
+
* keep hidden state for a mergeable child the diff makes visible again (e.g. applying
|
|
1366
|
+
* `doc.diff(afterDelete, beforeDelete)` to `doc` itself or to a copy of it). The child's
|
|
1367
|
+
* entry is then read as its full content and aligned with that hidden state. Without it
|
|
1368
|
+
* (the default), entries are applied as increments, which is right for events forwarded to
|
|
1369
|
+
* a document that shares the source's hidden state. Never pass it for events from local
|
|
1370
|
+
* commits; see `ApplyDiffOptions.fullState`.
|
|
1371
|
+
*
|
|
1372
|
+
* ```ts
|
|
1373
|
+
* const text = doc.getMap("m").ensureMergeableText("t");
|
|
1374
|
+
* text.insert(0, "hello");
|
|
1375
|
+
* const before = doc.frontiers();
|
|
1376
|
+
* doc.getMap("m").delete("t");
|
|
1377
|
+
* doc.applyDiff(doc.diff(doc.frontiers(), before), { fullState: true });
|
|
1378
|
+
* console.log(doc.getMap("m").get("t").toString()); // "hello"
|
|
1379
|
+
* ```
|
|
1363
1380
|
* @param {[ContainerID, Diff|JsonDiff][]} diff
|
|
1381
|
+
* @param {ApplyDiffOptions | null} [options]
|
|
1364
1382
|
*/
|
|
1365
|
-
applyDiff(diff) {
|
|
1383
|
+
applyDiff(diff, options) {
|
|
1366
1384
|
try {
|
|
1367
1385
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1368
|
-
wasm.lorodoc_applyDiff(retptr, this.__wbg_ptr, addHeapObject(diff));
|
|
1386
|
+
wasm.lorodoc_applyDiff(retptr, this.__wbg_ptr, addHeapObject(diff), isLikeNone(options) ? 0 : addHeapObject(options));
|
|
1369
1387
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1370
1388
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1371
1389
|
if (r1) {
|
|
@@ -7421,6 +7439,9 @@ export class UndoManager {
|
|
|
7421
7439
|
}
|
|
7422
7440
|
/**
|
|
7423
7441
|
* Redo the last undone operation.
|
|
7442
|
+
*
|
|
7443
|
+
* Throws like `undo` on steps that would recreate a container of an
|
|
7444
|
+
* unknown type.
|
|
7424
7445
|
* @returns {boolean}
|
|
7425
7446
|
*/
|
|
7426
7447
|
redo() {
|
|
@@ -7440,6 +7461,12 @@ export class UndoManager {
|
|
|
7440
7461
|
}
|
|
7441
7462
|
/**
|
|
7442
7463
|
* Undo the last operation.
|
|
7464
|
+
*
|
|
7465
|
+
* Throws without changing the doc if the step would have to recreate a
|
|
7466
|
+
* container of a type unknown to this version (created by a newer
|
|
7467
|
+
* loro-crdt). That step, with every edit merged into it, is dropped and its
|
|
7468
|
+
* edits stay; the next call undoes the step before it, rebased over the
|
|
7469
|
+
* dropped step's edits like over a remote peer's.
|
|
7443
7470
|
* @returns {boolean}
|
|
7444
7471
|
*/
|
|
7445
7472
|
undo() {
|
|
@@ -7828,7 +7855,7 @@ export function __wbg_entries_c8a90a7ed73e84ce(arg0) {
|
|
|
7828
7855
|
return addHeapObject(ret);
|
|
7829
7856
|
};
|
|
7830
7857
|
|
|
7831
|
-
export function
|
|
7858
|
+
export function __wbg_error_1d6f2b3f2c5a33ec(arg0, arg1) {
|
|
7832
7859
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
7833
7860
|
};
|
|
7834
7861
|
|
|
@@ -7959,7 +7986,7 @@ export function __wbg_log_cb9e190acc5753fb(arg0, arg1) {
|
|
|
7959
7986
|
}
|
|
7960
7987
|
};
|
|
7961
7988
|
|
|
7962
|
-
export function
|
|
7989
|
+
export function __wbg_log_f665cabe523a97df(arg0, arg1) {
|
|
7963
7990
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
7964
7991
|
};
|
|
7965
7992
|
|
|
@@ -8144,45 +8171,45 @@ export function __wbg_setindex_dcd71eabf405bde1(arg0, arg1, arg2) {
|
|
|
8144
8171
|
getObject(arg0)[arg1 >>> 0] = arg2;
|
|
8145
8172
|
};
|
|
8146
8173
|
|
|
8147
|
-
export function
|
|
8174
|
+
export function __wbg_stateBinary_9e1da8a4daa74bc6(arg0, arg1) {
|
|
8148
8175
|
const ret = stateBinary(getArrayU8FromWasm0(arg0, arg1));
|
|
8149
8176
|
return addHeapObject(ret);
|
|
8150
8177
|
};
|
|
8151
8178
|
|
|
8152
|
-
export function
|
|
8179
|
+
export function __wbg_stateCid_c43ea762fb462319(arg0, arg1, arg2) {
|
|
8153
8180
|
const ret = stateCid(getObject(arg0), arg1, arg2);
|
|
8154
8181
|
return addHeapObject(ret);
|
|
8155
8182
|
};
|
|
8156
8183
|
|
|
8157
|
-
export function
|
|
8184
|
+
export function __wbg_stateContainer_cd983f42c6fe987d(arg0, arg1, arg2) {
|
|
8158
8185
|
const ret = stateContainer(arg0, getObject(arg1), takeObject(arg2));
|
|
8159
8186
|
return addHeapObject(ret);
|
|
8160
8187
|
};
|
|
8161
8188
|
|
|
8162
|
-
export function
|
|
8189
|
+
export function __wbg_stateIndex_1fbac6394e58cff9() { return handleError(function (arg0, arg1, arg2) {
|
|
8163
8190
|
stateIndex(getObject(arg0), arg1 >>> 0, getObject(arg2));
|
|
8164
8191
|
}, arguments) };
|
|
8165
8192
|
|
|
8166
|
-
export function
|
|
8193
|
+
export function __wbg_stateOptions_dcb483514d1b925d() { return handleError(function (arg0, arg1) {
|
|
8167
8194
|
const ret = stateOptions(takeObject(arg0), arg1 !== 0);
|
|
8168
8195
|
return addHeapObject(ret);
|
|
8169
8196
|
}, arguments) };
|
|
8170
8197
|
|
|
8171
|
-
export function
|
|
8198
|
+
export function __wbg_stateRootCid_9198769cdd9f37d5(arg0, arg1, arg2) {
|
|
8172
8199
|
const ret = stateRootCid(getStringFromWasm0(arg0, arg1), arg2);
|
|
8173
8200
|
return addHeapObject(ret);
|
|
8174
8201
|
};
|
|
8175
8202
|
|
|
8176
|
-
export function
|
|
8203
|
+
export function __wbg_stateSet_a3e74b27d3d26f9d() { return handleError(function (arg0, arg1, arg2) {
|
|
8177
8204
|
stateSet(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
8178
8205
|
}, arguments) };
|
|
8179
8206
|
|
|
8180
|
-
export function
|
|
8207
|
+
export function __wbg_stateSlice_aafffe8ecba122b8(arg0, arg1, arg2) {
|
|
8181
8208
|
const ret = stateSlice(takeObject(arg0), arg1 >>> 0, arg2 >>> 0);
|
|
8182
8209
|
return addHeapObject(ret);
|
|
8183
8210
|
};
|
|
8184
8211
|
|
|
8185
|
-
export function
|
|
8212
|
+
export function __wbg_stateValue_8ed644fcdb61558c(arg0) {
|
|
8186
8213
|
const ret = stateValue(takeObject(arg0));
|
|
8187
8214
|
return addHeapObject(ret);
|
|
8188
8215
|
};
|
|
@@ -8232,7 +8259,7 @@ export function __wbg_versionvector_new(arg0) {
|
|
|
8232
8259
|
return addHeapObject(ret);
|
|
8233
8260
|
};
|
|
8234
8261
|
|
|
8235
|
-
export function
|
|
8262
|
+
export function __wbg_warn_52b319b1b6be3d2f(arg0, arg1) {
|
|
8236
8263
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
8237
8264
|
};
|
|
8238
8265
|
|
|
@@ -8274,12 +8301,12 @@ export function __wbindgen_cb_drop(arg0) {
|
|
|
8274
8301
|
return ret;
|
|
8275
8302
|
};
|
|
8276
8303
|
|
|
8277
|
-
export function
|
|
8304
|
+
export function __wbindgen_closure_wrapper285(arg0, arg1, arg2) {
|
|
8278
8305
|
const ret = makeMutClosure(arg0, arg1, 15, __wbg_adapter_58);
|
|
8279
8306
|
return addHeapObject(ret);
|
|
8280
8307
|
};
|
|
8281
8308
|
|
|
8282
|
-
export function
|
|
8309
|
+
export function __wbindgen_closure_wrapper544(arg0, arg1, arg2) {
|
|
8283
8310
|
const ret = makeMutClosure(arg0, arg1, 15, __wbg_adapter_61);
|
|
8284
8311
|
return addHeapObject(ret);
|
|
8285
8312
|
};
|
|
Binary file
|
|
@@ -66,7 +66,7 @@ export const lorocounter_parent: (a: number, b: number) => void;
|
|
|
66
66
|
export const lorocounter_subscribe: (a: number, b: number, c: number) => void;
|
|
67
67
|
export const lorocounter_toContainerTree: (a: number, b: number, c: number) => void;
|
|
68
68
|
export const lorodoc_JSONPath: (a: number, b: number, c: number, d: number) => void;
|
|
69
|
-
export const lorodoc_applyDiff: (a: number, b: number, c: number) => void;
|
|
69
|
+
export const lorodoc_applyDiff: (a: number, b: number, c: number, d: number) => void;
|
|
70
70
|
export const lorodoc_attach: (a: number) => void;
|
|
71
71
|
export const lorodoc_changeCount: (a: number) => number;
|
|
72
72
|
export const lorodoc_checkout: (a: number, b: number, c: number, d: number) => void;
|
package/bundler/index.js
CHANGED
|
@@ -409,7 +409,7 @@ export {
|
|
|
409
409
|
__wbg_done_769e5ede4b31c67b,
|
|
410
410
|
__wbg_entries_3265d4158b33e5dc,
|
|
411
411
|
__wbg_entries_c8a90a7ed73e84ce,
|
|
412
|
-
|
|
412
|
+
__wbg_error_1d6f2b3f2c5a33ec,
|
|
413
413
|
__wbg_from_2a5d3e218e67aa85,
|
|
414
414
|
__wbg_getOwnPropertySymbols_97eebed6fe6e08be,
|
|
415
415
|
__wbg_getRandomValues_b8f5dbd5f3995a9e,
|
|
@@ -428,7 +428,7 @@ export {
|
|
|
428
428
|
__wbg_length_e2d2a49132c1b256,
|
|
429
429
|
__wbg_log_0cc1b7768397bcfe,
|
|
430
430
|
__wbg_log_cb9e190acc5753fb,
|
|
431
|
-
|
|
431
|
+
__wbg_log_f665cabe523a97df,
|
|
432
432
|
__wbg_lorocounter_new,
|
|
433
433
|
__wbg_lorolist_new,
|
|
434
434
|
__wbg_loromap_new,
|
|
@@ -465,15 +465,15 @@ export {
|
|
|
465
465
|
__wbg_set_bb8cecf6a62b9f46,
|
|
466
466
|
__wbg_set_wasm,
|
|
467
467
|
__wbg_setindex_dcd71eabf405bde1,
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
468
|
+
__wbg_stateBinary_9e1da8a4daa74bc6,
|
|
469
|
+
__wbg_stateCid_c43ea762fb462319,
|
|
470
|
+
__wbg_stateContainer_cd983f42c6fe987d,
|
|
471
|
+
__wbg_stateIndex_1fbac6394e58cff9,
|
|
472
|
+
__wbg_stateOptions_dcb483514d1b925d,
|
|
473
|
+
__wbg_stateRootCid_9198769cdd9f37d5,
|
|
474
|
+
__wbg_stateSet_a3e74b27d3d26f9d,
|
|
475
|
+
__wbg_stateSlice_aafffe8ecba122b8,
|
|
476
|
+
__wbg_stateValue_8ed644fcdb61558c,
|
|
477
477
|
__wbg_static_accessor_GLOBAL_88a902d13a557d07,
|
|
478
478
|
__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0,
|
|
479
479
|
__wbg_static_accessor_SELF_37c5d418e4bf5819,
|
|
@@ -483,15 +483,15 @@ export {
|
|
|
483
483
|
__wbg_value_cd1ffa7b1ab794f1,
|
|
484
484
|
__wbg_versions_c01dfd4722a88165,
|
|
485
485
|
__wbg_versionvector_new,
|
|
486
|
-
|
|
486
|
+
__wbg_warn_52b319b1b6be3d2f,
|
|
487
487
|
__wbindgen_as_number,
|
|
488
488
|
__wbindgen_bigint_from_i64,
|
|
489
489
|
__wbindgen_bigint_from_u64,
|
|
490
490
|
__wbindgen_bigint_get_as_i64,
|
|
491
491
|
__wbindgen_boolean_get,
|
|
492
492
|
__wbindgen_cb_drop,
|
|
493
|
-
|
|
494
|
-
|
|
493
|
+
__wbindgen_closure_wrapper285,
|
|
494
|
+
__wbindgen_closure_wrapper544,
|
|
495
495
|
__wbindgen_debug_string,
|
|
496
496
|
__wbindgen_error_new,
|
|
497
497
|
__wbindgen_in,
|