@hyperframes/core 0.8.202 → 0.8.204

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/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ export { clearGifFramesBeforeNext, gifClearsAfterLeavingFrameInPlace, parseAnima
33
33
  export { HF_COLOR_GRADING_ATTR, HF_COLOR_GRADING_ADJUST_KEYS, HF_COLOR_GRADING_ACTIVE_EFFECT_KEYS, HF_COLOR_GRADING_ANIMATABLE_PROPERTIES, HF_COLOR_GRADING_CANVAS_ID_PREFIX, HF_COLOR_GRADING_COLOR_SPACE, HF_COLOR_GRADING_CURVE_KEYS, HF_COLOR_GRADING_DETAIL_KEYS, HF_COLOR_GRADING_EFFECT_APPLY_DEFAULTS, HF_COLOR_GRADING_EFFECT_KEYS, HF_COLOR_GRADING_EFFECT_PRESETS, HF_COLOR_GRADING_GRADE_PRESETS, HF_COLOR_GRADING_HUE_CURVE_KEYS, HF_COLOR_GRADING_LUT_KEYS, HF_COLOR_GRADING_PALETTES, HF_COLOR_GRADING_PRESETS, HF_COLOR_GRADING_TOP_LEVEL_KEYS, HF_COLOR_GRADING_WHEEL_KEYS, getHfColorGradingCapabilities, hasHfColorGradingAuthoredValues, isHfColorGradingActive, normalizeHfColorGrading, normalizeHfColorGradingWithVariables, resolveHfColorGradingVariables, serializeHfColorGrading, type HfColorGrading, type HfColorGradingAdjust, type HfColorGradingAdjustKey, type HfColorGradingAnimatablePath, type HfColorGradingActiveEffectKey, type HfColorGradingDetailKey, type HfColorGradingDetails, type HfColorGradingEffectKey, type HfColorGradingEffects, type HfColorGradingLutRef, type HfColorGradingPreset, type HfColorGradingPresetId, type HfColorGradingTarget, type HfColorGradingVariableMap, type HfColorGradingCapabilities, type HfColorGradingCurveKey, type HfColorGradingCurves, type HfColorGradingHueCurveKey, type HfColorGradingHueCurves, type HfColorGradingHueRange, type HfColorGradingSecondary, type HfColorGradingSecondaryCorrection, type HfColorGradingSoftRange, type HfColorGradingTonalWheel, type HfColorGradingWheelKey, type HfColorGradingWheels, type HfColorCurvePoint, type HfHueCurvePoint, type NormalizedHfColorGrading, type NormalizedHfColorGradingCurves, type NormalizedHfColorGradingHueCurves, type NormalizedHfColorGradingSecondary, type NormalizedHfColorGradingWheels, type ResolvedHfColorGrading, } from "./colorGrading.js";
34
34
  export { parseCubeLut, CubeLutParseError, type ParseCubeLutOptions } from "./colorLuts.js";
35
35
  export { firstFrameColourArgs, hdrToSdrToneMapFilter, parseFirstFrameColour, type ToneMapSourceColour, } from "./hdrToneMap.js";
36
- export { HEAVY_BITRATE, HEAVY_PIXEL_SHARE, PREVIEW_PROXY_BOX_PARAM, PREVIEW_PROXY_LIGHT_PARAM, PREVIEW_QUALITY_LEVELS, formatPreviewProxyBox, isHeavyForPreview, isPreviewQuality, parsePreviewProxyBox, quantizePreviewProxyBox, scalePreviewProxyBox, type PreviewProxyBox, type PreviewQuality, type PreviewSourceFacts, } from "./previewProxyBox.js";
36
+ export { HEAVY_BITRATE, HEAVY_PIXEL_SHARE, PREVIEW_PROXY_BOX_PARAM, PREVIEW_PROXY_LIGHT_PARAM, PREVIEW_PROXY_PROGRESS_HEADER, PREVIEW_PROXY_RETRY_PARAM, PREVIEW_QUALITY_LEVELS, formatPreviewProxyBox, isHeavyForPreview, isPreviewQuality, parsePreviewProxyBox, quantizePreviewProxyBox, scalePreviewProxyBox, type PreviewProxyBox, type PreviewQuality, type PreviewSourceFacts, } from "./previewProxyBox.js";
37
37
  export { HYPERFRAME_RUNTIME_ARTIFACTS, HYPERFRAME_RUNTIME_CONTRACT, loadHyperframeRuntimeSource, type HyperframeRuntimeContract, } from "./inline-scripts/hyperframe.js";
38
38
  export { HYPERFRAME_RUNTIME_GLOBALS, HYPERFRAME_BRIDGE_SOURCES, HYPERFRAME_CONTROL_ACTIONS, type HyperframeControlAction, } from "./inline-scripts/runtimeContract.js";
39
39
  export { getHyperframeRuntimeScript } from "./generated/runtime-inline.js";
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ export { clearGifFramesBeforeNext, gifClearsAfterLeavingFrameInPlace, parseAnima
29
29
  export { HF_COLOR_GRADING_ATTR, HF_COLOR_GRADING_ADJUST_KEYS, HF_COLOR_GRADING_ACTIVE_EFFECT_KEYS, HF_COLOR_GRADING_ANIMATABLE_PROPERTIES, HF_COLOR_GRADING_CANVAS_ID_PREFIX, HF_COLOR_GRADING_COLOR_SPACE, HF_COLOR_GRADING_CURVE_KEYS, HF_COLOR_GRADING_DETAIL_KEYS, HF_COLOR_GRADING_EFFECT_APPLY_DEFAULTS, HF_COLOR_GRADING_EFFECT_KEYS, HF_COLOR_GRADING_EFFECT_PRESETS, HF_COLOR_GRADING_GRADE_PRESETS, HF_COLOR_GRADING_HUE_CURVE_KEYS, HF_COLOR_GRADING_LUT_KEYS, HF_COLOR_GRADING_PALETTES, HF_COLOR_GRADING_PRESETS, HF_COLOR_GRADING_TOP_LEVEL_KEYS, HF_COLOR_GRADING_WHEEL_KEYS, getHfColorGradingCapabilities, hasHfColorGradingAuthoredValues, isHfColorGradingActive, normalizeHfColorGrading, normalizeHfColorGradingWithVariables, resolveHfColorGradingVariables, serializeHfColorGrading, } from "./colorGrading.js";
30
30
  export { parseCubeLut, CubeLutParseError } from "./colorLuts.js";
31
31
  export { firstFrameColourArgs, hdrToSdrToneMapFilter, parseFirstFrameColour, } from "./hdrToneMap.js";
32
- export { HEAVY_BITRATE, HEAVY_PIXEL_SHARE, PREVIEW_PROXY_BOX_PARAM, PREVIEW_PROXY_LIGHT_PARAM, PREVIEW_QUALITY_LEVELS, formatPreviewProxyBox, isHeavyForPreview, isPreviewQuality, parsePreviewProxyBox, quantizePreviewProxyBox, scalePreviewProxyBox, } from "./previewProxyBox.js";
32
+ export { HEAVY_BITRATE, HEAVY_PIXEL_SHARE, PREVIEW_PROXY_BOX_PARAM, PREVIEW_PROXY_LIGHT_PARAM, PREVIEW_PROXY_PROGRESS_HEADER, PREVIEW_PROXY_RETRY_PARAM, PREVIEW_QUALITY_LEVELS, formatPreviewProxyBox, isHeavyForPreview, isPreviewQuality, parsePreviewProxyBox, quantizePreviewProxyBox, scalePreviewProxyBox, } from "./previewProxyBox.js";
33
33
  // Inline scripts
34
34
  export { HYPERFRAME_RUNTIME_ARTIFACTS, HYPERFRAME_RUNTIME_CONTRACT, loadHyperframeRuntimeSource, } from "./inline-scripts/hyperframe.js";
35
35
  export { HYPERFRAME_RUNTIME_GLOBALS, HYPERFRAME_BRIDGE_SOURCES, HYPERFRAME_CONTROL_ACTIONS, } from "./inline-scripts/runtimeContract.js";
@@ -1,6 +1,8 @@
1
1
  /** Query parameter carrying the largest box, in device pixels, a preview shows a proxied video at. */
2
2
  export declare const PREVIEW_PROXY_BOX_PARAM = "hf-proxy-box";
3
3
  export declare const PREVIEW_PROXY_LIGHT_PARAM = "hf-proxy-light";
4
+ export declare const PREVIEW_PROXY_RETRY_PARAM = "hf-proxy-retry";
5
+ export declare const PREVIEW_PROXY_PROGRESS_HEADER = "X-HF-Proxy-Progress";
4
6
  export type PreviewProxyBox = {
5
7
  width: number;
6
8
  height: number;
@@ -18,6 +20,7 @@ export type PreviewSourceFacts = {
18
20
  height: number;
19
21
  bitDepth: number;
20
22
  bitrate: number;
23
+ codec?: string;
21
24
  };
22
25
  export declare const HEAVY_PIXEL_SHARE = 0.5;
23
26
  export declare const HEAVY_BITRATE = 40000000;
@@ -1,6 +1,8 @@
1
1
  /** Query parameter carrying the largest box, in device pixels, a preview shows a proxied video at. */
2
2
  export const PREVIEW_PROXY_BOX_PARAM = "hf-proxy-box";
3
3
  export const PREVIEW_PROXY_LIGHT_PARAM = "hf-proxy-light";
4
+ export const PREVIEW_PROXY_RETRY_PARAM = "hf-proxy-retry";
5
+ export const PREVIEW_PROXY_PROGRESS_HEADER = "X-HF-Proxy-Progress";
4
6
  // 256 * 2^(k/4), even: nearby boxes share one cached copy, and a rung overshoots by at most ~19%.
5
7
  const RUNGS = [
6
8
  256, 304, 362, 430, 512, 608, 724, 862, 1024, 1218, 1448, 1722, 2048, 2436, 2896, 3444, 4096,
@@ -23,6 +23,8 @@ type BridgeDeps = {
23
23
  onClearRuntimeData?: (channel: string, requestId?: number) => void;
24
24
  onSetDisplayScale?: (scale: number) => void;
25
25
  onSetPreviewQuality?: (level: number) => void;
26
+ onRetryPreviewCopies?: () => void;
27
+ onRequestPreviewFacts?: () => void;
26
28
  getCanonicalFps: () => number;
27
29
  };
28
30
  export declare function setRuntimeProtocolFps(fps: number): void;
@@ -31,6 +31,8 @@ const CONTROL_HANDLERS = new Map(Object.entries({
31
31
  "set-idle-heartbeat": (data, deps) => deps.onSetIdleHeartbeat(Boolean(data.slow)),
32
32
  "set-display-scale": (data, deps) => deps.onSetDisplayScale?.(Number(data.scale)),
33
33
  "set-preview-quality": (data, deps) => deps.onSetPreviewQuality?.(Number(data.level)),
34
+ "retry-preview-copies": (_d, deps) => deps.onRetryPreviewCopies?.(),
35
+ "request-preview-facts": (_d, deps) => deps.onRequestPreviewFacts?.(),
34
36
  "set-root-duration": (data, deps) => deps.onSetRootDuration(Number(data.durationSeconds ?? 0)),
35
37
  "set-play-range": (data, deps) => deps.onSetPlayRange(Number(data.startSeconds ?? 0), data.endSeconds == null ? null : Number(data.endSeconds)),
36
38
  "set-color-grading": (data, deps) => deps.onSetColorGrading(data.target ?? null, data.grading ?? null),
@@ -1,5 +1,5 @@
1
- /** The visibility pass's mark on a timed clip it hides; the runtime's rules hide the clip's contents by it. */
2
- export declare const CLIP_HIDDEN_ATTR = "data-hf-clip-hidden";
1
+ import { CLIP_HIDDEN_ATTR } from "../studioPreviewMark.js";
2
+ export { CLIP_HIDDEN_ATTR };
3
3
  /** Shows a clip the visibility pass hid, contents included; returns a function that puts the mark back. */
4
4
  export declare function revealClip(el: Element & ElementCSSInlineStyle, priority?: string): () => void;
5
5
  /** Called by shader-transitions builds on load: their revealers go through revealClip. */
@@ -1,5 +1,5 @@
1
- /** The visibility pass's mark on a timed clip it hides; the runtime's rules hide the clip's contents by it. */
2
- export const CLIP_HIDDEN_ATTR = "data-hf-clip-hidden";
1
+ import { CLIP_HIDDEN_ATTR } from "../studioPreviewMark.js";
2
+ export { CLIP_HIDDEN_ATTR };
3
3
  /** Shows a clip the visibility pass hid, contents included; returns a function that puts the mark back. */
4
4
  export function revealClip(el, priority = "") {
5
5
  el.style.setProperty("visibility", "visible", priority);
@@ -6,7 +6,7 @@ export type RuntimeJson = string | number | boolean | null | RuntimeJson[] | {
6
6
  import type { HyperframeControlAction } from "../inline-scripts/runtimeContract.js";
7
7
  import type { HyperframePickerElementInfo } from "../inline-scripts/pickerApi.js";
8
8
  import type { RuntimeProtocolV1 } from "./protocol.js";
9
- type RuntimeBridgeControlActionBase = HyperframeControlAction | "tick" | "set-volume" | "set-media-output-muted" | "set-native-media-sync-disabled" | "set-web-audio-media-disabled" | "set-idle-heartbeat" | "set-display-scale" | "set-preview-quality" | "set-root-duration" | "set-play-range" | "stop-media" | "flash-elements";
9
+ type RuntimeBridgeControlActionBase = HyperframeControlAction | "tick" | "set-volume" | "set-media-output-muted" | "set-native-media-sync-disabled" | "set-web-audio-media-disabled" | "set-idle-heartbeat" | "set-display-scale" | "set-preview-quality" | "retry-preview-copies" | "request-preview-facts" | "set-root-duration" | "set-play-range" | "stop-media" | "flash-elements";
10
10
  type RuntimeBridgeControlMessageBase = {
11
11
  source: "hf-parent";
12
12
  type: "control";
@@ -212,7 +212,51 @@ export type RuntimeGroupLevelsMessage = {
212
212
  clipped: boolean;
213
213
  }>;
214
214
  };
215
- export type RuntimeOutboundMessage = RuntimeStateMessage | RuntimeTimelineMessage | RuntimeDiagnosticMessage | RuntimePickerHoveredMessage | RuntimePickerCandidatesMessage | RuntimePickerPickedMessage | RuntimePickerPickedManyMessage | RuntimePickerCancelledMessage | RuntimeStageSizeMessage | RuntimeMediaAutoplayBlockedMessage | RuntimeReadyMessage | RuntimeAssetsReadyMessage | RuntimeDataErrorMessage | RuntimeDataAppliedMessage | RuntimeAnalyticsMessage | RuntimePerformanceMessage | RuntimeGroupLevelsMessage;
215
+ export type RuntimePreviewCopiesMessage = {
216
+ source: "hf-preview";
217
+ type: "preview-copies";
218
+ /** The lighter copies wanted at the current quality; null when none are. */
219
+ copies: {
220
+ total: number;
221
+ ready: number;
222
+ failed: number;
223
+ progress: number;
224
+ error: string | null;
225
+ } | null;
226
+ };
227
+ export type RuntimePreviewHealthMessage = {
228
+ source: "hf-preview";
229
+ type: "preview-health";
230
+ /** How playback went over the last few seconds of play; null while paused, seeking or warming up. */
231
+ health: {
232
+ droppedShare: number;
233
+ seconds: number;
234
+ choppy: boolean;
235
+ fps: number;
236
+ worstFrameMs: number;
237
+ mode: "play";
238
+ } | null;
239
+ };
240
+ export type RuntimePreviewFactsMessage = {
241
+ source: "hf-preview";
242
+ type: "preview-facts";
243
+ facts: {
244
+ sceneCount: number;
245
+ mountedElementCount: number;
246
+ durationSeconds: number;
247
+ videos: Array<{
248
+ codec: string;
249
+ width: number;
250
+ height: number;
251
+ bitDepth: number;
252
+ count: number;
253
+ }>;
254
+ /** The lower levels at which at least one video gets a lighter copy. */
255
+ lighterAt: number[];
256
+ copiesReady: boolean;
257
+ };
258
+ };
259
+ export type RuntimeOutboundMessage = RuntimeStateMessage | RuntimePreviewCopiesMessage | RuntimePreviewHealthMessage | RuntimePreviewFactsMessage | RuntimeTimelineMessage | RuntimeDiagnosticMessage | RuntimePickerHoveredMessage | RuntimePickerCandidatesMessage | RuntimePickerPickedMessage | RuntimePickerPickedManyMessage | RuntimePickerCancelledMessage | RuntimeStageSizeMessage | RuntimeMediaAutoplayBlockedMessage | RuntimeReadyMessage | RuntimeAssetsReadyMessage | RuntimeDataErrorMessage | RuntimeDataAppliedMessage | RuntimeAnalyticsMessage | RuntimePerformanceMessage | RuntimeGroupLevelsMessage;
216
260
  export type HeldSeek = Promise<void> | void;
217
261
  export type RuntimePlayer = {
218
262
  _timeline: RuntimeTimelineLike | null;
@@ -5,7 +5,9 @@ export declare const STUDIO_PREVIEW_LAZY_ATTR = "data-hf-preview-lazy";
5
5
  export declare const STUDIO_PREVIEW_ERRORS = "__hfPreviewErrors";
6
6
  export declare const PREVIEW_RASTER_ATTR = "data-hf-preview-raster";
7
7
  export declare const RUNTIME_STAMPED_ATTR = "data-hf-autostamped";
8
+ export declare const CLIP_HIDDEN_ATTR = "data-hf-clip-hidden";
8
9
  export declare const STUDIO_PREVIEW_FAR_SCENE_ATTR = "data-hf-far-scene";
9
10
  export declare const STUDIO_PREVIEW_PARKED_SCENE_ATTR = "data-hf-parked-scene";
10
11
  export declare const PREVIEW_ONLY_ATTRS: readonly ["data-hf-upcoming", "data-hf-far-scene", "data-hf-parked-scene", "data-hf-preview-lazy", "data-hf-preview-raster", "data-hf-autostamped"];
12
+ export declare const isClipHiddenByRuntime: (el: HTMLElement) => boolean;
11
13
  export declare function applyAuthoredTiming(el: Element, attrs: ReadonlyArray<readonly [name: string, value: string]>): void;
@@ -5,6 +5,7 @@ export const STUDIO_PREVIEW_LAZY_ATTR = "data-hf-preview-lazy";
5
5
  export const STUDIO_PREVIEW_ERRORS = "__hfPreviewErrors";
6
6
  export const PREVIEW_RASTER_ATTR = "data-hf-preview-raster";
7
7
  export const RUNTIME_STAMPED_ATTR = "data-hf-autostamped";
8
+ export const CLIP_HIDDEN_ATTR = "data-hf-clip-hidden";
8
9
  export const STUDIO_PREVIEW_FAR_SCENE_ATTR = "data-hf-far-scene";
9
10
  export const STUDIO_PREVIEW_PARKED_SCENE_ATTR = "data-hf-parked-scene";
10
11
  export const PREVIEW_ONLY_ATTRS = [
@@ -15,6 +16,7 @@ export const PREVIEW_ONLY_ATTRS = [
15
16
  PREVIEW_RASTER_ATTR,
16
17
  RUNTIME_STAMPED_ATTR,
17
18
  ];
19
+ export const isClipHiddenByRuntime = (el) => el.hasAttribute(CLIP_HIDDEN_ATTR) && el.style.visibility === "hidden";
18
20
  export function applyAuthoredTiming(el, attrs) {
19
21
  for (const [name, value] of attrs)
20
22
  el.setAttribute(name, value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.8.202",
3
+ "version": "0.8.204",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -96,6 +96,10 @@
96
96
  "import": "./dist/motionBlurSettings.js",
97
97
  "types": "./dist/motionBlurSettings.d.ts"
98
98
  },
99
+ "./preview-quality": {
100
+ "import": "./dist/previewProxyBox.js",
101
+ "types": "./dist/previewProxyBox.d.ts"
102
+ },
99
103
  "./gsap-cdn": {
100
104
  "import": "./dist/gsapCdn.js",
101
105
  "types": "./dist/gsapCdn.d.ts"
@@ -397,9 +401,9 @@
397
401
  "linkedom": "^0.18.12",
398
402
  "postcss": "^8.5.8",
399
403
  "wawoff2": "^2.0.1",
400
- "@hyperframes/lint": "0.8.202",
401
- "@hyperframes/studio-server": "0.8.202",
402
- "@hyperframes/parsers": "0.8.202"
404
+ "@hyperframes/lint": "0.8.204",
405
+ "@hyperframes/parsers": "0.8.204",
406
+ "@hyperframes/studio-server": "0.8.204"
403
407
  },
404
408
  "devDependencies": {
405
409
  "@fontsource/archivo-black": "^5.2.8",