@docusaurus/plugin-ideal-image 2.4.1 → 3.0.0-beta.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.
- package/README.md +1 -40
- package/lib/theme/IdealImage/index.js +1 -1
- package/package.json +15 -15
- package/src/deps.d.ts +1 -1
- package/src/theme/IdealImage/index.tsx +1 -1
package/README.md
CHANGED
|
@@ -2,45 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Docusaurus Plugin to generate an almost ideal image (responsive, lazy-loading, and low quality placeholder).
|
|
4
4
|
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
yarn add @docusaurus/plugin-ideal-image
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Modify your `docusaurus.config.js`
|
|
12
|
-
|
|
13
|
-
```diff
|
|
14
|
-
module.exports = {
|
|
15
|
-
...
|
|
16
|
-
+ plugins: ['@docusaurus/plugin-ideal-image'],
|
|
17
|
-
...
|
|
18
|
-
}
|
|
19
|
-
```
|
|
20
|
-
|
|
21
5
|
## Usage
|
|
22
6
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
```jsx
|
|
26
|
-
import Image from '@theme/IdealImage';
|
|
27
|
-
import thumbnail from './path/to/img.png';
|
|
28
|
-
|
|
29
|
-
// your react code
|
|
30
|
-
<Image img={thumbnail} />
|
|
31
|
-
|
|
32
|
-
// or
|
|
33
|
-
<Image img={require('./path/to/img.png')} />
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Options
|
|
37
|
-
|
|
38
|
-
| Option | Type | Default | Description |
|
|
39
|
-
| --- | --- | --- | --- |
|
|
40
|
-
| `name` | `string` | `ideal-img/[name].[hash:hex:7].[width].[ext]` | Filename template for output files. |
|
|
41
|
-
| `sizes` | `array` | _original size_ | Specify all widths you want to use; if a specified size exceeds the original image's width, the latter will be used (i.e. images won't be scaled up). You may also declare a default `sizes` array in the loader options in your `webpack.config.js`. |
|
|
42
|
-
| `size` | `integer` | _original size_ | Specify one width you want to use; if the specified size exceeds the original image's width, the latter will be used (i.e. images won't be scaled up) |
|
|
43
|
-
| `min` | `integer` | | As an alternative to manually specifying `sizes`, you can specify `min`, `max` and `steps`, and the sizes will be generated for you. |
|
|
44
|
-
| `max` | `integer` | | See `min` above |
|
|
45
|
-
| `steps` | `integer` | `4` | Configure the number of images generated between `min` and `max` (inclusive) |
|
|
46
|
-
| `quality` | `integer` | `85` | JPEG compression quality |
|
|
7
|
+
See [plugin-ideal-image documentation](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-ideal-image).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import ReactIdealImage from '@
|
|
8
|
+
import ReactIdealImage from '@slorber/react-ideal-image';
|
|
9
9
|
import {translate} from '@docusaurus/Translate';
|
|
10
10
|
// Adopted from https://github.com/endiliey/react-ideal-image/blob/master/src/components/helpers.js#L59-L65
|
|
11
11
|
function bytesToSize(bytes) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-ideal-image",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.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,26 +20,26 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "
|
|
24
|
-
"@docusaurus/lqip-loader": "
|
|
23
|
+
"@docusaurus/core": "3.0.0-beta.0",
|
|
24
|
+
"@docusaurus/lqip-loader": "3.0.0-beta.0",
|
|
25
25
|
"@docusaurus/responsive-loader": "^1.7.0",
|
|
26
|
-
"@docusaurus/theme-translations": "
|
|
27
|
-
"@docusaurus/types": "
|
|
28
|
-
"@docusaurus/utils-validation": "
|
|
29
|
-
"@
|
|
26
|
+
"@docusaurus/theme-translations": "3.0.0-beta.0",
|
|
27
|
+
"@docusaurus/types": "3.0.0-beta.0",
|
|
28
|
+
"@docusaurus/utils-validation": "3.0.0-beta.0",
|
|
29
|
+
"@slorber/react-ideal-image": "^0.0.12",
|
|
30
30
|
"react-waypoint": "^10.3.0",
|
|
31
|
-
"sharp": "^0.
|
|
32
|
-
"tslib": "^2.
|
|
33
|
-
"webpack": "^5.
|
|
31
|
+
"sharp": "^0.32.3",
|
|
32
|
+
"tslib": "^2.6.0",
|
|
33
|
+
"webpack": "^5.88.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@docusaurus/module-type-aliases": "
|
|
37
|
-
"fs-extra": "^
|
|
36
|
+
"@docusaurus/module-type-aliases": "3.0.0-beta.0",
|
|
37
|
+
"fs-extra": "^11.1.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"jimp": "*",
|
|
41
|
-
"react": "^
|
|
42
|
-
"react-dom": "^
|
|
41
|
+
"react": "^18.0.0",
|
|
42
|
+
"react-dom": "^18.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"jimp": {
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=16.14"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "27a1e90d9fff88af90ecad35bea16d4d7230482a"
|
|
53
53
|
}
|
package/src/deps.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Note: the original type definition is WRONG. getIcon & getMessage receive
|
|
13
13
|
* full state object.
|
|
14
14
|
*/
|
|
15
|
-
declare module '@
|
|
15
|
+
declare module '@slorber/react-ideal-image' {
|
|
16
16
|
import type {ComponentProps, ComponentType, CSSProperties} from 'react';
|
|
17
17
|
|
|
18
18
|
export type LoadingState = 'initial' | 'loading' | 'loaded' | 'error';
|
|
@@ -9,7 +9,7 @@ import React from 'react';
|
|
|
9
9
|
import ReactIdealImage, {
|
|
10
10
|
type IconKey,
|
|
11
11
|
type State,
|
|
12
|
-
} from '@
|
|
12
|
+
} from '@slorber/react-ideal-image';
|
|
13
13
|
import {translate} from '@docusaurus/Translate';
|
|
14
14
|
|
|
15
15
|
import type {Props} from '@theme/IdealImage';
|