@fluidframework/sequence 2.0.0-dev.7.4.0.215930 → 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.
Files changed (168) hide show
  1. package/api-extractor-lint.json +13 -0
  2. package/api-report/sequence.api.md +68 -78
  3. package/dist/defaultMapInterfaces.d.ts +1 -2
  4. package/dist/defaultMapInterfaces.d.ts.map +1 -1
  5. package/dist/defaultMapInterfaces.js.map +1 -1
  6. package/dist/intervalCollection.d.ts +8 -8
  7. package/dist/intervalCollection.js +2 -2
  8. package/dist/intervalCollection.js.map +1 -1
  9. package/dist/intervalIndex/endpointInRangeIndex.d.ts +2 -2
  10. package/dist/intervalIndex/endpointInRangeIndex.js +1 -1
  11. package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
  12. package/dist/intervalIndex/endpointIndex.d.ts +2 -2
  13. package/dist/intervalIndex/endpointIndex.js +1 -1
  14. package/dist/intervalIndex/endpointIndex.js.map +1 -1
  15. package/dist/intervalIndex/idIntervalIndex.d.ts +2 -2
  16. package/dist/intervalIndex/idIntervalIndex.js +1 -1
  17. package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
  18. package/dist/intervalIndex/intervalIndex.d.ts +1 -1
  19. package/dist/intervalIndex/intervalIndex.js.map +1 -1
  20. package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +2 -2
  21. package/dist/intervalIndex/overlappingIntervalsIndex.js +1 -1
  22. package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
  23. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +1 -1
  24. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js +1 -1
  25. package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
  26. package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +2 -1
  27. package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
  28. package/dist/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
  29. package/dist/intervalIndex/startpointInRangeIndex.d.ts +2 -2
  30. package/dist/intervalIndex/startpointInRangeIndex.js +1 -1
  31. package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
  32. package/dist/intervals/interval.d.ts +2 -7
  33. package/dist/intervals/interval.d.ts.map +1 -1
  34. package/dist/intervals/interval.js +1 -5
  35. package/dist/intervals/interval.js.map +1 -1
  36. package/dist/intervals/intervalUtils.d.ts +9 -11
  37. package/dist/intervals/intervalUtils.d.ts.map +1 -1
  38. package/dist/intervals/intervalUtils.js +2 -2
  39. package/dist/intervals/intervalUtils.js.map +1 -1
  40. package/dist/intervals/sequenceInterval.d.ts +3 -12
  41. package/dist/intervals/sequenceInterval.d.ts.map +1 -1
  42. package/dist/intervals/sequenceInterval.js +3 -11
  43. package/dist/intervals/sequenceInterval.js.map +1 -1
  44. package/dist/packageVersion.d.ts +1 -1
  45. package/dist/packageVersion.js +1 -1
  46. package/dist/packageVersion.js.map +1 -1
  47. package/dist/revertibles.d.ts +9 -13
  48. package/dist/revertibles.d.ts.map +1 -1
  49. package/dist/revertibles.js +7 -9
  50. package/dist/revertibles.js.map +1 -1
  51. package/dist/sequence-alpha.d.ts +141 -1540
  52. package/dist/sequence-beta.d.ts +128 -1442
  53. package/dist/sequence-public.d.ts +128 -1442
  54. package/dist/sequence-untrimmed.d.ts +63 -85
  55. package/dist/sequence.d.ts +2 -3
  56. package/dist/sequence.d.ts.map +1 -1
  57. package/dist/sequence.js +1 -1
  58. package/dist/sequence.js.map +1 -1
  59. package/dist/sequenceDeltaEvent.d.ts +4 -4
  60. package/dist/sequenceDeltaEvent.js +3 -3
  61. package/dist/sequenceDeltaEvent.js.map +1 -1
  62. package/dist/sequenceFactory.d.ts +1 -1
  63. package/dist/sequenceFactory.js +1 -1
  64. package/dist/sequenceFactory.js.map +1 -1
  65. package/dist/sharedIntervalCollection.d.ts +3 -3
  66. package/dist/sharedIntervalCollection.js +2 -2
  67. package/dist/sharedIntervalCollection.js.map +1 -1
  68. package/dist/sharedSequence.d.ts +3 -3
  69. package/dist/sharedSequence.js +2 -2
  70. package/dist/sharedSequence.js.map +1 -1
  71. package/dist/sharedString.d.ts +4 -5
  72. package/dist/sharedString.d.ts.map +1 -1
  73. package/dist/sharedString.js +2 -3
  74. package/dist/sharedString.js.map +1 -1
  75. package/lib/defaultMapInterfaces.d.ts +1 -2
  76. package/lib/defaultMapInterfaces.d.ts.map +1 -1
  77. package/lib/defaultMapInterfaces.js.map +1 -1
  78. package/lib/intervalCollection.d.ts +8 -8
  79. package/lib/intervalCollection.js +2 -2
  80. package/lib/intervalCollection.js.map +1 -1
  81. package/lib/intervalIndex/endpointInRangeIndex.d.ts +2 -2
  82. package/lib/intervalIndex/endpointInRangeIndex.js +1 -1
  83. package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
  84. package/lib/intervalIndex/endpointIndex.d.ts +2 -2
  85. package/lib/intervalIndex/endpointIndex.js +1 -1
  86. package/lib/intervalIndex/endpointIndex.js.map +1 -1
  87. package/lib/intervalIndex/idIntervalIndex.d.ts +2 -2
  88. package/lib/intervalIndex/idIntervalIndex.js +1 -1
  89. package/lib/intervalIndex/idIntervalIndex.js.map +1 -1
  90. package/lib/intervalIndex/intervalIndex.d.ts +1 -1
  91. package/lib/intervalIndex/intervalIndex.js.map +1 -1
  92. package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +2 -2
  93. package/lib/intervalIndex/overlappingIntervalsIndex.js +1 -1
  94. package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
  95. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +1 -1
  96. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js +1 -1
  97. package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
  98. package/lib/intervalIndex/sequenceIntervalIndexes.d.ts +2 -1
  99. package/lib/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
  100. package/lib/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
  101. package/lib/intervalIndex/startpointInRangeIndex.d.ts +2 -2
  102. package/lib/intervalIndex/startpointInRangeIndex.js +1 -1
  103. package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
  104. package/lib/intervals/interval.d.ts +2 -7
  105. package/lib/intervals/interval.d.ts.map +1 -1
  106. package/lib/intervals/interval.js +1 -5
  107. package/lib/intervals/interval.js.map +1 -1
  108. package/lib/intervals/intervalUtils.d.ts +9 -11
  109. package/lib/intervals/intervalUtils.d.ts.map +1 -1
  110. package/lib/intervals/intervalUtils.js +2 -2
  111. package/lib/intervals/intervalUtils.js.map +1 -1
  112. package/lib/intervals/sequenceInterval.d.ts +3 -12
  113. package/lib/intervals/sequenceInterval.d.ts.map +1 -1
  114. package/lib/intervals/sequenceInterval.js +3 -11
  115. package/lib/intervals/sequenceInterval.js.map +1 -1
  116. package/lib/packageVersion.d.ts +1 -1
  117. package/lib/packageVersion.js +1 -1
  118. package/lib/packageVersion.js.map +1 -1
  119. package/lib/revertibles.d.ts +9 -13
  120. package/lib/revertibles.d.ts.map +1 -1
  121. package/lib/revertibles.js +7 -9
  122. package/lib/revertibles.js.map +1 -1
  123. package/lib/sequence-alpha.d.ts +141 -1540
  124. package/lib/sequence-beta.d.ts +128 -1442
  125. package/lib/sequence-public.d.ts +128 -1442
  126. package/lib/sequence-untrimmed.d.ts +63 -85
  127. package/lib/sequence.d.ts +2 -3
  128. package/lib/sequence.d.ts.map +1 -1
  129. package/lib/sequence.js +1 -1
  130. package/lib/sequence.js.map +1 -1
  131. package/lib/sequenceDeltaEvent.d.ts +4 -4
  132. package/lib/sequenceDeltaEvent.js +3 -3
  133. package/lib/sequenceDeltaEvent.js.map +1 -1
  134. package/lib/sequenceFactory.d.ts +1 -1
  135. package/lib/sequenceFactory.js +1 -1
  136. package/lib/sequenceFactory.js.map +1 -1
  137. package/lib/sharedIntervalCollection.d.ts +3 -3
  138. package/lib/sharedIntervalCollection.js +2 -2
  139. package/lib/sharedIntervalCollection.js.map +1 -1
  140. package/lib/sharedSequence.d.ts +3 -3
  141. package/lib/sharedSequence.js +2 -2
  142. package/lib/sharedSequence.js.map +1 -1
  143. package/lib/sharedString.d.ts +4 -5
  144. package/lib/sharedString.d.ts.map +1 -1
  145. package/lib/sharedString.js +2 -3
  146. package/lib/sharedString.js.map +1 -1
  147. package/package.json +16 -15
  148. package/src/defaultMapInterfaces.ts +1 -2
  149. package/src/intervalCollection.ts +8 -8
  150. package/src/intervalIndex/endpointInRangeIndex.ts +2 -2
  151. package/src/intervalIndex/endpointIndex.ts +2 -2
  152. package/src/intervalIndex/idIntervalIndex.ts +2 -2
  153. package/src/intervalIndex/intervalIndex.ts +1 -1
  154. package/src/intervalIndex/overlappingIntervalsIndex.ts +2 -2
  155. package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +1 -1
  156. package/src/intervalIndex/sequenceIntervalIndexes.ts +2 -1
  157. package/src/intervalIndex/startpointInRangeIndex.ts +2 -2
  158. package/src/intervals/interval.ts +2 -7
  159. package/src/intervals/intervalUtils.ts +9 -11
  160. package/src/intervals/sequenceInterval.ts +3 -12
  161. package/src/packageVersion.ts +1 -1
  162. package/src/revertibles.ts +9 -13
  163. package/src/sequence.ts +2 -3
  164. package/src/sequenceDeltaEvent.ts +4 -4
  165. package/src/sequenceFactory.ts +1 -1
  166. package/src/sharedIntervalCollection.ts +3 -3
  167. package/src/sharedSequence.ts +3 -3
  168. 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,uCA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16
  * In addition to text, a Shared String can also contain markers. Markers can be
17
17
  * used to store metadata at positions within the text, like the details of an
18
18
  * image or Fluid object that should be rendered with the text.
19
- *
20
- * @public
19
+ * @internal
21
20
  */
22
21
  class SharedString extends sequence_1.SharedSegmentSequence {
23
22
  /**
@@ -210,7 +209,7 @@ exports.SharedString = SharedString;
210
209
  * // parallelMarkers === [<paragraph marker 1 object>, <paragraph marker 2 object>]
211
210
  * // Note parallelText does not include "missing".
212
211
  * ```
213
- * @public
212
+ * @internal
214
213
  */
215
214
  function getTextAndMarkers(sharedString, label, start, end) {
216
215
  const accum = {
@@ -1 +1 @@
1
- {"version":3,"file":"sharedString.js","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAcoC;AAEpC,yCAAmD;AACnD,uDAAwD;AAsCxD;;;;;;;;;;GAUG;AACH,MAAa,YACZ,SAAQ,gCAA0C;IAGlD;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW;QAChE,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,qCAAmB,CAAC,IAAI,CAAiB,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,UAAU;QACvB,OAAO,IAAI,qCAAmB,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,qCAAmB,CAAC,eAAsB,CAAC,CAAC;QAHrE,OAAE,GAAF,EAAE,CAAQ;QAIjB,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC3D,CAAC;IAED;;;;;OAKG;IACI,oBAAoB,CAC1B,YAA+B,EAC/B,OAAsB,EACtB,KAAmB;QAEnB,MAAM,OAAO,GAAG,IAAI,m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I,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,IAAA,4BAAe,EAAC,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,2DAcoC;AAEpC,yCAAmD;AACnD,uDAAwD;AAsCxD;;;;;;;;;GASG;AACH,MAAa,YACZ,SAAQ,gCAA0C;IAGlD;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW;QAChE,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,qCAAmB,CAAC,IAAI,CAAiB,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,UAAU;QACvB,OAAO,IAAI,qCAAmB,EAAE,CAAC;IAClC,CAAC;IAED,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC;IACb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I,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"]}
@@ -31,7 +31,6 @@ export interface IValueOpEmitter {
31
31
  * @param previousValue - JSONable previous value as defined by the value type @deprecated unused
32
32
  * @param params - JSONable params for the operation as defined by the value type
33
33
  * @param localOpMetadata - JSONable local metadata which should be submitted with the op
34
- * @internal
35
34
  */
36
35
  emit(opName: IntervalOpType, previousValue: undefined, params: SerializedIntervalDelta, localOpMetadata: IMapMessageLocalMetadata): void;
37
36
  }
@@ -43,7 +42,7 @@ export interface IMapMessageLocalMetadata {
43
42
  }
44
43
  /**
45
44
  * Optional flags that configure options for sequence DDSs
46
- * @public
45
+ * @internal
47
46
  */
48
47
  export interface SequenceOptions {
49
48
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"defaultMapInterfaces.d.ts","sourceRoot":"","sources":["../src/defaultMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,aAAa,EAAE,GAAG,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;;;;OAOG;IACH,IAAI,CACH,MAAM,EAAE,cAAc,EACtB,aAAa,EAAE,SAAS,EACxB,MAAM,EAAE,uBAAuB,EAC/B,eAAe,EAAE,wBAAwB,GACvC,IAAI,CAAC;CACR;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC/B;;;;;;;;;;;;OAYG;IACH,yBAAyB,EAAE,OAAO,CAAC;IACnC;;;;;;;;OAQG;IACH,qCAAqC,EAAE,OAAO,CAAC;IAC/C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,C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;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IAEvB;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;CAC/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultMapInterfaces.js","sourceRoot":"","sources":["../src/defaultMapInterfaces.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/protocol-definitions\";\nimport { ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/core-interfaces\";\nimport { ISerializedInterval, IntervalOpType, SerializedIntervalDelta } from \"./intervals\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n */\nexport interface IValueChanged {\n\t/**\n\t * The key storing the value that changed.\n\t */\n\tkey: string;\n\n\t/**\n\t * The value that was stored at the key prior to the change.\n\t */\n\tpreviousValue: any;\n}\n\n/**\n * Value types are given an IValueOpEmitter to emit their ops through the container type that holds them.\n * @internal\n * @deprecated - will be remove from public api as there is no public used of this type\n */\nexport interface IValueOpEmitter {\n\t/**\n\t * Called by the value type to emit a value type operation through the container type holding it.\n\t * @param opName - Name of the emitted operation\n\t * @param previousValue - JSONable previous value as defined by the value type @deprecated unused\n\t * @param params - JSONable params for the operation as defined by the value type\n\t * @param localOpMetadata - JSONable local metadata which should be submitted with the op\n\t * @internal\n\t */\n\temit(\n\t\topName: IntervalOpType,\n\t\tpreviousValue: undefined,\n\t\tparams: SerializedIntervalDelta,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t): void;\n}\n\n/**\n * @internal\n */\nexport interface IMapMessageLocalMetadata {\n\tlocalSeq: number;\n}\n\n/**\n * Optional flags that configure options for sequence DDSs\n * @public\n */\nexport interface SequenceOptions {\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 SequencePlace}\n\t * for additional context.\n\t *\n\t * This flag must be enabled to pass instances of {@link 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\t/**\n\t * Enable the ability for interval endpoints to slide to the special endpoint\n\t * segments that exist before and after the bounds of the string. This is\n\t * primarily useful for workflows involving interval stickiness, and it is\n\t * suggested to enable both this flag and `intervalStickinessEnabled` at the\n\t * same time.\n\t *\n\t * The default value is false.\n\t */\n\tmergeTreeReferencesCanSlideToEndpoint: boolean;\n\t[key: string]: boolean;\n}\n\n/**\n * A value factory is used to serialize/deserialize value types to a map\n * @alpha\n */\nexport interface IValueFactory<T> {\n\t/**\n\t * Create a new value type. Used both in creation of new value types, as well as in loading existing ones\n\t * from remote.\n\t * @param emitter - Emitter object that the created value type will use to emit operations\n\t * @param raw - Initialization parameters as defined by the value type\n\t * @returns The new value type\n\t * @alpha\n\t */\n\tload(emitter: IValueOpEmitter, raw: any, options?: Partial<SequenceOptions>): T;\n\n\t/**\n\t * Given a value type, provides a JSONable form of its data to be used for snapshotting. This data must be\n\t * loadable using the load method of its factory.\n\t * @param value - The value type to serialize\n\t * @returns The JSONable form of the value type\n\t * @alpha\n\t */\n\tstore(value: T): any;\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n * @alpha\n */\nexport interface IValueOperation<T> {\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 * @alpha\n\t */\n\tprocess(\n\t\tvalue: T,\n\t\tparams: ISerializedInterval,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata | undefined,\n\t);\n\n\t/**\n\t * Rebases an `op` on `value` from its original perspective (ref/local seq) to the current\n\t * perspective. Should be invoked on reconnection.\n\t * @param value - The current value stored at the given key, which should be the value type.\n\t * @param op - The op to be rebased.\n\t * @param localOpMetadata - Any local metadata that was originally submitted with the op.\n\t * @returns A rebased version of the op and any local metadata that should be submitted with it.\n\t */\n\trebase(\n\t\tvalue: T,\n\t\top: IValueTypeOperationValue,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t):\n\t\t| { rebasedOp: IValueTypeOperationValue; rebasedLocalOpMetadata: IMapMessageLocalMetadata }\n\t\t| undefined;\n}\n\n/**\n * Defines a value type that can be registered on a container type.\n */\nexport interface IValueType<T> {\n\t/**\n\t * Name of the value type.\n\t * @alpha\n\t */\n\tname: string;\n\n\t/**\n\t * Factory method used to convert to/from a JSON form of the type.\n\t * @alpha\n\t */\n\tfactory: IValueFactory<T>;\n\n\t/**\n\t * Operations that can be applied to the value type.\n\t * @alpha\n\t */\n\tops: Map<IntervalOpType, IValueOperation<T>>;\n}\n\nexport interface ISharedDefaultMapEvents extends ISharedObjectEvents {\n\t(\n\t\tevent: \"valueChanged\" | \"create\",\n\t\tlistener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\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 ISerializableValue {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\tvalue: any;\n}\n\nexport interface ISerializedValue {\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 * @alpha\n */\nexport interface IValueTypeOperationValue {\n\t/**\n\t * The name of the operation.\n\t */\n\topName: IntervalOpType;\n\n\t/**\n\t * The payload that is submitted along with the operation.\n\t */\n\tvalue: SerializedIntervalDelta;\n}\n"]}
1
+ {"version":3,"file":"defaultMapInterfaces.js","sourceRoot":"","sources":["../src/defaultMapInterfaces.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/protocol-definitions\";\nimport { ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/core-interfaces\";\nimport { ISerializedInterval, IntervalOpType, SerializedIntervalDelta } from \"./intervals\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n */\nexport interface IValueChanged {\n\t/**\n\t * The key storing the value that changed.\n\t */\n\tkey: string;\n\n\t/**\n\t * The value that was stored at the key prior to the change.\n\t */\n\tpreviousValue: any;\n}\n\n/**\n * Value types are given an IValueOpEmitter to emit their ops through the container type that holds them.\n * @internal\n * @deprecated - will be remove from public api as there is no public used of this type\n */\nexport interface IValueOpEmitter {\n\t/**\n\t * Called by the value type to emit a value type operation through the container type holding it.\n\t * @param opName - Name of the emitted operation\n\t * @param previousValue - JSONable previous value as defined by the value type @deprecated unused\n\t * @param params - JSONable params for the operation as defined by the value type\n\t * @param localOpMetadata - JSONable local metadata which should be submitted with the op\n\t */\n\temit(\n\t\topName: IntervalOpType,\n\t\tpreviousValue: undefined,\n\t\tparams: SerializedIntervalDelta,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t): void;\n}\n\n/**\n * @internal\n */\nexport interface IMapMessageLocalMetadata {\n\tlocalSeq: number;\n}\n\n/**\n * Optional flags that configure options for sequence DDSs\n * @internal\n */\nexport interface SequenceOptions {\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 SequencePlace}\n\t * for additional context.\n\t *\n\t * This flag must be enabled to pass instances of {@link 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\t/**\n\t * Enable the ability for interval endpoints to slide to the special endpoint\n\t * segments that exist before and after the bounds of the string. This is\n\t * primarily useful for workflows involving interval stickiness, and it is\n\t * suggested to enable both this flag and `intervalStickinessEnabled` at the\n\t * same time.\n\t *\n\t * The default value is false.\n\t */\n\tmergeTreeReferencesCanSlideToEndpoint: boolean;\n\t[key: string]: boolean;\n}\n\n/**\n * A value factory is used to serialize/deserialize value types to a map\n * @alpha\n */\nexport interface IValueFactory<T> {\n\t/**\n\t * Create a new value type. Used both in creation of new value types, as well as in loading existing ones\n\t * from remote.\n\t * @param emitter - Emitter object that the created value type will use to emit operations\n\t * @param raw - Initialization parameters as defined by the value type\n\t * @returns The new value type\n\t * @alpha\n\t */\n\tload(emitter: IValueOpEmitter, raw: any, options?: Partial<SequenceOptions>): T;\n\n\t/**\n\t * Given a value type, provides a JSONable form of its data to be used for snapshotting. This data must be\n\t * loadable using the load method of its factory.\n\t * @param value - The value type to serialize\n\t * @returns The JSONable form of the value type\n\t * @alpha\n\t */\n\tstore(value: T): any;\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n * @alpha\n */\nexport interface IValueOperation<T> {\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 * @alpha\n\t */\n\tprocess(\n\t\tvalue: T,\n\t\tparams: ISerializedInterval,\n\t\tlocal: boolean,\n\t\tmessage: ISequencedDocumentMessage | undefined,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata | undefined,\n\t);\n\n\t/**\n\t * Rebases an `op` on `value` from its original perspective (ref/local seq) to the current\n\t * perspective. Should be invoked on reconnection.\n\t * @param value - The current value stored at the given key, which should be the value type.\n\t * @param op - The op to be rebased.\n\t * @param localOpMetadata - Any local metadata that was originally submitted with the op.\n\t * @returns A rebased version of the op and any local metadata that should be submitted with it.\n\t */\n\trebase(\n\t\tvalue: T,\n\t\top: IValueTypeOperationValue,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t):\n\t\t| { rebasedOp: IValueTypeOperationValue; rebasedLocalOpMetadata: IMapMessageLocalMetadata }\n\t\t| undefined;\n}\n\n/**\n * Defines a value type that can be registered on a container type.\n */\nexport interface IValueType<T> {\n\t/**\n\t * Name of the value type.\n\t * @alpha\n\t */\n\tname: string;\n\n\t/**\n\t * Factory method used to convert to/from a JSON form of the type.\n\t * @alpha\n\t */\n\tfactory: IValueFactory<T>;\n\n\t/**\n\t * Operations that can be applied to the value type.\n\t * @alpha\n\t */\n\tops: Map<IntervalOpType, IValueOperation<T>>;\n}\n\nexport interface ISharedDefaultMapEvents extends ISharedObjectEvents {\n\t(\n\t\tevent: \"valueChanged\" | \"create\",\n\t\tlistener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\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 ISerializableValue {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\tvalue: any;\n}\n\nexport interface ISerializedValue {\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 * @alpha\n */\nexport interface IValueTypeOperationValue {\n\t/**\n\t * The name of the operation.\n\t */\n\topName: IntervalOpType;\n\n\t/**\n\t * The payload that is submitted along with the operation.\n\t */\n\tvalue: SerializedIntervalDelta;\n}\n"]}
@@ -32,14 +32,14 @@ import { IEndpointIndex, IIdIntervalIndex, IOverlappingIntervalsIndex, IntervalI
32
32
  * If a SequencePlace is the endpoint of a range (e.g. start/end of an interval or search range),
33
33
  * the Side value means it is exclusive if it is nearer to the other position and inclusive if it is farther.
34
34
  * E.g. the start of a range with Side.After is exclusive of the character at the position.
35
- * @public
35
+ * @internal
36
36
  */
37
37
  export type SequencePlace = number | "start" | "end" | InteriorSequencePlace;
38
38
  /**
39
39
  * A sequence place that does not refer to the special endpoint segments.
40
40
  *
41
41
  * See {@link SequencePlace} for additional context.
42
- * @public
42
+ * @internal
43
43
  */
44
44
  export interface InteriorSequencePlace {
45
45
  pos: number;
@@ -49,7 +49,7 @@ export interface InteriorSequencePlace {
49
49
  * Defines a side relative to a character in a sequence.
50
50
  *
51
51
  * @remarks See {@link SequencePlace} for additional context on usage.
52
- * @public
52
+ * @internal
53
53
  */
54
54
  export declare enum Side {
55
55
  Before = 0,
@@ -128,7 +128,7 @@ export declare class IntervalCollectionValueType implements IValueType<IntervalC
128
128
  }
129
129
  export declare function makeOpsMap<T extends ISerializableInterval>(): Map<IntervalOpType, IValueOperation<IntervalCollection<T>>>;
130
130
  /**
131
- * @public
131
+ * @internal
132
132
  */
133
133
  export type DeserializeCallback = (properties: PropertySet) => void;
134
134
  declare class IntervalCollectionIterator<TInterval extends ISerializableInterval> implements Iterator<TInterval> {
@@ -139,7 +139,7 @@ declare class IntervalCollectionIterator<TInterval extends ISerializableInterval
139
139
  }
140
140
  /**
141
141
  * Change events emitted by `IntervalCollection`s
142
- * @public
142
+ * @internal
143
143
  */
144
144
  export interface IIntervalCollectionEvent<TInterval extends ISerializableInterval> extends IEvent {
145
145
  /**
@@ -176,7 +176,7 @@ export interface IIntervalCollectionEvent<TInterval extends ISerializableInterva
176
176
  /**
177
177
  * Collection of intervals that supports addition, modification, removal, and efficient spatial querying.
178
178
  * Changes to this collection will be incur updates on collaborating clients (i.e. they are not local-only).
179
- * @public
179
+ * @internal
180
180
  */
181
181
  export interface IIntervalCollection<TInterval extends ISerializableInterval> extends TypedEventEmitter<IIntervalCollectionEvent<TInterval>> {
182
182
  readonly attached: boolean;
@@ -520,7 +520,7 @@ export declare class IntervalCollection<TInterval extends ISerializableInterval>
520
520
  }
521
521
  /**
522
522
  * Information that identifies an interval within a `Sequence`.
523
- * @public
523
+ * @internal
524
524
  */
525
525
  export interface IntervalLocator {
526
526
  /**
@@ -537,7 +537,7 @@ export interface IntervalLocator {
537
537
  * @returns undefined if the reference position is not the endpoint of any interval (e.g. it was created
538
538
  * on the merge tree directly by app code), otherwise an {@link IntervalLocator} for the interval this
539
539
  * endpoint is a part of.
540
- * @public
540
+ * @internal
541
541
  */
542
542
  export declare function intervalLocatorFromEndpoint(potentialEndpoint: LocalReferencePosition): IntervalLocator | undefined;
543
543
  export {};
@@ -15,7 +15,7 @@ import { EndpointIndex, OverlappingIntervalsIndex, createIdIntervalIndex, } from
15
15
  * Defines a side relative to a character in a sequence.
16
16
  *
17
17
  * @remarks See {@link SequencePlace} for additional context on usage.
18
- * @public
18
+ * @internal
19
19
  */
20
20
  export var Side;
21
21
  (function (Side) {
@@ -1133,7 +1133,7 @@ function setSlideOnRemove(lref) {
1133
1133
  * @returns undefined if the reference position is not the endpoint of any interval (e.g. it was created
1134
1134
  * on the merge tree directly by app code), otherwise an {@link IntervalLocator} for the interval this
1135
1135
  * endpoint is a part of.
1136
- * @public
1136
+ * @internal
1137
1137
  */
1138
1138
  export function intervalLocatorFromEndpoint(potentialEndpoint) {
1139
1139
  const { interval, [reservedRangeLabelsKey]: collectionNameArray } = potentialEndpoint.properties ?? {};