@fluidframework/sequence 2.0.0-rc.3.0.3 → 2.0.0-rc.4.0.0
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 +18 -0
- package/README.md +10 -3
- package/api-report/sequence.api.md +34 -35
- package/dist/IntervalCollectionValues.d.ts +0 -2
- package/dist/IntervalCollectionValues.d.ts.map +1 -1
- package/dist/IntervalCollectionValues.js +0 -2
- package/dist/IntervalCollectionValues.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.js +1 -1
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.d.ts +2 -2
- package/dist/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/dist/intervalIndex/endpointIndex.d.ts +2 -2
- package/dist/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +2 -2
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +2 -2
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.d.ts +2 -2
- package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/dist/intervals/interval.js +1 -1
- package/dist/intervals/interval.js.map +1 -1
- package/dist/intervals/sequenceInterval.js +1 -1
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/legacy.d.ts +2 -2
- 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 +6 -6
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js.map +1 -1
- package/dist/sequence.js +2 -2
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.d.ts +24 -3
- package/dist/sequenceDeltaEvent.d.ts.map +1 -1
- package/dist/sequenceDeltaEvent.js +16 -3
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sequenceFactory.d.ts +15 -7
- package/dist/sequenceFactory.d.ts.map +1 -1
- package/dist/sequenceFactory.js +9 -6
- package/dist/sequenceFactory.js.map +1 -1
- package/dist/sharedString.d.ts +70 -47
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +15 -52
- package/dist/sharedString.js.map +1 -1
- package/lib/IntervalCollectionValues.d.ts +0 -2
- package/lib/IntervalCollectionValues.d.ts.map +1 -1
- package/lib/IntervalCollectionValues.js +0 -2
- package/lib/IntervalCollectionValues.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.js +1 -1
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.d.ts +2 -2
- package/lib/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/lib/intervalIndex/endpointIndex.d.ts +2 -2
- package/lib/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +2 -2
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +2 -2
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.d.ts +2 -2
- package/lib/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/lib/intervals/interval.js +1 -1
- package/lib/intervals/interval.js.map +1 -1
- package/lib/intervals/sequenceInterval.js +1 -1
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/legacy.d.ts +2 -2
- 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 +6 -6
- package/lib/revertibles.d.ts.map +1 -1
- package/lib/revertibles.js.map +1 -1
- package/lib/sequence.js +2 -2
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.d.ts +24 -3
- package/lib/sequenceDeltaEvent.d.ts.map +1 -1
- package/lib/sequenceDeltaEvent.js +16 -3
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sequenceFactory.d.ts +15 -7
- package/lib/sequenceFactory.d.ts.map +1 -1
- package/lib/sequenceFactory.js +9 -6
- package/lib/sequenceFactory.js.map +1 -1
- package/lib/sharedString.d.ts +70 -47
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +13 -50
- package/lib/sharedString.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +38 -24
- package/src/IntervalCollectionValues.ts +0 -2
- package/src/index.ts +2 -2
- package/src/intervalCollection.ts +1 -1
- package/src/intervalIndex/endpointInRangeIndex.ts +2 -2
- package/src/intervalIndex/endpointIndex.ts +2 -2
- package/src/intervalIndex/overlappingIntervalsIndex.ts +2 -2
- package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +2 -2
- package/src/intervalIndex/startpointInRangeIndex.ts +2 -2
- package/src/intervals/interval.ts +1 -1
- package/src/intervals/sequenceInterval.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/revertibles.ts +18 -14
- package/src/sequence.ts +2 -2
- package/src/sequenceDeltaEvent.ts +12 -1
- package/src/sequenceFactory.ts +21 -9
- package/src/sharedString.ts +87 -56
package/src/sharedString.ts
CHANGED
|
@@ -42,9 +42,79 @@ export interface ISharedString extends SharedSegmentSequence<SharedStringSegment
|
|
|
42
42
|
insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): void;
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Inserts a marker at a relative position.
|
|
46
|
+
* @param relativePos1 - The relative position to insert the marker at
|
|
47
|
+
* @param refType - The reference type of the marker
|
|
48
|
+
* @param props - The properties of the marker
|
|
49
|
+
*/
|
|
50
|
+
insertMarkerRelative(
|
|
51
|
+
relativePos1: IRelativePosition,
|
|
52
|
+
refType: ReferenceType,
|
|
53
|
+
props?: PropertySet,
|
|
54
|
+
): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Inserts the text at the position.
|
|
58
|
+
* @param relativePos1 - The relative position to insert the text at
|
|
59
|
+
* @param text - The text to insert
|
|
60
|
+
* @param props - The properties of text
|
|
61
|
+
*/
|
|
62
|
+
insertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet): void;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Replaces a range with the provided text.
|
|
66
|
+
* @param start - The inclusive start of the range to replace
|
|
67
|
+
* @param end - The exclusive end of the range to replace
|
|
68
|
+
* @param text - The text to replace the range with
|
|
69
|
+
* @param props - Optional. The properties of the replacement text
|
|
70
|
+
*/
|
|
71
|
+
replaceText(start: number, end: number, text: string, props?: PropertySet): void;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Removes the text in the given range.
|
|
75
|
+
* @param start - The inclusive start of the range to remove
|
|
76
|
+
* @param end - The exclusive end of the range to replace
|
|
77
|
+
* @returns the message sent.
|
|
78
|
+
*/
|
|
79
|
+
removeText(start: number, end: number): void;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Annotates the marker with the provided properties.
|
|
83
|
+
* @param marker - The marker to annotate
|
|
84
|
+
* @param props - The properties to annotate the marker with
|
|
85
|
+
*/
|
|
86
|
+
annotateMarker(marker: Marker, props: PropertySet): void;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Searches a string for the nearest marker in either direction to a given start position.
|
|
90
|
+
* The search will include the start position, so markers at the start position are valid
|
|
91
|
+
* results of the search.
|
|
92
|
+
* @param startPos - Position at which to start the search
|
|
93
|
+
* @param markerLabel - Label of the marker to search for
|
|
94
|
+
* @param forwards - Whether the desired marker comes before (false) or after (true) `startPos`. Default true.
|
|
95
|
+
*/
|
|
96
|
+
searchForMarker(startPos: number, markerLabel: string, forwards?: boolean): Marker | undefined;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Retrieve text from the SharedString in string format.
|
|
100
|
+
* @param start - The starting index of the text to retrieve, or 0 if omitted.
|
|
101
|
+
* @param end - The ending index of the text to retrieve, or the end of the string if omitted
|
|
102
|
+
* @returns The requested text content as a string.
|
|
103
|
+
*/
|
|
104
|
+
getText(start?: number, end?: number): string;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Adds spaces for markers and handles, so that position calculations account for them.
|
|
46
108
|
*/
|
|
47
|
-
|
|
109
|
+
getTextWithPlaceholders(start?: number, end?: number): string;
|
|
110
|
+
|
|
111
|
+
getTextRangeWithMarkers(start: number, end: number): string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Looks up and returns a `Marker` using its id. Returns `undefined` if there is no marker with the provided
|
|
115
|
+
* id in this `SharedString`.
|
|
116
|
+
*/
|
|
117
|
+
getMarkerFromId(id: string): ISegment | undefined;
|
|
48
118
|
}
|
|
49
119
|
|
|
50
120
|
/**
|
|
@@ -62,28 +132,10 @@ export type SharedStringSegment = TextSegment | Marker;
|
|
|
62
132
|
* image or Fluid object that should be rendered with the text.
|
|
63
133
|
* @alpha
|
|
64
134
|
*/
|
|
65
|
-
export class
|
|
135
|
+
export class SharedStringClass
|
|
66
136
|
extends SharedSegmentSequence<SharedStringSegment>
|
|
67
137
|
implements ISharedString
|
|
68
138
|
{
|
|
69
|
-
/**
|
|
70
|
-
* Create a new shared string.
|
|
71
|
-
* @param runtime - data store runtime the new shared string belongs to
|
|
72
|
-
* @param id - optional name of the shared string
|
|
73
|
-
* @returns newly create shared string (but not attached yet)
|
|
74
|
-
*/
|
|
75
|
-
public static create(runtime: IFluidDataStoreRuntime, id?: string) {
|
|
76
|
-
return runtime.createChannel(id, SharedStringFactory.Type) as SharedString;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Get a factory for SharedString to register with the data store.
|
|
81
|
-
* @returns a factory that creates and load SharedString
|
|
82
|
-
*/
|
|
83
|
-
public static getFactory() {
|
|
84
|
-
return new SharedStringFactory();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
139
|
public get ISharedString(): ISharedString {
|
|
88
140
|
return this;
|
|
89
141
|
}
|
|
@@ -101,10 +153,7 @@ export class SharedString
|
|
|
101
153
|
}
|
|
102
154
|
|
|
103
155
|
/**
|
|
104
|
-
*
|
|
105
|
-
* @param relativePos1 - The relative position to insert the marker at
|
|
106
|
-
* @param refType - The reference type of the marker
|
|
107
|
-
* @param props - The properties of the marker
|
|
156
|
+
* {@inheritDoc ISharedString.insertMarkerRelative}
|
|
108
157
|
*/
|
|
109
158
|
public insertMarkerRelative(
|
|
110
159
|
relativePos1: IRelativePosition,
|
|
@@ -133,10 +182,7 @@ export class SharedString
|
|
|
133
182
|
}
|
|
134
183
|
|
|
135
184
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @param relativePos1 - The relative position to insert the text at
|
|
138
|
-
* @param text - The text to insert
|
|
139
|
-
* @param props - The properties of text
|
|
185
|
+
* {@inheritDoc ISharedString.insertTextRelative}
|
|
140
186
|
*/
|
|
141
187
|
public insertTextRelative(
|
|
142
188
|
relativePos1: IRelativePosition,
|
|
@@ -165,42 +211,28 @@ export class SharedString
|
|
|
165
211
|
}
|
|
166
212
|
|
|
167
213
|
/**
|
|
168
|
-
*
|
|
169
|
-
* @param start - The inclusive start of the range to replace
|
|
170
|
-
* @param end - The exclusive end of the range to replace
|
|
171
|
-
* @param text - The text to replace the range with
|
|
172
|
-
* @param props - Optional. The properties of the replacement text
|
|
214
|
+
* {@inheritDoc ISharedString.replaceText}
|
|
173
215
|
*/
|
|
174
216
|
public replaceText(start: number, end: number, text: string, props?: PropertySet): void {
|
|
175
217
|
this.replaceRange(start, end, TextSegment.make(text, props));
|
|
176
218
|
}
|
|
177
219
|
|
|
178
220
|
/**
|
|
179
|
-
*
|
|
180
|
-
* @param start - The inclusive start of the range to remove
|
|
181
|
-
* @param end - The exclusive end of the range to replace
|
|
182
|
-
* @returns the message sent.
|
|
221
|
+
* {@inheritDoc ISharedString.removeText}
|
|
183
222
|
*/
|
|
184
223
|
public removeText(start: number, end: number): void {
|
|
185
224
|
this.removeRange(start, end);
|
|
186
225
|
}
|
|
187
226
|
|
|
188
227
|
/**
|
|
189
|
-
*
|
|
190
|
-
* @param marker - The marker to annotate
|
|
191
|
-
* @param props - The properties to annotate the marker with
|
|
228
|
+
* {@inheritDoc ISharedString.annotateMarker}
|
|
192
229
|
*/
|
|
193
|
-
public annotateMarker(marker: Marker, props: PropertySet) {
|
|
230
|
+
public annotateMarker(marker: Marker, props: PropertySet): void {
|
|
194
231
|
this.guardReentrancy(() => this.client.annotateMarker(marker, props));
|
|
195
232
|
}
|
|
196
233
|
|
|
197
234
|
/**
|
|
198
|
-
*
|
|
199
|
-
* The search will include the start position, so markers at the start position are valid
|
|
200
|
-
* results of the search.
|
|
201
|
-
* @param startPos - Position at which to start the search
|
|
202
|
-
* @param markerLabel - Label of the marker to search for
|
|
203
|
-
* @param forwards - Whether the desired marker comes before (false) or after (true) `startPos`
|
|
235
|
+
* {@inheritDoc ISharedString.searchForMarker}
|
|
204
236
|
*/
|
|
205
237
|
public searchForMarker(
|
|
206
238
|
startPos: number,
|
|
@@ -211,10 +243,7 @@ export class SharedString
|
|
|
211
243
|
}
|
|
212
244
|
|
|
213
245
|
/**
|
|
214
|
-
*
|
|
215
|
-
* @param start - The starting index of the text to retrieve, or 0 if omitted.
|
|
216
|
-
* @param end - The ending index of the text to retrieve, or the end of the string if omitted
|
|
217
|
-
* @returns The requested text content as a string.
|
|
246
|
+
* {@inheritDoc ISharedString.getText}
|
|
218
247
|
*/
|
|
219
248
|
public getText(start?: number, end?: number) {
|
|
220
249
|
const segmentWindow = this.client.getCollabWindow();
|
|
@@ -228,7 +257,7 @@ export class SharedString
|
|
|
228
257
|
}
|
|
229
258
|
|
|
230
259
|
/**
|
|
231
|
-
*
|
|
260
|
+
* {@inheritDoc ISharedString.getTextWithPlaceholders}
|
|
232
261
|
*/
|
|
233
262
|
public getTextWithPlaceholders(start?: number, end?: number) {
|
|
234
263
|
const segmentWindow = this.client.getCollabWindow();
|
|
@@ -241,6 +270,9 @@ export class SharedString
|
|
|
241
270
|
);
|
|
242
271
|
}
|
|
243
272
|
|
|
273
|
+
/**
|
|
274
|
+
* {@inheritDoc ISharedString.getTextRangeWithMarkers}
|
|
275
|
+
*/
|
|
244
276
|
public getTextRangeWithMarkers(start: number, end: number) {
|
|
245
277
|
const segmentWindow = this.client.getCollabWindow();
|
|
246
278
|
return this.mergeTreeTextHelper.getText(
|
|
@@ -253,8 +285,7 @@ export class SharedString
|
|
|
253
285
|
}
|
|
254
286
|
|
|
255
287
|
/**
|
|
256
|
-
*
|
|
257
|
-
* id in this `SharedString`.
|
|
288
|
+
* {@inheritDoc ISharedString.getMarkerFromId}
|
|
258
289
|
*/
|
|
259
290
|
public getMarkerFromId(id: string): ISegment | undefined {
|
|
260
291
|
return this.client.getMarkerFromId(id);
|
|
@@ -297,7 +328,7 @@ interface ITextAndMarkerAccumulator {
|
|
|
297
328
|
* @internal
|
|
298
329
|
*/
|
|
299
330
|
export function getTextAndMarkers(
|
|
300
|
-
sharedString:
|
|
331
|
+
sharedString: ISharedString,
|
|
301
332
|
label: string,
|
|
302
333
|
start?: number,
|
|
303
334
|
end?: number,
|