diff --git a/types/jquery-awesome-cursor/index.d.ts b/types/jquery-awesome-cursor/index.d.ts new file mode 100644 index 0000000000..1137b16b75 --- /dev/null +++ b/types/jquery-awesome-cursor/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for jquery-awesome-cursor 0.3 +// Project: https://jwarby.github.io/jquery-awesome-cursor +// Definitions by: Zsolt Kovács +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// +declare namespace JQueryAwesomeCursor { + type flip = "horizontal" | "vertical" | "both"; + type cssHandler = (name: string) => void; + + interface Options { + color?: string; + size?: number; + hotspot?: number[] | string; + flip?: flip; + rotate?: number; + outline?: string; + font?: Font; + } + + interface Font { + family: string; + cssClass: string | cssHandler; + } +} + +interface JQueryStatic { + awesomeCursor(icon: string, options?: JQueryAwesomeCursor.Options): JQuery; +} + +interface JQuery { + awesomeCursor(icon: string, options?: JQueryAwesomeCursor.Options): JQuery; +} diff --git a/types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts b/types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts new file mode 100644 index 0000000000..cd47f56ff9 --- /dev/null +++ b/types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts @@ -0,0 +1,64 @@ +// Default +jQuery.awesomeCursor('pencil'); + +// Color +jQuery.awesomeCursor('pencil', { + color: '#ff0000' +}); + +// Size +jQuery.awesomeCursor('pencil', { + size: 32 +}); + +// Hotspot +jQuery.awesomeCursor('pencil', { + hotspot: [0, 17] +}); +jQuery.awesomeCursor('pencil', { + hotspot: 'bottom left' +}); + +// Flip +jQuery.awesomeCursor('pencil', { + flip: 'horizontal' +}); +jQuery.awesomeCursor('pencil', { + flip: 'vertical' +}); +jQuery.awesomeCursor('pencil', { + flip: 'both' +}); + +// Rotate +jQuery.awesomeCursor('pencil', { + rotate: 45 +}); + +// Outline +jQuery.awesomeCursor('pencil', { + outline: 'red' +}); + +// Different font +jQuery.awesomeCursor('brush', { + font: { + family: 'typicons', + cssClass: 'typcn typcn-%s' + } +}); +jQuery.awesomeCursor('brush', { + font: { + family: 'typicons', + cssClass: (name) => { + return 'typcn typcn-' + name; + } + } +}); + +// Mixed +jQuery.awesomeCursor('long-arrow-left', { + color: 'red', + hotspot: 'top left', + rotate: 45, +}); diff --git a/types/jquery-awesome-cursor/tsconfig.json b/types/jquery-awesome-cursor/tsconfig.json new file mode 100644 index 0000000000..cb81088d83 --- /dev/null +++ b/types/jquery-awesome-cursor/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery-awesome-cursor-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jquery-awesome-cursor/tslint.json b/types/jquery-awesome-cursor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jquery-awesome-cursor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }