@lonik/oh-image 2.7.0 → 2.9.0
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/cloudflare.d.ts +3 -3
- package/dist/cloudinary.d.ts +2 -2
- package/dist/contentful.d.ts +3 -3
- package/dist/imgproxy.d.ts +3 -3
- package/dist/{index-C-1t5-gk.d.ts → index-CP-wkNzk.d.ts} +4 -4
- package/dist/kontent.d.ts +3 -3
- package/dist/netlify.d.ts +3 -3
- package/dist/plugin.d.ts +4 -2
- package/dist/plugin.js +14 -6
- package/dist/react.d.ts +1 -1
- package/dist/wordpress.d.ts +3 -3
- package/package.json +1 -1
package/dist/cloudflare.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ImageLoaderOptions } from "./types-BEgZ3W30.js";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-CP-wkNzk.js";
|
|
3
3
|
import { n as BaseLoaderOptions, t as BaseGlobalLoaderOptions } from "./base-loader-options-DCLkYppY.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime7 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/loaders/cloudflare/cloudflare-options.d.ts
|
|
7
7
|
type CloudflareTransforms = Partial<{
|
|
@@ -40,6 +40,6 @@ declare const useCloudflareContext: () => CloudflareGlobalOptions, CloudflareLoa
|
|
|
40
40
|
...props
|
|
41
41
|
}: {
|
|
42
42
|
children: React.ReactNode;
|
|
43
|
-
} & Partial<CloudflareGlobalOptions>) =>
|
|
43
|
+
} & Partial<CloudflareGlobalOptions>) => react_jsx_runtime7.JSX.Element, useCloudflareLoader: (options?: CloudflareGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
|
|
44
44
|
//#endregion
|
|
45
45
|
export { CloudflareGlobalOptions, CloudflareLoaderProvider, CloudflareOptions, CloudflareTransforms, useCloudflareContext, useCloudflareLoader };
|
package/dist/cloudinary.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ImageLoaderOptions } from "./types-BEgZ3W30.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
import { Cloudinary, CloudinaryImage } from "@cloudinary/url-gen";
|
|
4
4
|
|
|
5
5
|
//#region src/loaders/cloudinary/cloudinary-options.d.ts
|
|
@@ -34,7 +34,7 @@ declare function CloudinaryLoaderProvider({
|
|
|
34
34
|
children: React.ReactNode;
|
|
35
35
|
transforms?: CloudinaryTransforms;
|
|
36
36
|
placeholder?: CloudinaryTransforms;
|
|
37
|
-
}):
|
|
37
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
38
38
|
declare function useCloudinaryLoader(options?: CloudinaryLoaderHookOptions | CloudinaryTransforms): (imageOptions: ImageLoaderOptions) => string;
|
|
39
39
|
declare const useCloudinaryContext: () => CloudinaryLoaderContext;
|
|
40
40
|
//#endregion
|
package/dist/contentful.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ImageLoaderOptions } from "./types-BEgZ3W30.js";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-CP-wkNzk.js";
|
|
3
3
|
import { n as BaseLoaderOptions, t as BaseGlobalLoaderOptions } from "./base-loader-options-DCLkYppY.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/loaders/contentful/contentful-options.d.ts
|
|
7
7
|
type ContentfulTransforms = Partial<{
|
|
@@ -39,6 +39,6 @@ declare const useContentfulContext: () => ContentfulGlobalOptions, ContentfulLoa
|
|
|
39
39
|
...props
|
|
40
40
|
}: {
|
|
41
41
|
children: React.ReactNode;
|
|
42
|
-
} & Partial<ContentfulGlobalOptions>) =>
|
|
42
|
+
} & Partial<ContentfulGlobalOptions>) => react_jsx_runtime3.JSX.Element, useContentfulLoader: (options?: ContentfulGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
|
|
43
43
|
//#endregion
|
|
44
44
|
export { ContentfulGlobalOptions, ContentfulLoaderProvider, ContentfulOptions, ContentfulTransforms, useContentfulContext, useContentfulLoader };
|
package/dist/imgproxy.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ImageLoaderOptions } from "./types-BEgZ3W30.js";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-CP-wkNzk.js";
|
|
3
3
|
import { n as BaseLoaderOptions, t as BaseGlobalLoaderOptions } from "./base-loader-options-DCLkYppY.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime6 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/loaders/imgproxy/imgproxy-options.d.ts
|
|
7
7
|
type ResizeType = "fit" | "fill" | "fill-down" | "force" | "auto";
|
|
@@ -384,6 +384,6 @@ declare const useImgproxyContext: () => ImgproxyGlobalOptions, ImgproxyLoaderPro
|
|
|
384
384
|
...props
|
|
385
385
|
}: {
|
|
386
386
|
children: React.ReactNode;
|
|
387
|
-
} & Partial<ImgproxyGlobalOptions>) =>
|
|
387
|
+
} & Partial<ImgproxyGlobalOptions>) => react_jsx_runtime6.JSX.Element, useImgproxyLoader: (options?: ImgproxyGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
|
|
388
388
|
//#endregion
|
|
389
389
|
export { ImgproxyGlobalOptions, ImgproxyLoaderProvider, ImgproxyOptions, ImgproxyTransforms, useImgproxyContext, useImgproxyLoader };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as ImageProps, t as ImageLoader } from "./types-BEgZ3W30.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/react/image.d.ts
|
|
5
|
-
declare function Image(props: ImageProps):
|
|
5
|
+
declare function Image(props: ImageProps): react_jsx_runtime1.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/react/image-factory.d.ts
|
|
8
|
-
declare function __imageFactory(defaultProps: any): (props: any) =>
|
|
8
|
+
declare function __imageFactory(defaultProps: any): (props: any) => react_jsx_runtime1.JSX.Element;
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/react/use-img-loaded.d.ts
|
|
11
11
|
/**
|
|
@@ -47,6 +47,6 @@ declare function ImageProvider({
|
|
|
47
47
|
...props
|
|
48
48
|
}: {
|
|
49
49
|
children: React.ReactNode;
|
|
50
|
-
} & Partial<ImageContextValue>):
|
|
50
|
+
} & Partial<ImageContextValue>): react_jsx_runtime1.JSX.Element;
|
|
51
51
|
//#endregion
|
|
52
52
|
export { Image as a, __imageFactory as i, useImageContext as n, useImgLoaded as r, ImageProvider as t };
|
package/dist/kontent.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ImageLoaderOptions } from "./types-BEgZ3W30.js";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-CP-wkNzk.js";
|
|
3
3
|
import { n as BaseLoaderOptions, t as BaseGlobalLoaderOptions } from "./base-loader-options-DCLkYppY.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime8 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/loaders/kontent/kontent-options.d.ts
|
|
7
7
|
type KontentTransforms = Partial<{
|
|
@@ -44,6 +44,6 @@ declare const useKontentContext: () => KontentGlobalOptions, KontentLoaderProvid
|
|
|
44
44
|
...props
|
|
45
45
|
}: {
|
|
46
46
|
children: React.ReactNode;
|
|
47
|
-
} & Partial<KontentGlobalOptions>) =>
|
|
47
|
+
} & Partial<KontentGlobalOptions>) => react_jsx_runtime8.JSX.Element, useKontentLoader: (options?: KontentGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
|
|
48
48
|
//#endregion
|
|
49
49
|
export { KontentGlobalOptions, KontentLoaderProvider, KontentOptions, KontentTransforms, useKontentContext, useKontentLoader };
|
package/dist/netlify.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ImageLoaderOptions } from "./types-BEgZ3W30.js";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-CP-wkNzk.js";
|
|
3
3
|
import { n as BaseLoaderOptions, t as BaseGlobalLoaderOptions } from "./base-loader-options-DCLkYppY.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime4 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/loaders/netlify/netlify-options.d.ts
|
|
7
7
|
type NetlifyTransforms = Partial<{
|
|
@@ -21,6 +21,6 @@ declare const useNetlifyContext: () => NetlifyGlobalOptions, NetlifyLoaderProvid
|
|
|
21
21
|
...props
|
|
22
22
|
}: {
|
|
23
23
|
children: React.ReactNode;
|
|
24
|
-
} & Partial<NetlifyGlobalOptions>) =>
|
|
24
|
+
} & Partial<NetlifyGlobalOptions>) => react_jsx_runtime4.JSX.Element, useNetlifyLoader: (options?: NetlifyGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
|
|
25
25
|
//#endregion
|
|
26
26
|
export { NetlifyGlobalOptions, NetlifyLoaderProvider, NetlifyOptions, NetlifyTransforms, useNetlifyContext, useNetlifyLoader };
|
package/dist/plugin.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { FormatEnum } from "sharp";
|
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/types.d.ts
|
|
5
|
-
interface PluginConfig extends Required<Pick<ImageOptions, "placeholder" | "breakpoints" | "format">> {
|
|
5
|
+
interface PluginConfig extends Required<Pick<ImageOptions, "placeholder" | "breakpoints" | "format" | "quality">> {
|
|
6
6
|
/** Directory name where processed images will be output during build */
|
|
7
7
|
distDir: string;
|
|
8
8
|
}
|
|
@@ -16,7 +16,7 @@ interface ImageOptions {
|
|
|
16
16
|
/** Whether to generate a placeholder image for lazy loading */
|
|
17
17
|
placeholder?: boolean;
|
|
18
18
|
/** Breakpoints array - widths in pixels for responsive srcSet generation */
|
|
19
|
-
breakpoints?: number[];
|
|
19
|
+
breakpoints?: number[] | null;
|
|
20
20
|
/** Blur the image */
|
|
21
21
|
blur?: number | null;
|
|
22
22
|
/** Flip the image vertically */
|
|
@@ -37,6 +37,8 @@ interface ImageOptions {
|
|
|
37
37
|
normalize?: boolean | null;
|
|
38
38
|
/** Apply threshold */
|
|
39
39
|
threshold?: number | null;
|
|
40
|
+
/** Apply quality */
|
|
41
|
+
quality?: number | null;
|
|
40
42
|
}
|
|
41
43
|
//#endregion
|
|
42
44
|
//#region src/plugin/plugin.d.ts
|
package/dist/plugin.js
CHANGED
|
@@ -18,6 +18,10 @@ function queryToOptions(processKey, uri) {
|
|
|
18
18
|
parseNumbers: true,
|
|
19
19
|
arrayFormat: "comma",
|
|
20
20
|
types: {
|
|
21
|
+
width: "number",
|
|
22
|
+
height: "number",
|
|
23
|
+
format: "string",
|
|
24
|
+
placeholder: "boolean",
|
|
21
25
|
breakpoints: "number[]",
|
|
22
26
|
blur: "number",
|
|
23
27
|
flip: "boolean",
|
|
@@ -28,7 +32,8 @@ function queryToOptions(processKey, uri) {
|
|
|
28
32
|
gamma: "number",
|
|
29
33
|
negate: "boolean",
|
|
30
34
|
normalize: "boolean",
|
|
31
|
-
threshold: "number"
|
|
35
|
+
threshold: "number",
|
|
36
|
+
quality: "number"
|
|
32
37
|
}
|
|
33
38
|
});
|
|
34
39
|
if (processKey in parsed) return {
|
|
@@ -39,7 +44,7 @@ function queryToOptions(processKey, uri) {
|
|
|
39
44
|
};
|
|
40
45
|
else return {
|
|
41
46
|
shouldProcess: false,
|
|
42
|
-
path,
|
|
47
|
+
path: "",
|
|
43
48
|
queryString: query
|
|
44
49
|
};
|
|
45
50
|
}
|
|
@@ -121,7 +126,8 @@ function createImageEntries() {
|
|
|
121
126
|
gamma: entry.gamma,
|
|
122
127
|
negate: entry.negate,
|
|
123
128
|
normalize: entry.normalize,
|
|
124
|
-
threshold: entry.threshold
|
|
129
|
+
threshold: entry.threshold,
|
|
130
|
+
quality: entry.quality
|
|
125
131
|
};
|
|
126
132
|
this.set(identifier, mainEntry);
|
|
127
133
|
},
|
|
@@ -167,7 +173,7 @@ async function processImage(path, options) {
|
|
|
167
173
|
width: options.width ?? void 0,
|
|
168
174
|
height: options.height ?? void 0
|
|
169
175
|
});
|
|
170
|
-
if (options.format) processed = processed.toFormat(options.format);
|
|
176
|
+
if (options.format) processed = processed.toFormat(options.format, { quality: options.quality ?? void 0 });
|
|
171
177
|
if (options.blur) processed = processed.blur(options.blur);
|
|
172
178
|
if (options.flip) processed = processed.flip();
|
|
173
179
|
if (options.flop) processed = processed.flop();
|
|
@@ -284,7 +290,8 @@ function ohImage(options) {
|
|
|
284
290
|
gamma: mergedOptions.gamma,
|
|
285
291
|
negate: mergedOptions.negate,
|
|
286
292
|
normalize: mergedOptions.normalize,
|
|
287
|
-
threshold: mergedOptions.threshold
|
|
293
|
+
threshold: mergedOptions.threshold,
|
|
294
|
+
quality: mergedOptions.quality
|
|
288
295
|
});
|
|
289
296
|
const src = {
|
|
290
297
|
width: metadata.width,
|
|
@@ -328,7 +335,8 @@ function ohImage(options) {
|
|
|
328
335
|
gamma: mergedOptions.gamma,
|
|
329
336
|
negate: mergedOptions.negate,
|
|
330
337
|
normalize: mergedOptions.normalize,
|
|
331
|
-
threshold: mergedOptions.threshold
|
|
338
|
+
threshold: mergedOptions.threshold,
|
|
339
|
+
quality: mergedOptions.quality
|
|
332
340
|
});
|
|
333
341
|
srcSets.push(`${srcSetIdentifier} ${breakpoint}w`);
|
|
334
342
|
}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as ImageLoaderOptions, r as ImageProps, t as ImageLoader } from "./types-BEgZ3W30.js";
|
|
2
|
-
import { a as Image, i as __imageFactory, n as useImageContext, r as useImgLoaded, t as ImageProvider } from "./index-
|
|
2
|
+
import { a as Image, i as __imageFactory, n as useImageContext, r as useImgLoaded, t as ImageProvider } from "./index-CP-wkNzk.js";
|
|
3
3
|
export { Image, ImageLoader, ImageLoaderOptions, ImageProps, ImageProvider, __imageFactory, useImageContext, useImgLoaded };
|
package/dist/wordpress.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ImageLoaderOptions } from "./types-BEgZ3W30.js";
|
|
2
|
-
import "./index-
|
|
2
|
+
import "./index-CP-wkNzk.js";
|
|
3
3
|
import { n as BaseLoaderOptions, t as BaseGlobalLoaderOptions } from "./base-loader-options-DCLkYppY.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/loaders/wordpress/wordpress-options.d.ts
|
|
7
7
|
type WordpressTransforms = Partial<{
|
|
@@ -31,6 +31,6 @@ declare const useWordpressContext: () => WordpressGlobalOptions, WordpressLoader
|
|
|
31
31
|
...props
|
|
32
32
|
}: {
|
|
33
33
|
children: React.ReactNode;
|
|
34
|
-
} & Partial<WordpressGlobalOptions>) =>
|
|
34
|
+
} & Partial<WordpressGlobalOptions>) => react_jsx_runtime5.JSX.Element, useWordpressLoader: (options?: WordpressGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
|
|
35
35
|
//#endregion
|
|
36
36
|
export { WordpressGlobalOptions, WordpressLoaderProvider, WordpressOptions, WordpressTransforms, useWordpressContext, useWordpressLoader };
|
package/package.json
CHANGED