import { Point } from './dom/point'; export interface SelectionLike { readonly anchorNode: Node; readonly anchorOffset: number; readonly focusNode: Node; readonly focusOffset: number; } export interface NonNullSelection extends Selection, SelectionLike { readonly type: 'Caret' | 'Range'; readonly anchorNode: Node; readonly focusNode: Node; } export interface PointSelection { readonly anchorPoint: Point; readonly focusPoint: Point; } export declare function isSelectionPresent(selection: Selection | null): selection is NonNullSelection; export declare function isSelectionCollapsed(selection: SelectionLike): boolean; export declare function isSelectionBackward(selection: Selection): boolean; export declare function isSelectionContainedByNode(node: Node, selection: SelectionLike): boolean; export declare function createSelectionWithPoint(point: Point): SelectionLike | undefined; export declare function createSelectionWithPoints({ anchorPoint, focusPoint, }: PointSelection): SelectionLike | undefined; export declare function createSelectionWithRange(range: Range, isBackward?: boolean): SelectionLike; export declare function createPointsWithSelection(selection: SelectionLike): PointSelection; /** * Returns information about the active selection within the given element. * * This is helpful for restoring the active selection later, such as after manipulating the DOM. */ export declare function createPointsWithSelectionInElement(element: Element): PointSelection | undefined; export declare function updateSelection(selection: Selection, newSelection: SelectionLike): void; /** * Restores the selection within the given element, if possible. */ export declare function updateSelectionInElementWithPoints(element: Element, pointSelection: PointSelection | undefined): void; export declare function updateSelectionWithRange(selection: Selection, range: Range, isBackward?: boolean): void; /** Changes [Hello]world to [Hello]world. */ export declare function maybeMoveFromStartToPreviousEndOfPhrasingContent(range: Range): Range;