UNPKG

@mescius/dsimageviewer

Version:

Document Solutions Image Viewer

121 lines (120 loc) 5.45 kB
import { ImageViewerAPI, Size, ImageLayer, OpenParameters, UndoStorage, EventBus, EventFan, ViewerOptions, ImageToolbarLayout, ZoomSettings, ImageViewerPluginReference, WindowKeyboardListener, PointLocation, GlobalCursorType, ConfirmButton, PluginType, UndoCommandSupport, ImageFormatCode, ImageFormatName, EventName, SecondToolbarType, SaveOptions } from "./ImageViewer"; export * from "./ImageViewer"; export * from "./ImageViewerCommands"; export * from "./ImageFiltersPlugin"; export * from "./PageToolsPlugin"; export * from "./PaintToolsPlugin"; /** * Document Solutions Image Viewer is a fast * JavaScript based client-side Image Viewer that runs in all major browsers. * <p>Note that DsImageViewer is the new name for GcImageViewer, with the same API.</p> * <p>During this transition period we are publishing both versions, but it is recommended that you switch to using DsImageViewer when possible.</p> * @example * ```javascript * const viewer = new GcImageViewer("#root"); * ``` */ export declare class GcImageViewer implements ImageViewerAPI { /** * ImageViewer constructor. * @param element Required. HTML element or CSS selector. * @param options Optional. Viewer options. */ constructor(element: HTMLElement | string, options?: Partial<ViewerOptions>); /** Gets or sets the license key. */ static LicenseKey: string; /** * Gets the viewer instance using the host element or host element selector. * @example * ```javascript * const viewer = DsImageViewer.findControl("#root"); * ``` * @param {string | HTMLElement} selector Root HTML element or its CSS selector * @returns {ImageViewerAPI | undefined} Image Viewer instance if found */ static findControl(selector: string | HTMLElement): ImageViewerAPI | undefined; hasImage: boolean; adaptiveNaturalSize: Size; actualSize: Size; language: string; layers: ImageLayer[]; naturalSize: Size; openParameters: OpenParameters | undefined; undoStorage: UndoStorage; hasUndo: boolean; hasRedo: boolean; undoIndex: number; undoCount: number; version: string; framesCount: number; eventBus: EventBus; onAfterOpen: EventFan; onBeforeOpen: EventFan; onError: EventFan; onImagePaint: EventFan; isAnimationStarted: boolean; options: Partial<ViewerOptions>; toolbarLayout: ImageToolbarLayout; frameIndex: number; zoom: ZoomSettings; ensurePaintLayer(): ImageLayer; removeLayer(layerOrIndex: string | number | ImageLayer): void; removeLayers(): void; applyOptions(): void; applyToolbarLayout(): void; addPlugin(plugin: ImageViewerPluginReference): boolean; addKeyboardListener(uniqueKey: string, handler: WindowKeyboardListener): void; removeKeyboardListener(uniqueKey: string): void; configurePluginMainToolbar(pos: number | boolean | undefined, buttonsToInsert: string[]): void; getEventCanvasPoint(event: MouseEvent | PointerEvent, includeDpi: boolean): PointLocation; setCursor(cursorType: GlobalCursorType): void; resetCursor(): void; toggleCursor(cursorType: false | GlobalCursorType): void; dataUrlToImageData(dataUrl: string, destinationSize?: Size): Promise<ImageData>; confirm(confirmationText?: any, level?: "error" | "info" | "warning", title?: string, buttons?: ConfirmButton[]): Promise<boolean | ConfirmButton>; removePlugin(pluginId: ImageViewerPluginReference | PluginType): void; showAbout(): void; findPlugin(pluginId: PluginType): ImageViewerPluginReference | null; removePlugins(): void; clearUndo(): void; executeCommand(command: UndoCommandSupport): Promise<void>; newImage(options?: Partial<Size> & OpenParameters): Promise<any>; open(file: string | URL | Uint8Array, openParameters?: ImageFormatCode | ImageFormatName | OpenParameters): Promise<any>; close(): Promise<void>; dispose(): void; showActivitySpinner(container?: HTMLElement): void; hideActivitySpinner(): void; startAnimation(): void; stopAnimation(): void; toggleAnimation(): void; undo(): Promise<void>; redo(): Promise<void>; getEvent(eventName: EventName | string): EventFan; triggerEvent(eventName: string, args?: Record<string, unknown>): void; getOriginalImageDataUrl(): string; getImageDataUrl(): string; setImageDataUrl(dataUrl: any): Promise<void>; showSecondToolbar(toolbarKey: SecondToolbarType): Promise<void>; hideSecondToolbar(toolbarKey?: SecondToolbarType): Promise<void>; openLocalFile(): void; save(options?: string | SaveOptions, original?: boolean): void; showMessage(message: string, details: string, severity: "error" | "warn" | "info" | "debug"): void; } /** * Document Solutions Image Viewer is a fast * JavaScript based client-side Image Viewer that runs in all major browsers. * <p>Note that DsImageViewer is the new name for GcImageViewer, with the same API.</p> * <p>During this transition period we are publishing both versions, but it is recommended that you switch to using DsImageViewer when possible.</p> * @example * ```javascript * const viewer = new DsImageViewer("#root"); * ``` */ export declare class DsImageViewer extends GcImageViewer implements ImageViewerAPI { } declare global { interface Window { DsImageViewer: typeof DsImageViewer; GcImageViewer: typeof GcImageViewer; } }