@fluidframework/sequence 2.0.0-internal.1.1.2 → 2.0.0-internal.1.2.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/README.md +19 -18
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +5 -5
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +8 -12
- package/dist/intervalCollection.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sequence.d.ts +8 -5
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +7 -4
- package/dist/sequence.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts +5 -5
- package/dist/sharedIntervalCollection.js +5 -5
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedString.d.ts +2 -2
- package/dist/sharedString.js +2 -2
- package/dist/sharedString.js.map +1 -1
- package/dist/sparsematrix.d.ts +28 -15
- package/dist/sparsematrix.d.ts.map +1 -1
- package/dist/sparsematrix.js +24 -13
- package/dist/sparsematrix.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +5 -5
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +8 -12
- package/lib/intervalCollection.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/sequence.d.ts +8 -5
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +7 -4
- package/lib/sequence.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts +5 -5
- package/lib/sharedIntervalCollection.js +5 -5
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedString.d.ts +2 -2
- package/lib/sharedString.js +2 -2
- package/lib/sharedString.js.map +1 -1
- package/lib/sparsematrix.d.ts +28 -15
- package/lib/sparsematrix.d.ts.map +1 -1
- package/lib/sparsematrix.js +24 -13
- package/lib/sparsematrix.js.map +1 -1
- package/package.json +18 -18
- package/src/index.ts +1 -1
- package/src/intervalCollection.ts +10 -11
- package/src/packageVersion.ts +1 -1
- package/src/sequence.ts +8 -5
- package/src/sharedIntervalCollection.ts +5 -5
- package/src/sharedString.ts +2 -2
- package/src/sparsematrix.ts +48 -35
package/lib/sparsematrix.js
CHANGED
|
@@ -6,10 +6,11 @@ import { BaseSegment, createGroupOp, LocalReferenceCollection, } from "@fluidfra
|
|
|
6
6
|
import { pkgVersion } from "./packageVersion";
|
|
7
7
|
import { SharedSegmentSequence, SubSequence } from "./";
|
|
8
8
|
/**
|
|
9
|
-
* An empty segment that occupies 'cachedLength' positions.
|
|
10
|
-
* to "pad" a run of unoccupied cells.
|
|
9
|
+
* An empty segment that occupies 'cachedLength' positions.
|
|
10
|
+
* {@link SparseMatrix} uses `PaddingSegment` to "pad" a run of unoccupied cells.
|
|
11
11
|
*
|
|
12
|
-
* @deprecated PaddingSegment is part of an abandoned prototype.
|
|
12
|
+
* @deprecated `PaddingSegment` is part of an abandoned prototype.
|
|
13
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
13
14
|
*/
|
|
14
15
|
export class PaddingSegment extends BaseSegment {
|
|
15
16
|
constructor(size) {
|
|
@@ -67,7 +68,8 @@ export class PaddingSegment extends BaseSegment {
|
|
|
67
68
|
}
|
|
68
69
|
PaddingSegment.typeString = "PaddingSegment";
|
|
69
70
|
/**
|
|
70
|
-
* @deprecated RunSegment is part of an abandoned prototype.
|
|
71
|
+
* @deprecated `RunSegment` is part of an abandoned prototype.
|
|
72
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
71
73
|
*/
|
|
72
74
|
export class RunSegment extends SubSequence {
|
|
73
75
|
constructor(items) {
|
|
@@ -134,31 +136,38 @@ export class RunSegment extends SubSequence {
|
|
|
134
136
|
}
|
|
135
137
|
RunSegment.typeString = "RunSegment";
|
|
136
138
|
/**
|
|
137
|
-
* @deprecated maxCol is part of an abandoned prototype.
|
|
139
|
+
* @deprecated `maxCol` is part of an abandoned prototype.
|
|
140
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
138
141
|
*/
|
|
139
142
|
export const maxCol = 0x200000; // X128 Excel maximum of 16,384 columns
|
|
140
143
|
/**
|
|
141
|
-
* @deprecated maxCols is part of an abandoned prototype.
|
|
144
|
+
* @deprecated `maxCols` is part of an abandoned prototype.
|
|
145
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
142
146
|
*/
|
|
143
147
|
export const maxCols = maxCol + 1;
|
|
144
148
|
/**
|
|
145
|
-
* @deprecated maxRow is part of an abandoned prototype.
|
|
149
|
+
* @deprecated `maxRow` is part of an abandoned prototype.
|
|
150
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
146
151
|
*/
|
|
147
152
|
export const maxRow = 0xFFFFFFFF; // X4096 Excel maximum of 1,048,576 rows
|
|
148
153
|
/**
|
|
149
|
-
* @deprecated maxRows is part of an abandoned prototype.
|
|
154
|
+
* @deprecated `maxRows` is part of an abandoned prototype.
|
|
155
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
150
156
|
*/
|
|
151
157
|
export const maxRows = maxRow + 1;
|
|
152
158
|
/**
|
|
153
|
-
* @deprecated maxCellPosition is part of an abandoned prototype.
|
|
159
|
+
* @deprecated `maxCellPosition` is part of an abandoned prototype.
|
|
160
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
154
161
|
*/
|
|
155
162
|
export const maxCellPosition = maxCol * maxRow;
|
|
156
163
|
/**
|
|
157
|
-
* @deprecated positionToRowCol is part of an abandoned prototype.
|
|
164
|
+
* @deprecated `positionToRowCol` is part of an abandoned prototype.
|
|
165
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
158
166
|
*/
|
|
159
167
|
export const rowColToPosition = (row, col) => row * maxCols + col;
|
|
160
168
|
/**
|
|
161
|
-
* @deprecated positionToRowCol is part of an abandoned prototype.
|
|
169
|
+
* @deprecated `positionToRowCol` is part of an abandoned prototype.
|
|
170
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
162
171
|
*/
|
|
163
172
|
export function positionToRowCol(position) {
|
|
164
173
|
const row = Math.floor(position / maxCols);
|
|
@@ -166,7 +175,8 @@ export function positionToRowCol(position) {
|
|
|
166
175
|
return { row, col };
|
|
167
176
|
}
|
|
168
177
|
/**
|
|
169
|
-
* @deprecated SparseMatrix is an abandoned prototype.
|
|
178
|
+
* @deprecated `SparseMatrix` is an abandoned prototype.
|
|
179
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
170
180
|
*/
|
|
171
181
|
export class SparseMatrix extends SharedSegmentSequence {
|
|
172
182
|
constructor(document, id, attributes) {
|
|
@@ -280,7 +290,8 @@ export class SparseMatrix extends SharedSegmentSequence {
|
|
|
280
290
|
}
|
|
281
291
|
}
|
|
282
292
|
/**
|
|
283
|
-
* @deprecated SparseMatrixFactory is an abandoned prototype.
|
|
293
|
+
* @deprecated `SparseMatrixFactory` is an abandoned prototype.
|
|
294
|
+
* Use {@link @fluidframework/matrix#SharedMatrixFactory} instead.
|
|
284
295
|
*/
|
|
285
296
|
export class SparseMatrixFactory {
|
|
286
297
|
static segmentFromSpec(spec) {
|
package/lib/sparsematrix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sparsematrix.js","sourceRoot":"","sources":["../src/sparsematrix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,WAAW,EACX,aAAa,EAGb,wBAAwB,GAE3B,MAAM,4BAA4B,CAAC;AAUpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE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CAAC,CAAC;QACzD,IAAI,YAAY,EAAE;YACd,OAAO,YAAY,CAAC;SACvB;QAED,MAAM,QAAQ,GAAG,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,QAAQ,EAAE;YACV,OAAO,QAAQ,CAAC;SACnB;QAED,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3E,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;QAE9B,MAAM,YAAY,GAAG,IAAI,YAAY,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,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACrE,YAAY,CAAC,eAAe,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC;IACxB,CAAC;;AAhDa,wBAAI,GAAG,2DAA2D,CAAC;AAEnE,8BAAU,GAAuB;IAC3C,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,UAAU;CAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n BaseSegment,\n createGroupOp,\n IJSONSegment,\n ISegment,\n LocalReferenceCollection,\n PropertySet,\n} from \"@fluidframework/merge-tree\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n Serializable,\n Jsonable,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISharedObject } from \"@fluidframework/shared-object-base\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { SharedSegmentSequence, SubSequence } from \"./\";\n\n/**\n * An empty segment that occupies 'cachedLength' positions. SparseMatrix uses PaddingSegment\n * to \"pad\" a run of unoccupied cells.\n *\n * @deprecated PaddingSegment is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport class PaddingSegment extends BaseSegment {\n public static readonly typeString = \"PaddingSegment\";\n public static is(segment: ISegment): segment is PaddingSegment {\n return segment.type === PaddingSegment.typeString;\n }\n public static fromJSONObject(spec: any) {\n if (spec && typeof spec === \"object\" && \"pad\" in spec) {\n const segment = new PaddingSegment(spec.pad);\n if (spec.props) {\n segment.addProperties(spec.props);\n }\n return segment;\n }\n return undefined;\n }\n public readonly type = PaddingSegment.typeString;\n\n constructor(size: number) {\n super();\n this.cachedLength = size;\n }\n\n public toJSONObject() {\n return { pad: this.cachedLength, props: this.properties };\n }\n\n public clone(start = 0, end?: number) {\n const b = new PaddingSegment(this.cachedLength);\n this.cloneInto(b);\n return b;\n }\n\n public canAppend(segment: ISegment) {\n return PaddingSegment.is(segment);\n }\n\n public toString() {\n return `[padding: ${this.cachedLength}]`;\n }\n\n public append(segment: ISegment) {\n if (!PaddingSegment.is(segment)) {\n throw new Error(\"can only append padding segment\");\n }\n\n // Note: Must call 'appendLocalRefs' before modifying this segment's length as\n // 'this.cachedLength' is used to adjust the offsets of the local refs.\n LocalReferenceCollection.append(this, segment);\n\n this.cachedLength += segment.cachedLength;\n }\n\n // Returns true if entire run removed\n public removeRange(start: number, end: number) {\n this.cachedLength -= (end - start);\n return (this.cachedLength === 0);\n }\n\n protected createSplitSegmentAt(pos: number) {\n const leftLength = pos;\n const rightLength = this.cachedLength - pos;\n\n this.cachedLength = leftLength;\n return new PaddingSegment(rightLength);\n }\n}\n\n/**\n * @deprecated SparseMatrixItem is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport type SparseMatrixItem = Serializable;\n\n/**\n * @deprecated RunSegment is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport class RunSegment extends SubSequence<SparseMatrixItem> {\n public static readonly typeString = \"RunSegment\";\n public static is(segment: ISegment): segment is RunSegment {\n return segment.type === RunSegment.typeString;\n }\n public static fromJSONObject(spec: any) {\n if (spec && typeof spec === \"object\" && \"items\" in spec) {\n const segment = new RunSegment(spec.items);\n if (spec.props) {\n segment.addProperties(spec.props);\n }\n return segment;\n }\n return undefined;\n }\n public readonly type = RunSegment.typeString;\n\n private tags: any[];\n\n constructor(public items: SparseMatrixItem[]) {\n super(items);\n this.tags = new Array(items.length).fill(undefined);\n }\n\n public clone(start = 0, end?: number) {\n const b = new RunSegment(this.items.slice(start, end));\n if (this.tags) {\n b.tags = this.tags.slice(start, end);\n }\n this.cloneInto(b);\n return b;\n }\n\n public append(segment: ISegment) {\n super.append(segment);\n\n const asRun = segment as RunSegment;\n if (asRun.tags) {\n if (this.tags) {\n this.tags.splice(this.items.length, 0, ...asRun.tags);\n }\n }\n\n return this;\n }\n\n // TODO: retain removed items for undo\n // returns true if entire run removed\n public removeRange(start: number, end: number) {\n this.tags.splice(start, end - start);\n return super.removeRange(start, end);\n }\n\n public getTag(pos: number) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this.tags[pos];\n }\n\n public setTag(pos: number, tag: any) {\n this.tags[pos] = tag;\n }\n\n protected createSplitSegmentAt(pos: number) {\n if (pos > 0) {\n const remainingItems = this.items.slice(pos);\n this.items = this.items.slice(0, pos);\n this.cachedLength = this.items.length;\n\n const leafSegment = new RunSegment(remainingItems);\n leafSegment.tags = this.tags.slice(pos);\n this.tags.length = pos;\n\n return leafSegment;\n }\n }\n}\n\n/**\n * @deprecated MatrixSegment is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport type MatrixSegment = RunSegment | PaddingSegment;\n\n/**\n * @deprecated maxCol is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport const maxCol = 0x200000; // X128 Excel maximum of 16,384 columns\n\n/**\n * @deprecated maxCols is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport const maxCols = maxCol + 1;\n\n/**\n * @deprecated maxRow is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport const maxRow = 0xFFFFFFFF; // X4096 Excel maximum of 1,048,576 rows\n\n/**\n * @deprecated maxRows is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport const maxRows = maxRow + 1;\n\n/**\n * @deprecated maxCellPosition is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport const maxCellPosition = maxCol * maxRow;\n\n/**\n * @deprecated positionToRowCol is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport const rowColToPosition = (row: number, col: number) => row * maxCols + col;\n\n/**\n * @deprecated positionToRowCol is part of an abandoned prototype. Use SharedMatrix instead.\n */\nexport function positionToRowCol(position: number) {\n const row = Math.floor(position / maxCols);\n const col = position - (row * maxCols);\n return { row, col };\n}\n\n/**\n * @deprecated SparseMatrix is an abandoned prototype. Use SharedMatrix instead.\n */\nexport class SparseMatrix extends SharedSegmentSequence<MatrixSegment> {\n /**\n * Create a new sparse matrix\n *\n * @param runtime - data store runtime the new sparse matrix belongs to\n * @param id - optional name of the sparse matrix\n * @returns newly create sparse matrix (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SparseMatrixFactory.Type) as SparseMatrix;\n }\n\n /**\n * Get a factory for SharedMap to register with the data store.\n *\n * @returns a factory that creates and load SharedMap\n */\n public static getFactory(): IChannelFactory {\n return new SparseMatrixFactory();\n }\n\n constructor(document: IFluidDataStoreRuntime, public id: string, attributes: IChannelAttributes) {\n super(document, id, attributes, SparseMatrixFactory.segmentFromSpec);\n }\n\n public get numRows() {\n return positionToRowCol(this.getLength()).row;\n }\n\n public setItems(\n row: number,\n col: number,\n values: SparseMatrixItem[],\n props?: PropertySet,\n ) {\n const start = rowColToPosition(row, col);\n const end = start + values.length;\n const segment = new RunSegment(values);\n if (props) {\n segment.addProperties(props);\n }\n\n this.replaceRange(start, end, segment);\n }\n\n public getItem(row: number, col: number):\n // The return type is defined explicitly here to prevent TypeScript from generating dynamic imports\n Jsonable<string | number | boolean | IFluidHandle> {\n const pos = rowColToPosition(row, col);\n const { segment, offset } = this.getContainingSegment(pos);\n if (segment && RunSegment.is(segment)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return segment.items[offset];\n } else if (segment && PaddingSegment.is(segment)) {\n return undefined;\n }\n\n throw new Error(`Unrecognized Segment type`);\n }\n\n public getTag(row: number, col: number) {\n const { segment, offset } = this.getSegment(row, col);\n if (RunSegment.is(segment)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return segment.getTag(offset);\n }\n return undefined;\n }\n\n public setTag(row: number, col: number, tag: any) {\n const { segment, offset } = this.getSegment(row, col);\n if (RunSegment.is(segment)) {\n segment.setTag(offset, tag);\n } else if (tag !== undefined) {\n throw new Error(`Must not attempt to set tags on '${segment.constructor.name}'.`);\n }\n }\n\n public insertRows(row: number, numRows: number) {\n const pos = rowColToPosition(row, 0);\n const size = maxCols * numRows;\n const segment = new PaddingSegment(size);\n\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n public removeRows(row: number, numRows: number) {\n const pos = rowColToPosition(row, 0);\n const size = maxCols * numRows;\n this.removeRange(pos, pos + size);\n }\n\n public insertCols(col: number, numCols: number) {\n this.moveAsPadding(maxCol - numCols, col, numCols);\n }\n\n public removeCols(col: number, numCols: number) {\n this.moveAsPadding(col, maxCol - numCols, numCols);\n }\n\n public annotatePosition(row: number, col: number, props: PropertySet) {\n const pos = rowColToPosition(row, col);\n this.annotateRange(pos, pos + 1, props);\n }\n\n public getPositionProperties(row: number, col: number) {\n const pos = rowColToPosition(row, col);\n return this.getPropertiesAtPosition(pos);\n }\n\n // For each row, moves 'numCols' items starting from 'srcCol' and inserts 'numCols' padding\n // at 'destCol'. Used by insertCols and removeCols.\n private moveAsPadding(srcCol: number, destCol: number, numCols: number) {\n const removeColStart = srcCol;\n const removeColEnd = srcCol + numCols;\n const ops = [];\n\n for (let r = 0, rowStart = 0; r < this.numRows; r++, rowStart += maxCols) {\n ops.push(this.client.removeRangeLocal(rowStart + removeColStart, rowStart + removeColEnd));\n const insertPos = rowStart + destCol;\n const segment = new PaddingSegment(numCols);\n ops.push(this.client.insertSegmentLocal(insertPos, segment));\n }\n\n this.submitSequenceMessage(createGroupOp(...ops));\n }\n\n private getSegment(row: number, col: number) {\n const pos = rowColToPosition(row, col);\n return this.getContainingSegment(pos);\n }\n}\n\n/**\n * @deprecated SparseMatrixFactory is an abandoned prototype. Use SharedMatrixFactory instead.\n */\nexport class SparseMatrixFactory implements IChannelFactory {\n public static Type = \"https://graph.microsoft.com/types/mergeTree/sparse-matrix\";\n\n public static Attributes: IChannelAttributes = {\n type: SparseMatrixFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public static segmentFromSpec(spec: IJSONSegment): ISegment {\n const maybePadding = PaddingSegment.fromJSONObject(spec);\n if (maybePadding) {\n return maybePadding;\n }\n\n const maybeRun = RunSegment.fromJSONObject(spec);\n if (maybeRun) {\n return maybeRun;\n }\n\n throw new Error(`Unrecognized IJSONObject: '${JSON.stringify(spec)}'`);\n }\n\n public get type() {\n return SparseMatrixFactory.Type;\n }\n\n public get attributes() {\n return SparseMatrixFactory.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,\n ): Promise<ISharedObject> {\n const sharedObject = new SparseMatrix(runtime, id, attributes);\n await sharedObject.load(services);\n return sharedObject;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string): ISharedObject {\n const sharedObject = new SparseMatrix(document, id, this.attributes);\n sharedObject.initializeLocal();\n return sharedObject;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sparsematrix.js","sourceRoot":"","sources":["../src/sparsematrix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,WAAW,EACX,aAAa,EAGb,wBAAwB,GAE3B,MAAM,4BAA4B,CAAC;AAUpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,OAAO,cAAe,SAAQ,WAAW;IAiB3C,YAAY,IAAY;QACpB,KAAK,EAAE,CAAC;QAHI,SAAI,GAAG,cAAc,CAAC,UAAU,CAAC;QAI7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC7B,CAAC;IAlBM,MAAM,CAAC,EAAE,CAAC,OAAiB;QAC9B,OAAO,OAAO,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,CAAC;IACtD,CAAC;IACM,MAAM,CAAC,cAAc,CAAC,IAAS;QAClC,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE;YACnD,MAAM,OAAO,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC7C,IAAI,IAAI,CAAC,KAAK,EAAE;gBACZ,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACrC;YACD,OAAO,OAAO,CAAC;SAClB;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAQM,YAAY;QACf,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;IAC9D,CAAC;IAEM,KAAK,CAAC,KAAK,GAAG,CA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AC;QACrE,YAAY,CAAC,eAAe,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC;IACxB,CAAC;;AAhDa,wBAAI,GAAG,2DAA2D,CAAC;AAEnE,8BAAU,GAAuB;IAC3C,IAAI,EAAE,mBAAmB,CAAC,IAAI;IAC9B,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,UAAU;CAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n BaseSegment,\n createGroupOp,\n IJSONSegment,\n ISegment,\n LocalReferenceCollection,\n PropertySet,\n} from \"@fluidframework/merge-tree\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelServices,\n IChannelFactory,\n Serializable,\n Jsonable,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISharedObject } from \"@fluidframework/shared-object-base\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { SharedSegmentSequence, SubSequence } from \"./\";\n\n/**\n * An empty segment that occupies 'cachedLength' positions.\n * {@link SparseMatrix} uses `PaddingSegment` to \"pad\" a run of unoccupied cells.\n *\n * @deprecated `PaddingSegment` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport class PaddingSegment extends BaseSegment {\n public static readonly typeString = \"PaddingSegment\";\n public static is(segment: ISegment): segment is PaddingSegment {\n return segment.type === PaddingSegment.typeString;\n }\n public static fromJSONObject(spec: any) {\n if (spec && typeof spec === \"object\" && \"pad\" in spec) {\n const segment = new PaddingSegment(spec.pad);\n if (spec.props) {\n segment.addProperties(spec.props);\n }\n return segment;\n }\n return undefined;\n }\n public readonly type = PaddingSegment.typeString;\n\n constructor(size: number) {\n super();\n this.cachedLength = size;\n }\n\n public toJSONObject() {\n return { pad: this.cachedLength, props: this.properties };\n }\n\n public clone(start = 0, end?: number) {\n const b = new PaddingSegment(this.cachedLength);\n this.cloneInto(b);\n return b;\n }\n\n public canAppend(segment: ISegment) {\n return PaddingSegment.is(segment);\n }\n\n public toString() {\n return `[padding: ${this.cachedLength}]`;\n }\n\n public append(segment: ISegment) {\n if (!PaddingSegment.is(segment)) {\n throw new Error(\"can only append padding segment\");\n }\n\n // Note: Must call 'appendLocalRefs' before modifying this segment's length as\n // 'this.cachedLength' is used to adjust the offsets of the local refs.\n LocalReferenceCollection.append(this, segment);\n\n this.cachedLength += segment.cachedLength;\n }\n\n // Returns true if entire run removed\n public removeRange(start: number, end: number) {\n this.cachedLength -= (end - start);\n return (this.cachedLength === 0);\n }\n\n protected createSplitSegmentAt(pos: number) {\n const leftLength = pos;\n const rightLength = this.cachedLength - pos;\n\n this.cachedLength = leftLength;\n return new PaddingSegment(rightLength);\n }\n}\n\n/**\n * @deprecated `SparseMatrixItem` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport type SparseMatrixItem = Serializable;\n\n/**\n * @deprecated `RunSegment` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport class RunSegment extends SubSequence<SparseMatrixItem> {\n public static readonly typeString = \"RunSegment\";\n public static is(segment: ISegment): segment is RunSegment {\n return segment.type === RunSegment.typeString;\n }\n public static fromJSONObject(spec: any) {\n if (spec && typeof spec === \"object\" && \"items\" in spec) {\n const segment = new RunSegment(spec.items);\n if (spec.props) {\n segment.addProperties(spec.props);\n }\n return segment;\n }\n return undefined;\n }\n public readonly type = RunSegment.typeString;\n\n private tags: any[];\n\n constructor(public items: SparseMatrixItem[]) {\n super(items);\n this.tags = new Array(items.length).fill(undefined);\n }\n\n public clone(start = 0, end?: number) {\n const b = new RunSegment(this.items.slice(start, end));\n if (this.tags) {\n b.tags = this.tags.slice(start, end);\n }\n this.cloneInto(b);\n return b;\n }\n\n public append(segment: ISegment) {\n super.append(segment);\n\n const asRun = segment as RunSegment;\n if (asRun.tags) {\n if (this.tags) {\n this.tags.splice(this.items.length, 0, ...asRun.tags);\n }\n }\n\n return this;\n }\n\n // TODO: retain removed items for undo\n // returns true if entire run removed\n public removeRange(start: number, end: number) {\n this.tags.splice(start, end - start);\n return super.removeRange(start, end);\n }\n\n public getTag(pos: number) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this.tags[pos];\n }\n\n public setTag(pos: number, tag: any) {\n this.tags[pos] = tag;\n }\n\n protected createSplitSegmentAt(pos: number) {\n if (pos > 0) {\n const remainingItems = this.items.slice(pos);\n this.items = this.items.slice(0, pos);\n this.cachedLength = this.items.length;\n\n const leafSegment = new RunSegment(remainingItems);\n leafSegment.tags = this.tags.slice(pos);\n this.tags.length = pos;\n\n return leafSegment;\n }\n }\n}\n\n/**\n * @deprecated `MatrixSegment` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport type MatrixSegment = RunSegment | PaddingSegment;\n\n/**\n * @deprecated `maxCol` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport const maxCol = 0x200000; // X128 Excel maximum of 16,384 columns\n\n/**\n * @deprecated `maxCols` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\n export const maxCols = maxCol + 1;\n\n /**\n * @deprecated `maxRow` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\n export const maxRow = 0xFFFFFFFF; // X4096 Excel maximum of 1,048,576 rows\n\n /**\n * @deprecated `maxRows` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\n export const maxRows = maxRow + 1;\n\n /**\n * @deprecated `maxCellPosition` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\n export const maxCellPosition = maxCol * maxRow;\n\n /**\n * @deprecated `positionToRowCol` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\n export const rowColToPosition = (row: number, col: number) => row * maxCols + col;\n\n /**\n * @deprecated `positionToRowCol` is part of an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport function positionToRowCol(position: number) {\n const row = Math.floor(position / maxCols);\n const col = position - (row * maxCols);\n return { row, col };\n}\n\n/**\n * @deprecated `SparseMatrix` is an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrix} instead.\n */\nexport class SparseMatrix extends SharedSegmentSequence<MatrixSegment> {\n /**\n * Create a new sparse matrix\n *\n * @param runtime - data store runtime the new sparse matrix belongs to\n * @param id - optional name of the sparse matrix\n * @returns newly create sparse matrix (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SparseMatrixFactory.Type) as SparseMatrix;\n }\n\n /**\n * Get a factory for SharedMap to register with the data store.\n *\n * @returns a factory that creates and load SharedMap\n */\n public static getFactory(): IChannelFactory {\n return new SparseMatrixFactory();\n }\n\n constructor(document: IFluidDataStoreRuntime, public id: string, attributes: IChannelAttributes) {\n super(document, id, attributes, SparseMatrixFactory.segmentFromSpec);\n }\n\n public get numRows() {\n return positionToRowCol(this.getLength()).row;\n }\n\n public setItems(\n row: number,\n col: number,\n values: SparseMatrixItem[],\n props?: PropertySet,\n ) {\n const start = rowColToPosition(row, col);\n const end = start + values.length;\n const segment = new RunSegment(values);\n if (props) {\n segment.addProperties(props);\n }\n\n this.replaceRange(start, end, segment);\n }\n\n public getItem(row: number, col: number):\n // The return type is defined explicitly here to prevent TypeScript from generating dynamic imports\n Jsonable<string | number | boolean | IFluidHandle> {\n const pos = rowColToPosition(row, col);\n const { segment, offset } = this.getContainingSegment(pos);\n if (segment && RunSegment.is(segment)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return segment.items[offset];\n } else if (segment && PaddingSegment.is(segment)) {\n return undefined;\n }\n\n throw new Error(`Unrecognized Segment type`);\n }\n\n public getTag(row: number, col: number) {\n const { segment, offset } = this.getSegment(row, col);\n if (RunSegment.is(segment)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return segment.getTag(offset);\n }\n return undefined;\n }\n\n public setTag(row: number, col: number, tag: any) {\n const { segment, offset } = this.getSegment(row, col);\n if (RunSegment.is(segment)) {\n segment.setTag(offset, tag);\n } else if (tag !== undefined) {\n throw new Error(`Must not attempt to set tags on '${segment.constructor.name}'.`);\n }\n }\n\n public insertRows(row: number, numRows: number) {\n const pos = rowColToPosition(row, 0);\n const size = maxCols * numRows;\n const segment = new PaddingSegment(size);\n\n const insertOp = this.client.insertSegmentLocal(pos, segment);\n if (insertOp) {\n this.submitSequenceMessage(insertOp);\n }\n }\n\n public removeRows(row: number, numRows: number) {\n const pos = rowColToPosition(row, 0);\n const size = maxCols * numRows;\n this.removeRange(pos, pos + size);\n }\n\n public insertCols(col: number, numCols: number) {\n this.moveAsPadding(maxCol - numCols, col, numCols);\n }\n\n public removeCols(col: number, numCols: number) {\n this.moveAsPadding(col, maxCol - numCols, numCols);\n }\n\n public annotatePosition(row: number, col: number, props: PropertySet) {\n const pos = rowColToPosition(row, col);\n this.annotateRange(pos, pos + 1, props);\n }\n\n public getPositionProperties(row: number, col: number) {\n const pos = rowColToPosition(row, col);\n return this.getPropertiesAtPosition(pos);\n }\n\n // For each row, moves 'numCols' items starting from 'srcCol' and inserts 'numCols' padding\n // at 'destCol'. Used by insertCols and removeCols.\n private moveAsPadding(srcCol: number, destCol: number, numCols: number) {\n const removeColStart = srcCol;\n const removeColEnd = srcCol + numCols;\n const ops = [];\n\n for (let r = 0, rowStart = 0; r < this.numRows; r++, rowStart += maxCols) {\n ops.push(this.client.removeRangeLocal(rowStart + removeColStart, rowStart + removeColEnd));\n const insertPos = rowStart + destCol;\n const segment = new PaddingSegment(numCols);\n ops.push(this.client.insertSegmentLocal(insertPos, segment));\n }\n\n this.submitSequenceMessage(createGroupOp(...ops));\n }\n\n private getSegment(row: number, col: number) {\n const pos = rowColToPosition(row, col);\n return this.getContainingSegment(pos);\n }\n}\n\n/**\n * @deprecated `SparseMatrixFactory` is an abandoned prototype.\n * Use {@link @fluidframework/matrix#SharedMatrixFactory} instead.\n */\nexport class SparseMatrixFactory implements IChannelFactory {\n public static Type = \"https://graph.microsoft.com/types/mergeTree/sparse-matrix\";\n\n public static Attributes: IChannelAttributes = {\n type: SparseMatrixFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public static segmentFromSpec(spec: IJSONSegment): ISegment {\n const maybePadding = PaddingSegment.fromJSONObject(spec);\n if (maybePadding) {\n return maybePadding;\n }\n\n const maybeRun = RunSegment.fromJSONObject(spec);\n if (maybeRun) {\n return maybeRun;\n }\n\n throw new Error(`Unrecognized IJSONObject: '${JSON.stringify(spec)}'`);\n }\n\n public get type() {\n return SparseMatrixFactory.Type;\n }\n\n public get attributes() {\n return SparseMatrixFactory.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,\n ): Promise<ISharedObject> {\n const sharedObject = new SparseMatrix(runtime, id, attributes);\n await sharedObject.load(services);\n return sharedObject;\n }\n\n public create(document: IFluidDataStoreRuntime, id: string): ISharedObject {\n const sharedObject = new SparseMatrix(document, id, this.attributes);\n sharedObject.initializeLocal();\n return sharedObject;\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/sequence",
|
|
3
|
-
"version": "2.0.0-internal.1.
|
|
3
|
+
"version": "2.0.0-internal.1.2.0",
|
|
4
4
|
"description": "Distributed sequence",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -68,29 +68,29 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
70
70
|
"@fluidframework/common-utils": "^1.0.0",
|
|
71
|
-
"@fluidframework/container-utils": "^2.0.0-internal.1.
|
|
72
|
-
"@fluidframework/core-interfaces": "^2.0.0-internal.1.
|
|
73
|
-
"@fluidframework/datastore-definitions": "^2.0.0-internal.1.
|
|
74
|
-
"@fluidframework/merge-tree": "^2.0.0-internal.1.
|
|
71
|
+
"@fluidframework/container-utils": "^2.0.0-internal.1.2.0",
|
|
72
|
+
"@fluidframework/core-interfaces": "^2.0.0-internal.1.2.0",
|
|
73
|
+
"@fluidframework/datastore-definitions": "^2.0.0-internal.1.2.0",
|
|
74
|
+
"@fluidframework/merge-tree": "^2.0.0-internal.1.2.0",
|
|
75
75
|
"@fluidframework/protocol-definitions": "^1.0.0",
|
|
76
|
-
"@fluidframework/runtime-definitions": "^2.0.0-internal.1.
|
|
77
|
-
"@fluidframework/runtime-utils": "^2.0.0-internal.1.
|
|
78
|
-
"@fluidframework/shared-object-base": "^2.0.0-internal.1.
|
|
79
|
-
"@fluidframework/telemetry-utils": "^2.0.0-internal.1.
|
|
76
|
+
"@fluidframework/runtime-definitions": "^2.0.0-internal.1.2.0",
|
|
77
|
+
"@fluidframework/runtime-utils": "^2.0.0-internal.1.2.0",
|
|
78
|
+
"@fluidframework/shared-object-base": "^2.0.0-internal.1.2.0",
|
|
79
|
+
"@fluidframework/telemetry-utils": "^2.0.0-internal.1.2.0",
|
|
80
80
|
"uuid": "^8.3.1"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@fluid-internal/stochastic-test-utils": "^2.0.0-internal.1.
|
|
84
|
-
"@fluid-internal/test-dds-utils": "^2.0.0-internal.1.
|
|
83
|
+
"@fluid-internal/stochastic-test-utils": "^2.0.0-internal.1.2.0",
|
|
84
|
+
"@fluid-internal/test-dds-utils": "^2.0.0-internal.1.2.0",
|
|
85
85
|
"@fluid-tools/benchmark": "^0.43.0",
|
|
86
|
-
"@fluidframework/build-common": "^0.
|
|
87
|
-
"@fluidframework/build-tools": "^0.
|
|
88
|
-
"@fluidframework/eslint-config-fluid": "^0.
|
|
89
|
-
"@fluidframework/gitresources": "^0.
|
|
90
|
-
"@fluidframework/mocha-test-setup": "^2.0.0-internal.1.
|
|
86
|
+
"@fluidframework/build-common": "^1.0.0",
|
|
87
|
+
"@fluidframework/build-tools": "^0.4.4000",
|
|
88
|
+
"@fluidframework/eslint-config-fluid": "^1.0.0",
|
|
89
|
+
"@fluidframework/gitresources": "^0.1038.1000",
|
|
90
|
+
"@fluidframework/mocha-test-setup": "^2.0.0-internal.1.2.0",
|
|
91
91
|
"@fluidframework/sequence-previous": "npm:@fluidframework/sequence@^1.0.0",
|
|
92
|
-
"@fluidframework/server-services-client": "^0.
|
|
93
|
-
"@fluidframework/test-runtime-utils": "^2.0.0-internal.1.
|
|
92
|
+
"@fluidframework/server-services-client": "^0.1038.1000",
|
|
93
|
+
"@fluidframework/test-runtime-utils": "^2.0.0-internal.1.2.0",
|
|
94
94
|
"@microsoft/api-extractor": "^7.22.2",
|
|
95
95
|
"@rushstack/eslint-config": "^2.5.1",
|
|
96
96
|
"@types/diff": "^3.5.1",
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Supports distributed data structures which are list-like.
|
|
8
8
|
*
|
|
9
|
-
* This
|
|
9
|
+
* This library's main export is {@link SharedSequence}, a DDS for storing and simultaneously editing a sequence of
|
|
10
10
|
* text.
|
|
11
11
|
*
|
|
12
12
|
* @remarks Note that SharedString is a sequence DDS but it has additional specialized features and behaviors for
|
|
@@ -51,6 +51,7 @@ const reservedIntervalIdKey = "intervalId";
|
|
|
51
51
|
export enum IntervalType {
|
|
52
52
|
Simple = 0x0,
|
|
53
53
|
Nest = 0x1,
|
|
54
|
+
|
|
54
55
|
/**
|
|
55
56
|
* SlideOnRemove indicates that the ends of the interval will slide if the segment
|
|
56
57
|
* they reference is removed and acked.
|
|
@@ -58,9 +59,10 @@ export enum IntervalType {
|
|
|
58
59
|
* SlideOnRemove is the default interval behavior and does not need to be specified.
|
|
59
60
|
*/
|
|
60
61
|
SlideOnRemove = 0x2, // SlideOnRemove is default behavior - all intervals are SlideOnRemove
|
|
62
|
+
|
|
61
63
|
/**
|
|
62
|
-
* @internal
|
|
63
64
|
* A temporary interval, used internally
|
|
65
|
+
* @internal
|
|
64
66
|
*/
|
|
65
67
|
Transient = 0x4,
|
|
66
68
|
}
|
|
@@ -313,8 +315,8 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
313
315
|
private callbacks?: Record<"beforePositionChange" | "afterPositionChange", () => void>;
|
|
314
316
|
|
|
315
317
|
/**
|
|
316
|
-
* @internal
|
|
317
318
|
* Subscribes to position change events on this interval if there are no current listeners.
|
|
319
|
+
* @internal
|
|
318
320
|
*/
|
|
319
321
|
public addPositionChangeListeners(beforePositionChange: () => void, afterPositionChange: () => void): void {
|
|
320
322
|
if (this.callbacks === undefined) {
|
|
@@ -331,8 +333,8 @@ export class SequenceInterval implements ISerializableInterval {
|
|
|
331
333
|
}
|
|
332
334
|
|
|
333
335
|
/**
|
|
334
|
-
* @internal
|
|
335
336
|
* Removes the currently subscribed position change listeners.
|
|
337
|
+
* @internal
|
|
336
338
|
*/
|
|
337
339
|
public removePositionChangeListeners(): void {
|
|
338
340
|
if (this.callbacks) {
|
|
@@ -1107,12 +1109,9 @@ export class IntervalCollection<TInterval extends ISerializableInterval>
|
|
|
1107
1109
|
) {
|
|
1108
1110
|
super();
|
|
1109
1111
|
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
this.savedSerializedIntervals =
|
|
1114
|
-
serializedIntervals.intervals.map((i) => decompressInterval(i, serializedIntervals.label));
|
|
1115
|
-
}
|
|
1112
|
+
this.savedSerializedIntervals = Array.isArray(serializedIntervals)
|
|
1113
|
+
? serializedIntervals
|
|
1114
|
+
: serializedIntervals.intervals.map((i) => decompressInterval(i, serializedIntervals.label));
|
|
1116
1115
|
}
|
|
1117
1116
|
|
|
1118
1117
|
public attachGraph(client: Client, label: string) {
|
|
@@ -1443,11 +1442,11 @@ export class IntervalCollection<TInterval extends ISerializableInterval>
|
|
|
1443
1442
|
}
|
|
1444
1443
|
|
|
1445
1444
|
/**
|
|
1446
|
-
* @internal
|
|
1447
|
-
*
|
|
1448
1445
|
* Returns new interval after rebasing. If undefined, the interval was
|
|
1449
1446
|
* deleted as a result of rebasing. This can occur if the interval applies
|
|
1450
1447
|
* to a range that no longer exists, and the interval was unable to slide.
|
|
1448
|
+
*
|
|
1449
|
+
* @internal
|
|
1451
1450
|
*/
|
|
1452
1451
|
public rebaseLocalInterval(
|
|
1453
1452
|
opName: string,
|
package/src/packageVersion.ts
CHANGED
package/src/sequence.ts
CHANGED
|
@@ -66,7 +66,7 @@ const contentPath = "content";
|
|
|
66
66
|
/**
|
|
67
67
|
* Events emitted in response to changes to the sequence data.
|
|
68
68
|
*
|
|
69
|
-
*
|
|
69
|
+
* @remarks
|
|
70
70
|
*
|
|
71
71
|
* The following is the list of events emitted.
|
|
72
72
|
*
|
|
@@ -408,8 +408,8 @@ export abstract class SharedSegmentSequence<T extends ISegment>
|
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
/**
|
|
411
|
-
* @deprecated
|
|
412
|
-
* are supported. Use
|
|
411
|
+
* @deprecated `IntervalCollection`s are created on a first-write wins basis, and concurrent creates
|
|
412
|
+
* are supported. Use {@link SharedSegmentSequence.getIntervalCollection} instead.
|
|
413
413
|
*/
|
|
414
414
|
public async waitIntervalCollection(
|
|
415
415
|
label: string,
|
|
@@ -422,12 +422,15 @@ export abstract class SharedSegmentSequence<T extends ISegment>
|
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
/**
|
|
425
|
-
* @returns
|
|
426
|
-
*
|
|
425
|
+
* @returns An iterable object that enumerates the IntervalCollection labels.
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* ```typescript
|
|
427
429
|
* const iter = this.getIntervalCollectionKeys();
|
|
428
430
|
* for (key of iter)
|
|
429
431
|
* const collection = this.getIntervalCollection(key);
|
|
430
432
|
* ...
|
|
433
|
+
* ```
|
|
431
434
|
*/
|
|
432
435
|
public getIntervalCollectionLabels(): IterableIterator<string> {
|
|
433
436
|
return this.intervalCollections.keys();
|
|
@@ -31,8 +31,8 @@ import { IMapMessageLocalMetadata } from "./defaultMapInterfaces";
|
|
|
31
31
|
const snapshotFileName = "header";
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* The factory that defines the SharedIntervalCollection
|
|
35
|
-
* @deprecated
|
|
34
|
+
* The factory that defines the SharedIntervalCollection.
|
|
35
|
+
* @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
|
|
36
36
|
*/
|
|
37
37
|
export class SharedIntervalCollectionFactory implements IChannelFactory {
|
|
38
38
|
public static readonly Type = "https://graph.microsoft.com/types/sharedIntervalCollection";
|
|
@@ -82,7 +82,7 @@ export interface ISharedIntervalCollection<TInterval extends ISerializableInterv
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* @deprecated
|
|
85
|
+
* @deprecated `SharedIntervalCollection` is not maintained and is planned to be removed.
|
|
86
86
|
*/
|
|
87
87
|
export class SharedIntervalCollection
|
|
88
88
|
extends SharedObject implements ISharedIntervalCollection<Interval> {
|
|
@@ -128,8 +128,8 @@ export class SharedIntervalCollection
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
* @deprecated
|
|
132
|
-
* are supported. Use
|
|
131
|
+
* @deprecated `IntervalCollection`s are created on a first-write wins basis, and concurrent creates
|
|
132
|
+
* are supported. Use {@link SharedIntervalCollection.getIntervalCollection} instead.
|
|
133
133
|
*/
|
|
134
134
|
public async waitIntervalCollection(
|
|
135
135
|
label: string,
|
package/src/sharedString.ts
CHANGED
|
@@ -224,7 +224,7 @@ export class SharedString extends SharedSegmentSequence<SharedStringSegment> imp
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
|
-
* @deprecated
|
|
227
|
+
* @deprecated Use the free function {@link getTextAndMarkers} exported by this package instead.
|
|
228
228
|
*/
|
|
229
229
|
public getTextAndMarkers(label: string) {
|
|
230
230
|
const segmentWindow = this.client.getCollabWindow();
|
|
@@ -251,7 +251,7 @@ export class SharedString extends SharedSegmentSequence<SharedStringSegment> imp
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
|
-
* @deprecated
|
|
254
|
+
* @deprecated Use {@link SharedString.getTextWithPlaceholders} instead.
|
|
255
255
|
*/
|
|
256
256
|
public getTextRangeWithPlaceholders(start: number, end: number) {
|
|
257
257
|
return this.getTextWithPlaceholders(start, end);
|
package/src/sparsematrix.ts
CHANGED
|
@@ -25,10 +25,11 @@ import { pkgVersion } from "./packageVersion";
|
|
|
25
25
|
import { SharedSegmentSequence, SubSequence } from "./";
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* An empty segment that occupies 'cachedLength' positions.
|
|
29
|
-
* to "pad" a run of unoccupied cells.
|
|
28
|
+
* An empty segment that occupies 'cachedLength' positions.
|
|
29
|
+
* {@link SparseMatrix} uses `PaddingSegment` to "pad" a run of unoccupied cells.
|
|
30
30
|
*
|
|
31
|
-
* @deprecated PaddingSegment is part of an abandoned prototype.
|
|
31
|
+
* @deprecated `PaddingSegment` is part of an abandoned prototype.
|
|
32
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
32
33
|
*/
|
|
33
34
|
export class PaddingSegment extends BaseSegment {
|
|
34
35
|
public static readonly typeString = "PaddingSegment";
|
|
@@ -98,12 +99,14 @@ export class PaddingSegment extends BaseSegment {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
/**
|
|
101
|
-
* @deprecated SparseMatrixItem is part of an abandoned prototype.
|
|
102
|
+
* @deprecated `SparseMatrixItem` is part of an abandoned prototype.
|
|
103
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
102
104
|
*/
|
|
103
105
|
export type SparseMatrixItem = Serializable;
|
|
104
106
|
|
|
105
107
|
/**
|
|
106
|
-
* @deprecated RunSegment is part of an abandoned prototype.
|
|
108
|
+
* @deprecated `RunSegment` is part of an abandoned prototype.
|
|
109
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
107
110
|
*/
|
|
108
111
|
export class RunSegment extends SubSequence<SparseMatrixItem> {
|
|
109
112
|
public static readonly typeString = "RunSegment";
|
|
@@ -183,43 +186,51 @@ export class RunSegment extends SubSequence<SparseMatrixItem> {
|
|
|
183
186
|
}
|
|
184
187
|
|
|
185
188
|
/**
|
|
186
|
-
* @deprecated MatrixSegment is part of an abandoned prototype.
|
|
189
|
+
* @deprecated `MatrixSegment` is part of an abandoned prototype.
|
|
190
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
187
191
|
*/
|
|
188
192
|
export type MatrixSegment = RunSegment | PaddingSegment;
|
|
189
193
|
|
|
190
194
|
/**
|
|
191
|
-
* @deprecated maxCol is part of an abandoned prototype.
|
|
195
|
+
* @deprecated `maxCol` is part of an abandoned prototype.
|
|
196
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
192
197
|
*/
|
|
193
198
|
export const maxCol = 0x200000; // X128 Excel maximum of 16,384 columns
|
|
194
199
|
|
|
195
200
|
/**
|
|
196
|
-
* @deprecated maxCols is part of an abandoned prototype.
|
|
197
|
-
|
|
198
|
-
export const maxCols = maxCol + 1;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* @deprecated maxRow is part of an abandoned prototype. Use SharedMatrix instead.
|
|
202
|
-
*/
|
|
203
|
-
export const maxRow = 0xFFFFFFFF; // X4096 Excel maximum of 1,048,576 rows
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* @deprecated maxRows is part of an abandoned prototype. Use SharedMatrix instead.
|
|
207
|
-
*/
|
|
208
|
-
export const maxRows = maxRow + 1;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @deprecated maxCellPosition is part of an abandoned prototype. Use SharedMatrix instead.
|
|
212
|
-
*/
|
|
213
|
-
export const maxCellPosition = maxCol * maxRow;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* @deprecated positionToRowCol is part of an abandoned prototype. Use SharedMatrix instead.
|
|
217
|
-
*/
|
|
218
|
-
export const rowColToPosition = (row: number, col: number) => row * maxCols + col;
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* @deprecated positionToRowCol is part of an abandoned prototype. Use SharedMatrix instead.
|
|
201
|
+
* @deprecated `maxCols` is part of an abandoned prototype.
|
|
202
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
222
203
|
*/
|
|
204
|
+
export const maxCols = maxCol + 1;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @deprecated `maxRow` is part of an abandoned prototype.
|
|
208
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
209
|
+
*/
|
|
210
|
+
export const maxRow = 0xFFFFFFFF; // X4096 Excel maximum of 1,048,576 rows
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @deprecated `maxRows` is part of an abandoned prototype.
|
|
214
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
215
|
+
*/
|
|
216
|
+
export const maxRows = maxRow + 1;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* @deprecated `maxCellPosition` is part of an abandoned prototype.
|
|
220
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
221
|
+
*/
|
|
222
|
+
export const maxCellPosition = maxCol * maxRow;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @deprecated `positionToRowCol` is part of an abandoned prototype.
|
|
226
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
227
|
+
*/
|
|
228
|
+
export const rowColToPosition = (row: number, col: number) => row * maxCols + col;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @deprecated `positionToRowCol` is part of an abandoned prototype.
|
|
232
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
233
|
+
*/
|
|
223
234
|
export function positionToRowCol(position: number) {
|
|
224
235
|
const row = Math.floor(position / maxCols);
|
|
225
236
|
const col = position - (row * maxCols);
|
|
@@ -227,7 +238,8 @@ export function positionToRowCol(position: number) {
|
|
|
227
238
|
}
|
|
228
239
|
|
|
229
240
|
/**
|
|
230
|
-
* @deprecated SparseMatrix is an abandoned prototype.
|
|
241
|
+
* @deprecated `SparseMatrix` is an abandoned prototype.
|
|
242
|
+
* Use {@link @fluidframework/matrix#SharedMatrix} instead.
|
|
231
243
|
*/
|
|
232
244
|
export class SparseMatrix extends SharedSegmentSequence<MatrixSegment> {
|
|
233
245
|
/**
|
|
@@ -366,7 +378,8 @@ export class SparseMatrix extends SharedSegmentSequence<MatrixSegment> {
|
|
|
366
378
|
}
|
|
367
379
|
|
|
368
380
|
/**
|
|
369
|
-
* @deprecated SparseMatrixFactory is an abandoned prototype.
|
|
381
|
+
* @deprecated `SparseMatrixFactory` is an abandoned prototype.
|
|
382
|
+
* Use {@link @fluidframework/matrix#SharedMatrixFactory} instead.
|
|
370
383
|
*/
|
|
371
384
|
export class SparseMatrixFactory implements IChannelFactory {
|
|
372
385
|
public static Type = "https://graph.microsoft.com/types/mergeTree/sparse-matrix";
|