@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
47 lines (46 loc) • 2.89 kB
TypeScript
import { IDnDProviderInternal } from '../types/provider';
import { TSortCompareFn, TFilterFn, TCollisionCheckFn, TContainerBoxFn } from './sensor';
/** Container from overlay ref */
export declare const previewContainer: (p: IDnDProviderInternal) => HTMLElement | null;
/**
* Box from overlay style (x,y) + size.
* The overlay is `position:fixed; top:0; left:0; transform:translate(x,y)`, so
* getBoundingClientRect() is unreliable for the position (transform offsets it from 0,0).
* However the SIZE from getBoundingClientRect IS correct and is used as a fallback
* when the ResizeObserver hasn't fired yet (`overlay.size.value` is still null).
*
* Without the fallback: size=0 → containerBox is a zero-size point → pointer.x <= box.x+0
* fails whenever offset.x>0 (grabbed away from left edge) → pointerInContainer=false always.
*/
export declare const previewBoxFromStyle: TContainerBoxFn;
/** Allowed draggedItems (visible + filtered by groups) */
export declare const visibleElements: (p: IDnDProviderInternal) => Set<HTMLElement>;
/** Allowed droppables (visible + filtered by groups) */
export declare const allowedVisibleZones: (p: IDnDProviderInternal) => Set<HTMLElement>;
/** Exclude nodes being dragged */
export declare const filterNotDragging: TFilterFn;
/** Exclude nodes that are descendants of any dragged element (nesting into self) */
export declare const filterNotDescendantOfDragged: TFilterFn;
/** Exclude disabled draggedItems and zones (including those inside disabled parents) */
export declare const filterNotDisabled: TFilterFn;
/** Exclude: not dragging, not descendant of dragged, not disabled */
export declare const filterValidCollisionTarget: TFilterFn;
/** AABB overlap check (element vs container) — legacy */
export declare const aabbCollision: TCollisionCheckFn;
/** Pointer-in-element: cursor must be inside element (AABB of element) */
export declare const pointerInElementCollision: TCollisionCheckFn;
/** Always true — no container check (for "closest on screen" regardless of overlay position) */
export declare const noContainerCollision: TCollisionCheckFn;
/** Sort: deepest first (topmost visible element under cursor) */
export declare const sortByDepth: TSortCompareFn;
/** Sort: by distance from pointer to element center (closest first) */
export declare const sortByPointerDistance: TSortCompareFn;
/**
* Sort: pointer-in-element + depth when pointer inside container; overlap % + centerDistance when outside.
*
* The container box MUST be computed via previewBoxFromStyle (not getBoundingClientRect) so that
* position is correct for a fixed+transform overlay. The size fallback in previewBoxFromStyle ensures
* the box is never zero-sized on the first frame, making `pointerInContainer` reliably true whenever
* the cursor is above the drag ghost.
*/
export declare const sortByOverlapAndPointer: TSortCompareFn;