loro-crdt 1.2.5 → 1.2.7
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/base64/index.js +16 -26
- package/base64/loro_wasm.d.ts +46 -39
- package/base64/loro_wasm_bg-68a6c103.js +64 -0
- package/bundler/loro_wasm.d.ts +46 -39
- package/bundler/loro_wasm_bg.js +15 -25
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm.d.ts +46 -39
- package/nodejs/loro_wasm.js +15 -25
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/package.json +1 -1
- package/web/loro_wasm.d.ts +46 -39
- package/web/loro_wasm.js +15 -25
- package/web/loro_wasm_bg.wasm +0 -0
- package/base64/loro_wasm_bg-8aefc7ca.js +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.2.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- da24910: fix: should commit before travel_change_ancestors #599
|
|
8
|
+
|
|
9
|
+
## 1.2.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- d552955: Make getByPath work for "tree/0/key"
|
|
14
|
+
- df81aec: Better event ordering
|
|
15
|
+
|
|
3
16
|
## 1.2.5
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/base64/index.js
CHANGED
|
@@ -2359,6 +2359,21 @@ class LoroDoc {
|
|
|
2359
2359
|
/**
|
|
2360
2360
|
* Get the value or container at the given path
|
|
2361
2361
|
*
|
|
2362
|
+
* The path can be specified in different ways depending on the container type:
|
|
2363
|
+
*
|
|
2364
|
+
* For Tree:
|
|
2365
|
+
* 1. Using node IDs: `tree/{node_id}/property`
|
|
2366
|
+
* 2. Using indices: `tree/0/1/property`
|
|
2367
|
+
*
|
|
2368
|
+
* For List and MovableList:
|
|
2369
|
+
* - Using indices: `list/0` or `list/1/property`
|
|
2370
|
+
*
|
|
2371
|
+
* For Map:
|
|
2372
|
+
* - Using keys: `map/key` or `map/nested/property`
|
|
2373
|
+
*
|
|
2374
|
+
* For tree structures, index-based paths follow depth-first traversal order.
|
|
2375
|
+
* The indices start from 0 and represent the position of a node among its siblings.
|
|
2376
|
+
*
|
|
2362
2377
|
* @example
|
|
2363
2378
|
* ```ts
|
|
2364
2379
|
* import { LoroDoc } from "loro-crdt";
|
|
@@ -5161,26 +5176,6 @@ class LoroTreeNode {
|
|
|
5161
5176
|
}
|
|
5162
5177
|
}
|
|
5163
5178
|
/**
|
|
5164
|
-
* Move this tree node to be a child of the parent.
|
|
5165
|
-
* If the parent is undefined, this node will be a root node.
|
|
5166
|
-
*
|
|
5167
|
-
* If the index is not provided, the node will be appended to the end.
|
|
5168
|
-
*
|
|
5169
|
-
* It's not allowed that the target is an ancestor of the parent.
|
|
5170
|
-
*
|
|
5171
|
-
* @example
|
|
5172
|
-
* ```ts
|
|
5173
|
-
* const doc = new LoroDoc();
|
|
5174
|
-
* const tree = doc.getTree("tree");
|
|
5175
|
-
* const root = tree.createNode();
|
|
5176
|
-
* const node = root.createNode();
|
|
5177
|
-
* const node2 = node.createNode();
|
|
5178
|
-
* node2.move(undefined, 0);
|
|
5179
|
-
* // node2 root
|
|
5180
|
-
* // |
|
|
5181
|
-
* // node
|
|
5182
|
-
*
|
|
5183
|
-
* ```
|
|
5184
5179
|
* @param {LoroTreeNode | undefined} parent
|
|
5185
5180
|
* @param {number | undefined} [index]
|
|
5186
5181
|
*/
|
|
@@ -5343,11 +5338,6 @@ class LoroTreeNode {
|
|
|
5343
5338
|
}
|
|
5344
5339
|
}
|
|
5345
5340
|
/**
|
|
5346
|
-
* Get the parent node of this node.
|
|
5347
|
-
*
|
|
5348
|
-
* - The parent of the root node is `undefined`.
|
|
5349
|
-
* - The object returned is a new js object each time because it need to cross
|
|
5350
|
-
* the WASM boundary.
|
|
5351
5341
|
* @returns {LoroTreeNode | undefined}
|
|
5352
5342
|
*/
|
|
5353
5343
|
parent() {
|
|
@@ -6438,7 +6428,7 @@ var imports = /*#__PURE__*/Object.freeze({
|
|
|
6438
6428
|
// Without this patch, Cloudflare Worker would raise issue like: "Uncaught TypeError: wasm2.__wbindgen_start is not a function"
|
|
6439
6429
|
|
|
6440
6430
|
|
|
6441
|
-
import loro_wasm_bg_js from './loro_wasm_bg-
|
|
6431
|
+
import loro_wasm_bg_js from './loro_wasm_bg-68a6c103.js';
|
|
6442
6432
|
const instance = new WebAssembly.Instance(loro_wasm_bg_js(), {
|
|
6443
6433
|
"./loro_wasm_bg.js": imports,
|
|
6444
6434
|
});
|
package/base64/loro_wasm.d.ts
CHANGED
|
@@ -397,11 +397,6 @@ export type TreeNodeJSON<T> = Omit<TreeNodeValue, 'meta' | 'children'> & {
|
|
|
397
397
|
children: TreeNodeJSON<T>[],
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
interface LoroTree{
|
|
401
|
-
toArray(): TreeNodeValue[];
|
|
402
|
-
getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode[];
|
|
403
|
-
}
|
|
404
|
-
|
|
405
400
|
interface LoroMovableList {
|
|
406
401
|
/**
|
|
407
402
|
* Get the cursor position at the given pos.
|
|
@@ -1129,6 +1124,8 @@ interface LoroTree<T extends Record<string, unknown> = Record<string, unknown>>
|
|
|
1129
1124
|
*/
|
|
1130
1125
|
getNodeByID(target: TreeID): LoroTreeNode<T>;
|
|
1131
1126
|
subscribe(listener: Listener): Subscription;
|
|
1127
|
+
toArray(): TreeNodeValue[];
|
|
1128
|
+
getNodes(options?: { withDeleted?: boolean } ): LoroTreeNode<T>[];
|
|
1132
1129
|
}
|
|
1133
1130
|
interface LoroTreeNode<T extends Record<string, unknown> = Record<string, unknown>> {
|
|
1134
1131
|
/**
|
|
@@ -1156,7 +1153,36 @@ interface LoroTreeNode<T extends Record<string, unknown> = Record<string, unknow
|
|
|
1156
1153
|
* ```
|
|
1157
1154
|
*/
|
|
1158
1155
|
createNode(index?: number): LoroTreeNode<T>;
|
|
1156
|
+
/**
|
|
1157
|
+
* Move this tree node to be a child of the parent.
|
|
1158
|
+
* If the parent is undefined, this node will be a root node.
|
|
1159
|
+
*
|
|
1160
|
+
* If the index is not provided, the node will be appended to the end.
|
|
1161
|
+
*
|
|
1162
|
+
* It's not allowed that the target is an ancestor of the parent.
|
|
1163
|
+
*
|
|
1164
|
+
* @example
|
|
1165
|
+
* ```ts
|
|
1166
|
+
* const doc = new LoroDoc();
|
|
1167
|
+
* const tree = doc.getTree("tree");
|
|
1168
|
+
* const root = tree.createNode();
|
|
1169
|
+
* const node = root.createNode();
|
|
1170
|
+
* const node2 = node.createNode();
|
|
1171
|
+
* node2.move(undefined, 0);
|
|
1172
|
+
* // node2 root
|
|
1173
|
+
* // |
|
|
1174
|
+
* // node
|
|
1175
|
+
*
|
|
1176
|
+
* ```
|
|
1177
|
+
*/
|
|
1159
1178
|
move(parent?: LoroTreeNode<T>, index?: number): void;
|
|
1179
|
+
/**
|
|
1180
|
+
* Get the parent node of this node.
|
|
1181
|
+
*
|
|
1182
|
+
* - The parent of the root node is `undefined`.
|
|
1183
|
+
* - The object returned is a new js object each time because it need to cross
|
|
1184
|
+
* the WASM boundary.
|
|
1185
|
+
*/
|
|
1160
1186
|
parent(): LoroTreeNode<T> | undefined;
|
|
1161
1187
|
/**
|
|
1162
1188
|
* Get the children of this node.
|
|
@@ -2099,6 +2125,21 @@ export class LoroDoc {
|
|
|
2099
2125
|
/**
|
|
2100
2126
|
* Get the value or container at the given path
|
|
2101
2127
|
*
|
|
2128
|
+
* The path can be specified in different ways depending on the container type:
|
|
2129
|
+
*
|
|
2130
|
+
* For Tree:
|
|
2131
|
+
* 1. Using node IDs: `tree/{node_id}/property`
|
|
2132
|
+
* 2. Using indices: `tree/0/1/property`
|
|
2133
|
+
*
|
|
2134
|
+
* For List and MovableList:
|
|
2135
|
+
* - Using indices: `list/0` or `list/1/property`
|
|
2136
|
+
*
|
|
2137
|
+
* For Map:
|
|
2138
|
+
* - Using keys: `map/key` or `map/nested/property`
|
|
2139
|
+
*
|
|
2140
|
+
* For tree structures, index-based paths follow depth-first traversal order.
|
|
2141
|
+
* The indices start from 0 and represent the position of a node among its siblings.
|
|
2142
|
+
*
|
|
2102
2143
|
* @example
|
|
2103
2144
|
* ```ts
|
|
2104
2145
|
* import { LoroDoc } from "loro-crdt";
|
|
@@ -3179,31 +3220,6 @@ export class LoroTreeNode {
|
|
|
3179
3220
|
*/
|
|
3180
3221
|
__getClassname(): string;
|
|
3181
3222
|
/**
|
|
3182
|
-
* Move this tree node to be a child of the parent.
|
|
3183
|
-
* If the parent is undefined, this node will be a root node.
|
|
3184
|
-
*
|
|
3185
|
-
* If the index is not provided, the node will be appended to the end.
|
|
3186
|
-
*
|
|
3187
|
-
* It's not allowed that the target is an ancestor of the parent.
|
|
3188
|
-
*
|
|
3189
|
-
* @example
|
|
3190
|
-
* ```ts
|
|
3191
|
-
* const doc = new LoroDoc();
|
|
3192
|
-
* const tree = doc.getTree("tree");
|
|
3193
|
-
* const root = tree.createNode();
|
|
3194
|
-
* const node = root.createNode();
|
|
3195
|
-
* const node2 = node.createNode();
|
|
3196
|
-
* node2.move(undefined, 0);
|
|
3197
|
-
* // node2 root
|
|
3198
|
-
* // |
|
|
3199
|
-
* // node
|
|
3200
|
-
*
|
|
3201
|
-
* ```
|
|
3202
|
-
* @param {LoroTreeNode | undefined} parent
|
|
3203
|
-
* @param {number | undefined} [index]
|
|
3204
|
-
*/
|
|
3205
|
-
move(parent: LoroTreeNode | undefined, index?: number): void;
|
|
3206
|
-
/**
|
|
3207
3223
|
* Move the tree node to be after the target node.
|
|
3208
3224
|
*
|
|
3209
3225
|
* @example
|
|
@@ -3256,15 +3272,6 @@ export class LoroTreeNode {
|
|
|
3256
3272
|
*/
|
|
3257
3273
|
fractionalIndex(): string | undefined;
|
|
3258
3274
|
/**
|
|
3259
|
-
* Get the parent node of this node.
|
|
3260
|
-
*
|
|
3261
|
-
* - The parent of the root node is `undefined`.
|
|
3262
|
-
* - The object returned is a new js object each time because it need to cross
|
|
3263
|
-
* the WASM boundary.
|
|
3264
|
-
* @returns {LoroTreeNode | undefined}
|
|
3265
|
-
*/
|
|
3266
|
-
parent(): LoroTreeNode | undefined;
|
|
3267
|
-
/**
|
|
3268
3275
|
* Check if the node is deleted.
|
|
3269
3276
|
* @returns {boolean}
|
|
3270
3277
|
*/
|