From f851dac2abb999eee9b1d10422ab45b7e5764ea6 Mon Sep 17 00:00:00 2001 From: "VML\\snau" Date: Mon, 18 Dec 2017 14:45:01 -0800 Subject: [PATCH] **@types/vanilla-modal Creating definitions for "vanilla-modal"** adding all the required files for the new type definition --- types/vanilla-modal/index.d.ts | 50 ++++++++++++++++++++++ types/vanilla-modal/tsconfig.json | 24 +++++++++++ types/vanilla-modal/tslint.json | 1 + types/vanilla-modal/vanilla-modal-tests.ts | 3 ++ 4 files changed, 78 insertions(+) create mode 100644 types/vanilla-modal/index.d.ts create mode 100644 types/vanilla-modal/tsconfig.json create mode 100644 types/vanilla-modal/tslint.json create mode 100644 types/vanilla-modal/vanilla-modal-tests.ts diff --git a/types/vanilla-modal/index.d.ts b/types/vanilla-modal/index.d.ts new file mode 100644 index 0000000000..90775bf7ee --- /dev/null +++ b/types/vanilla-modal/index.d.ts @@ -0,0 +1,50 @@ +// Type definitions for vanilla-modal 1.6 +// Project: https://github.com/benceg/vanilla-modal +// Definitions by: Sam Nau +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface VanillaModalConfig { + modal?: string | HTMLElement; + modalInner?: string; + modalContent?: string; + open?: string; + close?: string; + page?: string; + class?: string; + loadClass?: string; + clickOutside?: boolean; + closeKeys?: [number]; + transitions?: string; + transitionEnd?(): undefined; + onBeforeOpen?(): undefined; + onBeforeClose?(): undefined; + onOpen?(): undefined; + onClose?(): undefined; +} +export interface VanillaModalDomNodes { + modal: HTMLElement; + page: HTMLElement; + modalInner: HTMLElement; + modalContent: HTMLElement; +} + +export default class VanillaModal { + constructor(settings?: VanillaModalConfig); + getDomNodes(): VanillaModalDomNodes; + addLoadedCssClass(): void; + setOpenId(id: string): void; + removeOpenId(): void; + open(allMatches: string, e?: Event): void; + detectTransition(): boolean; + close(e: Event): void; + closeModal(e: Event): void; + closeModalWithTransition(e: Event): void; + captureNode(node: Node): void; + releaseNode(node: Node): void; + closeKeyHandler(e: Event): void; + outsideClickHandler(e: Event): void; + delegateOpen(e: Event): void; + delegateClose(e: Event): void; + listen(): void; + destroy(): void; +} diff --git a/types/vanilla-modal/tsconfig.json b/types/vanilla-modal/tsconfig.json new file mode 100644 index 0000000000..f6d7663c4f --- /dev/null +++ b/types/vanilla-modal/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames" : true + }, + "files": [ + "index.d.ts", + "vanilla-modal-tests.ts" + ] +} diff --git a/types/vanilla-modal/tslint.json b/types/vanilla-modal/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vanilla-modal/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vanilla-modal/vanilla-modal-tests.ts b/types/vanilla-modal/vanilla-modal-tests.ts new file mode 100644 index 0000000000..3f75db3cc8 --- /dev/null +++ b/types/vanilla-modal/vanilla-modal-tests.ts @@ -0,0 +1,3 @@ +import VanillaModal from 'vanilla-modal'; + +const modalInstance = new VanillaModal();