@lonik/oh-image 1.2.1 → 1.2.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/README.md CHANGED
@@ -1,30 +1,42 @@
1
- # react-components-starter
1
+ # Oh Image
2
2
 
3
- A starter for creating a React component library.
3
+ [![npm](https://img.shields.io/npm/v/@lonik/oh-image)](https://www.npmjs.com/package/@lonik/oh-image)
4
4
 
5
- ## Development
5
+ The missing `<Image />` component for Vite and React.
6
6
 
7
- - Install dependencies:
7
+ For full documentation, visit [docs](https://lukonik.github.io/oh-image).
8
+
9
+ ## Installation
8
10
 
9
11
  ```bash
10
- npm install
12
+ npm install @lonik/oh-image sharp --save
11
13
  ```
12
14
 
13
- - Run the playground:
15
+ ## Usage
14
16
 
15
- ```bash
16
- npm run play
17
- ```
17
+ ### 1. Register the Vite plugin
18
18
 
19
- - Run the unit tests:
19
+ ```ts
20
+ // vite.config.ts
21
+ import { defineConfig } from "vite";
22
+ import react from "@vitejs/plugin-react";
23
+ import { ohImage } from "@lonik/oh-image/plugin";
20
24
 
21
- ```bash
22
- npm run test
25
+ export default defineConfig({
26
+ plugins: [react(), ohImage()],
27
+ });
23
28
  ```
24
29
 
25
- - Build the library:
30
+ ### 2. Use the Image component
26
31
 
27
- ```bash
28
- npm run build
32
+ ```tsx
33
+ import { Image } from "@lonik/oh-image/react";
34
+ import heroImg from "./hero.jpg?oh";
35
+
36
+ function App() {
37
+ return <Image src={heroImg} alt="Hero" />;
38
+ }
29
39
  ```
30
- # tsdown-template
40
+ ## License
41
+
42
+ [MIT](./LICENSE)
package/dist/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Oh Image
2
+
3
+ [![npm](https://img.shields.io/npm/v/@lonik/oh-image)](https://www.npmjs.com/package/@lonik/oh-image)
4
+
5
+ The missing `<Image />` component for Vite and React.
6
+
7
+ For full documentation, visit [docs](https://lukonik.github.io/oh-image).
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @lonik/oh-image sharp --save
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### 1. Register the Vite plugin
18
+
19
+ ```ts
20
+ // vite.config.ts
21
+ import { defineConfig } from "vite";
22
+ import react from "@vitejs/plugin-react";
23
+ import { ohImage } from "@lonik/oh-image/plugin";
24
+
25
+ export default defineConfig({
26
+ plugins: [react(), ohImage()],
27
+ });
28
+ ```
29
+
30
+ ### 2. Use the Image component
31
+
32
+ ```tsx
33
+ import { Image } from "@lonik/oh-image/react";
34
+ import heroImg from "./hero.jpg?oh";
35
+
36
+ function App() {
37
+ return <Image src={heroImg} alt="Hero" />;
38
+ }
39
+ ```
40
+ ## License
41
+
42
+ [MIT](./LICENSE)
package/dist/plugin.d.ts CHANGED
@@ -14,8 +14,6 @@ interface ImageOptions {
14
14
  height?: number | null;
15
15
  /** Output format for the main image (e.g., 'webp', 'avif', 'png') */
16
16
  format?: keyof FormatEnum | null;
17
- /** Blur amount (true for default blur, or a number for sigma value) */
18
- blur?: number | boolean;
19
17
  /** Whether to generate a placeholder image for lazy loading */
20
18
  placeholder?: boolean;
21
19
  /** Breakpoints array - widths in pixels for responsive srcSet generation */
package/dist/plugin.js CHANGED
@@ -80,7 +80,7 @@ const DEFAULT_CONFIGS = {
80
80
  1920
81
81
  ],
82
82
  format: "webp",
83
- placeholder: false
83
+ placeholder: true
84
84
  };
85
85
  const PROCESS_KEY = "oh";
86
86
  const SUPPORTED_IMAGE_FORMATS = /\.(jpe?g|png|webp|avif|gif|svg)(\?.*)?$/i;
package/dist/react.d.ts CHANGED
@@ -21,7 +21,9 @@ declare module "*?oh" {
21
21
  //#endregion
22
22
  //#region src/react/types.d.ts
23
23
  type ImageSrcType = string | ImageSrc;
24
- interface ImageProps extends Partial<Pick<ImgHTMLAttributes<HTMLImageElement>, "alt" | "fetchPriority" | "decoding" | "loading" | "height" | "width" | "srcSet" | "className" | "sizes" | "style">> {
24
+ interface ImageProps extends Partial<Pick<ImgHTMLAttributes<HTMLImageElement>, "fetchPriority" | "decoding" | "loading" | "height" | "width" | "srcSet" | "className" | "sizes" | "style">> {
25
+ /** Alternative text for the image, required for accessibility. Use an empty string for decorative images. */
26
+ alt: string;
25
27
  /** Configures the Image component to load the image immediately. */
26
28
  asap?: boolean;
27
29
  /** */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lonik/oh-image",
3
3
  "type": "module",
4
- "version": "1.2.1",
4
+ "version": "1.2.3",
5
5
  "description": "A React component library for optimized image handling.",
6
6
  "author": "Luka Onikadze <lukonik@gmail.com>",
7
7
  "license": "MIT",
@@ -73,5 +73,14 @@
73
73
  "dependencies": {
74
74
  "p-limit": "^7.3.0",
75
75
  "query-string": "^9.3.1"
76
- }
76
+ },
77
+ "keywords": [
78
+ "react",
79
+ "reactjs",
80
+ "react-components",
81
+ "react-component-library",
82
+ "vite",
83
+ "vitejs",
84
+ "vite-plugin"
85
+ ]
77
86
  }