@lonik/oh-image 2.2.2 → 2.3.1

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.
@@ -1,13 +1,13 @@
1
1
  //#region src/loaders/base-loader-options.d.ts
2
2
  interface BaseLoaderOptions<T> {
3
3
  path?: string;
4
- transforms?: T;
4
+ transforms?: T & BaseLoaderTransforms;
5
5
  }
6
6
  interface BaseGlobalLoaderOptions<T> extends BaseLoaderOptions<T> {
7
- placeholder?: T;
7
+ placeholder?: T & BaseLoaderTransforms;
8
8
  }
9
9
  interface BaseLoaderTransforms {
10
10
  [futureKey: string]: any;
11
11
  }
12
12
  //#endregion
13
- export { BaseLoaderOptions as n, BaseLoaderTransforms as r, BaseGlobalLoaderOptions as t };
13
+ export { BaseLoaderOptions as n, BaseGlobalLoaderOptions as t };
@@ -1,9 +1,9 @@
1
- import { s as ImageLoaderOptions } from "./index-BXVRSiZA.js";
2
- import { n as BaseLoaderOptions, r as BaseLoaderTransforms, t as BaseGlobalLoaderOptions } from "./base-loader-options-C1EZVxmE.js";
1
+ import { s as ImageLoaderOptions } from "./index-5t1nN_1J.js";
2
+ import { n as BaseLoaderOptions, t as BaseGlobalLoaderOptions } from "./base-loader-options-BzrruYJ4.js";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/loaders/cloudflare/cloudflare-options.d.ts
6
- type CloudflareTransforms = BaseLoaderTransforms & Partial<{
6
+ type CloudflareTransforms = Partial<{
7
7
  anim: boolean;
8
8
  background: string;
9
9
  blur: number;
@@ -1,4 +1,4 @@
1
- import { t as loaderFactory } from "./loader-factory-C1301CZd.js";
1
+ import { t as loaderFactory } from "./loader-factory-JhrhUvkg.js";
2
2
 
3
3
  //#region src/loaders/cloudflare/cloudflare-loader.tsx
4
4
  const { useLoaderContext: useCloudflareContext, LoaderProvider: CloudflareLoaderProvider, useLoader: useCloudflareLoader } = loaderFactory({
@@ -1,6 +1,6 @@
1
- import { s as ImageLoaderOptions } from "./index-BXVRSiZA.js";
2
- import { n as BaseLoaderOptions, r as BaseLoaderTransforms, t as BaseGlobalLoaderOptions } from "./base-loader-options-C1EZVxmE.js";
3
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import { s as ImageLoaderOptions } from "./index-5t1nN_1J.js";
2
+ import { n as BaseLoaderOptions, t as BaseGlobalLoaderOptions } from "./base-loader-options-BzrruYJ4.js";
3
+ import * as react_jsx_runtime4 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/loaders/cloudinary/cloudinary-options.d.ts
6
6
  type BACKGROUND_MODE = "border" | "predominant" | "border_contrast" | "predominant_contrast" | "predominant_gradient" | "predominant_gradient_contrast" | "border_gradient" | "border_gradient_contrast";
@@ -9,7 +9,7 @@ type CROP_MODE = "auto" | "auto_pad" | "crop" | "fill" | "fill_pad" | "fit" | "i
9
9
  type COLOR_SPACE = "sRGB" | "tinysrgb" | "cmyk" | "no_cmyk" | "keep_cmyk" | "truecolor";
10
10
  type ART_FILTER = "al_dente" | "athena" | "audrey" | "aurora" | "daguerre" | "eucalyptus" | "fes" | "frost" | "hairspray" | "hokusai" | "incognito" | "linen" | "peacock" | "primavera" | "quartz" | "red_rock" | "refresh" | "sizzle" | "sonnet" | "ukulele" | "zorro";
11
11
  type FORMAT_TYPE = "3ds" | "ai" | "avif" | "bmp" | "bw" | "djvu" | "dng" | "eps" | "fbx" | "flif" | "gif" | "glb" | "gltf" | "heif" | "heic" | "ico" | "indd" | "jp2" | "jpg" | "jpeg" | "jxl" | "obj" | "pdf" | "ply" | "png" | "psd" | "raw" | "svg" | "tga" | "tif" | "tiff" | "u3ma" | "usdz" | "wdp" | "webp";
12
- type CloudinaryTransforms = BaseLoaderTransforms & Partial<{
12
+ type CloudinaryTransforms = Partial<{
13
13
  a?: number | ANGLE_MODE | string;
14
14
  mode?: string;
15
15
  ar?: string | number;
@@ -106,6 +106,6 @@ declare const useCloudinaryContext: () => CloudinaryGlobalOptions, CloudinaryLoa
106
106
  ...props
107
107
  }: {
108
108
  children: React.ReactNode;
109
- } & Partial<CloudinaryGlobalOptions>) => react_jsx_runtime0.JSX.Element, useCloudinaryLoader: (options?: CloudinaryGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
109
+ } & Partial<CloudinaryGlobalOptions>) => react_jsx_runtime4.JSX.Element, useCloudinaryLoader: (options?: CloudinaryGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
110
110
  //#endregion
111
111
  export { CloudinaryGlobalOptions, CloudinaryLoaderProvider, CloudinaryOptions, CloudinaryTransforms, useCloudinaryContext, useCloudinaryLoader };
@@ -1,4 +1,4 @@
1
- import { t as loaderFactory } from "./loader-factory-C1301CZd.js";
1
+ import { t as loaderFactory } from "./loader-factory-JhrhUvkg.js";
2
2
 
3
3
  //#region src/loaders/cloudinary/cloudinary-loader.tsx
4
4
  function customResolver(key, value) {
@@ -1,6 +1,6 @@
1
- import { s as ImageLoaderOptions } from "./index-BXVRSiZA.js";
2
- import { n as BaseLoaderOptions, r as BaseLoaderTransforms, t as BaseGlobalLoaderOptions } from "./base-loader-options-C1EZVxmE.js";
3
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import { s as ImageLoaderOptions } from "./index-5t1nN_1J.js";
2
+ import { n as BaseLoaderOptions, t as BaseGlobalLoaderOptions } from "./base-loader-options-BzrruYJ4.js";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/loaders/imgproxy/imgproxy-options.d.ts
6
6
  type ResizeType = "fit" | "fill" | "fill-down" | "force" | "auto";
@@ -100,7 +100,7 @@ interface PngOptions {
100
100
  quantize?: boolean;
101
101
  quantization_colors?: number;
102
102
  }
103
- type ImgproxyTransforms = BaseLoaderTransforms & Partial<{
103
+ type ImgproxyTransforms = Partial<{
104
104
  /**
105
105
  * Defines the resizing type, width, height, enlarge, and extend.
106
106
  * All arguments are optional and can be omitted to use their default values.
@@ -383,6 +383,6 @@ declare const useImgproxyContext: () => ImgproxyGlobalOptions, ImgproxyLoaderPro
383
383
  ...props
384
384
  }: {
385
385
  children: React.ReactNode;
386
- } & Partial<ImgproxyGlobalOptions>) => react_jsx_runtime1.JSX.Element, useImgproxyLoader: (options?: ImgproxyGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
386
+ } & Partial<ImgproxyGlobalOptions>) => react_jsx_runtime0.JSX.Element, useImgproxyLoader: (options?: ImgproxyGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
387
387
  //#endregion
388
388
  export { ImgproxyGlobalOptions, ImgproxyLoaderProvider, ImgproxyOptions, ImgproxyTransforms, useImgproxyContext, useImgproxyLoader };
package/dist/imgproxy.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as loaderFactory } from "./loader-factory-C1301CZd.js";
1
+ import { t as loaderFactory } from "./loader-factory-JhrhUvkg.js";
2
2
 
3
3
  //#region src/loaders/imgproxy/imgproxy-loader.tsx
4
4
  const { useLoaderContext: useImgproxyContext, LoaderProvider: ImgproxyLoaderProvider, useLoader: useImgproxyLoader } = loaderFactory({
@@ -1,5 +1,5 @@
1
1
  import { ImgHTMLAttributes } from "react";
2
- import * as react_jsx_runtime4 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/react/types.d.ts
5
5
  interface ImageLoaderOptions {
@@ -30,10 +30,10 @@ interface ImageProps extends Partial<Pick<ImgHTMLAttributes<HTMLImageElement>, "
30
30
  }
31
31
  //#endregion
32
32
  //#region src/react/image.d.ts
33
- declare function Image(props: ImageProps): react_jsx_runtime4.JSX.Element;
33
+ declare function Image(props: ImageProps): react_jsx_runtime2.JSX.Element;
34
34
  //#endregion
35
35
  //#region src/react/image-factory.d.ts
36
- declare function __imageFactory(defaultProps: any): (props: any) => react_jsx_runtime4.JSX.Element;
36
+ declare function __imageFactory(defaultProps: any): (props: any) => react_jsx_runtime2.JSX.Element;
37
37
  //#endregion
38
38
  //#region src/react/use-img-loaded.d.ts
39
39
  /**
@@ -75,6 +75,6 @@ declare function ImageProvider({
75
75
  ...props
76
76
  }: {
77
77
  children: React.ReactNode;
78
- } & Partial<ImageContextValue>): react_jsx_runtime4.JSX.Element;
78
+ } & Partial<ImageContextValue>): react_jsx_runtime2.JSX.Element;
79
79
  //#endregion
80
80
  export { Image as a, ImageProps as c, __imageFactory as i, useImageContext as n, ImageLoader as o, useImgLoaded as r, ImageLoaderOptions as s, ImageProvider as t };
@@ -0,0 +1,48 @@
1
+ import { s as ImageLoaderOptions } from "./index-5t1nN_1J.js";
2
+ import { n as BaseLoaderOptions, t as BaseGlobalLoaderOptions } from "./base-loader-options-BzrruYJ4.js";
3
+ import * as react_jsx_runtime5 from "react/jsx-runtime";
4
+
5
+ //#region src/loaders/kontent/kontent-options.d.ts
6
+ type KontentTransforms = Partial<{
7
+ /** Resize the width of the image in pixels. */
8
+ w?: number;
9
+ /** Resize the height of the image in pixels. */
10
+ h?: number;
11
+ /** Serve correctly sized images for devices that expose a device pixel ratio. */
12
+ dpr?: number;
13
+ /** Set how the image will fit within the size bounds provided. */
14
+ fit?: "clamp" | "clip" | "crop" | "facearea" | "fill" | "fillmax" | "max" | "min" | "scale";
15
+ /** * Select a sub-region of the source image to use for processing.
16
+ * Expected format: "x,y,width,height"
17
+ */
18
+ rect?: [number, number, number, number];
19
+ /** * Focal point crop: Choose the point of interest (x, y coordinates and zoom).
20
+ * fp-x and fp-y are typically 0.0 to 1.0.
21
+ */
22
+ "fp-x"?: number;
23
+ "fp-y"?: number;
24
+ "fp-z"?: number;
25
+ smart?: boolean | "face" | "edges" | "objects";
26
+ /** Fill transparent areas of the image with the specified color (e.g., 'FFF' or 'red'). */
27
+ bg?: string;
28
+ /** Specify the output format to convert the image to. */
29
+ fm?: "webp" | "jpg" | "png" | "gif" | "avif" | "jp2";
30
+ /** Optimize image compression (1-100) for lossy formats. */
31
+ q?: number;
32
+ /** Enable delivery of lossless images in supported formats. */
33
+ lossless?: boolean;
34
+ /** Automatic delivery of optimized formats like WebP based on browser support. */
35
+ auto?: "format" | "compress" | "enhance";
36
+ }>;
37
+ type KontentOptions = BaseLoaderOptions<KontentTransforms>;
38
+ type KontentGlobalOptions = BaseGlobalLoaderOptions<KontentTransforms>;
39
+ //#endregion
40
+ //#region src/loaders/kontent/kontent-loader.d.ts
41
+ declare const useKontentContext: () => KontentGlobalOptions, KontentLoaderProvider: ({
42
+ children,
43
+ ...props
44
+ }: {
45
+ children: React.ReactNode;
46
+ } & Partial<KontentGlobalOptions>) => react_jsx_runtime5.JSX.Element, useKontentLoader: (options?: KontentGlobalOptions | undefined) => (() => undefined) | ((imageOptions: ImageLoaderOptions) => string);
47
+ //#endregion
48
+ export { KontentGlobalOptions, KontentLoaderProvider, KontentOptions, KontentTransforms, useKontentContext, useKontentLoader };
@@ -0,0 +1,18 @@
1
+ import { t as loaderFactory } from "./loader-factory-JhrhUvkg.js";
2
+
3
+ //#region src/loaders/kontent/kontent-loader.tsx
4
+ const { useLoaderContext: useKontentContext, LoaderProvider: KontentLoaderProvider, useLoader: useKontentLoader } = loaderFactory({
5
+ transforms: { auto: "format" },
6
+ placeholder: {
7
+ q: 10,
8
+ auto: "format"
9
+ }
10
+ }, {
11
+ optionSeparator: "=",
12
+ paramSeparator: "&",
13
+ passBooleanValue: true,
14
+ customResolver: { rect: (key, value) => `${key}=${value.join(",")}` }
15
+ }, ({ path, params, imageOptions }) => `${path}/${imageOptions.src}?${params}`);
16
+
17
+ //#endregion
18
+ export { KontentLoaderProvider, useKontentContext, useKontentLoader };
package/dist/plugin.js CHANGED
@@ -342,8 +342,7 @@ function ohImage(options) {
342
342
  height: src.height,
343
343
  src: src.src,
344
344
  srcSet: src.srcSet,
345
- placeholder: src.placeholder,
346
- alt: ""
345
+ placeholder: src.placeholder
347
346
  })})
348
347
  `;
349
348
  } catch (err) {
package/dist/react.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as Image, c as ImageProps, i as __imageFactory, n as useImageContext, o as ImageLoader, r as useImgLoaded, s as ImageLoaderOptions, t as ImageProvider } from "./index-BXVRSiZA.js";
1
+ import { a as Image, c as ImageProps, i as __imageFactory, n as useImageContext, o as ImageLoader, r as useImgLoaded, s as ImageLoaderOptions, t as ImageProvider } from "./index-5t1nN_1J.js";
2
2
  export { Image, ImageLoader, ImageLoaderOptions, ImageProps, ImageProvider, __imageFactory, useImageContext, useImgLoaded };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lonik/oh-image",
3
3
  "type": "module",
4
- "version": "2.2.2",
4
+ "version": "2.3.1",
5
5
  "description": "A React component library for optimized image handling.",
6
6
  "author": "Luka Onikadze <lukonik@gmail.com>",
7
7
  "license": "MIT",
@@ -36,6 +36,10 @@
36
36
  "types": "./dist/imgproxy.d.ts",
37
37
  "default": "./dist/imgproxy.js"
38
38
  },
39
+ "./kontent": {
40
+ "types": "./dist/kontent.d.ts",
41
+ "default": "./dist/kontent.js"
42
+ },
39
43
  "./client": {
40
44
  "types": "./dist/client.d.ts"
41
45
  }