@types/dragula
TypeScript icon, indicating that this package has built-in type declarations

3.7.2 • Public • Published

Installation

npm install --save @types/dragula

Summary

This package contains type definitions for dragula (http://bevacqua.github.io/dragula/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dragula.

index.d.ts

// Type definitions for dragula 3.7
// Project: http://bevacqua.github.io/dragula/
// Definitions by: Paul Welter <https://github.com/pwelter34>
//                 Yang He <https://github.com/abruzzihraig>
//                 Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare const dragula: dragula.Dragula;

export = dragula;
export as namespace dragula;

declare namespace dragula {
    interface DragulaOptions {
        containers?: Element[] | undefined;
        isContainer?: ((el?: Element) => boolean) | undefined;
        moves?: ((el?: Element, container?: Element, handle?: Element, sibling?: Element) => boolean) | undefined;
        accepts?: ((el?: Element, target?: Element, source?: Element, sibling?: Element) => boolean) | undefined;
        invalid?: ((el?: Element, target?: Element) => boolean) | undefined;
        direction?: string | undefined;
        copy?: ((el: Element, source: Element) => boolean) | boolean | undefined;
        copySortSource?: boolean | undefined;
        revertOnSpill?: boolean | undefined;
        removeOnSpill?: boolean | undefined;
        delay?: boolean | number | undefined;
        mirrorContainer?: Element | undefined;
        ignoreInputTextSelection?: boolean | undefined;
    }

    interface Drake {
        containers: Element[];
        dragging: boolean;
        start(item: Element): void;
        end(): void;
        cancel(revert?: boolean): void;
        canMove(item: Element): boolean;
        remove(): void;
        on(event: "drag", listener: (el: Element, source: Element) => void): Drake;
        on(event: "dragend", listener: (el: Element) => void): Drake;
        on(event: "drop", listener: (el: Element, target: Element, source: Element, sibling: Element) => void): Drake;
        on(
            event: "cancel" | "remove" | "shadow" | "over" | "out",
            listener: (el: Element, container: Element, source: Element) => void,
        ): Drake;
        on(event: "cloned", listener: (clone: Element, original: Element, type: "mirror" | "copy") => void): Drake;
        destroy(): void;
    }

    interface Dragula {
        (containers: Element, options: DragulaOptions): Drake;
        (containers: Element[], options?: DragulaOptions): Drake;
        (options?: DragulaOptions): Drake;
    }
}

Additional Details

  • Last updated: Fri, 22 Sep 2023 20:29:40 GMT
  • Dependencies: none
  • Global values: dragula

Credits

These definitions were written by Paul Welter, Yang He, and Piotr Błażejewicz.

Readme

Keywords

none

Package Sidebar

Install

Weekly Downloads

98,394

Version

3.7.2

License

MIT

Unpacked Size

7.72 kB

Total Files

5

Last publish

Collaborators

  • types