loro-crdt 1.0.8-alpha.3 → 1.0.9

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - 7bf6db7: Add `push` to LoroText and `pushContainer` to LoroList LoroMovableList
8
+ - 9b60d01: Define the behavior of `doc.fork()` when the doc is detached
9
+
10
+ It will fork at the current state_frontiers, which is equivalent to calling `doc.fork_at(&doc.state_frontiers())`
11
+
12
+ ## 1.0.8
13
+
14
+ ### Patch Changes
15
+
16
+ - 62a3a93: Merge two js packages
17
+
3
18
  ## 1.0.8-alpha.3
4
19
 
5
20
  ### Patch Changes
@@ -779,6 +779,10 @@ interface LoroList<T = unknown> {
779
779
  * ```
780
780
  */
781
781
  insertContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
782
+ /**
783
+ * Push a container to the end of the list.
784
+ */
785
+ pushContainer<C extends Container>(child: C): T extends C ? T : C;
782
786
  /**
783
787
  * Get the value at the index. If the value is a container, the corresponding handler will be returned.
784
788
  *
@@ -851,6 +855,10 @@ interface LoroMovableList<T = unknown> {
851
855
  * ```
852
856
  */
853
857
  insertContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
858
+ /**
859
+ * Push a container to the end of the list.
860
+ */
861
+ pushContainer<C extends Container>(child: C): T extends C ? T : C;
854
862
  /**
855
863
  * Get the value at the index. If the value is a container, the corresponding handler will be returned.
856
864
  *
@@ -1479,11 +1487,16 @@ export class LoroDoc {
1479
1487
  * Duplicate the document with a different PeerID
1480
1488
  *
1481
1489
  * The time complexity and space complexity of this operation are both O(n),
1490
+ *
1491
+ * When called in detached mode, it will fork at the current state frontiers.
1492
+ * It will have the same effect as `forkAt(&self.frontiers())`.
1482
1493
  * @returns {LoroDoc}
1483
1494
  */
1484
1495
  fork(): LoroDoc;
1485
1496
  /**
1486
1497
  * Creates a new LoroDoc at a specified version (Frontiers)
1498
+ *
1499
+ * The created doc will only contain the history before the specified frontiers.
1487
1500
  * @param {({ peer: PeerID, counter: number })[]} frontiers
1488
1501
  * @returns {LoroDoc}
1489
1502
  */
@@ -2687,6 +2700,11 @@ export class LoroText {
2687
2700
  */
2688
2701
  getAttached(): LoroText | undefined;
2689
2702
  /**
2703
+ * Push a string to the end of the text.
2704
+ * @param {string} s
2705
+ */
2706
+ push(s: string): void;
2707
+ /**
2690
2708
  * Get the container id of the text.
2691
2709
  */
2692
2710
  readonly id: ContainerID;
@@ -1134,6 +1134,9 @@ export class LoroDoc {
1134
1134
  * Duplicate the document with a different PeerID
1135
1135
  *
1136
1136
  * The time complexity and space complexity of this operation are both O(n),
1137
+ *
1138
+ * When called in detached mode, it will fork at the current state frontiers.
1139
+ * It will have the same effect as `forkAt(&self.frontiers())`.
1137
1140
  * @returns {LoroDoc}
1138
1141
  */
1139
1142
  fork() {
@@ -1142,6 +1145,8 @@ export class LoroDoc {
1142
1145
  }
1143
1146
  /**
1144
1147
  * Creates a new LoroDoc at a specified version (Frontiers)
1148
+ *
1149
+ * The created doc will only contain the history before the specified frontiers.
1145
1150
  * @param {({ peer: PeerID, counter: number })[]} frontiers
1146
1151
  * @returns {LoroDoc}
1147
1152
  */
@@ -2575,6 +2580,25 @@ export class LoroList {
2575
2580
  }
2576
2581
  }
2577
2582
  /**
2583
+ * @param {Container} child
2584
+ * @returns {Container}
2585
+ */
2586
+ pushContainer(child) {
2587
+ try {
2588
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2589
+ wasm.lorolist_pushContainer(retptr, this.__wbg_ptr, addHeapObject(child));
2590
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2591
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2592
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2593
+ if (r2) {
2594
+ throw takeObject(r1);
2595
+ }
2596
+ return takeObject(r0);
2597
+ } finally {
2598
+ wasm.__wbindgen_add_to_stack_pointer(16);
2599
+ }
2600
+ }
2601
+ /**
2578
2602
  * Subscribe to the changes of the list.
2579
2603
  *
2580
2604
  * Returns a subscription callback, which can be used to unsubscribe.
@@ -3387,6 +3411,26 @@ export class LoroMovableList {
3387
3411
  }
3388
3412
  }
3389
3413
  /**
3414
+ * Push a container to the end of the list.
3415
+ * @param {Container} child
3416
+ * @returns {Container}
3417
+ */
3418
+ pushContainer(child) {
3419
+ try {
3420
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3421
+ wasm.loromovablelist_pushContainer(retptr, this.__wbg_ptr, addHeapObject(child));
3422
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3423
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3424
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3425
+ if (r2) {
3426
+ throw takeObject(r1);
3427
+ }
3428
+ return takeObject(r0);
3429
+ } finally {
3430
+ wasm.__wbindgen_add_to_stack_pointer(16);
3431
+ }
3432
+ }
3433
+ /**
3390
3434
  * Subscribe to the changes of the list.
3391
3435
  *
3392
3436
  * Returns a subscription callback, which can be used to unsubscribe.
@@ -4204,6 +4248,25 @@ export class LoroText {
4204
4248
  const ret = wasm.lorotext_getCursor(this.__wbg_ptr, pos, addHeapObject(side));
4205
4249
  return ret === 0 ? undefined : Cursor.__wrap(ret);
4206
4250
  }
4251
+ /**
4252
+ * Push a string to the end of the text.
4253
+ * @param {string} s
4254
+ */
4255
+ push(s) {
4256
+ try {
4257
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4258
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
4259
+ const len0 = WASM_VECTOR_LEN;
4260
+ wasm.lorotext_push(retptr, this.__wbg_ptr, ptr0, len0);
4261
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4262
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4263
+ if (r1) {
4264
+ throw takeObject(r0);
4265
+ }
4266
+ } finally {
4267
+ wasm.__wbindgen_add_to_stack_pointer(16);
4268
+ }
4269
+ }
4207
4270
  }
4208
4271
 
4209
4272
  const LoroTreeFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
@@ -113,6 +113,7 @@ export function lorotext_applyDelta(a: number, b: number, c: number): void;
113
113
  export function lorotext_parent(a: number): number;
114
114
  export function lorotext_getAttached(a: number): number;
115
115
  export function lorotext_getCursor(a: number, b: number, c: number): number;
116
+ export function lorotext_push(a: number, b: number, c: number, d: number): void;
116
117
  export function __wbg_loromap_free(a: number): void;
117
118
  export function loromap_new(): number;
118
119
  export function loromap_kind(a: number): number;
@@ -141,6 +142,7 @@ export function lorolist_id(a: number): number;
141
142
  export function lorolist_toArray(a: number, b: number): void;
142
143
  export function lorolist_toJSON(a: number): number;
143
144
  export function lorolist_insertContainer(a: number, b: number, c: number, d: number): void;
145
+ export function lorolist_pushContainer(a: number, b: number, c: number): void;
144
146
  export function lorolist_subscribe(a: number, b: number, c: number): void;
145
147
  export function lorolist_length(a: number): number;
146
148
  export function lorolist_parent(a: number): number;
@@ -159,6 +161,7 @@ export function loromovablelist_id(a: number): number;
159
161
  export function loromovablelist_toArray(a: number, b: number): void;
160
162
  export function loromovablelist_toJSON(a: number): number;
161
163
  export function loromovablelist_insertContainer(a: number, b: number, c: number, d: number): void;
164
+ export function loromovablelist_pushContainer(a: number, b: number, c: number): void;
162
165
  export function loromovablelist_subscribe(a: number, b: number, c: number): void;
163
166
  export function loromovablelist_length(a: number): number;
164
167
  export function loromovablelist_getAttached(a: number): number;
@@ -779,6 +779,10 @@ interface LoroList<T = unknown> {
779
779
  * ```
780
780
  */
781
781
  insertContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
782
+ /**
783
+ * Push a container to the end of the list.
784
+ */
785
+ pushContainer<C extends Container>(child: C): T extends C ? T : C;
782
786
  /**
783
787
  * Get the value at the index. If the value is a container, the corresponding handler will be returned.
784
788
  *
@@ -851,6 +855,10 @@ interface LoroMovableList<T = unknown> {
851
855
  * ```
852
856
  */
853
857
  insertContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
858
+ /**
859
+ * Push a container to the end of the list.
860
+ */
861
+ pushContainer<C extends Container>(child: C): T extends C ? T : C;
854
862
  /**
855
863
  * Get the value at the index. If the value is a container, the corresponding handler will be returned.
856
864
  *
@@ -1479,11 +1487,16 @@ export class LoroDoc {
1479
1487
  * Duplicate the document with a different PeerID
1480
1488
  *
1481
1489
  * The time complexity and space complexity of this operation are both O(n),
1490
+ *
1491
+ * When called in detached mode, it will fork at the current state frontiers.
1492
+ * It will have the same effect as `forkAt(&self.frontiers())`.
1482
1493
  * @returns {LoroDoc}
1483
1494
  */
1484
1495
  fork(): LoroDoc;
1485
1496
  /**
1486
1497
  * Creates a new LoroDoc at a specified version (Frontiers)
1498
+ *
1499
+ * The created doc will only contain the history before the specified frontiers.
1487
1500
  * @param {({ peer: PeerID, counter: number })[]} frontiers
1488
1501
  * @returns {LoroDoc}
1489
1502
  */
@@ -2687,6 +2700,11 @@ export class LoroText {
2687
2700
  */
2688
2701
  getAttached(): LoroText | undefined;
2689
2702
  /**
2703
+ * Push a string to the end of the text.
2704
+ * @param {string} s
2705
+ */
2706
+ push(s: string): void;
2707
+ /**
2690
2708
  * Get the container id of the text.
2691
2709
  */
2692
2710
  readonly id: ContainerID;
@@ -1132,6 +1132,9 @@ class LoroDoc {
1132
1132
  * Duplicate the document with a different PeerID
1133
1133
  *
1134
1134
  * The time complexity and space complexity of this operation are both O(n),
1135
+ *
1136
+ * When called in detached mode, it will fork at the current state frontiers.
1137
+ * It will have the same effect as `forkAt(&self.frontiers())`.
1135
1138
  * @returns {LoroDoc}
1136
1139
  */
1137
1140
  fork() {
@@ -1140,6 +1143,8 @@ class LoroDoc {
1140
1143
  }
1141
1144
  /**
1142
1145
  * Creates a new LoroDoc at a specified version (Frontiers)
1146
+ *
1147
+ * The created doc will only contain the history before the specified frontiers.
1143
1148
  * @param {({ peer: PeerID, counter: number })[]} frontiers
1144
1149
  * @returns {LoroDoc}
1145
1150
  */
@@ -2574,6 +2579,25 @@ class LoroList {
2574
2579
  }
2575
2580
  }
2576
2581
  /**
2582
+ * @param {Container} child
2583
+ * @returns {Container}
2584
+ */
2585
+ pushContainer(child) {
2586
+ try {
2587
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2588
+ wasm.lorolist_pushContainer(retptr, this.__wbg_ptr, addHeapObject(child));
2589
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2590
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2591
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2592
+ if (r2) {
2593
+ throw takeObject(r1);
2594
+ }
2595
+ return takeObject(r0);
2596
+ } finally {
2597
+ wasm.__wbindgen_add_to_stack_pointer(16);
2598
+ }
2599
+ }
2600
+ /**
2577
2601
  * Subscribe to the changes of the list.
2578
2602
  *
2579
2603
  * Returns a subscription callback, which can be used to unsubscribe.
@@ -3388,6 +3412,26 @@ class LoroMovableList {
3388
3412
  }
3389
3413
  }
3390
3414
  /**
3415
+ * Push a container to the end of the list.
3416
+ * @param {Container} child
3417
+ * @returns {Container}
3418
+ */
3419
+ pushContainer(child) {
3420
+ try {
3421
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3422
+ wasm.loromovablelist_pushContainer(retptr, this.__wbg_ptr, addHeapObject(child));
3423
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3424
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3425
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3426
+ if (r2) {
3427
+ throw takeObject(r1);
3428
+ }
3429
+ return takeObject(r0);
3430
+ } finally {
3431
+ wasm.__wbindgen_add_to_stack_pointer(16);
3432
+ }
3433
+ }
3434
+ /**
3391
3435
  * Subscribe to the changes of the list.
3392
3436
  *
3393
3437
  * Returns a subscription callback, which can be used to unsubscribe.
@@ -4206,6 +4250,25 @@ class LoroText {
4206
4250
  const ret = wasm.lorotext_getCursor(this.__wbg_ptr, pos, addHeapObject(side));
4207
4251
  return ret === 0 ? undefined : Cursor.__wrap(ret);
4208
4252
  }
4253
+ /**
4254
+ * Push a string to the end of the text.
4255
+ * @param {string} s
4256
+ */
4257
+ push(s) {
4258
+ try {
4259
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4260
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
4261
+ const len0 = WASM_VECTOR_LEN;
4262
+ wasm.lorotext_push(retptr, this.__wbg_ptr, ptr0, len0);
4263
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4264
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4265
+ if (r1) {
4266
+ throw takeObject(r0);
4267
+ }
4268
+ } finally {
4269
+ wasm.__wbindgen_add_to_stack_pointer(16);
4270
+ }
4271
+ }
4209
4272
  }
4210
4273
  module.exports.LoroText = LoroText;
4211
4274
 
Binary file
@@ -113,6 +113,7 @@ export function lorotext_applyDelta(a: number, b: number, c: number): void;
113
113
  export function lorotext_parent(a: number): number;
114
114
  export function lorotext_getAttached(a: number): number;
115
115
  export function lorotext_getCursor(a: number, b: number, c: number): number;
116
+ export function lorotext_push(a: number, b: number, c: number, d: number): void;
116
117
  export function __wbg_loromap_free(a: number): void;
117
118
  export function loromap_new(): number;
118
119
  export function loromap_kind(a: number): number;
@@ -141,6 +142,7 @@ export function lorolist_id(a: number): number;
141
142
  export function lorolist_toArray(a: number, b: number): void;
142
143
  export function lorolist_toJSON(a: number): number;
143
144
  export function lorolist_insertContainer(a: number, b: number, c: number, d: number): void;
145
+ export function lorolist_pushContainer(a: number, b: number, c: number): void;
144
146
  export function lorolist_subscribe(a: number, b: number, c: number): void;
145
147
  export function lorolist_length(a: number): number;
146
148
  export function lorolist_parent(a: number): number;
@@ -159,6 +161,7 @@ export function loromovablelist_id(a: number): number;
159
161
  export function loromovablelist_toArray(a: number, b: number): void;
160
162
  export function loromovablelist_toJSON(a: number): number;
161
163
  export function loromovablelist_insertContainer(a: number, b: number, c: number, d: number): void;
164
+ export function loromovablelist_pushContainer(a: number, b: number, c: number): void;
162
165
  export function loromovablelist_subscribe(a: number, b: number, c: number): void;
163
166
  export function loromovablelist_length(a: number): number;
164
167
  export function loromovablelist_getAttached(a: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loro-crdt",
3
- "version": "1.0.8-alpha.3",
3
+ "version": "1.0.9",
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",
@@ -26,11 +26,6 @@
26
26
  "LICENSE",
27
27
  "package.json"
28
28
  ],
29
- "scripts": {
30
- "build-dev": "deno run -A ./scripts/build.ts dev && rollup -c && deno run -A ./scripts/post-rollup.ts && npm run test",
31
- "build-release": "deno run -A ./scripts/build.ts release && rollup -c && deno run -A ./scripts/post-rollup.ts && npm run test",
32
- "test": "node --expose-gc ./node_modules/vitest/vitest.mjs run && npx tsc --noEmit && cd ./deno_tests && deno test -A"
33
- },
34
29
  "homepage": "https://loro.dev",
35
30
  "author": "",
36
31
  "license": "MIT",
@@ -54,5 +49,10 @@
54
49
  "rollup-plugin-esbuild": "^5.0.0",
55
50
  "vite": "^4.2.1",
56
51
  "vitest": "^1.4.0"
52
+ },
53
+ "scripts": {
54
+ "build-dev": "deno run -A ./scripts/build.ts dev && rollup -c && deno run -A ./scripts/post-rollup.ts && npm run test",
55
+ "build-release": "deno run -A ./scripts/build.ts release && rollup -c && deno run -A ./scripts/post-rollup.ts && npm run test",
56
+ "test": "node --expose-gc ./node_modules/vitest/vitest.mjs run && npx tsc --noEmit && cd ./deno_tests && deno test -A"
57
57
  }
58
- }
58
+ }
@@ -779,6 +779,10 @@ interface LoroList<T = unknown> {
779
779
  * ```
780
780
  */
781
781
  insertContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
782
+ /**
783
+ * Push a container to the end of the list.
784
+ */
785
+ pushContainer<C extends Container>(child: C): T extends C ? T : C;
782
786
  /**
783
787
  * Get the value at the index. If the value is a container, the corresponding handler will be returned.
784
788
  *
@@ -851,6 +855,10 @@ interface LoroMovableList<T = unknown> {
851
855
  * ```
852
856
  */
853
857
  insertContainer<C extends Container>(pos: number, child: C): T extends C ? T : C;
858
+ /**
859
+ * Push a container to the end of the list.
860
+ */
861
+ pushContainer<C extends Container>(child: C): T extends C ? T : C;
854
862
  /**
855
863
  * Get the value at the index. If the value is a container, the corresponding handler will be returned.
856
864
  *
@@ -1479,11 +1487,16 @@ export class LoroDoc {
1479
1487
  * Duplicate the document with a different PeerID
1480
1488
  *
1481
1489
  * The time complexity and space complexity of this operation are both O(n),
1490
+ *
1491
+ * When called in detached mode, it will fork at the current state frontiers.
1492
+ * It will have the same effect as `forkAt(&self.frontiers())`.
1482
1493
  * @returns {LoroDoc}
1483
1494
  */
1484
1495
  fork(): LoroDoc;
1485
1496
  /**
1486
1497
  * Creates a new LoroDoc at a specified version (Frontiers)
1498
+ *
1499
+ * The created doc will only contain the history before the specified frontiers.
1487
1500
  * @param {({ peer: PeerID, counter: number })[]} frontiers
1488
1501
  * @returns {LoroDoc}
1489
1502
  */
@@ -2687,6 +2700,11 @@ export class LoroText {
2687
2700
  */
2688
2701
  getAttached(): LoroText | undefined;
2689
2702
  /**
2703
+ * Push a string to the end of the text.
2704
+ * @param {string} s
2705
+ */
2706
+ push(s: string): void;
2707
+ /**
2690
2708
  * Get the container id of the text.
2691
2709
  */
2692
2710
  readonly id: ContainerID;
@@ -3218,6 +3236,7 @@ export interface InitOutput {
3218
3236
  readonly lorotext_parent: (a: number) => number;
3219
3237
  readonly lorotext_getAttached: (a: number) => number;
3220
3238
  readonly lorotext_getCursor: (a: number, b: number, c: number) => number;
3239
+ readonly lorotext_push: (a: number, b: number, c: number, d: number) => void;
3221
3240
  readonly __wbg_loromap_free: (a: number) => void;
3222
3241
  readonly loromap_new: () => number;
3223
3242
  readonly loromap_kind: (a: number) => number;
@@ -3246,6 +3265,7 @@ export interface InitOutput {
3246
3265
  readonly lorolist_toArray: (a: number, b: number) => void;
3247
3266
  readonly lorolist_toJSON: (a: number) => number;
3248
3267
  readonly lorolist_insertContainer: (a: number, b: number, c: number, d: number) => void;
3268
+ readonly lorolist_pushContainer: (a: number, b: number, c: number) => void;
3249
3269
  readonly lorolist_subscribe: (a: number, b: number, c: number) => void;
3250
3270
  readonly lorolist_length: (a: number) => number;
3251
3271
  readonly lorolist_parent: (a: number) => number;
@@ -3264,6 +3284,7 @@ export interface InitOutput {
3264
3284
  readonly loromovablelist_toArray: (a: number, b: number) => void;
3265
3285
  readonly loromovablelist_toJSON: (a: number) => number;
3266
3286
  readonly loromovablelist_insertContainer: (a: number, b: number, c: number, d: number) => void;
3287
+ readonly loromovablelist_pushContainer: (a: number, b: number, c: number) => void;
3267
3288
  readonly loromovablelist_subscribe: (a: number, b: number, c: number) => void;
3268
3289
  readonly loromovablelist_length: (a: number) => number;
3269
3290
  readonly loromovablelist_getAttached: (a: number) => number;
package/web/loro_wasm.js CHANGED
@@ -1126,6 +1126,9 @@ export class LoroDoc {
1126
1126
  * Duplicate the document with a different PeerID
1127
1127
  *
1128
1128
  * The time complexity and space complexity of this operation are both O(n),
1129
+ *
1130
+ * When called in detached mode, it will fork at the current state frontiers.
1131
+ * It will have the same effect as `forkAt(&self.frontiers())`.
1129
1132
  * @returns {LoroDoc}
1130
1133
  */
1131
1134
  fork() {
@@ -1134,6 +1137,8 @@ export class LoroDoc {
1134
1137
  }
1135
1138
  /**
1136
1139
  * Creates a new LoroDoc at a specified version (Frontiers)
1140
+ *
1141
+ * The created doc will only contain the history before the specified frontiers.
1137
1142
  * @param {({ peer: PeerID, counter: number })[]} frontiers
1138
1143
  * @returns {LoroDoc}
1139
1144
  */
@@ -2567,6 +2572,25 @@ export class LoroList {
2567
2572
  }
2568
2573
  }
2569
2574
  /**
2575
+ * @param {Container} child
2576
+ * @returns {Container}
2577
+ */
2578
+ pushContainer(child) {
2579
+ try {
2580
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2581
+ wasm.lorolist_pushContainer(retptr, this.__wbg_ptr, addHeapObject(child));
2582
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2583
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2584
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2585
+ if (r2) {
2586
+ throw takeObject(r1);
2587
+ }
2588
+ return takeObject(r0);
2589
+ } finally {
2590
+ wasm.__wbindgen_add_to_stack_pointer(16);
2591
+ }
2592
+ }
2593
+ /**
2570
2594
  * Subscribe to the changes of the list.
2571
2595
  *
2572
2596
  * Returns a subscription callback, which can be used to unsubscribe.
@@ -3379,6 +3403,26 @@ export class LoroMovableList {
3379
3403
  }
3380
3404
  }
3381
3405
  /**
3406
+ * Push a container to the end of the list.
3407
+ * @param {Container} child
3408
+ * @returns {Container}
3409
+ */
3410
+ pushContainer(child) {
3411
+ try {
3412
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3413
+ wasm.loromovablelist_pushContainer(retptr, this.__wbg_ptr, addHeapObject(child));
3414
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
3415
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
3416
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
3417
+ if (r2) {
3418
+ throw takeObject(r1);
3419
+ }
3420
+ return takeObject(r0);
3421
+ } finally {
3422
+ wasm.__wbindgen_add_to_stack_pointer(16);
3423
+ }
3424
+ }
3425
+ /**
3382
3426
  * Subscribe to the changes of the list.
3383
3427
  *
3384
3428
  * Returns a subscription callback, which can be used to unsubscribe.
@@ -4196,6 +4240,25 @@ export class LoroText {
4196
4240
  const ret = wasm.lorotext_getCursor(this.__wbg_ptr, pos, addHeapObject(side));
4197
4241
  return ret === 0 ? undefined : Cursor.__wrap(ret);
4198
4242
  }
4243
+ /**
4244
+ * Push a string to the end of the text.
4245
+ * @param {string} s
4246
+ */
4247
+ push(s) {
4248
+ try {
4249
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4250
+ const ptr0 = passStringToWasm0(s, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
4251
+ const len0 = WASM_VECTOR_LEN;
4252
+ wasm.lorotext_push(retptr, this.__wbg_ptr, ptr0, len0);
4253
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4254
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4255
+ if (r1) {
4256
+ throw takeObject(r0);
4257
+ }
4258
+ } finally {
4259
+ wasm.__wbindgen_add_to_stack_pointer(16);
4260
+ }
4261
+ }
4199
4262
  }
4200
4263
 
4201
4264
  const LoroTreeFinalization = (typeof FinalizationRegistry === 'undefined')
Binary file
@@ -113,6 +113,7 @@ export function lorotext_applyDelta(a: number, b: number, c: number): void;
113
113
  export function lorotext_parent(a: number): number;
114
114
  export function lorotext_getAttached(a: number): number;
115
115
  export function lorotext_getCursor(a: number, b: number, c: number): number;
116
+ export function lorotext_push(a: number, b: number, c: number, d: number): void;
116
117
  export function __wbg_loromap_free(a: number): void;
117
118
  export function loromap_new(): number;
118
119
  export function loromap_kind(a: number): number;
@@ -141,6 +142,7 @@ export function lorolist_id(a: number): number;
141
142
  export function lorolist_toArray(a: number, b: number): void;
142
143
  export function lorolist_toJSON(a: number): number;
143
144
  export function lorolist_insertContainer(a: number, b: number, c: number, d: number): void;
145
+ export function lorolist_pushContainer(a: number, b: number, c: number): void;
144
146
  export function lorolist_subscribe(a: number, b: number, c: number): void;
145
147
  export function lorolist_length(a: number): number;
146
148
  export function lorolist_parent(a: number): number;
@@ -159,6 +161,7 @@ export function loromovablelist_id(a: number): number;
159
161
  export function loromovablelist_toArray(a: number, b: number): void;
160
162
  export function loromovablelist_toJSON(a: number): number;
161
163
  export function loromovablelist_insertContainer(a: number, b: number, c: number, d: number): void;
164
+ export function loromovablelist_pushContainer(a: number, b: number, c: number): void;
162
165
  export function loromovablelist_subscribe(a: number, b: number, c: number): void;
163
166
  export function loromovablelist_length(a: number): number;
164
167
  export function loromovablelist_getAttached(a: number): number;