@vue-dnd-kit/core
Version:
Core functionality for Vue DnD Kit - a lightweight Vue 3 library for building performant and accessible drag and drop interfaces
37 lines (36 loc) • 1.7 kB
TypeScript
import { CSSProperties } from 'vue';
import { ICoordinates } from '../../external/types';
import { IDnDProviderInternal } from '../types/provider';
/**
* Converts viewport coordinates to container-relative coordinates.
* scroll - page scroll position (window.scrollX, window.scrollY)
*/
export declare const getRelativeCoordinates: (event: ICoordinates, container: HTMLElement | null, scroll?: {
x: number;
y: number;
}) => ICoordinates;
/**
* Returns CSS properties for a bounded selection box within its container.
*
* Uses position: absolute (not fixed) so the rect is placed correctly even when
* an ancestor element has a CSS transform / will-change / filter — any of those
* break fixed positioning by creating a new containing block.
*
* Coordinates are converted from viewport-space (pointer positions) to
* container-local space, accounting for the container's own scroll offset so it
* also works inside scrollable containers.
*/
export declare const getBoundedSelectionArea: (start: ICoordinates, current: ICoordinates, container: HTMLElement | null) => CSSProperties;
/**
* Checks if the event target is within the correct selectable area
*/
export declare const checkIsSelectableArea: (event: PointerEvent, container: HTMLElement) => boolean;
/**
* Updates selectedSet based on selection box (pointer start → current).
* Uses rectCache to avoid getBoundingClientRect() on every pointer move.
*/
export declare const updateSelectionByBox: (provider: IDnDProviderInternal) => void;
/**
* Creates a DOMRect for the selection box from pointer coordinates
*/
export declare const getSelectionBoxRect: (start: ICoordinates, current: ICoordinates) => DOMRect;