@fluidframework/sequence 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.204906
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 +95 -0
- package/README.md +130 -0
- package/api-extractor.json +1 -1
- package/api-report/sequence.api.md +717 -0
- package/dist/defaultMap.d.ts +1 -1
- package/dist/defaultMap.d.ts.map +1 -1
- package/dist/defaultMap.js +6 -6
- package/dist/defaultMap.js.map +1 -1
- package/dist/defaultMapInterfaces.d.ts +22 -2
- package/dist/defaultMapInterfaces.d.ts.map +1 -1
- package/dist/defaultMapInterfaces.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +164 -16
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +174 -54
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.d.ts +17 -3
- package/dist/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.js +12 -6
- package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/dist/intervalIndex/endpointIndex.d.ts +19 -2
- package/dist/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointIndex.js +10 -5
- package/dist/intervalIndex/endpointIndex.js.map +1 -1
- package/dist/intervalIndex/idIntervalIndex.d.ts +6 -0
- package/dist/intervalIndex/idIntervalIndex.d.ts.map +1 -1
- package/dist/intervalIndex/idIntervalIndex.js +3 -0
- package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
- package/dist/intervalIndex/index.d.ts +4 -4
- package/dist/intervalIndex/index.d.ts.map +1 -1
- package/dist/intervalIndex/index.js +5 -1
- package/dist/intervalIndex/index.js.map +1 -1
- package/dist/intervalIndex/intervalIndex.d.ts +1 -0
- package/dist/intervalIndex/intervalIndex.d.ts.map +1 -1
- package/dist/intervalIndex/intervalIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +17 -6
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js +17 -4
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +5 -2
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js +9 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +2 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.d.ts +17 -3
- package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.js +12 -8
- package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/dist/intervalTree.d.ts +1 -1
- package/dist/intervalTree.d.ts.map +1 -1
- package/dist/intervals/interval.d.ts +4 -2
- package/dist/intervals/interval.d.ts.map +1 -1
- package/dist/intervals/interval.js +14 -5
- package/dist/intervals/interval.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +51 -18
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js +18 -10
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +28 -13
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +124 -43
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/localValues.d.ts.map +1 -1
- package/dist/localValues.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/revertibles.d.ts +3 -15
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +11 -19
- package/dist/revertibles.js.map +1 -1
- package/dist/sequence-alpha.d.ts +1587 -0
- package/dist/sequence-beta.d.ts +1507 -0
- package/dist/sequence-public.d.ts +1507 -0
- package/dist/sequence-untrimmed.d.ts +1759 -0
- package/dist/sequence.d.ts +8 -4
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +53 -48
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.d.ts +4 -0
- package/dist/sequenceDeltaEvent.d.ts.map +1 -1
- package/dist/sequenceDeltaEvent.js +3 -0
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sequenceFactory.d.ts +3 -0
- package/dist/sequenceFactory.d.ts.map +1 -1
- package/dist/sequenceFactory.js +4 -1
- package/dist/sequenceFactory.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts +5 -0
- package/dist/sharedIntervalCollection.d.ts.map +1 -1
- package/dist/sharedIntervalCollection.js +11 -9
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedSequence.d.ts +6 -3
- package/dist/sharedSequence.d.ts.map +1 -1
- package/dist/sharedSequence.js +10 -8
- package/dist/sharedSequence.js.map +1 -1
- package/dist/sharedString.d.ts +17 -2
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +21 -7
- package/dist/sharedString.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/defaultMap.d.ts +1 -1
- package/lib/defaultMap.d.ts.map +1 -1
- package/lib/defaultMap.js +6 -6
- package/lib/defaultMap.js.map +1 -1
- package/lib/defaultMapInterfaces.d.ts +22 -2
- package/lib/defaultMapInterfaces.d.ts.map +1 -1
- package/lib/defaultMapInterfaces.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +164 -16
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +172 -55
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.d.ts +17 -3
- package/lib/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.js +12 -7
- package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/lib/intervalIndex/endpointIndex.d.ts +19 -2
- package/lib/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointIndex.js +10 -6
- package/lib/intervalIndex/endpointIndex.js.map +1 -1
- package/lib/intervalIndex/idIntervalIndex.d.ts +6 -0
- package/lib/intervalIndex/idIntervalIndex.d.ts.map +1 -1
- package/lib/intervalIndex/idIntervalIndex.js +3 -0
- package/lib/intervalIndex/idIntervalIndex.js.map +1 -1
- package/lib/intervalIndex/index.d.ts +4 -4
- package/lib/intervalIndex/index.d.ts.map +1 -1
- package/lib/intervalIndex/index.js +4 -4
- package/lib/intervalIndex/index.js.map +1 -1
- package/lib/intervalIndex/intervalIndex.d.ts +1 -0
- package/lib/intervalIndex/intervalIndex.d.ts.map +1 -1
- package/lib/intervalIndex/intervalIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +17 -6
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.js +18 -5
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +5 -2
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js +9 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts +2 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.d.ts +17 -3
- package/lib/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.js +12 -9
- package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/lib/intervalTree.d.ts +1 -1
- package/lib/intervalTree.d.ts.map +1 -1
- package/lib/intervals/interval.d.ts +4 -2
- package/lib/intervals/interval.d.ts.map +1 -1
- package/lib/intervals/interval.js +14 -5
- package/lib/intervals/interval.js.map +1 -1
- package/lib/intervals/intervalUtils.d.ts +51 -18
- package/lib/intervals/intervalUtils.d.ts.map +1 -1
- package/lib/intervals/intervalUtils.js +14 -6
- package/lib/intervals/intervalUtils.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +28 -13
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +125 -42
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/localValues.d.ts.map +1 -1
- package/lib/localValues.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/revertibles.d.ts +3 -15
- package/lib/revertibles.d.ts.map +1 -1
- package/lib/revertibles.js +11 -19
- package/lib/revertibles.js.map +1 -1
- package/lib/sequence.d.ts +8 -4
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +56 -49
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.d.ts +4 -0
- package/lib/sequenceDeltaEvent.d.ts.map +1 -1
- package/lib/sequenceDeltaEvent.js +3 -0
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sequenceFactory.d.ts +3 -0
- package/lib/sequenceFactory.d.ts.map +1 -1
- package/lib/sequenceFactory.js +4 -1
- package/lib/sequenceFactory.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts +5 -0
- package/lib/sharedIntervalCollection.d.ts.map +1 -1
- package/lib/sharedIntervalCollection.js +11 -9
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedSequence.d.ts +6 -3
- package/lib/sharedSequence.d.ts.map +1 -1
- package/lib/sharedSequence.js +10 -8
- package/lib/sharedSequence.js.map +1 -1
- package/lib/sharedString.d.ts +17 -2
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +21 -7
- package/lib/sharedString.js.map +1 -1
- package/package.json +31 -30
- package/src/defaultMapInterfaces.ts +22 -2
- package/src/index.ts +4 -1
- package/src/intervalCollection.ts +423 -82
- package/src/intervalIndex/endpointInRangeIndex.ts +23 -11
- package/src/intervalIndex/endpointIndex.ts +22 -9
- package/src/intervalIndex/idIntervalIndex.ts +7 -1
- package/src/intervalIndex/index.ts +12 -3
- package/src/intervalIndex/intervalIndex.ts +1 -0
- package/src/intervalIndex/overlappingIntervalsIndex.ts +40 -15
- package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +10 -1
- package/src/intervalIndex/sequenceIntervalIndexes.ts +2 -1
- package/src/intervalIndex/startpointInRangeIndex.ts +23 -18
- package/src/intervals/interval.ts +35 -8
- package/src/intervals/intervalUtils.ts +61 -27
- package/src/intervals/sequenceInterval.ts +197 -47
- package/src/localValues.ts +4 -1
- package/src/packageVersion.ts +1 -1
- package/src/revertibles.ts +14 -36
- package/src/sequence.ts +14 -5
- package/src/sequenceDeltaEvent.ts +4 -0
- package/src/sequenceFactory.ts +4 -1
- package/src/sharedIntervalCollection.ts +5 -0
- package/src/sharedSequence.ts +6 -3
- package/src/sharedString.ts +25 -2
|
@@ -4,21 +4,44 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.sequenceIntervalHelpers = exports.
|
|
7
|
+
exports.sequenceIntervalHelpers = exports.createSequenceInterval = exports.createPositionReferenceFromSegoff = exports.SequenceInterval = void 0;
|
|
8
8
|
/* eslint-disable no-bitwise */
|
|
9
|
+
/* eslint-disable import/no-deprecated */
|
|
9
10
|
const merge_tree_1 = require("@fluidframework/merge-tree");
|
|
10
11
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
11
12
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
13
|
+
const intervalCollection_1 = require("../intervalCollection");
|
|
12
14
|
const intervalUtils_1 = require("./intervalUtils");
|
|
13
15
|
const reservedIntervalIdKey = "intervalId";
|
|
16
|
+
function compareSides(sideA, sideB) {
|
|
17
|
+
if (sideA === sideB) {
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
if (sideA === intervalCollection_1.Side.Before) {
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
23
|
+
return -1;
|
|
24
|
+
}
|
|
25
|
+
function minSide(sideA, sideB) {
|
|
26
|
+
if (sideA === intervalCollection_1.Side.After && sideB === intervalCollection_1.Side.After) {
|
|
27
|
+
return intervalCollection_1.Side.After;
|
|
28
|
+
}
|
|
29
|
+
return intervalCollection_1.Side.Before;
|
|
30
|
+
}
|
|
31
|
+
function maxSide(sideA, sideB) {
|
|
32
|
+
if (sideA === intervalCollection_1.Side.Before && sideB === intervalCollection_1.Side.Before) {
|
|
33
|
+
return intervalCollection_1.Side.Before;
|
|
34
|
+
}
|
|
35
|
+
return intervalCollection_1.Side.After;
|
|
36
|
+
}
|
|
14
37
|
/**
|
|
15
38
|
* Interval implementation whose ends are associated with positions in a mutatable sequence.
|
|
16
39
|
* As such, when content is inserted into the middle of the interval, the interval expands to
|
|
17
40
|
* include that content.
|
|
18
41
|
*
|
|
19
|
-
* @remarks The
|
|
20
|
-
* an interval referring to "hello" in "hello world"
|
|
21
|
-
* position of 5.
|
|
42
|
+
* @remarks The endpoints' positions should be treated exclusively to get
|
|
43
|
+
* reasonable behavior. E.g., an interval referring to "hello" in "hello world"
|
|
44
|
+
* should have a start position of 0 and an end position of 5.
|
|
22
45
|
*
|
|
23
46
|
* To see why, consider what happens if "llo wor" is removed from the string to make "held".
|
|
24
47
|
* The interval's startpoint remains on the "h" (it isn't altered), but the interval's endpoint
|
|
@@ -28,11 +51,26 @@ const reservedIntervalIdKey = "intervalId";
|
|
|
28
51
|
* If the interval endpoint was treated inclusively, the interval would now refer to "hel", which
|
|
29
52
|
* is undesirable.
|
|
30
53
|
*
|
|
31
|
-
* Since the
|
|
32
|
-
* length of the associated sequence,
|
|
33
|
-
*
|
|
54
|
+
* Since the endpoints of an interval are treated exclusively but cannot be greater
|
|
55
|
+
* than or equal to the length of the associated sequence, there exist special
|
|
56
|
+
* endpoint segments, "start" and "end", which represent the position immediately
|
|
57
|
+
* before or immediately after the string respectively.
|
|
58
|
+
*
|
|
59
|
+
* If a `SequenceInterval` is created on a sequence with the
|
|
60
|
+
* `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints
|
|
61
|
+
* of the interval that are exclusive will have the ability to slide to these
|
|
62
|
+
* special endpoint segments.
|
|
63
|
+
* @public
|
|
34
64
|
*/
|
|
35
65
|
class SequenceInterval {
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
get stickiness() {
|
|
70
|
+
const startSegment = this.start.getSegment();
|
|
71
|
+
const endSegment = this.end.getSegment();
|
|
72
|
+
return (0, intervalCollection_1.computeStickinessFromSide)(startSegment?.endpointType, this.startSide, endSegment?.endpointType, this.endSide);
|
|
73
|
+
}
|
|
36
74
|
constructor(client,
|
|
37
75
|
/**
|
|
38
76
|
* Start endpoint of this interval.
|
|
@@ -43,12 +81,13 @@ class SequenceInterval {
|
|
|
43
81
|
* End endpoint of this interval.
|
|
44
82
|
* @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.
|
|
45
83
|
*/
|
|
46
|
-
end, intervalType, props,
|
|
84
|
+
end, intervalType, props, startSide = intervalCollection_1.Side.Before, endSide = intervalCollection_1.Side.Before) {
|
|
47
85
|
this.client = client;
|
|
48
86
|
this.start = start;
|
|
49
87
|
this.end = end;
|
|
50
88
|
this.intervalType = intervalType;
|
|
51
|
-
this.
|
|
89
|
+
this.startSide = startSide;
|
|
90
|
+
this.endSide = endSide;
|
|
52
91
|
this.propertyManager = new merge_tree_1.PropertiesManager();
|
|
53
92
|
this.properties = {};
|
|
54
93
|
if (props) {
|
|
@@ -90,25 +129,26 @@ class SequenceInterval {
|
|
|
90
129
|
serialize() {
|
|
91
130
|
const startPosition = this.client.localReferencePositionToPosition(this.start);
|
|
92
131
|
const endPosition = this.client.localReferencePositionToPosition(this.end);
|
|
132
|
+
const { startSide, endSide } = (0, intervalCollection_1.sidesFromStickiness)(this.stickiness);
|
|
93
133
|
const serializedInterval = {
|
|
94
134
|
end: endPosition,
|
|
95
135
|
intervalType: this.intervalType,
|
|
96
136
|
sequenceNumber: this.client.getCurrentSeq(),
|
|
97
137
|
start: startPosition,
|
|
138
|
+
stickiness: this.stickiness,
|
|
139
|
+
startSide,
|
|
140
|
+
endSide,
|
|
98
141
|
};
|
|
99
142
|
if (this.properties) {
|
|
100
143
|
serializedInterval.properties = this.properties;
|
|
101
144
|
}
|
|
102
|
-
if (this.stickiness !== intervalUtils_1.IntervalStickiness.END) {
|
|
103
|
-
serializedInterval.stickiness = this.stickiness;
|
|
104
|
-
}
|
|
105
145
|
return serializedInterval;
|
|
106
146
|
}
|
|
107
147
|
/**
|
|
108
148
|
* {@inheritDoc IInterval.clone}
|
|
109
149
|
*/
|
|
110
150
|
clone() {
|
|
111
|
-
return new SequenceInterval(this.client, this.start, this.end, this.intervalType, this.properties, this.
|
|
151
|
+
return new SequenceInterval(this.client, this.start, this.end, this.intervalType, this.properties, this.startSide, this.endSide);
|
|
112
152
|
}
|
|
113
153
|
/**
|
|
114
154
|
* {@inheritDoc IInterval.compare}
|
|
@@ -140,13 +180,21 @@ class SequenceInterval {
|
|
|
140
180
|
* {@inheritDoc IInterval.compareStart}
|
|
141
181
|
*/
|
|
142
182
|
compareStart(b) {
|
|
143
|
-
|
|
183
|
+
const dist = (0, merge_tree_1.compareReferencePositions)(this.start, b.start);
|
|
184
|
+
if (dist === 0) {
|
|
185
|
+
return compareSides(this.startSide, b.startSide);
|
|
186
|
+
}
|
|
187
|
+
return dist;
|
|
144
188
|
}
|
|
145
189
|
/**
|
|
146
190
|
* {@inheritDoc IInterval.compareEnd}
|
|
147
191
|
*/
|
|
148
192
|
compareEnd(b) {
|
|
149
|
-
|
|
193
|
+
const dist = (0, merge_tree_1.compareReferencePositions)(this.end, b.end);
|
|
194
|
+
if (dist === 0) {
|
|
195
|
+
return compareSides(b.endSide, this.endSide);
|
|
196
|
+
}
|
|
197
|
+
return dist;
|
|
150
198
|
}
|
|
151
199
|
/**
|
|
152
200
|
* {@inheritDoc IInterval.overlaps}
|
|
@@ -169,7 +217,23 @@ class SequenceInterval {
|
|
|
169
217
|
* @internal
|
|
170
218
|
*/
|
|
171
219
|
union(b) {
|
|
172
|
-
|
|
220
|
+
const newStart = (0, merge_tree_1.minReferencePosition)(this.start, b.start);
|
|
221
|
+
const newEnd = (0, merge_tree_1.maxReferencePosition)(this.end, b.end);
|
|
222
|
+
let startSide;
|
|
223
|
+
if (this.start === b.start) {
|
|
224
|
+
startSide = minSide(this.startSide, b.startSide);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
startSide = this.start === newStart ? this.startSide : b.startSide;
|
|
228
|
+
}
|
|
229
|
+
let endSide;
|
|
230
|
+
if (this.end === b.end) {
|
|
231
|
+
endSide = maxSide(this.endSide, b.endSide);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
endSide = this.end === newEnd ? this.endSide : b.endSide;
|
|
235
|
+
}
|
|
236
|
+
return new SequenceInterval(this.client, newStart, newEnd, this.intervalType, undefined, startSide, endSide);
|
|
173
237
|
}
|
|
174
238
|
/**
|
|
175
239
|
* {@inheritDoc ISerializableInterval.addProperties}
|
|
@@ -191,7 +255,9 @@ class SequenceInterval {
|
|
|
191
255
|
* {@inheritDoc IInterval.modify}
|
|
192
256
|
* @internal
|
|
193
257
|
*/
|
|
194
|
-
modify(label, start, end, op, localSeq,
|
|
258
|
+
modify(label, start, end, op, localSeq, useNewSlidingBehavior = false) {
|
|
259
|
+
const { startSide, endSide, startPos, endPos } = (0, intervalCollection_1.endpointPosAndSide)(start, end);
|
|
260
|
+
const stickiness = (0, intervalCollection_1.computeStickinessFromSide)(startPos ?? this.start.getSegment()?.endpointType, startSide ?? this.startSide, endPos ?? this.end.getSegment()?.endpointType, endSide ?? this.endSide);
|
|
195
261
|
const getRefType = (baseType) => {
|
|
196
262
|
let refType = baseType;
|
|
197
263
|
if (op === undefined) {
|
|
@@ -201,20 +267,20 @@ class SequenceInterval {
|
|
|
201
267
|
return refType;
|
|
202
268
|
};
|
|
203
269
|
let startRef = this.start;
|
|
204
|
-
if (
|
|
205
|
-
startRef = createPositionReference(this.client,
|
|
270
|
+
if (startPos !== undefined) {
|
|
271
|
+
startRef = createPositionReference(this.client, startPos, getRefType(this.start.refType), op, undefined, localSeq, (0, intervalUtils_1.startReferenceSlidingPreference)(stickiness), (0, intervalUtils_1.startReferenceSlidingPreference)(stickiness) === merge_tree_1.SlidingPreference.BACKWARD, useNewSlidingBehavior);
|
|
206
272
|
if (this.start.properties) {
|
|
207
273
|
startRef.addProperties(this.start.properties);
|
|
208
274
|
}
|
|
209
275
|
}
|
|
210
276
|
let endRef = this.end;
|
|
211
|
-
if (
|
|
212
|
-
endRef = createPositionReference(this.client,
|
|
277
|
+
if (endPos !== undefined) {
|
|
278
|
+
endRef = createPositionReference(this.client, endPos, getRefType(this.end.refType), op, undefined, localSeq, (0, intervalUtils_1.endReferenceSlidingPreference)(stickiness), (0, intervalUtils_1.endReferenceSlidingPreference)(stickiness) === merge_tree_1.SlidingPreference.FORWARD, useNewSlidingBehavior);
|
|
213
279
|
if (this.end.properties) {
|
|
214
280
|
endRef.addProperties(this.end.properties);
|
|
215
281
|
}
|
|
216
282
|
}
|
|
217
|
-
const newInterval = new SequenceInterval(this.client, startRef, endRef, this.intervalType);
|
|
283
|
+
const newInterval = new SequenceInterval(this.client, startRef, endRef, this.intervalType, undefined, startSide ?? this.startSide, endSide ?? this.endSide);
|
|
218
284
|
if (this.properties) {
|
|
219
285
|
newInterval.initializeProperties();
|
|
220
286
|
this.propertyManager.copyTo(this.properties, newInterval.properties, newInterval.propertyManager);
|
|
@@ -231,9 +297,12 @@ class SequenceInterval {
|
|
|
231
297
|
}
|
|
232
298
|
}
|
|
233
299
|
exports.SequenceInterval = SequenceInterval;
|
|
234
|
-
function createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference) {
|
|
300
|
+
function createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, canSlideToEndpoint) {
|
|
301
|
+
if (segoff === "start" || segoff === "end") {
|
|
302
|
+
return client.createLocalReferencePosition(segoff, undefined, refType, undefined, slidingPreference, canSlideToEndpoint);
|
|
303
|
+
}
|
|
235
304
|
if (segoff.segment) {
|
|
236
|
-
const ref = client.createLocalReferencePosition(segoff.segment, segoff.offset, refType, undefined, slidingPreference);
|
|
305
|
+
const ref = client.createLocalReferencePosition(segoff.segment, segoff.offset, refType, undefined, slidingPreference, canSlideToEndpoint);
|
|
237
306
|
return ref;
|
|
238
307
|
}
|
|
239
308
|
// Creating references on detached segments is allowed for:
|
|
@@ -250,23 +319,37 @@ function createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq
|
|
|
250
319
|
return (0, merge_tree_1.createDetachedLocalReferencePosition)(refType);
|
|
251
320
|
}
|
|
252
321
|
exports.createPositionReferenceFromSegoff = createPositionReferenceFromSegoff;
|
|
253
|
-
function createPositionReference(client, pos, refType, op, fromSnapshot, localSeq, slidingPreference) {
|
|
322
|
+
function createPositionReference(client, pos, refType, op, fromSnapshot, localSeq, slidingPreference, exclusive = false, useNewSlidingBehavior = false) {
|
|
254
323
|
let segoff;
|
|
255
324
|
if (op) {
|
|
256
325
|
(0, core_utils_1.assert)((refType & merge_tree_1.ReferenceType.SlideOnRemove) !== 0, 0x2f5 /* op create references must be SlideOnRemove */);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
326
|
+
if (pos === "start" || pos === "end") {
|
|
327
|
+
segoff = pos;
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
segoff = client.getContainingSegment(pos, {
|
|
331
|
+
referenceSequenceNumber: op.referenceSequenceNumber,
|
|
332
|
+
clientId: op.clientId,
|
|
333
|
+
});
|
|
334
|
+
segoff = (0, merge_tree_1.getSlideToSegoff)(segoff, undefined, useNewSlidingBehavior);
|
|
335
|
+
}
|
|
262
336
|
}
|
|
263
337
|
else {
|
|
264
338
|
(0, core_utils_1.assert)((refType & merge_tree_1.ReferenceType.SlideOnRemove) === 0 || !!fromSnapshot, 0x2f6 /* SlideOnRemove references must be op created */);
|
|
265
|
-
segoff =
|
|
339
|
+
segoff =
|
|
340
|
+
pos === "start" || pos === "end"
|
|
341
|
+
? pos
|
|
342
|
+
: client.getContainingSegment(pos, undefined, localSeq);
|
|
266
343
|
}
|
|
267
|
-
return createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference);
|
|
344
|
+
return createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, exclusive);
|
|
268
345
|
}
|
|
269
|
-
function createSequenceInterval(label, start, end, client, intervalType, op, fromSnapshot,
|
|
346
|
+
function createSequenceInterval(label, start, end, client, intervalType, op, fromSnapshot, useNewSlidingBehavior = false) {
|
|
347
|
+
const { startPos, startSide, endPos, endSide } = (0, intervalCollection_1.endpointPosAndSide)(start ?? "start", end ?? "end");
|
|
348
|
+
(0, core_utils_1.assert)(startPos !== undefined &&
|
|
349
|
+
endPos !== undefined &&
|
|
350
|
+
startSide !== undefined &&
|
|
351
|
+
endSide !== undefined, 0x794 /* start and end cannot be undefined because they were not passed in as undefined */);
|
|
352
|
+
const stickiness = (0, intervalCollection_1.computeStickinessFromSide)(startPos, startSide, endPos, endSide);
|
|
270
353
|
let beginRefType = merge_tree_1.ReferenceType.RangeBegin;
|
|
271
354
|
let endRefType = merge_tree_1.ReferenceType.RangeEnd;
|
|
272
355
|
if (intervalType === intervalUtils_1.IntervalType.Transient) {
|
|
@@ -281,7 +364,7 @@ function createSequenceInterval(label, start, end, client, intervalType, op, fro
|
|
|
281
364
|
// All non-transient interval references must eventually be SlideOnRemove
|
|
282
365
|
// To ensure eventual consistency, they must start as StayOnRemove when
|
|
283
366
|
// pending (created locally and creation op is not acked)
|
|
284
|
-
if (op
|
|
367
|
+
if (op ?? fromSnapshot) {
|
|
285
368
|
beginRefType |= merge_tree_1.ReferenceType.SlideOnRemove;
|
|
286
369
|
endRefType |= merge_tree_1.ReferenceType.SlideOnRemove;
|
|
287
370
|
}
|
|
@@ -290,24 +373,22 @@ function createSequenceInterval(label, start, end, client, intervalType, op, fro
|
|
|
290
373
|
endRefType |= merge_tree_1.ReferenceType.StayOnRemove;
|
|
291
374
|
}
|
|
292
375
|
}
|
|
293
|
-
const startLref = createPositionReference(client,
|
|
294
|
-
const endLref = createPositionReference(client,
|
|
376
|
+
const startLref = createPositionReference(client, startPos, beginRefType, op, fromSnapshot, undefined, (0, intervalUtils_1.startReferenceSlidingPreference)(stickiness), (0, intervalUtils_1.startReferenceSlidingPreference)(stickiness) === merge_tree_1.SlidingPreference.BACKWARD, useNewSlidingBehavior);
|
|
377
|
+
const endLref = createPositionReference(client, endPos, endRefType, op, fromSnapshot, undefined, (0, intervalUtils_1.endReferenceSlidingPreference)(stickiness), (0, intervalUtils_1.endReferenceSlidingPreference)(stickiness) === merge_tree_1.SlidingPreference.FORWARD, useNewSlidingBehavior);
|
|
295
378
|
const rangeProp = {
|
|
296
379
|
[merge_tree_1.reservedRangeLabelsKey]: [label],
|
|
297
380
|
};
|
|
298
381
|
startLref.addProperties(rangeProp);
|
|
299
382
|
endLref.addProperties(rangeProp);
|
|
300
|
-
const ival = new SequenceInterval(client, startLref, endLref, intervalType, rangeProp,
|
|
383
|
+
const ival = new SequenceInterval(client, startLref, endLref, intervalType, rangeProp, startSide, endSide);
|
|
301
384
|
return ival;
|
|
302
385
|
}
|
|
303
386
|
exports.createSequenceInterval = createSequenceInterval;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
387
|
+
/**
|
|
388
|
+
* @deprecated The methods within have substitutions
|
|
389
|
+
* @public
|
|
390
|
+
*/
|
|
308
391
|
exports.sequenceIntervalHelpers = {
|
|
309
|
-
compareEnds: exports.compareSequenceIntervalEnds,
|
|
310
|
-
compareStarts: exports.compareSequenceIntervalStarts,
|
|
311
392
|
create: createSequenceInterval,
|
|
312
393
|
};
|
|
313
394
|
//# sourceMappingURL=sequenceInterval.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAE/B,2DAiBoC;AACpC,2DAAoD;AAEpD,qEAA6D;AAC7D,mDAQyB;AAEzB,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,gBAAgB;IAW5B,YACkB,MAAc;IAC/B;;;OAGG;IACI,KAA6B;IACpC;;;OAGG;IACI,GAA2B,EAC3B,YAA0B,EACjC,KAAmB,EACH,aAAiC,kCAAkB,CAAC,GAAG;QAbtD,WAAM,GAAN,MAAM,CAAQ;QAKxB,UAAK,GAAL,KAAK,CAAwB;QAK7B,QAAG,GAAH,GAAG,CAAwB;QAC3B,iBAAY,GAAZ,YAAY,CAAc;QAEjB,eAAU,GAAV,UAAU,CAA6C;QAEvE,IAAI,CAAC,eAAe,GAAG,IAAI,8BAAiB,EAAE,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB,IAAI,KAAK,EAAE;YACV,IA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O,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAEjC,MAAM,IAAI,GAAG,IAAI,gBAAgB,CAChC,MAAM,EACN,SAAS,EACT,OAAO,EACP,YAAY,EACZ,SAAS,EACT,UAAU,CACV,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC;AAnED,wDAmEC;AAEM,MAAM,2BAA2B,GAAG,CAAC,CAAmB,EAAE,CAAmB,EAAU,EAAE,CAC/F,IAAA,sCAAyB,EAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;AAD5B,QAAA,2BAA2B,+BACC;AAElC,MAAM,6BAA6B,GAAG,CAAC,CAAmB,EAAE,CAAmB,EAAU,EAAE,CACjG,IAAA,sCAAyB,EAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AADhC,QAAA,6BAA6B,iCACG;AAEhC,QAAA,uBAAuB,GAAuC;IAC1E,WAAW,EAAE,mCAA2B;IACxC,aAAa,EAAE,qCAA6B;IAC5C,MAAM,EAAE,sBAAsB;CAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport {\n\tClient,\n\tICombiningOp,\n\tISegment,\n\tLocalReferencePosition,\n\tPropertiesManager,\n\tPropertySet,\n\tReferenceType,\n\tSlidingPreference,\n\tcompareReferencePositions,\n\tcreateDetachedLocalReferencePosition,\n\tcreateMap,\n\tgetSlideToSegoff,\n\tmaxReferencePosition,\n\tminReferencePosition,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n} from \"@fluidframework/merge-tree\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tIIntervalHelpers,\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n} from \"./intervalUtils\";\n\nconst reservedIntervalIdKey = \"intervalId\";\n\n/**\n * Interval implementation whose ends are associated with positions in a mutatable sequence.\n * As such, when content is inserted into the middle of the interval, the interval expands to\n * include that content.\n *\n * @remarks The endpoint's position should be treated exclusively to get reasonable behavior--i.e.\n * an interval referring to \"hello\" in \"hello world\" should have a start position of 0 and an end\n * position of 5.\n *\n * To see why, consider what happens if \"llo wor\" is removed from the string to make \"held\".\n * The interval's startpoint remains on the \"h\" (it isn't altered), but the interval's endpoint\n * slides forward to the next unremoved position, which is the \"l\" in \"held\".\n * Users would generally expect the interval to now refer to \"he\" (as it is the subset of content\n * remaining after the removal), hence the \"l\" should be excluded.\n * If the interval endpoint was treated inclusively, the interval would now refer to \"hel\", which\n * is undesirable.\n *\n * Since the end of an interval is treated exclusively but cannot be greater than or equal to the\n * length of the associated sequence, application models which leverage interval collections should\n * consider inserting a marker at the end of the sequence to represent the end of the content.\n */\nexport class SequenceInterval implements ISerializableInterval {\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic properties: PropertySet;\n\t/**\n\t * {@inheritDoc ISerializableInterval.propertyManager}\n\t * @internal\n\t */\n\tpublic propertyManager: PropertiesManager;\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\t/**\n\t\t * Start endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic start: LocalReferencePosition,\n\t\t/**\n\t\t * End endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic end: LocalReferencePosition,\n\t\tpublic intervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tpublic readonly stickiness: IntervalStickiness = IntervalStickiness.END,\n\t) {\n\t\tthis.propertyManager = new PropertiesManager();\n\t\tthis.properties = {};\n\n\t\tif (props) {\n\t\t\tthis.addProperties(props);\n\t\t}\n\t}\n\n\tprivate callbacks?: Record<\"beforePositionChange\" | \"afterPositionChange\", () => void>;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t * @internal\n\t */\n\tpublic addPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void {\n\t\tif (this.callbacks === undefined) {\n\t\t\tthis.callbacks = {\n\t\t\t\tbeforePositionChange,\n\t\t\t\tafterPositionChange,\n\t\t\t};\n\n\t\t\tconst startCbs = (this.start.callbacks ??= {});\n\t\t\tconst endCbs = (this.end.callbacks ??= {});\n\t\t\tstartCbs.beforeSlide = endCbs.beforeSlide = beforePositionChange;\n\t\t\tstartCbs.afterSlide = endCbs.afterSlide = afterPositionChange;\n\t\t}\n\t}\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t * @internal\n\t */\n\tpublic removePositionChangeListeners(): void {\n\t\tif (this.callbacks) {\n\t\t\tthis.callbacks = undefined;\n\t\t\tthis.start.callbacks = undefined;\n\t\t\tthis.end.callbacks = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t * @internal\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\tconst startPosition = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPosition = this.client.localReferencePositionToPosition(this.end);\n\t\tconst serializedInterval: ISerializedInterval = {\n\t\t\tend: endPosition,\n\t\t\tintervalType: this.intervalType,\n\t\t\tsequenceNumber: this.client.getCurrentSeq(),\n\t\t\tstart: startPosition,\n\t\t};\n\n\t\tif (this.properties) {\n\t\t\tserializedInterval.properties = this.properties;\n\t\t}\n\t\tif (this.stickiness !== IntervalStickiness.END) {\n\t\t\tserializedInterval.stickiness = this.stickiness;\n\t\t}\n\n\t\treturn serializedInterval;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone() {\n\t\treturn new SequenceInterval(\n\t\t\tthis.client,\n\t\t\tthis.start,\n\t\t\tthis.end,\n\t\t\tthis.intervalType,\n\t\t\tthis.properties,\n\t\t\tthis.stickiness,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: SequenceInterval) {\n\t\tconst startResult = this.compareStart(b);\n\t\tif (startResult === 0) {\n\t\t\tconst endResult = this.compareEnd(b);\n\t\t\tif (endResult === 0) {\n\t\t\t\tconst thisId = this.getIntervalId();\n\t\t\t\tif (thisId) {\n\t\t\t\t\tconst bId = b.getIntervalId();\n\t\t\t\t\tif (bId) {\n\t\t\t\t\t\treturn thisId > bId ? 1 : thisId < bId ? -1 : 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn endResult;\n\t\t\t}\n\t\t} else {\n\t\t\treturn startResult;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareStart}\n\t */\n\tpublic compareStart(b: SequenceInterval) {\n\t\treturn compareReferencePositions(this.start, b.start);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: SequenceInterval) {\n\t\treturn compareReferencePositions(this.end, b.end);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: SequenceInterval) {\n\t\tconst result =\n\t\t\tcompareReferencePositions(this.start, b.end) <= 0 &&\n\t\t\tcompareReferencePositions(this.end, b.start) >= 0;\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.getIntervalId}\n\t */\n\tpublic getIntervalId(): string {\n\t\tconst id = this.properties?.[reservedIntervalIdKey];\n\t\tassert(id !== undefined, 0x5e2 /* interval ID should not be undefined */);\n\t\treturn `${id}`;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t * @internal\n\t */\n\tpublic union(b: SequenceInterval) {\n\t\treturn new SequenceInterval(\n\t\t\tthis.client,\n\t\t\tminReferencePosition(this.start, b.start),\n\t\t\tmaxReferencePosition(this.end, b.end),\n\t\t\tthis.intervalType,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.addProperties}\n\t * @internal\n\t */\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tcollab: boolean = false,\n\t\tseq?: number,\n\t\top?: ICombiningOp,\n\t): PropertySet | undefined {\n\t\tthis.initializeProperties();\n\t\treturn this.propertyManager.addProperties(this.properties, newProps, op, seq, collab);\n\t}\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\tpublic overlapsPos(bstart: number, bend: number) {\n\t\tconst startPos = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPos = this.client.localReferencePositionToPosition(this.end);\n\t\treturn endPos > bstart && startPos < bend;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t * @internal\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart: number,\n\t\tend: number,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tstickiness: IntervalStickiness = IntervalStickiness.END,\n\t) {\n\t\tconst getRefType = (baseType: ReferenceType): ReferenceType => {\n\t\t\tlet refType = baseType;\n\t\t\tif (op === undefined) {\n\t\t\t\trefType &= ~ReferenceType.SlideOnRemove;\n\t\t\t\trefType |= ReferenceType.StayOnRemove;\n\t\t\t}\n\t\t\treturn refType;\n\t\t};\n\n\t\tlet startRef = this.start;\n\t\tif (start !== undefined) {\n\t\t\tstartRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tstart,\n\t\t\t\tgetRefType(this.start.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tstartReferenceSlidingPreference(stickiness),\n\t\t\t);\n\t\t\tif (this.start.properties) {\n\t\t\t\tstartRef.addProperties(this.start.properties);\n\t\t\t}\n\t\t}\n\n\t\tlet endRef = this.end;\n\t\tif (end !== undefined) {\n\t\t\tendRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tend,\n\t\t\t\tgetRefType(this.end.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tendReferenceSlidingPreference(stickiness),\n\t\t\t);\n\t\t\tif (this.end.properties) {\n\t\t\t\tendRef.addProperties(this.end.properties);\n\t\t\t}\n\t\t}\n\n\t\tconst newInterval = new SequenceInterval(this.client, startRef, endRef, this.intervalType);\n\t\tif (this.properties) {\n\t\t\tnewInterval.initializeProperties();\n\t\t\tthis.propertyManager.copyTo(\n\t\t\t\tthis.properties,\n\t\t\t\tnewInterval.properties,\n\t\t\t\tnewInterval.propertyManager,\n\t\t\t);\n\t\t}\n\t\treturn newInterval;\n\t}\n\n\tprivate initializeProperties(): void {\n\t\tif (!this.propertyManager) {\n\t\t\tthis.propertyManager = new PropertiesManager();\n\t\t}\n\t\tif (!this.properties) {\n\t\t\tthis.properties = createMap<any>();\n\t\t}\n\t}\n}\n\nexport function createPositionReferenceFromSegoff(\n\tclient: Client,\n\tsegoff: { segment: ISegment | undefined; offset: number | undefined },\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tlocalSeq?: number,\n\tfromSnapshot?: boolean,\n\tslidingPreference?: SlidingPreference,\n): LocalReferencePosition {\n\tif (segoff.segment) {\n\t\tconst ref = client.createLocalReferencePosition(\n\t\t\tsegoff.segment,\n\t\t\tsegoff.offset,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t);\n\t\treturn ref;\n\t}\n\n\t// Creating references on detached segments is allowed for:\n\t// - Transient segments\n\t// - References coming from a remote client (location may have been concurrently removed)\n\t// - References being rebased to a new sequence number\n\t// (segment they originally referred to may have been removed with no suitable replacement)\n\tif (\n\t\t!op &&\n\t\t!localSeq &&\n\t\t!fromSnapshot &&\n\t\t!refTypeIncludesFlag(refType, ReferenceType.Transient)\n\t) {\n\t\tthrow new UsageError(\"Non-transient references need segment\");\n\t}\n\n\treturn createDetachedLocalReferencePosition(refType);\n}\n\nfunction createPositionReference(\n\tclient: Client,\n\tpos: number,\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tlocalSeq?: number,\n\tslidingPreference?: SlidingPreference,\n): LocalReferencePosition {\n\tlet segoff;\n\tif (op) {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) !== 0,\n\t\t\t0x2f5 /* op create references must be SlideOnRemove */,\n\t\t);\n\t\tsegoff = client.getContainingSegment(pos, {\n\t\t\treferenceSequenceNumber: op.referenceSequenceNumber,\n\t\t\tclientId: op.clientId,\n\t\t});\n\t\tsegoff = getSlideToSegoff(segoff);\n\t} else {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) === 0 || !!fromSnapshot,\n\t\t\t0x2f6 /* SlideOnRemove references must be op created */,\n\t\t);\n\t\tsegoff = client.getContainingSegment(pos, undefined, localSeq);\n\t}\n\n\treturn createPositionReferenceFromSegoff(\n\t\tclient,\n\t\tsegoff,\n\t\trefType,\n\t\top,\n\t\tlocalSeq,\n\t\tfromSnapshot,\n\t\tslidingPreference,\n\t);\n}\n\nexport function createSequenceInterval(\n\tlabel: string,\n\tstart: number,\n\tend: number,\n\tclient: Client,\n\tintervalType: IntervalType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tstickiness: IntervalStickiness = IntervalStickiness.END,\n): SequenceInterval {\n\tlet beginRefType = ReferenceType.RangeBegin;\n\tlet endRefType = ReferenceType.RangeEnd;\n\tif (intervalType === IntervalType.Transient) {\n\t\tbeginRefType = ReferenceType.Transient;\n\t\tendRefType = ReferenceType.Transient;\n\t} else {\n\t\tif (intervalType === IntervalType.Nest) {\n\t\t\tbeginRefType = ReferenceType.NestBegin;\n\t\t\tendRefType = ReferenceType.NestEnd;\n\t\t}\n\t\t// All non-transient interval references must eventually be SlideOnRemove\n\t\t// To ensure eventual consistency, they must start as StayOnRemove when\n\t\t// pending (created locally and creation op is not acked)\n\t\tif (op || fromSnapshot) {\n\t\t\tbeginRefType |= ReferenceType.SlideOnRemove;\n\t\t\tendRefType |= ReferenceType.SlideOnRemove;\n\t\t} else {\n\t\t\tbeginRefType |= ReferenceType.StayOnRemove;\n\t\t\tendRefType |= ReferenceType.StayOnRemove;\n\t\t}\n\t}\n\n\tconst startLref = createPositionReference(\n\t\tclient,\n\t\tstart,\n\t\tbeginRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tstartReferenceSlidingPreference(stickiness),\n\t);\n\n\tconst endLref = createPositionReference(\n\t\tclient,\n\t\tend,\n\t\tendRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tendReferenceSlidingPreference(stickiness),\n\t);\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [label],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\tconst ival = new SequenceInterval(\n\t\tclient,\n\t\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\trangeProp,\n\t\tstickiness,\n\t);\n\treturn ival;\n}\n\nexport const compareSequenceIntervalEnds = (a: SequenceInterval, b: SequenceInterval): number =>\n\tcompareReferencePositions(a.end, b.end);\n\nexport const compareSequenceIntervalStarts = (a: SequenceInterval, b: SequenceInterval): number =>\n\tcompareReferencePositions(a.start, b.start);\n\nexport const sequenceIntervalHelpers: IIntervalHelpers<SequenceInterval> = {\n\tcompareEnds: compareSequenceIntervalEnds,\n\tcompareStarts: compareSequenceIntervalStarts,\n\tcreate: createSequenceInterval,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"sequenceInterval.js","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAC/B,yCAAyC;AAEzC,2DAiBoC;AACpC,2DAAoD;AAEpD,qEAA6D;AAC7D,8DAM+B;AAC/B,mDAQyB;AAEzB,MAAM,q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AC;SACzC;KACD;IAED,MAAM,SAAS,GAAG,uBAAuB,CACxC,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,EAAE,EACF,YAAY,EACZ,SAAS,EACT,IAAA,+CAA+B,EAAC,UAAU,CAAC,EAC3C,IAAA,+CAA+B,EAAC,UAAU,CAAC,KAAK,8BAAiB,CAAC,QAAQ,EAC1E,qBAAqB,CACrB,CAAC;IAEF,MAAM,OAAO,GAAG,uBAAuB,CACtC,MAAM,EACN,MAAM,EACN,UAAU,EACV,EAAE,EACF,YAAY,EACZ,SAAS,EACT,IAAA,6CAA6B,EAAC,UAAU,CAAC,EACzC,IAAA,6CAA6B,EAAC,UAAU,CAAC,KAAK,8BAAiB,CAAC,OAAO,EACvE,qBAAqB,CACrB,CAAC;IAEF,MAAM,SAAS,GAAG;QACjB,CAAC,mCAAsB,CAAC,EAAE,CAAC,KAAK,CAAC;KACjC,CAAC;IACF,SAAS,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAEjC,MAAM,IAAI,GAAG,IAAI,gBAAgB,CAChC,MAAM,EACN,SAAS,EACT,OAAO,EACP,YAAY,EACZ,SAAS,EACT,SAAS,EACT,OAAO,CACP,CAAC;IACF,OAAO,IAAI,CAAC;AACb,CAAC;AApFD,wDAoFC;AAED;;;GAGG;AACU,QAAA,uBAAuB,GAAuC;IAC1E,MAAM,EAAE,sBAAsB;CAC9B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n/* eslint-disable import/no-deprecated */\n\nimport {\n\tClient,\n\tICombiningOp,\n\tISegment,\n\tLocalReferencePosition,\n\tPropertiesManager,\n\tPropertySet,\n\tReferenceType,\n\tSlidingPreference,\n\tcompareReferencePositions,\n\tcreateDetachedLocalReferencePosition,\n\tcreateMap,\n\tgetSlideToSegoff,\n\tmaxReferencePosition,\n\tminReferencePosition,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n} from \"@fluidframework/merge-tree\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tSequencePlace,\n\tSide,\n\tcomputeStickinessFromSide,\n\tendpointPosAndSide,\n\tsidesFromStickiness,\n} from \"../intervalCollection\";\nimport {\n\tIIntervalHelpers,\n\tISerializableInterval,\n\tISerializedInterval,\n\tIntervalStickiness,\n\tIntervalType,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n} from \"./intervalUtils\";\n\nconst reservedIntervalIdKey = \"intervalId\";\n\nfunction compareSides(sideA: Side, sideB: Side): number {\n\tif (sideA === sideB) {\n\t\treturn 0;\n\t}\n\n\tif (sideA === Side.Before) {\n\t\treturn 1;\n\t}\n\n\treturn -1;\n}\n\nfunction minSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.After && sideB === Side.After) {\n\t\treturn Side.After;\n\t}\n\n\treturn Side.Before;\n}\n\nfunction maxSide(sideA: Side, sideB: Side): Side {\n\tif (sideA === Side.Before && sideB === Side.Before) {\n\t\treturn Side.Before;\n\t}\n\n\treturn Side.After;\n}\n\n/**\n * Interval implementation whose ends are associated with positions in a mutatable sequence.\n * As such, when content is inserted into the middle of the interval, the interval expands to\n * include that content.\n *\n * @remarks The endpoints' positions should be treated exclusively to get\n * reasonable behavior. E.g., an interval referring to \"hello\" in \"hello world\"\n * should have a start position of 0 and an end position of 5.\n *\n * To see why, consider what happens if \"llo wor\" is removed from the string to make \"held\".\n * The interval's startpoint remains on the \"h\" (it isn't altered), but the interval's endpoint\n * slides forward to the next unremoved position, which is the \"l\" in \"held\".\n * Users would generally expect the interval to now refer to \"he\" (as it is the subset of content\n * remaining after the removal), hence the \"l\" should be excluded.\n * If the interval endpoint was treated inclusively, the interval would now refer to \"hel\", which\n * is undesirable.\n *\n * Since the endpoints of an interval are treated exclusively but cannot be greater\n * than or equal to the length of the associated sequence, there exist special\n * endpoint segments, \"start\" and \"end\", which represent the position immediately\n * before or immediately after the string respectively.\n *\n * If a `SequenceInterval` is created on a sequence with the\n * `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints\n * of the interval that are exclusive will have the ability to slide to these\n * special endpoint segments.\n * @public\n */\nexport class SequenceInterval implements ISerializableInterval {\n\t/**\n\t * {@inheritDoc ISerializableInterval.properties}\n\t */\n\tpublic properties: PropertySet;\n\t/**\n\t * {@inheritDoc ISerializableInterval.propertyManager}\n\t * @internal\n\t */\n\tpublic propertyManager: PropertiesManager;\n\n\t/**\n\t * @internal\n\t */\n\tpublic get stickiness(): IntervalStickiness {\n\t\tconst startSegment = this.start.getSegment();\n\t\tconst endSegment = this.end.getSegment();\n\t\treturn computeStickinessFromSide(\n\t\t\tstartSegment?.endpointType,\n\t\t\tthis.startSide,\n\t\t\tendSegment?.endpointType,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\t/**\n\t\t * Start endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic start: LocalReferencePosition,\n\t\t/**\n\t\t * End endpoint of this interval.\n\t\t * @remarks This endpoint can be resolved into a character position using the SharedString it's a part of.\n\t\t */\n\t\tpublic end: LocalReferencePosition,\n\t\tpublic intervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tpublic readonly startSide: Side = Side.Before,\n\t\tpublic readonly endSide: Side = Side.Before,\n\t) {\n\t\tthis.propertyManager = new PropertiesManager();\n\t\tthis.properties = {};\n\n\t\tif (props) {\n\t\t\tthis.addProperties(props);\n\t\t}\n\t}\n\n\tprivate callbacks?: Record<\"beforePositionChange\" | \"afterPositionChange\", () => void>;\n\n\t/**\n\t * Subscribes to position change events on this interval if there are no current listeners.\n\t * @internal\n\t */\n\tpublic addPositionChangeListeners(\n\t\tbeforePositionChange: () => void,\n\t\tafterPositionChange: () => void,\n\t): void {\n\t\tif (this.callbacks === undefined) {\n\t\t\tthis.callbacks = {\n\t\t\t\tbeforePositionChange,\n\t\t\t\tafterPositionChange,\n\t\t\t};\n\n\t\t\tconst startCbs = (this.start.callbacks ??= {});\n\t\t\tconst endCbs = (this.end.callbacks ??= {});\n\t\t\tstartCbs.beforeSlide = endCbs.beforeSlide = beforePositionChange;\n\t\t\tstartCbs.afterSlide = endCbs.afterSlide = afterPositionChange;\n\t\t}\n\t}\n\n\t/**\n\t * Removes the currently subscribed position change listeners.\n\t * @internal\n\t */\n\tpublic removePositionChangeListeners(): void {\n\t\tif (this.callbacks) {\n\t\t\tthis.callbacks = undefined;\n\t\t\tthis.start.callbacks = undefined;\n\t\t\tthis.end.callbacks = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.serialize}\n\t * @internal\n\t */\n\tpublic serialize(): ISerializedInterval {\n\t\tconst startPosition = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPosition = this.client.localReferencePositionToPosition(this.end);\n\t\tconst { startSide, endSide } = sidesFromStickiness(this.stickiness);\n\t\tconst serializedInterval: ISerializedInterval = {\n\t\t\tend: endPosition,\n\t\t\tintervalType: this.intervalType,\n\t\t\tsequenceNumber: this.client.getCurrentSeq(),\n\t\t\tstart: startPosition,\n\t\t\tstickiness: this.stickiness,\n\t\t\tstartSide,\n\t\t\tendSide,\n\t\t};\n\n\t\tif (this.properties) {\n\t\t\tserializedInterval.properties = this.properties;\n\t\t}\n\n\t\treturn serializedInterval;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.clone}\n\t */\n\tpublic clone() {\n\t\treturn new SequenceInterval(\n\t\t\tthis.client,\n\t\t\tthis.start,\n\t\t\tthis.end,\n\t\t\tthis.intervalType,\n\t\t\tthis.properties,\n\t\t\tthis.startSide,\n\t\t\tthis.endSide,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compare}\n\t */\n\tpublic compare(b: SequenceInterval) {\n\t\tconst startResult = this.compareStart(b);\n\t\tif (startResult === 0) {\n\t\t\tconst endResult = this.compareEnd(b);\n\t\t\tif (endResult === 0) {\n\t\t\t\tconst thisId = this.getIntervalId();\n\t\t\t\tif (thisId) {\n\t\t\t\t\tconst bId = b.getIntervalId();\n\t\t\t\t\tif (bId) {\n\t\t\t\t\t\treturn thisId > bId ? 1 : thisId < bId ? -1 : 0;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn endResult;\n\t\t\t}\n\t\t} else {\n\t\t\treturn startResult;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareStart}\n\t */\n\tpublic compareStart(b: SequenceInterval) {\n\t\tconst dist = compareReferencePositions(this.start, b.start);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(this.startSide, b.startSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.compareEnd}\n\t */\n\tpublic compareEnd(b: SequenceInterval): number {\n\t\tconst dist = compareReferencePositions(this.end, b.end);\n\n\t\tif (dist === 0) {\n\t\t\treturn compareSides(b.endSide, this.endSide);\n\t\t}\n\n\t\treturn dist;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.overlaps}\n\t */\n\tpublic overlaps(b: SequenceInterval) {\n\t\tconst result =\n\t\t\tcompareReferencePositions(this.start, b.end) <= 0 &&\n\t\t\tcompareReferencePositions(this.end, b.start) >= 0;\n\t\treturn result;\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.getIntervalId}\n\t */\n\tpublic getIntervalId(): string {\n\t\tconst id = this.properties?.[reservedIntervalIdKey];\n\t\tassert(id !== undefined, 0x5e2 /* interval ID should not be undefined */);\n\t\treturn `${id}`;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.union}\n\t * @internal\n\t */\n\tpublic union(b: SequenceInterval) {\n\t\tconst newStart = minReferencePosition(this.start, b.start);\n\t\tconst newEnd = maxReferencePosition(this.end, b.end);\n\n\t\tlet startSide: Side;\n\n\t\tif (this.start === b.start) {\n\t\t\tstartSide = minSide(this.startSide, b.startSide);\n\t\t} else {\n\t\t\tstartSide = this.start === newStart ? this.startSide : b.startSide;\n\t\t}\n\n\t\tlet endSide: Side;\n\n\t\tif (this.end === b.end) {\n\t\t\tendSide = maxSide(this.endSide, b.endSide);\n\t\t} else {\n\t\t\tendSide = this.end === newEnd ? this.endSide : b.endSide;\n\t\t}\n\n\t\treturn new SequenceInterval(\n\t\t\tthis.client,\n\t\t\tnewStart,\n\t\t\tnewEnd,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide,\n\t\t\tendSide,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISerializableInterval.addProperties}\n\t * @internal\n\t */\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tcollab: boolean = false,\n\t\tseq?: number,\n\t\top?: ICombiningOp,\n\t): PropertySet | undefined {\n\t\tthis.initializeProperties();\n\t\treturn this.propertyManager.addProperties(this.properties, newProps, op, seq, collab);\n\t}\n\n\t/**\n\t * @returns whether this interval overlaps two numerical positions.\n\t */\n\tpublic overlapsPos(bstart: number, bend: number) {\n\t\tconst startPos = this.client.localReferencePositionToPosition(this.start);\n\t\tconst endPos = this.client.localReferencePositionToPosition(this.end);\n\t\treturn endPos > bstart && startPos < bend;\n\t}\n\n\t/**\n\t * {@inheritDoc IInterval.modify}\n\t * @internal\n\t */\n\tpublic modify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tuseNewSlidingBehavior: boolean = false,\n\t) {\n\t\tconst { startSide, endSide, startPos, endPos } = endpointPosAndSide(start, end);\n\t\tconst stickiness = computeStickinessFromSide(\n\t\t\tstartPos ?? this.start.getSegment()?.endpointType,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendPos ?? this.end.getSegment()?.endpointType,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tconst getRefType = (baseType: ReferenceType): ReferenceType => {\n\t\t\tlet refType = baseType;\n\t\t\tif (op === undefined) {\n\t\t\t\trefType &= ~ReferenceType.SlideOnRemove;\n\t\t\t\trefType |= ReferenceType.StayOnRemove;\n\t\t\t}\n\t\t\treturn refType;\n\t\t};\n\n\t\tlet startRef = this.start;\n\t\tif (startPos !== undefined) {\n\t\t\tstartRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tstartPos,\n\t\t\t\tgetRefType(this.start.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tstartReferenceSlidingPreference(stickiness),\n\t\t\t\tstartReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,\n\t\t\t\tuseNewSlidingBehavior,\n\t\t\t);\n\t\t\tif (this.start.properties) {\n\t\t\t\tstartRef.addProperties(this.start.properties);\n\t\t\t}\n\t\t}\n\n\t\tlet endRef = this.end;\n\t\tif (endPos !== undefined) {\n\t\t\tendRef = createPositionReference(\n\t\t\t\tthis.client,\n\t\t\t\tendPos,\n\t\t\t\tgetRefType(this.end.refType),\n\t\t\t\top,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t\tendReferenceSlidingPreference(stickiness),\n\t\t\t\tendReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,\n\t\t\t\tuseNewSlidingBehavior,\n\t\t\t);\n\t\t\tif (this.end.properties) {\n\t\t\t\tendRef.addProperties(this.end.properties);\n\t\t\t}\n\t\t}\n\n\t\tconst newInterval = new SequenceInterval(\n\t\t\tthis.client,\n\t\t\tstartRef,\n\t\t\tendRef,\n\t\t\tthis.intervalType,\n\t\t\tundefined,\n\t\t\tstartSide ?? this.startSide,\n\t\t\tendSide ?? this.endSide,\n\t\t);\n\t\tif (this.properties) {\n\t\t\tnewInterval.initializeProperties();\n\t\t\tthis.propertyManager.copyTo(\n\t\t\t\tthis.properties,\n\t\t\t\tnewInterval.properties,\n\t\t\t\tnewInterval.propertyManager,\n\t\t\t);\n\t\t}\n\t\treturn newInterval;\n\t}\n\n\tprivate initializeProperties(): void {\n\t\tif (!this.propertyManager) {\n\t\t\tthis.propertyManager = new PropertiesManager();\n\t\t}\n\t\tif (!this.properties) {\n\t\t\tthis.properties = createMap<any>();\n\t\t}\n\t}\n}\n\nexport function createPositionReferenceFromSegoff(\n\tclient: Client,\n\tsegoff: { segment: ISegment | undefined; offset: number | undefined } | \"start\" | \"end\",\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tlocalSeq?: number,\n\tfromSnapshot?: boolean,\n\tslidingPreference?: SlidingPreference,\n\tcanSlideToEndpoint?: boolean,\n): LocalReferencePosition {\n\tif (segoff === \"start\" || segoff === \"end\") {\n\t\treturn client.createLocalReferencePosition(\n\t\t\tsegoff,\n\t\t\tundefined,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t}\n\n\tif (segoff.segment) {\n\t\tconst ref = client.createLocalReferencePosition(\n\t\t\tsegoff.segment,\n\t\t\tsegoff.offset,\n\t\t\trefType,\n\t\t\tundefined,\n\t\t\tslidingPreference,\n\t\t\tcanSlideToEndpoint,\n\t\t);\n\t\treturn ref;\n\t}\n\n\t// Creating references on detached segments is allowed for:\n\t// - Transient segments\n\t// - References coming from a remote client (location may have been concurrently removed)\n\t// - References being rebased to a new sequence number\n\t// (segment they originally referred to may have been removed with no suitable replacement)\n\tif (\n\t\t!op &&\n\t\t!localSeq &&\n\t\t!fromSnapshot &&\n\t\t!refTypeIncludesFlag(refType, ReferenceType.Transient)\n\t) {\n\t\tthrow new UsageError(\"Non-transient references need segment\");\n\t}\n\n\treturn createDetachedLocalReferencePosition(refType);\n}\n\nfunction createPositionReference(\n\tclient: Client,\n\tpos: number | \"start\" | \"end\",\n\trefType: ReferenceType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tlocalSeq?: number,\n\tslidingPreference?: SlidingPreference,\n\texclusive: boolean = false,\n\tuseNewSlidingBehavior: boolean = false,\n): LocalReferencePosition {\n\tlet segoff;\n\n\tif (op) {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) !== 0,\n\t\t\t0x2f5 /* op create references must be SlideOnRemove */,\n\t\t);\n\t\tif (pos === \"start\" || pos === \"end\") {\n\t\t\tsegoff = pos;\n\t\t} else {\n\t\t\tsegoff = client.getContainingSegment(pos, {\n\t\t\t\treferenceSequenceNumber: op.referenceSequenceNumber,\n\t\t\t\tclientId: op.clientId,\n\t\t\t});\n\t\t\tsegoff = getSlideToSegoff(segoff, undefined, useNewSlidingBehavior);\n\t\t}\n\t} else {\n\t\tassert(\n\t\t\t(refType & ReferenceType.SlideOnRemove) === 0 || !!fromSnapshot,\n\t\t\t0x2f6 /* SlideOnRemove references must be op created */,\n\t\t);\n\t\tsegoff =\n\t\t\tpos === \"start\" || pos === \"end\"\n\t\t\t\t? pos\n\t\t\t\t: client.getContainingSegment(pos, undefined, localSeq);\n\t}\n\n\treturn createPositionReferenceFromSegoff(\n\t\tclient,\n\t\tsegoff,\n\t\trefType,\n\t\top,\n\t\tlocalSeq,\n\t\tfromSnapshot,\n\t\tslidingPreference,\n\t\texclusive,\n\t);\n}\n\nexport function createSequenceInterval(\n\tlabel: string,\n\tstart: SequencePlace | undefined,\n\tend: SequencePlace | undefined,\n\tclient: Client,\n\tintervalType: IntervalType,\n\top?: ISequencedDocumentMessage,\n\tfromSnapshot?: boolean,\n\tuseNewSlidingBehavior: boolean = false,\n): SequenceInterval {\n\tconst { startPos, startSide, endPos, endSide } = endpointPosAndSide(\n\t\tstart ?? \"start\",\n\t\tend ?? \"end\",\n\t);\n\tassert(\n\t\tstartPos !== undefined &&\n\t\t\tendPos !== undefined &&\n\t\t\tstartSide !== undefined &&\n\t\t\tendSide !== undefined,\n\t\t0x794 /* start and end cannot be undefined because they were not passed in as undefined */,\n\t);\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\tlet beginRefType = ReferenceType.RangeBegin;\n\tlet endRefType = ReferenceType.RangeEnd;\n\tif (intervalType === IntervalType.Transient) {\n\t\tbeginRefType = ReferenceType.Transient;\n\t\tendRefType = ReferenceType.Transient;\n\t} else {\n\t\tif (intervalType === IntervalType.Nest) {\n\t\t\tbeginRefType = ReferenceType.NestBegin;\n\t\t\tendRefType = ReferenceType.NestEnd;\n\t\t}\n\t\t// All non-transient interval references must eventually be SlideOnRemove\n\t\t// To ensure eventual consistency, they must start as StayOnRemove when\n\t\t// pending (created locally and creation op is not acked)\n\t\tif (op ?? fromSnapshot) {\n\t\t\tbeginRefType |= ReferenceType.SlideOnRemove;\n\t\t\tendRefType |= ReferenceType.SlideOnRemove;\n\t\t} else {\n\t\t\tbeginRefType |= ReferenceType.StayOnRemove;\n\t\t\tendRefType |= ReferenceType.StayOnRemove;\n\t\t}\n\t}\n\n\tconst startLref = createPositionReference(\n\t\tclient,\n\t\tstartPos,\n\t\tbeginRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tstartReferenceSlidingPreference(stickiness),\n\t\tstartReferenceSlidingPreference(stickiness) === SlidingPreference.BACKWARD,\n\t\tuseNewSlidingBehavior,\n\t);\n\n\tconst endLref = createPositionReference(\n\t\tclient,\n\t\tendPos,\n\t\tendRefType,\n\t\top,\n\t\tfromSnapshot,\n\t\tundefined,\n\t\tendReferenceSlidingPreference(stickiness),\n\t\tendReferenceSlidingPreference(stickiness) === SlidingPreference.FORWARD,\n\t\tuseNewSlidingBehavior,\n\t);\n\n\tconst rangeProp = {\n\t\t[reservedRangeLabelsKey]: [label],\n\t};\n\tstartLref.addProperties(rangeProp);\n\tendLref.addProperties(rangeProp);\n\n\tconst ival = new SequenceInterval(\n\t\tclient,\n\t\tstartLref,\n\t\tendLref,\n\t\tintervalType,\n\t\trangeProp,\n\t\tstartSide,\n\t\tendSide,\n\t);\n\treturn ival;\n}\n\n/**\n * @deprecated The methods within have substitutions\n * @public\n */\nexport const sequenceIntervalHelpers: IIntervalHelpers<SequenceInterval> = {\n\tcreate: createSequenceInterval,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localValues.d.ts","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oCAAoC,CAAC;AACxF,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAElB;;;;;OAKG;IACH,cAAc,CAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB,CAAC;CACnF;AAED,wBAAgB,gBAAgB,CAC/B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GAChB,kBAAkB,CAMpB;AAED;;;;GAIG;AACH,qBAAa,mBAAmB,CAAC,CAAC,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"localValues.d.ts","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oCAAoC,CAAC;AACxF,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IACnC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAElB;;;;;OAKG;IACH,cAAc,CAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB,CAAC;CACnF;AAED,wBAAgB,gBAAgB,CAC/B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GAChB,kBAAkB,CAMpB;AAED;;;;GAIG;AACH,qBAAa,mBAAmB,CAAC,CAAC,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;aAO3C,KAAK,EAAE,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAP3B;;;;OAIG;gBAEc,KAAK,EAAE,CAAC,EACP,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAG1C;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACI,cAAc,CAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB;IAUzF;;;;OAIG;IACI,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC;CAQvD"}
|
package/dist/localValues.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localValues.js","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAAwF;AA+BxF,SAAgB,gBAAgB,CAC/B,UAAuB,EACvB,UAA4B,EAC5B,IAAkB;IAElB,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO;QACN,IAAI,EAAE,KAAK,C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AO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SACxC;QAED,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AA5CD,kDA4CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { IFluidSerializer, serializeHandles } from \"@fluidframework/shared-object-base\";\nimport {\n\tISerializableValue,\n\tISerializedValue,\n\tIValueOperation,\n\tIValueType,\n} from \"./defaultMapInterfaces\";\n\n/**\n * A local value to be stored in a container type DDS.\n */\nexport interface ILocalValue<T = any> {\n\t/**\n\t * Type indicator of the value stored within.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * The in-memory value stored within.\n\t */\n\treadonly value: T;\n\n\t/**\n\t * Retrieve the serialized form of the value stored within.\n\t * @param serializer - Data store runtime's serializer\n\t * @param bind - Container type's handle\n\t * @returns The serialized form of the contained value\n\t */\n\tmakeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue;\n}\n\nexport function makeSerializable(\n\tlocalValue: ILocalValue,\n\tserializer: IFluidSerializer,\n\tbind: IFluidHandle,\n): ISerializableValue {\n\tconst value = localValue.makeSerialized(serializer, bind);\n\treturn {\n\t\ttype: value.type,\n\t\tvalue: value.value && JSON.parse(value.value),\n\t};\n}\n\n/**\n * Manages a contained value type.\n *\n * @alpha\n */\nexport class ValueTypeLocalValue<T> implements ILocalValue<T> {\n\t/**\n\t * Create a new ValueTypeLocalValue.\n\t * @param value - The instance of the value type stored within\n\t * @param valueType - The type object of the value type stored within\n\t */\n\tconstructor(\n\t\tpublic readonly value: T,\n\t\tprivate readonly valueType: IValueType<T>,\n\t) {}\n\n\t/**\n\t * {@inheritDoc ILocalValue.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn this.valueType.name;\n\t}\n\n\t/**\n\t * {@inheritDoc ILocalValue.makeSerialized}\n\t */\n\tpublic makeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue {\n\t\tconst storedValueType = this.valueType.factory.store(this.value);\n\t\tconst value = serializeHandles(storedValueType, serializer, bind);\n\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tvalue,\n\t\t};\n\t}\n\n\t/**\n\t * Get the handler for a given op of this value type.\n\t * @param opName - The name of the operation that needs processing\n\t * @returns The object which can process the given op\n\t */\n\tpublic getOpHandler(opName: string): IValueOperation<T> {\n\t\tconst handler = this.valueType.ops.get(opName);\n\t\tif (!handler) {\n\t\t\tthrow new Error(\"Unknown type message\");\n\t\t}\n\n\t\treturn handler;\n\t}\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/sequence";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-dev.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-dev.7.2.0.204906";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/sequence";
|
|
11
|
-
exports.pkgVersion = "2.0.0-dev.
|
|
11
|
+
exports.pkgVersion = "2.0.0-dev.7.2.0.204906";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.0.0-dev.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,UAAU,GAAG,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"2.0.0-dev.7.2.0.204906\";\n"]}
|
package/dist/revertibles.d.ts
CHANGED
|
@@ -9,22 +9,16 @@ import { SequenceDeltaEvent } from "./sequenceDeltaEvent";
|
|
|
9
9
|
/**
|
|
10
10
|
* Data for undoing edits on SharedStrings and Intervals.
|
|
11
11
|
*
|
|
12
|
-
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
13
|
-
* be set as true on the underlying merge tree in order to function correctly.
|
|
14
|
-
*
|
|
15
12
|
* @alpha
|
|
16
13
|
*/
|
|
17
|
-
export
|
|
18
|
-
|
|
14
|
+
export type SharedStringRevertible = MergeTreeDeltaRevertible | IntervalRevertible;
|
|
15
|
+
type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];
|
|
19
16
|
/**
|
|
20
17
|
* Data for undoing edits affecting Intervals.
|
|
21
18
|
*
|
|
22
|
-
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
23
|
-
* be set as true on the underlying merge tree in order to function correctly.
|
|
24
|
-
*
|
|
25
19
|
* @alpha
|
|
26
20
|
*/
|
|
27
|
-
export
|
|
21
|
+
export type IntervalRevertible = {
|
|
28
22
|
event: typeof IntervalOpType.CHANGE;
|
|
29
23
|
interval: SequenceInterval;
|
|
30
24
|
start: LocalReferencePosition;
|
|
@@ -80,9 +74,6 @@ export declare function appendIntervalPropertyChangedToRevertibles(interval: Seq
|
|
|
80
74
|
* Create revertibles for SharedStringDeltas, handling indirectly modified intervals
|
|
81
75
|
* (e.g. reverting remove of a range that contains an interval will move the interval back)
|
|
82
76
|
*
|
|
83
|
-
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
84
|
-
* be set as true on the underlying merge tree in order to function correctly.
|
|
85
|
-
*
|
|
86
77
|
* @alpha
|
|
87
78
|
*/
|
|
88
79
|
export declare function appendSharedStringDeltaToRevertibles(string: SharedString, delta: SequenceDeltaEvent, revertibles: SharedStringRevertible[]): void;
|
|
@@ -94,9 +85,6 @@ export declare function discardSharedStringRevertibles(sharedString: SharedStrin
|
|
|
94
85
|
/**
|
|
95
86
|
* Invoke revertibles to reverse prior edits
|
|
96
87
|
*
|
|
97
|
-
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
98
|
-
* be set as true on the underlying merge tree in order to function correctly.
|
|
99
|
-
*
|
|
100
88
|
* @alpha
|
|
101
89
|
*/
|
|
102
90
|
export declare function revertSharedStringRevertibles(sharedString: SharedString, revertibles: SharedStringRevertible[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revertibles.d.ts","sourceRoot":"","sources":["../src/revertibles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAIN,sBAAsB,EAEtB,wBAAwB,EAExB,WAAW,EAMX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAuB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAuB,k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ibleRefs) {
|
|
|
130
130
|
* Create revertibles for SharedStringDeltas, handling indirectly modified intervals
|
|
131
131
|
* (e.g. reverting remove of a range that contains an interval will move the interval back)
|
|
132
132
|
*
|
|
133
|
-
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
134
|
-
* be set as true on the underlying merge tree in order to function correctly.
|
|
135
|
-
*
|
|
136
133
|
* @alpha
|
|
137
134
|
*/
|
|
138
135
|
function appendSharedStringDeltaToRevertibles(string, delta, revertibles) {
|
|
@@ -249,11 +246,14 @@ function revertLocalDelete(string, revertible) {
|
|
|
249
246
|
const startSlidePos = getSlidePosition(string, revertible.start, start);
|
|
250
247
|
const end = string.localReferencePositionToPosition(revertible.end);
|
|
251
248
|
const endSlidePos = getSlidePosition(string, revertible.end, end);
|
|
252
|
-
const type = revertible.interval.intervalType;
|
|
253
249
|
// reusing the id causes eventual consistency bugs, so it is removed here and recreated in add
|
|
254
250
|
const { intervalId, ...props } = revertible.interval.properties;
|
|
255
251
|
if (isValidRange(startSlidePos, endSlidePos, string)) {
|
|
256
|
-
const int = collection.add(
|
|
252
|
+
const int = collection.add({
|
|
253
|
+
start: startSlidePos,
|
|
254
|
+
end: endSlidePos,
|
|
255
|
+
props,
|
|
256
|
+
});
|
|
257
257
|
idMap.forEach((newId, oldId) => {
|
|
258
258
|
if (intervalId === newId) {
|
|
259
259
|
idMap.set(oldId, getUpdatedIdFromInterval(int));
|
|
@@ -331,17 +331,12 @@ function revertLocalSequenceRemove(sharedString, revertible) {
|
|
|
331
331
|
const intervalId = getUpdatedId(intervalInfo.intervalId);
|
|
332
332
|
const interval = intervalCollection.getIntervalById(intervalId);
|
|
333
333
|
if (interval !== undefined) {
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
(newEnd === undefined &&
|
|
341
|
-
newStart !== undefined &&
|
|
342
|
-
sharedString.localReferencePositionToPosition(interval.end) >= newStart) ||
|
|
343
|
-
(newStart !== undefined && newEnd !== undefined && newStart <= newEnd)) {
|
|
344
|
-
intervalCollection.change(intervalId, newStart, newEnd);
|
|
334
|
+
const start = newEndpointPosition(intervalInfo.startOffset, restoredRanges, sharedString) ??
|
|
335
|
+
sharedString.localReferencePositionToPosition(interval.start);
|
|
336
|
+
const end = newEndpointPosition(intervalInfo.endOffset, restoredRanges, sharedString) ??
|
|
337
|
+
sharedString.localReferencePositionToPosition(interval.end);
|
|
338
|
+
if (start <= end) {
|
|
339
|
+
intervalCollection.change(intervalId, start, end);
|
|
345
340
|
}
|
|
346
341
|
}
|
|
347
342
|
});
|
|
@@ -367,9 +362,6 @@ function revertLocalSequenceRemove(sharedString, revertible) {
|
|
|
367
362
|
/**
|
|
368
363
|
* Invoke revertibles to reverse prior edits
|
|
369
364
|
*
|
|
370
|
-
* Revertibles are new and require the option mergeTreeUseNewLengthCalculations to
|
|
371
|
-
* be set as true on the underlying merge tree in order to function correctly.
|
|
372
|
-
*
|
|
373
365
|
* @alpha
|
|
374
366
|
*/
|
|
375
367
|
function revertSharedStringRevertibles(sharedString, revertibles) {
|