@yorkie-js/sdk 0.6.43 → 0.6.44
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/dist/yorkie-js-sdk.d.ts
CHANGED
|
@@ -5655,9 +5655,15 @@ declare class SplayTree<V> {
|
|
|
5655
5655
|
*/
|
|
5656
5656
|
get length(): number;
|
|
5657
5657
|
/**
|
|
5658
|
-
* `
|
|
5658
|
+
* `findForText` returns the Node and offset of the given position (cursor).
|
|
5659
|
+
* Used for Text where cursor placed between characters.
|
|
5659
5660
|
*/
|
|
5660
|
-
|
|
5661
|
+
findForText(pos: number): [SplayNode<V> | undefined, number];
|
|
5662
|
+
/**
|
|
5663
|
+
* `findForArray` returns the Node of the given position (index).
|
|
5664
|
+
* Used for Array where index points to the element.
|
|
5665
|
+
*/
|
|
5666
|
+
findForArray(idx: number): SplayNode<V> | undefined;
|
|
5661
5667
|
/**
|
|
5662
5668
|
* Find the index of the given node in BST.
|
|
5663
5669
|
*
|
package/dist/yorkie-js-sdk.es.js
CHANGED
|
@@ -6298,9 +6298,10 @@ class SplayTree {
|
|
|
6298
6298
|
return this.root ? this.root.getWeight() : 0;
|
|
6299
6299
|
}
|
|
6300
6300
|
/**
|
|
6301
|
-
* `
|
|
6301
|
+
* `findForText` returns the Node and offset of the given position (cursor).
|
|
6302
|
+
* Used for Text where cursor placed between characters.
|
|
6302
6303
|
*/
|
|
6303
|
-
|
|
6304
|
+
findForText(pos) {
|
|
6304
6305
|
if (!this.root || pos < 0) {
|
|
6305
6306
|
return [void 0, 0];
|
|
6306
6307
|
}
|
|
@@ -6325,6 +6326,34 @@ class SplayTree {
|
|
|
6325
6326
|
this.splayNode(node);
|
|
6326
6327
|
return [node, pos];
|
|
6327
6328
|
}
|
|
6329
|
+
/**
|
|
6330
|
+
* `findForArray` returns the Node of the given position (index).
|
|
6331
|
+
* Used for Array where index points to the element.
|
|
6332
|
+
*/
|
|
6333
|
+
findForArray(idx) {
|
|
6334
|
+
if (!this.root) {
|
|
6335
|
+
return void 0;
|
|
6336
|
+
}
|
|
6337
|
+
if (idx < 0 || idx >= this.length) {
|
|
6338
|
+
throw new YorkieError(
|
|
6339
|
+
Code.ErrInvalidArgument,
|
|
6340
|
+
`out of index range: idx: ${idx}, length: ${this.length}`
|
|
6341
|
+
);
|
|
6342
|
+
}
|
|
6343
|
+
let node = this.root;
|
|
6344
|
+
for (; ; ) {
|
|
6345
|
+
if (node.hasLeft() && idx < node.getLeftWeight()) {
|
|
6346
|
+
node = node.getLeft();
|
|
6347
|
+
} else if (node.hasRight() && node.getLeftWeight() + node.getLength() <= idx) {
|
|
6348
|
+
idx -= node.getLeftWeight() + node.getLength();
|
|
6349
|
+
node = node.getRight();
|
|
6350
|
+
} else {
|
|
6351
|
+
break;
|
|
6352
|
+
}
|
|
6353
|
+
}
|
|
6354
|
+
this.splayNode(node);
|
|
6355
|
+
return node;
|
|
6356
|
+
}
|
|
6328
6357
|
/**
|
|
6329
6358
|
* Find the index of the given node in BST.
|
|
6330
6359
|
*
|
|
@@ -8007,15 +8036,8 @@ class RGATreeList {
|
|
|
8007
8036
|
if (idx >= this.length) {
|
|
8008
8037
|
return;
|
|
8009
8038
|
}
|
|
8010
|
-
const
|
|
8011
|
-
|
|
8012
|
-
if (idx === 0 && node === this.dummyHead || offset > 0) {
|
|
8013
|
-
do {
|
|
8014
|
-
if (rgaNode) {
|
|
8015
|
-
rgaNode = rgaNode.getNext();
|
|
8016
|
-
}
|
|
8017
|
-
} while (rgaNode && rgaNode.isRemoved());
|
|
8018
|
-
}
|
|
8039
|
+
const node = this.nodeMapByIndex.findForArray(idx);
|
|
8040
|
+
const rgaNode = node;
|
|
8019
8041
|
return rgaNode;
|
|
8020
8042
|
}
|
|
8021
8043
|
/**
|
|
@@ -9482,7 +9504,7 @@ class RGATreeSplit {
|
|
|
9482
9504
|
* `indexToPos` finds RGATreeSplitPos of given offset.
|
|
9483
9505
|
*/
|
|
9484
9506
|
indexToPos(idx) {
|
|
9485
|
-
const [node, offset] = this.treeByIndex.
|
|
9507
|
+
const [node, offset] = this.treeByIndex.findForText(idx);
|
|
9486
9508
|
const splitNode = node;
|
|
9487
9509
|
return RGATreeSplitPos.of(splitNode.getID(), offset);
|
|
9488
9510
|
}
|
|
@@ -19247,7 +19269,7 @@ function createAuthInterceptor(apiKey, token) {
|
|
|
19247
19269
|
};
|
|
19248
19270
|
}
|
|
19249
19271
|
const name = "@yorkie-js/sdk";
|
|
19250
|
-
const version = "0.6.
|
|
19272
|
+
const version = "0.6.44";
|
|
19251
19273
|
const pkg = {
|
|
19252
19274
|
name,
|
|
19253
19275
|
version
|