UNPKG

visionary-url

Version:

A lightweight library for generating image URLs with baked-in blurhash placeholders.

67 lines (57 loc) 1.78 kB
/** * Defaults blurhash components to [4, 4] (or [4, 3] for landscape photos) */ export declare const BASE_BLURHASH_DIMENSIONS = 4; /** * Default endpoint for generating Visionary URLs * - Can be overridden in the `options` field of generateVisionaryUrl() */ export declare const DEFAULT_ENDPOINT = "https://link.visionary.cloud"; export declare const DEFAULT_OPTIONS: VisionaryImageOptions; export declare const IMAGE_SIZE_LOOKUP: Record<number, ImageSizeToken>; /** * Maps bootstrap-inspired size codes to pixels */ export declare const IMAGE_SIZES: Record<ImageSizeToken, number>; declare enum ImageFormatToken { AUTO = "auto", AVIF = "avif", JPEG = "jpeg", WEBP = "webp" } declare enum ImageSizeToken { xs = "xs", sm = "sm", md = "md", lg = "lg", xl = "xl", xxl = "xxl", "4k" = "4k", "5k" = "5k", /** * `full` is image dependent and represents the source image's longest edge */ full = "full" } /** * Charater used to separate Visionary code fields. * (This must be a value not used by blurhash/base83 — see here: https://github.com/woltapp/blurhash/blob/master/Algorithm.md#base-83) */ export declare const V_CODE_SEPARATOR = "!"; /** * Options are encoded in the second segment of a Visionary URL */ declare interface VisionaryImageOptions { debug?: boolean; /** * Specifies that server should send the file as an attachment download * (e.g. content-disposition: attachment) */ download?: boolean; /** Specifies a custom endpoint when `generateVisionaryUrl()` is used */ endpoint?: string; follow?: boolean; format?: ImageFormatToken; size?: ImageSizeToken; } export { }