diff --git a/types/nivo-slider/index.d.ts b/types/nivo-slider/index.d.ts new file mode 100644 index 0000000000..f30f6d445b --- /dev/null +++ b/types/nivo-slider/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for Nivo Slider 3.2 +// Project: https://github.com/Codeinwp/Nivo-Slider-jQuery +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +export type EffectType = 'sliceDown' | 'sliceDownLeft' | 'sliceUp' | 'sliceUpLeft' | 'sliceUpDown' | 'sliceUpDownLeft' | + 'fold' | 'fade' | 'random' | 'slideInRight' | 'slideInLeft' | 'boxRandom' | 'boxRain' | 'boxRainReverse' | + 'boxRainGrow' | 'boxRainGrowReverse'; + +export interface Options { + effect?: EffectType; + slices?: number; + boxCols?: number; + boxRows?: number; + animSpeed?: number; + pauseTime?: number; + startSlide?: number; + directionNav?: boolean; + controlNav?: boolean; + controlNavThumbs?: boolean; + pauseOnHover?: boolean; + manualAdvance?: boolean; + prevText?: string; + nextText?: string; + randomStart?: boolean; + beforeChange?: () => void; + afterChange?: () => void; + slideshowEnd?: () => void; + lastSlide?: () => void; + afterLoad?: () => void; +} +declare global { + interface JQuery { + nivoSlider(options?: Options): JQuery; + } +} diff --git a/types/nivo-slider/nivo-slider-tests.ts b/types/nivo-slider/nivo-slider-tests.ts new file mode 100644 index 0000000000..a82ec64106 --- /dev/null +++ b/types/nivo-slider/nivo-slider-tests.ts @@ -0,0 +1,23 @@ +import { Options } from "nivo-slider"; + +// basic usage +$('#slider').nivoSlider(); + +// with options +const options: Options = { + effect: 'random', + slices: 15, + boxCols: 8, + boxRows: 4, + animSpeed: 500, + pauseTime: 3000, + startSlide: 0, + directionNav: true, + controlNav: true, + controlNavThumbs: false, + pauseOnHover: true, + manualAdvance: false, + prevText: 'Prev', + nextText: 'Next' +}; +$('#slider').nivoSlider(options); diff --git a/types/nivo-slider/tsconfig.json b/types/nivo-slider/tsconfig.json new file mode 100644 index 0000000000..4275013350 --- /dev/null +++ b/types/nivo-slider/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "nivo-slider-tests.ts" + ] +} \ No newline at end of file diff --git a/types/nivo-slider/tslint.json b/types/nivo-slider/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/nivo-slider/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file