import type { PointerEventState } from '@revesuite/lit'; import type { PageSelectionState } from '../default/selection-manager/index.js'; export declare function repairContextMenuRange(e: MouseEvent): void; export type DragDirection = 'right-bottom' | 'right-top' | 'left-bottom' | 'left-top' | 'center-bottom' | 'center-top' | 'directionless'; export type SelectedBlockType = 'Text' | 'Caret' | 'Other'; export declare function getDragDirection(e: PointerEventState): DragDirection; /** * Return a base range for element positioning based on the current selection and selection info * * @example * ```ts * const { selectedType, direction } = getNativeSelectionMouseDragInfo(e); * if (selectedType === 'Caret') { * return; * } * ``` */ export declare function getNativeSelectionMouseDragInfo(e: PointerEventState): { selectedType: "Text" | "Caret"; direction: DragDirection; }; export declare function calcPositionPointByRange(range: Range, direction: DragDirection): { x: number; y: number; }; /** * This function is used to calculate the position of the format bar. * * After update block type, the native selection may be change to block selection, * for example, update block to code block. * So we need to get the targe block's rect dynamic. */ export declare function calcCurrentSelectionPosition(direction: DragDirection, pageSelectionState?: PageSelectionState): { x: number; y: number; }; type CollisionBox = { /** * The point that the objRect is positioned to. */ positioningPoint: { x: number; y: number; }; /** * The boundary rect of the obj that is being positioned. */ objRect?: { height: number; width: number; }; /** * The boundary rect of the container that the obj is in. */ boundaryRect?: DOMRect; offsetX?: number; offsetY?: number; edgeGap?: number; }; export declare function calcSafeCoordinate({ positioningPoint, objRect, boundaryRect, offsetX, offsetY, edgeGap, }: CollisionBox): { x: number; y: number; }; /** * Used to compare the space available * at the top and bottom of an element within a container. * * Please give preference to {@link getPopperPosition} */ export declare function compareTopAndBottomSpace(obj: { getBoundingClientRect: () => DOMRect; }, container?: HTMLElement, gap?: number): { placement: "top" | "bottom"; height: number; }; /** * Get the position of the popper element with flip. */ export declare function getPopperPosition(popper: { getBoundingClientRect: () => DOMRect; }, reference: { getBoundingClientRect: () => DOMRect; }, { gap, offsetY }?: { gap?: number; offsetY?: number; }): { placement: "top" | "bottom"; /** * The height is the available space height. * * Note: it's a max height, not the real height, * because sometimes the popper's height is smaller than the available space. */ height: number; x: string; y: string; }; export {}; //# sourceMappingURL=position.d.ts.map