@docusaurus/plugin-ideal-image 2.1.0 → 2.2.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.
|
@@ -72,23 +72,17 @@ function getMessage(icon, state) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
export default function IdealImage(props) {
|
|
75
|
-
const {
|
|
75
|
+
const {img, ...propsRest} = props;
|
|
76
76
|
// In dev env just use regular img with original file
|
|
77
77
|
if (typeof img === 'string' || 'default' in img) {
|
|
78
78
|
return (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
className={className}
|
|
82
|
-
alt={alt}
|
|
83
|
-
{...props}
|
|
84
|
-
/>
|
|
79
|
+
// eslint-disable-next-line jsx-a11y/alt-text
|
|
80
|
+
<img src={typeof img === 'string' ? img : img.default} {...propsRest} />
|
|
85
81
|
);
|
|
86
82
|
}
|
|
87
83
|
return (
|
|
88
84
|
<ReactIdealImage
|
|
89
|
-
{...
|
|
90
|
-
alt={alt}
|
|
91
|
-
className={className}
|
|
85
|
+
{...propsRest}
|
|
92
86
|
height={img.src.height ?? 100}
|
|
93
87
|
width={img.src.width ?? 100}
|
|
94
88
|
placeholder={{lqip: img.preSrc}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-ideal-image",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-ideal-image.d.ts",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "2.
|
|
24
|
-
"@docusaurus/lqip-loader": "2.
|
|
23
|
+
"@docusaurus/core": "2.2.0",
|
|
24
|
+
"@docusaurus/lqip-loader": "2.2.0",
|
|
25
25
|
"@docusaurus/responsive-loader": "^1.7.0",
|
|
26
|
-
"@docusaurus/theme-translations": "2.
|
|
27
|
-
"@docusaurus/types": "2.
|
|
28
|
-
"@docusaurus/utils-validation": "2.
|
|
26
|
+
"@docusaurus/theme-translations": "2.2.0",
|
|
27
|
+
"@docusaurus/types": "2.2.0",
|
|
28
|
+
"@docusaurus/utils-validation": "2.2.0",
|
|
29
29
|
"@endiliey/react-ideal-image": "^0.0.11",
|
|
30
30
|
"react-waypoint": "^10.3.0",
|
|
31
31
|
"sharp": "^0.30.7",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"webpack": "^5.73.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@docusaurus/module-type-aliases": "2.
|
|
36
|
+
"@docusaurus/module-type-aliases": "2.2.0",
|
|
37
37
|
"fs-extra": "^10.1.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=16.14"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "a308fb7c81832cca354192fe2984f52749441249"
|
|
53
53
|
}
|
|
@@ -81,25 +81,19 @@ function getMessage(icon: IconKey, state: State) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export default function IdealImage(props: Props): JSX.Element {
|
|
84
|
-
const {
|
|
84
|
+
const {img, ...propsRest} = props;
|
|
85
85
|
|
|
86
86
|
// In dev env just use regular img with original file
|
|
87
87
|
if (typeof img === 'string' || 'default' in img) {
|
|
88
88
|
return (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
className={className}
|
|
92
|
-
alt={alt}
|
|
93
|
-
{...props}
|
|
94
|
-
/>
|
|
89
|
+
// eslint-disable-next-line jsx-a11y/alt-text
|
|
90
|
+
<img src={typeof img === 'string' ? img : img.default} {...propsRest} />
|
|
95
91
|
);
|
|
96
92
|
}
|
|
97
93
|
|
|
98
94
|
return (
|
|
99
95
|
<ReactIdealImage
|
|
100
|
-
{...
|
|
101
|
-
alt={alt}
|
|
102
|
-
className={className}
|
|
96
|
+
{...propsRest}
|
|
103
97
|
height={img.src.height ?? 100}
|
|
104
98
|
width={img.src.width ?? 100}
|
|
105
99
|
placeholder={{lqip: img.preSrc}}
|