@hyperframes/core 0.9.44 → 0.9.46

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.
@@ -29,4 +29,6 @@ export type PreviewSourceFacts = {
29
29
  export declare const HEAVY_PIXEL_SHARE = 0.5;
30
30
  export declare const HEAVY_BITRATE = 40000000;
31
31
  export declare function scalePreviewProxyBox(box: PreviewProxyBox, level: PreviewQuality): PreviewProxyBox;
32
+ export declare function isOversizedForPreview(facts: PreviewSourceFacts, box: PreviewProxyBox): boolean;
32
33
  export declare function isHeavyForPreview(facts: PreviewSourceFacts, copyBox: PreviewProxyBox): boolean;
34
+ export declare function wantsLighterCopy(facts: PreviewSourceFacts, box: PreviewProxyBox, level: PreviewQuality): boolean;
@@ -42,8 +42,12 @@ export const HEAVY_BITRATE = 40_000_000;
42
42
  export function scalePreviewProxyBox(box, level) {
43
43
  return quantizePreviewProxyBox(box.width * level, box.height * level) ?? box;
44
44
  }
45
+ export function isOversizedForPreview(facts, box) {
46
+ return box.width * box.height <= HEAVY_PIXEL_SHARE * facts.width * facts.height;
47
+ }
45
48
  export function isHeavyForPreview(facts, copyBox) {
46
- return (copyBox.width * copyBox.height <= HEAVY_PIXEL_SHARE * facts.width * facts.height ||
47
- facts.bitDepth > 8 ||
48
- facts.bitrate >= HEAVY_BITRATE);
49
+ return (isOversizedForPreview(facts, copyBox) || facts.bitDepth > 8 || facts.bitrate >= HEAVY_BITRATE);
50
+ }
51
+ export function wantsLighterCopy(facts, box, level) {
52
+ return level < 1 ? isHeavyForPreview(facts, box) : isOversizedForPreview(facts, box);
49
53
  }
@@ -1,5 +1,14 @@
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
+ /** Media elements the runtime opened at their in-point: the src the author wrote, the one written in its
4
+ * place (null while the clip is held with no src until it is due), and whether it is held again when idle. */
5
+ type InPointRecord = {
6
+ authored: string;
7
+ written: string | null;
8
+ holdsWhenIdle: boolean;
9
+ };
10
+ export declare const inPointOf: (el: Element) => InPointRecord | undefined;
11
+ export declare const heldForCopy: WeakMap<Element, InPointRecord | undefined>;
3
12
  export declare function recordOpenedAtInPoint(el: Element, authored: string, written: string | null, holdsWhenIdle?: boolean): void;
4
13
  /** True for a clip the runtime holds whenever it is not due, while its src is still the runtime's. */
5
14
  export declare function holdsWhenIdle(el: Element): boolean;
@@ -15,3 +24,4 @@ export declare const heldPosters: WeakMap<Element, {
15
24
  export declare function unheldPoster(el: Element): string | null;
16
25
  /** The video shows a still while its new copy loads, so the film need not wait for it. */
17
26
  export declare function stillStandsIn(el: Element): boolean;
27
+ export {};
@@ -1,8 +1,8 @@
1
1
  /** Media elements swapped to their proxy, each with the src attribute it had before the swap. */
2
2
  export const swappedElements = new WeakMap();
3
- /** Media elements the runtime opened at their in-point: the src the author wrote, the one written in its
4
- * place (null while the clip is held with no src until it is due), and whether it is held again when idle. */
5
3
  const openedAtInPoint = new WeakMap();
4
+ export const inPointOf = (el) => openedAtInPoint.get(el);
5
+ export const heldForCopy = new WeakMap();
6
6
  export function recordOpenedAtInPoint(el, authored, written, holdsWhenIdle = openedAtInPoint.get(el)?.holdsWhenIdle ?? false) {
7
7
  openedAtInPoint.set(el, { authored, written, holdsWhenIdle });
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.9.44",
3
+ "version": "0.9.46",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -449,9 +449,9 @@
449
449
  "linkedom": "^0.18.12",
450
450
  "postcss": "^8.5.8",
451
451
  "wawoff2": "^2.0.1",
452
- "@hyperframes/studio-server": "0.9.44",
453
- "@hyperframes/parsers": "0.9.44",
454
- "@hyperframes/lint": "0.9.44"
452
+ "@hyperframes/studio-server": "0.9.46",
453
+ "@hyperframes/lint": "0.9.46",
454
+ "@hyperframes/parsers": "0.9.46"
455
455
  },
456
456
  "devDependencies": {
457
457
  "@fontsource/archivo-black": "^5.2.8",