polite-media 0.6.0 → 0.6.1
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/CHANGELOG.md +14 -0
- package/README.md +4 -2
- package/dist/image.css +1 -1
- package/package.json +1 -1
- package/src/image.css +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
Notable changes, newest first. Versions follow [semver](https://semver.org); while
|
|
4
4
|
this is `0.x`, a minor bump may still break things and will say so here.
|
|
5
5
|
|
|
6
|
+
## 0.6.1 (2026-10-11)
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- **The reveal failsafe could not run on the compositor.** Its animation lasted `0s`, which
|
|
11
|
+
Chromium will not composite, so every image marked for a reveal carried a main-thread animation
|
|
12
|
+
and Lighthouse listed it under "Avoid non-composited animations". It now lasts `1ms`, and a
|
|
13
|
+
stray image still arrives unfaded once `--polite-failsafe` has passed.
|
|
14
|
+
|
|
15
|
+
### Documentation
|
|
16
|
+
|
|
17
|
+
- **The wrapper recipe in "Composing your own animation" uses a `1ms` failsafe**, for the same
|
|
18
|
+
reason. Its `0s` gave a copied rule the same Lighthouse warning.
|
|
19
|
+
|
|
6
20
|
## 0.6.0 (2026-10-07)
|
|
7
21
|
|
|
8
22
|
### Breaking
|
package/README.md
CHANGED
|
@@ -200,7 +200,7 @@ you have to add yourself:
|
|
|
200
200
|
.card.is-visible:has(img[data-polite-reveal]:not([data-polite-ready])) {
|
|
201
201
|
opacity: 0;
|
|
202
202
|
/* yours, not the library's: see below */
|
|
203
|
-
animation: your-failsafe
|
|
203
|
+
animation: your-failsafe 1ms linear 5s forwards;
|
|
204
204
|
}
|
|
205
205
|
```
|
|
206
206
|
|
|
@@ -208,7 +208,9 @@ you have to add yourself:
|
|
|
208
208
|
`image.css` is CSS-only and reveals **the image**, not a wrapper around it. So a
|
|
209
209
|
bundle that never arrives leaves your wrapper hidden for good even though the
|
|
210
210
|
library's own failsafe fired. Give any rule of yours that hides on
|
|
211
|
-
`:not([data-polite-ready])` its own failsafe on the same delay
|
|
211
|
+
`:not([data-polite-ready])` its own failsafe on the same delay, and give it a
|
|
212
|
+
length: Chromium runs no animation of `0s` on the compositor, and Lighthouse
|
|
213
|
+
lists every such element as non-composited.
|
|
212
214
|
|
|
213
215
|
**Gate a wrapper only on images that will load.** The `:has()` above waits on
|
|
214
216
|
every marked image inside the card, and lazy loading may never fetch some of
|
package/dist/image.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@media(scripting:enabled){img[data-polite-reveal][loading=lazy],img[data-polite-reveal=eager]{opacity:0;transition:opacity var(--polite-fade, .35s) ease}img[data-polite-reveal][loading=lazy]:not([data-polite-ready]):not([data-polite-managed]),img[data-polite-reveal=eager]:not([data-polite-ready]):not([data-polite-managed]){animation:polite-reveal-failsafe
|
|
1
|
+
@media(scripting:enabled){img[data-polite-reveal][loading=lazy],img[data-polite-reveal=eager]{opacity:0;transition:opacity var(--polite-fade, .35s) ease}img[data-polite-reveal][loading=lazy]:not([data-polite-ready]):not([data-polite-managed]),img[data-polite-reveal=eager]:not([data-polite-ready]):not([data-polite-managed]){animation:polite-reveal-failsafe 1ms var(--polite-failsafe, 5s) forwards}img[data-polite-reveal][data-polite-ready]{opacity:1}@keyframes polite-reveal-failsafe{to{opacity:1}}}@media(prefers-reduced-motion:reduce){img[data-polite-reveal][loading=lazy],img[data-polite-reveal=eager]{transition:none}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polite-media",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Background video, image reveals and next-page image warming. Reveals on the frame that actually painted, plays only what is on screen, respects data and motion.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"video",
|
package/src/image.css
CHANGED
|
@@ -57,10 +57,13 @@
|
|
|
57
57
|
* stylesheet applied stayed at 0 for the whole delay and then snapped to 1
|
|
58
58
|
* unfaded, while Chromium and WebKit revealed it. Cancelling only the animation
|
|
59
59
|
* on such an image put it at 1 immediately.
|
|
60
|
+
*
|
|
61
|
+
* 1ms rather than 0s: Chromium runs no animation of zero length on the
|
|
62
|
+
* compositor, and Lighthouse lists every such image as non-composited.
|
|
60
63
|
*/
|
|
61
64
|
img[data-polite-reveal][loading='lazy']:not([data-polite-ready]):not([data-polite-managed]),
|
|
62
65
|
img[data-polite-reveal='eager']:not([data-polite-ready]):not([data-polite-managed]) {
|
|
63
|
-
animation: polite-reveal-failsafe
|
|
66
|
+
animation: polite-reveal-failsafe 1ms var(--polite-failsafe, 5s) forwards;
|
|
64
67
|
}
|
|
65
68
|
|
|
66
69
|
img[data-polite-reveal][data-polite-ready] {
|