mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Types: changes/additions relating to new v0.32.0 features
A separate commit is required as these were not part of the initial definitions in the v0.31.3 snapshot. From now on, new features and updates can include the relevant TypeScript definition changes as part of the same code/docs/tests commits.
This commit is contained in:
parent
25c6da2bcd
commit
a532659b0f
22
lib/index.d.ts
vendored
22
lib/index.d.ts
vendored
@ -46,7 +46,7 @@ declare namespace sharp {
|
|||||||
/** Object containing nested boolean values representing the available input and output formats/methods. */
|
/** Object containing nested boolean values representing the available input and output formats/methods. */
|
||||||
const format: FormatEnum;
|
const format: FormatEnum;
|
||||||
|
|
||||||
/** An Object containing the version numbers of libvips and its dependencies. */
|
/** An Object containing the version numbers of sharp, libvips and its dependencies. */
|
||||||
const versions: {
|
const versions: {
|
||||||
vips: string;
|
vips: string;
|
||||||
cairo?: string | undefined;
|
cairo?: string | undefined;
|
||||||
@ -67,6 +67,7 @@ declare namespace sharp {
|
|||||||
pango?: string | undefined;
|
pango?: string | undefined;
|
||||||
pixman?: string | undefined;
|
pixman?: string | undefined;
|
||||||
png?: string | undefined;
|
png?: string | undefined;
|
||||||
|
sharp?: string | undefined;
|
||||||
svg?: string | undefined;
|
svg?: string | undefined;
|
||||||
tiff?: string | undefined;
|
tiff?: string | undefined;
|
||||||
webp?: string | undefined;
|
webp?: string | undefined;
|
||||||
@ -808,7 +809,7 @@ declare namespace sharp {
|
|||||||
limitInputPixels?: number | boolean | undefined;
|
limitInputPixels?: number | boolean | undefined;
|
||||||
/** Set this to true to remove safety features that help prevent memory exhaustion (SVG, PNG). (optional, default false) */
|
/** Set this to true to remove safety features that help prevent memory exhaustion (SVG, PNG). (optional, default false) */
|
||||||
unlimited?: boolean | undefined;
|
unlimited?: boolean | undefined;
|
||||||
/** Set this to true to use sequential rather than random access where possible. This can reduce memory usage and might improve performance on some systems. (optional, default false) */
|
/** Set this to false to use random access rather than sequential read. Some operations will do this automatically. */
|
||||||
sequentialRead?: boolean | undefined;
|
sequentialRead?: boolean | undefined;
|
||||||
/** Number representing the DPI for vector images in the range 1 to 100000. (optional, default 72) */
|
/** Number representing the DPI for vector images in the range 1 to 100000. (optional, default 72) */
|
||||||
density?: number | undefined;
|
density?: number | undefined;
|
||||||
@ -902,6 +903,8 @@ declare namespace sharp {
|
|||||||
rgba?: boolean;
|
rgba?: boolean;
|
||||||
/** Text line height in points. Will use the font line height if none is specified. (optional, default `0`) */
|
/** Text line height in points. Will use the font line height if none is specified. (optional, default `0`) */
|
||||||
spacing?: number;
|
spacing?: number;
|
||||||
|
/** Word wrapping style when width is provided, one of: 'word', 'char', 'charWord' (prefer char, fallback to word) or 'none' */
|
||||||
|
wrap?: TextWrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WriteableMetadata {
|
interface WriteableMetadata {
|
||||||
@ -972,6 +975,8 @@ declare namespace sharp {
|
|||||||
subifds?: number | undefined;
|
subifds?: number | undefined;
|
||||||
/** The unit of resolution (density) */
|
/** The unit of resolution (density) */
|
||||||
resolutionUnit?: 'inch' | 'cm' | undefined;
|
resolutionUnit?: 'inch' | 'cm' | undefined;
|
||||||
|
/** String containing format for images loaded via *magick */
|
||||||
|
formatMagick?: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface LevelMetadata {
|
interface LevelMetadata {
|
||||||
@ -1117,10 +1122,10 @@ declare namespace sharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface GifOptions extends OutputOptions, AnimationOptions {
|
interface GifOptions extends OutputOptions, AnimationOptions {
|
||||||
/** Always generate new palettes (slow), re-use existing by default (optional, default false) */
|
/** Re-use existing palette, otherwise generate new (slow) */
|
||||||
reoptimise?: boolean | undefined;
|
reuse?: boolean | undefined;
|
||||||
/** Alternative spelling of "reoptimise" (optional, default false) */
|
/** Use progressive (interlace) scan */
|
||||||
reoptimize?: boolean | undefined;
|
progressive?: boolean | undefined;
|
||||||
/** Maximum number of palette entries, including transparency, between 2 and 256 (optional, default 256) */
|
/** Maximum number of palette entries, including transparency, between 2 and 256 (optional, default 256) */
|
||||||
colours?: number | undefined;
|
colours?: number | undefined;
|
||||||
/** Alternative spelling of "colours". Maximum number of palette entries, including transparency, between 2 and 256 (optional, default 256) */
|
/** Alternative spelling of "colours". Maximum number of palette entries, including transparency, between 2 and 256 (optional, default 256) */
|
||||||
@ -1418,6 +1423,9 @@ declare namespace sharp {
|
|||||||
trimOffsetTop?: number | undefined;
|
trimOffsetTop?: number | undefined;
|
||||||
/** DPI the font was rendered at, only defined when using `text` input */
|
/** DPI the font was rendered at, only defined when using `text` input */
|
||||||
textAutofitDpi?: number | undefined;
|
textAutofitDpi?: number | undefined;
|
||||||
|
/** When using the attention crop strategy, the focal point of the cropped region */
|
||||||
|
attentionX?: number | undefined;
|
||||||
|
attentionY?: number | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AvailableFormatInfo {
|
interface AvailableFormatInfo {
|
||||||
@ -1460,6 +1468,8 @@ declare namespace sharp {
|
|||||||
|
|
||||||
type TextAlign = 'left' | 'centre' | 'center' | 'right';
|
type TextAlign = 'left' | 'centre' | 'center' | 'right';
|
||||||
|
|
||||||
|
type TextWrap = 'word' | 'char' | 'charWord' | 'none';
|
||||||
|
|
||||||
type TileContainer = 'fs' | 'zip';
|
type TileContainer = 'fs' | 'zip';
|
||||||
|
|
||||||
type TileLayout = 'dz' | 'iiif' | 'iiif3' | 'zoomify' | 'google';
|
type TileLayout = 'dz' | 'iiif' | 'iiif3' | 'zoomify' | 'google';
|
||||||
|
@ -352,8 +352,10 @@ sharp(input)
|
|||||||
.gif({})
|
.gif({})
|
||||||
.gif({ loop: 0, delay: [], force: true })
|
.gif({ loop: 0, delay: [], force: true })
|
||||||
.gif({ delay: 30 })
|
.gif({ delay: 30 })
|
||||||
.gif({ reoptimise: true })
|
.gif({ reuse: true })
|
||||||
.gif({ reoptimize: false })
|
.gif({ reuse: false })
|
||||||
|
.gif({ progressive: true })
|
||||||
|
.gif({ progressive: false })
|
||||||
.toBuffer({ resolveWithObject: true })
|
.toBuffer({ resolveWithObject: true })
|
||||||
.then(({ data, info }) => {
|
.then(({ data, info }) => {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@ -589,6 +591,7 @@ sharp({
|
|||||||
rgba: true,
|
rgba: true,
|
||||||
justify: true,
|
justify: true,
|
||||||
spacing: 10,
|
spacing: 10,
|
||||||
|
wrap: 'charWord',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.png()
|
.png()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user