@hyperframes/core 0.8.201 → 0.8.203

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
@@ -4,7 +4,7 @@ export type { SlideshowManifest, SlideRef, SlideHotspot, SlideSequence, Resolved
4
4
  export { parseSlideshowManifest, resolveSlideshow } from "./slideshow/index.js";
5
5
  export type { AuthoredTimingValue, RawAuthoredTiming, AuthoredTimingWindow, } from "./runtime/authoredTiming.js";
6
6
  export { resolveAuthoredTimingWindow } from "./runtime/authoredTiming.js";
7
- export { CANVAS_DIMENSIONS, VALID_CANVAS_RESOLUTIONS, normalizeResolutionFlag, isAspectAgnosticResolutionAlias, resolveResolutionFlagPair, checkOutputResolutionCompatibility, suggestMatchingPreset, parseFps, parseFpsWithDefault, toFps, fpsToNumber, fpsToFfmpegArg, TIMELINE_COLORS, DEFAULT_DURATIONS, COMPOSITION_VARIABLE_TYPES, isTextElement, isMediaElement, isCompositionElement, getDefaultStageZoom, } from "./core.types.js";
7
+ export { CANVAS_DIMENSIONS, VALID_CANVAS_RESOLUTIONS, normalizeResolutionFlag, isAspectAgnosticResolutionAlias, resolveResolutionFlagPair, checkOutputResolutionCompatibility, outputResolutionForSize, suggestMatchingPreset, parseFps, parseFpsWithDefault, toFps, fpsToNumber, fpsToFfmpegArg, TIMELINE_COLORS, DEFAULT_DURATIONS, COMPOSITION_VARIABLE_TYPES, isTextElement, isMediaElement, isCompositionElement, getDefaultStageZoom, } from "./core.types.js";
8
8
  export { DISTRIBUTED_FPS, type DistributedFps, isDistributedFps } from "./distributedFps.js";
9
9
  export { generateBaseHtml, getStageStyles } from "./templates/base.js";
10
10
  export { GSAP_CDN, BASE_STYLES, ELEMENT_BASE_STYLES, MEDIA_STYLES, TEXT_STYLES, ZOOM_CONTAINER_STYLES, } from "./templates/constants.js";
@@ -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
@@ -1,6 +1,6 @@
1
1
  export { parseSlideshowManifest, resolveSlideshow } from "./slideshow/index.js";
2
2
  export { resolveAuthoredTimingWindow } from "./runtime/authoredTiming.js";
3
- export { CANVAS_DIMENSIONS, VALID_CANVAS_RESOLUTIONS, normalizeResolutionFlag, isAspectAgnosticResolutionAlias, resolveResolutionFlagPair, checkOutputResolutionCompatibility, suggestMatchingPreset, parseFps, parseFpsWithDefault, toFps, fpsToNumber, fpsToFfmpegArg, TIMELINE_COLORS, DEFAULT_DURATIONS, COMPOSITION_VARIABLE_TYPES, isTextElement, isMediaElement, isCompositionElement, getDefaultStageZoom, } from "./core.types.js";
3
+ export { CANVAS_DIMENSIONS, VALID_CANVAS_RESOLUTIONS, normalizeResolutionFlag, isAspectAgnosticResolutionAlias, resolveResolutionFlagPair, checkOutputResolutionCompatibility, outputResolutionForSize, suggestMatchingPreset, parseFps, parseFpsWithDefault, toFps, fpsToNumber, fpsToFfmpegArg, TIMELINE_COLORS, DEFAULT_DURATIONS, COMPOSITION_VARIABLE_TYPES, isTextElement, isMediaElement, isCompositionElement, getDefaultStageZoom, } from "./core.types.js";
4
4
  export { DISTRIBUTED_FPS, isDistributedFps } from "./distributedFps.js";
5
5
  // Templates
6
6
  export { generateBaseHtml, getStageStyles } from "./templates/base.js";
@@ -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),
@@ -111,7 +111,7 @@ export declare function syncRuntimeMedia(params: {
111
111
  */
112
112
  onAutoplayBlocked?: () => void;
113
113
  /** `clipGain` is `data-volume` for a routed clip, played ahead of its FX; 1 otherwise. */
114
- onElementVolume?: (el: HTMLMediaElement, effectiveVolume: number, authorVolume: number, clipGain: number) => void;
114
+ onElementVolume?: (el: HTMLMediaElement, effectiveVolume: number, authorVolume: number, clipGain: number, unfadedVolume?: number) => void;
115
115
  /** Is THIS element owned by the Web Audio transport? Owned → mute it (transport
116
116
  * plays it); not owned → leave audible (HTMLMedia fallback). Per-element, not a
117
117
  * global flag, so a not-yet-claimed track isn't muted by other tracks. */
@@ -375,6 +375,7 @@ export function syncRuntimeMedia(params) {
375
375
  authorVolume = fallbackAuthorVolume;
376
376
  }
377
377
  // Clip-local fade on top of the resolved level, matching render's afade-after-volume.
378
+ const unfadedVolume = authorVolume;
378
379
  const fades = clip.fades ?? NO_FADES;
379
380
  if (fades.fadeIn > 0 || fades.fadeOut > 0) {
380
381
  authorVolume *= fadeGain(params.timeSeconds - origin, clip.duration + clip.start - origin, fades);
@@ -392,7 +393,10 @@ export function syncRuntimeMedia(params) {
392
393
  if (Math.abs(el.volume - effectiveVolume) > 1e-6)
393
394
  el.volume = effectiveVolume;
394
395
  lastRuntimeAppliedVolume.set(el, effectiveVolume);
395
- params.onElementVolume?.(el, effectiveVolume, authorVolume, preFxGain);
396
+ if (unfadedVolume === authorVolume)
397
+ params.onElementVolume?.(el, effectiveVolume, authorVolume, preFxGain);
398
+ else
399
+ params.onElementVolume?.(el, effectiveVolume, authorVolume, preFxGain, unfadedVolume);
396
400
  // Mute only when force-muted or the transport owns this element; an unclaimed
397
401
  // track stays audible via the HTMLMedia fallback.
398
402
  if ((forceMuteAll || params.isWebAudioOwned?.(el)) && !el.muted)
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.8.201",
3
+ "version": "0.8.203",
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.201",
401
- "@hyperframes/studio-server": "0.8.201",
402
- "@hyperframes/parsers": "0.8.201"
404
+ "@hyperframes/parsers": "0.8.203",
405
+ "@hyperframes/studio-server": "0.8.203",
406
+ "@hyperframes/lint": "0.8.203"
403
407
  },
404
408
  "devDependencies": {
405
409
  "@fontsource/archivo-black": "^5.2.8",