import type { CropMode } from './CropMode'; import { SPResourcePath } from './SPResourcePath'; export declare const MAX_PIXEL_RATIO: number; export declare const PUBLIC_CACHE_BREAKPOINT_S: number; /** * @internal */ export declare const CACHE_BREAKPOINT_S: number; /** * @internal */ export declare const CACHE_BREAKPOINT_XL: number; /** * Calculates an optimal thumbnail width for deformed/stretched images. * Uses display sizex2 for retina support, rounds up to nearest cache breakpoint * Sets minimum of CACHE_BREAKPOINT_M to avoid requesting very small thumbnails for highly deformed images * * @param displayWidth - The width at which the image will be displayed (in pixels) * @param naturalWidth - Optional natural width of the image to use as an upper bound * @returns The recommended thumbnail width to request * @internal */ export declare function getDeformationThumbnailWidth(displayWidth: number, naturalWidth?: number): number; export declare const EMPTY_GUIDS: Set; /** * * @internal */ export interface IThumbnailDimension { width: number; height: number; } /** * Internal Utility for PreviewHelper and ThumbnailUrlGenerator class * @internal */ export declare class PreviewUtility { static readonly CLIENT_TYPE: string; static readonly MODERN_WEB_PART: string; static readonly PREFER: string; static readonly EXTEND_CACHE_MAXAGE: string; static readonly THUMBNAIL_SIZE_PREFIX: string; static readonly NO_REDIRECT: string; static readonly CURRENT_OPTIMIZED_FORMAT: string; static readonly VROOM_FORMAT: string; /** * List of file types supported by Media TA service for thumbnail */ static readonly mediaServiceSupportedMap: Set; static get smallestBreakPointWidth(): number; static readonly _optimizableFormats: Map boolean>; private static readonly _browserViewableImageExtensions; private static readonly _getPreviewSupportedMap; private static _imageExtensions; private static _videoExtensions; static get getPreviewSupportedMap(): Set; /** * Returns alternate URL for the given URL. It takes care of encoded/decoded URL. * * @param resourcePath - Relative path of the SharePoint resource. It works for * absolute URL but recommended to use relative Url as authority is always subject * to change upon tenant migration. * @param width - Optional width if provided will be appended as width query parameter * @param height - Optional height if provided will be appended as width query parameter * @param originalWidth - Width of the source image * @param originalHeight - Height of the source image * @param cropMode - Style of cropping requested * @param viewportTop - Top position for the sub-image to start * @param viewportLeft - Left position for the sub-image to start * @param viewportWidth - Width of the sub-image * @param viewportHeight - Height of the sub-image */ static getAlternateUrl(resourcePath: SPResourcePath, width?: number, height?: number, originalWidth?: number, originalHeight?: number, cropMode?: CropMode, viewportTop?: number, viewportLeft?: number, viewportWidth?: number, viewportHeight?: number, cacheBuster?: string, encodedLQIPImage?: string): string | undefined; /** * Normalizes width based on device pixel ratio and supported width breakpoints */ static normalizeWidth(width: number | undefined, isPublicImage?: boolean): number | undefined; /** * Normalizes height based on device pixel ratio */ static normalizeHeight(height: number | undefined): number | undefined; static normalizeWidthToResolution(width: number): number; static isImage(ext: string): boolean; static isVideo(ext: string): boolean; /** * Returns the scaled width based on the effective device pixel ratio (getClampedDevicePixelRatio) * @param width - Width to be scaled by the device pixel ratio * @returns - Scaled width or the original width if it is falsy */ static scaleByPixelRatio(width: number): number; /** * Calculates the effective device pixel ratio based on the current device pixel ratio and the clamping limits. * @returns clamped device pixel ratio between 1 and MAX_PIXEL_RATIO */ static getClampedDevicePixelRatio(): number; /** * Generate VROOM based thumbnail URL * @param vroomItemUrl - VROOM URL representing drive item * @param width - Width of the thumbnail * @param height - Height of the thumbnail * @param cacheBuster - optional cacheBuster of advanced edited image to break cache, * @param resolution - Alternative to width/height * @param originalWidth - Width of the source image * @param originalHeight - Height of the source image * @param cropMode - Style of cropping requested * @param viewportTop - Top position for the subimage to start * @param viewportLeft - Left position for the subimage to start * @param viewportWidth - Width of the subimage * @param viewportHeight - Height of the subimage * @param format - Format of the image (e.g., 'webp') * @param encodedLQIPImage - Base83 encoded image data for Low Quality Image Placeholder (LQIP) */ static getVROOMThumbnailUrl(vroomItemUrl: string | undefined, width?: number | undefined, height?: number | undefined, cacheBuster?: string | undefined, resolution?: number | undefined, originalWidth?: number | undefined, originalHeight?: number | undefined, cropMode?: CropMode | undefined, viewportTop?: number | undefined, viewportLeft?: number | undefined, viewportWidth?: number | undefined, viewportHeight?: number | undefined, format?: string | undefined, encodedLQIPImage?: string | undefined): string | undefined; /** * Generates VROOM Item URL for given resource. * @param siteId - SiteId of the resource, required if spResourcePath is not provided * @param webId - WebId of the resource, required if spResourcePath is not provided * @param listId - listId of the resource, required if spResourcePath is not provided * @param uniqueId - uniqueId of the resource, required if spResourcePath is not provided * @param spHostBaseUrl - Base URL to the SP Host * @param domainName - Domain name of the SP Host, required if spResourcePath is not provided * @param spResourcePath - Path to the resource. used when Guids are not available. * @param callerId - Identification of the caller. This will be used for telemetry purpose only. */ static getVROOMItemUrl(siteId: string | undefined, webId: string | undefined, listId: string | undefined, uniqueId: string | undefined, spHostBaseUrl: string | undefined, domainName: string | undefined, spResourcePath?: string, callerId?: string): string | undefined; /** * Update VROOM custom thumbnail width after normalizing given width by MeTA cache size * @param thumbnailUrl - Original VROOM thumbnail url * @param newWidth - new raw width to be updated */ static updateVROOMCustomThumbnailSize(thumbnailUrl: string | undefined, newWidth: number): string | undefined; /** * Get VROOM thumbnail custom width if specified undefined otherwise * @param thumbnailUrl - Original VROOM thumbnail url */ static getVROOMThumbnailWidth(thumbnailUrl: string): number | undefined; /** * Normalize requested width and height to closest breakpoint respecting device pixel ratio * When width and height both dimension are specified, it is not mapped to break point * Such scenarios URL performance might be slow compared to request by width or height * @param width - Requested width of the thumbnail * @param height - Requested height of the thumbnail * @param resolution - Alternative legacy docviz dimension */ static normalizeDimension(width: number | undefined, height: number | undefined, resolution?: number | undefined): IThumbnailDimension; /** * Extracts the filename extension based on file path (supports url). * @param path - _SPResourcePath of the object. */ static getFileExtension(path: SPResourcePath): string | undefined; /** * Maps given resolution to the max width */ static getWidthByResolution(resolution: number): number; private static _widthToResolution; private static _createLookupEntries; /** * Convert requested width to nearest breakpoint supported by MeTA cache. * @param width - Requested width * @param isPublicImage - When true it is not restricted to MeTA cache size */ private static _getWidthByMeTACache; } //# sourceMappingURL=PreviewUtility.d.ts.map