import type { ReactiveController, ReactiveControllerHost } from 'lit'; import type { FlowBoardColumnElement } from './FlowBoardColumnElement.js'; import type { FlowBoardColumnItemElement } from './FlowBoardColumnItemElement.js'; /** * Controller host type for FlowBoardDragController. * * @public */ export type FlowBoardDragControllerHost = ReactiveControllerHost & HTMLElement; /** * Drag target type. * * @public */ export type FlowBoardDragTargetType = 'column' | 'item'; /** * Drag state for the FlowBoard. * * @public */ export interface IFlowBoardDragState { /** * Whether a drag operation is in progress. */ isDragging: boolean; /** * The type of element being dragged. */ type: FlowBoardDragTargetType | null; /** * The element being dragged. */ element: HTMLElement | null; /** * The ghost element shown during drag. */ ghost: HTMLElement | null; /** * The placeholder element showing drop location. */ placeholder: HTMLElement | null; /** * The original column key (for items). */ fromColumnKey: string | null; /** * The item or column key being dragged. */ key: string | null; /** * The starting index. */ fromIndex: number; /** * The current target index. */ toIndex: number; /** * Current target column key (for cross-column moves). */ targetColumnKey: string | null; /** * The offset position when drag started. */ startOffset: { x: number; y: number; }; /** * Current pointer position. */ currentPosition: { x: number; y: number; }; } /** * Configuration for the FlowBoardDragController. * * @public */ export interface IFlowBoardDragControllerConfig { /** * Callback to check if drag is enabled. */ isDragEnabled: () => boolean; /** * Callback to get all columns. */ getColumns: () => Array; /** * Callback to get items from a column. */ getColumnItems: (column: FlowBoardColumnElement) => Array; /** * Callback fired when column drag starts. */ onColumnDragStart?: (columnKey: string) => void; /** * Callback fired when column drag ends. */ onColumnDragEnd?: (columnKey: string, dropped: boolean) => void; /** * Callback fired when column reorder is requested. */ onColumnReorder?: (columnKey: string, fromIndex: number, toIndex: number) => boolean; /** * Callback fired when item drag starts. */ onItemDragStart?: (itemKey: string, columnKey: string) => void; /** * Callback fired when item drag ends. */ onItemDragEnd?: (itemKey: string, columnKey: string, dropped: boolean) => void; /** * Callback fired when item reorder is requested (same column). */ onItemReorder?: (itemKey: string, columnKey: string, fromIndex: number, toIndex: number, pinnedOffset: number) => boolean; /** * Callback fired when item move is requested (cross column). */ onItemMove?: (itemKey: string, fromColumnKey: string, toColumnKey: string, fromIndex: number, toIndex: number, pinnedOffset: number) => boolean; } /** * Controller for managing drag and drop operations in the FlowBoard. * * @public */ export declare class FlowBoardDragController implements ReactiveController { private readonly _host; private readonly _config; private _state; private _abortController; private _rafId; /** * Creates a new FlowBoardDragController. * * @public * @param host The host element. * @param config The controller configuration. */ constructor(host: FlowBoardDragControllerHost, config: IFlowBoardDragControllerConfig); /** * Gets the current drag state. * * @public * @readonly */ get state(): Readonly; /** * Whether a drag operation is in progress. * * @public * @readonly */ get isDragging(): boolean; /** * @public */ hostConnected(): void; /** * @public */ hostDisconnected(): void; /** * Starts a column drag operation. * * @public * @param column The column element to drag. * @param event The pointer event that started the drag. */ startColumnDrag(column: FlowBoardColumnElement, event: PointerEvent): void; /** * Starts an item drag operation. * * @public * @param item The item element to drag. * @param column The column containing the item. * @param event The pointer event that started the drag. */ startItemDrag(item: FlowBoardColumnItemElement, column: FlowBoardColumnElement, event: PointerEvent): void; /** * Cancels the current drag operation. * * @public */ cancelDrag(): void; /** * Creates the initial drag state. * * @private */ private createInitialState; /** * Creates a ghost element for column dragging. * * @private */ private createColumnGhost; /** * Creates a ghost element for item dragging. * * @private */ private createItemGhost; /** * Creates a placeholder element for column reordering. * * @private */ private createColumnPlaceholder; /** * Creates a placeholder element for item reordering. * * @private */ private createItemPlaceholder; /** * Attaches global pointer event listeners for drag tracking. * * @private */ private attachGlobalListeners; /** * Handles pointer move during drag. * * @private */ private handlePointerMove; /** * Handles pointer up to complete drag. * * @private */ private handlePointerUp; /** * Updates the ghost element position. * * @private */ private updateGhostPosition; /** * Updates the drop target based on current pointer position. * * @private */ private updateDropTarget; /** * Updates the drop target for column dragging. * * @private */ private updateColumnDropTarget; /** * Updates the drop target for item dragging. * * @private */ private updateItemDropTarget; /** * Ends the drag operation. * * @private */ private endDrag; /** * Cleans up drag state and listeners. * * @private */ private cleanup; } /** * Adds a FlowBoardDragController to the given host. * * @public * @param host The host element. * @param config The controller configuration. * @returns The FlowBoardDragController instance. */ export declare function addFlowBoardDragController(host: FlowBoardDragControllerHost, config: IFlowBoardDragControllerConfig): FlowBoardDragController; //# sourceMappingURL=FlowBoardDragController.d.ts.map