@lonik/oh-image 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.d.ts CHANGED
@@ -1,504 +1,2 @@
1
- import { ImgHTMLAttributes } from "react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
3
-
4
- //#region src/react/types.d.ts
5
- interface ImageLoaderOptions {
6
- src: string;
7
- width?: number | null | undefined;
8
- height?: number | null | undefined;
9
- }
10
- type ImageLoader = (options: ImageLoaderOptions) => string;
11
- type ImageSrcType = string | ImageSrc;
12
- interface ImageProps extends Partial<Pick<ImgHTMLAttributes<HTMLImageElement>, "fetchPriority" | "decoding" | "loading" | "srcSet" | "className" | "sizes" | "style">> {
13
- /** Alternative text for the image, required for accessibility. Use an empty string for decorative images. */
14
- alt: string;
15
- /** @deprecated Use `priority` instead. */
16
- asap?: boolean;
17
- /** Configures the Image component to load the image immediately. */
18
- priority?: boolean;
19
- /** */
20
- src: ImageSrcType;
21
- /** The URL of the placeholder image to display while loading. */
22
- placeholder?: string | undefined | ImageLoader | null;
23
- /**
24
- * Sets the image to "fill mode", which eliminates the height/width requirement and adds
25
- * styles such that the image fills its containing element.
26
- */
27
- fill?: boolean;
28
- loader?: ImageLoader | null;
29
- width?: number | undefined;
30
- height?: number | undefined;
31
- breakpoints?: number[];
32
- }
33
- //#endregion
34
- //#region src/react/image.d.ts
35
- declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
36
- //#endregion
37
- //#region src/react/use-img-loaded.d.ts
38
- /**
39
- * A hook that tracks whether an image element has finished loading.
40
- *
41
- * Handles all edge cases:
42
- * - Image already cached/complete on mount
43
- * - Normal load via event listener
44
- * - Errors (resets to `false`)
45
- * - `src` changes (resets to `false` until the new source loads)
46
- * - Element unmount / ref set to `null`
47
- *
48
- * @returns `[ref, isLoaded]` — attach the ref callback to an `<img>` element.
49
- *
50
- * @example
51
- * ```tsx
52
- * function Avatar({ src }: { src: string }) {
53
- * const [imgRef, isLoaded] = useImgLoaded(src);
54
- * return (
55
- * <img
56
- * ref={imgRef}
57
- * src={src}
58
- * style={{ opacity: isLoaded ? 1 : 0 }}
59
- * />
60
- * );
61
- * }
62
- * ```
63
- */
64
- declare function useImgLoaded(src: string | undefined): [(img: HTMLImageElement | null) => void, boolean];
65
- //#endregion
66
- //#region src/react/image-context.d.ts
67
- interface ImageContextValue extends Pick<ImageProps, "loading"> {
68
- breakpoints: number[];
69
- loader: ImageLoader | null;
70
- }
71
- declare function useImageContext(): ImageContextValue;
72
- declare function ImageProvider({
73
- children,
74
- ...props
75
- }: {
76
- children: React.ReactNode;
77
- } & Partial<ImageContextValue>): react_jsx_runtime0.JSX.Element;
78
- //#endregion
79
- //#region src/react/loaders/base-loader-options.d.ts
80
- interface BaseLoaderOptions<T> {
81
- path?: string;
82
- transforms?: T;
83
- /** @deprecated Use `transforms` instead. */
84
- params?: any;
85
- }
86
- interface BaseGlobalLoaderOptions<T> extends BaseLoaderOptions<T> {
87
- placeholderTransforms?: T;
88
- }
89
- //#endregion
90
- //#region src/react/loaders/imgproxy/imgproxy-options.d.ts
91
- type ResizeType = "fit" | "fill" | "fill-down" | "force" | "auto";
92
- type ResizeAlgorithm = "nearest" | "linear" | "cubic" | "lanczos2" | "lanczos3";
93
- type GravityType = "no" | "so" | "ea" | "we" | "noea" | "nowe" | "soea" | "sowe" | "ce";
94
- interface ResizeOptions {
95
- resizing_type?: ResizeType;
96
- width?: number;
97
- height?: number;
98
- enlarge?: boolean;
99
- extend?: boolean;
100
- }
101
- interface SizeOptions {
102
- width?: number;
103
- height?: number;
104
- enlarge?: boolean;
105
- extend?: boolean;
106
- }
107
- interface ExtendOptions {
108
- extend?: boolean;
109
- gravity?: GravityType;
110
- }
111
- interface GravityOptions {
112
- type: GravityType;
113
- x_offset?: number;
114
- y_offset?: number;
115
- }
116
- interface CropOptions {
117
- width: number;
118
- height: number;
119
- gravity?: GravityType;
120
- }
121
- interface TrimOptions {
122
- threshold: number;
123
- color?: string;
124
- equal_hor?: boolean;
125
- equal_ver?: boolean;
126
- }
127
- interface PaddingOptions {
128
- top?: number;
129
- right?: number;
130
- bottom?: number;
131
- left?: number;
132
- }
133
- interface BackgroundOptions {
134
- r: number;
135
- g: number;
136
- b: number;
137
- }
138
- interface AdjustOptions {
139
- brightness?: number;
140
- contrast?: number;
141
- saturation?: number;
142
- }
143
- interface BlurDetectionsOptions {
144
- sigma: number;
145
- class_names: string[];
146
- }
147
- interface DrawDetectionsOptions {
148
- draw: boolean;
149
- class_names: string[];
150
- }
151
- interface WatermarkOptions {
152
- opacity: number;
153
- position?: GravityType | "re";
154
- x_offset?: number;
155
- y_offset?: number;
156
- scale?: number;
157
- }
158
- interface WatermarkSizeOptions {
159
- width: number;
160
- height: number;
161
- }
162
- interface UnsharpeningOptions {
163
- mode?: string;
164
- weight?: number;
165
- dividor?: number;
166
- }
167
- interface AutoqualityOptions {
168
- method?: string;
169
- target?: number;
170
- min_quality?: number;
171
- max_quality?: number;
172
- allowed_error?: number;
173
- }
174
- interface JpegOptions {
175
- progressive?: boolean;
176
- no_subsample?: boolean;
177
- trellis_quant?: boolean;
178
- overshoot_deringing?: boolean;
179
- optimize_scans?: boolean;
180
- quant_table?: number;
181
- }
182
- interface PngOptions {
183
- interlaced?: boolean;
184
- quantize?: boolean;
185
- quantization_colors?: number;
186
- }
187
- interface ImgproxyTransforms {
188
- /**
189
- * Defines the resizing type, width, height, enlarge, and extend.
190
- * All arguments are optional and can be omitted to use their default values.
191
- */
192
- resize?: ResizeOptions;
193
- /**
194
- * Defines the width, height, enlarge, and extend.
195
- * All arguments are optional and can be omitted to use their default values.
196
- */
197
- size?: SizeOptions;
198
- /**
199
- * Defines how imgproxy will resize the source image.
200
- * Default: fit
201
- */
202
- resizing_type?: ResizeType;
203
- /**
204
- * Defines the algorithm that imgproxy will use for resizing.
205
- * Default: lanczos3
206
- */
207
- resizing_algorithm?: ResizeAlgorithm;
208
- /**
209
- * Defines the width of the resulting image.
210
- * Default: 0
211
- */
212
- width?: number;
213
- /**
214
- * Defines the height of the resulting image.
215
- * Default: 0
216
- */
217
- height?: number;
218
- /**
219
- * Defines the minimum width of the resulting image.
220
- * Default: 0
221
- */
222
- "min-width"?: number;
223
- /**
224
- * Defines the minimum height of the resulting image.
225
- * Default: 0
226
- */
227
- "min-height"?: number;
228
- /**
229
- * When set, imgproxy will multiply the image dimensions according to these factors.
230
- * Default: 1
231
- */
232
- zoom?: number | {
233
- x: number;
234
- y: number;
235
- };
236
- /**
237
- * When set, imgproxy will multiply the image dimensions according to this factor for HiDPI (Retina) devices.
238
- * Default: 1
239
- */
240
- dpr?: number;
241
- /**
242
- * When set to true, imgproxy will enlarge the image if it is smaller than the given size.
243
- * Default: false
244
- */
245
- enlarge?: boolean;
246
- /**
247
- * When set to true, imgproxy will extend the image if it is smaller than the given size.
248
- * Can also specify gravity.
249
- * Default: false:ce:0:0
250
- */
251
- extend?: boolean | ExtendOptions;
252
- /**
253
- * When imgproxy needs to cut some parts of the image, it is guided by the gravity option.
254
- * Default: ce:0:0
255
- */
256
- gravity?: GravityOptions;
257
- /**
258
- * Defines an area of the image to be processed (crop before resize).
259
- */
260
- crop?: CropOptions;
261
- /**
262
- * Removes surrounding background.
263
- */
264
- trim?: TrimOptions;
265
- /**
266
- * Defines padding size.
267
- */
268
- padding?: PaddingOptions;
269
- /**
270
- * When set to true, imgproxy will automatically rotate images based on the EXIF Orientation parameter.
271
- */
272
- auto_rotate?: boolean;
273
- /**
274
- * Rotates the image on the specified angle.
275
- * Default: 0
276
- */
277
- rotate?: number;
278
- /**
279
- * When set, imgproxy will fill the resulting image background with the specified color.
280
- * Default: disabled
281
- */
282
- background?: string | BackgroundOptions;
283
- /**
284
- * Adds an alpha channel to background.
285
- * Default: 1
286
- */
287
- background_alpha?: number;
288
- /**
289
- * Defines the brightness, contrast, and saturation.
290
- */
291
- adjust?: AdjustOptions;
292
- /**
293
- * When set, imgproxy will adjust brightness of the resulting image.
294
- * Default: 0
295
- */
296
- brightness?: number;
297
- /**
298
- * When set, imgproxy will adjust the contrast of the resulting image.
299
- * Default: 1
300
- */
301
- contrast?: number;
302
- /**
303
- * When set, imgproxy will adjust saturation of the resulting image.
304
- * Default: 1
305
- */
306
- saturation?: number;
307
- /**
308
- * When set, imgproxy will apply a gaussian blur filter to the resulting image.
309
- * Default: disabled
310
- */
311
- blur?: number;
312
- /**
313
- * When set, imgproxy will apply the sharpen filter to the resulting image.
314
- * Default: disabled
315
- */
316
- sharpen?: number;
317
- /**
318
- * When set, imgproxy will apply the pixelate filter to the resulting image.
319
- * Default: disabled
320
- */
321
- pixelate?: number;
322
- /**
323
- * Allows redefining unsharpening options.
324
- */
325
- unsharpening?: UnsharpeningOptions;
326
- /**
327
- * imgproxy detects objects of the provided classes and blurs them.
328
- */
329
- blur_detections?: BlurDetectionsOptions;
330
- /**
331
- * When draw is set to true, imgproxy detects objects of the provided classes and draws their bounding boxes.
332
- */
333
- draw_detections?: DrawDetectionsOptions;
334
- /**
335
- * Places a watermark on the processed image.
336
- * Default: disabled
337
- */
338
- watermark?: WatermarkOptions;
339
- /**
340
- * When set, imgproxy will use the image from the specified URL as a watermark.
341
- * Default: blank
342
- */
343
- watermark_url?: string;
344
- /**
345
- * When set, imgproxy will generate an image from the provided text and use it as a watermark.
346
- * Default: blank
347
- */
348
- watermark_text?: string;
349
- /**
350
- * Defines the desired width and height of the watermark.
351
- * Default: 0:0
352
- */
353
- watermark_size?: WatermarkSizeOptions;
354
- /**
355
- * When set, imgproxy will prepend a <style> node with the provided content to the <svg> node.
356
- * Default: blank
357
- */
358
- style?: string;
359
- /**
360
- * When set to true, imgproxy will strip the metadata (EXIF, IPTC, etc.) on JPEG and WebP output images.
361
- */
362
- strip_metadata?: boolean;
363
- /**
364
- * When set to true, imgproxy will not remove copyright info while stripping metadata.
365
- */
366
- keep_copyright?: boolean;
367
- /**
368
- * When set to true, imgproxy will transform the embedded color profile (ICC) to sRGB and remove it from the image.
369
- */
370
- strip_color_profile?: boolean;
371
- /**
372
- * When set to true and the source image has an embedded thumbnail, imgproxy will always use the embedded thumbnail.
373
- */
374
- enforce_thumbnail?: boolean;
375
- /**
376
- * When set to true, imgproxy will return attachment in the Content-Disposition header.
377
- */
378
- return_attachment?: boolean;
379
- /**
380
- * Redefines quality of the resulting image, as a percentage.
381
- * Default: 0
382
- */
383
- quality?: number;
384
- /**
385
- * Adds or redefines IMGPROXY_FORMAT_QUALITY values.
386
- */
387
- format_quality?: Record<string, number>;
388
- /**
389
- * Redefines autoquality settings.
390
- */
391
- autoquality?: AutoqualityOptions;
392
- /**
393
- * When set, imgproxy automatically degrades the quality of the image until the image size is under the specified amount of bytes.
394
- * Default: 0
395
- */
396
- max_bytes?: number;
397
- /**
398
- * Allows redefining JPEG saving options.
399
- */
400
- jpeg_options?: JpegOptions;
401
- /**
402
- * Allows redefining PNG saving options.
403
- */
404
- png_options?: PngOptions;
405
- /**
406
- * Specifies the resulting image format.
407
- * Default: jpg
408
- */
409
- format?: string;
410
- /**
411
- * When a source image supports pagination or animation, this option allows specifying the page to use it on.
412
- * Default: 0
413
- */
414
- page?: number;
415
- /**
416
- * Allows redefining IMGPROXY_VIDEO_THUMBNAIL_SECOND config.
417
- */
418
- video_thumbnail_second?: number;
419
- /**
420
- * You can use a custom fallback image by specifying its URL.
421
- * Default: blank
422
- */
423
- fallback_image_url?: string;
424
- /**
425
- * When set, imgproxy will skip the processing of the listed formats.
426
- * Default: empty
427
- */
428
- skip_processing?: string[];
429
- /**
430
- * Cache buster doesn't affect image processing but its changing allows for bypassing the CDN, proxy server and browser cache.
431
- * Default: empty
432
- */
433
- cachebuster?: string;
434
- /**
435
- * When set, imgproxy will check the provided unix timestamp and return 404 when expired.
436
- * Default: empty
437
- */
438
- expires?: number;
439
- /**
440
- * Defines a filename for the Content-Disposition header.
441
- * Default: empty
442
- */
443
- filename?: string;
444
- /**
445
- * Defines a list of presets to be used by imgproxy.
446
- * Default: empty
447
- */
448
- preset?: string[];
449
- }
450
- type ImgproxyOptions = BaseLoaderOptions<ImgproxyTransforms>;
451
- type ImgproxyGlobalOptions = BaseGlobalLoaderOptions<ImgproxyTransforms>;
452
- //#endregion
453
- //#region src/react/loaders/imgproxy/use-imgproxy-loader.d.ts
454
- declare function useImgproxyLoader(options?: ImgproxyOptions): (imageOptions: ImageLoaderOptions) => string;
455
- //#endregion
456
- //#region src/react/loaders/imgproxy/imgproxy-context.d.ts
457
- declare function useImgproxyContext(): ImgproxyGlobalOptions;
458
- declare function ImgproxyLoaderProvider({
459
- children,
460
- ...props
461
- }: {
462
- children: React.ReactNode;
463
- } & Partial<ImgproxyOptions>): react_jsx_runtime0.JSX.Element;
464
- //#endregion
465
- //#region src/react/loaders/imgproxy/use-imgproxy-placeholder.d.ts
466
- declare function useImgproxyPlaceholder(options?: ImgproxyOptions): (imageOptions: ImageLoaderOptions) => string;
467
- //#endregion
468
- //#region src/react/loaders/cloudflare-loader.d.ts
469
- interface CloudflareLoaderOptions {
470
- path: string;
471
- placeholder: boolean;
472
- format: string;
473
- params?: Record<string, string>;
474
- placeholderParams?: Record<string, string>;
475
- breakpoints?: number[];
476
- }
477
- declare function useCloudflareContext(): CloudflareLoaderOptions;
478
- declare function CloudflareLoaderProvider({
479
- children,
480
- ...props
481
- }: {
482
- children: React.ReactNode;
483
- } & Partial<CloudflareLoaderOptions>): react_jsx_runtime0.JSX.Element;
484
- declare function useCloudflareLoader(options?: Partial<CloudflareLoaderOptions>): ImageLoader;
485
- //#endregion
486
- //#region src/react/loaders/cloudinary-loader.d.ts
487
- interface CloudinaryLoaderOptions {
488
- path: string;
489
- placeholder: boolean;
490
- format: string;
491
- params?: Record<string, string>;
492
- placeholderParams?: Record<string, string>;
493
- breakpoints?: number[];
494
- }
495
- declare function useCloudinaryContext(): CloudinaryLoaderOptions;
496
- declare function CloudinaryLoaderProvider({
497
- children,
498
- ...props
499
- }: {
500
- children: React.ReactNode;
501
- } & Partial<CloudinaryLoaderOptions>): react_jsx_runtime0.JSX.Element;
502
- declare function useCloudinaryLoader(options?: Partial<CloudinaryLoaderOptions>): ImageLoader;
503
- //#endregion
504
- export { type CloudflareLoaderOptions, CloudflareLoaderProvider, type CloudinaryLoaderOptions, CloudinaryLoaderProvider, Image, type ImageLoader, type ImageLoaderOptions, type ImageProps, ImageProvider, type ImageSrcType, type ImgproxyGlobalOptions, ImgproxyLoaderProvider, type ImgproxyOptions, type ImgproxyTransforms, useCloudflareContext, useCloudflareLoader, useCloudinaryContext, useCloudinaryLoader, useImageContext, useImgLoaded, useImgproxyContext, useImgproxyLoader, useImgproxyPlaceholder };
1
+ import { a as ImageLoader, c as ImageSrcType, i as Image, n as useImageContext, o as ImageLoaderOptions, r as useImgLoaded, s as ImageProps, t as ImageProvider } from "./index-BLvefiKI.js";
2
+ export { Image, ImageLoader, ImageLoaderOptions, ImageProps, ImageProvider, ImageSrcType, useImageContext, useImgLoaded };