@fluidframework/merge-tree 0.49.0-39015 → 0.49.0-39313
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/mergeTree.d.ts +7 -1
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +1 -1
- package/dist/mergeTree.js.map +1 -1
- package/dist/opBuilder.d.ts +1 -1
- package/dist/opBuilder.js +1 -1
- package/dist/opBuilder.js.map +1 -1
- package/dist/sortedSegmentSet.js +4 -4
- package/dist/sortedSegmentSet.js.map +1 -1
- package/lib/client.d.ts +1 -1
- package/lib/client.js +1 -1
- package/lib/client.js.map +1 -1
- package/lib/mergeTree.d.ts +7 -1
- package/lib/mergeTree.d.ts.map +1 -1
- package/lib/mergeTree.js +1 -1
- package/lib/mergeTree.js.map +1 -1
- package/lib/opBuilder.d.ts +1 -1
- package/lib/opBuilder.js +1 -1
- package/lib/opBuilder.js.map +1 -1
- package/lib/sortedSegmentSet.js +4 -4
- package/lib/sortedSegmentSet.js.map +1 -1
- package/package.json +7 -7
- package/src/client.ts +1 -1
- package/src/mergeTree.ts +7 -1
- package/src/opBuilder.ts +1 -1
- package/src/sortedSegmentSet.ts +4 -4
package/lib/opBuilder.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { PropertySet } from "./properties";
|
|
|
15
15
|
export declare function createAnnotateMarkerOp(marker: Marker, props: PropertySet, combiningOp: ICombiningOp): IMergeTreeAnnotateMsg | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Creates the op for annotating the range with the provided properties
|
|
18
|
-
* @param start - The inclusive start
|
|
18
|
+
* @param start - The inclusive start position of the range to annotate
|
|
19
19
|
* @param end - The exclusive end position of the range to annotate
|
|
20
20
|
* @param props - The properties to annotate the range with
|
|
21
21
|
* @param combiningOp - Optional. Specifies how to combine values for the property, such as "incr" for increment.
|
package/lib/opBuilder.js
CHANGED
|
@@ -24,7 +24,7 @@ export function createAnnotateMarkerOp(marker, props, combiningOp) {
|
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Creates the op for annotating the range with the provided properties
|
|
27
|
-
* @param start - The inclusive start
|
|
27
|
+
* @param start - The inclusive start position of the range to annotate
|
|
28
28
|
* @param end - The exclusive end position of the range to annotate
|
|
29
29
|
* @param props - The properties to annotate the range with
|
|
30
30
|
* @param combiningOp - Optional. Specifies how to combine values for the property, such as "incr" for increment.
|
package/lib/opBuilder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opBuilder.js","sourceRoot":"","sources":["../src/opBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAClC,MAAc,EAAE,KAAkB,EAAE,WAAyB;IAC7D,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,EAAE;QACL,OAAO,SAAS,CAAC;KACpB;IAED,OAAO;QACH,WAAW;QACX,KAAK;QACL,YAAY,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;QAClC,YAAY,EAAE,EAAE,EAAE,EAAE;QACpB,IAAI,kBAA6B;KACpC,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACjC,KAAa,EAAE,GAAW,EAAE,KAAkB,EAAE,WAAqC;IACrF,OAAO;QACH,WAAW;QACX,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,KAAK;QACL,IAAI,kBAA6B;KACpC,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,GAAW,EAAE,QAAiB;IAC7E,OAAO;QACH,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,QAAQ;QACR,IAAI,gBAA2B;KAClC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW,EAAE,OAAiB;IAChE,OAAO,cAAc,CACjB,GAAG,EACH,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAY;IACpD,OAAO;QACH,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,OAAO;QACZ,IAAI,gBAA2B;KAClC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,GAAW,EAAE,QAAgB;IACpE,OAAO;QACH,IAAI,EAAE,GAAG;QACT,QAAQ;QACR,IAAI,gBAA2B;KAClC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAa,EAAE,GAAW,EAAE,QAAgB;IACjF,OAAO;QACH,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,QAAQ;QACR,IAAI,gBAA2B;KAClC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CACzB,GAAG,GAAwB;IAC3B,OAAO;QACH,GAAG;QACH,IAAI,eAA0B;KACjC,CAAC;AACN,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISegment, Marker } from \"./mergeTree\";\nimport {\n ICombiningOp,\n IMergeTreeAnnotateMsg,\n IMergeTreeGroupMsg,\n IMergeTreeInsertMsg,\n IMergeTreeRemoveMsg,\n MergeTreeDeltaType,\n IMergeTreeDeltaOp,\n} from \"./ops\";\nimport { PropertySet } from \"./properties\";\n\n/**\n * Creates the op for annotating the markers with the provided properties\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n * @returns The annotate op\n */\nexport function createAnnotateMarkerOp(\n marker: Marker, props: PropertySet, combiningOp: ICombiningOp): IMergeTreeAnnotateMsg | undefined {\n const id = marker.getId();\n if (!id) {\n return undefined;\n }\n\n return {\n combiningOp,\n props,\n relativePos1: { id, before: true },\n relativePos2: { id },\n type: MergeTreeDeltaType.ANNOTATE,\n };\n}\n\n/**\n * Creates the op for annotating the range with the provided properties\n * @param start - The inclusive start
|
|
1
|
+
{"version":3,"file":"opBuilder.js","sourceRoot":"","sources":["../src/opBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAClC,MAAc,EAAE,KAAkB,EAAE,WAAyB;IAC7D,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,EAAE;QACL,OAAO,SAAS,CAAC;KACpB;IAED,OAAO;QACH,WAAW;QACX,KAAK;QACL,YAAY,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;QAClC,YAAY,EAAE,EAAE,EAAE,EAAE;QACpB,IAAI,kBAA6B;KACpC,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACjC,KAAa,EAAE,GAAW,EAAE,KAAkB,EAAE,WAAqC;IACrF,OAAO;QACH,WAAW;QACX,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,KAAK;QACL,IAAI,kBAA6B;KACpC,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,GAAW,EAAE,QAAiB;IAC7E,OAAO;QACH,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,QAAQ;QACR,IAAI,gBAA2B;KAClC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW,EAAE,OAAiB;IAChE,OAAO,cAAc,CACjB,GAAG,EACH,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAY;IACpD,OAAO;QACH,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,OAAO;QACZ,IAAI,gBAA2B;KAClC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,GAAW,EAAE,QAAgB;IACpE,OAAO;QACH,IAAI,EAAE,GAAG;QACT,QAAQ;QACR,IAAI,gBAA2B;KAClC,CAAC;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAa,EAAE,GAAW,EAAE,QAAgB;IACjF,OAAO;QACH,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,QAAQ;QACR,IAAI,gBAA2B;KAClC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CACzB,GAAG,GAAwB;IAC3B,OAAO;QACH,GAAG;QACH,IAAI,eAA0B;KACjC,CAAC;AACN,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISegment, Marker } from \"./mergeTree\";\nimport {\n ICombiningOp,\n IMergeTreeAnnotateMsg,\n IMergeTreeGroupMsg,\n IMergeTreeInsertMsg,\n IMergeTreeRemoveMsg,\n MergeTreeDeltaType,\n IMergeTreeDeltaOp,\n} from \"./ops\";\nimport { PropertySet } from \"./properties\";\n\n/**\n * Creates the op for annotating the markers with the provided properties\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n * @returns The annotate op\n */\nexport function createAnnotateMarkerOp(\n marker: Marker, props: PropertySet, combiningOp: ICombiningOp): IMergeTreeAnnotateMsg | undefined {\n const id = marker.getId();\n if (!id) {\n return undefined;\n }\n\n return {\n combiningOp,\n props,\n relativePos1: { id, before: true },\n relativePos2: { id },\n type: MergeTreeDeltaType.ANNOTATE,\n };\n}\n\n/**\n * Creates the op for annotating the range with the provided properties\n * @param start - The inclusive start position of the range to annotate\n * @param end - The exclusive end position of the range to annotate\n * @param props - The properties to annotate the range with\n * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n * @returns The annotate op\n */\nexport function createAnnotateRangeOp(\n start: number, end: number, props: PropertySet, combiningOp: ICombiningOp | undefined): IMergeTreeAnnotateMsg {\n return {\n combiningOp,\n pos1: start,\n pos2: end,\n props,\n type: MergeTreeDeltaType.ANNOTATE,\n };\n}\n\n/**\n * Creates the op to remove a range and puts the content of the removed range in a register\n * if a register name is provided\n *\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to remove\n * @param register - Optional. The name of the register to store the removed range in\n */\nexport function createRemoveRangeOp(start: number, end: number, register?: string): IMergeTreeRemoveMsg {\n return {\n pos1: start,\n pos2: end,\n register,\n type: MergeTreeDeltaType.REMOVE,\n };\n}\n\n/**\n *\n * @param pos - The position to insert the segment at\n * @param segment - The segment to insert\n */\nexport function createInsertSegmentOp(pos: number, segment: ISegment): IMergeTreeInsertMsg {\n return createInsertOp(\n pos,\n segment.toJSONObject());\n}\n\nexport function createInsertOp(pos: number, segSpec: any): IMergeTreeInsertMsg {\n return {\n pos1: pos,\n seg: segSpec,\n type: MergeTreeDeltaType.INSERT,\n };\n}\n\n/**\n *\n * @param pos - The position to insert the register contents at\n * @param register - The name of the register to insert the value of\n */\nexport function createInsertFromRegisterOp(pos: number, register: string): IMergeTreeInsertMsg {\n return {\n pos1: pos,\n register,\n type: MergeTreeDeltaType.INSERT,\n };\n}\n\n/**\n *\n * @param start - The inclusive start of the range to insert into the register\n * @param end - The exclusive end of the range to insert into the register\n * @param register - The name of the register to insert the range contents into\n */\nexport function createInsertToRegisterOp(start: number, end: number, register: string): IMergeTreeInsertMsg {\n return {\n pos1: start,\n pos2: end,\n register,\n type: MergeTreeDeltaType.INSERT,\n };\n}\n\n/**\n *\n * @param ops - The ops to group\n */\nexport function createGroupOp(\n ...ops: IMergeTreeDeltaOp[]): IMergeTreeGroupMsg {\n return {\n ops,\n type: MergeTreeDeltaType.GROUP,\n };\n}\n"]}
|
package/lib/sortedSegmentSet.js
CHANGED
|
@@ -23,14 +23,14 @@ export class SortedSegmentSet {
|
|
|
23
23
|
return this.oridinalSortedItems;
|
|
24
24
|
}
|
|
25
25
|
addOrUpdate(newItem, update) {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
26
|
+
const position = this.findOrdinalPosition(this.getOrdinal(newItem));
|
|
27
|
+
if (position.exists) {
|
|
28
28
|
if (update) {
|
|
29
|
-
update(this.oridinalSortedItems[
|
|
29
|
+
update(this.oridinalSortedItems[position.index], newItem);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
this.oridinalSortedItems.splice(
|
|
33
|
+
this.oridinalSortedItems.splice(position.index, 0, newItem);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
remove(item) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortedSegmentSet.js","sourceRoot":"","sources":["../src/sortedSegmentSet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;GASG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QACqB,wBAAmB,GAAQ,EAAE,CAAC;IAkEnD,CAAC;IAhEG,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;IAC3C,CAAC;IAED,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;IAEM,WAAW,CAAC,OAAU,EAAE,MAA2C;QACtE,MAAM,
|
|
1
|
+
{"version":3,"file":"sortedSegmentSet.js","sourceRoot":"","sources":["../src/sortedSegmentSet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;GASG;AACH,MAAM,OAAO,gBAAgB;IAA7B;QACqB,wBAAmB,GAAQ,EAAE,CAAC;IAkEnD,CAAC;IAhEG,IAAW,IAAI;QACX,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IACnC,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISegment } from \"./mergeTree\";\n\n/**\n * Stores a unique and sorted set of segments, or objects with segments\n *\n * This differs from a normal sorted set in that the keys are not fixed.\n * The segments are sorted via their ordinals which can change as the merge tree is modified.\n * Eventhough the values of the ordinals can change their ordering and uniqueness cannot, so the order of a set of\n * segments ordered by their ordinals will always have the same order even if the ordinal values on\n * the segments changes. This invarient allows ensure the segments stay ordered and unique, and that new segments\n * can be inserted into that order.\n */\nexport class SortedSegmentSet<T extends ISegment | { readonly segment: ISegment } = ISegment> {\n private readonly oridinalSortedItems: T[] = [];\n\n public get size(): number {\n return this.oridinalSortedItems.length;\n }\n\n public get items(): readonly T[] {\n return this.oridinalSortedItems;\n }\n\n public addOrUpdate(newItem: T, update?: (existingItem: T, newItem: T) => T) {\n const position = this.findOrdinalPosition(this.getOrdinal(newItem));\n if (position.exists) {\n if (update) {\n update(this.oridinalSortedItems[position.index], newItem);\n }\n } else {\n this.oridinalSortedItems.splice(position.index, 0, newItem);\n }\n }\n\n public remove(item: T): boolean {\n const position = this.findOrdinalPosition(this.getOrdinal(item));\n if (position.exists) {\n this.oridinalSortedItems.splice(position.index, 1);\n return true;\n }\n return false;\n }\n\n public has(item: T): boolean {\n const position = this.findOrdinalPosition(this.getOrdinal(item));\n return position.exists;\n }\n\n private getOrdinal(item: T): string {\n const maybeObject = item as { readonly segment: ISegment };\n if (maybeObject && maybeObject.segment) {\n return maybeObject.segment.ordinal;\n }\n\n const maybeSegment = item as ISegment;\n return maybeSegment.ordinal;\n }\n\n private findOrdinalPosition(ordinal: string, start?: number, end?: number): { exists: boolean, index: number } {\n if (this.oridinalSortedItems.length === 0) {\n return { exists: false, index: 0 };\n }\n if (start === undefined || end === undefined) {\n return this.findOrdinalPosition(ordinal, 0, this.oridinalSortedItems.length - 1);\n }\n const index = start + Math.floor((end - start) / 2);\n if (this.getOrdinal(this.oridinalSortedItems[index]) > ordinal) {\n if (start === index) {\n return { exists: false, index };\n }\n return this.findOrdinalPosition(ordinal, start, index - 1);\n } else if (this.getOrdinal(this.oridinalSortedItems[index]) < ordinal) {\n if (index === end) {\n return { exists: false, index: index + 1 };\n }\n return this.findOrdinalPosition(ordinal, index + 1, end);\n }\n return { exists: true, index };\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/merge-tree",
|
|
3
|
-
"version": "0.49.0-
|
|
3
|
+
"version": "0.49.0-39313",
|
|
4
4
|
"description": "Merge tree",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": "https://github.com/microsoft/FluidFramework",
|
|
@@ -55,17 +55,17 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
57
57
|
"@fluidframework/common-utils": "^0.32.1",
|
|
58
|
-
"@fluidframework/container-definitions": "^0.
|
|
58
|
+
"@fluidframework/container-definitions": "^0.40.0-39046",
|
|
59
59
|
"@fluidframework/core-interfaces": "^0.39.7",
|
|
60
|
-
"@fluidframework/datastore-definitions": "0.49.0-
|
|
61
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
62
|
-
"@fluidframework/telemetry-utils": "0.49.0-
|
|
60
|
+
"@fluidframework/datastore-definitions": "0.49.0-39313",
|
|
61
|
+
"@fluidframework/protocol-definitions": "^0.1025.0-38844",
|
|
62
|
+
"@fluidframework/telemetry-utils": "0.49.0-39313"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@fluidframework/build-common": "^0.23.0",
|
|
66
66
|
"@fluidframework/eslint-config-fluid": "^0.23.0",
|
|
67
|
-
"@fluidframework/mocha-test-setup": "0.49.0-
|
|
68
|
-
"@fluidframework/test-runtime-utils": "0.49.0-
|
|
67
|
+
"@fluidframework/mocha-test-setup": "0.49.0-39313",
|
|
68
|
+
"@fluidframework/test-runtime-utils": "0.49.0-39313",
|
|
69
69
|
"@types/diff": "^3.5.1",
|
|
70
70
|
"@types/mocha": "^8.2.2",
|
|
71
71
|
"@types/node": "^12.19.0",
|
package/src/client.ts
CHANGED
|
@@ -156,7 +156,7 @@ export class Client {
|
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* Annotates the range with the provided properties
|
|
159
|
-
* @param start - The inclusive start
|
|
159
|
+
* @param start - The inclusive start position of the range to annotate
|
|
160
160
|
* @param end - The exclusive end position of the range to annotate
|
|
161
161
|
* @param props - The properties to annotate the range with
|
|
162
162
|
* @param combiningOp - Specifies how to combine values for the property, such as "incr" for increment.
|
package/src/mergeTree.ts
CHANGED
|
@@ -51,6 +51,9 @@ export type RangeStackMap = Properties.MapLike<Collections.Stack<ReferencePositi
|
|
|
51
51
|
|
|
52
52
|
export interface IMergeNodeCommon {
|
|
53
53
|
parent?: IMergeBlock;
|
|
54
|
+
/**
|
|
55
|
+
* The length of the contents of the node.
|
|
56
|
+
*/
|
|
54
57
|
cachedLength: number;
|
|
55
58
|
index: number;
|
|
56
59
|
ordinal: string;
|
|
@@ -84,6 +87,9 @@ export interface IRemovalInfo {
|
|
|
84
87
|
removedClientOverlap?: number[];
|
|
85
88
|
}
|
|
86
89
|
|
|
90
|
+
/**
|
|
91
|
+
* A segment representing a portion of the merge tree.
|
|
92
|
+
*/
|
|
87
93
|
export interface ISegment extends IMergeNodeCommon, IRemovalInfo {
|
|
88
94
|
readonly type: string;
|
|
89
95
|
readonly segmentGroups: SegmentGroupCollection;
|
|
@@ -2540,7 +2546,7 @@ export class MergeTree {
|
|
|
2540
2546
|
|
|
2541
2547
|
/**
|
|
2542
2548
|
* Annotate a range with properties
|
|
2543
|
-
* @param start - The inclusive start
|
|
2549
|
+
* @param start - The inclusive start position of the range to annotate
|
|
2544
2550
|
* @param end - The exclusive end position of the range to annotate
|
|
2545
2551
|
* @param props - The properties to annotate the range with
|
|
2546
2552
|
* @param combiningOp - Optional. Specifies how to combine values for the property, such as "incr" for increment.
|
package/src/opBuilder.ts
CHANGED
|
@@ -40,7 +40,7 @@ export function createAnnotateMarkerOp(
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Creates the op for annotating the range with the provided properties
|
|
43
|
-
* @param start - The inclusive start
|
|
43
|
+
* @param start - The inclusive start position of the range to annotate
|
|
44
44
|
* @param end - The exclusive end position of the range to annotate
|
|
45
45
|
* @param props - The properties to annotate the range with
|
|
46
46
|
* @param combiningOp - Optional. Specifies how to combine values for the property, such as "incr" for increment.
|
package/src/sortedSegmentSet.ts
CHANGED
|
@@ -27,13 +27,13 @@ export class SortedSegmentSet<T extends ISegment | { readonly segment: ISegment
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
public addOrUpdate(newItem: T, update?: (existingItem: T, newItem: T) => T) {
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
30
|
+
const position = this.findOrdinalPosition(this.getOrdinal(newItem));
|
|
31
|
+
if (position.exists) {
|
|
32
32
|
if (update) {
|
|
33
|
-
update(this.oridinalSortedItems[
|
|
33
|
+
update(this.oridinalSortedItems[position.index], newItem);
|
|
34
34
|
}
|
|
35
35
|
} else {
|
|
36
|
-
this.oridinalSortedItems.splice(
|
|
36
|
+
this.oridinalSortedItems.splice(position.index, 0, newItem);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|