import type { DragRef } from './DragRef'; import type { Direction, DropListOrientation, IDropListRefConfig, IPoint } from './Types'; /** * Reference to a drop list container. * Manages drag items, sorting, and drop events. * * @public */ export declare class DropListRef { private readonly _config; private readonly _element; private _data; private _items; private _connectedLists; private _activeDragItem; private _itemPositions; private _isReceiving; private readonly _registry; private _currentPlaceholderIndex; /** * Create a new DropListRef. * * @param element - Host element. * @param config - Configuration options. */ constructor(element: HTMLElement, config?: IDropListRefConfig); /** * Get host element. * * @public */ get element(): HTMLElement; /** * Get associated data. * * @public */ get data(): TData | undefined; /** * Set associated data. * * @public */ set data(value: TData | undefined); /** * Get disabled state. * * @public */ get disabled(): boolean; /** * Set disabled state. * * @public */ set disabled(value: boolean); /** * Get orientation. * * @public */ get orientation(): DropListOrientation; /** * Set orientation. * * @public */ set orientation(value: DropListOrientation); /** * Get items. * * @public */ get items(): ReadonlyArray>; /** * Get connected lists. * * @public */ get connectedTo(): ReadonlyArray>; /** * Whether this list is currently receiving an item from another list. * * @public */ get isReceiving(): boolean; /** * Get ID. * * @public */ get id(): string; /** * Add an item to this list. * * @param item - Item to add. * * @public */ withItems(items: Array>): this; /** * Connect to other drop lists. * * @param lists - Connected lists. * * @public */ connectTo(lists: Array>): this; /** * Set orientation (fluent API). * * @param orientation - List orientation. * * @public */ withOrientation(orientation: DropListOrientation): this; /** * Check if drag container is currently dragging. * * @returns True if dragging active. * * @public */ isDragging(): boolean; /** * Set scrollable parent elements. * * @param parents - Array of scrollable parent elements. * * @public */ withScrollableParents(parents: Array): this; /** * Set element container. * * @param container - Container element. * * @public */ withElementContainer(container: HTMLElement): this; /** * Set layout direction (ltr/rtl). * * @param direction - Layout direction. * * @public */ withDirection(direction: Direction): this; /** * Start drag sequence manually. * Notifies the drop list that dragging has started. * * @public */ start(): void; /** * Dispose of this drop list. * * @public */ dispose(): void; /** * Check if this list can receive a drag item. * * @param item - Item to check. * @param pointerPosition - Current pointer position. * @returns Whether item can be received. * * @public */ _canReceive(item: DragRef, pointerPosition: IPoint): boolean; /** * Cache positions of all items. * Uses placeholder rect for the active drag item since the original element is hidden. * * @private */ private _cacheItemPositions; /** * Cache positions of sibling items (excludes the dragged item). * Used for FLIP animation during sorting. * * @param draggedItem - The item being dragged. * @returns Map of DragRef to DOMRect. * * @private */ private _cacheSiblingPositions; /** * Animate sibling items using FLIP technique. * Applies transforms to move items visually back to old positions, * then removes transforms in next frame to let items animate to new positions. * * @param draggedItem - The item being dragged. * @param oldPositions - Cached positions before placeholder move. * * @private */ private _animateSiblingItems; /** * Get item index at a point. * * @param point - Point to check. * @returns Item index. * * @private */ private _getItemIndexAtPoint; /** * Check if pointer is over container element. * * @param point - Pointer position. * @returns True if over container. * * @private */ private _isPointerOverContainer; /** * Get item index at a point for initial insertion (excluding the dragged item). * * @param point - Point to check. * @returns Insertion index. * * @private */ private _getItemIndexAtPointForInsertion; /** * Get item index at a point for sorting (uses current sibling positions). * * @param point - Point to check. * @param dragItem - The item being dragged. * @returns New index for the item. * * @private */ private _getItemIndexAtPointForSort; /** * Get sibling elements in this container, optionally excluding a drag item. * * @param excludeDragItem - Drag item to exclude (uses its original element). * @returns Array of sibling elements. * * @private */ private _getSiblingElements; /** * Get the container element where items are placed. * * @returns Container element. * * @private */ private _getItemContainer; /** * Insert placeholder at a specific index in the DOM. * * @param placeholder - Placeholder element. * @param index - Target index. * * @private */ private _insertPlaceholderAtIndex; /** * Move placeholder to a specific index in the DOM. * * @param placeholder - Placeholder element. * @param newIndex - Target index. * @param dragItem - The drag item (to exclude its original element). * * @private */ private _movePlaceholderToIndex; /** * Get all items in their current sorted order. * * @returns Array of items. * * @public */ getSortedItems(): Array>; /** * Get the index of a specific drag item. * * @param item - Drag item to find. * @returns Index of item, or -1 if not found. * * @public */ getItemIndex(item: DragRef): number; /** * Get the drag item at a specific index. * * @param index - Index to get item from. * @returns Drag item at index, or null if index is out of bounds. * * @public */ getItemAtIndex(index: number): DragRef | null; /** * Emit sort event. * * @param item - Item being sorted. * @param previousIndex - Previous index. * @param currentIndex - Current index. * @param pointerPosition - Pointer position. * * @private */ private _emitSortEvent; /** * Apply default configuration. * * @param config - User config. * @returns Full config. * * @private */ private _applyConfigDefaults; } /** * Create a new DropListRef instance. * * @param element - Element to make a drop container. * @param config - Configuration options. * @returns DropListRef instance. * * @public */ export declare function createDropListRef(element: HTMLElement, config?: IDropListRefConfig): DropListRef; //# sourceMappingURL=DropListRef.d.ts.map