@fluidframework/sequence 2.43.0-343119 → 2.43.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 +21 -0
- package/api-report/sequence.legacy.alpha.api.md +2 -2
- package/dist/intervalCollection.d.ts +4 -9
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +96 -82
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalCollectionMap.d.ts +1 -1
- package/dist/intervalCollectionMap.d.ts.map +1 -1
- package/dist/intervalCollectionMap.js +2 -2
- package/dist/intervalCollectionMap.js.map +1 -1
- package/dist/intervalCollectionMapInterfaces.d.ts +13 -6
- package/dist/intervalCollectionMapInterfaces.d.ts.map +1 -1
- package/dist/intervalCollectionMapInterfaces.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +4 -3
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js +16 -3
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +21 -7
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +88 -16
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sequence.js +1 -1
- package/dist/sequence.js.map +1 -1
- package/lib/intervalCollection.d.ts +4 -9
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +98 -82
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalCollectionMap.d.ts +1 -1
- package/lib/intervalCollectionMap.d.ts.map +1 -1
- package/lib/intervalCollectionMap.js +2 -2
- package/lib/intervalCollectionMap.js.map +1 -1
- package/lib/intervalCollectionMapInterfaces.d.ts +13 -6
- package/lib/intervalCollectionMapInterfaces.d.ts.map +1 -1
- package/lib/intervalCollectionMapInterfaces.js.map +1 -1
- package/lib/intervals/intervalUtils.d.ts +4 -3
- package/lib/intervals/intervalUtils.d.ts.map +1 -1
- package/lib/intervals/intervalUtils.js +15 -3
- package/lib/intervals/intervalUtils.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +21 -7
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +88 -16
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/sequence.js +1 -1
- package/lib/sequence.js.map +1 -1
- package/package.json +18 -18
- package/src/intervalCollection.ts +122 -142
- package/src/intervalCollectionMap.ts +6 -2
- package/src/intervalCollectionMapInterfaces.ts +15 -5
- package/src/intervals/intervalUtils.ts +31 -3
- package/src/intervals/sequenceInterval.ts +135 -72
- package/src/packageVersion.ts +1 -1
- package/src/sequence.ts +1 -1
|
@@ -3,29 +3,36 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
6
|
-
import { IMergeTreeOptions, ListNode } from "@fluidframework/merge-tree/internal";
|
|
6
|
+
import { IMergeTreeOptions, ListNode, type ISegmentInternal } from "@fluidframework/merge-tree/internal";
|
|
7
7
|
import type { IntervalCollection, ISerializedIntervalCollectionV1, ISerializedIntervalCollectionV2 } from "./intervalCollection.js";
|
|
8
|
-
import { ISerializedInterval, IntervalDeltaOpType, SerializedIntervalDelta } from "./intervals/index.js";
|
|
8
|
+
import { ISerializedInterval, IntervalDeltaOpType, SerializedIntervalDelta, type SequenceIntervalClass } from "./intervals/index.js";
|
|
9
9
|
export interface IntervalAddLocalMetadata {
|
|
10
10
|
type: typeof IntervalDeltaOpType.ADD;
|
|
11
11
|
localSeq: number;
|
|
12
12
|
endpointChangesNode?: ListNode<IntervalAddLocalMetadata | IntervalChangeLocalMetadata>;
|
|
13
|
-
rebased?:
|
|
14
|
-
|
|
13
|
+
rebased?: Record<"start" | "end", {
|
|
14
|
+
segment: ISegmentInternal;
|
|
15
|
+
offset: number;
|
|
16
|
+
}> | "detached";
|
|
17
|
+
interval: SequenceIntervalClass;
|
|
15
18
|
}
|
|
16
19
|
export interface IntervalChangeLocalMetadata {
|
|
17
20
|
type: typeof IntervalDeltaOpType.CHANGE;
|
|
18
21
|
localSeq: number;
|
|
19
22
|
previous: ISerializedInterval;
|
|
20
23
|
endpointChangesNode?: ListNode<IntervalChangeLocalMetadata | IntervalChangeLocalMetadata>;
|
|
21
|
-
rebased?:
|
|
22
|
-
|
|
24
|
+
rebased?: Record<"start" | "end", {
|
|
25
|
+
segment: ISegmentInternal;
|
|
26
|
+
offset: number;
|
|
27
|
+
}> | "detached";
|
|
28
|
+
interval: SequenceIntervalClass;
|
|
23
29
|
}
|
|
24
30
|
export interface IntervalDeleteLocalMetadata {
|
|
25
31
|
type: typeof IntervalDeltaOpType.DELETE;
|
|
26
32
|
localSeq: number;
|
|
27
33
|
previous: ISerializedInterval;
|
|
28
34
|
endpointChangesNode?: undefined;
|
|
35
|
+
interval?: undefined;
|
|
29
36
|
}
|
|
30
37
|
export type IntervalMessageLocalMetadata = IntervalAddLocalMetadata | IntervalChangeLocalMetadata | IntervalDeleteLocalMetadata;
|
|
31
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalCollectionMapInterfaces.d.ts","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,
|
|
1
|
+
{"version":3,"file":"intervalCollectionMapInterfaces.d.ts","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,E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9B,GACD;IACA;;OAEG;IACH,MAAM,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC;IAE1C;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalCollectionMapInterfaces.js","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {
|
|
1
|
+
{"version":3,"file":"intervalCollectionMapInterfaces.js","sourceRoot":"","sources":["../src/intervalCollectionMapInterfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIMergeTreeOptions,\n\tListNode,\n\ttype ISegmentInternal,\n} from \"@fluidframework/merge-tree/internal\";\n\nimport type {\n\tIntervalCollection,\n\tISerializedIntervalCollectionV1,\n\tISerializedIntervalCollectionV2,\n} from \"./intervalCollection.js\";\nimport {\n\tISerializedInterval,\n\tIntervalDeltaOpType,\n\tSerializedIntervalDelta,\n\ttype SequenceIntervalClass,\n} from \"./intervals/index.js\";\n\nexport interface IntervalAddLocalMetadata {\n\ttype: typeof IntervalDeltaOpType.ADD;\n\tlocalSeq: number;\n\tendpointChangesNode?: ListNode<IntervalAddLocalMetadata | IntervalChangeLocalMetadata>;\n\trebased?:\n\t\t| Record<\"start\" | \"end\", { segment: ISegmentInternal; offset: number }>\n\t\t| \"detached\";\n\tinterval: SequenceIntervalClass;\n}\nexport interface IntervalChangeLocalMetadata {\n\ttype: typeof IntervalDeltaOpType.CHANGE;\n\tlocalSeq: number;\n\tprevious: ISerializedInterval;\n\tendpointChangesNode?: ListNode<IntervalChangeLocalMetadata | IntervalChangeLocalMetadata>;\n\trebased?:\n\t\t| Record<\"start\" | \"end\", { segment: ISegmentInternal; offset: number }>\n\t\t| \"detached\";\n\tinterval: SequenceIntervalClass;\n}\nexport interface IntervalDeleteLocalMetadata {\n\ttype: typeof IntervalDeltaOpType.DELETE;\n\tlocalSeq: number;\n\tprevious: ISerializedInterval;\n\tendpointChangesNode?: undefined;\n\tinterval?: undefined;\n}\nexport type IntervalMessageLocalMetadata =\n\t| IntervalAddLocalMetadata\n\t| IntervalChangeLocalMetadata\n\t| IntervalDeleteLocalMetadata;\n/**\n * Optional flags that configure options for sequence DDSs\n * @internal\n */\nexport interface SequenceOptions\n\textends Pick<\n\t\tIMergeTreeOptions,\n\t\t| \"mergeTreeReferencesCanSlideToEndpoint\"\n\t\t| \"mergeTreeEnableObliterate\"\n\t\t| \"mergeTreeEnableSidedObliterate\"\n\t\t| \"mergeTreeEnableAnnotateAdjust\"\n\t> {\n\t/**\n\t * Enable the ability to use interval APIs that rely on positions before and\n\t * after individual characters, referred to as \"sides\". See {@link @fluidframework/merge-tree#SequencePlace}\n\t * for additional context.\n\t *\n\t * This flag must be enabled to pass instances of {@link @fluidframework/merge-tree#SequencePlace} to\n\t * any IIntervalCollection API.\n\t *\n\t * Also see the feature flag `mergeTreeReferencesCanSlideToEndpoint` to allow\n\t * endpoints to slide to the special endpoint segments.\n\t *\n\t * The default value is false.\n\t */\n\tintervalStickinessEnabled: boolean;\n\n\t/**\n\t * This is for testing, and allows us to output intervals in the older formats.\n\t */\n\tintervalSerializationFormat: \"1\" | \"2\";\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n *\n */\nexport interface IIntervalCollectionOperation {\n\t/**\n\t * Performs the actual processing on the incoming operation.\n\t * @param value - The current value stored at the given key, which should be the value type\n\t * @param params - The params on the incoming operation\n\t * @param local - Whether the operation originated from this client\n\t * @param message - The operation itself\n\t * @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.\n\t */\n\tprocess(\n\t\tvalue: IntervalCollection,\n\t\tparams: ISerializedInterval,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IntervalMessageLocalMetadata | undefined,\n\t): void;\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * The DefaultMap implementation for sequence has been specialized to only support a single ValueType, which serializes\n * and deserializes via .store() and .load().\n */\nexport interface ISerializableIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: \"sharedStringIntervalCollection\";\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\tvalue: ISerializedIntervalCollectionV1 | ISerializedIntervalCollectionV2;\n}\n\nexport interface ISerializedIntervalCollection {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * String representation of the value.\n\t */\n\tvalue: string | undefined;\n}\n\n/**\n * ValueTypes handle ops slightly differently from SharedObjects or plain JS objects. Since the Map/Directory doesn't\n * know how to handle the ValueType's ops, those ops are instead passed along to the ValueType for processing.\n * IValueTypeOperationValue is that passed-along op. The opName on it is the ValueType-specific operation and the\n * value is whatever params the ValueType needs to complete that operation. Similar to ISerializableValue, it is\n * serializable via JSON.stringify/parse but differs in that it has no equivalency with an in-memory value - rather\n * it just describes an operation to be applied to an already-in-memory value.\n */\nexport type IIntervalCollectionTypeOperationValue =\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.ADD;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: ISerializedInterval;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.CHANGE;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: SerializedIntervalDelta;\n\t }\n\t| {\n\t\t\t/**\n\t\t\t * The name of the operation.\n\t\t\t */\n\t\t\topName: typeof IntervalDeltaOpType.DELETE;\n\n\t\t\t/**\n\t\t\t * The payload that is submitted along with the operation.\n\t\t\t */\n\t\t\tvalue: SerializedIntervalDelta;\n\t };\n"]}
|
|
@@ -42,7 +42,7 @@ export interface IInterval {
|
|
|
42
42
|
*
|
|
43
43
|
* @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release
|
|
44
44
|
*/
|
|
45
|
-
modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number,
|
|
45
|
+
modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, canSlideToEndpoint?: boolean): IInterval | undefined;
|
|
46
46
|
/**
|
|
47
47
|
* @returns whether this interval overlaps with `b`.
|
|
48
48
|
* Intervals are considered to overlap if their intersection is non-empty.
|
|
@@ -224,6 +224,7 @@ export declare const IntervalStickiness: {
|
|
|
224
224
|
* @alpha
|
|
225
225
|
*/
|
|
226
226
|
export type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];
|
|
227
|
-
export declare function startReferenceSlidingPreference(
|
|
228
|
-
export declare function endReferenceSlidingPreference(
|
|
227
|
+
export declare function startReferenceSlidingPreference(startPos: number | "start" | "end" | undefined, startSide: Side, endPos: number | "start" | "end" | undefined, endSide: Side): SlidingPreference;
|
|
228
|
+
export declare function endReferenceSlidingPreference(startPos: number | "start" | "end" | undefined, startSide: Side, endPos: number | "start" | "end" | undefined, endSide: Side): SlidingPreference;
|
|
229
|
+
export declare function computeStickinessFromSide(startPos: number | "start" | "end" | undefined, startSide: Side, endPos: number | "start" | "end" | undefined, endSide: Side): IntervalStickiness;
|
|
229
230
|
//# sourceMappingURL=intervalUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalUtils.d.ts","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,MAAM,qCAAqC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB;;;;;OAKG;IACH,KAAK,IAAI,SAAS,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC9B;;;;OAIG;IACH,YAAY,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,UAAU,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACjC;;;;OAIG;IACH,MAAM,CACL,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,GAAG,EAAE,aAAa,GAAG,SAAS,EAC9B,EAAE,CAAC,EAAE,yBAAyB,EAC9B,QAAQ,CAAC,EAAE,MAAM,EACjB,
|
|
1
|
+
{"version":3,"file":"intervalUtils.d.ts","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,MAAM,qCAAqC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB;;;;;OAKG;IACH,KAAK,IAAI,SAAS,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,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,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC9C,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC5C,OAAO,EAAE,IAAI,GACX,iBAAiB,CAMnB;AAED,wBAAgB,6BAA6B,CAC5C,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC9C,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC5C,OAAO,EAAE,IAAI,GACX,iBAAiB,CAOnB;AAED,wBAAgB,yBAAyB,CACxC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC9C,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,EAC5C,OAAO,EAAE,IAAI,GACX,kBAAkB,CAYpB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.endReferenceSlidingPreference = exports.startReferenceSlidingPreference = exports.IntervalStickiness = exports.IntervalType = exports.IntervalOpType = exports.IntervalDeltaOpType = void 0;
|
|
7
|
+
exports.computeStickinessFromSide = exports.endReferenceSlidingPreference = exports.startReferenceSlidingPreference = exports.IntervalStickiness = exports.IntervalType = exports.IntervalOpType = exports.IntervalDeltaOpType = void 0;
|
|
8
8
|
const internal_1 = require("@fluidframework/merge-tree/internal");
|
|
9
9
|
/**
|
|
10
10
|
* Values are used in persisted formats (ops).
|
|
@@ -75,18 +75,31 @@ exports.IntervalStickiness = {
|
|
|
75
75
|
*/
|
|
76
76
|
FULL: 0b11,
|
|
77
77
|
};
|
|
78
|
-
function startReferenceSlidingPreference(
|
|
78
|
+
function startReferenceSlidingPreference(startPos, startSide, endPos, endSide) {
|
|
79
|
+
const stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);
|
|
79
80
|
// if any start stickiness, prefer sliding backwards
|
|
80
81
|
return (stickiness & exports.IntervalStickiness.START) === 0
|
|
81
82
|
? internal_1.SlidingPreference.FORWARD
|
|
82
83
|
: internal_1.SlidingPreference.BACKWARD;
|
|
83
84
|
}
|
|
84
85
|
exports.startReferenceSlidingPreference = startReferenceSlidingPreference;
|
|
85
|
-
function endReferenceSlidingPreference(
|
|
86
|
+
function endReferenceSlidingPreference(startPos, startSide, endPos, endSide) {
|
|
87
|
+
const stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);
|
|
86
88
|
// if any end stickiness, prefer sliding forwards
|
|
87
89
|
return (stickiness & exports.IntervalStickiness.END) === 0
|
|
88
90
|
? internal_1.SlidingPreference.BACKWARD
|
|
89
91
|
: internal_1.SlidingPreference.FORWARD;
|
|
90
92
|
}
|
|
91
93
|
exports.endReferenceSlidingPreference = endReferenceSlidingPreference;
|
|
94
|
+
function computeStickinessFromSide(startPos, startSide, endPos, endSide) {
|
|
95
|
+
let stickiness = exports.IntervalStickiness.NONE;
|
|
96
|
+
if (startSide === internal_1.Side.After || startPos === "start") {
|
|
97
|
+
stickiness |= exports.IntervalStickiness.START;
|
|
98
|
+
}
|
|
99
|
+
if (endSide === internal_1.Side.Before || endPos === "end") {
|
|
100
|
+
stickiness |= exports.IntervalStickiness.END;
|
|
101
|
+
}
|
|
102
|
+
return stickiness;
|
|
103
|
+
}
|
|
104
|
+
exports.computeStickinessFromSide = computeStickinessFromSide;
|
|
92
105
|
//# sourceMappingURL=intervalUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalUtils.js","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,kEAK6C;AA+D7C;;;GAGG;AACU,QAAA,mBAAmB,GAAG;IAClC,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACP,CAAC;AAKX;;;;GAIG;AACU,QAAA,cAAc,GAAG;IAC7B,GAAG,2BAAmB;IACtB,gBAAgB,EAAE,iBAAiB;IACnC,eAAe,EAAE,gBAAgB;CACxB,CAAC;AAOX;;;GAGG;AACH,IAAY,YAgBX;AAhBD,WAAY,YAAY;IACvB,mDAAY,CAAA;IAEZ;;;;;OAKG;IACH,iEAAmB,CAAA;IAEnB;;;OAGG;IACH,yDAAe,CAAA;AAChB,CAAC,EAhBW,YAAY,4BAAZ,YAAY,QAgBvB;AA+FD;;;;;;;;;GASG;AACU,QAAA,kBAAkB,GAAG;IACjC;;OAEG;IACH,IAAI,EAAE,IAAI;IAEV;;OAEG;IACH,KAAK,EAAE,IAAI;IAEX;;;;OAIG;IACH,GAAG,EAAE,IAAI;IAET;;OAEG;IACH,IAAI,EAAE,IAAI;CACD,CAAC;AAaX,SAAgB,+BAA+B,CAC9C,UAA8B;IAE9B,oDAAoD;IACpD,OAAO,CAAC,UAAU,GAAG,0BAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;QACnD,CAAC,CAAC,4BAAiB,CAAC,OAAO;QAC3B,CAAC,CAAC,4BAAiB,CAAC,QAAQ,CAAC;AAC/B,CAAC;AAPD,0EAOC;AAED,SAAgB,6BAA6B,CAC5C,UAA8B;IAE9B,iDAAiD;IACjD,OAAO,CAAC,UAAU,GAAG,0BAAkB,CAAC,GAAG,CAAC,KAAK,CAAC;QACjD,CAAC,CAAC,4BAAiB,CAAC,QAAQ;QAC5B,CAAC,CAAC,4BAAiB,CAAC,OAAO,CAAC;AAC9B,CAAC;AAPD,sEAOC","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 { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tPropertySet,\n\tSlidingPreference,\n\tSequencePlace,\n\tSide,\n} from \"@fluidframework/merge-tree/internal\";\n\n/**\n * Basic interval abstraction\n * @legacy\n * @alpha\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t *\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t * @privateRemarks Move to ISerializableInterval after deprecation period\n\t */\n\tclone(): IInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: IInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: IInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t *\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t */\n\tmodify(\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,\n\t): IInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: IInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t * @privateRemarks Move to ISerializableInterval after deprecation period\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\n/**\n * Values are used in persisted formats (ops).\n * @internal\n */\nexport const IntervalDeltaOpType = {\n\tADD: \"add\",\n\tDELETE: \"delete\",\n\tCHANGE: \"change\",\n} as const;\n\nexport type IntervalDeltaOpType =\n\t(typeof IntervalDeltaOpType)[keyof typeof IntervalDeltaOpType];\n\n/**\n * Values are used in revertibles.\n * @legacy\n * @alpha\n */\nexport const IntervalOpType = {\n\t...IntervalDeltaOpType,\n\tPROPERTY_CHANGED: \"propertyChanged\",\n\tPOSITION_REMOVE: \"positionRemove\",\n} as const;\n/**\n * @legacy\n * @alpha\n */\nexport type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];\n\n/**\n * @legacy\n * @alpha\n */\nexport enum IntervalType {\n\tSimple = 0x0,\n\n\t/**\n\t * SlideOnRemove indicates that the ends of the interval will slide if the segment\n\t * they reference is removed and acked.\n\t * See `packages\\dds\\merge-tree\\docs\\REFERENCEPOSITIONS.md` for details\n\t * SlideOnRemove is the default interval behavior and does not need to be specified.\n\t */\n\tSlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove\n\n\t/**\n\t * A temporary interval, used internally\n\t * @internal\n\t */\n\tTransient = 0x4,\n}\n\n/**\n * Serialized object representation of an interval.\n * This representation is used for ops that create or change intervals.\n * @legacy\n * @alpha\n */\nexport interface ISerializedInterval {\n\t/**\n\t * Sequence number at which `start` and `end` should be interpreted\n\t *\n\t * @remarks It's unclear that this is necessary to store here.\n\t * This should just be the refSeq on the op that modified the interval, which should be available via other means.\n\t * At the time of writing, it's not plumbed through to the reconnect/rebase code, however, which does need it.\n\t */\n\tsequenceNumber: number;\n\t/** Start position of the interval */\n\tstart: number | \"start\" | \"end\";\n\t/** End position of the interval */\n\tend: number | \"start\" | \"end\";\n\t/** Interval type to create */\n\tintervalType: IntervalType;\n\t/**\n\t * The stickiness of this interval\n\t */\n\tstickiness?: IntervalStickiness;\n\tstartSide?: Side;\n\tendSide?: Side;\n\t/** Any properties the interval has */\n\tproperties?: PropertySet;\n}\n\n/**\n * @legacy\n * @alpha\n * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n * @privateRemarks Remove from external exports, and replace usages of IInterval with this interface after deprecation period\n */\nexport interface ISerializableInterval extends IInterval {\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\n\t/**\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t */\n\tserialize(): ISerializedInterval;\n\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t */\n\tgetIntervalId(): string;\n}\n\n/**\n * Represents a change that should be applied to an existing interval.\n * Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.\n * @internal\n */\nexport type SerializedIntervalDelta = Omit<\n\tISerializedInterval,\n\t\"start\" | \"end\" | \"properties\"\n> &\n\tPartial<Pick<ISerializedInterval, \"start\" | \"end\" | \"properties\">>;\n\n/**\n * A size optimization to avoid redundantly storing keys when serializing intervals\n * as JSON for summaries.\n *\n * Intervals are of the format:\n *\n * [\n * start,\n * end,\n * sequenceNumber,\n * intervalType,\n * properties,\n * stickiness?,\n * startSide?,\n * endSide?,\n * ]\n */\nexport type CompressedSerializedInterval =\n\t| [\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber,\n\t\t\tIntervalType,\n\t\t\tPropertySet,\n\t\t\tIntervalStickiness,\n\t ]\n\t| [number | \"start\" | \"end\", number | \"start\" | \"end\", number, IntervalType, PropertySet];\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n *\n * @legacy\n * @alpha\n */\nexport const IntervalStickiness = {\n\t/**\n\t * Interval does not expand to include adjacent segments\n\t */\n\tNONE: 0b00,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the start\n\t */\n\tSTART: 0b01,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the end\n\t *\n\t * This is the default stickiness\n\t */\n\tEND: 0b10,\n\n\t/**\n\t * Interval expands to include all segments inserted adjacent to it\n\t */\n\tFULL: 0b11,\n} as const;\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n * @legacy\n * @alpha\n */\nexport type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];\n\nexport function startReferenceSlidingPreference(\n\tstickiness: IntervalStickiness,\n): SlidingPreference {\n\t// if any start stickiness, prefer sliding backwards\n\treturn (stickiness & IntervalStickiness.START) === 0\n\t\t? SlidingPreference.FORWARD\n\t\t: SlidingPreference.BACKWARD;\n}\n\nexport function endReferenceSlidingPreference(\n\tstickiness: IntervalStickiness,\n): SlidingPreference {\n\t// if any end stickiness, prefer sliding forwards\n\treturn (stickiness & IntervalStickiness.END) === 0\n\t\t? SlidingPreference.BACKWARD\n\t\t: SlidingPreference.FORWARD;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"intervalUtils.js","sourceRoot":"","sources":["../../src/intervals/intervalUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,kEAK6C;AA+D7C;;;GAGG;AACU,QAAA,mBAAmB,GAAG;IAClC,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACP,CAAC;AAKX;;;;GAIG;AACU,QAAA,cAAc,GAAG;IAC7B,GAAG,2BAAmB;IACtB,gBAAgB,EAAE,iBAAiB;IACnC,eAAe,EAAE,gBAAgB;CACxB,CAAC;AAOX;;;GAGG;AACH,IAAY,YAgBX;AAhBD,WAAY,YAAY;IACvB,mDAAY,CAAA;IAEZ;;;;;OAKG;IACH,iEAAmB,CAAA;IAEnB;;;OAGG;IACH,yDAAe,CAAA;AAChB,CAAC,EAhBW,YAAY,4BAAZ,YAAY,QAgBvB;AA+FD;;;;;;;;;GASG;AACU,QAAA,kBAAkB,GAAG;IACjC;;OAEG;I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,CAAC,GAAG,CAAC;IACtC,CAAC;IAED,OAAO,UAAgC,CAAC;AACzC,CAAC;AAjBD,8DAiBC","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 { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tPropertySet,\n\tSlidingPreference,\n\tSequencePlace,\n\tSide,\n} from \"@fluidframework/merge-tree/internal\";\n\n/**\n * Basic interval abstraction\n * @legacy\n * @alpha\n */\nexport interface IInterval {\n\t/**\n\t * @returns a new interval object with identical semantics.\n\t *\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t * @privateRemarks Move to ISerializableInterval after deprecation period\n\t */\n\tclone(): IInterval;\n\t/**\n\t * Compares this interval to `b` with standard comparator semantics:\n\t * - returns -1 if this is less than `b`\n\t * - returns 1 if this is greater than `b`\n\t * - returns 0 if this is equivalent to `b`\n\t * @param b - Interval to compare against\n\t */\n\tcompare(b: IInterval): number;\n\t/**\n\t * Compares the start endpoint of this interval to `b`'s start endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareStart(b: IInterval): number;\n\t/**\n\t * Compares the end endpoint of this interval to `b`'s end endpoint.\n\t * Standard comparator semantics apply.\n\t * @param b - Interval to compare against\n\t */\n\tcompareEnd(b: IInterval): number;\n\t/**\n\t * Modifies one or more of the endpoints of this interval, returning a new interval representing the result.\n\t *\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t */\n\tmodify(\n\t\tlabel: string,\n\t\tstart: SequencePlace | undefined,\n\t\tend: SequencePlace | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t\tcanSlideToEndpoint?: boolean,\n\t): IInterval | undefined;\n\t/**\n\t * @returns whether this interval overlaps with `b`.\n\t * Intervals are considered to overlap if their intersection is non-empty.\n\t */\n\toverlaps(b: IInterval): boolean;\n\t/**\n\t * Unions this interval with `b`, returning a new interval.\n\t * The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes\n\t * intermediate values between the two intervals.\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t * @privateRemarks Move to ISerializableInterval after deprecation period\n\t */\n\tunion(b: IInterval): IInterval;\n}\n\n/**\n * Values are used in persisted formats (ops).\n * @internal\n */\nexport const IntervalDeltaOpType = {\n\tADD: \"add\",\n\tDELETE: \"delete\",\n\tCHANGE: \"change\",\n} as const;\n\nexport type IntervalDeltaOpType =\n\t(typeof IntervalDeltaOpType)[keyof typeof IntervalDeltaOpType];\n\n/**\n * Values are used in revertibles.\n * @legacy\n * @alpha\n */\nexport const IntervalOpType = {\n\t...IntervalDeltaOpType,\n\tPROPERTY_CHANGED: \"propertyChanged\",\n\tPOSITION_REMOVE: \"positionRemove\",\n} as const;\n/**\n * @legacy\n * @alpha\n */\nexport type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];\n\n/**\n * @legacy\n * @alpha\n */\nexport enum IntervalType {\n\tSimple = 0x0,\n\n\t/**\n\t * SlideOnRemove indicates that the ends of the interval will slide if the segment\n\t * they reference is removed and acked.\n\t * See `packages\\dds\\merge-tree\\docs\\REFERENCEPOSITIONS.md` for details\n\t * SlideOnRemove is the default interval behavior and does not need to be specified.\n\t */\n\tSlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove\n\n\t/**\n\t * A temporary interval, used internally\n\t * @internal\n\t */\n\tTransient = 0x4,\n}\n\n/**\n * Serialized object representation of an interval.\n * This representation is used for ops that create or change intervals.\n * @legacy\n * @alpha\n */\nexport interface ISerializedInterval {\n\t/**\n\t * Sequence number at which `start` and `end` should be interpreted\n\t *\n\t * @remarks It's unclear that this is necessary to store here.\n\t * This should just be the refSeq on the op that modified the interval, which should be available via other means.\n\t * At the time of writing, it's not plumbed through to the reconnect/rebase code, however, which does need it.\n\t */\n\tsequenceNumber: number;\n\t/** Start position of the interval */\n\tstart: number | \"start\" | \"end\";\n\t/** End position of the interval */\n\tend: number | \"start\" | \"end\";\n\t/** Interval type to create */\n\tintervalType: IntervalType;\n\t/**\n\t * The stickiness of this interval\n\t */\n\tstickiness?: IntervalStickiness;\n\tstartSide?: Side;\n\tendSide?: Side;\n\t/** Any properties the interval has */\n\tproperties?: PropertySet;\n}\n\n/**\n * @legacy\n * @alpha\n * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n * @privateRemarks Remove from external exports, and replace usages of IInterval with this interface after deprecation period\n */\nexport interface ISerializableInterval extends IInterval {\n\t/** Serializable bag of properties associated with the interval. */\n\tproperties: PropertySet;\n\n\t/**\n\t * @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release\n\t */\n\tserialize(): ISerializedInterval;\n\n\t/**\n\t * Gets the id associated with this interval.\n\t * When the interval is used as part of an interval collection, this id can be used to modify or remove the\n\t * interval.\n\t */\n\tgetIntervalId(): string;\n}\n\n/**\n * Represents a change that should be applied to an existing interval.\n * Changes can modify any of start/end/properties, with `undefined` signifying no change should be made.\n * @internal\n */\nexport type SerializedIntervalDelta = Omit<\n\tISerializedInterval,\n\t\"start\" | \"end\" | \"properties\"\n> &\n\tPartial<Pick<ISerializedInterval, \"start\" | \"end\" | \"properties\">>;\n\n/**\n * A size optimization to avoid redundantly storing keys when serializing intervals\n * as JSON for summaries.\n *\n * Intervals are of the format:\n *\n * [\n * start,\n * end,\n * sequenceNumber,\n * intervalType,\n * properties,\n * stickiness?,\n * startSide?,\n * endSide?,\n * ]\n */\nexport type CompressedSerializedInterval =\n\t| [\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber | \"start\" | \"end\",\n\t\t\tnumber,\n\t\t\tIntervalType,\n\t\t\tPropertySet,\n\t\t\tIntervalStickiness,\n\t ]\n\t| [number | \"start\" | \"end\", number | \"start\" | \"end\", number, IntervalType, PropertySet];\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n *\n * @legacy\n * @alpha\n */\nexport const IntervalStickiness = {\n\t/**\n\t * Interval does not expand to include adjacent segments\n\t */\n\tNONE: 0b00,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the start\n\t */\n\tSTART: 0b01,\n\n\t/**\n\t * Interval expands to include segments inserted adjacent to the end\n\t *\n\t * This is the default stickiness\n\t */\n\tEND: 0b10,\n\n\t/**\n\t * Interval expands to include all segments inserted adjacent to it\n\t */\n\tFULL: 0b11,\n} as const;\n\n/**\n * Determines how an interval should expand when segments are inserted adjacent\n * to the range it spans\n *\n * Note that interval stickiness is currently an experimental feature and must\n * be explicitly enabled with the `intervalStickinessEnabled` flag\n * @legacy\n * @alpha\n */\nexport type IntervalStickiness = (typeof IntervalStickiness)[keyof typeof IntervalStickiness];\n\nexport function startReferenceSlidingPreference(\n\tstartPos: number | \"start\" | \"end\" | undefined,\n\tstartSide: Side,\n\tendPos: number | \"start\" | \"end\" | undefined,\n\tendSide: Side,\n): SlidingPreference {\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\t// if any start stickiness, prefer sliding backwards\n\treturn (stickiness & IntervalStickiness.START) === 0\n\t\t? SlidingPreference.FORWARD\n\t\t: SlidingPreference.BACKWARD;\n}\n\nexport function endReferenceSlidingPreference(\n\tstartPos: number | \"start\" | \"end\" | undefined,\n\tstartSide: Side,\n\tendPos: number | \"start\" | \"end\" | undefined,\n\tendSide: Side,\n): SlidingPreference {\n\tconst stickiness = computeStickinessFromSide(startPos, startSide, endPos, endSide);\n\n\t// if any end stickiness, prefer sliding forwards\n\treturn (stickiness & IntervalStickiness.END) === 0\n\t\t? SlidingPreference.BACKWARD\n\t\t: SlidingPreference.FORWARD;\n}\n\nexport function computeStickinessFromSide(\n\tstartPos: number | \"start\" | \"end\" | undefined,\n\tstartSide: Side,\n\tendPos: number | \"start\" | \"end\" | undefined,\n\tendSide: Side,\n): IntervalStickiness {\n\tlet stickiness: IntervalStickiness = IntervalStickiness.NONE;\n\n\tif (startSide === Side.After || startPos === \"start\") {\n\t\tstickiness |= IntervalStickiness.START;\n\t}\n\n\tif (endSide === Side.Before || endPos === \"end\") {\n\t\tstickiness |= IntervalStickiness.END;\n\t}\n\n\treturn stickiness as IntervalStickiness;\n}\n"]}
|
|
@@ -81,7 +81,7 @@ export interface SequenceInterval extends ISerializableInterval {
|
|
|
81
81
|
* Modifies one or more of the endpoints of this interval, returning a new interval representing the result.
|
|
82
82
|
* @deprecated This api is not meant or necessary for external consumption and will be removed in subsequent release
|
|
83
83
|
*/
|
|
84
|
-
modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number,
|
|
84
|
+
modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, canSlideToEndpoint?: boolean): SequenceInterval | undefined;
|
|
85
85
|
/**
|
|
86
86
|
* @returns whether this interval overlaps with `b`.
|
|
87
87
|
* Intervals are considered to overlap if their intersection is non-empty.
|
|
@@ -200,16 +200,30 @@ export declare class SequenceIntervalClass implements SequenceInterval, ISeriali
|
|
|
200
200
|
* @returns whether this interval overlaps two numerical positions.
|
|
201
201
|
*/
|
|
202
202
|
overlapsPos(bstart: number, bend: number): boolean;
|
|
203
|
+
moveEndpointReferences(rebased: Partial<Record<"start" | "end", {
|
|
204
|
+
segment: ISegment;
|
|
205
|
+
offset: number;
|
|
206
|
+
}>>): void;
|
|
203
207
|
/**
|
|
204
208
|
* {@inheritDoc IInterval.modify}
|
|
205
209
|
*/
|
|
206
|
-
modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number,
|
|
210
|
+
modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, canSlideToEndpoint?: boolean): SequenceIntervalClass;
|
|
207
211
|
ackPropertiesChange(newProps: PropertySet, op: ISequencedDocumentMessage): void;
|
|
208
212
|
}
|
|
209
|
-
export declare function createPositionReferenceFromSegoff(client
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
+
export declare function createPositionReferenceFromSegoff({ client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, canSlideToEndpoint, rollback, }: {
|
|
214
|
+
client: Client;
|
|
215
|
+
segoff: {
|
|
216
|
+
segment: ISegment;
|
|
217
|
+
offset: number;
|
|
218
|
+
} | undefined | "start" | "end";
|
|
219
|
+
refType: ReferenceType;
|
|
220
|
+
op?: ISequencedDocumentMessage;
|
|
221
|
+
localSeq?: number;
|
|
222
|
+
fromSnapshot?: boolean;
|
|
223
|
+
slidingPreference: SlidingPreference | undefined;
|
|
224
|
+
canSlideToEndpoint: boolean | undefined;
|
|
225
|
+
rollback?: boolean;
|
|
226
|
+
}): LocalReferencePosition;
|
|
213
227
|
export declare function createTransientInterval(start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client): SequenceIntervalClass;
|
|
214
|
-
export declare function createSequenceInterval(label: string, id: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean,
|
|
228
|
+
export declare function createSequenceInterval(label: string, id: string, start: SequencePlace | undefined, end: SequencePlace | undefined, client: Client, intervalType: IntervalType, op?: ISequencedDocumentMessage, fromSnapshot?: boolean, canSlideToEndpoint?: boolean, props?: PropertySet, rollback?: boolean): SequenceIntervalClass;
|
|
215
229
|
//# sourceMappingURL=sequenceInterval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceInterval.d.ts","sourceRoot":"","sources":["../../src/intervals/sequenceInterval.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EACN,MAAM,EACN,QAAQ,EACR,sBAAsB,EAEt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,EACV,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,GAAG,EAAE,aAAa,GAAG,SAAS,EAC9B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,EAAE,CAAC,EAAE,yBAAyB,EAC9B,YAAY,CAAC,EAAE,OAAO,EACtB,kBAAkB,GAAE,OAAe,EACnC,KAAK,CAAC,EAAE,WAAW,EACnB,QAAQ,CAAC,EAAE,OAAO,GAChB,qBAAqB,CAwFvB"}
|
|
@@ -16,7 +16,6 @@ const internal_1 = require("@fluidframework/core-utils/internal");
|
|
|
16
16
|
const internal_2 = require("@fluidframework/merge-tree/internal");
|
|
17
17
|
const internal_3 = require("@fluidframework/telemetry-utils/internal");
|
|
18
18
|
const uuid_1 = require("uuid");
|
|
19
|
-
const intervalCollection_js_1 = require("../intervalCollection.js");
|
|
20
19
|
const intervalUtils_js_1 = require("./intervalUtils.js");
|
|
21
20
|
function compareSides(sideA, sideB) {
|
|
22
21
|
if (sideA === sideB) {
|
|
@@ -69,7 +68,7 @@ class SequenceIntervalClass {
|
|
|
69
68
|
get stickiness() {
|
|
70
69
|
const startSegment = this.start.getSegment();
|
|
71
70
|
const endSegment = this.end.getSegment();
|
|
72
|
-
return (0,
|
|
71
|
+
return (0, intervalUtils_js_1.computeStickinessFromSide)(startSegment?.endpointType, this.startSide, endSegment?.endpointType, this.endSide);
|
|
73
72
|
}
|
|
74
73
|
constructor(client, id, label,
|
|
75
74
|
/**
|
|
@@ -250,14 +249,39 @@ class SequenceIntervalClass {
|
|
|
250
249
|
const endPos = this.client.localReferencePositionToPosition(this.end);
|
|
251
250
|
return endPos > bstart && startPos < bend;
|
|
252
251
|
}
|
|
252
|
+
moveEndpointReferences(rebased) {
|
|
253
|
+
if (rebased.start) {
|
|
254
|
+
const startRef = createPositionReferenceFromSegoff({
|
|
255
|
+
client: this.client,
|
|
256
|
+
segoff: rebased.start,
|
|
257
|
+
refType: this.start.refType,
|
|
258
|
+
slidingPreference: this.start.slidingPreference,
|
|
259
|
+
canSlideToEndpoint: this.start.canSlideToEndpoint,
|
|
260
|
+
});
|
|
261
|
+
if (this.start.properties) {
|
|
262
|
+
startRef.addProperties(this.start.properties);
|
|
263
|
+
}
|
|
264
|
+
this.start = startRef;
|
|
265
|
+
}
|
|
266
|
+
if (rebased.end) {
|
|
267
|
+
const endRef = createPositionReferenceFromSegoff({
|
|
268
|
+
client: this.client,
|
|
269
|
+
segoff: rebased.end,
|
|
270
|
+
refType: this.end.refType,
|
|
271
|
+
slidingPreference: this.end.slidingPreference,
|
|
272
|
+
canSlideToEndpoint: this.end.canSlideToEndpoint,
|
|
273
|
+
});
|
|
274
|
+
if (this.end.properties) {
|
|
275
|
+
endRef.addProperties(this.end.properties);
|
|
276
|
+
}
|
|
277
|
+
this.end = endRef;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
253
280
|
/**
|
|
254
281
|
* {@inheritDoc IInterval.modify}
|
|
255
282
|
*/
|
|
256
|
-
modify(label, start, end, op, localSeq,
|
|
283
|
+
modify(label, start, end, op, localSeq, canSlideToEndpoint = false) {
|
|
257
284
|
const { startSide, endSide, startPos, endPos } = (0, internal_2.endpointPosAndSide)(start, end);
|
|
258
|
-
const startSegment = this.start.getSegment();
|
|
259
|
-
const endSegment = this.end.getSegment();
|
|
260
|
-
const stickiness = (0, intervalCollection_js_1.computeStickinessFromSide)(startPos ?? startSegment?.endpointType, startSide ?? this.startSide, endPos ?? endSegment?.endpointType, endSide ?? this.endSide);
|
|
261
285
|
const getRefType = (baseType) => {
|
|
262
286
|
let refType = baseType;
|
|
263
287
|
if (op === undefined) {
|
|
@@ -268,14 +292,32 @@ class SequenceIntervalClass {
|
|
|
268
292
|
};
|
|
269
293
|
let startRef = this.start;
|
|
270
294
|
if (startPos !== undefined) {
|
|
271
|
-
|
|
295
|
+
const slidingPreference = (0, intervalUtils_js_1.startReferenceSlidingPreference)(startPos, startSide ?? internal_2.Side.Before, endPos, endSide ?? internal_2.Side.Before);
|
|
296
|
+
startRef = createPositionReference({
|
|
297
|
+
client: this.client,
|
|
298
|
+
pos: startPos,
|
|
299
|
+
refType: getRefType(this.start.refType),
|
|
300
|
+
op,
|
|
301
|
+
localSeq,
|
|
302
|
+
slidingPreference,
|
|
303
|
+
canSlideToEndpoint: canSlideToEndpoint && slidingPreference === internal_2.SlidingPreference.BACKWARD,
|
|
304
|
+
});
|
|
272
305
|
if (this.start.properties) {
|
|
273
306
|
startRef.addProperties(this.start.properties);
|
|
274
307
|
}
|
|
275
308
|
}
|
|
276
309
|
let endRef = this.end;
|
|
277
310
|
if (endPos !== undefined) {
|
|
278
|
-
|
|
311
|
+
const slidingPreference = (0, intervalUtils_js_1.endReferenceSlidingPreference)(startPos, startSide ?? internal_2.Side.Before, endPos, endSide ?? internal_2.Side.Before);
|
|
312
|
+
endRef = createPositionReference({
|
|
313
|
+
client: this.client,
|
|
314
|
+
pos: endPos,
|
|
315
|
+
refType: getRefType(this.end.refType),
|
|
316
|
+
op,
|
|
317
|
+
localSeq,
|
|
318
|
+
slidingPreference,
|
|
319
|
+
canSlideToEndpoint: canSlideToEndpoint && slidingPreference === internal_2.SlidingPreference.FORWARD,
|
|
320
|
+
});
|
|
279
321
|
if (this.end.properties) {
|
|
280
322
|
endRef.addProperties(this.end.properties);
|
|
281
323
|
}
|
|
@@ -294,7 +336,7 @@ class SequenceIntervalClass {
|
|
|
294
336
|
}
|
|
295
337
|
exports.SequenceIntervalClass = SequenceIntervalClass;
|
|
296
338
|
_SequenceIntervalClass_props = new WeakMap();
|
|
297
|
-
function createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, canSlideToEndpoint, rollback) {
|
|
339
|
+
function createPositionReferenceFromSegoff({ client, segoff, refType, op, localSeq, fromSnapshot, slidingPreference, canSlideToEndpoint, rollback, }) {
|
|
298
340
|
if (segoff === "start" || segoff === "end") {
|
|
299
341
|
return client.createLocalReferencePosition(segoff, undefined, refType, undefined, slidingPreference, canSlideToEndpoint);
|
|
300
342
|
}
|
|
@@ -317,7 +359,7 @@ function createPositionReferenceFromSegoff(client, segoff, refType, op, localSeq
|
|
|
317
359
|
return (0, internal_2.createDetachedLocalReferencePosition)(slidingPreference, refType);
|
|
318
360
|
}
|
|
319
361
|
exports.createPositionReferenceFromSegoff = createPositionReferenceFromSegoff;
|
|
320
|
-
function createPositionReference(client, pos, refType, op, fromSnapshot, localSeq, slidingPreference,
|
|
362
|
+
function createPositionReference({ client, pos, refType, op, fromSnapshot, localSeq, slidingPreference, canSlideToEndpoint, rollback, }) {
|
|
321
363
|
let segoff;
|
|
322
364
|
if (op) {
|
|
323
365
|
(0, internal_1.assert)((refType & internal_2.ReferenceType.SlideOnRemove) !== 0, 0x2f5 /* op create references must be SlideOnRemove */);
|
|
@@ -329,7 +371,7 @@ function createPositionReference(client, pos, refType, op, fromSnapshot, localSe
|
|
|
329
371
|
referenceSequenceNumber: op.referenceSequenceNumber,
|
|
330
372
|
clientId: op.clientId,
|
|
331
373
|
});
|
|
332
|
-
segoff = (0, internal_2.getSlideToSegoff)(segoff, slidingPreference, undefined,
|
|
374
|
+
segoff = (0, internal_2.getSlideToSegoff)(segoff, slidingPreference, undefined, canSlideToEndpoint);
|
|
333
375
|
}
|
|
334
376
|
}
|
|
335
377
|
else {
|
|
@@ -339,19 +381,28 @@ function createPositionReference(client, pos, refType, op, fromSnapshot, localSe
|
|
|
339
381
|
? pos
|
|
340
382
|
: client.getContainingSegment(pos, undefined, localSeq);
|
|
341
383
|
}
|
|
342
|
-
return createPositionReferenceFromSegoff(
|
|
384
|
+
return createPositionReferenceFromSegoff({
|
|
385
|
+
client,
|
|
386
|
+
segoff,
|
|
387
|
+
refType,
|
|
388
|
+
op,
|
|
389
|
+
localSeq,
|
|
390
|
+
fromSnapshot,
|
|
391
|
+
slidingPreference,
|
|
392
|
+
canSlideToEndpoint,
|
|
393
|
+
rollback,
|
|
394
|
+
});
|
|
343
395
|
}
|
|
344
396
|
function createTransientInterval(start, end, client) {
|
|
345
397
|
return createSequenceInterval("transient", (0, uuid_1.v4)(), start, end, client, intervalUtils_js_1.IntervalType.Transient);
|
|
346
398
|
}
|
|
347
399
|
exports.createTransientInterval = createTransientInterval;
|
|
348
|
-
function createSequenceInterval(label, id, start, end, client, intervalType, op, fromSnapshot,
|
|
400
|
+
function createSequenceInterval(label, id, start, end, client, intervalType, op, fromSnapshot, canSlideToEndpoint = false, props, rollback) {
|
|
349
401
|
const { startPos, startSide, endPos, endSide } = (0, internal_2.endpointPosAndSide)(start ?? "start", end ?? "end");
|
|
350
402
|
(0, internal_1.assert)(startPos !== undefined &&
|
|
351
403
|
endPos !== undefined &&
|
|
352
404
|
startSide !== undefined &&
|
|
353
405
|
endSide !== undefined, 0x794 /* start and end cannot be undefined because they were not passed in as undefined */);
|
|
354
|
-
const stickiness = (0, intervalCollection_js_1.computeStickinessFromSide)(startPos, startSide, endPos, endSide);
|
|
355
406
|
let beginRefType = internal_2.ReferenceType.RangeBegin;
|
|
356
407
|
let endRefType = internal_2.ReferenceType.RangeEnd;
|
|
357
408
|
if (intervalType === intervalUtils_js_1.IntervalType.Transient) {
|
|
@@ -371,8 +422,29 @@ function createSequenceInterval(label, id, start, end, client, intervalType, op,
|
|
|
371
422
|
endRefType |= internal_2.ReferenceType.StayOnRemove;
|
|
372
423
|
}
|
|
373
424
|
}
|
|
374
|
-
const
|
|
375
|
-
const
|
|
425
|
+
const stickiness = (0, intervalUtils_js_1.computeStickinessFromSide)(startPos, startSide, endPos, endSide);
|
|
426
|
+
const startSlidingPreference = (0, intervalUtils_js_1.startReferenceSlidingPreference)(startPos, startSide, endPos, endSide);
|
|
427
|
+
const startLref = createPositionReference({
|
|
428
|
+
client,
|
|
429
|
+
pos: startPos,
|
|
430
|
+
refType: beginRefType,
|
|
431
|
+
op,
|
|
432
|
+
fromSnapshot,
|
|
433
|
+
slidingPreference: startSlidingPreference,
|
|
434
|
+
canSlideToEndpoint: canSlideToEndpoint && stickiness !== intervalUtils_js_1.IntervalStickiness.NONE,
|
|
435
|
+
rollback,
|
|
436
|
+
});
|
|
437
|
+
const endSlidingPreference = (0, intervalUtils_js_1.endReferenceSlidingPreference)(startPos, startSide, endPos, endSide);
|
|
438
|
+
const endLref = createPositionReference({
|
|
439
|
+
client,
|
|
440
|
+
pos: endPos,
|
|
441
|
+
refType: endRefType,
|
|
442
|
+
op,
|
|
443
|
+
fromSnapshot,
|
|
444
|
+
slidingPreference: endSlidingPreference,
|
|
445
|
+
canSlideToEndpoint: canSlideToEndpoint && stickiness !== intervalUtils_js_1.IntervalStickiness.NONE,
|
|
446
|
+
rollback,
|
|
447
|
+
});
|
|
376
448
|
const rangeProp = {
|
|
377
449
|
[internal_2.reservedRangeLabelsKey]: [label],
|
|
378
450
|
};
|