polite-media 0.3.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/LICENSE +21 -0
  3. package/README.md +675 -0
  4. package/dist/coordinator.d.ts +231 -0
  5. package/dist/coordinator.d.ts.map +1 -0
  6. package/dist/coordinator.js +1017 -0
  7. package/dist/coordinator.js.map +1 -0
  8. package/dist/env.d.ts +30 -0
  9. package/dist/env.d.ts.map +1 -0
  10. package/dist/env.js +49 -0
  11. package/dist/env.js.map +1 -0
  12. package/dist/events.d.ts +70 -0
  13. package/dist/events.d.ts.map +1 -0
  14. package/dist/events.js +42 -0
  15. package/dist/events.js.map +1 -0
  16. package/dist/image.css +1 -0
  17. package/dist/image.d.ts +45 -0
  18. package/dist/image.d.ts.map +1 -0
  19. package/dist/image.js +127 -0
  20. package/dist/image.js.map +1 -0
  21. package/dist/layer.css +1 -0
  22. package/dist/reveal.d.ts +34 -0
  23. package/dist/reveal.d.ts.map +1 -0
  24. package/dist/reveal.js +72 -0
  25. package/dist/reveal.js.map +1 -0
  26. package/dist/sources.d.ts +22 -0
  27. package/dist/sources.d.ts.map +1 -0
  28. package/dist/sources.js +148 -0
  29. package/dist/sources.js.map +1 -0
  30. package/dist/targets.d.ts +20 -0
  31. package/dist/targets.d.ts.map +1 -0
  32. package/dist/targets.js +17 -0
  33. package/dist/targets.js.map +1 -0
  34. package/dist/video.css +1 -0
  35. package/dist/video.d.ts +15 -0
  36. package/dist/video.d.ts.map +1 -0
  37. package/dist/video.js +17 -0
  38. package/dist/video.js.map +1 -0
  39. package/dist/warm.d.ts +13 -0
  40. package/dist/warm.d.ts.map +1 -0
  41. package/dist/warm.js +12 -0
  42. package/dist/warm.js.map +1 -0
  43. package/dist/warming.d.ts +62 -0
  44. package/dist/warming.d.ts.map +1 -0
  45. package/dist/warming.js +136 -0
  46. package/dist/warming.js.map +1 -0
  47. package/package.json +96 -0
  48. package/src/coordinator.ts +1337 -0
  49. package/src/env.ts +56 -0
  50. package/src/events.ts +78 -0
  51. package/src/image.css +74 -0
  52. package/src/image.ts +160 -0
  53. package/src/layer.css +60 -0
  54. package/src/reveal.ts +75 -0
  55. package/src/sources.ts +164 -0
  56. package/src/targets.ts +27 -0
  57. package/src/video.css +74 -0
  58. package/src/video.ts +32 -0
  59. package/src/warm.ts +12 -0
  60. package/src/warming.ts +162 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../src/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,GAGnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAsB,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,cAAc,EAAe,MAAM,cAAc,CAAC;AAyJ3D,MAAM,QAAQ,GAAmB;IAC/B,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,oBAAoB;IACnC,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;IAClC,UAAU,EAAE,GAAG;IACf,SAAS,EAAE,aAAa;IACxB,eAAe,EAAE,KAAK;CACvB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,IAAI,MAAM,GAAmB,EAAE,GAAG,QAAQ,EAAE,CAAC;AAE7C;;;;;;;GAOG;AACH,SAAS,UAAU;IACjB,OAAO,QAAQ,CAAC,UAAU,KAAK,UAAU,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,MAAM,gBAAgB,GA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mB,GAAG,KAAK,CAAC;IAC5B,mBAAmB,EAAE,CAAC;AACxB,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,aAAa;IAC3B,aAAa,EAAE,CAAC;IAChB,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;IACzB,UAAU,GAAG,KAAK,CAAC;IACnB,gFAAgF;IAChF,2EAA2E;IAC3E,oCAAoC;IACpC,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,OAAO;IACrB,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,KAAK,IAAI,EAAE,SAAS,EAAE,SAAS,KAAK,IAAI,EAAE,CAAC;AAChG,CAAC"}
package/dist/env.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Environment gates: the conditions under which video is allowed to play at all.
3
+ * The poster is a complete fallback for every one of them, so a gate that says no
4
+ * costs the user nothing.
5
+ */
6
+ /**
7
+ * Memoised `matchMedia`, and the reason every media query in this package goes
8
+ * through one function: a module-scope `matchMedia(...)` throws the moment the
9
+ * package is imported anywhere without a DOM (SSR, prerender, a Node test), and
10
+ * would contradict the `sideEffects` declaration in package.json.
11
+ *
12
+ * Memoising also lets callers attach `change` listeners to the same object the
13
+ * predicates read, so "honour it live" costs no extra plumbing.
14
+ */
15
+ export declare function mediaQuery(query: string): MediaQueryList;
16
+ export declare function motionAllowed(): boolean;
17
+ /**
18
+ * Video is an enhancement over a poster that already stands on its own, so it is
19
+ * skipped on a metered or very slow connection.
20
+ *
21
+ * Absence must mean *allow*. The Network Information API is not Baseline: Safari
22
+ * and Firefox never expose it, and Brave disables it as a fingerprinting surface.
23
+ * Reading absence as "block" would fail closed for most of the web, and fail
24
+ * closed in the one direction nobody would catch: Chrome is the browser that has
25
+ * the API, so a Chrome-only developer never sees it.
26
+ */
27
+ export declare function connectionAllowsMedia(): boolean;
28
+ /** Drops memoised queries so a test can swap `matchMedia`. Not part of the public API. */
29
+ export declare function resetEnv(): void;
30
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAOxD;AAED,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAOD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAK/C;AAED,0FAA0F;AAC1F,wBAAgB,QAAQ,IAAI,IAAI,CAE/B"}
package/dist/env.js ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Environment gates: the conditions under which video is allowed to play at all.
3
+ * The poster is a complete fallback for every one of them, so a gate that says no
4
+ * costs the user nothing.
5
+ */
6
+ const queries = new Map();
7
+ /**
8
+ * Memoised `matchMedia`, and the reason every media query in this package goes
9
+ * through one function: a module-scope `matchMedia(...)` throws the moment the
10
+ * package is imported anywhere without a DOM (SSR, prerender, a Node test), and
11
+ * would contradict the `sideEffects` declaration in package.json.
12
+ *
13
+ * Memoising also lets callers attach `change` listeners to the same object the
14
+ * predicates read, so "honour it live" costs no extra plumbing.
15
+ */
16
+ export function mediaQuery(query) {
17
+ let mql = queries.get(query);
18
+ if (!mql) {
19
+ mql = matchMedia(query);
20
+ queries.set(query, mql);
21
+ }
22
+ return mql;
23
+ }
24
+ export function motionAllowed() {
25
+ return !mediaQuery('(prefers-reduced-motion: reduce)').matches;
26
+ }
27
+ /**
28
+ * Video is an enhancement over a poster that already stands on its own, so it is
29
+ * skipped on a metered or very slow connection.
30
+ *
31
+ * Absence must mean *allow*. The Network Information API is not Baseline: Safari
32
+ * and Firefox never expose it, and Brave disables it as a fingerprinting surface.
33
+ * Reading absence as "block" would fail closed for most of the web, and fail
34
+ * closed in the one direction nobody would catch: Chrome is the browser that has
35
+ * the API, so a Chrome-only developer never sees it.
36
+ */
37
+ export function connectionAllowsMedia() {
38
+ const conn = navigator.connection;
39
+ if (!conn)
40
+ return true;
41
+ if (conn.saveData)
42
+ return false;
43
+ return conn.effectiveType !== 'slow-2g' && conn.effectiveType !== '2g';
44
+ }
45
+ /** Drops memoised queries so a test can swap `matchMedia`. Not part of the public API. */
46
+ export function resetEnv() {
47
+ queries.clear();
48
+ }
49
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;AACjE,CAAC;AAOD;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,IAAI,GAAI,SAA6D,CAAC,UAAU,CAAC;IACvF,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAChC,OAAO,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,CAAC;AACzE,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,QAAQ;IACtB,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * The events both halves dispatch, and the typing that makes them usable.
3
+ *
4
+ * Three pieces, because no one of them is sufficient on its own:
5
+ *
6
+ * - The **constants**, because a mistyped event name still compiles. lib.dom
7
+ * declares a fallback `addEventListener(type: string, ...)` overload, so
8
+ * `'polite-video:redy'` type-checks happily however the maps are augmented.
9
+ * - The **detail**, because these events bubble by design and the useful
10
+ * listener sits on a container, which makes `event.target` the wrong element
11
+ * or a bare `EventTarget` needing a cast.
12
+ * - The **augmentation**, so a listener gets `CustomEvent<Detail>` rather than
13
+ * `Event`.
14
+ *
15
+ * `ElementEventMap` and `DocumentEventMap` are the two that have to be patched,
16
+ * and not the more obvious `HTMLElementEventMap`. lib.dom declares
17
+ * `HTMLElementEventMap extends ElementEventMap`, so augmenting the base reaches
18
+ * `HTMLElement`, `HTMLMediaElement` and `HTMLVideoElement` through inheritance,
19
+ * while augmenting the derived one reaches none of its ancestors. `document` is
20
+ * a separate branch entirely -- `DocumentEventMap extends
21
+ * GlobalEventHandlersEventMap` -- so it needs its own entry.
22
+ */
23
+ /** Dispatched on the video once a frame has genuinely painted. Bubbles. */
24
+ export declare const POLITE_VIDEO_READY = "polite-video:ready";
25
+ /** Dispatched on the video when no source could be decoded. Bubbles. */
26
+ export declare const POLITE_VIDEO_FAILED = "polite-video:failed";
27
+ /** Dispatched on the image once it has decoded. Bubbles. */
28
+ export declare const POLITE_IMAGE_READY = "polite-image:ready";
29
+ /**
30
+ * Dispatched on `document` when the user pauses or resumes everything.
31
+ *
32
+ * The odd one out, and deliberately: a user pause is page-wide rather than about
33
+ * one video, so there is no element to dispatch it at and nothing for it to
34
+ * bubble through. Only `DocumentEventMap` is augmented for it.
35
+ *
36
+ * It exists because the alternative for a host is watching `data-polite-paused`
37
+ * on `<html>` with a MutationObserver, which is the same unreasonable ask this
38
+ * library avoids by maintaining `aria-pressed` itself. Without it, the
39
+ * label-swapping control the README offers as an option cannot be built.
40
+ */
41
+ export declare const POLITE_VIDEO_PAUSECHANGE = "polite-video:pausechange";
42
+ export interface PoliteVideoEventDetail {
43
+ /**
44
+ * The managed video. Saves casting `event.target`, which is the container
45
+ * rather than the video whenever the listener is on an ancestor.
46
+ */
47
+ video: HTMLVideoElement;
48
+ }
49
+ export interface PoliteImageEventDetail {
50
+ /** The managed image, for the same reason. */
51
+ image: HTMLImageElement;
52
+ }
53
+ export interface PolitePauseEventDetail {
54
+ /** True once the user has paused everything, false once they resume. */
55
+ paused: boolean;
56
+ }
57
+ declare global {
58
+ interface ElementEventMap {
59
+ 'polite-video:ready': CustomEvent<PoliteVideoEventDetail>;
60
+ 'polite-video:failed': CustomEvent<PoliteVideoEventDetail>;
61
+ 'polite-image:ready': CustomEvent<PoliteImageEventDetail>;
62
+ }
63
+ interface DocumentEventMap {
64
+ 'polite-video:ready': CustomEvent<PoliteVideoEventDetail>;
65
+ 'polite-video:failed': CustomEvent<PoliteVideoEventDetail>;
66
+ 'polite-image:ready': CustomEvent<PoliteImageEventDetail>;
67
+ 'polite-video:pausechange': CustomEvent<PolitePauseEventDetail>;
68
+ }
69
+ }
70
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,4DAA4D;AAC5D,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,6BAA6B,CAAC;AAEnE,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,eAAe;QACvB,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;QAC1D,qBAAqB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;QAC3D,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;KAC3D;IAED,UAAU,gBAAgB;QACxB,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;QAC1D,qBAAqB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;QAC3D,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;QAC1D,0BAA0B,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;KACjE;CACF"}
package/dist/events.js ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The events both halves dispatch, and the typing that makes them usable.
3
+ *
4
+ * Three pieces, because no one of them is sufficient on its own:
5
+ *
6
+ * - The **constants**, because a mistyped event name still compiles. lib.dom
7
+ * declares a fallback `addEventListener(type: string, ...)` overload, so
8
+ * `'polite-video:redy'` type-checks happily however the maps are augmented.
9
+ * - The **detail**, because these events bubble by design and the useful
10
+ * listener sits on a container, which makes `event.target` the wrong element
11
+ * or a bare `EventTarget` needing a cast.
12
+ * - The **augmentation**, so a listener gets `CustomEvent<Detail>` rather than
13
+ * `Event`.
14
+ *
15
+ * `ElementEventMap` and `DocumentEventMap` are the two that have to be patched,
16
+ * and not the more obvious `HTMLElementEventMap`. lib.dom declares
17
+ * `HTMLElementEventMap extends ElementEventMap`, so augmenting the base reaches
18
+ * `HTMLElement`, `HTMLMediaElement` and `HTMLVideoElement` through inheritance,
19
+ * while augmenting the derived one reaches none of its ancestors. `document` is
20
+ * a separate branch entirely -- `DocumentEventMap extends
21
+ * GlobalEventHandlersEventMap` -- so it needs its own entry.
22
+ */
23
+ /** Dispatched on the video once a frame has genuinely painted. Bubbles. */
24
+ export const POLITE_VIDEO_READY = 'polite-video:ready';
25
+ /** Dispatched on the video when no source could be decoded. Bubbles. */
26
+ export const POLITE_VIDEO_FAILED = 'polite-video:failed';
27
+ /** Dispatched on the image once it has decoded. Bubbles. */
28
+ export const POLITE_IMAGE_READY = 'polite-image:ready';
29
+ /**
30
+ * Dispatched on `document` when the user pauses or resumes everything.
31
+ *
32
+ * The odd one out, and deliberately: a user pause is page-wide rather than about
33
+ * one video, so there is no element to dispatch it at and nothing for it to
34
+ * bubble through. Only `DocumentEventMap` is augmented for it.
35
+ *
36
+ * It exists because the alternative for a host is watching `data-polite-paused`
37
+ * on `<html>` with a MutationObserver, which is the same unreasonable ask this
38
+ * library avoids by maintaining `aria-pressed` itself. Without it, the
39
+ * label-swapping control the README offers as an option cannot be built.
40
+ */
41
+ export const POLITE_VIDEO_PAUSECHANGE = 'polite-video:pausechange';
42
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAEzD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,0BAA0B,CAAC"}
package/dist/image.css ADDED
@@ -0,0 +1 @@
1
+ @media(scripting:enabled){img[data-polite-reveal]{opacity:0;transition:opacity var(--polite-fade, .35s) ease;animation:polite-reveal-failsafe 0s 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]{transition:none}}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @module
3
+ * Image reveal. Independent of the video module by design: an image needs no
4
+ * IntersectionObserver, no source negotiation and no playback arbitration, and
5
+ * it is not skipped on a metered connection the way video is -- you still have
6
+ * to show the picture.
7
+ *
8
+ * The point is the same as the video module's, applied to a different signal:
9
+ * reveal when pixels are ready, not when bytes arrived. `load` fires *before*
10
+ * decode, so fading on it can start against an undecoded bitmap and hitch.
11
+ * `HTMLImageElement.decode()` resolves when the image is actually paintable,
12
+ * which is the image analogue of requestVideoFrameCallback.
13
+ *
14
+ * Reduced motion is handled entirely in image.css: the image still reveals, it
15
+ * just does so instantly. No JS gate, because "show the picture without
16
+ * animating" is a pure styling concern.
17
+ */
18
+ import { type Target } from './targets.js';
19
+ /** Anything that names one or more images. See {@link Target}. */
20
+ export type ImageTarget = Target<HTMLImageElement>;
21
+ export interface RevealImagesOptions {
22
+ /**
23
+ * Manage images that are not `loading="lazy"`.
24
+ *
25
+ * Off by default because LCP excludes elements at `opacity: 0`, and revealing
26
+ * one does not restore its candidacy -- so fading an eager, above-the-fold
27
+ * image can forfeit the metric it was meant to improve. A lazy image was never
28
+ * an LCP candidate, so the default is risk-free.
29
+ *
30
+ * Turning this on is legitimate and sometimes right: an eager grid that would
31
+ * otherwise cut from its backdrop to the photo on whatever frame the async
32
+ * decode lands looks worse without a fade. It just has to be a decision rather
33
+ * than an accident.
34
+ */
35
+ allowEager?: boolean;
36
+ }
37
+ /**
38
+ * Reveals each matching image once it has decoded.
39
+ *
40
+ * Returns a function that stops any reveals still pending, for a client-side
41
+ * router tearing the page down before the images resolved.
42
+ */
43
+ export declare function revealImages(target: ImageTarget, options?: RevealImagesOptions): () => void;
44
+ export { POLITE_IMAGE_READY, type PoliteImageEventDetail } from './events.js';
45
+ //# sourceMappingURL=image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3D,kEAAkE;AAClE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEnD,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAmDD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,IAAI,CA0D/F;AAKD,OAAO,EAAE,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC"}
package/dist/image.js ADDED
@@ -0,0 +1,127 @@
1
+ /**
2
+ * @module
3
+ * Image reveal. Independent of the video module by design: an image needs no
4
+ * IntersectionObserver, no source negotiation and no playback arbitration, and
5
+ * it is not skipped on a metered connection the way video is -- you still have
6
+ * to show the picture.
7
+ *
8
+ * The point is the same as the video module's, applied to a different signal:
9
+ * reveal when pixels are ready, not when bytes arrived. `load` fires *before*
10
+ * decode, so fading on it can start against an undecoded bitmap and hitch.
11
+ * `HTMLImageElement.decode()` resolves when the image is actually paintable,
12
+ * which is the image analogue of requestVideoFrameCallback.
13
+ *
14
+ * Reduced motion is handled entirely in image.css: the image still reveals, it
15
+ * just does so instantly. No JS gate, because "show the picture without
16
+ * animating" is a pure styling concern.
17
+ */
18
+ import { POLITE_IMAGE_READY } from './events.js';
19
+ import { resolveTargets } from './targets.js';
20
+ const READY = 'data-polite-ready';
21
+ function markReady(image) {
22
+ image.setAttribute(READY, '');
23
+ image.dispatchEvent(new CustomEvent(POLITE_IMAGE_READY, {
24
+ bubbles: true,
25
+ detail: { image },
26
+ }));
27
+ }
28
+ /**
29
+ * Every image this module has taken responsibility for.
30
+ *
31
+ * A WeakSet rather than an attribute: the stylesheet no longer needs to know
32
+ * which images are managed, so writing it into the DOM would be state kept for
33
+ * nobody. Weak so a released image is not pinned by the bookkeeping.
34
+ */
35
+ const managed = new WeakSet();
36
+ let unmanagedCheck;
37
+ /**
38
+ * The failsafe in image.css keeps a stray image from vanishing, but silently.
39
+ * This is the half a developer can act on: it names the element and says which
40
+ * of the two mistakes was made.
41
+ *
42
+ * Debounced rather than run per call, because several `revealImages()` calls
43
+ * with different selectors are a normal way to set a page up and an image is
44
+ * only stray once all of them have had their chance. Rescheduling also means a
45
+ * client-side navigation gets its own check instead of one per page lifetime,
46
+ * which a once-only flag would have given.
47
+ */
48
+ function scheduleUnmanagedCheck() {
49
+ clearTimeout(unmanagedCheck);
50
+ unmanagedCheck = setTimeout(() => {
51
+ for (const image of document.querySelectorAll('img[data-polite-reveal]')) {
52
+ if (managed.has(image))
53
+ continue;
54
+ console.warn('polite-media: no revealImages() call manages this image, so the failsafe revealed ' +
55
+ 'it late and unfaded. Widen the selector, or drop data-polite-reveal.', image);
56
+ return;
57
+ }
58
+ }, 1000);
59
+ }
60
+ /**
61
+ * Reveals each matching image once it has decoded.
62
+ *
63
+ * Returns a function that stops any reveals still pending, for a client-side
64
+ * router tearing the page down before the images resolved.
65
+ */
66
+ export function revealImages(target, options = {}) {
67
+ const controller = new AbortController();
68
+ const { signal } = controller;
69
+ scheduleUnmanagedCheck();
70
+ for (const image of resolveTargets(target)) {
71
+ managed.add(image);
72
+ // Eager images are revealed at once rather than skipped.
73
+ //
74
+ // Skipping looks like the cautious choice and is the opposite: image.css
75
+ // has already hidden anything carrying data-polite-reveal, so declining to
76
+ // manage it leaves it invisible permanently instead of merely unfaded.
77
+ // Revealing immediately keeps the LCP candidate visible from its first
78
+ // paint, which is the whole reason eager images are treated differently.
79
+ //
80
+ // Tested against 'lazy' rather than for 'eager' deliberately. Engines
81
+ // disagree on what an absent or invalid attribute reports: MDN documents
82
+ // only 'eager' and 'lazy', while happy-dom returns 'auto'. Only "lazy" has
83
+ // one agreed spelling, so asking whether it is lazy is answerable
84
+ // everywhere, and everything else correctly falls into the eager branch.
85
+ if (!options.allowEager && image.loading !== 'lazy') {
86
+ markReady(image);
87
+ continue;
88
+ }
89
+ // A cached image is frequently already decoded before this module runs at
90
+ // all -- these are deferred scripts. Revealing on the next frame rather than
91
+ // synchronously lets the browser paint the hidden state first, so the
92
+ // transition still runs instead of snapping.
93
+ if (image.complete && image.naturalWidth > 0) {
94
+ requestAnimationFrame(() => {
95
+ if (!signal.aborted)
96
+ markReady(image);
97
+ });
98
+ continue;
99
+ }
100
+ image
101
+ .decode()
102
+ .then(() => {
103
+ if (!signal.aborted)
104
+ markReady(image);
105
+ })
106
+ .catch(() => {
107
+ // decode() rejects with EncodingError when `src` changes mid-flight,
108
+ // which a responsive `srcset` genuinely does on resize, and on a real
109
+ // decode failure. Either way the image must not be left hidden: `load`
110
+ // is the weaker signal, and no reveal at all is worse than an early one.
111
+ if (signal.aborted)
112
+ return;
113
+ if (image.complete) {
114
+ markReady(image);
115
+ return;
116
+ }
117
+ image.addEventListener('load', () => markReady(image), { once: true, signal });
118
+ image.addEventListener('error', () => markReady(image), { once: true, signal });
119
+ });
120
+ }
121
+ return () => controller.abort();
122
+ }
123
+ // Re-exported so `polite-media/image` carries the ElementEventMap and
124
+ // DocumentEventMap augmentation too: it only reaches a consumer whose program
125
+ // includes the module that declares it.
126
+ export { POLITE_IMAGE_READY } from './events.js';
127
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.js","sourceRoot":"","sources":["../src/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,kBAAkB,EAA+B,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAe,MAAM,cAAc,CAAC;AAsB3D,MAAM,KAAK,GAAG,mBAAmB,CAAC;AAElC,SAAS,SAAS,CAAC,KAAuB;IACxC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC9B,KAAK,CAAC,aAAa,CACjB,IAAI,WAAW,CAAyB,kBAAkB,EAAE;QA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}[data-polite-media]>:is(img,video),[data-polite-media]>picture>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The library's core primitive: fire once a frame has genuinely reached the
3
+ * compositor.
4
+ *
5
+ * The obvious signal, the `playing` event, is wrong -- and measurably wrong in
6
+ * both directions rather than merely early. On one machine in one run
7
+ * H.264 presented its first frame 1.6 ms *before* `playing`,
8
+ * while AV1 presented 0.8 ms *after*. So revealing on `playing` either flashes
9
+ * (poster removed before anything painted) or lingers (poster held over a frame
10
+ * that already painted), and which one you get depends on the codec, so no delay
11
+ * can tune it away.
12
+ *
13
+ * `requestVideoFrameCallback` is specified in terms of a frame being sent to the
14
+ * compositor, making it correct by definition rather than by timing.
15
+ */
16
+ /**
17
+ * Calls `onPainted` once, when a frame is on screen.
18
+ *
19
+ * Returns a cancel function. Cancelling matters: a video can be unregistered
20
+ * (scrolled out of view, a router navigation) before its first frame ever
21
+ * arrives, and a reveal firing afterwards would un-hide a layer whose element is
22
+ * already gone.
23
+ *
24
+ * Cancellation does two things on the two rungs that can still be pending. The
25
+ * `done` flag is the correctness guarantee, so `cancel()` means "will not fire"
26
+ * however the underlying mechanism behaves; the platform call beside it
27
+ * (`cancelVideoFrameCallback`, `removeEventListener`) is resource release. They
28
+ * overlap on the `loadeddata` rung, where removing the listener would be enough
29
+ * on its own -- the price of `cancel()` meaning one thing rather than three
30
+ * subtly different things. On the `readyState` rung there is nothing to cancel:
31
+ * it has already fired synchronously by the time the caller holds the function.
32
+ */
33
+ export declare function revealWhenPainted(video: HTMLVideoElement, onPainted: () => void): () => void;
34
+ //# sourceMappingURL=reveal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal.d.ts","sourceRoot":"","sources":["../src/reveal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAmC5F"}
package/dist/reveal.js ADDED
@@ -0,0 +1,72 @@
1
+ /**
2
+ * The library's core primitive: fire once a frame has genuinely reached the
3
+ * compositor.
4
+ *
5
+ * The obvious signal, the `playing` event, is wrong -- and measurably wrong in
6
+ * both directions rather than merely early. On one machine in one run
7
+ * H.264 presented its first frame 1.6 ms *before* `playing`,
8
+ * while AV1 presented 0.8 ms *after*. So revealing on `playing` either flashes
9
+ * (poster removed before anything painted) or lingers (poster held over a frame
10
+ * that already painted), and which one you get depends on the codec, so no delay
11
+ * can tune it away.
12
+ *
13
+ * `requestVideoFrameCallback` is specified in terms of a frame being sent to the
14
+ * compositor, making it correct by definition rather than by timing.
15
+ */
16
+ /**
17
+ * `HTMLMediaElement.HAVE_CURRENT_DATA`. Inlined rather than read off the global
18
+ * so this module never touches `HTMLMediaElement`, which does not exist in Node.
19
+ */
20
+ const HAVE_CURRENT_DATA = 2;
21
+ /**
22
+ * Calls `onPainted` once, when a frame is on screen.
23
+ *
24
+ * Returns a cancel function. Cancelling matters: a video can be unregistered
25
+ * (scrolled out of view, a router navigation) before its first frame ever
26
+ * arrives, and a reveal firing afterwards would un-hide a layer whose element is
27
+ * already gone.
28
+ *
29
+ * Cancellation does two things on the two rungs that can still be pending. The
30
+ * `done` flag is the correctness guarantee, so `cancel()` means "will not fire"
31
+ * however the underlying mechanism behaves; the platform call beside it
32
+ * (`cancelVideoFrameCallback`, `removeEventListener`) is resource release. They
33
+ * overlap on the `loadeddata` rung, where removing the listener would be enough
34
+ * on its own -- the price of `cancel()` meaning one thing rather than three
35
+ * subtly different things. On the `readyState` rung there is nothing to cancel:
36
+ * it has already fired synchronously by the time the caller holds the function.
37
+ */
38
+ export function revealWhenPainted(video, onPainted) {
39
+ let done = false;
40
+ const fire = () => {
41
+ if (done)
42
+ return;
43
+ done = true;
44
+ onPainted();
45
+ };
46
+ // lib.dom declares requestVideoFrameCallback as always present, but it is only
47
+ // Baseline as of October 2024, so the types are more optimistic than reality
48
+ // and the runtime check is doing real work on older browsers.
49
+ if (typeof video.requestVideoFrameCallback === 'function') {
50
+ const handle = video.requestVideoFrameCallback(fire);
51
+ return () => {
52
+ done = true;
53
+ video.cancelVideoFrameCallback(handle);
54
+ };
55
+ }
56
+ // Both fallbacks are strictly weaker signals. HAVE_CURRENT_DATA means "data
57
+ // exists for the current playback position", which is a decode-side fact and
58
+ // says nothing about whether pixels have been presented. Accepted only because
59
+ // the alternative on these browsers is no reveal at all.
60
+ if (video.readyState >= HAVE_CURRENT_DATA) {
61
+ fire();
62
+ return () => {
63
+ done = true;
64
+ };
65
+ }
66
+ video.addEventListener('loadeddata', fire, { once: true });
67
+ return () => {
68
+ done = true;
69
+ video.removeEventListener('loadeddata', fire);
70
+ };
71
+ }
72
+ //# sourceMappingURL=reveal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal.js","sourceRoot":"","sources":["../src/reveal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAuB,EAAE,SAAqB;IAC9E,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,MAAM,IAAI,GAAG,GAAS,EAAE;QACtB,IAAI,IAAI;YAAE,OAAO;QACjB,IAAI,GAAG,IAAI,CAAC;QACZ,SAAS,EAAE,CAAC;IACd,CAAC,CAAC;IAEF,+EAA+E;IAC/E,6EAA6E;IAC7E,8DAA8D;IAC9D,IAAI,OAAO,KAAK,CAAC,yBAAyB,KAAK,UAAU,EAAE,CAAC;QAC1D,MAAM,MAAM,GAAG,KAAK,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QACrD,OAAO,GAAG,EAAE;YACV,IAAI,GAAG,IAAI,CAAC;YACZ,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,6EAA6E;IAC7E,+EAA+E;IAC/E,yDAAyD;IACzD,IAAI,KAAK,CAAC,UAAU,IAAI,iBAAiB,EAAE,CAAC;QAC1C,IAAI,EAAE,CAAC;QACP,OAAO,GAAG,EAAE;YACV,IAAI,GAAG,IAAI,CAAC;QACd,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,OAAO,GAAG,EAAE;QACV,IAAI,GAAG,IAAI,CAAC;QACZ,KAAK,CAAC,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Whether an error means "this file is unusable, try another" as opposed to
3
+ * "something happened to this attempt".
4
+ *
5
+ * Codes matter here. `MEDIA_ERR_ABORTED` (1) is what the element reports when
6
+ * its `src` is reassigned -- which this module does itself -- so treating every
7
+ * error as fatal would cascade through the whole candidate list on the first
8
+ * assignment. `MEDIA_ERR_NETWORK` (2) means the fetch failed on a resource that
9
+ * was previously fine; another candidate is unlikely to fare better on the same
10
+ * connection, and burning the list would leave nothing to retry with.
11
+ */
12
+ export declare function isUnusable(error: MediaError | null): boolean;
13
+ export interface SourceManager {
14
+ /** Loads the best remaining candidate. False when none are left to try. */
15
+ select(): boolean;
16
+ /** Discards the current candidate and loads the next. False when exhausted. */
17
+ advance(): boolean;
18
+ }
19
+ export declare function manageSources(video: HTMLVideoElement): SourceManager;
20
+ /** Internal reset for tests. Not exported from the package entry point. */
21
+ export declare function resetSourceWarnings(): void;
22
+ //# sourceMappingURL=sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../src/sources.ts"],"names":[],"mappings":"AAkCA;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,OAAO,CAG5D;AAED,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,MAAM,IAAI,OAAO,CAAC;IAClB,+EAA+E;IAC/E,OAAO,IAAI,OAAO,CAAC;CACpB;AAoED,wBAAgB,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,aAAa,CAmCpE;AAED,2EAA2E;AAC3E,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}