From ce1b7e8971e3d2e1393cd4d990308d6a6f349b38 Mon Sep 17 00:00:00 2001 From: AndersonFriaca Date: Sun, 4 Mar 2018 00:08:05 -0400 Subject: [PATCH 1/2] Types for JQuery ElevateZoom Plus Plugin --- types/ez-plus/ez-plus-tests.ts | 14 +++ types/ez-plus/index.d.ts | 167 +++++++++++++++++++++++++++++++++ types/ez-plus/tsconfig.json | 25 +++++ types/ez-plus/tslint.json | 1 + 4 files changed, 207 insertions(+) create mode 100644 types/ez-plus/ez-plus-tests.ts create mode 100644 types/ez-plus/index.d.ts create mode 100644 types/ez-plus/tsconfig.json create mode 100644 types/ez-plus/tslint.json diff --git a/types/ez-plus/ez-plus-tests.ts b/types/ez-plus/ez-plus-tests.ts new file mode 100644 index 0000000000..df442607f4 --- /dev/null +++ b/types/ez-plus/ez-plus-tests.ts @@ -0,0 +1,14 @@ +import { Options } from "ez-plus"; + +$(document).ready(() => { + // basic usage + $('#image').ezPlus(); + + // with options + const options: Options = { + zoomLens: true, + zoomType: 'lens', + cursor: 'crosshair' + }; + $('#image').ezPlus(options); +}); diff --git a/types/ez-plus/index.d.ts b/types/ez-plus/index.d.ts new file mode 100644 index 0000000000..177816118c --- /dev/null +++ b/types/ez-plus/index.d.ts @@ -0,0 +1,167 @@ +// Type definitions for jQuery ElevateZoom Plus Plugin 1.2 +// Project: https://github.com/igorlino/elevatezoom-plus +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +export interface Options { + /** + * Activate responsivenes + */ + responsive?: boolean; + + /** + * Activate zoom on mouse scroll + */ + scrollZoom?: boolean; + + /** + * Activate simultaneous crossfade of images on gallery change + */ + imageCrossfade?: boolean; + + /** + * Activate spinner icon + */ + loadingIcon?: boolean; + + /** + * Activate easing + */ + easing?: boolean; + easingType?: string; + easingDuration?: number; + + /** + * Used when zoomType set to lens + */ + lensSize?: number; + + /** + * Width of the zoomWindow + */ + zoomWindowWidth?: number; + + /** + * Height of the zoomWindow + */ + zoomWindowHeight?: number; + + /** + * x-axis offset of the zoom window + */ + zoomWindowOffsetX?: number; + + /** + * y-axis offset of the zoom window + */ + zoomWindowOffsetY?: number; + zoomWindowPosition?: number|string; + + /** + * Speed of Lens fadeIn + */ + lensFadeIn?: number; + + /** + * Speed of Lens fadeOut + */ + lensFadeOut?: number; + + /** + * Speed of Window fadeIn + */ + zoomWindowFadeIn?: number; + + /** + * Speed of Window fadeOut + */ + zoomWindowFadeOut?: number; + + /** + * Speed of Tint fadeIn + */ + zoomTintFadeIn?: number; + + /** + * Speed of Tint fadeOut + */ + zoomTintFadeOut?: number; + + /** + * Border Size of the ZoomBox + */ + borderSize?: number; + + /** + * Enable Lens + */ + zoomLens?: boolean; + + /** + * Border Colour + */ + borderColour?: string; + + /** + * Width in pixels of the lens border + */ + lensBorder?: number; + + /** + * Type of lens + */ + lensShape?: 'square' | 'round'; + + /** + * Type of zoom + */ + zoomType?: 'lens' | 'window' | 'inner'; + containLensZoom?: boolean; + + /** + * Colour of the lens background + */ + lensColour?: string; + + /** + * Opacity of lens + */ + lensOpacity?: number; + lenszoom?: boolean; + + /** + * Enable a tint overlay + */ + tint?: boolean; + + /** + * Colour of the tin + */ + tintColour?: string; + + /** + * Opacity of the tint + */ + tintOpacity?: number; + + /** + * This assigns a set of gallery links to the zoom image + */ + gallery?: string; + + /** + * Type of cursor + */ + cursor?: 'default' | 'cursor' | 'crosshair'; +} +declare global { + interface JQuery { + /** + * Initialize ElevateZoom Plugin + */ + ezPlus(options?: Options): JQuery; + } +} diff --git a/types/ez-plus/tsconfig.json b/types/ez-plus/tsconfig.json new file mode 100644 index 0000000000..14e9266312 --- /dev/null +++ b/types/ez-plus/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", + "ez-plus-tests.ts" + ] +} \ No newline at end of file diff --git a/types/ez-plus/tslint.json b/types/ez-plus/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/ez-plus/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file From f804578e48d70a0b859c7f176442ab8cbe3c2461 Mon Sep 17 00:00:00 2001 From: AndersonFriaca Date: Sun, 4 Mar 2018 00:26:00 -0400 Subject: [PATCH 2/2] Types for JQuery ElevateZoom Plus Plugin --- types/ez-plus/index.d.ts | 53 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/types/ez-plus/index.d.ts b/types/ez-plus/index.d.ts index 177816118c..3a372108d3 100644 --- a/types/ez-plus/index.d.ts +++ b/types/ez-plus/index.d.ts @@ -23,9 +23,9 @@ export interface Options { imageCrossfade?: boolean; /** - * Activate spinner icon + * Activate spinner icon or url */ - loadingIcon?: boolean; + loadingIcon?: boolean | string; /** * Activate easing @@ -58,7 +58,7 @@ export interface Options { * y-axis offset of the zoom window */ zoomWindowOffsetY?: number; - zoomWindowPosition?: number|string; + zoomWindowPosition?: number | string; /** * Speed of Lens fadeIn @@ -156,6 +156,53 @@ export interface Options { * Type of cursor */ cursor?: 'default' | 'cursor' | 'crosshair'; + container?: string; + + /** + * Attribute to plugin use for zoom + */ + attrImageZoomSrc?: string; + + /** + * In pixels the dimensions you want to constrain on + */ + constrainSize?: number | false; + constrainType?: 'width' | 'height'; + debug?: boolean; + easingAmount?: number; + enabled?: boolean; + galleryActiveClass?: string; + gallerySelector?: string | false; + galleryItem?: string; + galleryEvent?: string; + mantainZoomAspectRatio?: boolean; + maxZoomLevel?: number | false; + minZoomLevel?: number; + preloading?: 0 | 1; + respond?: any[]; + + /** + * Steps of the scrollzoom + */ + scrollZoomIncrement?: number; + touchEnabled?: boolean; + zoomActivation?: 'click' | 'hover'; + + /** + * Zoom container parent selector + */ + zoomContainerAppendTo?: string; + + /** + * Identifier for the zoom container + */ + zoomId?: number; + + /** + * Zoom level of image + */ + zoomLevel?: number; + zIndex?: number; } declare global { interface JQuery {