@fluidframework/sequence 2.0.0-dev.7.4.0.215747 → 2.0.0-dev.7.4.0.216897
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/api-extractor-lint.json +13 -0
- package/api-report/sequence.api.md +68 -78
- package/dist/defaultMapInterfaces.d.ts +1 -2
- package/dist/defaultMapInterfaces.d.ts.map +1 -1
- package/dist/defaultMapInterfaces.js.map +1 -1
- package/dist/intervalCollection.d.ts +8 -8
- package/dist/intervalCollection.js +2 -2
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.d.ts +2 -2
- package/dist/intervalIndex/endpointInRangeIndex.js +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/dist/intervalIndex/endpointIndex.d.ts +2 -2
- package/dist/intervalIndex/endpointIndex.js +1 -1
- package/dist/intervalIndex/endpointIndex.js.map +1 -1
- package/dist/intervalIndex/idIntervalIndex.d.ts +2 -2
- package/dist/intervalIndex/idIntervalIndex.js +1 -1
- package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
- package/dist/intervalIndex/intervalIndex.d.ts +1 -1
- package/dist/intervalIndex/intervalIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +2 -2
- package/dist/intervalIndex/overlappingIntervalsIndex.js +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js +1 -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 +2 -2
- package/dist/intervalIndex/startpointInRangeIndex.js +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/dist/intervals/interval.d.ts +2 -7
- package/dist/intervals/interval.d.ts.map +1 -1
- package/dist/intervals/interval.js +1 -5
- package/dist/intervals/interval.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +9 -11
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js +2 -2
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +3 -12
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +3 -11
- package/dist/intervals/sequenceInterval.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 +9 -13
- package/dist/revertibles.d.ts.map +1 -1
- package/dist/revertibles.js +7 -9
- package/dist/revertibles.js.map +1 -1
- package/dist/sequence-alpha.d.ts +141 -1540
- package/dist/sequence-beta.d.ts +128 -1442
- package/dist/sequence-public.d.ts +128 -1442
- package/dist/sequence-untrimmed.d.ts +63 -85
- package/dist/sequence.d.ts +2 -3
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +1 -1
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.d.ts +4 -4
- package/dist/sequenceDeltaEvent.js +3 -3
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sequenceFactory.d.ts +1 -1
- package/dist/sequenceFactory.js +1 -1
- package/dist/sequenceFactory.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts +3 -3
- package/dist/sharedIntervalCollection.js +2 -2
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedSequence.d.ts +3 -3
- package/dist/sharedSequence.js +2 -2
- package/dist/sharedSequence.js.map +1 -1
- package/dist/sharedString.d.ts +4 -5
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +2 -3
- package/dist/sharedString.js.map +1 -1
- package/lib/defaultMapInterfaces.d.ts +1 -2
- package/lib/defaultMapInterfaces.d.ts.map +1 -1
- package/lib/defaultMapInterfaces.js.map +1 -1
- package/lib/intervalCollection.d.ts +8 -8
- package/lib/intervalCollection.js +2 -2
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.d.ts +2 -2
- package/lib/intervalIndex/endpointInRangeIndex.js +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/lib/intervalIndex/endpointIndex.d.ts +2 -2
- package/lib/intervalIndex/endpointIndex.js +1 -1
- package/lib/intervalIndex/endpointIndex.js.map +1 -1
- package/lib/intervalIndex/idIntervalIndex.d.ts +2 -2
- package/lib/intervalIndex/idIntervalIndex.js +1 -1
- package/lib/intervalIndex/idIntervalIndex.js.map +1 -1
- package/lib/intervalIndex/intervalIndex.d.ts +1 -1
- package/lib/intervalIndex/intervalIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +2 -2
- package/lib/intervalIndex/overlappingIntervalsIndex.js +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js +1 -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 +2 -2
- package/lib/intervalIndex/startpointInRangeIndex.js +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/lib/intervals/interval.d.ts +2 -7
- package/lib/intervals/interval.d.ts.map +1 -1
- package/lib/intervals/interval.js +1 -5
- package/lib/intervals/interval.js.map +1 -1
- package/lib/intervals/intervalUtils.d.ts +9 -11
- package/lib/intervals/intervalUtils.d.ts.map +1 -1
- package/lib/intervals/intervalUtils.js +2 -2
- package/lib/intervals/intervalUtils.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +3 -12
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +3 -11
- package/lib/intervals/sequenceInterval.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 +9 -13
- package/lib/revertibles.d.ts.map +1 -1
- package/lib/revertibles.js +7 -9
- package/lib/revertibles.js.map +1 -1
- package/lib/sequence-alpha.d.ts +141 -1540
- package/lib/sequence-beta.d.ts +128 -1442
- package/lib/sequence-public.d.ts +128 -1442
- package/lib/sequence-untrimmed.d.ts +63 -85
- package/lib/sequence.d.ts +2 -3
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +1 -1
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.d.ts +4 -4
- package/lib/sequenceDeltaEvent.js +3 -3
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sequenceFactory.d.ts +1 -1
- package/lib/sequenceFactory.js +1 -1
- package/lib/sequenceFactory.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts +3 -3
- package/lib/sharedIntervalCollection.js +2 -2
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedSequence.d.ts +3 -3
- package/lib/sharedSequence.js +2 -2
- package/lib/sharedSequence.js.map +1 -1
- package/lib/sharedString.d.ts +4 -5
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +2 -3
- package/lib/sharedString.js.map +1 -1
- package/package.json +16 -15
- package/src/defaultMapInterfaces.ts +1 -2
- package/src/intervalCollection.ts +8 -8
- package/src/intervalIndex/endpointInRangeIndex.ts +2 -2
- package/src/intervalIndex/endpointIndex.ts +2 -2
- package/src/intervalIndex/idIntervalIndex.ts +2 -2
- package/src/intervalIndex/intervalIndex.ts +1 -1
- package/src/intervalIndex/overlappingIntervalsIndex.ts +2 -2
- package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +1 -1
- package/src/intervalIndex/sequenceIntervalIndexes.ts +2 -1
- package/src/intervalIndex/startpointInRangeIndex.ts +2 -2
- package/src/intervals/interval.ts +2 -7
- package/src/intervals/intervalUtils.ts +9 -11
- package/src/intervals/sequenceInterval.ts +3 -12
- package/src/packageVersion.ts +1 -1
- package/src/revertibles.ts +9 -13
- package/src/sequence.ts +2 -3
- package/src/sequenceDeltaEvent.ts +4 -4
- package/src/sequenceFactory.ts +1 -1
- package/src/sharedIntervalCollection.ts +3 -3
- package/src/sharedSequence.ts +3 -3
- package/src/sharedString.ts +4 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedString.d.ts","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EAEnB,iBAAiB,EACjB,QAAQ,EAER,MAAM,EACN,WAAW,EACX,iBAAiB,EACjB,aAAa,EAEb,WAAW,EACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,qBAAqB,CAAC,mBAAmB,CAAC;IAChF;;;;;OAKG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAEjE;;;;;OAKG;IACH,YAAY,CACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,aAAa,EACtB,KAAK,CAAC,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AAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,SAAS,EAAE,MAAM,EACjB,SAAS,UAAO,GAEd;QACA,IAAI,EAAE,iBAAiB,CAAC;QACxB,GAAG,EAAE,MAAM,CAAC;KACX,GACD,SAAS;IAIZ;;;;;;;OAOG;IACI,eAAe,CACrB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,QAAQ,UAAO,GACb,MAAM,GAAG,SAAS;IAIrB;;;;;OAKG;IACI,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAW3C;;OAEG;IACI,uBAAuB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAWpD,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAWzD;;;OAGG;IACI,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAIxD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;CAOhE;AAWD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAChC,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,MAAM,GACV;IACF,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC1B,CAWA"}
|
package/lib/sharedString.js
CHANGED
|
@@ -13,8 +13,7 @@ import { SharedStringFactory } from "./sequenceFactory";
|
|
|
13
13
|
* In addition to text, a Shared String can also contain markers. Markers can be
|
|
14
14
|
* used to store metadata at positions within the text, like the details of an
|
|
15
15
|
* image or Fluid object that should be rendered with the text.
|
|
16
|
-
*
|
|
17
|
-
* @public
|
|
16
|
+
* @internal
|
|
18
17
|
*/
|
|
19
18
|
export class SharedString extends SharedSegmentSequence {
|
|
20
19
|
/**
|
|
@@ -206,7 +205,7 @@ export class SharedString extends SharedSegmentSequence {
|
|
|
206
205
|
* // parallelMarkers === [<paragraph marker 1 object>, <paragraph marker 2 object>]
|
|
207
206
|
* // Note parallelText does not include "missing".
|
|
208
207
|
* ```
|
|
209
|
-
* @
|
|
208
|
+
* @internal
|
|
210
209
|
*/
|
|
211
210
|
export function getTextAndMarkers(sharedString, label, start, end) {
|
|
212
211
|
const accum = {
|
package/lib/sharedString.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedString.js","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAQN,MAAM,EAIN,eAAe,EACf,WAAW,GACX,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAsCxD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,YACZ,SAAQ,qBAA0C;IAGlD;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW;QAChE,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,mBAAmB,CAAC,IAAI,CAAiB,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,UAAU;QACvB,OAAO,IAAI,mBAAmB,EAAE,CAAC;IAClC,CAAC;IAED,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;IAID,YACC,QAAgC,EACzB,EAAU,EACjB,UAA8B;QAE9B,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,mBAAmB,CAAC,eAAsB,CAAC,CAAC;QAHrE,OAAE,GAAF,EAAE,CAAQ;QAIjB,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC3D,CAAC;IAED;;;;;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I,CAAC;SACjC;aAAM;YACN,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;YACnC,MAAM,MAAM,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YACrC,MAAM,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC;YAC7C,WAAW,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SACzD;KACD;SAAM;QACN,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1C,MAAM,eAAe,GACpB,WAAW,KAAK,GAAG;gBAClB,CAAC,CAAC,gEAAgE;oBAChE,KAAK,OAAO,CAAC,QAAQ,EAAE,EAAE;gBAC3B,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAC7C,WAAW,CAAC,IAAI,IAAI,eAAe,CAAC;SACpC;aAAM;YACN,MAAM,MAAM,GAAG,OAAiB,CAAC;YACjC,IAAI,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE;gBAC3D,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACvC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC9C,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;aACtB;SACD;KACD;IAED,OAAO,IAAI,CAAC;AACb,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tICombiningOp,\n\tIMergeTreeInsertMsg,\n\tIMergeTreeRemoveMsg,\n\tIMergeTreeTextHelper,\n\tIRelativePosition,\n\tISegment,\n\tISegmentAction,\n\tMarker,\n\tPropertySet,\n\tReferencePosition,\n\tReferenceType,\n\trefHasTileLabel,\n\tTextSegment,\n} from \"@fluidframework/merge-tree\";\nimport { IFluidDataStoreRuntime, IChannelAttributes } from \"@fluidframework/datastore-definitions\";\nimport { SharedSegmentSequence } from \"./sequence\";\nimport { SharedStringFactory } from \"./sequenceFactory\";\n\n/**\n * Fluid object interface describing access methods on a SharedString\n * @public\n */\nexport interface ISharedString extends SharedSegmentSequence<SharedStringSegment> {\n\t/**\n\t * Inserts the text at the position.\n\t * @param pos - The position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of the text\n\t */\n\tinsertText(pos: number, text: string, props?: PropertySet): void;\n\n\t/**\n\t * Inserts a marker at the position.\n\t * @param pos - The position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tinsertMarker(\n\t\tpos: number,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t): IMergeTreeInsertMsg | undefined;\n\n\t/**\n\t * {@inheritDoc SharedSegmentSequence.posFromRelativePos}\n\t */\n\tposFromRelativePos(relativePos: IRelativePosition): number;\n}\n\n/**\n * @public\n */\nexport type SharedStringSegment = TextSegment | Marker;\n\n/**\n * The Shared String is a specialized data structure for handling collaborative\n * text. It is based on a more general Sequence data structure but has\n * additional features that make working with text easier.\n *\n * In addition to text, a Shared String can also contain markers. Markers can be\n * used to store metadata at positions within the text, like the details of an\n * image or Fluid object that should be rendered with the text.\n *\n * @public\n */\nexport class SharedString\n\textends SharedSegmentSequence<SharedStringSegment>\n\timplements ISharedString\n{\n\t/**\n\t * Create a new shared string.\n\t * @param runtime - data store runtime the new shared string belongs to\n\t * @param id - optional name of the shared string\n\t * @returns newly create shared string (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string) {\n\t\treturn runtime.createChannel(id, SharedStringFactory.Type) as SharedString;\n\t}\n\n\t/**\n\t * Get a factory for SharedString to register with the data store.\n\t * @returns a factory that creates and load SharedString\n\t */\n\tpublic static getFactory() {\n\t\treturn new SharedStringFactory();\n\t}\n\n\tpublic get ISharedString(): ISharedString {\n\t\treturn this;\n\t}\n\n\tprivate readonly mergeTreeTextHelper: IMergeTreeTextHelper;\n\n\tconstructor(\n\t\tdocument: IFluidDataStoreRuntime,\n\t\tpublic id: string,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(document, id, attributes, SharedStringFactory.segmentFromSpec as any);\n\t\tthis.mergeTreeTextHelper = this.client.createTextHelper();\n\t}\n\n\t/**\n\t * Inserts a marker at a relative position.\n\t * @param relativePos1 - The relative position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tpublic insertMarkerRelative(\n\t\trelativePos1: IRelativePosition,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t) {\n\t\tconst segment = new Marker(refType);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\tconst pos = this.posFromRelativePos(relativePos1);\n\t\tthis.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertMarker}\n\t */\n\tpublic insertMarker(\n\t\tpos: number,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t): IMergeTreeInsertMsg | undefined {\n\t\tconst segment = new Marker(refType);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\treturn this.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\t/**\n\t * Inserts the text at the position.\n\t * @param relativePos1 - The relative position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tpublic insertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet) {\n\t\tconst segment = new TextSegment(text);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\tconst pos = this.posFromRelativePos(relativePos1);\n\t\tthis.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertText}\n\t */\n\tpublic insertText(pos: number, text: string, props?: PropertySet) {\n\t\tconst segment = new TextSegment(text);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\tthis.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\t/**\n\t * Replaces a range with the provided text.\n\t * @param start - The inclusive start of the range to replace\n\t * @param end - The exclusive end of the range to replace\n\t * @param text - The text to replace the range with\n\t * @param props - Optional. The properties of the replacement text\n\t */\n\tpublic replaceText(start: number, end: number, text: string, props?: PropertySet) {\n\t\tthis.replaceRange(start, end, TextSegment.make(text, props));\n\t}\n\n\t/**\n\t * Removes the text in the given range.\n\t * @param start - The inclusive start of the range to remove\n\t * @param end - The exclusive end of the range to replace\n\t * @returns the message sent.\n\t */\n\tpublic removeText(start: number, end: number): IMergeTreeRemoveMsg {\n\t\treturn this.removeRange(start, end);\n\t}\n\n\t/**\n\t * Annotates the marker with the provided properties and calls the callback on consensus.\n\t * @param marker - The marker to annotate\n\t * @param props - The properties to annotate the marker with\n\t * @param consensusCallback - The callback called when consensus is reached\n\t *\n\t * @deprecated We no longer intend to support this functionality and it will\n\t * be removed in a future release. There is no replacement for this\n\t * functionality.\n\t */\n\tpublic annotateMarkerNotifyConsensus(\n\t\tmarker: Marker,\n\t\tprops: PropertySet,\n\t\tcallback: (m: Marker) => void,\n\t) {\n\t\tthis.guardReentrancy(() =>\n\t\t\tthis.client.annotateMarkerNotifyConsensus(marker, props, callback),\n\t\t);\n\t}\n\n\t/**\n\t * Annotates the marker with the provided properties.\n\t * @param marker - The marker to annotate\n\t * @param props - The properties to annotate the marker with\n\t * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n\t */\n\tpublic annotateMarker(marker: Marker, props: PropertySet, combiningOp?: ICombiningOp) {\n\t\tthis.guardReentrancy(() => this.client.annotateMarker(marker, props, combiningOp));\n\t}\n\n\t/**\n\t * Finds the nearest reference with ReferenceType.Tile to `startPos` in the direction dictated by `tilePrecedesPos`.\n\t * Note that Markers receive `ReferenceType.Tile` by default.\n\t * @deprecated Use `searchForMarker` instead.\n\t * @param startPos - Position at which to start the search\n\t * @param clientId - clientId dictating the perspective to search from\n\t * @param tileLabel - Label of the tile to search for\n\t * @param preceding - Whether the desired tile comes before (true) or after (false) `startPos`\n\t */\n\tpublic findTile(\n\t\tstartPos: number | undefined,\n\t\ttileLabel: string,\n\t\tpreceding = true,\n\t):\n\t\t| {\n\t\t\t\ttile: ReferencePosition;\n\t\t\t\tpos: number;\n\t\t }\n\t\t| undefined {\n\t\treturn this.client.findTile(startPos ?? 0, tileLabel, preceding);\n\t}\n\n\t/**\n\t * Searches a string for the nearest marker in either direction to a given start position.\n\t * The search will include the start position, so markers at the start position are valid\n\t * results of the search.\n\t * @param startPos - Position at which to start the search\n\t * @param markerLabel - Label of the marker to search for\n\t * @param forwards - Whether the desired marker comes before (false) or after (true) `startPos`\n\t */\n\tpublic searchForMarker(\n\t\tstartPos: number,\n\t\tmarkerLabel: string,\n\t\tforwards = true,\n\t): Marker | undefined {\n\t\treturn this.client.searchForMarker(startPos, markerLabel, forwards);\n\t}\n\n\t/**\n\t * Retrieve text from the SharedString in string format.\n\t * @param start - The starting index of the text to retrieve, or 0 if omitted.\n\t * @param end - The ending index of the text to retrieve, or the end of the string if omitted\n\t * @returns The requested text content as a string.\n\t */\n\tpublic getText(start?: number, end?: number) {\n\t\tconst segmentWindow = this.client.getCollabWindow();\n\t\treturn this.mergeTreeTextHelper.getText(\n\t\t\tsegmentWindow.currentSeq,\n\t\t\tsegmentWindow.clientId,\n\t\t\t\"\",\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\t/**\n\t * Adds spaces for markers and handles, so that position calculations account for them.\n\t */\n\tpublic getTextWithPlaceholders(start?: number, end?: number) {\n\t\tconst segmentWindow = this.client.getCollabWindow();\n\t\treturn this.mergeTreeTextHelper.getText(\n\t\t\tsegmentWindow.currentSeq,\n\t\t\tsegmentWindow.clientId,\n\t\t\t\" \",\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\tpublic getTextRangeWithMarkers(start: number, end: number) {\n\t\tconst segmentWindow = this.client.getCollabWindow();\n\t\treturn this.mergeTreeTextHelper.getText(\n\t\t\tsegmentWindow.currentSeq,\n\t\t\tsegmentWindow.clientId,\n\t\t\t\"*\",\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\t/**\n\t * Looks up and returns a `Marker` using its id. Returns `undefined` if there is no marker with the provided\n\t * id in this `SharedString`.\n\t */\n\tpublic getMarkerFromId(id: string): ISegment | undefined {\n\t\treturn this.client.getMarkerFromId(id);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tif (this.client.rollback !== undefined) {\n\t\t\tthis.client.rollback(content, localOpMetadata);\n\t\t} else {\n\t\t\tsuper.rollback(content, localOpMetadata);\n\t\t}\n\t}\n}\n\ninterface ITextAndMarkerAccumulator {\n\tparallelText: string[];\n\tparallelMarkers: Marker[];\n\tparallelMarkerLabel: string;\n\tplaceholder?: string;\n\ttagsInProgress: string[];\n\ttextSegment: TextSegment;\n}\n\n/**\n * Splits the text into regions ending with markers with the given `label`.\n * @param sharedString - String to retrieve text and markers from\n * @param label - label to split on\n * @returns Two parallel lists of text and markers, split by markers with the provided `label`.\n * For example:\n * ```typescript\n * // Say sharedstring has contents \"hello<paragraph marker 1>world<paragraph marker 2>missing\".\n * const { parallelText, parallelMarkers } = getTextAndMarkers(sharedString, \"paragraph\");\n * // parallelText === [\"hello\", \"world\"]\n * // parallelMarkers === [<paragraph marker 1 object>, <paragraph marker 2 object>]\n * // Note parallelText does not include \"missing\".\n * ```\n * @public\n */\nexport function getTextAndMarkers(\n\tsharedString: SharedString,\n\tlabel: string,\n\tstart?: number,\n\tend?: number,\n): {\n\tparallelText: string[];\n\tparallelMarkers: Marker[];\n} {\n\tconst accum: ITextAndMarkerAccumulator = {\n\t\tparallelMarkerLabel: label,\n\t\tparallelMarkers: [],\n\t\tparallelText: [],\n\t\ttagsInProgress: [],\n\t\ttextSegment: new TextSegment(\"\"),\n\t};\n\n\tsharedString.walkSegments(gatherTextAndMarkers, start, end, accum);\n\treturn { parallelText: accum.parallelText, parallelMarkers: accum.parallelMarkers };\n}\n\nconst gatherTextAndMarkers: ISegmentAction<ITextAndMarkerAccumulator> = (\n\tsegment: ISegment,\n\tpos: number,\n\trefSeq: number,\n\tclientId: number,\n\tstart: number,\n\tend: number,\n\taccumText: ITextAndMarkerAccumulator,\n) => {\n\tconst { placeholder, tagsInProgress, textSegment } = accumText;\n\tif (TextSegment.is(segment)) {\n\t\tlet beginTags = \"\";\n\t\tlet endTags = \"\";\n\t\t// TODO: let clients pass in function to get tag\n\t\tconst tags = [] as string[];\n\t\tconst initTags = [] as string[];\n\n\t\tif (segment.properties?.[\"font-weight\"]) {\n\t\t\ttags.push(\"b\");\n\t\t}\n\t\tif (segment.properties?.[\"text-decoration\"]) {\n\t\t\ttags.push(\"u\");\n\t\t}\n\t\tconst remTags = [] as string[];\n\t\tif (tags.length > 0) {\n\t\t\tfor (const tag of tags) {\n\t\t\t\tif (!tagsInProgress.includes(tag)) {\n\t\t\t\t\tbeginTags += `<${tag}>`;\n\t\t\t\t\tinitTags.push(tag);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const accumTag of tagsInProgress) {\n\t\t\t\tif (!tags.includes(accumTag)) {\n\t\t\t\t\tendTags += `</${accumTag}>`;\n\t\t\t\t\tremTags.push(accumTag);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const initTag of initTags.reverse()) {\n\t\t\t\ttagsInProgress.push(initTag);\n\t\t\t}\n\t\t} else {\n\t\t\tfor (const accumTag of tagsInProgress) {\n\t\t\t\tendTags += `</${accumTag}>`;\n\t\t\t\tremTags.push(accumTag);\n\t\t\t}\n\t\t}\n\t\tfor (const remTag of remTags) {\n\t\t\tconst remdex = tagsInProgress.indexOf(remTag);\n\t\t\tif (remdex >= 0) {\n\t\t\t\ttagsInProgress.splice(remdex, 1);\n\t\t\t}\n\t\t}\n\t\ttextSegment.text += endTags;\n\t\ttextSegment.text += beginTags;\n\t\tif (start <= 0 && end >= segment.text.length) {\n\t\t\ttextSegment.text += segment.text;\n\t\t} else {\n\t\t\tconst seglen = segment.text.length;\n\t\t\tconst _start = start < 0 ? 0 : start;\n\t\t\tconst _end = end >= seglen ? undefined : end;\n\t\t\ttextSegment.text += segment.text.substring(_start, _end);\n\t\t}\n\t} else {\n\t\tif (placeholder && placeholder.length > 0) {\n\t\t\tconst placeholderText =\n\t\t\t\tplaceholder === \"*\"\n\t\t\t\t\t? // eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\t\t\t `\\n${segment.toString()}`\n\t\t\t\t\t: placeholder.repeat(segment.cachedLength);\n\t\t\ttextSegment.text += placeholderText;\n\t\t} else {\n\t\t\tconst marker = segment as Marker;\n\t\t\tif (refHasTileLabel(marker, accumText.parallelMarkerLabel)) {\n\t\t\t\taccumText.parallelMarkers.push(marker);\n\t\t\t\taccumText.parallelText.push(textSegment.text);\n\t\t\t\ttextSegment.text = \"\";\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"sharedString.js","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAQN,MAAM,EAIN,eAAe,EACf,WAAW,GACX,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAsCxD;;;;;;;;;GASG;AACH,MAAM,OAAO,YACZ,SAAQ,qBAA0C;IAGlD;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW;QAChE,OAAO,OAAO,CAAC,aAAa,C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AAS,CAAC,mBAAmB,CAAC,EAAE;gBAC3D,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACvC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC9C,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;aACtB;SACD;KACD;IAED,OAAO,IAAI,CAAC;AACb,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tICombiningOp,\n\tIMergeTreeInsertMsg,\n\tIMergeTreeRemoveMsg,\n\tIMergeTreeTextHelper,\n\tIRelativePosition,\n\tISegment,\n\tISegmentAction,\n\tMarker,\n\tPropertySet,\n\tReferencePosition,\n\tReferenceType,\n\trefHasTileLabel,\n\tTextSegment,\n} from \"@fluidframework/merge-tree\";\nimport { IFluidDataStoreRuntime, IChannelAttributes } from \"@fluidframework/datastore-definitions\";\nimport { SharedSegmentSequence } from \"./sequence\";\nimport { SharedStringFactory } from \"./sequenceFactory\";\n\n/**\n * Fluid object interface describing access methods on a SharedString\n * @internal\n */\nexport interface ISharedString extends SharedSegmentSequence<SharedStringSegment> {\n\t/**\n\t * Inserts the text at the position.\n\t * @param pos - The position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of the text\n\t */\n\tinsertText(pos: number, text: string, props?: PropertySet): void;\n\n\t/**\n\t * Inserts a marker at the position.\n\t * @param pos - The position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tinsertMarker(\n\t\tpos: number,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t): IMergeTreeInsertMsg | undefined;\n\n\t/**\n\t * {@inheritDoc SharedSegmentSequence.posFromRelativePos}\n\t */\n\tposFromRelativePos(relativePos: IRelativePosition): number;\n}\n\n/**\n * @internal\n */\nexport type SharedStringSegment = TextSegment | Marker;\n\n/**\n * The Shared String is a specialized data structure for handling collaborative\n * text. It is based on a more general Sequence data structure but has\n * additional features that make working with text easier.\n *\n * In addition to text, a Shared String can also contain markers. Markers can be\n * used to store metadata at positions within the text, like the details of an\n * image or Fluid object that should be rendered with the text.\n * @internal\n */\nexport class SharedString\n\textends SharedSegmentSequence<SharedStringSegment>\n\timplements ISharedString\n{\n\t/**\n\t * Create a new shared string.\n\t * @param runtime - data store runtime the new shared string belongs to\n\t * @param id - optional name of the shared string\n\t * @returns newly create shared string (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string) {\n\t\treturn runtime.createChannel(id, SharedStringFactory.Type) as SharedString;\n\t}\n\n\t/**\n\t * Get a factory for SharedString to register with the data store.\n\t * @returns a factory that creates and load SharedString\n\t */\n\tpublic static getFactory() {\n\t\treturn new SharedStringFactory();\n\t}\n\n\tpublic get ISharedString(): ISharedString {\n\t\treturn this;\n\t}\n\n\tprivate readonly mergeTreeTextHelper: IMergeTreeTextHelper;\n\n\tconstructor(\n\t\tdocument: IFluidDataStoreRuntime,\n\t\tpublic id: string,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(document, id, attributes, SharedStringFactory.segmentFromSpec as any);\n\t\tthis.mergeTreeTextHelper = this.client.createTextHelper();\n\t}\n\n\t/**\n\t * Inserts a marker at a relative position.\n\t * @param relativePos1 - The relative position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tpublic insertMarkerRelative(\n\t\trelativePos1: IRelativePosition,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t) {\n\t\tconst segment = new Marker(refType);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\tconst pos = this.posFromRelativePos(relativePos1);\n\t\tthis.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertMarker}\n\t */\n\tpublic insertMarker(\n\t\tpos: number,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t): IMergeTreeInsertMsg | undefined {\n\t\tconst segment = new Marker(refType);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\treturn this.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\t/**\n\t * Inserts the text at the position.\n\t * @param relativePos1 - The relative position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tpublic insertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet) {\n\t\tconst segment = new TextSegment(text);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\tconst pos = this.posFromRelativePos(relativePos1);\n\t\tthis.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertText}\n\t */\n\tpublic insertText(pos: number, text: string, props?: PropertySet) {\n\t\tconst segment = new TextSegment(text);\n\t\tif (props) {\n\t\t\tsegment.addProperties(props);\n\t\t}\n\n\t\tthis.guardReentrancy(() => this.client.insertSegmentLocal(pos, segment));\n\t}\n\n\t/**\n\t * Replaces a range with the provided text.\n\t * @param start - The inclusive start of the range to replace\n\t * @param end - The exclusive end of the range to replace\n\t * @param text - The text to replace the range with\n\t * @param props - Optional. The properties of the replacement text\n\t */\n\tpublic replaceText(start: number, end: number, text: string, props?: PropertySet) {\n\t\tthis.replaceRange(start, end, TextSegment.make(text, props));\n\t}\n\n\t/**\n\t * Removes the text in the given range.\n\t * @param start - The inclusive start of the range to remove\n\t * @param end - The exclusive end of the range to replace\n\t * @returns the message sent.\n\t */\n\tpublic removeText(start: number, end: number): IMergeTreeRemoveMsg {\n\t\treturn this.removeRange(start, end);\n\t}\n\n\t/**\n\t * Annotates the marker with the provided properties and calls the callback on consensus.\n\t * @param marker - The marker to annotate\n\t * @param props - The properties to annotate the marker with\n\t * @param consensusCallback - The callback called when consensus is reached\n\t *\n\t * @deprecated We no longer intend to support this functionality and it will\n\t * be removed in a future release. There is no replacement for this\n\t * functionality.\n\t */\n\tpublic annotateMarkerNotifyConsensus(\n\t\tmarker: Marker,\n\t\tprops: PropertySet,\n\t\tcallback: (m: Marker) => void,\n\t) {\n\t\tthis.guardReentrancy(() =>\n\t\t\tthis.client.annotateMarkerNotifyConsensus(marker, props, callback),\n\t\t);\n\t}\n\n\t/**\n\t * Annotates the marker with the provided properties.\n\t * @param marker - The marker to annotate\n\t * @param props - The properties to annotate the marker with\n\t * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n\t */\n\tpublic annotateMarker(marker: Marker, props: PropertySet, combiningOp?: ICombiningOp) {\n\t\tthis.guardReentrancy(() => this.client.annotateMarker(marker, props, combiningOp));\n\t}\n\n\t/**\n\t * Finds the nearest reference with ReferenceType.Tile to `startPos` in the direction dictated by `tilePrecedesPos`.\n\t * Note that Markers receive `ReferenceType.Tile` by default.\n\t * @deprecated Use `searchForMarker` instead.\n\t * @param startPos - Position at which to start the search\n\t * @param clientId - clientId dictating the perspective to search from\n\t * @param tileLabel - Label of the tile to search for\n\t * @param preceding - Whether the desired tile comes before (true) or after (false) `startPos`\n\t */\n\tpublic findTile(\n\t\tstartPos: number | undefined,\n\t\ttileLabel: string,\n\t\tpreceding = true,\n\t):\n\t\t| {\n\t\t\t\ttile: ReferencePosition;\n\t\t\t\tpos: number;\n\t\t }\n\t\t| undefined {\n\t\treturn this.client.findTile(startPos ?? 0, tileLabel, preceding);\n\t}\n\n\t/**\n\t * Searches a string for the nearest marker in either direction to a given start position.\n\t * The search will include the start position, so markers at the start position are valid\n\t * results of the search.\n\t * @param startPos - Position at which to start the search\n\t * @param markerLabel - Label of the marker to search for\n\t * @param forwards - Whether the desired marker comes before (false) or after (true) `startPos`\n\t */\n\tpublic searchForMarker(\n\t\tstartPos: number,\n\t\tmarkerLabel: string,\n\t\tforwards = true,\n\t): Marker | undefined {\n\t\treturn this.client.searchForMarker(startPos, markerLabel, forwards);\n\t}\n\n\t/**\n\t * Retrieve text from the SharedString in string format.\n\t * @param start - The starting index of the text to retrieve, or 0 if omitted.\n\t * @param end - The ending index of the text to retrieve, or the end of the string if omitted\n\t * @returns The requested text content as a string.\n\t */\n\tpublic getText(start?: number, end?: number) {\n\t\tconst segmentWindow = this.client.getCollabWindow();\n\t\treturn this.mergeTreeTextHelper.getText(\n\t\t\tsegmentWindow.currentSeq,\n\t\t\tsegmentWindow.clientId,\n\t\t\t\"\",\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\t/**\n\t * Adds spaces for markers and handles, so that position calculations account for them.\n\t */\n\tpublic getTextWithPlaceholders(start?: number, end?: number) {\n\t\tconst segmentWindow = this.client.getCollabWindow();\n\t\treturn this.mergeTreeTextHelper.getText(\n\t\t\tsegmentWindow.currentSeq,\n\t\t\tsegmentWindow.clientId,\n\t\t\t\" \",\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\tpublic getTextRangeWithMarkers(start: number, end: number) {\n\t\tconst segmentWindow = this.client.getCollabWindow();\n\t\treturn this.mergeTreeTextHelper.getText(\n\t\t\tsegmentWindow.currentSeq,\n\t\t\tsegmentWindow.clientId,\n\t\t\t\"*\",\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\t/**\n\t * Looks up and returns a `Marker` using its id. Returns `undefined` if there is no marker with the provided\n\t * id in this `SharedString`.\n\t */\n\tpublic getMarkerFromId(id: string): ISegment | undefined {\n\t\treturn this.client.getMarkerFromId(id);\n\t}\n\n\t/**\n\t * Revert an op\n\t */\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tif (this.client.rollback !== undefined) {\n\t\t\tthis.client.rollback(content, localOpMetadata);\n\t\t} else {\n\t\t\tsuper.rollback(content, localOpMetadata);\n\t\t}\n\t}\n}\n\ninterface ITextAndMarkerAccumulator {\n\tparallelText: string[];\n\tparallelMarkers: Marker[];\n\tparallelMarkerLabel: string;\n\tplaceholder?: string;\n\ttagsInProgress: string[];\n\ttextSegment: TextSegment;\n}\n\n/**\n * Splits the text into regions ending with markers with the given `label`.\n * @param sharedString - String to retrieve text and markers from\n * @param label - label to split on\n * @returns Two parallel lists of text and markers, split by markers with the provided `label`.\n * For example:\n * ```typescript\n * // Say sharedstring has contents \"hello<paragraph marker 1>world<paragraph marker 2>missing\".\n * const { parallelText, parallelMarkers } = getTextAndMarkers(sharedString, \"paragraph\");\n * // parallelText === [\"hello\", \"world\"]\n * // parallelMarkers === [<paragraph marker 1 object>, <paragraph marker 2 object>]\n * // Note parallelText does not include \"missing\".\n * ```\n * @internal\n */\nexport function getTextAndMarkers(\n\tsharedString: SharedString,\n\tlabel: string,\n\tstart?: number,\n\tend?: number,\n): {\n\tparallelText: string[];\n\tparallelMarkers: Marker[];\n} {\n\tconst accum: ITextAndMarkerAccumulator = {\n\t\tparallelMarkerLabel: label,\n\t\tparallelMarkers: [],\n\t\tparallelText: [],\n\t\ttagsInProgress: [],\n\t\ttextSegment: new TextSegment(\"\"),\n\t};\n\n\tsharedString.walkSegments(gatherTextAndMarkers, start, end, accum);\n\treturn { parallelText: accum.parallelText, parallelMarkers: accum.parallelMarkers };\n}\n\nconst gatherTextAndMarkers: ISegmentAction<ITextAndMarkerAccumulator> = (\n\tsegment: ISegment,\n\tpos: number,\n\trefSeq: number,\n\tclientId: number,\n\tstart: number,\n\tend: number,\n\taccumText: ITextAndMarkerAccumulator,\n) => {\n\tconst { placeholder, tagsInProgress, textSegment } = accumText;\n\tif (TextSegment.is(segment)) {\n\t\tlet beginTags = \"\";\n\t\tlet endTags = \"\";\n\t\t// TODO: let clients pass in function to get tag\n\t\tconst tags = [] as string[];\n\t\tconst initTags = [] as string[];\n\n\t\tif (segment.properties?.[\"font-weight\"]) {\n\t\t\ttags.push(\"b\");\n\t\t}\n\t\tif (segment.properties?.[\"text-decoration\"]) {\n\t\t\ttags.push(\"u\");\n\t\t}\n\t\tconst remTags = [] as string[];\n\t\tif (tags.length > 0) {\n\t\t\tfor (const tag of tags) {\n\t\t\t\tif (!tagsInProgress.includes(tag)) {\n\t\t\t\t\tbeginTags += `<${tag}>`;\n\t\t\t\t\tinitTags.push(tag);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const accumTag of tagsInProgress) {\n\t\t\t\tif (!tags.includes(accumTag)) {\n\t\t\t\t\tendTags += `</${accumTag}>`;\n\t\t\t\t\tremTags.push(accumTag);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const initTag of initTags.reverse()) {\n\t\t\t\ttagsInProgress.push(initTag);\n\t\t\t}\n\t\t} else {\n\t\t\tfor (const accumTag of tagsInProgress) {\n\t\t\t\tendTags += `</${accumTag}>`;\n\t\t\t\tremTags.push(accumTag);\n\t\t\t}\n\t\t}\n\t\tfor (const remTag of remTags) {\n\t\t\tconst remdex = tagsInProgress.indexOf(remTag);\n\t\t\tif (remdex >= 0) {\n\t\t\t\ttagsInProgress.splice(remdex, 1);\n\t\t\t}\n\t\t}\n\t\ttextSegment.text += endTags;\n\t\ttextSegment.text += beginTags;\n\t\tif (start <= 0 && end >= segment.text.length) {\n\t\t\ttextSegment.text += segment.text;\n\t\t} else {\n\t\t\tconst seglen = segment.text.length;\n\t\t\tconst _start = start < 0 ? 0 : start;\n\t\t\tconst _end = end >= seglen ? undefined : end;\n\t\t\ttextSegment.text += segment.text.substring(_start, _end);\n\t\t}\n\t} else {\n\t\tif (placeholder && placeholder.length > 0) {\n\t\t\tconst placeholderText =\n\t\t\t\tplaceholder === \"*\"\n\t\t\t\t\t? // eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\t\t\t `\\n${segment.toString()}`\n\t\t\t\t\t: placeholder.repeat(segment.cachedLength);\n\t\t\ttextSegment.text += placeholderText;\n\t\t} else {\n\t\t\tconst marker = segment as Marker;\n\t\t\tif (refHasTileLabel(marker, accumText.parallelMarkerLabel)) {\n\t\t\t\taccumText.parallelMarkers.push(marker);\n\t\t\t\taccumText.parallelText.push(textSegment.text);\n\t\t\t\ttextSegment.text = \"\";\n\t\t\t}\n\t\t}\n\t}\n\n\treturn true;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/sequence",
|
|
3
|
-
"version": "2.0.0-dev.7.4.0.
|
|
3
|
+
"version": "2.0.0-dev.7.4.0.216897",
|
|
4
4
|
"description": "Distributed sequence",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,29 +35,29 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": "2.0.0-dev.7.4.0.
|
|
39
|
-
"@fluidframework/core-interfaces": "2.0.0-dev.7.4.0.
|
|
40
|
-
"@fluidframework/core-utils": "2.0.0-dev.7.4.0.
|
|
41
|
-
"@fluidframework/datastore-definitions": "2.0.0-dev.7.4.0.
|
|
42
|
-
"@fluidframework/merge-tree": "2.0.0-dev.7.4.0.
|
|
38
|
+
"@fluid-internal/client-utils": "2.0.0-dev.7.4.0.216897",
|
|
39
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.7.4.0.216897",
|
|
40
|
+
"@fluidframework/core-utils": "2.0.0-dev.7.4.0.216897",
|
|
41
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev.7.4.0.216897",
|
|
42
|
+
"@fluidframework/merge-tree": "2.0.0-dev.7.4.0.216897",
|
|
43
43
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
44
|
-
"@fluidframework/runtime-definitions": "2.0.0-dev.7.4.0.
|
|
45
|
-
"@fluidframework/runtime-utils": "2.0.0-dev.7.4.0.
|
|
46
|
-
"@fluidframework/shared-object-base": "2.0.0-dev.7.4.0.
|
|
47
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev.7.4.0.
|
|
44
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev.7.4.0.216897",
|
|
45
|
+
"@fluidframework/runtime-utils": "2.0.0-dev.7.4.0.216897",
|
|
46
|
+
"@fluidframework/shared-object-base": "2.0.0-dev.7.4.0.216897",
|
|
47
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev.7.4.0.216897",
|
|
48
48
|
"uuid": "^9.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@fluid-private/stochastic-test-utils": "2.0.0-dev.7.4.0.
|
|
52
|
-
"@fluid-private/test-dds-utils": "2.0.0-dev.7.4.0.
|
|
51
|
+
"@fluid-private/stochastic-test-utils": "2.0.0-dev.7.4.0.216897",
|
|
52
|
+
"@fluid-private/test-dds-utils": "2.0.0-dev.7.4.0.216897",
|
|
53
53
|
"@fluid-tools/benchmark": "^0.48.0",
|
|
54
54
|
"@fluid-tools/build-cli": "^0.28.0",
|
|
55
55
|
"@fluidframework/build-common": "^2.0.3",
|
|
56
56
|
"@fluidframework/build-tools": "^0.28.0",
|
|
57
57
|
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
58
|
-
"@fluidframework/mocha-test-setup": "2.0.0-dev.7.4.0.
|
|
58
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev.7.4.0.216897",
|
|
59
59
|
"@fluidframework/sequence-previous": "npm:@fluidframework/sequence@2.0.0-internal.7.2.0",
|
|
60
|
-
"@fluidframework/test-runtime-utils": "2.0.0-dev.7.4.0.
|
|
60
|
+
"@fluidframework/test-runtime-utils": "2.0.0-dev.7.4.0.216897",
|
|
61
61
|
"@microsoft/api-extractor": "^7.38.3",
|
|
62
62
|
"@types/diff": "^3.5.1",
|
|
63
63
|
"@types/mocha": "^9.1.1",
|
|
@@ -107,12 +107,13 @@
|
|
|
107
107
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
108
108
|
"build:genver": "gen-version",
|
|
109
109
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
110
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
110
111
|
"ci:build:docs": "api-extractor run",
|
|
111
112
|
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
112
113
|
"eslint": "eslint --format stylish src",
|
|
113
114
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
114
115
|
"format": "npm run prettier:fix",
|
|
115
|
-
"lint": "npm run prettier && npm run eslint",
|
|
116
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
116
117
|
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
117
118
|
"perf": "cross-env FLUID_TEST_VERBOSE=1 mocha \"dist/**/*.spec.js\" --node-option unhandled-rejections=strict,expose-gc --exit -r node_modules/@fluidframework/mocha-test-setup --perfMode --fgrep @Benchmark --reporter @fluid-tools/benchmark/dist/MochaReporter.js --timeout 30000",
|
|
118
119
|
"perf:measure": "npm run perf -- --fgrep @Measurement",
|
|
@@ -35,7 +35,6 @@ export interface IValueOpEmitter {
|
|
|
35
35
|
* @param previousValue - JSONable previous value as defined by the value type @deprecated unused
|
|
36
36
|
* @param params - JSONable params for the operation as defined by the value type
|
|
37
37
|
* @param localOpMetadata - JSONable local metadata which should be submitted with the op
|
|
38
|
-
* @internal
|
|
39
38
|
*/
|
|
40
39
|
emit(
|
|
41
40
|
opName: IntervalOpType,
|
|
@@ -54,7 +53,7 @@ export interface IMapMessageLocalMetadata {
|
|
|
54
53
|
|
|
55
54
|
/**
|
|
56
55
|
* Optional flags that configure options for sequence DDSs
|
|
57
|
-
* @
|
|
56
|
+
* @internal
|
|
58
57
|
*/
|
|
59
58
|
export interface SequenceOptions {
|
|
60
59
|
/**
|
|
@@ -87,7 +87,7 @@ import {
|
|
|
87
87
|
* If a SequencePlace is the endpoint of a range (e.g. start/end of an interval or search range),
|
|
88
88
|
* the Side value means it is exclusive if it is nearer to the other position and inclusive if it is farther.
|
|
89
89
|
* E.g. the start of a range with Side.After is exclusive of the character at the position.
|
|
90
|
-
* @
|
|
90
|
+
* @internal
|
|
91
91
|
*/
|
|
92
92
|
export type SequencePlace = number | "start" | "end" | InteriorSequencePlace;
|
|
93
93
|
|
|
@@ -95,7 +95,7 @@ export type SequencePlace = number | "start" | "end" | InteriorSequencePlace;
|
|
|
95
95
|
* A sequence place that does not refer to the special endpoint segments.
|
|
96
96
|
*
|
|
97
97
|
* See {@link SequencePlace} for additional context.
|
|
98
|
-
* @
|
|
98
|
+
* @internal
|
|
99
99
|
*/
|
|
100
100
|
export interface InteriorSequencePlace {
|
|
101
101
|
pos: number;
|
|
@@ -106,7 +106,7 @@ export interface InteriorSequencePlace {
|
|
|
106
106
|
* Defines a side relative to a character in a sequence.
|
|
107
107
|
*
|
|
108
108
|
* @remarks See {@link SequencePlace} for additional context on usage.
|
|
109
|
-
* @
|
|
109
|
+
* @internal
|
|
110
110
|
*/
|
|
111
111
|
export enum Side {
|
|
112
112
|
Before = 0,
|
|
@@ -626,7 +626,7 @@ export function makeOpsMap<T extends ISerializableInterval>(): Map<
|
|
|
626
626
|
}
|
|
627
627
|
|
|
628
628
|
/**
|
|
629
|
-
* @
|
|
629
|
+
* @internal
|
|
630
630
|
*/
|
|
631
631
|
export type DeserializeCallback = (properties: PropertySet) => void;
|
|
632
632
|
|
|
@@ -665,7 +665,7 @@ class IntervalCollectionIterator<TInterval extends ISerializableInterval>
|
|
|
665
665
|
|
|
666
666
|
/**
|
|
667
667
|
* Change events emitted by `IntervalCollection`s
|
|
668
|
-
* @
|
|
668
|
+
* @internal
|
|
669
669
|
*/
|
|
670
670
|
export interface IIntervalCollectionEvent<TInterval extends ISerializableInterval> extends IEvent {
|
|
671
671
|
/**
|
|
@@ -733,7 +733,7 @@ const isSequencePlace = (place: any): place is SequencePlace => {
|
|
|
733
733
|
/**
|
|
734
734
|
* Collection of intervals that supports addition, modification, removal, and efficient spatial querying.
|
|
735
735
|
* Changes to this collection will be incur updates on collaborating clients (i.e. they are not local-only).
|
|
736
|
-
* @
|
|
736
|
+
* @internal
|
|
737
737
|
*/
|
|
738
738
|
export interface IIntervalCollection<TInterval extends ISerializableInterval>
|
|
739
739
|
extends TypedEventEmitter<IIntervalCollectionEvent<TInterval>> {
|
|
@@ -2063,7 +2063,7 @@ function setSlideOnRemove(lref: LocalReferencePosition) {
|
|
|
2063
2063
|
|
|
2064
2064
|
/**
|
|
2065
2065
|
* Information that identifies an interval within a `Sequence`.
|
|
2066
|
-
* @
|
|
2066
|
+
* @internal
|
|
2067
2067
|
*/
|
|
2068
2068
|
export interface IntervalLocator {
|
|
2069
2069
|
/**
|
|
@@ -2081,7 +2081,7 @@ export interface IntervalLocator {
|
|
|
2081
2081
|
* @returns undefined if the reference position is not the endpoint of any interval (e.g. it was created
|
|
2082
2082
|
* on the merge tree directly by app code), otherwise an {@link IntervalLocator} for the interval this
|
|
2083
2083
|
* endpoint is a part of.
|
|
2084
|
-
* @
|
|
2084
|
+
* @internal
|
|
2085
2085
|
*/
|
|
2086
2086
|
export function intervalLocatorFromEndpoint(
|
|
2087
2087
|
potentialEndpoint: LocalReferencePosition,
|
|
@@ -20,7 +20,7 @@ import { HasComparisonOverride, compareOverrideables, forceCompare } from "./int
|
|
|
20
20
|
* Collection of intervals.
|
|
21
21
|
*
|
|
22
22
|
* Provide additional APIs to support efficiently querying a collection of intervals whose endpoints fall within a specified range.
|
|
23
|
-
* @
|
|
23
|
+
* @internal
|
|
24
24
|
*/
|
|
25
25
|
export interface IEndpointInRangeIndex<TInterval extends ISerializableInterval>
|
|
26
26
|
extends IntervalIndex<TInterval> {
|
|
@@ -106,7 +106,7 @@ export class EndpointInRangeIndex<TInterval extends ISerializableInterval>
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* @
|
|
109
|
+
* @internal
|
|
110
110
|
*/
|
|
111
111
|
export function createEndpointInRangeIndex(
|
|
112
112
|
sharedString: SharedString,
|
|
@@ -16,7 +16,7 @@ import { SharedString } from "../sharedString";
|
|
|
16
16
|
import { IntervalIndex } from "./intervalIndex";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @
|
|
19
|
+
* @internal
|
|
20
20
|
*/
|
|
21
21
|
export interface IEndpointIndex<TInterval extends ISerializableInterval>
|
|
22
22
|
extends IntervalIndex<TInterval> {
|
|
@@ -83,7 +83,7 @@ export class EndpointIndex<TInterval extends ISerializableInterval>
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* @
|
|
86
|
+
* @internal
|
|
87
87
|
*/
|
|
88
88
|
export function createEndpointIndex(sharedString: SharedString): IEndpointIndex<SequenceInterval> {
|
|
89
89
|
const client = (sharedString as unknown as { client: Client }).client;
|
|
@@ -10,7 +10,7 @@ import { IntervalIndex } from "./intervalIndex";
|
|
|
10
10
|
const reservedIntervalIdKey = "intervalId";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @
|
|
13
|
+
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export interface IIdIntervalIndex<TInterval extends ISerializableInterval>
|
|
16
16
|
extends IntervalIndex<TInterval>,
|
|
@@ -55,7 +55,7 @@ class IdIntervalIndex<TInterval extends ISerializableInterval>
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* @
|
|
58
|
+
* @internal
|
|
59
59
|
*/
|
|
60
60
|
export function createIdIntervalIndex<
|
|
61
61
|
TInterval extends ISerializableInterval,
|
|
@@ -13,7 +13,7 @@ import { ISerializableInterval } from "../intervals";
|
|
|
13
13
|
* - "find all intervals with start endpoint between these two points"
|
|
14
14
|
* - "find all intervals which overlap this range"
|
|
15
15
|
* etc.
|
|
16
|
-
* @
|
|
16
|
+
* @internal
|
|
17
17
|
*/
|
|
18
18
|
export interface IntervalIndex<TInterval extends ISerializableInterval> {
|
|
19
19
|
/**
|
|
@@ -18,7 +18,7 @@ import { SequencePlace, endpointPosAndSide } from "../intervalCollection";
|
|
|
18
18
|
import { IntervalIndex } from "./intervalIndex";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* @
|
|
21
|
+
* @internal
|
|
22
22
|
*/
|
|
23
23
|
export interface IOverlappingIntervalsIndex<TInterval extends ISerializableInterval>
|
|
24
24
|
extends IntervalIndex<TInterval> {
|
|
@@ -177,7 +177,7 @@ export class OverlappingIntervalsIndex<TInterval extends ISerializableInterval>
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
|
-
* @
|
|
180
|
+
* @internal
|
|
181
181
|
*/
|
|
182
182
|
export function createOverlappingIntervalsIndex(
|
|
183
183
|
sharedString: SharedString,
|
|
@@ -10,7 +10,7 @@ import { IOverlappingIntervalsIndex } from "./overlappingIntervalsIndex";
|
|
|
10
10
|
/**
|
|
11
11
|
* This namespace contains specialiazations of indexes which support spatial queries
|
|
12
12
|
* specifically for `SequenceInterval`s.
|
|
13
|
-
* @
|
|
13
|
+
* @internal
|
|
14
14
|
*/
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
16
16
|
export namespace SequenceIntervalIndexes {
|
|
@@ -18,6 +18,7 @@ export namespace SequenceIntervalIndexes {
|
|
|
18
18
|
* Collection of intervals.
|
|
19
19
|
*
|
|
20
20
|
* Provides additional APIs to support efficiently querying a collection of intervals based on segments and offset.
|
|
21
|
+
* @internal
|
|
21
22
|
*/
|
|
22
23
|
export interface Overlapping extends IOverlappingIntervalsIndex<SequenceInterval> {
|
|
23
24
|
/**
|
|
@@ -20,7 +20,7 @@ import { HasComparisonOverride, compareOverrideables, forceCompare } from "./int
|
|
|
20
20
|
* Collection of intervals.
|
|
21
21
|
*
|
|
22
22
|
* Provide additional APIs to support efficiently querying a collection of intervals whose startpoints fall within a specified range.
|
|
23
|
-
* @
|
|
23
|
+
* @internal
|
|
24
24
|
*/
|
|
25
25
|
export interface IStartpointInRangeIndex<TInterval extends ISerializableInterval>
|
|
26
26
|
extends IntervalIndex<TInterval> {
|
|
@@ -104,7 +104,7 @@ export class StartpointInRangeIndex<TInterval extends ISerializableInterval>
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* @
|
|
107
|
+
* @internal
|
|
108
108
|
*/
|
|
109
109
|
export function createStartpointInRangeIndex(
|
|
110
110
|
sharedString: SharedString,
|
|
@@ -21,18 +21,17 @@ const reservedIntervalIdKey = "intervalId";
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Serializable interval whose endpoints are plain-old numbers.
|
|
24
|
-
* @
|
|
24
|
+
* @internal
|
|
25
25
|
*/
|
|
26
26
|
export class Interval implements ISerializableInterval {
|
|
27
27
|
/**
|
|
28
28
|
* {@inheritDoc ISerializableInterval.properties}
|
|
29
29
|
*/
|
|
30
30
|
public properties: PropertySet;
|
|
31
|
-
|
|
31
|
+
/***/
|
|
32
32
|
public auxProps: PropertySet[] | undefined;
|
|
33
33
|
/**
|
|
34
34
|
* {@inheritDoc ISerializableInterval.propertyManager}
|
|
35
|
-
* @internal
|
|
36
35
|
*/
|
|
37
36
|
public propertyManager: PropertiesManager;
|
|
38
37
|
constructor(
|
|
@@ -81,7 +80,6 @@ export class Interval implements ISerializableInterval {
|
|
|
81
80
|
|
|
82
81
|
/**
|
|
83
82
|
* {@inheritDoc ISerializableInterval.serialize}
|
|
84
|
-
* @internal
|
|
85
83
|
*/
|
|
86
84
|
public serialize(): ISerializedInterval {
|
|
87
85
|
const serializedInterval: ISerializedInterval = {
|
|
@@ -152,7 +150,6 @@ export class Interval implements ISerializableInterval {
|
|
|
152
150
|
|
|
153
151
|
/**
|
|
154
152
|
* {@inheritDoc IInterval.union}
|
|
155
|
-
* @internal
|
|
156
153
|
*/
|
|
157
154
|
public union(b: Interval) {
|
|
158
155
|
return new Interval(
|
|
@@ -168,7 +165,6 @@ export class Interval implements ISerializableInterval {
|
|
|
168
165
|
|
|
169
166
|
/**
|
|
170
167
|
* {@inheritDoc ISerializableInterval.addProperties}
|
|
171
|
-
* @internal
|
|
172
168
|
*/
|
|
173
169
|
public addProperties(
|
|
174
170
|
newProps: PropertySet,
|
|
@@ -190,7 +186,6 @@ export class Interval implements ISerializableInterval {
|
|
|
190
186
|
|
|
191
187
|
/**
|
|
192
188
|
* {@inheritDoc IInterval.modify}
|
|
193
|
-
* @internal
|
|
194
189
|
*/
|
|
195
190
|
public modify(
|
|
196
191
|
label: string,
|
|
@@ -17,7 +17,7 @@ import { SequencePlace, Side } from "../intervalCollection";
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Basic interval abstraction
|
|
20
|
-
* @
|
|
20
|
+
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export interface IInterval {
|
|
23
23
|
/**
|
|
@@ -46,7 +46,6 @@ export interface IInterval {
|
|
|
46
46
|
compareEnd(b: IInterval): number;
|
|
47
47
|
/**
|
|
48
48
|
* Modifies one or more of the endpoints of this interval, returning a new interval representing the result.
|
|
49
|
-
* @internal
|
|
50
49
|
*/
|
|
51
50
|
modify(
|
|
52
51
|
label: string,
|
|
@@ -65,14 +64,13 @@ export interface IInterval {
|
|
|
65
64
|
* Unions this interval with `b`, returning a new interval.
|
|
66
65
|
* The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes
|
|
67
66
|
* intermediate values between the two intervals.
|
|
68
|
-
* @internal
|
|
69
67
|
*/
|
|
70
68
|
union(b: IInterval): IInterval;
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
/**
|
|
74
72
|
* Values are used in persisted formats (ops) and revertibles.
|
|
75
|
-
* @
|
|
73
|
+
* @internal
|
|
76
74
|
*/
|
|
77
75
|
export const IntervalOpType = {
|
|
78
76
|
ADD: "add",
|
|
@@ -82,11 +80,11 @@ export const IntervalOpType = {
|
|
|
82
80
|
POSITION_REMOVE: "positionRemove",
|
|
83
81
|
} as const;
|
|
84
82
|
/**
|
|
85
|
-
* @
|
|
83
|
+
* @internal
|
|
86
84
|
*/
|
|
87
85
|
export type IntervalOpType = (typeof IntervalOpType)[keyof typeof IntervalOpType];
|
|
88
86
|
/**
|
|
89
|
-
* @
|
|
87
|
+
* @internal
|
|
90
88
|
*/
|
|
91
89
|
export enum IntervalType {
|
|
92
90
|
Simple = 0x0,
|
|
@@ -141,16 +139,16 @@ export interface ISerializedInterval {
|
|
|
141
139
|
}
|
|
142
140
|
|
|
143
141
|
/**
|
|
144
|
-
* @
|
|
142
|
+
* @internal
|
|
145
143
|
*/
|
|
146
144
|
export interface ISerializableInterval extends IInterval {
|
|
147
145
|
/** Serializable bag of properties associated with the interval. */
|
|
148
146
|
properties: PropertySet;
|
|
149
|
-
|
|
147
|
+
/***/
|
|
150
148
|
propertyManager: PropertiesManager;
|
|
151
|
-
|
|
149
|
+
/***/
|
|
152
150
|
serialize(): ISerializedInterval;
|
|
153
|
-
|
|
151
|
+
/***/
|
|
154
152
|
addProperties(
|
|
155
153
|
props: PropertySet,
|
|
156
154
|
collaborating?: boolean,
|
|
@@ -205,7 +203,7 @@ export type CompressedSerializedInterval =
|
|
|
205
203
|
/**
|
|
206
204
|
* @sealed
|
|
207
205
|
* @deprecated The methods within have substitutions
|
|
208
|
-
* @
|
|
206
|
+
* @internal
|
|
209
207
|
*/
|
|
210
208
|
export interface IIntervalHelpers<TInterval extends ISerializableInterval> {
|
|
211
209
|
/**
|
|
@@ -100,7 +100,7 @@ function maxSide(sideA: Side, sideB: Side): Side {
|
|
|
100
100
|
* `mergeTreeReferencesCanSlideToEndpoint` feature flag set to true, the endpoints
|
|
101
101
|
* of the interval that are exclusive will have the ability to slide to these
|
|
102
102
|
* special endpoint segments.
|
|
103
|
-
* @
|
|
103
|
+
* @internal
|
|
104
104
|
*/
|
|
105
105
|
export class SequenceInterval implements ISerializableInterval {
|
|
106
106
|
/**
|
|
@@ -109,13 +109,10 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
109
109
|
public properties: PropertySet;
|
|
110
110
|
/**
|
|
111
111
|
* {@inheritDoc ISerializableInterval.propertyManager}
|
|
112
|
-
* @internal
|
|
113
112
|
*/
|
|
114
113
|
public propertyManager: PropertiesManager;
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
* @internal
|
|
118
|
-
*/
|
|
115
|
+
/***/
|
|
119
116
|
public get stickiness(): IntervalStickiness {
|
|
120
117
|
const startSegment = this.start.getSegment();
|
|
121
118
|
const endSegment = this.end.getSegment();
|
|
@@ -156,7 +153,6 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
156
153
|
|
|
157
154
|
/**
|
|
158
155
|
* Subscribes to position change events on this interval if there are no current listeners.
|
|
159
|
-
* @internal
|
|
160
156
|
*/
|
|
161
157
|
public addPositionChangeListeners(
|
|
162
158
|
beforePositionChange: () => void,
|
|
@@ -177,7 +173,6 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
177
173
|
|
|
178
174
|
/**
|
|
179
175
|
* Removes the currently subscribed position change listeners.
|
|
180
|
-
* @internal
|
|
181
176
|
*/
|
|
182
177
|
public removePositionChangeListeners(): void {
|
|
183
178
|
if (this.callbacks) {
|
|
@@ -189,7 +184,6 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
189
184
|
|
|
190
185
|
/**
|
|
191
186
|
* {@inheritDoc ISerializableInterval.serialize}
|
|
192
|
-
* @internal
|
|
193
187
|
*/
|
|
194
188
|
public serialize(): ISerializedInterval {
|
|
195
189
|
const startPosition = this.client.localReferencePositionToPosition(this.start);
|
|
@@ -299,7 +293,6 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
299
293
|
|
|
300
294
|
/**
|
|
301
295
|
* {@inheritDoc IInterval.union}
|
|
302
|
-
* @internal
|
|
303
296
|
*/
|
|
304
297
|
public union(b: SequenceInterval) {
|
|
305
298
|
const newStart = minReferencePosition(this.start, b.start);
|
|
@@ -334,7 +327,6 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
334
327
|
|
|
335
328
|
/**
|
|
336
329
|
* {@inheritDoc ISerializableInterval.addProperties}
|
|
337
|
-
* @internal
|
|
338
330
|
*/
|
|
339
331
|
public addProperties(
|
|
340
332
|
newProps: PropertySet,
|
|
@@ -357,7 +349,6 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
357
349
|
|
|
358
350
|
/**
|
|
359
351
|
* {@inheritDoc IInterval.modify}
|
|
360
|
-
* @internal
|
|
361
352
|
*/
|
|
362
353
|
public modify(
|
|
363
354
|
label: string,
|
|
@@ -637,7 +628,7 @@ export function createSequenceInterval(
|
|
|
637
628
|
|
|
638
629
|
/**
|
|
639
630
|
* @deprecated The methods within have substitutions
|
|
640
|
-
* @
|
|
631
|
+
* @internal
|
|
641
632
|
*/
|
|
642
633
|
export const sequenceIntervalHelpers: IIntervalHelpers<SequenceInterval> = {
|
|
643
634
|
create: createSequenceInterval,
|
package/src/packageVersion.ts
CHANGED