@ecopages/image-processor 0.2.0-beta.37 → 0.2.0-beta.39
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 +11 -3
- package/package.json +17 -3
- package/src/component/jsx.d.ts +12 -0
- package/src/component/jsx.js +18 -0
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ It provides automatic image processing (e.g. converting and compressing to WebP)
|
|
|
9
9
|
- **Automatic Image Optimization**: Converts and compresses images to modern formats at build time.
|
|
10
10
|
- **Responsive Image Generation**: Creates multiple variants for different screen sizes.
|
|
11
11
|
- **Virtual Module Integration**: Type-safe imports through `ecopages:images`.
|
|
12
|
-
- **Ecopages Components**: Ready-to-use HTML
|
|
12
|
+
- **Ecopages Components**: Ready-to-use HTML, Ecopages JSX, and React (`EcoImage`) components.
|
|
13
13
|
- **Multiple Layout Options**: Fixed, constrained, and full-width layouts built-in.
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
@@ -70,9 +70,9 @@ import { heroImage, profilePicture } from 'ecopages:images';
|
|
|
70
70
|
|
|
71
71
|
### Components
|
|
72
72
|
|
|
73
|
-
The plugin provides ready-to-use components for HTML (
|
|
73
|
+
The plugin provides ready-to-use components for string HTML (KitaJS), Ecopages JSX, and React.
|
|
74
74
|
|
|
75
|
-
**HTML Component
|
|
75
|
+
**HTML Component** (returns a markup string; use as a function, or in string-based JSX runtimes like KitaJS):
|
|
76
76
|
|
|
77
77
|
```typescript
|
|
78
78
|
import { EcoImage } from '@ecopages/image-processor/component/html';
|
|
@@ -85,6 +85,14 @@ EcoImage({
|
|
|
85
85
|
});
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
**Ecopages JSX Component:**
|
|
89
|
+
|
|
90
|
+
```jsx
|
|
91
|
+
import { EcoImage } from '@ecopages/image-processor/component/jsx';
|
|
92
|
+
|
|
93
|
+
<EcoImage {...heroImage} alt="Hero banner" layout="constrained" priority />;
|
|
94
|
+
```
|
|
95
|
+
|
|
88
96
|
**React Component:**
|
|
89
97
|
|
|
90
98
|
```jsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecopages/image-processor",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.39",
|
|
4
4
|
"description": "Image processor, transform and optimize images for web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"image",
|
|
@@ -15,10 +15,16 @@
|
|
|
15
15
|
"directory": "packages/processors/image-processor"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@ecopages/core": "0.2.0-beta.
|
|
18
|
+
"@ecopages/core": "0.2.0-beta.39",
|
|
19
|
+
"@ecopages/jsx": ">=0.3.0-beta.6"
|
|
20
|
+
},
|
|
21
|
+
"peerDependenciesMeta": {
|
|
22
|
+
"@ecopages/jsx": {
|
|
23
|
+
"optional": true
|
|
24
|
+
}
|
|
19
25
|
},
|
|
20
26
|
"dependencies": {
|
|
21
|
-
"@ecopages/file-system": "0.2.0-beta.
|
|
27
|
+
"@ecopages/file-system": "0.2.0-beta.39",
|
|
22
28
|
"@ecopages/logger": "^0.2.3",
|
|
23
29
|
"react": "^19.2.6",
|
|
24
30
|
"react-dom": "^19.2.6",
|
|
@@ -36,6 +42,10 @@
|
|
|
36
42
|
"default": "./src/component/html.js",
|
|
37
43
|
"types": "./src/component/html.d.ts"
|
|
38
44
|
},
|
|
45
|
+
"./component/jsx": {
|
|
46
|
+
"default": "./src/component/jsx.js",
|
|
47
|
+
"types": "./src/component/jsx.d.ts"
|
|
48
|
+
},
|
|
39
49
|
"./component/react": {
|
|
40
50
|
"default": "./src/component/react.js",
|
|
41
51
|
"types": "./src/component/react.d.ts"
|
|
@@ -47,6 +57,10 @@
|
|
|
47
57
|
"default": "./src/component/html.js",
|
|
48
58
|
"types": "./src/component/html.d.ts"
|
|
49
59
|
},
|
|
60
|
+
"./component/jsx.ts": {
|
|
61
|
+
"default": "./src/component/jsx.js",
|
|
62
|
+
"types": "./src/component/jsx.d.ts"
|
|
63
|
+
},
|
|
50
64
|
"./component/react.ts": {
|
|
51
65
|
"default": "./src/component/react.js",
|
|
52
66
|
"types": "./src/component/react.d.ts"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image component that renders as an Ecopages JSX element.
|
|
3
|
+
* @module @ecopages/image-processor/component/jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type JsxRenderable } from '@ecopages/jsx';
|
|
6
|
+
import { type EcoImageProps } from '../image-renderer.js';
|
|
7
|
+
/**
|
|
8
|
+
* EcoImage
|
|
9
|
+
* This component generates the image element based on the provided props as JSX
|
|
10
|
+
* @param props {@link EcoImageProps}
|
|
11
|
+
*/
|
|
12
|
+
export declare const EcoImage: (props: EcoImageProps) => JsxRenderable;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image component that renders as an Ecopages JSX element.
|
|
3
|
+
* @module @ecopages/image-processor/component/jsx
|
|
4
|
+
*/
|
|
5
|
+
import { jsx } from '@ecopages/jsx';
|
|
6
|
+
import { renderer } from '../image-renderer.js';
|
|
7
|
+
/**
|
|
8
|
+
* EcoImage
|
|
9
|
+
* This component generates the image element based on the provided props as JSX
|
|
10
|
+
* @param props {@link EcoImageProps}
|
|
11
|
+
*/
|
|
12
|
+
export const EcoImage = (props) => {
|
|
13
|
+
const attributes = renderer.generateAttributes(props);
|
|
14
|
+
if (!attributes) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return jsx('img', attributes);
|
|
18
|
+
};
|