astro-lqip 1.3.0 → 1.3.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 +8 -8
- package/package.json +7 -6
- package/src/components/Image.astro +3 -34
- package/src/components/Picture.astro +2 -31
- package/src/styles/lqip.css +37 -0
package/README.md
CHANGED
|
@@ -51,10 +51,10 @@ Example:
|
|
|
51
51
|
|
|
52
52
|
```astro
|
|
53
53
|
---
|
|
54
|
-
import { Image, Picture } from 'astro-lqip/components'
|
|
54
|
+
import { Image, Picture } from 'astro-lqip/components';
|
|
55
55
|
|
|
56
|
-
import image from './path/to/image.png'
|
|
57
|
-
import otherImage from './path/to/other-image.png'
|
|
56
|
+
import image from './path/to/image.png';
|
|
57
|
+
import otherImage from './path/to/other-image.png';
|
|
58
58
|
---
|
|
59
59
|
|
|
60
60
|
<Image src={image} alt="Cover Image" width={220} height={220} />
|
|
@@ -73,16 +73,16 @@ Both `<Image>` and `<Picture>` components support all the props of the [native A
|
|
|
73
73
|
- `lqipSize`: The size of the LQIP image, which can be any number from `4` to `64`. (default is 4)
|
|
74
74
|
|
|
75
75
|
> [!WARNING]
|
|
76
|
-
> A major size in the lqipSize prop can significantly impact the performance of your application.
|
|
76
|
+
> A major size in the `lqipSize` prop can significantly impact the performance of your application.
|
|
77
77
|
|
|
78
78
|
Example:
|
|
79
79
|
|
|
80
80
|
```astro
|
|
81
81
|
---
|
|
82
|
-
import { Image, Picture } from 'astro-lqip/components'
|
|
82
|
+
import { Image, Picture } from 'astro-lqip/components';
|
|
83
83
|
|
|
84
|
-
import image from './path/to/image.png'
|
|
85
|
-
import otherImage from './path/to/other-image.png'
|
|
84
|
+
import image from './path/to/image.png';
|
|
85
|
+
import otherImage from './path/to/other-image.png';
|
|
86
86
|
---
|
|
87
87
|
|
|
88
88
|
<Image src={image} alt="Cover Image" width={220} height={220} lqip="svg" lqipSize={10} />
|
|
@@ -97,7 +97,7 @@ import otherImage from './path/to/other-image.png'
|
|
|
97
97
|
- [x] Add support for Image component.
|
|
98
98
|
- [x] Add support for more lqip techniques.
|
|
99
99
|
- [ ] Test for remote images.
|
|
100
|
-
- [
|
|
100
|
+
- [x] Optimize current CSS usage.
|
|
101
101
|
- [x] Improve docs page.
|
|
102
102
|
- [ ] Test support for SSR mode.
|
|
103
103
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-lqip",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "Native extended Astro
|
|
3
|
+
"version": "1.3.2",
|
|
4
|
+
"description": "Native extended Astro components for generating low quality image placeholders (LQIP).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astro",
|
|
7
7
|
"astro-component",
|
|
8
8
|
"astro-integration",
|
|
9
9
|
"image",
|
|
10
|
+
"picture",
|
|
10
11
|
"lqip"
|
|
11
12
|
],
|
|
12
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://astro-lqip.web.app",
|
|
13
14
|
"bugs": {
|
|
14
15
|
"url": "https://github.com/felixicaza/astro-lqip/issues"
|
|
15
16
|
},
|
|
@@ -37,14 +38,14 @@
|
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@eslint/js": "9.33.0",
|
|
40
|
-
"@typescript-eslint/parser": "8.
|
|
41
|
-
"astro": "5.
|
|
41
|
+
"@typescript-eslint/parser": "8.40.0",
|
|
42
|
+
"astro": "5.13.2",
|
|
42
43
|
"bumpp": "10.2.3",
|
|
43
44
|
"eslint": "9.33.0",
|
|
44
45
|
"eslint-plugin-astro": "1.3.1",
|
|
45
46
|
"eslint-plugin-jsonc": "2.20.1",
|
|
46
47
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
47
|
-
"eslint-plugin-package-json": "0.
|
|
48
|
+
"eslint-plugin-package-json": "0.54.0",
|
|
48
49
|
"eslint-plugin-yml": "1.18.0",
|
|
49
50
|
"globals": "16.3.0",
|
|
50
51
|
"jiti": "2.5.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { LocalImageProps, RemoteImageProps } from 'astro:assets'
|
|
3
|
-
import type { Props as LqipProps } from '../types'
|
|
4
3
|
import type { HTMLAttributes } from 'astro/types'
|
|
4
|
+
import type { Props as LqipProps } from '../types'
|
|
5
5
|
|
|
6
6
|
import { PREFIX } from '../constants'
|
|
7
7
|
|
|
@@ -12,6 +12,8 @@ import { getLqip } from '../utils/getLqip'
|
|
|
12
12
|
|
|
13
13
|
import { Image as ImageComponent } from 'astro:assets'
|
|
14
14
|
|
|
15
|
+
import '../styles/lqip.css'
|
|
16
|
+
|
|
15
17
|
type Props = (LocalImageProps | RemoteImageProps) & LqipProps & {
|
|
16
18
|
parentAttributes?: HTMLAttributes<'div'>
|
|
17
19
|
}
|
|
@@ -53,39 +55,6 @@ const combinedParentAttributes = {
|
|
|
53
55
|
}
|
|
54
56
|
---
|
|
55
57
|
|
|
56
|
-
<style is:inline>
|
|
57
|
-
div[data-astro-lqip] {
|
|
58
|
-
--opacity: 1;
|
|
59
|
-
--z-index: 0;
|
|
60
|
-
|
|
61
|
-
position: relative;
|
|
62
|
-
display: inline-block;
|
|
63
|
-
width: fit-content;
|
|
64
|
-
height: fit-content;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
div[data-astro-lqip]::after {
|
|
68
|
-
content: "";
|
|
69
|
-
inset: 0;
|
|
70
|
-
width: 100%;
|
|
71
|
-
height: 100%;
|
|
72
|
-
position: absolute;
|
|
73
|
-
pointer-events: none;
|
|
74
|
-
transition: opacity 1s;
|
|
75
|
-
opacity: var(--opacity);
|
|
76
|
-
z-index: var(--z-index);
|
|
77
|
-
background: var(--lqip-background);
|
|
78
|
-
background-size: cover;
|
|
79
|
-
background-position: 50% 50%;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
div[data-astro-lqip] img {
|
|
83
|
-
z-index: 1;
|
|
84
|
-
position: relative;
|
|
85
|
-
overflow: hidden;
|
|
86
|
-
}
|
|
87
|
-
</style>
|
|
88
|
-
|
|
89
58
|
<div class={className} data-astro-lqip {...combinedParentAttributes}>
|
|
90
59
|
<ImageComponent
|
|
91
60
|
{...props}
|
|
@@ -11,6 +11,8 @@ import { getLqip } from '../utils/getLqip'
|
|
|
11
11
|
|
|
12
12
|
import { Picture as PictureComponent } from 'astro:assets'
|
|
13
13
|
|
|
14
|
+
import '../styles/lqip.css'
|
|
15
|
+
|
|
14
16
|
type Props = AstroPictureProps & LqipProps
|
|
15
17
|
|
|
16
18
|
const { class: className, lqip = 'base64', lqipSize = 4, pictureAttributes = {}, ...props } = Astro.props as Props
|
|
@@ -50,37 +52,6 @@ const combinedPictureAttributes = {
|
|
|
50
52
|
}
|
|
51
53
|
---
|
|
52
54
|
|
|
53
|
-
<style is:inline>
|
|
54
|
-
picture[data-astro-lqip] {
|
|
55
|
-
--opacity: 1;
|
|
56
|
-
--z-index: 0;
|
|
57
|
-
|
|
58
|
-
position: relative;
|
|
59
|
-
display: inline-block;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
picture[data-astro-lqip]::after {
|
|
63
|
-
content: "";
|
|
64
|
-
inset: 0;
|
|
65
|
-
width: 100%;
|
|
66
|
-
height: 100%;
|
|
67
|
-
position: absolute;
|
|
68
|
-
pointer-events: none;
|
|
69
|
-
transition: opacity 1s;
|
|
70
|
-
opacity: var(--opacity);
|
|
71
|
-
z-index: var(--z-index);
|
|
72
|
-
background: var(--lqip-background);
|
|
73
|
-
background-size: cover;
|
|
74
|
-
background-position: 50% 50%;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
picture[data-astro-lqip] img {
|
|
78
|
-
z-index: 1;
|
|
79
|
-
position: relative;
|
|
80
|
-
overflow: hidden;
|
|
81
|
-
}
|
|
82
|
-
</style>
|
|
83
|
-
|
|
84
55
|
<PictureComponent
|
|
85
56
|
{...props}
|
|
86
57
|
class={className}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[data-astro-lqip] {
|
|
2
|
+
--opacity: 1;
|
|
3
|
+
--z-index: 0;
|
|
4
|
+
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
width: fit-content;
|
|
8
|
+
height: fit-content;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[data-astro-lqip]::after {
|
|
12
|
+
content: "";
|
|
13
|
+
inset: 0;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
position: absolute;
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
transition: opacity 1s;
|
|
19
|
+
opacity: var(--opacity);
|
|
20
|
+
z-index: var(--z-index);
|
|
21
|
+
background: var(--lqip-background);
|
|
22
|
+
background-size: cover;
|
|
23
|
+
background-position: 50% 50%;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[data-astro-lqip] img {
|
|
27
|
+
z-index: 1;
|
|
28
|
+
position: relative;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@media (scripting: none) {
|
|
33
|
+
[data-astro-lqip] {
|
|
34
|
+
--opacity: 0;
|
|
35
|
+
--z-index: 1;
|
|
36
|
+
}
|
|
37
|
+
}
|