@lonik/oh-image 1.2.1 → 1.2.2

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,40 @@
1
- # react-components-starter
1
+ # Oh Image
2
2
 
3
- A starter for creating a React component library.
3
+ The missing `<Image />` component for Vite and React.
4
4
 
5
- ## Development
5
+ For full documentation, visit [docs](https://lukonik.github.io/oh-image).
6
6
 
7
- - Install dependencies:
7
+ ## Installation
8
8
 
9
9
  ```bash
10
- npm install
10
+ npm install @lonik/oh-image sharp --save
11
11
  ```
12
12
 
13
- - Run the playground:
13
+ ## Usage
14
14
 
15
- ```bash
16
- npm run play
17
- ```
15
+ ### 1. Register the Vite plugin
18
16
 
19
- - Run the unit tests:
17
+ ```ts
18
+ // vite.config.ts
19
+ import { defineConfig } from "vite";
20
+ import react from "@vitejs/plugin-react";
21
+ import { ohImage } from "@lonik/oh-image/plugin";
20
22
 
21
- ```bash
22
- npm run test
23
+ export default defineConfig({
24
+ plugins: [react(), ohImage()],
25
+ });
23
26
  ```
24
27
 
25
- - Build the library:
28
+ ### 2. Use the Image component
26
29
 
27
- ```bash
28
- npm run build
30
+ ```tsx
31
+ import { Image } from "@lonik/oh-image/react";
32
+ import heroImg from "./hero.jpg?oh";
33
+
34
+ function App() {
35
+ return <Image src={heroImg} alt="Hero" />;
36
+ }
29
37
  ```
30
- # tsdown-template
38
+ ## License
39
+
40
+ [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.2",
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
  }