@hyperframes/core 0.8.227 → 0.8.228

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.
@@ -1,6 +1,11 @@
1
1
  /** Media elements swapped to their proxy, each with the src attribute it had before the swap. */
2
2
  export declare const swappedElements: WeakMap<Element, string | null>;
3
3
  export declare function unproxiedSrc(el: Element): string | null;
4
- /** Videos showing a still of their last frame as poster across a copy swap, each with the poster it had before. */
5
- export declare const heldPosters: WeakMap<Element, string | null>;
4
+ /** Videos showing a still of their last frame as poster across a copy swap: the poster they had before, and when. */
5
+ export declare const heldPosters: WeakMap<Element, {
6
+ poster: string | null;
7
+ since: number;
8
+ }>;
6
9
  export declare function unheldPoster(el: Element): string | null;
10
+ /** The video shows a still while its new copy loads, so the film need not wait for it. */
11
+ export declare function stillStandsIn(el: Element): boolean;
@@ -3,8 +3,14 @@ export const swappedElements = new WeakMap();
3
3
  export function unproxiedSrc(el) {
4
4
  return swappedElements.has(el) ? (swappedElements.get(el) ?? null) : el.getAttribute("src");
5
5
  }
6
- /** Videos showing a still of their last frame as poster across a copy swap, each with the poster it had before. */
6
+ /** Videos showing a still of their last frame as poster across a copy swap: the poster they had before, and when. */
7
7
  export const heldPosters = new WeakMap();
8
8
  export function unheldPoster(el) {
9
- return heldPosters.has(el) ? (heldPosters.get(el) ?? null) : el.getAttribute("poster");
9
+ return heldPosters.has(el) ? (heldPosters.get(el)?.poster ?? null) : el.getAttribute("poster");
10
+ }
11
+ const STILL_STANDS_IN_MS = 2000;
12
+ /** The video shows a still while its new copy loads, so the film need not wait for it. */
13
+ export function stillStandsIn(el) {
14
+ const held = heldPosters.get(el);
15
+ return held !== undefined && performance.now() - held.since < STILL_STANDS_IN_MS;
10
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.8.227",
3
+ "version": "0.8.228",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -429,9 +429,9 @@
429
429
  "linkedom": "^0.18.12",
430
430
  "postcss": "^8.5.8",
431
431
  "wawoff2": "^2.0.1",
432
- "@hyperframes/lint": "0.8.227",
433
- "@hyperframes/parsers": "0.8.227",
434
- "@hyperframes/studio-server": "0.8.227"
432
+ "@hyperframes/parsers": "0.8.228",
433
+ "@hyperframes/lint": "0.8.228",
434
+ "@hyperframes/studio-server": "0.8.228"
435
435
  },
436
436
  "devDependencies": {
437
437
  "@fontsource/archivo-black": "^5.2.8",