@fluidframework/sequence 2.3.1 → 2.4.0-297027
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-report/sequence.legacy.alpha.api.md +6 -2
- package/dist/intervals/sequenceInterval.d.ts +3 -0
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +3 -0
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sequence.d.ts +1 -0
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +1 -0
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.d.ts +9 -0
- package/dist/sequenceDeltaEvent.d.ts.map +1 -1
- package/dist/sequenceDeltaEvent.js +9 -0
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sequenceFactory.d.ts.map +1 -1
- package/dist/sequenceFactory.js +4 -0
- package/dist/sequenceFactory.js.map +1 -1
- package/dist/sharedSequence.d.ts.map +1 -1
- package/dist/sharedSequence.js +2 -0
- package/dist/sharedSequence.js.map +1 -1
- package/dist/sharedString.d.ts +1 -0
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +5 -1
- package/dist/sharedString.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +3 -0
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +3 -0
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/sequence.d.ts +1 -0
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +1 -0
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.d.ts +9 -0
- package/lib/sequenceDeltaEvent.d.ts.map +1 -1
- package/lib/sequenceDeltaEvent.js +9 -0
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sequenceFactory.d.ts.map +1 -1
- package/lib/sequenceFactory.js +4 -0
- package/lib/sequenceFactory.js.map +1 -1
- package/lib/sharedSequence.d.ts.map +1 -1
- package/lib/sharedSequence.js +2 -0
- package/lib/sharedSequence.js.map +1 -1
- package/lib/sharedString.d.ts +1 -0
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +5 -1
- package/lib/sharedString.js.map +1 -1
- package/package.json +31 -18
- package/src/intervals/sequenceInterval.ts +3 -0
- package/src/packageVersion.ts +1 -1
- package/src/sequence.ts +1 -0
- package/src/sequenceDeltaEvent.ts +9 -0
- package/src/sequenceFactory.ts +5 -0
- package/src/sharedSequence.ts +2 -0
- package/src/sharedString.ts +3 -0
package/lib/sharedString.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { Marker, TextSegment, refHasTileLabel, } from "@fluidframework/merge-tree/internal";
|
|
6
|
+
// eslint-disable-next-line import/no-deprecated
|
|
6
7
|
import { SharedSegmentSequence } from "./sequence.js";
|
|
7
8
|
import { SharedStringFactory } from "./sequenceFactory.js";
|
|
8
9
|
/**
|
|
@@ -15,8 +16,11 @@ import { SharedStringFactory } from "./sequenceFactory.js";
|
|
|
15
16
|
* image or Fluid object that should be rendered with the text.
|
|
16
17
|
* @legacy
|
|
17
18
|
* @alpha
|
|
19
|
+
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
18
20
|
*/
|
|
19
|
-
export class SharedStringClass
|
|
21
|
+
export class SharedStringClass
|
|
22
|
+
// eslint-disable-next-line import/no-deprecated
|
|
23
|
+
extends SharedSegmentSequence {
|
|
20
24
|
get ISharedString() {
|
|
21
25
|
return this;
|
|
22
26
|
}
|
package/lib/sharedString.js.map
CHANGED
|
@@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C;QAClC,CAAC;aAAM,CAAC;YACP,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;QAC1D,CAAC;IACF,CAAC;SAAM,CAAC;QACP,IAAI,WAAW,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3C,MAAM,eAAe;YACpB,gEAAgE;YAChE,WAAW,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACjF,WAAW,CAAC,IAAI,IAAI,eAAe,CAAC;QACrC,CAAC;aAAM,CAAC;YACP,MAAM,MAAM,GAAG,OAAiB,CAAC;YACjC,IAAI,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBAC5D,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;YACvB,CAAC;QACF,CAAC;IACF,CAAC;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\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeTextHelper,\n\tIRelativePosition,\n\tISegment,\n\tISegmentAction,\n\tMarker,\n\tPropertySet,\n\tReferenceType,\n\tTextSegment,\n\trefHasTileLabel,\n} from \"@fluidframework/merge-tree/internal\";\n\nimport { SharedSegmentSequence, type ISharedSegmentSequence } from \"./sequence.js\";\nimport { SharedStringFactory } from \"./sequenceFactory.js\";\n\n/**\n * Fluid object interface describing access methods on a SharedString\n * @legacy\n * @alpha\n */\nexport interface ISharedString extends ISharedSegmentSequence<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(pos: number, refType: ReferenceType, props?: PropertySet): void;\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\tinsertMarkerRelative(\n\t\trelativePos1: IRelativePosition,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t): void;\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\tinsertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet): void;\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\treplaceText(start: number, end: number, text: string, props?: PropertySet): void;\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\tremoveText(start: number, end: number): void;\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 */\n\tannotateMarker(marker: Marker, props: PropertySet): void;\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`. Default true.\n\t */\n\tsearchForMarker(\n\t\tstartPos: number,\n\t\tmarkerLabel: string,\n\t\tforwards?: boolean,\n\t): Marker | undefined;\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\tgetText(start?: number, end?: number): string;\n\n\t/**\n\t * Adds spaces for markers and handles, so that position calculations account for them.\n\t */\n\tgetTextWithPlaceholders(start?: number, end?: number): string;\n\n\tgetTextRangeWithMarkers(start: number, end: number): string;\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\tgetMarkerFromId(id: string): ISegment | undefined;\n}\n\n/**\n * @legacy\n * @alpha\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 * @legacy\n * @alpha\n */\nexport class SharedStringClass\n\textends SharedSegmentSequence<SharedStringSegment>\n\timplements ISharedString\n{\n\tpublic get ISharedString(): ISharedString {\n\t\treturn this;\n\t}\n\n\t// eslint-disable-next-line import/no-deprecated\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 * {@inheritDoc ISharedString.insertMarkerRelative}\n\t */\n\tpublic insertMarkerRelative(\n\t\trelativePos1: IRelativePosition,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t): void {\n\t\tconst pos = this.posFromRelativePos(relativePos1);\n\t\tthis.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(pos, Marker.make(refType, props)),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertMarker}\n\t */\n\tpublic insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): void {\n\t\tthis.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(pos, Marker.make(refType, props)),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertTextRelative}\n\t */\n\tpublic insertTextRelative(\n\t\trelativePos1: IRelativePosition,\n\t\ttext: string,\n\t\tprops?: PropertySet,\n\t): void {\n\t\tconst pos = this.posFromRelativePos(relativePos1);\n\t\tthis.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(pos, TextSegment.make(text, props)),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertText}\n\t */\n\tpublic insertText(pos: number, text: string, props?: PropertySet): void {\n\t\tthis.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(pos, TextSegment.make(text, props)),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.replaceText}\n\t */\n\tpublic replaceText(start: number, end: number, text: string, props?: PropertySet): void {\n\t\tthis.replaceRange(start, end, TextSegment.make(text, props));\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.removeText}\n\t */\n\tpublic removeText(start: number, end: number): void {\n\t\tthis.removeRange(start, end);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.annotateMarker}\n\t */\n\tpublic annotateMarker(marker: Marker, props: PropertySet): void {\n\t\tthis.guardReentrancy(() => this.client.annotateMarker(marker, props));\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.searchForMarker}\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 * {@inheritDoc ISharedString.getText}\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 * {@inheritDoc ISharedString.getTextWithPlaceholders}\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\t/**\n\t * {@inheritDoc ISharedString.getTextRangeWithMarkers}\n\t */\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 * {@inheritDoc ISharedString.getMarkerFromId}\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: ISharedString,\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\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\t\tplaceholder === \"*\" ? `\\n${segment}` : 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;AAMH,OAAO,EAMN,MAAM,EAGN,WAAW,EACX,eAAe,GACf,MAAM,qCAAqC,CAAC;AAE7C,gDAAgD;AAChD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AA8G3D;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,iBAAiB;AAC7B,gDAAgD;AAChD,SAAQ,qBAA0C;IAGlD,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC;IACb,CAAC;IAKD,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;;OAEG;IACI,oBAAoB,CAC1B,YAA+B,EAC/B,OAAsB,EACtB,KAAmB;QAEnB,MAAM,GAAG,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QAClD,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,CACzB,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,C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AAI,CAAC,CAAC;gBAC9C,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC;YACvB,CAAC;QACF,CAAC;IACF,CAAC;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\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeTextHelper,\n\tIRelativePosition,\n\tISegment,\n\tISegmentAction,\n\tMarker,\n\tPropertySet,\n\tReferenceType,\n\tTextSegment,\n\trefHasTileLabel,\n} from \"@fluidframework/merge-tree/internal\";\n\n// eslint-disable-next-line import/no-deprecated\nimport { SharedSegmentSequence, type ISharedSegmentSequence } from \"./sequence.js\";\nimport { SharedStringFactory } from \"./sequenceFactory.js\";\n\n/**\n * Fluid object interface describing access methods on a SharedString\n * @legacy\n * @alpha\n */\nexport interface ISharedString extends ISharedSegmentSequence<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(pos: number, refType: ReferenceType, props?: PropertySet): void;\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\tinsertMarkerRelative(\n\t\trelativePos1: IRelativePosition,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t): void;\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\tinsertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet): void;\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\treplaceText(start: number, end: number, text: string, props?: PropertySet): void;\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\tremoveText(start: number, end: number): void;\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 */\n\tannotateMarker(marker: Marker, props: PropertySet): void;\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`. Default true.\n\t */\n\tsearchForMarker(\n\t\tstartPos: number,\n\t\tmarkerLabel: string,\n\t\tforwards?: boolean,\n\t): Marker | undefined;\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\tgetText(start?: number, end?: number): string;\n\n\t/**\n\t * Adds spaces for markers and handles, so that position calculations account for them.\n\t */\n\tgetTextWithPlaceholders(start?: number, end?: number): string;\n\n\tgetTextRangeWithMarkers(start: number, end: number): string;\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\tgetMarkerFromId(id: string): ISegment | undefined;\n}\n\n/**\n * @legacy\n * @alpha\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 * @legacy\n * @alpha\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n */\nexport class SharedStringClass\n\t// eslint-disable-next-line import/no-deprecated\n\textends SharedSegmentSequence<SharedStringSegment>\n\timplements ISharedString\n{\n\tpublic get ISharedString(): ISharedString {\n\t\treturn this;\n\t}\n\n\t// eslint-disable-next-line import/no-deprecated\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 * {@inheritDoc ISharedString.insertMarkerRelative}\n\t */\n\tpublic insertMarkerRelative(\n\t\trelativePos1: IRelativePosition,\n\t\trefType: ReferenceType,\n\t\tprops?: PropertySet,\n\t): void {\n\t\tconst pos = this.posFromRelativePos(relativePos1);\n\t\tthis.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(pos, Marker.make(refType, props)),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertMarker}\n\t */\n\tpublic insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): void {\n\t\tthis.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(pos, Marker.make(refType, props)),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertTextRelative}\n\t */\n\tpublic insertTextRelative(\n\t\trelativePos1: IRelativePosition,\n\t\ttext: string,\n\t\tprops?: PropertySet,\n\t): void {\n\t\tconst pos = this.posFromRelativePos(relativePos1);\n\t\tthis.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(pos, TextSegment.make(text, props)),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.insertText}\n\t */\n\tpublic insertText(pos: number, text: string, props?: PropertySet): void {\n\t\tthis.guardReentrancy(() =>\n\t\t\tthis.client.insertSegmentLocal(pos, TextSegment.make(text, props)),\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.replaceText}\n\t */\n\tpublic replaceText(start: number, end: number, text: string, props?: PropertySet): void {\n\t\tthis.replaceRange(start, end, TextSegment.make(text, props));\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.removeText}\n\t */\n\tpublic removeText(start: number, end: number): void {\n\t\tthis.removeRange(start, end);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.annotateMarker}\n\t */\n\tpublic annotateMarker(marker: Marker, props: PropertySet): void {\n\t\tthis.guardReentrancy(() => this.client.annotateMarker(marker, props));\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedString.searchForMarker}\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 * {@inheritDoc ISharedString.getText}\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 * {@inheritDoc ISharedString.getTextWithPlaceholders}\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\t/**\n\t * {@inheritDoc ISharedString.getTextRangeWithMarkers}\n\t */\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 * {@inheritDoc ISharedString.getMarkerFromId}\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: ISharedString,\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\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\t\tplaceholder === \"*\" ? `\\n${segment}` : 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.
|
|
3
|
+
"version": "2.4.0-297027",
|
|
4
4
|
"description": "Distributed sequence",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -77,33 +77,33 @@
|
|
|
77
77
|
"temp-directory": "nyc/.nyc_output"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@fluid-internal/client-utils": "
|
|
81
|
-
"@fluidframework/core-interfaces": "
|
|
82
|
-
"@fluidframework/core-utils": "
|
|
83
|
-
"@fluidframework/datastore-definitions": "
|
|
84
|
-
"@fluidframework/driver-definitions": "
|
|
85
|
-
"@fluidframework/merge-tree": "
|
|
86
|
-
"@fluidframework/runtime-definitions": "
|
|
87
|
-
"@fluidframework/runtime-utils": "
|
|
88
|
-
"@fluidframework/shared-object-base": "
|
|
89
|
-
"@fluidframework/telemetry-utils": "
|
|
80
|
+
"@fluid-internal/client-utils": "2.4.0-297027",
|
|
81
|
+
"@fluidframework/core-interfaces": "2.4.0-297027",
|
|
82
|
+
"@fluidframework/core-utils": "2.4.0-297027",
|
|
83
|
+
"@fluidframework/datastore-definitions": "2.4.0-297027",
|
|
84
|
+
"@fluidframework/driver-definitions": "2.4.0-297027",
|
|
85
|
+
"@fluidframework/merge-tree": "2.4.0-297027",
|
|
86
|
+
"@fluidframework/runtime-definitions": "2.4.0-297027",
|
|
87
|
+
"@fluidframework/runtime-utils": "2.4.0-297027",
|
|
88
|
+
"@fluidframework/shared-object-base": "2.4.0-297027",
|
|
89
|
+
"@fluidframework/telemetry-utils": "2.4.0-297027",
|
|
90
90
|
"double-ended-queue": "^2.1.0-0",
|
|
91
91
|
"uuid": "^9.0.0"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
95
95
|
"@biomejs/biome": "~1.8.3",
|
|
96
|
-
"@fluid-internal/mocha-test-setup": "
|
|
97
|
-
"@fluid-private/stochastic-test-utils": "
|
|
98
|
-
"@fluid-private/test-dds-utils": "
|
|
96
|
+
"@fluid-internal/mocha-test-setup": "2.4.0-297027",
|
|
97
|
+
"@fluid-private/stochastic-test-utils": "2.4.0-297027",
|
|
98
|
+
"@fluid-private/test-dds-utils": "2.4.0-297027",
|
|
99
99
|
"@fluid-tools/benchmark": "^0.50.0",
|
|
100
100
|
"@fluid-tools/build-cli": "^0.46.0",
|
|
101
101
|
"@fluidframework/build-common": "^2.0.3",
|
|
102
102
|
"@fluidframework/build-tools": "^0.46.0",
|
|
103
|
-
"@fluidframework/container-definitions": "
|
|
103
|
+
"@fluidframework/container-definitions": "2.4.0-297027",
|
|
104
104
|
"@fluidframework/eslint-config-fluid": "^5.4.0",
|
|
105
|
-
"@fluidframework/sequence-previous": "npm:@fluidframework/sequence@2.
|
|
106
|
-
"@fluidframework/test-runtime-utils": "
|
|
105
|
+
"@fluidframework/sequence-previous": "npm:@fluidframework/sequence@2.3.0",
|
|
106
|
+
"@fluidframework/test-runtime-utils": "2.4.0-297027",
|
|
107
107
|
"@microsoft/api-extractor": "7.47.8",
|
|
108
108
|
"@types/diff": "^3.5.1",
|
|
109
109
|
"@types/double-ended-queue": "^2.1.0",
|
|
@@ -135,7 +135,20 @@
|
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
"typeValidation": {
|
|
138
|
-
"broken": {
|
|
138
|
+
"broken": {
|
|
139
|
+
"ClassStatics_SequenceMaintenanceEvent": {
|
|
140
|
+
"backCompat": false
|
|
141
|
+
},
|
|
142
|
+
"Class_SequenceMaintenanceEvent": {
|
|
143
|
+
"backCompat": false
|
|
144
|
+
},
|
|
145
|
+
"ClassStatics_SequenceDeltaEvent": {
|
|
146
|
+
"backCompat": false
|
|
147
|
+
},
|
|
148
|
+
"Class_SequenceDeltaEvent": {
|
|
149
|
+
"backCompat": false
|
|
150
|
+
}
|
|
151
|
+
},
|
|
139
152
|
"entrypoint": "internal"
|
|
140
153
|
},
|
|
141
154
|
"scripts": {
|
|
@@ -127,6 +127,9 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
127
127
|
);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
132
|
+
*/
|
|
130
133
|
constructor(
|
|
131
134
|
private readonly client: Client,
|
|
132
135
|
/**
|
package/src/packageVersion.ts
CHANGED
package/src/sequence.ts
CHANGED
|
@@ -345,6 +345,7 @@ export interface ISharedSegmentSequence<T extends ISegment>
|
|
|
345
345
|
/**
|
|
346
346
|
* @legacy
|
|
347
347
|
* @alpha
|
|
348
|
+
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
348
349
|
*/
|
|
349
350
|
export abstract class SharedSegmentSequence<T extends ISegment>
|
|
350
351
|
extends SharedObject<ISharedSegmentSequenceEvents>
|
|
@@ -36,6 +36,9 @@ export abstract class SequenceEvent<
|
|
|
36
36
|
private readonly pFirst: Lazy<ISequenceDeltaRange<TOperation>>;
|
|
37
37
|
private readonly pLast: Lazy<ISequenceDeltaRange<TOperation>>;
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
41
|
+
*/
|
|
39
42
|
constructor(
|
|
40
43
|
/**
|
|
41
44
|
* Arguments reflecting the type of change that caused this event.
|
|
@@ -127,6 +130,9 @@ export class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationTyp
|
|
|
127
130
|
*/
|
|
128
131
|
public readonly isLocal: boolean;
|
|
129
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
135
|
+
*/
|
|
130
136
|
constructor(
|
|
131
137
|
public readonly opArgs: IMergeTreeDeltaOpArgs,
|
|
132
138
|
deltaArgs: IMergeTreeDeltaCallbackArgs,
|
|
@@ -148,6 +154,9 @@ export class SequenceDeltaEvent extends SequenceEvent<MergeTreeDeltaOperationTyp
|
|
|
148
154
|
* @alpha
|
|
149
155
|
*/
|
|
150
156
|
export class SequenceMaintenanceEvent extends SequenceEvent<MergeTreeMaintenanceType> {
|
|
157
|
+
/**
|
|
158
|
+
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
159
|
+
*/
|
|
151
160
|
constructor(
|
|
152
161
|
/**
|
|
153
162
|
* Defined iff `deltaArgs.operation` is {@link @fluidframework/merge-tree#MergeTreeMaintenanceType.ACKNOWLEDGED|MergeTreeMaintenanceType.ACKNOWLEDGED}.
|
package/src/sequenceFactory.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { Marker, TextSegment } from "@fluidframework/merge-tree/internal";
|
|
|
13
13
|
import { createSharedObjectKind } from "@fluidframework/shared-object-base/internal";
|
|
14
14
|
|
|
15
15
|
import { pkgVersion } from "./packageVersion.js";
|
|
16
|
+
// eslint-disable-next-line import/no-deprecated
|
|
16
17
|
import { SharedStringClass, SharedStringSegment, type ISharedString } from "./sharedString.js";
|
|
17
18
|
|
|
18
19
|
export class SharedStringFactory implements IChannelFactory<ISharedString> {
|
|
@@ -56,7 +57,9 @@ export class SharedStringFactory implements IChannelFactory<ISharedString> {
|
|
|
56
57
|
id: string,
|
|
57
58
|
services: IChannelServices,
|
|
58
59
|
attributes: IChannelAttributes,
|
|
60
|
+
// eslint-disable-next-line import/no-deprecated
|
|
59
61
|
): Promise<SharedStringClass> {
|
|
62
|
+
// eslint-disable-next-line import/no-deprecated
|
|
60
63
|
const sharedString = new SharedStringClass(runtime, id, attributes);
|
|
61
64
|
await sharedString.load(services);
|
|
62
65
|
return sharedString;
|
|
@@ -65,7 +68,9 @@ export class SharedStringFactory implements IChannelFactory<ISharedString> {
|
|
|
65
68
|
/**
|
|
66
69
|
* {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
|
|
67
70
|
*/
|
|
71
|
+
// eslint-disable-next-line import/no-deprecated
|
|
68
72
|
public create(document: IFluidDataStoreRuntime, id: string): SharedStringClass {
|
|
73
|
+
// eslint-disable-next-line import/no-deprecated
|
|
69
74
|
const sharedString = new SharedStringClass(document, id, this.attributes);
|
|
70
75
|
sharedString.initializeLocal();
|
|
71
76
|
return sharedString;
|
package/src/sharedSequence.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
PropertySet,
|
|
17
17
|
} from "@fluidframework/merge-tree/internal";
|
|
18
18
|
|
|
19
|
+
// eslint-disable-next-line import/no-deprecated
|
|
19
20
|
import { SharedSegmentSequence } from "./sequence.js";
|
|
20
21
|
|
|
21
22
|
const MaxRun = 128;
|
|
@@ -118,6 +119,7 @@ export class SubSequence<T> extends BaseSegment {
|
|
|
118
119
|
* @deprecated SharedSequence will be removed in a upcoming release. It has been moved to the fluid-experimental/sequence-deprecated package
|
|
119
120
|
* @internal
|
|
120
121
|
*/
|
|
122
|
+
// eslint-disable-next-line import/no-deprecated
|
|
121
123
|
export class SharedSequence<T> extends SharedSegmentSequence<SubSequence<T>> {
|
|
122
124
|
constructor(
|
|
123
125
|
document: IFluidDataStoreRuntime,
|
package/src/sharedString.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
refHasTileLabel,
|
|
21
21
|
} from "@fluidframework/merge-tree/internal";
|
|
22
22
|
|
|
23
|
+
// eslint-disable-next-line import/no-deprecated
|
|
23
24
|
import { SharedSegmentSequence, type ISharedSegmentSequence } from "./sequence.js";
|
|
24
25
|
import { SharedStringFactory } from "./sequenceFactory.js";
|
|
25
26
|
|
|
@@ -141,8 +142,10 @@ export type SharedStringSegment = TextSegment | Marker;
|
|
|
141
142
|
* image or Fluid object that should be rendered with the text.
|
|
142
143
|
* @legacy
|
|
143
144
|
* @alpha
|
|
145
|
+
* @deprecated This functionality was not meant to be exported and will be removed in a future release
|
|
144
146
|
*/
|
|
145
147
|
export class SharedStringClass
|
|
148
|
+
// eslint-disable-next-line import/no-deprecated
|
|
146
149
|
extends SharedSegmentSequence<SharedStringSegment>
|
|
147
150
|
implements ISharedString
|
|
148
151
|
{
|