iiif-processor
Version:
IIIF 2.1 & 3.0 Image API modules for NodeJS
78 lines (72 loc) • 2.18 kB
text/typescript
import { D as Dimensions, M as MaxDimensions, B as BoundingBox, C as CalculatorOptions, a as Calculated } from './contracts-BZUndhBZ.mjs';
type ValidatorKey = 'quality' | 'format' | 'region' | 'size' | 'rotation' | 'density';
type ValidatorMap = Record<ValidatorKey, string[]>;
declare const Validators: ValidatorMap;
type SizeDesc = {
width?: number | null;
height?: number | null;
fit?: 'fill' | 'inside';
};
type CanonicalInfo = {
region: 'full' | BoundingBox;
size: 'full' | 'max' | string;
rotation: string;
quality: string;
format: string;
};
type ParsedInfo = {
region: BoundingBox;
size: SizeDesc;
rotation: {
flop: boolean;
degree: number;
};
quality: string;
format: {
type: string;
density?: number;
};
upscale: boolean;
};
declare class Base {
protected dims: Dimensions;
protected opts: {
max?: MaxDimensions;
};
protected _canonicalInfo: CanonicalInfo;
protected _parsedInfo: ParsedInfo;
protected _sourceDims: Dimensions;
static _matchers(): typeof Validators;
static _validator(type: ValidatorKey): string;
static parsePath(path: string): {
[key: string]: string;
};
constructor(dims: Dimensions, opts?: CalculatorOptions);
protected _validate(type: keyof typeof Validators | 'density', v: unknown): boolean;
region(v: string): this;
size(v: string): this;
rotation(v: string): this;
quality(v: string): this;
format(v: string, density?: number): this;
info(): Calculated;
canonicalPath(): string;
protected _setSize(v: BoundingBox | SizeDesc): this;
protected _constrainSize(constraints: MaxDimensions): void;
protected _canonicalSize(): string;
protected _constrainRegion(): void;
}
declare class Calculator$1 extends Base {
}
declare class Calculator extends Base {
static _matchers(): ValidatorMap;
constructor(dims: {
width: number;
height: number;
}, opts?: CalculatorOptions);
size(v: string): this;
}
declare const _default: {
2: typeof Calculator$1;
3: typeof Calculator;
};
export { _default as default };