@drozdik.m/image-gallery
Version:
Efficient native modal image gallery.
106 lines (105 loc) • 3.07 kB
TypeScript
import { GalleryImage } from "./GalleryImage";
import { LoadingAnimation } from "@drozdik.m/loading-animation";
export declare class ImageGallery {
protected images: GalleryImage[];
protected currentImageIndex: number;
showAnimationLength: number;
showTimeout: number;
protected isOpen: boolean;
constructor(images: GalleryImage[]);
/**
* Moves to the next in the gallery
* */
Next(): void;
/**
* Moves to the previous in the gallery
* */
Previous(): void;
/**
* Tells if the gallery is at the last image
* */
IsAtLast(): boolean;
/**
* Tells if the gallery is at the last image
* */
IsAtFirst(): boolean;
/**
* Opens the gallery if not. Show a gallery image.
* @param index Index of the gallery image to show.
*/
ShowImage(index: number): void;
/**
* Appends an image into the DOM
* @param image Image to append
*/
private AppendImage;
/**
* Resizes current image into proper shape
* */
protected ResizeCurrentImage(): void;
/**
* Invoked prerender method in a gallery image
* @param index Target gallery image index
*/
protected PrerenderImage(index: number): void;
/**
* Opens the gallery at an image
* @param index The initial image index
*/
Open(): void;
/**
* Closes the image gallery
* */
Close(): void;
IsOpen(): boolean;
/**
* Creates an image gallery based on selector to all links/gallery images.
* @param selector Selector to gallery images as links
*/
static FromLinksSelector(selector: string): ImageGallery;
private static environmentInitiated;
private static imageGalleryTarget;
private static imageGallery;
private static arrowLeft;
private static arrowRight;
private static close;
private static background;
private static resizeTarget;
private static loadingAnimation;
/**
* Ensures that there is suitable environment created for ImageGallery functionality
* */
static EnsureEnvironment(): void;
/**
* Returns target for image operations and appending
* */
static GetImageGalleryTarget(): HTMLElement;
/**
* Returns the container for resizing
* */
static GetResizeTarget(): HTMLElement;
/**
* Returns button for closing the gallery
* */
static GetClose(): HTMLElement;
/**
* Returns the image gallery environment root div
* */
static GetImageGallery(): HTMLElement;
/**
* Return environment arrow to the left
* */
static GetArrowLeft(): HTMLElement;
/**
* Return environment arrow to the right
* */
static GetArrowRight(): HTMLElement;
/**
* Return environment background
* */
static GetBackground(): HTMLElement;
/**
* Returns the loading animation
* */
static GetLoadingAnimation(): LoadingAnimation;
}