**@types/vanilla-modal Creating definitions for "vanilla-modal"**

adding all the required files for the new type definition
This commit is contained in:
VML\snau
2017-12-18 14:45:01 -08:00
parent e9430decb9
commit f851dac2ab
4 changed files with 78 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
// Type definitions for vanilla-modal 1.6
// Project: https://github.com/benceg/vanilla-modal
// Definitions by: Sam Nau <https://github.com/samnau>
// 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;
}
+24
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,3 @@
import VanillaModal from 'vanilla-modal';
const modalInstance = new VanillaModal();