@yorkie-js/react 0.6.9 → 0.6.10
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-react.es.js +82 -260
- package/dist/yorkie-js-react.es.js.map +1 -1
- package/dist/yorkie-js-react.js +82 -260
- package/dist/yorkie-js-react.js.map +1 -1
- package/package.json +2 -2
package/dist/yorkie-js-react.js
CHANGED
|
@@ -7,7 +7,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
7
7
|
|
|
8
8
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
9
9
|
const name$1 = "@yorkie-js/react";
|
|
10
|
-
const version$1 = "0.6.
|
|
10
|
+
const version$1 = "0.6.10";
|
|
11
11
|
const pkg$1 = {
|
|
12
12
|
name: name$1,
|
|
13
13
|
version: version$1
|
|
@@ -4470,6 +4470,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4470
4470
|
*/
|
|
4471
4471
|
__publicField(this, "changes", []);
|
|
4472
4472
|
/**
|
|
4473
|
+
* deprecated
|
|
4474
|
+
*
|
|
4473
4475
|
* @generated from field: yorkie.v1.TimeTicket min_synced_ticket = 5;
|
|
4474
4476
|
*/
|
|
4475
4477
|
__publicField(this, "minSyncedTicket");
|
|
@@ -4886,6 +4888,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4886
4888
|
*/
|
|
4887
4889
|
__publicField(this, "to");
|
|
4888
4890
|
/**
|
|
4891
|
+
* deprecated
|
|
4892
|
+
*
|
|
4889
4893
|
* @generated from field: map<string, yorkie.v1.TimeTicket> created_at_map_by_actor = 4;
|
|
4890
4894
|
*/
|
|
4891
4895
|
__publicField(this, "createdAtMapByActor", {});
|
|
@@ -5005,6 +5009,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5005
5009
|
*/
|
|
5006
5010
|
__publicField(this, "executedAt");
|
|
5007
5011
|
/**
|
|
5012
|
+
* deprecated
|
|
5013
|
+
*
|
|
5008
5014
|
* @generated from field: map<string, yorkie.v1.TimeTicket> created_at_map_by_actor = 6;
|
|
5009
5015
|
*/
|
|
5010
5016
|
__publicField(this, "createdAtMapByActor", {});
|
|
@@ -5092,6 +5098,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5092
5098
|
*/
|
|
5093
5099
|
__publicField(this, "to");
|
|
5094
5100
|
/**
|
|
5101
|
+
* deprecated
|
|
5102
|
+
*
|
|
5095
5103
|
* @generated from field: map<string, yorkie.v1.TimeTicket> created_at_map_by_actor = 4;
|
|
5096
5104
|
*/
|
|
5097
5105
|
__publicField(this, "createdAtMapByActor", {});
|
|
@@ -5168,6 +5176,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5168
5176
|
*/
|
|
5169
5177
|
__publicField(this, "attributesToRemove", []);
|
|
5170
5178
|
/**
|
|
5179
|
+
* deprecated
|
|
5180
|
+
*
|
|
5171
5181
|
* @generated from field: map<string, yorkie.v1.TimeTicket> created_at_map_by_actor = 7;
|
|
5172
5182
|
*/
|
|
5173
5183
|
__publicField(this, "createdAtMapByActor", {});
|
|
@@ -11133,18 +11143,17 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
11133
11143
|
*
|
|
11134
11144
|
* @internal
|
|
11135
11145
|
*/
|
|
11136
|
-
edit(range, content, editedAt, attributes,
|
|
11146
|
+
edit(range, content, editedAt, attributes, versionVector) {
|
|
11137
11147
|
const crdtTextValue = content ? CRDTTextValue.create(content) : void 0;
|
|
11138
11148
|
if (crdtTextValue && attributes) {
|
|
11139
11149
|
for (const [k, v] of Object.entries(attributes)) {
|
|
11140
11150
|
crdtTextValue.setAttr(k, v, editedAt);
|
|
11141
11151
|
}
|
|
11142
11152
|
}
|
|
11143
|
-
const [caretPos,
|
|
11153
|
+
const [caretPos, pairs, valueChanges] = this.rgaTreeSplit.edit(
|
|
11144
11154
|
range,
|
|
11145
11155
|
editedAt,
|
|
11146
11156
|
crdtTextValue,
|
|
11147
|
-
maxCreatedAtMapByActor,
|
|
11148
11157
|
versionVector
|
|
11149
11158
|
);
|
|
11150
11159
|
const changes = valueChanges.map((change) => ({
|
|
@@ -11159,7 +11168,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
11159
11168
|
type: "content"
|
|
11160
11169
|
/* Content */
|
|
11161
11170
|
}));
|
|
11162
|
-
return [
|
|
11171
|
+
return [changes, pairs, [caretPos, caretPos]];
|
|
11163
11172
|
}
|
|
11164
11173
|
/**
|
|
11165
11174
|
* `setStyle` applies the style of the given range.
|
|
@@ -11169,10 +11178,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
11169
11178
|
* @param range - range of RGATreeSplitNode
|
|
11170
11179
|
* @param attributes - style attributes
|
|
11171
11180
|
* @param editedAt - edited time
|
|
11172
|
-
* @param maxCreatedAtMapByActor - maxCreatedAtMapByActor
|
|
11173
11181
|
* @internal
|
|
11174
11182
|
*/
|
|
11175
|
-
setStyle(range, attributes, editedAt,
|
|
11183
|
+
setStyle(range, attributes, editedAt, versionVector) {
|
|
11176
11184
|
const [, toRight] = this.rgaTreeSplit.findNodeWithSplit(range[1], editedAt);
|
|
11177
11185
|
const [, fromRight] = this.rgaTreeSplit.findNodeWithSplit(
|
|
11178
11186
|
range[0],
|
|
@@ -11180,25 +11188,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
11180
11188
|
);
|
|
11181
11189
|
const changes = [];
|
|
11182
11190
|
const nodes = this.rgaTreeSplit.findBetween(fromRight, toRight);
|
|
11183
|
-
const createdAtMapByActor = /* @__PURE__ */ new Map();
|
|
11184
11191
|
const toBeStyleds = [];
|
|
11185
11192
|
for (const node of nodes) {
|
|
11186
11193
|
const actorID = node.getCreatedAt().getActorID();
|
|
11187
|
-
let
|
|
11188
|
-
|
|
11189
|
-
if (versionVector === void 0 && maxCreatedAtMapByActor === void 0) {
|
|
11190
|
-
clientLamportAtChange = MaxLamport;
|
|
11191
|
-
} else if (versionVector.size() > 0) {
|
|
11194
|
+
let clientLamportAtChange = MaxLamport;
|
|
11195
|
+
if (versionVector != void 0) {
|
|
11192
11196
|
clientLamportAtChange = versionVector.get(actorID) ? versionVector.get(actorID) : 0n;
|
|
11193
|
-
} else {
|
|
11194
|
-
maxCreatedAt = maxCreatedAtMapByActor.has(actorID) ? maxCreatedAtMapByActor.get(actorID) : InitialTimeTicket;
|
|
11195
11197
|
}
|
|
11196
|
-
if (node.canStyle(editedAt,
|
|
11197
|
-
const maxCreatedAt2 = createdAtMapByActor.get(actorID);
|
|
11198
|
-
const createdAt = node.getCreatedAt();
|
|
11199
|
-
if (!maxCreatedAt2 || createdAt.after(maxCreatedAt2)) {
|
|
11200
|
-
createdAtMapByActor.set(actorID, createdAt);
|
|
11201
|
-
}
|
|
11198
|
+
if (node.canStyle(editedAt, clientLamportAtChange)) {
|
|
11202
11199
|
toBeStyleds.push(node);
|
|
11203
11200
|
}
|
|
11204
11201
|
}
|
|
@@ -11226,7 +11223,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
11226
11223
|
}
|
|
11227
11224
|
}
|
|
11228
11225
|
}
|
|
11229
|
-
return [
|
|
11226
|
+
return [pairs, changes];
|
|
11230
11227
|
}
|
|
11231
11228
|
/**
|
|
11232
11229
|
* `indexRangeToPosRange` returns the position range of the given index range.
|
|
@@ -11373,28 +11370,25 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
11373
11370
|
}
|
|
11374
11371
|
}
|
|
11375
11372
|
class EditOperation extends Operation {
|
|
11376
|
-
constructor(parentCreatedAt, fromPos, toPos,
|
|
11373
|
+
constructor(parentCreatedAt, fromPos, toPos, content, attributes, executedAt) {
|
|
11377
11374
|
super(parentCreatedAt, executedAt);
|
|
11378
11375
|
__publicField(this, "fromPos");
|
|
11379
11376
|
__publicField(this, "toPos");
|
|
11380
|
-
__publicField(this, "maxCreatedAtMapByActor");
|
|
11381
11377
|
__publicField(this, "content");
|
|
11382
11378
|
__publicField(this, "attributes");
|
|
11383
11379
|
this.fromPos = fromPos;
|
|
11384
11380
|
this.toPos = toPos;
|
|
11385
|
-
this.maxCreatedAtMapByActor = maxCreatedAtMapByActor;
|
|
11386
11381
|
this.content = content;
|
|
11387
11382
|
this.attributes = attributes;
|
|
11388
11383
|
}
|
|
11389
11384
|
/**
|
|
11390
11385
|
* `create` creates a new instance of EditOperation.
|
|
11391
11386
|
*/
|
|
11392
|
-
static create(parentCreatedAt, fromPos, toPos,
|
|
11387
|
+
static create(parentCreatedAt, fromPos, toPos, content, attributes, executedAt) {
|
|
11393
11388
|
return new EditOperation(
|
|
11394
11389
|
parentCreatedAt,
|
|
11395
11390
|
fromPos,
|
|
11396
11391
|
toPos,
|
|
11397
|
-
maxCreatedAtMapByActor,
|
|
11398
11392
|
content,
|
|
11399
11393
|
attributes,
|
|
11400
11394
|
executedAt
|
|
@@ -11418,12 +11412,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
11418
11412
|
);
|
|
11419
11413
|
}
|
|
11420
11414
|
const text = parentObject;
|
|
11421
|
-
const [
|
|
11415
|
+
const [changes, pairs] = text.edit(
|
|
11422
11416
|
[this.fromPos, this.toPos],
|
|
11423
11417
|
this.content,
|
|
11424
11418
|
this.getExecutedAt(),
|
|
11425
11419
|
Object.fromEntries(this.attributes),
|
|
11426
|
-
this.maxCreatedAtMapByActor,
|
|
11427
11420
|
versionVector
|
|
11428
11421
|
);
|
|
11429
11422
|
for (const pair of pairs) {
|
|
@@ -11481,35 +11474,25 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
11481
11474
|
getAttributes() {
|
|
11482
11475
|
return this.attributes || /* @__PURE__ */ new Map();
|
|
11483
11476
|
}
|
|
11484
|
-
/**
|
|
11485
|
-
* `getMaxCreatedAtMapByActor` returns the map that stores the latest creation time
|
|
11486
|
-
* by actor for the nodes included in the editing range.
|
|
11487
|
-
*/
|
|
11488
|
-
getMaxCreatedAtMapByActor() {
|
|
11489
|
-
return this.maxCreatedAtMapByActor;
|
|
11490
|
-
}
|
|
11491
11477
|
}
|
|
11492
11478
|
class StyleOperation extends Operation {
|
|
11493
|
-
constructor(parentCreatedAt, fromPos, toPos,
|
|
11479
|
+
constructor(parentCreatedAt, fromPos, toPos, attributes, executedAt) {
|
|
11494
11480
|
super(parentCreatedAt, executedAt);
|
|
11495
11481
|
__publicField(this, "fromPos");
|
|
11496
11482
|
__publicField(this, "toPos");
|
|
11497
|
-
__publicField(this, "maxCreatedAtMapByActor");
|
|
11498
11483
|
__publicField(this, "attributes");
|
|
11499
11484
|
this.fromPos = fromPos;
|
|
11500
11485
|
this.toPos = toPos;
|
|
11501
|
-
this.maxCreatedAtMapByActor = maxCreatedAtMapByActor;
|
|
11502
11486
|
this.attributes = attributes;
|
|
11503
11487
|
}
|
|
11504
11488
|
/**
|
|
11505
11489
|
* `create` creates a new instance of StyleOperation.
|
|
11506
11490
|
*/
|
|
11507
|
-
static create(parentCreatedAt, fromPos, toPos,
|
|
11491
|
+
static create(parentCreatedAt, fromPos, toPos, attributes, executedAt) {
|
|
11508
11492
|
return new StyleOperation(
|
|
11509
11493
|
parentCreatedAt,
|
|
11510
11494
|
fromPos,
|
|
11511
11495
|
toPos,
|
|
11512
|
-
maxCreatedAtMapByActor,
|
|
11513
11496
|
attributes,
|
|
11514
11497
|
executedAt
|
|
11515
11498
|
);
|
|
@@ -11532,11 +11515,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
11532
11515
|
);
|
|
11533
11516
|
}
|
|
11534
11517
|
const text = parentObject;
|
|
11535
|
-
const [
|
|
11518
|
+
const [pairs, changes] = text.setStyle(
|
|
11536
11519
|
[this.fromPos, this.toPos],
|
|
11537
11520
|
this.attributes ? Object.fromEntries(this.attributes) : {},
|
|
11538
11521
|
this.getExecutedAt(),
|
|
11539
|
-
this.maxCreatedAtMapByActor,
|
|
11540
11522
|
versionVector
|
|
11541
11523
|
);
|
|
11542
11524
|
for (const pair of pairs) {
|
|
@@ -11588,13 +11570,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
11588
11570
|
getAttributes() {
|
|
11589
11571
|
return this.attributes;
|
|
11590
11572
|
}
|
|
11591
|
-
/**
|
|
11592
|
-
* `getMaxCreatedAtMapByActor` returns the map that stores the latest creation time
|
|
11593
|
-
* by actor for the nodes included in the editing range.
|
|
11594
|
-
*/
|
|
11595
|
-
getMaxCreatedAtMapByActor() {
|
|
11596
|
-
return this.maxCreatedAtMapByActor;
|
|
11597
|
-
}
|
|
11598
11573
|
}
|
|
11599
11574
|
const ElementPaddingSize = 2;
|
|
11600
11575
|
const DefaultRootType = "root";
|
|
@@ -12865,18 +12840,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
12865
12840
|
/**
|
|
12866
12841
|
* `canDelete` checks if node is able to delete.
|
|
12867
12842
|
*/
|
|
12868
|
-
canDelete(editedAt,
|
|
12869
|
-
const nodeExisted =
|
|
12843
|
+
canDelete(editedAt, clientLamportAtChange) {
|
|
12844
|
+
const nodeExisted = this.getCreatedAt().getLamport() <= clientLamportAtChange;
|
|
12870
12845
|
return nodeExisted && (!this.removedAt || editedAt.after(this.removedAt));
|
|
12871
12846
|
}
|
|
12872
12847
|
/**
|
|
12873
12848
|
* `canStyle` checks if node is able to style.
|
|
12874
12849
|
*/
|
|
12875
|
-
canStyle(editedAt,
|
|
12850
|
+
canStyle(editedAt, clientLamportAtChange) {
|
|
12876
12851
|
if (this.isText) {
|
|
12877
12852
|
return false;
|
|
12878
12853
|
}
|
|
12879
|
-
const nodeExisted =
|
|
12854
|
+
const nodeExisted = this.getCreatedAt().getLamport() <= clientLamportAtChange;
|
|
12880
12855
|
return nodeExisted && (!this.removedAt || editedAt.after(this.removedAt));
|
|
12881
12856
|
}
|
|
12882
12857
|
/**
|
|
@@ -13065,7 +13040,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13065
13040
|
/**
|
|
13066
13041
|
* `style` applies the given attributes of the given range.
|
|
13067
13042
|
*/
|
|
13068
|
-
style(range, attributes, editedAt,
|
|
13043
|
+
style(range, attributes, editedAt, versionVector) {
|
|
13069
13044
|
const [fromParent, fromLeft] = this.findNodesAndSplitText(
|
|
13070
13045
|
range[0],
|
|
13071
13046
|
editedAt
|
|
@@ -13073,7 +13048,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13073
13048
|
const [toParent, toLeft] = this.findNodesAndSplitText(range[1], editedAt);
|
|
13074
13049
|
const changes = [];
|
|
13075
13050
|
const attrs = attributes ? parseObjectValues(attributes) : {};
|
|
13076
|
-
const createdAtMapByActor = /* @__PURE__ */ new Map();
|
|
13077
13051
|
const pairs = [];
|
|
13078
13052
|
this.traverseInPosRange(
|
|
13079
13053
|
fromParent,
|
|
@@ -13082,21 +13056,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13082
13056
|
toLeft,
|
|
13083
13057
|
([node]) => {
|
|
13084
13058
|
const actorID = node.getCreatedAt().getActorID();
|
|
13085
|
-
let
|
|
13086
|
-
|
|
13087
|
-
if (versionVector === void 0 && maxCreatedAtMapByActor === void 0) {
|
|
13088
|
-
clientLamportAtChange = MaxLamport;
|
|
13089
|
-
} else if (versionVector.size() > 0) {
|
|
13059
|
+
let clientLamportAtChange = MaxLamport;
|
|
13060
|
+
if (versionVector != void 0) {
|
|
13090
13061
|
clientLamportAtChange = versionVector.get(actorID) ? versionVector.get(actorID) : 0n;
|
|
13091
|
-
} else {
|
|
13092
|
-
maxCreatedAt = maxCreatedAtMapByActor.has(actorID) ? maxCreatedAtMapByActor.get(actorID) : InitialTimeTicket;
|
|
13093
13062
|
}
|
|
13094
|
-
if (node.canStyle(editedAt,
|
|
13095
|
-
const maxCreatedAt2 = createdAtMapByActor.get(actorID);
|
|
13096
|
-
const createdAt = node.getCreatedAt();
|
|
13097
|
-
if (!maxCreatedAt2 || createdAt.after(maxCreatedAt2)) {
|
|
13098
|
-
createdAtMapByActor.set(actorID, createdAt);
|
|
13099
|
-
}
|
|
13063
|
+
if (node.canStyle(editedAt, clientLamportAtChange) && attributes) {
|
|
13100
13064
|
const updatedAttrPairs = node.setAttrs(attributes, editedAt);
|
|
13101
13065
|
const affectedAttrs = updatedAttrPairs.reduce(
|
|
13102
13066
|
(acc, [, curr]) => {
|
|
@@ -13129,19 +13093,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13129
13093
|
}
|
|
13130
13094
|
}
|
|
13131
13095
|
);
|
|
13132
|
-
return [
|
|
13096
|
+
return [pairs, changes];
|
|
13133
13097
|
}
|
|
13134
13098
|
/**
|
|
13135
13099
|
* `removeStyle` removes the given attributes of the given range.
|
|
13136
13100
|
*/
|
|
13137
|
-
removeStyle(range, attributesToRemove, editedAt,
|
|
13101
|
+
removeStyle(range, attributesToRemove, editedAt, versionVector) {
|
|
13138
13102
|
const [fromParent, fromLeft] = this.findNodesAndSplitText(
|
|
13139
13103
|
range[0],
|
|
13140
13104
|
editedAt
|
|
13141
13105
|
);
|
|
13142
13106
|
const [toParent, toLeft] = this.findNodesAndSplitText(range[1], editedAt);
|
|
13143
13107
|
const changes = [];
|
|
13144
|
-
const createdAtMapByActor = /* @__PURE__ */ new Map();
|
|
13145
13108
|
const pairs = [];
|
|
13146
13109
|
this.traverseInPosRange(
|
|
13147
13110
|
fromParent,
|
|
@@ -13150,21 +13113,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13150
13113
|
toLeft,
|
|
13151
13114
|
([node]) => {
|
|
13152
13115
|
const actorID = node.getCreatedAt().getActorID();
|
|
13153
|
-
let
|
|
13154
|
-
|
|
13155
|
-
if (versionVector === void 0 && maxCreatedAtMapByActor === void 0) {
|
|
13156
|
-
clientLamportAtChange = MaxLamport;
|
|
13157
|
-
} else if (versionVector.size() > 0) {
|
|
13116
|
+
let clientLamportAtChange = MaxLamport;
|
|
13117
|
+
if (versionVector != void 0) {
|
|
13158
13118
|
clientLamportAtChange = versionVector.get(actorID) ? versionVector.get(actorID) : 0n;
|
|
13159
|
-
} else {
|
|
13160
|
-
maxCreatedAt = maxCreatedAtMapByActor.has(actorID) ? maxCreatedAtMapByActor.get(actorID) : InitialTimeTicket;
|
|
13161
13119
|
}
|
|
13162
|
-
if (node.canStyle(editedAt,
|
|
13163
|
-
const maxCreatedAt2 = createdAtMapByActor.get(actorID);
|
|
13164
|
-
const createdAt = node.getCreatedAt();
|
|
13165
|
-
if (!maxCreatedAt2 || createdAt.after(maxCreatedAt2)) {
|
|
13166
|
-
createdAtMapByActor.set(actorID, createdAt);
|
|
13167
|
-
}
|
|
13120
|
+
if (node.canStyle(editedAt, clientLamportAtChange) && attributesToRemove) {
|
|
13168
13121
|
if (!node.attrs) {
|
|
13169
13122
|
node.attrs = new RHT();
|
|
13170
13123
|
}
|
|
@@ -13188,13 +13141,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13188
13141
|
}
|
|
13189
13142
|
}
|
|
13190
13143
|
);
|
|
13191
|
-
return [
|
|
13144
|
+
return [pairs, changes];
|
|
13192
13145
|
}
|
|
13193
13146
|
/**
|
|
13194
13147
|
* `edit` edits the tree with the given range and content.
|
|
13195
13148
|
* If the content is undefined, the range will be removed.
|
|
13196
13149
|
*/
|
|
13197
|
-
edit(range, contents, splitLevel, editedAt, issueTimeTicket,
|
|
13150
|
+
edit(range, contents, splitLevel, editedAt, issueTimeTicket, versionVector) {
|
|
13198
13151
|
const [fromParent, fromLeft] = this.findNodesAndSplitText(
|
|
13199
13152
|
range[0],
|
|
13200
13153
|
editedAt
|
|
@@ -13205,7 +13158,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13205
13158
|
const nodesToBeRemoved = [];
|
|
13206
13159
|
const tokensToBeRemoved = [];
|
|
13207
13160
|
const toBeMovedToFromParents = [];
|
|
13208
|
-
const maxCreatedAtMap = /* @__PURE__ */ new Map();
|
|
13209
13161
|
this.traverseInPosRange(
|
|
13210
13162
|
fromParent,
|
|
13211
13163
|
fromLeft,
|
|
@@ -13218,21 +13170,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13218
13170
|
}
|
|
13219
13171
|
}
|
|
13220
13172
|
const actorID = node.getCreatedAt().getActorID();
|
|
13221
|
-
let
|
|
13222
|
-
|
|
13223
|
-
if (versionVector === void 0 && maxCreatedAtMapByActor === void 0) {
|
|
13224
|
-
clientLamportAtChange = MaxLamport;
|
|
13225
|
-
} else if (versionVector.size() > 0) {
|
|
13173
|
+
let clientLamportAtChange = MaxLamport;
|
|
13174
|
+
if (versionVector != void 0) {
|
|
13226
13175
|
clientLamportAtChange = versionVector.get(actorID) ? versionVector.get(actorID) : 0n;
|
|
13227
|
-
} else {
|
|
13228
|
-
maxCreatedAt = maxCreatedAtMapByActor.has(actorID) ? maxCreatedAtMapByActor.get(actorID) : InitialTimeTicket;
|
|
13229
13176
|
}
|
|
13230
|
-
if (node.canDelete(editedAt,
|
|
13231
|
-
const maxCreatedAt2 = maxCreatedAtMap.get(actorID);
|
|
13232
|
-
const createdAt = node.getCreatedAt();
|
|
13233
|
-
if (!maxCreatedAt2 || createdAt.after(maxCreatedAt2)) {
|
|
13234
|
-
maxCreatedAtMap.set(actorID, createdAt);
|
|
13235
|
-
}
|
|
13177
|
+
if (node.canDelete(editedAt, clientLamportAtChange) || nodesToBeRemoved.includes(node.parent)) {
|
|
13236
13178
|
if (tokenType === TokenType.Text || tokenType === TokenType.Start) {
|
|
13237
13179
|
nodesToBeRemoved.push(node);
|
|
13238
13180
|
}
|
|
@@ -13313,7 +13255,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13313
13255
|
}
|
|
13314
13256
|
}
|
|
13315
13257
|
}
|
|
13316
|
-
return [changes, pairs
|
|
13258
|
+
return [changes, pairs];
|
|
13317
13259
|
}
|
|
13318
13260
|
/**
|
|
13319
13261
|
* `editT` edits the given range with the given value.
|
|
@@ -13752,30 +13694,27 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13752
13694
|
}
|
|
13753
13695
|
}
|
|
13754
13696
|
class TreeEditOperation extends Operation {
|
|
13755
|
-
constructor(parentCreatedAt, fromPos, toPos, contents, splitLevel,
|
|
13697
|
+
constructor(parentCreatedAt, fromPos, toPos, contents, splitLevel, executedAt) {
|
|
13756
13698
|
super(parentCreatedAt, executedAt);
|
|
13757
13699
|
__publicField(this, "fromPos");
|
|
13758
13700
|
__publicField(this, "toPos");
|
|
13759
13701
|
__publicField(this, "contents");
|
|
13760
13702
|
__publicField(this, "splitLevel");
|
|
13761
|
-
__publicField(this, "maxCreatedAtMapByActor");
|
|
13762
13703
|
this.fromPos = fromPos;
|
|
13763
13704
|
this.toPos = toPos;
|
|
13764
13705
|
this.contents = contents;
|
|
13765
13706
|
this.splitLevel = splitLevel;
|
|
13766
|
-
this.maxCreatedAtMapByActor = maxCreatedAtMapByActor;
|
|
13767
13707
|
}
|
|
13768
13708
|
/**
|
|
13769
13709
|
* `create` creates a new instance of EditOperation.
|
|
13770
13710
|
*/
|
|
13771
|
-
static create(parentCreatedAt, fromPos, toPos, contents, splitLevel,
|
|
13711
|
+
static create(parentCreatedAt, fromPos, toPos, contents, splitLevel, executedAt) {
|
|
13772
13712
|
return new TreeEditOperation(
|
|
13773
13713
|
parentCreatedAt,
|
|
13774
13714
|
fromPos,
|
|
13775
13715
|
toPos,
|
|
13776
13716
|
contents,
|
|
13777
13717
|
splitLevel,
|
|
13778
|
-
maxCreatedAtMapByActor,
|
|
13779
13718
|
executedAt
|
|
13780
13719
|
);
|
|
13781
13720
|
}
|
|
@@ -13823,7 +13762,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13823
13762
|
);
|
|
13824
13763
|
return issueTimeTicket;
|
|
13825
13764
|
})(),
|
|
13826
|
-
this.maxCreatedAtMapByActor,
|
|
13827
13765
|
versionVector
|
|
13828
13766
|
);
|
|
13829
13767
|
for (const pair of pairs) {
|
|
@@ -13886,13 +13824,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13886
13824
|
getSplitLevel() {
|
|
13887
13825
|
return this.splitLevel;
|
|
13888
13826
|
}
|
|
13889
|
-
/**
|
|
13890
|
-
* `getMaxCreatedAtMapByActor` returns the map that stores the latest creation time
|
|
13891
|
-
* by actor for the nodes included in the editing range.
|
|
13892
|
-
*/
|
|
13893
|
-
getMaxCreatedAtMapByActor() {
|
|
13894
|
-
return this.maxCreatedAtMapByActor;
|
|
13895
|
-
}
|
|
13896
13827
|
}
|
|
13897
13828
|
class VersionVector {
|
|
13898
13829
|
constructor(vector) {
|
|
@@ -14036,12 +13967,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
14036
13967
|
*/
|
|
14037
13968
|
syncClocks(other) {
|
|
14038
13969
|
const lamport = other.lamport > this.lamport ? other.lamport + 1n : this.lamport + 1n;
|
|
14039
|
-
|
|
14040
|
-
if (otherVV.size() === 0) {
|
|
14041
|
-
otherVV = otherVV.deepcopy();
|
|
14042
|
-
otherVV.set(other.actor, other.lamport);
|
|
14043
|
-
}
|
|
14044
|
-
const maxVersionVector = this.versionVector.max(otherVV);
|
|
13970
|
+
const maxVersionVector = this.versionVector.max(other.versionVector);
|
|
14045
13971
|
const newID = new ChangeID(
|
|
14046
13972
|
this.clientSeq,
|
|
14047
13973
|
lamport,
|
|
@@ -14287,7 +14213,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
14287
14213
|
}
|
|
14288
14214
|
}
|
|
14289
14215
|
class ChangePack {
|
|
14290
|
-
constructor(key, checkpoint, isRemoved, changes, versionVector, snapshot
|
|
14216
|
+
constructor(key, checkpoint, isRemoved, changes, versionVector, snapshot) {
|
|
14291
14217
|
/**
|
|
14292
14218
|
* `documentKey` is the key of the document.
|
|
14293
14219
|
*/
|
|
@@ -14305,12 +14231,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
14305
14231
|
* `snapshot` is a byte array that encodes the document.
|
|
14306
14232
|
*/
|
|
14307
14233
|
__publicField(this, "snapshot");
|
|
14308
|
-
/**
|
|
14309
|
-
* `minSyncedTicket` is the minimum logical time taken by clients who attach
|
|
14310
|
-
* to the document. It is used to collect garbage on the replica on the
|
|
14311
|
-
* client.
|
|
14312
|
-
*/
|
|
14313
|
-
__publicField(this, "minSyncedTicket");
|
|
14314
14234
|
/**
|
|
14315
14235
|
* `versionVector` is the version vector current document
|
|
14316
14236
|
*/
|
|
@@ -14320,21 +14240,19 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
14320
14240
|
this.isRemoved = isRemoved;
|
|
14321
14241
|
this.changes = changes;
|
|
14322
14242
|
this.snapshot = snapshot;
|
|
14323
|
-
this.minSyncedTicket = minSyncedTicket;
|
|
14324
14243
|
this.versionVector = versionVector;
|
|
14325
14244
|
}
|
|
14326
14245
|
/**
|
|
14327
14246
|
* `create` creates a new instance of ChangePack.
|
|
14328
14247
|
*/
|
|
14329
|
-
static create(key, checkpoint, isRemoved, changes, versionVector, snapshot
|
|
14248
|
+
static create(key, checkpoint, isRemoved, changes, versionVector, snapshot) {
|
|
14330
14249
|
return new ChangePack(
|
|
14331
14250
|
key,
|
|
14332
14251
|
checkpoint,
|
|
14333
14252
|
isRemoved,
|
|
14334
14253
|
changes,
|
|
14335
14254
|
versionVector,
|
|
14336
|
-
snapshot
|
|
14337
|
-
minSyncedTicket
|
|
14255
|
+
snapshot
|
|
14338
14256
|
);
|
|
14339
14257
|
}
|
|
14340
14258
|
/**
|
|
@@ -14385,12 +14303,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
14385
14303
|
getSnapshot() {
|
|
14386
14304
|
return this.snapshot;
|
|
14387
14305
|
}
|
|
14388
|
-
/**
|
|
14389
|
-
* `getMinSyncedTicket` returns the minimum synced ticket of this pack.
|
|
14390
|
-
*/
|
|
14391
|
-
getMinSyncedTicket() {
|
|
14392
|
-
return this.minSyncedTicket;
|
|
14393
|
-
}
|
|
14394
14306
|
/**
|
|
14395
14307
|
* `getVersionVector` returns the document's version vector of this pack
|
|
14396
14308
|
*/
|
|
@@ -14775,9 +14687,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
14775
14687
|
/**
|
|
14776
14688
|
* `canDelete` checks if node is able to delete.
|
|
14777
14689
|
*/
|
|
14778
|
-
canDelete(editedAt,
|
|
14690
|
+
canDelete(editedAt, clientLamportAtChange) {
|
|
14779
14691
|
const justRemoved = !this.removedAt;
|
|
14780
|
-
const nodeExisted =
|
|
14692
|
+
const nodeExisted = this.getCreatedAt().getLamport() <= clientLamportAtChange;
|
|
14781
14693
|
if (nodeExisted && (!this.removedAt || editedAt.after(this.removedAt))) {
|
|
14782
14694
|
return justRemoved;
|
|
14783
14695
|
}
|
|
@@ -14786,8 +14698,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
14786
14698
|
/**
|
|
14787
14699
|
* `canStyle` checks if node is able to set style.
|
|
14788
14700
|
*/
|
|
14789
|
-
canStyle(editedAt,
|
|
14790
|
-
const nodeExisted =
|
|
14701
|
+
canStyle(editedAt, clientLamportAtChange) {
|
|
14702
|
+
const nodeExisted = this.getCreatedAt().getLamport() <= clientLamportAtChange;
|
|
14791
14703
|
return nodeExisted && (!this.removedAt || editedAt.after(this.removedAt));
|
|
14792
14704
|
}
|
|
14793
14705
|
/**
|
|
@@ -14869,17 +14781,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
14869
14781
|
* @param range - range of RGATreeSplitNode
|
|
14870
14782
|
* @param editedAt - edited time
|
|
14871
14783
|
* @param value - value
|
|
14872
|
-
* @
|
|
14873
|
-
* @returns `[RGATreeSplitPos, Map<string, TimeTicket>, Array<GCPair>, Array<Change>]`
|
|
14784
|
+
* @returns `[RGATreeSplitPos, Array<GCPair>, Array<Change>]`
|
|
14874
14785
|
*/
|
|
14875
|
-
edit(range, editedAt, value,
|
|
14786
|
+
edit(range, editedAt, value, versionVector) {
|
|
14876
14787
|
const [toLeft, toRight] = this.findNodeWithSplit(range[1], editedAt);
|
|
14877
14788
|
const [fromLeft, fromRight] = this.findNodeWithSplit(range[0], editedAt);
|
|
14878
14789
|
const nodesToDelete = this.findBetween(fromRight, toRight);
|
|
14879
|
-
const [changes,
|
|
14790
|
+
const [changes, removedNodes] = this.deleteNodes(
|
|
14880
14791
|
nodesToDelete,
|
|
14881
14792
|
editedAt,
|
|
14882
|
-
maxCreatedAtMapByActor,
|
|
14883
14793
|
versionVector
|
|
14884
14794
|
);
|
|
14885
14795
|
const caretID = toRight ? toRight.getID() : toLeft.getID();
|
|
@@ -14909,7 +14819,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
14909
14819
|
for (const [, removedNode] of removedNodes) {
|
|
14910
14820
|
pairs.push({ parent: this, child: removedNode });
|
|
14911
14821
|
}
|
|
14912
|
-
return [caretPos,
|
|
14822
|
+
return [caretPos, pairs, changes];
|
|
14913
14823
|
}
|
|
14914
14824
|
/**
|
|
14915
14825
|
* `indexToPos` finds RGATreeSplitPos of given offset.
|
|
@@ -15114,47 +15024,36 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
15114
15024
|
splitNode.setInsPrev(node);
|
|
15115
15025
|
return splitNode;
|
|
15116
15026
|
}
|
|
15117
|
-
deleteNodes(candidates, editedAt,
|
|
15027
|
+
deleteNodes(candidates, editedAt, versionVector) {
|
|
15118
15028
|
if (!candidates.length) {
|
|
15119
|
-
return [[], /* @__PURE__ */ new Map()
|
|
15029
|
+
return [[], /* @__PURE__ */ new Map()];
|
|
15120
15030
|
}
|
|
15121
15031
|
const [nodesToDelete, nodesToKeep] = this.filterNodes(
|
|
15122
15032
|
candidates,
|
|
15123
15033
|
editedAt,
|
|
15124
|
-
maxCreatedAtMapByActor,
|
|
15125
15034
|
versionVector
|
|
15126
15035
|
);
|
|
15127
|
-
const createdAtMapByActor = /* @__PURE__ */ new Map();
|
|
15128
15036
|
const removedNodes = /* @__PURE__ */ new Map();
|
|
15129
15037
|
const changes = this.makeChanges(nodesToKeep, editedAt);
|
|
15130
15038
|
for (const node of nodesToDelete) {
|
|
15131
|
-
const actorID = node.getCreatedAt().getActorID();
|
|
15132
|
-
if (!createdAtMapByActor.has(actorID) || node.getID().getCreatedAt().after(createdAtMapByActor.get(actorID))) {
|
|
15133
|
-
createdAtMapByActor.set(actorID, node.getID().getCreatedAt());
|
|
15134
|
-
}
|
|
15135
15039
|
removedNodes.set(node.getID().toIDString(), node);
|
|
15136
15040
|
node.remove(editedAt);
|
|
15137
15041
|
}
|
|
15138
15042
|
this.deleteIndexNodes(nodesToKeep);
|
|
15139
|
-
return [changes,
|
|
15043
|
+
return [changes, removedNodes];
|
|
15140
15044
|
}
|
|
15141
|
-
filterNodes(candidates, editedAt,
|
|
15045
|
+
filterNodes(candidates, editedAt, versionVector) {
|
|
15142
15046
|
const nodesToDelete = [];
|
|
15143
15047
|
const nodesToKeep = [];
|
|
15144
15048
|
const [leftEdge, rightEdge] = this.findEdgesOfCandidates(candidates);
|
|
15145
15049
|
nodesToKeep.push(leftEdge);
|
|
15146
15050
|
for (const node of candidates) {
|
|
15147
15051
|
const actorID = node.getCreatedAt().getActorID();
|
|
15148
|
-
let
|
|
15149
|
-
|
|
15150
|
-
if (versionVector === void 0 && maxCreatedAtMapByActor === void 0) {
|
|
15151
|
-
clientLamportAtChange = MaxLamport;
|
|
15152
|
-
} else if (versionVector.size() > 0) {
|
|
15052
|
+
let clientLamportAtChange = MaxLamport;
|
|
15053
|
+
if (versionVector != void 0) {
|
|
15153
15054
|
clientLamportAtChange = versionVector.get(actorID) ? versionVector.get(actorID) : 0n;
|
|
15154
|
-
} else {
|
|
15155
|
-
maxCreatedAt = maxCreatedAtMapByActor.has(actorID) ? maxCreatedAtMapByActor.get(actorID) : InitialTimeTicket;
|
|
15156
15055
|
}
|
|
15157
|
-
if (node.canDelete(editedAt,
|
|
15056
|
+
if (node.canDelete(editedAt, clientLamportAtChange)) {
|
|
15158
15057
|
nodesToDelete.push(node);
|
|
15159
15058
|
} else {
|
|
15160
15059
|
nodesToKeep.push(node);
|
|
@@ -15535,28 +15434,25 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
15535
15434
|
}
|
|
15536
15435
|
}
|
|
15537
15436
|
class TreeStyleOperation extends Operation {
|
|
15538
|
-
constructor(parentCreatedAt, fromPos, toPos,
|
|
15437
|
+
constructor(parentCreatedAt, fromPos, toPos, attributes, attributesToRemove, executedAt) {
|
|
15539
15438
|
super(parentCreatedAt, executedAt);
|
|
15540
15439
|
__publicField(this, "fromPos");
|
|
15541
15440
|
__publicField(this, "toPos");
|
|
15542
|
-
__publicField(this, "maxCreatedAtMapByActor");
|
|
15543
15441
|
__publicField(this, "attributes");
|
|
15544
15442
|
__publicField(this, "attributesToRemove");
|
|
15545
15443
|
this.fromPos = fromPos;
|
|
15546
15444
|
this.toPos = toPos;
|
|
15547
|
-
this.maxCreatedAtMapByActor = maxCreatedAtMapByActor;
|
|
15548
15445
|
this.attributes = attributes;
|
|
15549
15446
|
this.attributesToRemove = attributesToRemove;
|
|
15550
15447
|
}
|
|
15551
15448
|
/**
|
|
15552
15449
|
* `create` creates a new instance of TreeStyleOperation.
|
|
15553
15450
|
*/
|
|
15554
|
-
static create(parentCreatedAt, fromPos, toPos,
|
|
15451
|
+
static create(parentCreatedAt, fromPos, toPos, attributes, executedAt) {
|
|
15555
15452
|
return new TreeStyleOperation(
|
|
15556
15453
|
parentCreatedAt,
|
|
15557
15454
|
fromPos,
|
|
15558
15455
|
toPos,
|
|
15559
|
-
maxCreatedAtMapByActor,
|
|
15560
15456
|
attributes,
|
|
15561
15457
|
[],
|
|
15562
15458
|
executedAt
|
|
@@ -15565,12 +15461,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
15565
15461
|
/**
|
|
15566
15462
|
* `createTreeRemoveStyleOperation` creates a new instance of TreeStyleOperation for style deletion.
|
|
15567
15463
|
*/
|
|
15568
|
-
static createTreeRemoveStyleOperation(parentCreatedAt, fromPos, toPos,
|
|
15464
|
+
static createTreeRemoveStyleOperation(parentCreatedAt, fromPos, toPos, attributesToRemove, executedAt) {
|
|
15569
15465
|
return new TreeStyleOperation(
|
|
15570
15466
|
parentCreatedAt,
|
|
15571
15467
|
fromPos,
|
|
15572
15468
|
toPos,
|
|
15573
|
-
maxCreatedAtMapByActor,
|
|
15574
15469
|
/* @__PURE__ */ new Map(),
|
|
15575
15470
|
attributesToRemove,
|
|
15576
15471
|
executedAt
|
|
@@ -15599,20 +15494,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
15599
15494
|
if (this.attributes.size) {
|
|
15600
15495
|
const attributes = {};
|
|
15601
15496
|
[...this.attributes].forEach(([key, value]) => attributes[key] = value);
|
|
15602
|
-
[
|
|
15497
|
+
[pairs, changes] = tree.style(
|
|
15603
15498
|
[this.fromPos, this.toPos],
|
|
15604
15499
|
attributes,
|
|
15605
15500
|
this.getExecutedAt(),
|
|
15606
|
-
this.maxCreatedAtMapByActor,
|
|
15607
15501
|
versionVector
|
|
15608
15502
|
);
|
|
15609
15503
|
} else {
|
|
15610
15504
|
const attributesToRemove = this.attributesToRemove;
|
|
15611
|
-
[
|
|
15505
|
+
[pairs, changes] = tree.removeStyle(
|
|
15612
15506
|
[this.fromPos, this.toPos],
|
|
15613
15507
|
attributesToRemove,
|
|
15614
15508
|
this.getExecutedAt(),
|
|
15615
|
-
this.maxCreatedAtMapByActor,
|
|
15616
15509
|
versionVector
|
|
15617
15510
|
);
|
|
15618
15511
|
}
|
|
@@ -15674,13 +15567,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
15674
15567
|
getAttributesToRemove() {
|
|
15675
15568
|
return this.attributesToRemove;
|
|
15676
15569
|
}
|
|
15677
|
-
/**
|
|
15678
|
-
* `getMaxCreatedAtMapByActor` returns the map that stores the latest creation time
|
|
15679
|
-
* by actor for the nodes included in the styling range.
|
|
15680
|
-
*/
|
|
15681
|
-
getMaxCreatedAtMapByActor() {
|
|
15682
|
-
return this.maxCreatedAtMapByActor;
|
|
15683
|
-
}
|
|
15684
15570
|
}
|
|
15685
15571
|
function toPresence(presence) {
|
|
15686
15572
|
const pbPresence = new Presence$1();
|
|
@@ -15904,10 +15790,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
15904
15790
|
);
|
|
15905
15791
|
pbEditOperation.from = toTextNodePos(editOperation.getFromPos());
|
|
15906
15792
|
pbEditOperation.to = toTextNodePos(editOperation.getToPos());
|
|
15907
|
-
const pbCreatedAtMapByActor = pbEditOperation.createdAtMapByActor;
|
|
15908
|
-
for (const [key, value] of editOperation.getMaxCreatedAtMapByActor()) {
|
|
15909
|
-
pbCreatedAtMapByActor[key] = toTimeTicket(value);
|
|
15910
|
-
}
|
|
15911
15793
|
pbEditOperation.content = editOperation.getContent();
|
|
15912
15794
|
const pbAttributes = pbEditOperation.attributes;
|
|
15913
15795
|
for (const [key, value] of editOperation.getAttributes()) {
|
|
@@ -15924,10 +15806,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
15924
15806
|
);
|
|
15925
15807
|
pbStyleOperation.from = toTextNodePos(styleOperation.getFromPos());
|
|
15926
15808
|
pbStyleOperation.to = toTextNodePos(styleOperation.getToPos());
|
|
15927
|
-
const pbCreatedAtMapByActor = pbStyleOperation.createdAtMapByActor;
|
|
15928
|
-
for (const [key, value] of styleOperation.getMaxCreatedAtMapByActor()) {
|
|
15929
|
-
pbCreatedAtMapByActor[key] = toTimeTicket(value);
|
|
15930
|
-
}
|
|
15931
15809
|
const pbAttributes = pbStyleOperation.attributes;
|
|
15932
15810
|
for (const [key, value] of styleOperation.getAttributes()) {
|
|
15933
15811
|
pbAttributes[key] = value;
|
|
@@ -15950,10 +15828,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
15950
15828
|
} else if (operation instanceof TreeEditOperation) {
|
|
15951
15829
|
const treeEditOperation = operation;
|
|
15952
15830
|
const pbTreeEditOperation = new Operation_TreeEdit();
|
|
15953
|
-
const pbCreatedAtMapByActor = pbTreeEditOperation.createdAtMapByActor;
|
|
15954
|
-
for (const [key, value] of treeEditOperation.getMaxCreatedAtMapByActor()) {
|
|
15955
|
-
pbCreatedAtMapByActor[key] = toTimeTicket(value);
|
|
15956
|
-
}
|
|
15957
15831
|
pbTreeEditOperation.parentCreatedAt = toTimeTicket(
|
|
15958
15832
|
treeEditOperation.getParentCreatedAt()
|
|
15959
15833
|
);
|
|
@@ -15976,10 +15850,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
15976
15850
|
);
|
|
15977
15851
|
pbTreeStyleOperation.from = toTreePos(treeStyleOperation.getFromPos());
|
|
15978
15852
|
pbTreeStyleOperation.to = toTreePos(treeStyleOperation.getToPos());
|
|
15979
|
-
const pbCreatedAtMapByActor = pbTreeStyleOperation.createdAtMapByActor;
|
|
15980
|
-
for (const [key, value] of treeStyleOperation.getMaxCreatedAtMapByActor()) {
|
|
15981
|
-
pbCreatedAtMapByActor[key] = toTimeTicket(value);
|
|
15982
|
-
}
|
|
15983
15853
|
const attributesToRemove = treeStyleOperation.getAttributesToRemove();
|
|
15984
15854
|
if (attributesToRemove.length > 0) {
|
|
15985
15855
|
pbTreeStyleOperation.attributesToRemove = attributesToRemove;
|
|
@@ -16217,8 +16087,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
16217
16087
|
isRemoved: pack.getIsRemoved(),
|
|
16218
16088
|
changes: toChanges(pack.getChanges()),
|
|
16219
16089
|
snapshot: pack.getSnapshot(),
|
|
16220
|
-
versionVector: toVersionVector(pack.getVersionVector())
|
|
16221
|
-
minSyncedTicket: toTimeTicket(pack.getMinSyncedTicket())
|
|
16090
|
+
versionVector: toVersionVector(pack.getVersionVector())
|
|
16222
16091
|
});
|
|
16223
16092
|
}
|
|
16224
16093
|
function errorMetadataOf(error) {
|
|
@@ -16508,12 +16377,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
16508
16377
|
);
|
|
16509
16378
|
} else if (pbOperation.body.case === "edit") {
|
|
16510
16379
|
const pbEditOperation = pbOperation.body.value;
|
|
16511
|
-
const createdAtMapByActor = /* @__PURE__ */ new Map();
|
|
16512
|
-
Object.entries(pbEditOperation.createdAtMapByActor).forEach(
|
|
16513
|
-
([key, value]) => {
|
|
16514
|
-
createdAtMapByActor.set(key, fromTimeTicket(value));
|
|
16515
|
-
}
|
|
16516
|
-
);
|
|
16517
16380
|
const attributes = /* @__PURE__ */ new Map();
|
|
16518
16381
|
Object.entries(pbEditOperation.attributes).forEach(([key, value]) => {
|
|
16519
16382
|
attributes.set(key, value);
|
|
@@ -16522,19 +16385,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
16522
16385
|
fromTimeTicket(pbEditOperation.parentCreatedAt),
|
|
16523
16386
|
fromTextNodePos(pbEditOperation.from),
|
|
16524
16387
|
fromTextNodePos(pbEditOperation.to),
|
|
16525
|
-
createdAtMapByActor,
|
|
16526
16388
|
pbEditOperation.content,
|
|
16527
16389
|
attributes,
|
|
16528
16390
|
fromTimeTicket(pbEditOperation.executedAt)
|
|
16529
16391
|
);
|
|
16530
16392
|
} else if (pbOperation.body.case === "style") {
|
|
16531
16393
|
const pbStyleOperation = pbOperation.body.value;
|
|
16532
|
-
const createdAtMapByActor = /* @__PURE__ */ new Map();
|
|
16533
|
-
Object.entries(pbStyleOperation.createdAtMapByActor).forEach(
|
|
16534
|
-
([key, value]) => {
|
|
16535
|
-
createdAtMapByActor.set(key, fromTimeTicket(value));
|
|
16536
|
-
}
|
|
16537
|
-
);
|
|
16538
16394
|
const attributes = /* @__PURE__ */ new Map();
|
|
16539
16395
|
Object.entries(pbStyleOperation.attributes).forEach(([key, value]) => {
|
|
16540
16396
|
attributes.set(key, value);
|
|
@@ -16543,7 +16399,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
16543
16399
|
fromTimeTicket(pbStyleOperation.parentCreatedAt),
|
|
16544
16400
|
fromTextNodePos(pbStyleOperation.from),
|
|
16545
16401
|
fromTextNodePos(pbStyleOperation.to),
|
|
16546
|
-
createdAtMapByActor,
|
|
16547
16402
|
attributes,
|
|
16548
16403
|
fromTimeTicket(pbStyleOperation.executedAt)
|
|
16549
16404
|
);
|
|
@@ -16558,39 +16413,23 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
16558
16413
|
);
|
|
16559
16414
|
} else if (pbOperation.body.case === "treeEdit") {
|
|
16560
16415
|
const pbTreeEditOperation = pbOperation.body.value;
|
|
16561
|
-
const createdAtMapByActor = /* @__PURE__ */ new Map();
|
|
16562
|
-
Object.entries(pbTreeEditOperation.createdAtMapByActor).forEach(
|
|
16563
|
-
([key, value]) => {
|
|
16564
|
-
createdAtMapByActor.set(key, fromTimeTicket(value));
|
|
16565
|
-
}
|
|
16566
|
-
);
|
|
16567
16416
|
return TreeEditOperation.create(
|
|
16568
16417
|
fromTimeTicket(pbTreeEditOperation.parentCreatedAt),
|
|
16569
16418
|
fromTreePos(pbTreeEditOperation.from),
|
|
16570
16419
|
fromTreePos(pbTreeEditOperation.to),
|
|
16571
16420
|
fromTreeNodesWhenEdit(pbTreeEditOperation.contents),
|
|
16572
16421
|
pbTreeEditOperation.splitLevel,
|
|
16573
|
-
createdAtMapByActor,
|
|
16574
16422
|
fromTimeTicket(pbTreeEditOperation.executedAt)
|
|
16575
16423
|
);
|
|
16576
16424
|
} else if (pbOperation.body.case === "treeStyle") {
|
|
16577
16425
|
const pbTreeStyleOperation = pbOperation.body.value;
|
|
16578
16426
|
const attributes = /* @__PURE__ */ new Map();
|
|
16579
16427
|
const attributesToRemove = pbTreeStyleOperation.attributesToRemove;
|
|
16580
|
-
const createdAtMapByActor = /* @__PURE__ */ new Map();
|
|
16581
|
-
if (pbTreeStyleOperation == null ? void 0 : pbTreeStyleOperation.createdAtMapByActor) {
|
|
16582
|
-
Object.entries(pbTreeStyleOperation.createdAtMapByActor).forEach(
|
|
16583
|
-
([key, value]) => {
|
|
16584
|
-
createdAtMapByActor.set(key, fromTimeTicket(value));
|
|
16585
|
-
}
|
|
16586
|
-
);
|
|
16587
|
-
}
|
|
16588
16428
|
if ((attributesToRemove == null ? void 0 : attributesToRemove.length) > 0) {
|
|
16589
16429
|
return TreeStyleOperation.createTreeRemoveStyleOperation(
|
|
16590
16430
|
fromTimeTicket(pbTreeStyleOperation.parentCreatedAt),
|
|
16591
16431
|
fromTreePos(pbTreeStyleOperation.from),
|
|
16592
16432
|
fromTreePos(pbTreeStyleOperation.to),
|
|
16593
|
-
createdAtMapByActor,
|
|
16594
16433
|
attributesToRemove,
|
|
16595
16434
|
fromTimeTicket(pbTreeStyleOperation.executedAt)
|
|
16596
16435
|
);
|
|
@@ -16604,7 +16443,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
16604
16443
|
fromTimeTicket(pbTreeStyleOperation.parentCreatedAt),
|
|
16605
16444
|
fromTreePos(pbTreeStyleOperation.from),
|
|
16606
16445
|
fromTreePos(pbTreeStyleOperation.to),
|
|
16607
|
-
createdAtMapByActor,
|
|
16608
16446
|
attributes,
|
|
16609
16447
|
fromTimeTicket(pbTreeStyleOperation.executedAt)
|
|
16610
16448
|
);
|
|
@@ -16647,8 +16485,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
16647
16485
|
pbPack.isRemoved,
|
|
16648
16486
|
fromChanges(pbPack.changes),
|
|
16649
16487
|
fromVersionVector(pbPack.versionVector),
|
|
16650
|
-
pbPack.snapshot
|
|
16651
|
-
fromTimeTicket(pbPack.minSyncedTicket)
|
|
16488
|
+
pbPack.snapshot
|
|
16652
16489
|
);
|
|
16653
16490
|
}
|
|
16654
16491
|
function fromObject(pbObject) {
|
|
@@ -18111,7 +17948,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18111
17948
|
}
|
|
18112
17949
|
const attrs = attributes ? stringifyObjectValues(attributes) : void 0;
|
|
18113
17950
|
const ticket = this.context.issueTimeTicket();
|
|
18114
|
-
const [
|
|
17951
|
+
const [, pairs, rangeAfterEdit] = this.text.edit(
|
|
18115
17952
|
range,
|
|
18116
17953
|
content,
|
|
18117
17954
|
ticket,
|
|
@@ -18125,7 +17962,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18125
17962
|
this.text.getCreatedAt(),
|
|
18126
17963
|
range[0],
|
|
18127
17964
|
range[1],
|
|
18128
|
-
maxCreatedAtMapByActor,
|
|
18129
17965
|
content,
|
|
18130
17966
|
attrs ? new Map(Object.entries(attrs)) : /* @__PURE__ */ new Map(),
|
|
18131
17967
|
ticket
|
|
@@ -18171,11 +18007,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18171
18007
|
}
|
|
18172
18008
|
const attrs = stringifyObjectValues(attributes);
|
|
18173
18009
|
const ticket = this.context.issueTimeTicket();
|
|
18174
|
-
const [
|
|
18175
|
-
range,
|
|
18176
|
-
attrs,
|
|
18177
|
-
ticket
|
|
18178
|
-
);
|
|
18010
|
+
const [pairs] = this.text.setStyle(range, attrs, ticket);
|
|
18179
18011
|
for (const pair of pairs) {
|
|
18180
18012
|
this.context.registerGCPair(pair);
|
|
18181
18013
|
}
|
|
@@ -18184,7 +18016,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18184
18016
|
this.text.getCreatedAt(),
|
|
18185
18017
|
range[0],
|
|
18186
18018
|
range[1],
|
|
18187
|
-
maxCreatedAtMapByActor,
|
|
18188
18019
|
new Map(Object.entries(attrs)),
|
|
18189
18020
|
ticket
|
|
18190
18021
|
)
|
|
@@ -18719,17 +18550,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18719
18550
|
const [fromPos, toPos] = this.tree.pathToPosRange(path);
|
|
18720
18551
|
const ticket = this.context.issueTimeTicket();
|
|
18721
18552
|
const attrs = attributes ? stringifyObjectValues(attributes) : void 0;
|
|
18722
|
-
const [
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18726
|
-
);
|
|
18553
|
+
const [pairs] = this.tree.style([fromPos, toPos], attrs, ticket);
|
|
18554
|
+
for (const pair of pairs) {
|
|
18555
|
+
this.context.registerGCPair(pair);
|
|
18556
|
+
}
|
|
18727
18557
|
this.context.push(
|
|
18728
18558
|
TreeStyleOperation.create(
|
|
18729
18559
|
this.tree.getCreatedAt(),
|
|
18730
18560
|
fromPos,
|
|
18731
18561
|
toPos,
|
|
18732
|
-
maxCreationMapByActor,
|
|
18733
18562
|
attrs ? new Map(Object.entries(attrs)) : /* @__PURE__ */ new Map(),
|
|
18734
18563
|
ticket
|
|
18735
18564
|
)
|
|
@@ -18755,11 +18584,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18755
18584
|
const toPos = this.tree.findPos(toIdx);
|
|
18756
18585
|
const ticket = this.context.issueTimeTicket();
|
|
18757
18586
|
const attrs = attributes ? stringifyObjectValues(attributes) : void 0;
|
|
18758
|
-
const [
|
|
18759
|
-
[fromPos, toPos],
|
|
18760
|
-
attrs,
|
|
18761
|
-
ticket
|
|
18762
|
-
);
|
|
18587
|
+
const [pairs] = this.tree.style([fromPos, toPos], attrs, ticket);
|
|
18763
18588
|
for (const pair of pairs) {
|
|
18764
18589
|
this.context.registerGCPair(pair);
|
|
18765
18590
|
}
|
|
@@ -18768,7 +18593,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18768
18593
|
this.tree.getCreatedAt(),
|
|
18769
18594
|
fromPos,
|
|
18770
18595
|
toPos,
|
|
18771
|
-
maxCreationMapByActor,
|
|
18772
18596
|
attrs ? new Map(Object.entries(attrs)) : /* @__PURE__ */ new Map(),
|
|
18773
18597
|
ticket
|
|
18774
18598
|
)
|
|
@@ -18793,7 +18617,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18793
18617
|
const fromPos = this.tree.findPos(fromIdx);
|
|
18794
18618
|
const toPos = this.tree.findPos(toIdx);
|
|
18795
18619
|
const ticket = this.context.issueTimeTicket();
|
|
18796
|
-
const [
|
|
18620
|
+
const [pairs] = this.tree.removeStyle(
|
|
18797
18621
|
[fromPos, toPos],
|
|
18798
18622
|
attributesToRemove,
|
|
18799
18623
|
ticket
|
|
@@ -18806,7 +18630,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18806
18630
|
this.tree.getCreatedAt(),
|
|
18807
18631
|
fromPos,
|
|
18808
18632
|
toPos,
|
|
18809
|
-
maxCreationMapByActor,
|
|
18810
18633
|
attributesToRemove,
|
|
18811
18634
|
ticket
|
|
18812
18635
|
)
|
|
@@ -18841,7 +18664,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18841
18664
|
} else {
|
|
18842
18665
|
crdtNodes = contents.map((content) => content && createCRDTTreeNode(this.context, content)).filter((a) => a);
|
|
18843
18666
|
}
|
|
18844
|
-
const [, pairs
|
|
18667
|
+
const [, pairs] = this.tree.edit(
|
|
18845
18668
|
[fromPos, toPos],
|
|
18846
18669
|
crdtNodes.length ? crdtNodes.map((crdtNode) => crdtNode == null ? void 0 : crdtNode.deepcopy()) : void 0,
|
|
18847
18670
|
splitLevel,
|
|
@@ -18858,7 +18681,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
18858
18681
|
toPos,
|
|
18859
18682
|
crdtNodes.length ? crdtNodes : void 0,
|
|
18860
18683
|
splitLevel,
|
|
18861
|
-
maxCreatedAtMapByActor,
|
|
18862
18684
|
ticket
|
|
18863
18685
|
)
|
|
18864
18686
|
);
|
|
@@ -20598,7 +20420,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
20598
20420
|
};
|
|
20599
20421
|
}
|
|
20600
20422
|
const name = "@yorkie-js/sdk";
|
|
20601
|
-
const version = "0.6.
|
|
20423
|
+
const version = "0.6.10";
|
|
20602
20424
|
const pkg = {
|
|
20603
20425
|
name,
|
|
20604
20426
|
version
|