/*! * Copyright (c) Microsoft Corporation and contributors. All rights reserved. * Licensed under the MIT License. */ import type { SlidingPreference } from "./localReference.js"; import type { ISegment } from "./mergeTreeNodes.js"; import { ReferenceType } from "./ops.js"; import type { PropertySet } from "./properties.js"; /** * @internal */ export declare const reservedTileLabelsKey = "referenceTileLabels"; /** * @internal */ export declare const reservedRangeLabelsKey = "referenceRangeLabels"; /** * Determines if the given reference type includes the given flags. * @internal */ export declare function refTypeIncludesFlag(refPosOrType: ReferencePosition | ReferenceType, flags: ReferenceType): boolean; /** * Gets the tile labels stored in the given reference position. * @legacy @beta */ export declare const refGetTileLabels: (refPos: ReferencePosition) => string[] | undefined; /** * Determines if a reference position has the given tile label. * @legacy @beta */ export declare function refHasTileLabel(refPos: ReferencePosition, label: string): boolean; /** * Determines if a reference position has any tile labels. * @internal */ export declare function refHasTileLabels(refPos: ReferencePosition): boolean; /** * Represents a reference to a place within a merge tree. This place conceptually remains stable over time * by referring to a particular segment and offset within that segment. * Thus, this reference's character position changes as the tree is edited. * @legacy @beta */ export interface ReferencePosition { /** * Properties associated with this reference */ properties?: PropertySet; /** * The direction for this reference position to slide when the segment it * points to is removed. See {@link (SlidingPreference:type)} for additional context. * * Defaults to SlidingPreference.Forward */ slidingPreference?: SlidingPreference; refType: ReferenceType; /** * Gets the segment that this reference position is semantically associated with. Returns undefined iff the * reference became detached from the string. */ getSegment(): ISegment | undefined; /** * Gets the offset for this reference position within its associated segment. * * @example * * If a merge-tree has 3 leaf segments ["hello", " ", "world"] and a ReferencePosition refers to the "l" * in "world", that reference's offset would be 3 as "l" is the character at index 3 within "world". */ getOffset(): number; isLeaf(): this is ISegment; } /** * @internal */ export declare const DetachedReferencePosition = -1; /** * Finds the minimum reference position. * @internal */ export declare function minReferencePosition(a: T, b: T): T; /** * Finds the maximum reference position. * @internal */ export declare function maxReferencePosition(a: T, b: T): T; /** * Compares two reference positions. * @internal */ export declare function compareReferencePositions(a: ReferencePosition, b: ReferencePosition): number; //# sourceMappingURL=referencePositions.d.ts.map