import { EventAggregator } from 'aurelia-event-aggregator'; export interface SourceDelegate { dndElement?: Element; dnd?: SourceDelegateInjectedDnd; dndModel(): any; dndCanDrag?(): boolean; dndPreview?(model: any): Element; } export interface SourceOptions { element?: Element; handler?: Element; noPreview?: boolean; hideCursor?: boolean; centerPreviewToMousePosition?: boolean; } export interface SourceDelegateInjectedDnd { isProcessing: boolean; isStartingSource?: boolean; } interface Point { readonly x: number; readonly y: number; } interface Rect { readonly x: number; readonly y: number; readonly width: number; readonly height: number; } export interface DndLocation { mouseStartAt: Point; mouseEndAt: Point; sourceElementRect: Rect; previewElementRect: Rect; targetElementRect: Rect; } export interface TargetDelegateInjectedDnd { isProcessing: boolean; model?: any; canDrop?: boolean; isHovering?: boolean; isHoveringShallowly?: boolean; } export type SourceAndTargetDelegateInjectedDnd = SourceDelegateInjectedDnd & TargetDelegateInjectedDnd; export interface TargetDelegate { dndElement?: Element; dnd?: TargetDelegateInjectedDnd; dndCanDrop(model: any): boolean; dndDrop(location: DndLocation): void; dndHover?(location: DndLocation): void; } export interface TargetOptions { element?: Element; } export type PreviewDrawer = (element: Element) => Element | void; interface LandingTargets { shallowTarget: DndTarget | void; possibleTargets: Array; } declare class DndSource { delegate: SourceDelegate; element: Element; handler: Element | void; noPreview: boolean; hideCursor: boolean; centerPreviewToMousePosition: boolean; constructor(delegate: SourceDelegate, options?: SourceOptions); } declare class DndTarget { delegate: TargetDelegate; element: Element; dndHover: void | ((location: DndLocation) => void); constructor(delegate: TargetDelegate, options?: TargetOptions); } declare class DndService { ea: EventAggregator; dndSources: Array; dndTargets: Array; previewDrawers: Array; isProcessing: boolean; model: any; _element: Element | void; _grabbed: DndSource | void; _moveX: number | void; _moveY: number | void; _sourceElement: Element | void; _sourceElementRect: Rect; _offsetX: number | void; _offsetY: number | void; _noPreview: boolean | void; _sourcePreview: Element | void; _hideCursor: boolean | void; _centerPreviewToMousePosition: boolean | void; _preview: Element | void; constructor(ea: EventAggregator); addPreviewDrawer(drawer: PreviewDrawer): void; addSource(delegate: SourceDelegate, options?: SourceOptions): void; removeSource(delegateOrElement: SourceDelegate | Element): void; addTarget(delegate: TargetDelegate, options?: TargetOptions): void; removeTarget(delegateOrElement: TargetDelegate | Element): void; _sourceOf(element: Element): DndSource; _startListeningEventualMovements(): void; _stopListeningEventualMovements(): void; _startListeningMovements(): void; _stopListeningMovements(): void; _preventGrabbed(e: MouseEvent | TouchEvent): void; _grab(e: MouseEvent | TouchEvent): void; _ungrab(): void; _release(e: MouseEvent | TouchEvent): void; _startingSource(element: Element): DndSource; _startBecauseMouseMoved(e: MouseEvent | TouchEvent): void; _start(dndSource: DndSource): void; _cleanup(): void; _landingTargets(e: MouseEvent | TouchEvent): LandingTargets; _drag(e: MouseEvent | TouchEvent): void; _esc(e: KeyboardEvent): void; _updatePreviewLocation(e: MouseEvent | TouchEvent): void; _locationInfo(targetElement: Element, e: MouseEvent | TouchEvent): DndLocation; _renderPreviewImage(): void; _removePreviewImage(): void; } export { DndService };