zyzo / react-dnd-mouse-backend

Mouse Backend for react-dnd library
http://zyzo.github.io/react-dnd-mouse-backend/
MIT License
85 stars 30 forks source link

Add typing? #16

Closed valjusha closed 6 years ago

valjusha commented 6 years ago

Hi, planning to add typing (TypeScript)?

agos commented 6 years ago

a very basic typing:

declare module 'react-dnd-mouse-backend' {
  import { Backend, DragDropManager } from 'dnd-core';

  export default function createHTML5Backend(
    manager: DragDropManager<any>,
  ): MouseBackend;

  export class MouseBackend implements Backend {
    private actions;
    private monitor;
    private registry;
    private context;
    private sourcePreviewNodes;
    private sourcePreviewNodeOptions;
    private sourceNodes;
    private sourceNodeOptions;
    private enterLeaveCounter;
    private dragStartSourceIds;
    private dropTargetIds;
    private dragEnterTargetIds;
    private currentNativeSource;
    private currentNativeHandle;
    private currentDragSourceNode;
    private currentDragSourceNodeOffset;
    private currentDragSourceNodeOffsetChanged;
    private altKeyPressed;
    private mouseMoveTimeoutTimer;
    private asyncEndDragFrameId;
    private dragOverTargetIds;
    constructor(manager: DragDropManager<any>);
    readonly window: Window | undefined;
    setup(): void;
    teardown(): void;
    connectDragPreview(sourceId: string, node: any, options: any): () => void;
    connectDragSource(sourceId: string, node: any, options: any): () => void;
    connectDropTarget(targetId: string, node: any): () => void;
    private addEventListeners;
    private removeEventListeners;
    private getCurrentSourceNodeOptions;
    private getCurrentDropEffect;
    private getCurrentSourcePreviewNodeOptions;
    private getSourceClientOffset;
    private isDraggingNativeItem;
    private beginDragNativeItem;
    private endDragNativeItem;
    private isNodeInDocument;
    private endDragIfSourceWasRemovedFromDOM;
    private setCurrentDragSourceNode;
    private clearCurrentDragSourceNode;
    private checkIfCurrentDragSourceRectChanged;
    private handleTopDragStartCapture;
    private handleDragStart;
    private handleTopDragStart;
    private handleTopDragEndCapture;
    private handleTopDragEnterCapture;
    private handleDragEnter;
    private handleTopDragEnter;
    private handleTopDragOverCapture;
    private handleDragOver;
    private handleTopDragOver;
    private handleTopDragLeaveCapture;
    private handleTopDropCapture;
    private handleDrop;
    private handleTopDrop;
    private handleSelectStart;
  }
}
zyzo commented 6 years ago

Don't have this in mind anytime soon, but feel free to make a PR. Seems like @agos got off to a good start