@fluidframework/sequence 2.0.0-internal.1.4.2 → 2.0.0-internal.2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/defaultMap.d.ts.map +1 -1
- package/dist/defaultMap.js +1 -0
- package/dist/defaultMap.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +271 -34
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +343 -97
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalTree.d.ts +72 -0
- package/dist/intervalTree.d.ts.map +1 -0
- package/dist/intervalTree.js +91 -0
- package/dist/intervalTree.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sequence.d.ts +66 -15
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +73 -19
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.d.ts +15 -1
- package/dist/sequenceDeltaEvent.d.ts.map +1 -1
- package/dist/sequenceDeltaEvent.js +2 -1
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sequenceFactory.d.ts +0 -89
- package/dist/sequenceFactory.d.ts.map +1 -1
- package/dist/sequenceFactory.js +2 -142
- package/dist/sequenceFactory.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts +0 -6
- package/dist/sharedIntervalCollection.d.ts.map +1 -1
- package/dist/sharedIntervalCollection.js +0 -7
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedSequence.d.ts +2 -2
- package/dist/sharedString.d.ts +16 -15
- package/dist/sharedString.d.ts.map +1 -1
- package/dist/sharedString.js +96 -15
- package/dist/sharedString.js.map +1 -1
- package/lib/defaultMap.d.ts.map +1 -1
- package/lib/defaultMap.js +1 -0
- package/lib/defaultMap.js.map +1 -1
- package/lib/index.d.ts +4 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -4
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +271 -34
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +341 -98
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalTree.d.ts +72 -0
- package/lib/intervalTree.d.ts.map +1 -0
- package/lib/intervalTree.js +86 -0
- package/lib/intervalTree.js.map +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/sequence.d.ts +66 -15
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +73 -19
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.d.ts +15 -1
- package/lib/sequenceDeltaEvent.d.ts.map +1 -1
- package/lib/sequenceDeltaEvent.js +2 -1
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sequenceFactory.d.ts +0 -89
- package/lib/sequenceFactory.d.ts.map +1 -1
- package/lib/sequenceFactory.js +1 -139
- package/lib/sequenceFactory.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts +0 -6
- package/lib/sharedIntervalCollection.d.ts.map +1 -1
- package/lib/sharedIntervalCollection.js +0 -7
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedSequence.d.ts +2 -2
- package/lib/sharedString.d.ts +16 -15
- package/lib/sharedString.d.ts.map +1 -1
- package/lib/sharedString.js +97 -16
- package/lib/sharedString.js.map +1 -1
- package/package.json +99 -27
- package/src/defaultMap.ts +3 -0
- package/src/index.ts +4 -4
- package/src/intervalCollection.ts +486 -143
- package/src/intervalTree.ts +166 -0
- package/src/packageVersion.ts +1 -1
- package/src/sequence.ts +86 -30
- package/src/sequenceDeltaEvent.ts +18 -4
- package/src/sequenceFactory.ts +2 -163
- package/src/sharedIntervalCollection.ts +0 -11
- package/src/sharedString.ts +120 -23
- package/tsconfig.json +0 -1
- package/dist/sharedNumberSequence.d.ts +0 -50
- package/dist/sharedNumberSequence.d.ts.map +0 -1
- package/dist/sharedNumberSequence.js +0 -61
- package/dist/sharedNumberSequence.js.map +0 -1
- package/dist/sharedObjectSequence.d.ts +0 -50
- package/dist/sharedObjectSequence.d.ts.map +0 -1
- package/dist/sharedObjectSequence.js +0 -61
- package/dist/sharedObjectSequence.js.map +0 -1
- package/dist/sparsematrix.d.ts +0 -152
- package/dist/sparsematrix.d.ts.map +0 -1
- package/dist/sparsematrix.js +0 -343
- package/dist/sparsematrix.js.map +0 -1
- package/lib/sharedNumberSequence.d.ts +0 -50
- package/lib/sharedNumberSequence.d.ts.map +0 -1
- package/lib/sharedNumberSequence.js +0 -57
- package/lib/sharedNumberSequence.js.map +0 -1
- package/lib/sharedObjectSequence.d.ts +0 -50
- package/lib/sharedObjectSequence.d.ts.map +0 -1
- package/lib/sharedObjectSequence.js +0 -57
- package/lib/sharedObjectSequence.js.map +0 -1
- package/lib/sparsematrix.d.ts +0 -152
- package/lib/sparsematrix.d.ts.map +0 -1
- package/lib/sparsematrix.js +0 -334
- package/lib/sparsematrix.js.map +0 -1
- package/src/sharedNumberSequence.ts +0 -62
- package/src/sharedObjectSequence.ts +0 -62
- package/src/sparsematrix.ts +0 -434
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceFactory.js","sourceRoot":"","sources":["../src/sequenceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,2DAIoC;AAEpC,qDAA8C;AAC9C,iEAA8D;AAC9D,iEAA8D;AAC9D,qDAAgE;AAChE,iDAAmE;AAEnE,MAAa,mBAAmB;IAWrB,MAAM,CAAC,eAAe,CAAC,IAAS;QACnC,MAAM,SAAS,GAAG,wBAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,SAAS,EAAE;YAAE,OAAO,SAAS,CAAC;SAAE;QAEpC,MAAM,WAAW,GAAG,mBAAM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UAAU,CAAC,KAAK,CAAC,CAAC;aACvC;YACD,OAAO,GAAG,CAAC;SACd;IACL,CAAC;IAED;;;OAGG;IACH,IAAW,IAAI;QACX,OAAO,2BAA2B,CAAC,IAAI,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,IAAW,UAAU;QACjB,OAAO,2BAA2B,CAAC,UAAU,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,SAAS,GAAG,IAAI,2CAAoB,CAAC,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QACpE,MAAM,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,QAAgC,EAAE,EAAU;QACtD,MAAM,YAAY,GAAG,IAAI,2CAAoB,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7E,YAAY,CAAC,eAAe,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC;IACxB,CAAC;;AAxEL,kEAyEC;AAxEG;;;GAGG;AACW,gCAAI,GAAG,6DAA6D,CAAC;AAEnF;;;GAGG;AACoB,sCAAU,GAAuB;IACpD,IAAI,EAAE,2BAA2B,CAAC,IAAI;IACtC,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n IJSONSegment,\n Marker,\n TextSegment,\n} from \"@fluidframework/merge-tree\";\nimport { ISharedObject } from \"@fluidframework/shared-object-base\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { SharedNumberSequence } from \"./sharedNumberSequence\";\nimport { SharedObjectSequence } from \"./sharedObjectSequence\";\nimport { IJSONRunSegment, SubSequence } from \"./sharedSequence\";\nimport { SharedString, SharedStringSegment } from \"./sharedString\";\n\nexport class SharedStringFactory implements IChannelFactory {\n // TODO rename back to https://graph.microsoft.com/types/mergeTree/string once paparazzi is able to dynamically\n // load code\n public static Type = \"https://graph.microsoft.com/types/mergeTree\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: SharedStringFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public static segmentFromSpec(spec: any): SharedStringSegment {\n const maybeText = TextSegment.fromJSONObject(spec);\n if (maybeText) { return maybeText; }\n\n const maybeMarker = Marker.fromJSONObject(spec);\n if (maybeMarker) { return maybeMarker; }\n }\n\n public get type() {\n return SharedStringFactory.Type;\n }\n\n public get attributes() {\n return SharedStringFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<SharedString> {\n const sharedString = new SharedString(runtime, id, attributes);\n await sharedString.load(services);\n return sharedString;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string): SharedString {\n const sharedString = new SharedString(document, id, this.attributes);\n sharedString.initializeLocal();\n return sharedString;\n }\n}\n\n/**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\nexport class SharedObjectSequenceFactory implements IChannelFactory {\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static Type = \"https://graph.microsoft.com/types/mergeTree/object-sequence\";\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static readonly Attributes: IChannelAttributes = {\n type: SharedObjectSequenceFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static segmentFromSpec(segSpec: IJSONSegment) {\n const runSegment = segSpec as IJSONRunSegment<object>;\n if (runSegment.items) {\n const seg = new SubSequence<object>(runSegment.items);\n if (runSegment.props) {\n seg.addProperties(runSegment.props);\n }\n return seg;\n }\n }\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public get type() {\n return SharedObjectSequenceFactory.Type;\n }\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public get attributes() {\n return SharedObjectSequenceFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n *\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<ISharedObject> {\n const sharedSeq = new SharedObjectSequence<object>(runtime, id, attributes);\n await sharedSeq.load(services);\n return sharedSeq;\n }\n\n /**\n * @deprecated SharedObjectSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public create(document: IFluidDataStoreRuntime, id: string): ISharedObject {\n const sharedString = new SharedObjectSequence(document, id, this.attributes);\n sharedString.initializeLocal();\n return sharedString;\n }\n}\n\n/**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\nexport class SharedNumberSequenceFactory implements IChannelFactory {\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static Type = \"https://graph.microsoft.com/types/mergeTree/number-sequence\";\n\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static readonly Attributes: IChannelAttributes = {\n type: SharedNumberSequenceFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public static segmentFromSpec(segSpec: IJSONSegment) {\n const runSegment = segSpec as IJSONRunSegment<number>;\n if (runSegment.items) {\n const seg = new SubSequence<number>(runSegment.items);\n if (runSegment.props) {\n seg.addProperties(runSegment.props);\n }\n return seg;\n }\n }\n\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public get type() {\n return SharedNumberSequenceFactory.Type;\n }\n\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public get attributes() {\n return SharedNumberSequenceFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n *\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<ISharedObject> {\n const sharedSeq = new SharedNumberSequence(runtime, id, attributes);\n await sharedSeq.load(services);\n return sharedSeq;\n }\n\n /**\n * @deprecated SharedNumberSequence is not recommended for use and will be removed in an upcoming release.\n * For more info, please see [Github issue 8526](https://github.com/microsoft/FluidFramework/issues/8526)\n */\n public create(document: IFluidDataStoreRuntime, id: string): ISharedObject {\n const sharedString = new SharedNumberSequence(document, id, this.attributes);\n sharedString.initializeLocal();\n return sharedString;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sequenceFactory.js","sourceRoot":"","sources":["../src/sequenceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,2DAGoC;AACpC,qDAA8C;AAC9C,iDAAmE;AAEnE,MAAa,mBAAmB;IAWrB,MAAM,CAAC,eAAe,CAAC,IAAS;QACnC,MAAM,SAAS,GAAG,wBAAW,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,SAAS,EAAE;YAAE,OAAO,SAAS,CAAC;SAAE;QAEpC,MAAM,WAAW,GAAG,mBAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,WAAW,EAAE;YAAE,OAAO,WAAW,CAAC;SAAE;QAExC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAChD,CAAC;IAED,IAAW,IAAI;QACX,OAAO,mBAAmB,CAAC,IAAI,CAAC;IACpC,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,mBAAmB,CAAC,UAAU,CAAC;IAC1C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QAC/D,MAAM,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClC,OAAO,YAAY,CAAC;IACxB,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACtD,MAAM,YAAY,GAAG,IAAI,2BAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACrE,YAAY,CAAC,eAAe,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC;IACxB,CAAC;;AA9CL,kDA+CC;AA9CG,+GAA+G;AAC/G,YAAY;AACE,wBAAI,GAAG,6CAA6C,CAAC;AAE5C,8BAAU,GAAuB;IACpD,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n Marker,\n TextSegment,\n} from \"@fluidframework/merge-tree\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { SharedString, SharedStringSegment } from \"./sharedString\";\n\nexport class SharedStringFactory implements IChannelFactory {\n // TODO rename back to https://graph.microsoft.com/types/mergeTree/string once paparazzi is able to dynamically\n // load code\n public static Type = \"https://graph.microsoft.com/types/mergeTree\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: SharedStringFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public static segmentFromSpec(spec: any): SharedStringSegment {\n const maybeText = TextSegment.fromJSONObject(spec);\n if (maybeText) { return maybeText; }\n\n const maybeMarker = Marker.fromJSONObject(spec);\n if (maybeMarker) { return maybeMarker; }\n\n throw new Error(`Unrecognized IJSONObject`);\n }\n\n public get type() {\n return SharedStringFactory.Type;\n }\n\n public get attributes() {\n return SharedStringFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<SharedString> {\n const sharedString = new SharedString(runtime, id, attributes);\n await sharedString.load(services);\n return sharedString;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string): SharedString {\n const sharedString = new SharedString(document, id, this.attributes);\n sharedString.initializeLocal();\n return sharedString;\n }\n}\n"]}
|
|
@@ -23,7 +23,6 @@ export declare class SharedIntervalCollectionFactory implements IChannelFactory
|
|
|
23
23
|
create(runtime: IFluidDataStoreRuntime, id: string): SharedIntervalCollection;
|
|
24
24
|
}
|
|
25
25
|
export interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {
|
|
26
|
-
waitIntervalCollection(label: string): Promise<IntervalCollection<TInterval>>;
|
|
27
26
|
getIntervalCollection(label: string): IntervalCollection<TInterval>;
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
@@ -51,11 +50,6 @@ export declare class SharedIntervalCollection extends SharedObject implements IS
|
|
|
51
50
|
* be provided
|
|
52
51
|
*/
|
|
53
52
|
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated `IntervalCollection`s are created on a first-write wins basis, and concurrent creates
|
|
56
|
-
* are supported. Use {@link SharedIntervalCollection.getIntervalCollection} instead.
|
|
57
|
-
*/
|
|
58
|
-
waitIntervalCollection(label: string): Promise<IntervalCollection<Interval>>;
|
|
59
53
|
getIntervalCollection(label: string): IntervalCollection<Interval>;
|
|
60
54
|
protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
|
|
61
55
|
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedIntervalCollection.d.ts","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EAClB,MAAM,uCAAuC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AC,WAAW,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;IAMlG;;;OAGG;IACH,SAAS,CAAC,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI1D,SAAS,CAAC,cAAc;CAG3B"}
|
|
@@ -76,13 +76,6 @@ class SharedIntervalCollection extends shared_object_base_1.SharedObject {
|
|
|
76
76
|
static getFactory() {
|
|
77
77
|
return new SharedIntervalCollectionFactory();
|
|
78
78
|
}
|
|
79
|
-
/**
|
|
80
|
-
* @deprecated `IntervalCollection`s are created on a first-write wins basis, and concurrent creates
|
|
81
|
-
* are supported. Use {@link SharedIntervalCollection.getIntervalCollection} instead.
|
|
82
|
-
*/
|
|
83
|
-
async waitIntervalCollection(label) {
|
|
84
|
-
return this.intervalCollections.get(this.getIntervalCollectionPath(label));
|
|
85
|
-
}
|
|
86
79
|
getIntervalCollection(label) {
|
|
87
80
|
const realLabel = this.getIntervalCollectionPath(label);
|
|
88
81
|
const sharedCollection = this.intervalCollections.get(realLabel);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedIntervalCollection.js","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+DAA8D;AAQ9D,+EAA8F;AAE9F,2EAI4C;AAC5C,6DAK8B;AAC9B,6CAA0C;AAC1C,qDAA8C;AAG9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAa,+BAA+B;IASxC,IAAW,IAAI;QACX,OAAO,+BAA+B,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,+BAA+B,CAAC,UAAU,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,GAAG,GAAG,IAAI,wBAAwB,CAAC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CAAC;QACjE,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAES,aAAa,CAAC,UAA4B;QAChD,OAAO,IAAA,4CAAuB,EAAC,gBAAgB,EAAE,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IACrG,CAAC;IAES,YAAY,CAAC,OAAY,EAAE,eAAwB;QACzD,IAAI,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,OAAO,EAAE,eAA2C,CAAC,CAAC;IACtG,CAAC;IAES,YAAY,KAAK,CAAC;IAE5B;;OAEG;IACO,KAAK,CAAC,QAAQ,CAAC,OAA+B;QACpD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,IAAA,6BAAc,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAES,WAAW,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC9F,IAAI,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,SAAS,EAAE;YACxC,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;SACjG;IACL,CAAC;IAED;;;OAGG;IACO,yBAAyB,CAAC,KAAa;QAC7C,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;AArFD,4DAqFC;KA/DoB,MAAM,CAAC,WAAW","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluidframework/common-utils\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport {\n createSingleBlobSummary,\n IFluidSerializer,\n SharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport {\n Interval,\n IntervalCollection,\n IntervalCollectionValueType,\n ISerializableInterval,\n} from \"./intervalCollection\";\nimport { DefaultMap } from \"./defaultMap\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { IMapMessageLocalMetadata } from \"./defaultMapInterfaces\";\n\nconst snapshotFileName = \"header\";\n\n/**\n * The factory that defines the SharedIntervalCollection.\n * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollectionFactory implements IChannelFactory {\n public static readonly Type = \"https://graph.microsoft.com/types/sharedIntervalCollection\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: SharedIntervalCollectionFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public get type() {\n return SharedIntervalCollectionFactory.Type;\n }\n\n public get attributes() {\n return SharedIntervalCollectionFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<SharedIntervalCollection> {\n const map = new SharedIntervalCollection(id, runtime, attributes);\n await map.load(services);\n\n return map;\n }\n\n public create(runtime: IFluidDataStoreRuntime, id: string): SharedIntervalCollection {\n const map = new SharedIntervalCollection(\n id,\n runtime,\n this.attributes);\n map.initializeLocal();\n\n return map;\n }\n}\n\nexport interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {\n getIntervalCollection(label: string): IntervalCollection<TInterval>;\n}\n\n/**\n * @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollection\n extends SharedObject implements ISharedIntervalCollection<Interval> {\n /**\n * Create a SharedIntervalCollection\n *\n * @param runtime - data store runtime the new shared map belongs to\n * @param id - optional name of the shared map\n * @returns newly create shared map (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SharedIntervalCollectionFactory.Type) as SharedIntervalCollection;\n }\n\n /**\n * Get a factory for SharedIntervalCollection to register with the data store.\n *\n * @returns a factory that creates and load SharedIntervalCollection\n */\n public static getFactory(): IChannelFactory {\n return new SharedIntervalCollectionFactory();\n }\n\n public readonly [Symbol.toStringTag]: string = \"SharedIntervalCollection\";\n private readonly intervalCollections: DefaultMap<IntervalCollection<Interval>>;\n\n /**\n * Constructs a new shared SharedIntervalCollection. If the object is non-local an id and service interfaces will\n * be provided\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes, \"fluid_sharedIntervalCollection_\");\n this.intervalCollections = new DefaultMap(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n new IntervalCollectionValueType(),\n );\n }\n\n public getIntervalCollection(label: string): IntervalCollection<Interval> {\n const realLabel = this.getIntervalCollectionPath(label);\n const sharedCollection = this.intervalCollections.get(realLabel);\n return sharedCollection;\n }\n\n protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n return createSingleBlobSummary(snapshotFileName, this.intervalCollections.serialize(serializer));\n }\n\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.intervalCollections.tryResubmitMessage(content, localOpMetadata as IMapMessageLocalMetadata);\n }\n\n protected onDisconnect() { }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService) {\n const blob = await storage.readBlob(snapshotFileName);\n const header = bufferToString(blob, \"utf8\");\n this.intervalCollections.populate(header);\n }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (message.type === MessageType.Operation) {\n this.intervalCollections.tryProcessMessage(message.contents, local, message, localOpMetadata);\n }\n }\n\n /**\n * Creates the full path of the intervalCollection label\n * @param label - the incoming label\n */\n protected getIntervalCollectionPath(label: string): string {\n return label;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n}\n"]}
|
package/dist/sharedSequence.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class SubSequence<T> extends BaseSegment {
|
|
|
12
12
|
items: Serializable<T>[];
|
|
13
13
|
static readonly typeString: string;
|
|
14
14
|
static is(segment: ISegment): segment is SubSequence<any>;
|
|
15
|
-
static fromJSONObject<U>(spec: Serializable): SubSequence<U
|
|
15
|
+
static fromJSONObject<U>(spec: Serializable): SubSequence<U> | undefined;
|
|
16
16
|
readonly type: string;
|
|
17
17
|
constructor(items: Serializable<T>[]);
|
|
18
18
|
toJSONObject(): IJSONRunSegment<T>;
|
|
@@ -21,7 +21,7 @@ export declare class SubSequence<T> extends BaseSegment {
|
|
|
21
21
|
toString(): string;
|
|
22
22
|
append(segment: ISegment): void;
|
|
23
23
|
removeRange(start: number, end: number): boolean;
|
|
24
|
-
protected createSplitSegmentAt(pos: number): SubSequence<T
|
|
24
|
+
protected createSplitSegmentAt(pos: number): SubSequence<T> | undefined;
|
|
25
25
|
}
|
|
26
26
|
export declare class SharedSequence<T> extends SharedSegmentSequence<SubSequence<T>> {
|
|
27
27
|
id: string;
|
package/dist/sharedString.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface ISharedString extends SharedSegmentSequence<SharedStringSegment
|
|
|
23
23
|
* @param refType - The reference type of the marker
|
|
24
24
|
* @param props - The properties of the marker
|
|
25
25
|
*/
|
|
26
|
-
insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg;
|
|
26
|
+
insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg | undefined;
|
|
27
27
|
/**
|
|
28
28
|
* {@inheritDoc SharedSegmentSequence.posFromRelativePos}
|
|
29
29
|
*/
|
|
@@ -67,7 +67,7 @@ export declare class SharedString extends SharedSegmentSequence<SharedStringSegm
|
|
|
67
67
|
/**
|
|
68
68
|
* {@inheritDoc ISharedString.insertMarker}
|
|
69
69
|
*/
|
|
70
|
-
insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg;
|
|
70
|
+
insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg | undefined;
|
|
71
71
|
/**
|
|
72
72
|
* Inserts the text at the position.
|
|
73
73
|
* @param relativePos1 - The relative position to insert the text at
|
|
@@ -108,17 +108,18 @@ export declare class SharedString extends SharedSegmentSequence<SharedStringSegm
|
|
|
108
108
|
* @param combiningOp - Optional. Specifies how to combine values for the property, such as "incr" for increment.
|
|
109
109
|
*/
|
|
110
110
|
annotateMarker(marker: Marker, props: PropertySet, combiningOp?: ICombiningOp): void;
|
|
111
|
+
/**
|
|
112
|
+
* Finds the nearest reference with ReferenceType.Tile to `startPos` in the direction dictated by `tilePrecedesPos`.
|
|
113
|
+
* Note that Markers receive `ReferenceType.Tile` by default.
|
|
114
|
+
* @param startPos - Position at which to start the search
|
|
115
|
+
* @param clientId - clientId dictating the perspective to search from
|
|
116
|
+
* @param tileLabel - Label of the tile to search for
|
|
117
|
+
* @param preceding - Whether the desired tile comes before (true) or after (false) `startPos`
|
|
118
|
+
*/
|
|
111
119
|
findTile(startPos: number | undefined, tileLabel: string, preceding?: boolean): {
|
|
112
120
|
tile: ReferencePosition;
|
|
113
121
|
pos: number;
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* @deprecated Use the free function {@link getTextAndMarkers} exported by this package instead.
|
|
117
|
-
*/
|
|
118
|
-
getTextAndMarkers(label: string): {
|
|
119
|
-
parallelText: string[];
|
|
120
|
-
parallelMarkers: Marker[];
|
|
121
|
-
};
|
|
122
|
+
} | undefined;
|
|
122
123
|
/**
|
|
123
124
|
* Retrieve text from the SharedString in string format.
|
|
124
125
|
* @param start - The starting index of the text to retrieve, or 0 if omitted.
|
|
@@ -130,12 +131,12 @@ export declare class SharedString extends SharedSegmentSequence<SharedStringSegm
|
|
|
130
131
|
* Adds spaces for markers and handles, so that position calculations account for them.
|
|
131
132
|
*/
|
|
132
133
|
getTextWithPlaceholders(start?: number, end?: number): string;
|
|
134
|
+
getTextRangeWithMarkers(start: number, end: number): string;
|
|
133
135
|
/**
|
|
134
|
-
*
|
|
136
|
+
* Looks up and returns a `Marker` using its id. Returns `undefined` if there is no marker with the provided
|
|
137
|
+
* id in this `SharedString`.
|
|
135
138
|
*/
|
|
136
|
-
|
|
137
|
-
getTextRangeWithMarkers(start: number, end: number): string;
|
|
138
|
-
getMarkerFromId(id: string): ISegment;
|
|
139
|
+
getMarkerFromId(id: string): ISegment | undefined;
|
|
139
140
|
/**
|
|
140
141
|
* Revert an op
|
|
141
142
|
*/
|
|
@@ -156,7 +157,7 @@ export declare class SharedString extends SharedSegmentSequence<SharedStringSegm
|
|
|
156
157
|
* // Note parallelText does not include "missing".
|
|
157
158
|
* ```
|
|
158
159
|
*/
|
|
159
|
-
export declare function getTextAndMarkers(sharedString: SharedString, label: string): {
|
|
160
|
+
export declare function getTextAndMarkers(sharedString: SharedString, label: string, start?: number, end?: number): {
|
|
160
161
|
parallelText: string[];
|
|
161
162
|
parallelMarkers: Marker[];
|
|
162
163
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedString.d.ts","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EAEnB,iBAAiB,EACjB,QAAQ,
|
|
1
|
+
{"version":3,"file":"sharedString.d.ts","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EAEnB,iBAAiB,EACjB,QAAQ,EAER,MAAM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;OAGG;IACI,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAIxD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;CAOnE;AAWD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG;IACxG,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC7B,CAWA"}
|
package/dist/sharedString.js
CHANGED
|
@@ -147,15 +147,16 @@ class SharedString extends sequence_1.SharedSegmentSequence {
|
|
|
147
147
|
this.submitSequenceMessage(annotateOp);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
findTile(startPos, tileLabel, preceding = true) {
|
|
151
|
-
return this.client.findTile(startPos, tileLabel, preceding);
|
|
152
|
-
}
|
|
153
150
|
/**
|
|
154
|
-
*
|
|
151
|
+
* Finds the nearest reference with ReferenceType.Tile to `startPos` in the direction dictated by `tilePrecedesPos`.
|
|
152
|
+
* Note that Markers receive `ReferenceType.Tile` by default.
|
|
153
|
+
* @param startPos - Position at which to start the search
|
|
154
|
+
* @param clientId - clientId dictating the perspective to search from
|
|
155
|
+
* @param tileLabel - Label of the tile to search for
|
|
156
|
+
* @param preceding - Whether the desired tile comes before (true) or after (false) `startPos`
|
|
155
157
|
*/
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return this.mergeTreeTextHelper.getTextAndMarkers(segmentWindow.currentSeq, segmentWindow.clientId, label);
|
|
158
|
+
findTile(startPos, tileLabel, preceding = true) {
|
|
159
|
+
return this.client.findTile(startPos !== null && startPos !== void 0 ? startPos : 0, tileLabel, preceding);
|
|
159
160
|
}
|
|
160
161
|
/**
|
|
161
162
|
* Retrieve text from the SharedString in string format.
|
|
@@ -174,16 +175,14 @@ class SharedString extends sequence_1.SharedSegmentSequence {
|
|
|
174
175
|
const segmentWindow = this.client.getCollabWindow();
|
|
175
176
|
return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, " ", start, end);
|
|
176
177
|
}
|
|
177
|
-
/**
|
|
178
|
-
* @deprecated Use {@link SharedString.getTextWithPlaceholders} instead.
|
|
179
|
-
*/
|
|
180
|
-
getTextRangeWithPlaceholders(start, end) {
|
|
181
|
-
return this.getTextWithPlaceholders(start, end);
|
|
182
|
-
}
|
|
183
178
|
getTextRangeWithMarkers(start, end) {
|
|
184
179
|
const segmentWindow = this.client.getCollabWindow();
|
|
185
180
|
return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, "*", start, end);
|
|
186
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* Looks up and returns a `Marker` using its id. Returns `undefined` if there is no marker with the provided
|
|
184
|
+
* id in this `SharedString`.
|
|
185
|
+
*/
|
|
187
186
|
getMarkerFromId(id) {
|
|
188
187
|
return this.client.getMarkerFromId(id);
|
|
189
188
|
}
|
|
@@ -215,8 +214,90 @@ exports.SharedString = SharedString;
|
|
|
215
214
|
* // Note parallelText does not include "missing".
|
|
216
215
|
* ```
|
|
217
216
|
*/
|
|
218
|
-
function getTextAndMarkers(sharedString, label) {
|
|
219
|
-
|
|
217
|
+
function getTextAndMarkers(sharedString, label, start, end) {
|
|
218
|
+
const accum = {
|
|
219
|
+
parallelMarkerLabel: label,
|
|
220
|
+
parallelMarkers: [],
|
|
221
|
+
parallelText: [],
|
|
222
|
+
tagsInProgress: [],
|
|
223
|
+
textSegment: new merge_tree_1.TextSegment(""),
|
|
224
|
+
};
|
|
225
|
+
sharedString.walkSegments(gatherTextAndMarkers, start, end, accum);
|
|
226
|
+
return { parallelText: accum.parallelText, parallelMarkers: accum.parallelMarkers };
|
|
220
227
|
}
|
|
221
228
|
exports.getTextAndMarkers = getTextAndMarkers;
|
|
229
|
+
const gatherTextAndMarkers = (segment, pos, refSeq, clientId, start, end, accumText) => {
|
|
230
|
+
var _a, _b;
|
|
231
|
+
const { placeholder, tagsInProgress, textSegment } = accumText;
|
|
232
|
+
if (merge_tree_1.TextSegment.is(segment)) {
|
|
233
|
+
let beginTags = "";
|
|
234
|
+
let endTags = "";
|
|
235
|
+
// TODO: let clients pass in function to get tag
|
|
236
|
+
const tags = [];
|
|
237
|
+
const initTags = [];
|
|
238
|
+
if ((_a = segment.properties) === null || _a === void 0 ? void 0 : _a["font-weight"]) {
|
|
239
|
+
tags.push("b");
|
|
240
|
+
}
|
|
241
|
+
if ((_b = segment.properties) === null || _b === void 0 ? void 0 : _b["text-decoration"]) {
|
|
242
|
+
tags.push("u");
|
|
243
|
+
}
|
|
244
|
+
const remTags = [];
|
|
245
|
+
if (tags.length > 0) {
|
|
246
|
+
for (const tag of tags) {
|
|
247
|
+
if (!tagsInProgress.includes(tag)) {
|
|
248
|
+
beginTags += `<${tag}>`;
|
|
249
|
+
initTags.push(tag);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
for (const accumTag of tagsInProgress) {
|
|
253
|
+
if (!tags.includes(accumTag)) {
|
|
254
|
+
endTags += `</${accumTag}>`;
|
|
255
|
+
remTags.push(accumTag);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
for (const initTag of initTags.reverse()) {
|
|
259
|
+
tagsInProgress.push(initTag);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
for (const accumTag of tagsInProgress) {
|
|
264
|
+
endTags += `</${accumTag}>`;
|
|
265
|
+
remTags.push(accumTag);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
for (const remTag of remTags) {
|
|
269
|
+
const remdex = tagsInProgress.indexOf(remTag);
|
|
270
|
+
if (remdex >= 0) {
|
|
271
|
+
tagsInProgress.splice(remdex, 1);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
textSegment.text += endTags;
|
|
275
|
+
textSegment.text += beginTags;
|
|
276
|
+
if ((start <= 0) && (end >= segment.text.length)) {
|
|
277
|
+
textSegment.text += segment.text;
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
const seglen = segment.text.length;
|
|
281
|
+
const _start = start < 0 ? 0 : start;
|
|
282
|
+
const _end = end >= seglen ? undefined : end;
|
|
283
|
+
textSegment.text += segment.text.substring(_start, _end);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
if (placeholder && (placeholder.length > 0)) {
|
|
288
|
+
const placeholderText = placeholder === "*" ?
|
|
289
|
+
`\n${segment.toString()}` : placeholder.repeat(segment.cachedLength);
|
|
290
|
+
textSegment.text += placeholderText;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
const marker = segment;
|
|
294
|
+
if ((0, merge_tree_1.refHasTileLabel)(marker, accumText.parallelMarkerLabel)) {
|
|
295
|
+
accumText.parallelMarkers.push(marker);
|
|
296
|
+
accumText.parallelText.push(textSegment.text);
|
|
297
|
+
textSegment.text = "";
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return true;
|
|
302
|
+
};
|
|
222
303
|
//# sourceMappingURL=sharedString.js.map
|
package/dist/sharedString.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedString.js","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAYoC;AAEpC,yCAAmD;AACnD,uDAAwD;AA8BxD;;;;;;;;;GASG;AACH,MAAa,YAAa,SAAQ,gCAA0C;IAyBxE,YAAY,QAAgC,EAAS,EAAU,EAAE,UAA8B;QAC3F,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,qCAAmB,CAAC,eAAe,CAAC,CAAC;QADpB,OAAE,GAAF,EAAE,CAAQ;QAE3D,IAAI,CAAC,mBAAmB,GAAG,IAAI,C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,MAAM,CAAC,eAAe,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,EAAE,aAAa,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IAC/G,CAAC;IAED;;OAEG;IACI,4BAA4B,CAAC,KAAa,EAAE,GAAW;QAC1D,OAAO,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpD,CAAC;IAEM,uBAAuB,CAAC,KAAa,EAAE,GAAW;QACrD,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,EAAE,aAAa,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IAC/G,CAAC;IAEM,eAAe,CAAC,EAAU;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACO,QAAQ,CAAC,OAAY,EAAE,eAAwB;QACrD,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE;YACpC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;SAClD;aAAM;YACH,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;SAC5C;IACL,CAAC;CACJ;AA1ND,oCA0NC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,iBAAiB,CAAC,YAA0B,EAAE,KAAa;IAIvE,OAAO,YAAY,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC;AALD,8CAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ICombiningOp,\n IMergeTreeInsertMsg,\n IMergeTreeRemoveMsg,\n IMergeTreeTextHelper,\n IRelativePosition,\n ISegment,\n Marker,\n PropertySet,\n ReferencePosition,\n ReferenceType,\n TextSegment,\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 */\nexport interface ISharedString extends SharedSegmentSequence<SharedStringSegment> {\n /**\n * Inserts the text at the position.\n * @param pos - The position to insert the text at\n * @param text - The text to insert\n * @param props - The properties of the text\n */\n insertText(pos: number, text: string, props?: PropertySet): void;\n\n /**\n * Inserts a marker at the position.\n * @param pos - The position to insert the marker at\n * @param refType - The reference type of the marker\n * @param props - The properties of the marker\n */\n insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg;\n\n /**\n * {@inheritDoc SharedSegmentSequence.posFromRelativePos}\n */\n posFromRelativePos(relativePos: IRelativePosition): number;\n}\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 */\nexport class SharedString extends SharedSegmentSequence<SharedStringSegment> implements ISharedString {\n /**\n * Create a new shared string.\n * @param runtime - data store runtime the new shared string belongs to\n * @param id - optional name of the shared string\n * @returns newly create shared string (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SharedStringFactory.Type) as SharedString;\n }\n\n /**\n * Get a factory for SharedString to register with the data store.\n * @returns a factory that creates and load SharedString\n */\n public static getFactory() {\n return new SharedStringFactory();\n }\n\n public get ISharedString(): ISharedString {\n return this;\n }\n\n private readonly mergeTreeTextHelper: IMergeTreeTextHelper;\n\n constructor(document: IFluidDataStoreRuntime, public id: string, attributes: IChannelAttributes) {\n super(document, id, attributes, SharedStringFactory.segmentFromSpec);\n this.mergeTreeTextHelper = this.client.createTextHelper();\n }\n\n /**\n * Inserts a marker at a relative position.\n * @param relativePos1 - The relative position to insert the marker at\n * @param refType - The reference type of the marker\n * @param props - The properties of the marker\n */\n public insertMarkerRelative(\n relativePos1: IRelativePosition,\n refType: ReferenceType,\n props?: PropertySet) {\n const segment = new Marker(refType);\n if (props) {\n segment.addProperties(props);\n }\n\n const pos = this.posFromRelativePos(relativePos1);\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * {@inheritDoc ISharedString.insertMarker}\n */\n public insertMarker(\n pos: number,\n refType: ReferenceType,\n props?: PropertySet): IMergeTreeInsertMsg {\n const segment = new Marker(refType);\n if (props) {\n segment.addProperties(props);\n }\n\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n return insertOp;\n }\n\n /**\n * Inserts the text at the position.\n * @param relativePos1 - The relative position to insert the text at\n * @param text - The text to insert\n * @param props - The properties of text\n */\n public insertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet) {\n const segment = new TextSegment(text);\n if (props) {\n segment.addProperties(props);\n }\n\n const pos = this.posFromRelativePos(relativePos1);\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * {@inheritDoc ISharedString.insertText}\n */\n public insertText(pos: number, text: string, props?: PropertySet) {\n const segment = new TextSegment(text);\n if (props) {\n segment.addProperties(props);\n }\n\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * Replaces a range with the provided text.\n * @param start - The inclusive start of the range to replace\n * @param end - The exclusive end of the range to replace\n * @param text - The text to replace the range with\n * @param props - Optional. The properties of the replacement text\n */\n public replaceText(start: number, end: number, text: string, props?: PropertySet) {\n this.replaceRange(start, end, TextSegment.make(text, props));\n }\n\n /**\n * Removes the text in the given range.\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to replace\n * @returns the message sent.\n */\n public removeText(start: number, end: number): IMergeTreeRemoveMsg {\n return this.removeRange(start, end);\n }\n\n /**\n * Annotates the marker with the provided properties and calls the callback on consensus.\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @param consensusCallback - The callback called when consensus is reached\n */\n public annotateMarkerNotifyConsensus(\n marker: Marker,\n props: PropertySet,\n callback: (m: Marker) => void) {\n const annotateOp = this.client.annotateMarkerNotifyConsensus(marker, props, callback);\n if (annotateOp) {\n this.submitSequenceMessage(annotateOp);\n }\n }\n\n /**\n * Annotates the marker with the provided properties.\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n */\n public annotateMarker(\n marker: Marker,\n props: PropertySet,\n combiningOp?: ICombiningOp) {\n const annotateOp = this.client.annotateMarker(marker, props, combiningOp);\n if (annotateOp) {\n this.submitSequenceMessage(annotateOp);\n }\n }\n\n public findTile(startPos: number | undefined, tileLabel: string, preceding = true): {\n tile: ReferencePosition;\n pos: number;\n } {\n return this.client.findTile(startPos, tileLabel, preceding);\n }\n\n /**\n * @deprecated Use the free function {@link getTextAndMarkers} exported by this package instead.\n */\n public getTextAndMarkers(label: string) {\n const segmentWindow = this.client.getCollabWindow();\n return this.mergeTreeTextHelper.getTextAndMarkers(segmentWindow.currentSeq, segmentWindow.clientId, label);\n }\n\n /**\n * Retrieve text from the SharedString in string format.\n * @param start - The starting index of the text to retrieve, or 0 if omitted.\n * @param end - The ending index of the text to retrieve, or the end of the string if omitted\n * @returns The requested text content as a string.\n */\n public getText(start?: number, end?: number) {\n const segmentWindow = this.client.getCollabWindow();\n return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, \"\", start, end);\n }\n\n /**\n * Adds spaces for markers and handles, so that position calculations account for them.\n */\n public getTextWithPlaceholders(start?: number, end?: number) {\n const segmentWindow = this.client.getCollabWindow();\n return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, \" \", start, end);\n }\n\n /**\n * @deprecated Use {@link SharedString.getTextWithPlaceholders} instead.\n */\n public getTextRangeWithPlaceholders(start: number, end: number) {\n return this.getTextWithPlaceholders(start, end);\n }\n\n public getTextRangeWithMarkers(start: number, end: number) {\n const segmentWindow = this.client.getCollabWindow();\n return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, \"*\", start, end);\n }\n\n public getMarkerFromId(id: string): ISegment {\n return this.client.getMarkerFromId(id);\n }\n\n /**\n * Revert an op\n */\n protected rollback(content: any, localOpMetadata: unknown): void {\n if (this.client.rollback !== undefined) {\n this.client.rollback(content, localOpMetadata);\n } else {\n super.rollback(content, localOpMetadata);\n }\n }\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 *\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 */\nexport function getTextAndMarkers(sharedString: SharedString, label: string): {\n parallelText: string[];\n parallelMarkers: Marker[];\n} {\n return sharedString.getTextAndMarkers(label);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sharedString.js","sourceRoot":"","sources":["../src/sharedString.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAcoC;AAEpC,yCAAmD;AACnD,uDAAwD;AA8BxD;;;;;;;;;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;SAAM;QACH,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE;YACzC,MAAM,eAAe,GAAG,WAAW,KAAK,GAAG,CAAC,CAAC;gBACzC,KAAK,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACzE,WAAW,CAAC,IAAI,IAAI,eAAe,CAAC;SACvC;aAAM;YACH,MAAM,MAAM,GAAG,OAAiB,CAAC;YACjC,IAAI,IAAA,4BAAe,EAAC,MAAM,EAAE,SAAS,CAAC,mBAAmB,CAAC,EAAE;gBACxD,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;aACzB;SACJ;KACJ;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ICombiningOp,\n IMergeTreeInsertMsg,\n IMergeTreeRemoveMsg,\n IMergeTreeTextHelper,\n IRelativePosition,\n ISegment,\n ISegmentAction,\n Marker,\n PropertySet,\n ReferencePosition,\n ReferenceType,\n refHasTileLabel,\n TextSegment,\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 */\nexport interface ISharedString extends SharedSegmentSequence<SharedStringSegment> {\n /**\n * Inserts the text at the position.\n * @param pos - The position to insert the text at\n * @param text - The text to insert\n * @param props - The properties of the text\n */\n insertText(pos: number, text: string, props?: PropertySet): void;\n\n /**\n * Inserts a marker at the position.\n * @param pos - The position to insert the marker at\n * @param refType - The reference type of the marker\n * @param props - The properties of the marker\n */\n insertMarker(pos: number, refType: ReferenceType, props?: PropertySet): IMergeTreeInsertMsg | undefined;\n\n /**\n * {@inheritDoc SharedSegmentSequence.posFromRelativePos}\n */\n posFromRelativePos(relativePos: IRelativePosition): number;\n}\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 */\nexport class SharedString extends SharedSegmentSequence<SharedStringSegment> implements ISharedString {\n /**\n * Create a new shared string.\n * @param runtime - data store runtime the new shared string belongs to\n * @param id - optional name of the shared string\n * @returns newly create shared string (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SharedStringFactory.Type) as SharedString;\n }\n\n /**\n * Get a factory for SharedString to register with the data store.\n * @returns a factory that creates and load SharedString\n */\n public static getFactory() {\n return new SharedStringFactory();\n }\n\n public get ISharedString(): ISharedString {\n return this;\n }\n\n private readonly mergeTreeTextHelper: IMergeTreeTextHelper;\n\n constructor(document: IFluidDataStoreRuntime, public id: string, attributes: IChannelAttributes) {\n super(document, id, attributes, SharedStringFactory.segmentFromSpec as any);\n this.mergeTreeTextHelper = this.client.createTextHelper();\n }\n\n /**\n * Inserts a marker at a relative position.\n * @param relativePos1 - The relative position to insert the marker at\n * @param refType - The reference type of the marker\n * @param props - The properties of the marker\n */\n public insertMarkerRelative(\n relativePos1: IRelativePosition,\n refType: ReferenceType,\n props?: PropertySet) {\n const segment = new Marker(refType);\n if (props) {\n segment.addProperties(props);\n }\n\n const pos = this.posFromRelativePos(relativePos1);\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * {@inheritDoc ISharedString.insertMarker}\n */\n public insertMarker(\n pos: number,\n refType: ReferenceType,\n props?: PropertySet): IMergeTreeInsertMsg | undefined {\n const segment = new Marker(refType);\n if (props) {\n segment.addProperties(props);\n }\n\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n return insertOp;\n }\n\n /**\n * Inserts the text at the position.\n * @param relativePos1 - The relative position to insert the text at\n * @param text - The text to insert\n * @param props - The properties of text\n */\n public insertTextRelative(relativePos1: IRelativePosition, text: string, props?: PropertySet) {\n const segment = new TextSegment(text);\n if (props) {\n segment.addProperties(props);\n }\n\n const pos = this.posFromRelativePos(relativePos1);\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * {@inheritDoc ISharedString.insertText}\n */\n public insertText(pos: number, text: string, props?: PropertySet) {\n const segment = new TextSegment(text);\n if (props) {\n segment.addProperties(props);\n }\n\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n /**\n * Replaces a range with the provided text.\n * @param start - The inclusive start of the range to replace\n * @param end - The exclusive end of the range to replace\n * @param text - The text to replace the range with\n * @param props - Optional. The properties of the replacement text\n */\n public replaceText(start: number, end: number, text: string, props?: PropertySet) {\n this.replaceRange(start, end, TextSegment.make(text, props));\n }\n\n /**\n * Removes the text in the given range.\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to replace\n * @returns the message sent.\n */\n public removeText(start: number, end: number): IMergeTreeRemoveMsg {\n return this.removeRange(start, end);\n }\n\n /**\n * Annotates the marker with the provided properties and calls the callback on consensus.\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @param consensusCallback - The callback called when consensus is reached\n */\n public annotateMarkerNotifyConsensus(\n marker: Marker,\n props: PropertySet,\n callback: (m: Marker) => void) {\n const annotateOp = this.client.annotateMarkerNotifyConsensus(marker, props, callback);\n if (annotateOp) {\n this.submitSequenceMessage(annotateOp);\n }\n }\n\n /**\n * Annotates the marker with the provided properties.\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @param combiningOp - Optional. Specifies how to combine values for the property, such as \"incr\" for increment.\n */\n public annotateMarker(\n marker: Marker,\n props: PropertySet,\n combiningOp?: ICombiningOp) {\n const annotateOp = this.client.annotateMarker(marker, props, combiningOp);\n if (annotateOp) {\n this.submitSequenceMessage(annotateOp);\n }\n }\n\n /**\n * Finds the nearest reference with ReferenceType.Tile to `startPos` in the direction dictated by `tilePrecedesPos`.\n * Note that Markers receive `ReferenceType.Tile` by default.\n * @param startPos - Position at which to start the search\n * @param clientId - clientId dictating the perspective to search from\n * @param tileLabel - Label of the tile to search for\n * @param preceding - Whether the desired tile comes before (true) or after (false) `startPos`\n */\n public findTile(startPos: number | undefined, tileLabel: string, preceding = true): {\n tile: ReferencePosition;\n pos: number;\n } | undefined {\n return this.client.findTile(startPos ?? 0, tileLabel, preceding);\n }\n\n /**\n * Retrieve text from the SharedString in string format.\n * @param start - The starting index of the text to retrieve, or 0 if omitted.\n * @param end - The ending index of the text to retrieve, or the end of the string if omitted\n * @returns The requested text content as a string.\n */\n public getText(start?: number, end?: number) {\n const segmentWindow = this.client.getCollabWindow();\n return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, \"\", start, end);\n }\n\n /**\n * Adds spaces for markers and handles, so that position calculations account for them.\n */\n public getTextWithPlaceholders(start?: number, end?: number) {\n const segmentWindow = this.client.getCollabWindow();\n return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, \" \", start, end);\n }\n\n public getTextRangeWithMarkers(start: number, end: number) {\n const segmentWindow = this.client.getCollabWindow();\n return this.mergeTreeTextHelper.getText(segmentWindow.currentSeq, segmentWindow.clientId, \"*\", start, end);\n }\n\n /**\n * Looks up and returns a `Marker` using its id. Returns `undefined` if there is no marker with the provided\n * id in this `SharedString`.\n */\n public getMarkerFromId(id: string): ISegment | undefined {\n return this.client.getMarkerFromId(id);\n }\n\n /**\n * Revert an op\n */\n protected rollback(content: any, localOpMetadata: unknown): void {\n if (this.client.rollback !== undefined) {\n this.client.rollback(content, localOpMetadata);\n } else {\n super.rollback(content, localOpMetadata);\n }\n }\n}\n\ninterface ITextAndMarkerAccumulator {\n parallelText: string[];\n parallelMarkers: Marker[];\n parallelMarkerLabel: string;\n placeholder?: string;\n tagsInProgress: string[];\n textSegment: 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 *\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 */\nexport function getTextAndMarkers(sharedString: SharedString, label: string, start?: number, end?: number): {\n parallelText: string[];\n parallelMarkers: Marker[];\n} {\n const accum: ITextAndMarkerAccumulator = {\n parallelMarkerLabel: label,\n parallelMarkers: [],\n parallelText: [],\n tagsInProgress: [],\n textSegment: new TextSegment(\"\"),\n };\n\n sharedString.walkSegments(gatherTextAndMarkers, start, end, accum);\n return { parallelText: accum.parallelText, parallelMarkers: accum.parallelMarkers };\n}\n\nconst gatherTextAndMarkers: ISegmentAction<ITextAndMarkerAccumulator> = (\n segment: ISegment,\n pos: number,\n refSeq: number,\n clientId: number,\n start: number,\n end: number,\n accumText: ITextAndMarkerAccumulator,\n) => {\n const { placeholder, tagsInProgress, textSegment } = accumText;\n if (TextSegment.is(segment)) {\n let beginTags = \"\";\n let endTags = \"\";\n // TODO: let clients pass in function to get tag\n const tags = [] as string[];\n const initTags = [] as string[];\n\n if (segment.properties?.[\"font-weight\"]) {\n tags.push(\"b\");\n }\n if (segment.properties?.[\"text-decoration\"]) {\n tags.push(\"u\");\n }\n const remTags = [] as string[];\n if (tags.length > 0) {\n for (const tag of tags) {\n if (!tagsInProgress.includes(tag)) {\n beginTags += `<${tag}>`;\n initTags.push(tag);\n }\n }\n for (const accumTag of tagsInProgress) {\n if (!tags.includes(accumTag)) {\n endTags += `</${accumTag}>`;\n remTags.push(accumTag);\n }\n }\n for (const initTag of initTags.reverse()) {\n tagsInProgress.push(initTag);\n }\n } else {\n for (const accumTag of tagsInProgress) {\n endTags += `</${accumTag}>`;\n remTags.push(accumTag);\n }\n }\n for (const remTag of remTags) {\n const remdex = tagsInProgress.indexOf(remTag);\n if (remdex >= 0) {\n tagsInProgress.splice(remdex, 1);\n }\n }\n textSegment.text += endTags;\n textSegment.text += beginTags;\n if ((start <= 0) && (end >= segment.text.length)) {\n textSegment.text += segment.text;\n } else {\n const seglen = segment.text.length;\n const _start = start < 0 ? 0 : start;\n const _end = end >= seglen ? undefined : end;\n textSegment.text += segment.text.substring(_start, _end);\n }\n } else {\n if (placeholder && (placeholder.length > 0)) {\n const placeholderText = placeholder === \"*\" ?\n `\\n${segment.toString()}` : placeholder.repeat(segment.cachedLength);\n textSegment.text += placeholderText;\n } else {\n const marker = segment as Marker;\n if (refHasTileLabel(marker, accumText.parallelMarkerLabel)) {\n accumText.parallelMarkers.push(marker);\n accumText.parallelText.push(textSegment.text);\n textSegment.text = \"\";\n }\n }\n }\n\n return true;\n};\n"]}
|
package/lib/defaultMap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultMap.d.ts","sourceRoot":"","sources":["../src/defaultMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACH,gBAAgB,EAInB,MAAM,o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Ae,EAAE,wBAAwB,GAAG,OAAO;IAU/E,4BAA4B,CAAC,EAAE,EAAE,GAAG,GAAG,OAAO;IASrD;;;;;;;OAOG;IACI,iBAAiB,CACpB,EAAE,EAAE,aAAa,EACjB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,yBAAyB,GAAG,SAAS,EAC9C,eAAe,EAAE,OAAO,GACzB,OAAO;IASV;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAYlB;;;;;;;;;OASG;IACH,OAAO,CAAC,SAAS;IAYjB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAiD1B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;CAwBhC"}
|
package/lib/defaultMap.js
CHANGED
|
@@ -266,6 +266,7 @@ export class DefaultMap {
|
|
|
266
266
|
},
|
|
267
267
|
resubmit: (op, localOpMetadata) => {
|
|
268
268
|
const localValue = this.data.get(op.key);
|
|
269
|
+
assert(localValue !== undefined, 0x3f8 /* Local value expected on resubmission */);
|
|
269
270
|
const handler = localValue.getOpHandler(op.value.opName);
|
|
270
271
|
const { rebasedOp, rebasedLocalOpMetadata, } = handler.rebase(localValue.value, op.value, localOpMetadata);
|
|
271
272
|
this.submitMessage(Object.assign(Object.assign({}, op), { value: rebasedOp }), rebasedLocalOpMetadata);
|