@hyperframes/core 0.9.15 → 0.9.17

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
@@ -35,7 +35,7 @@ export { HF_COLOR_GRADING_ATTR, HF_COLOR_GRADING_ADJUST_KEYS, HF_COLOR_GRADING_A
35
35
  export { colorGroupOf, effectiveColorGrading, ensureColorGroupInertStyle, HF_COLOR_GROUP_ATTR, HF_COLOR_GROUP_TAG, resolveColorGroupElement, } from "./colorGroups.js";
36
36
  export { parseCubeLut, CubeLutParseError, type CubeLut3D, type ParseCubeLutOptions, } from "./colorLuts.js";
37
37
  export { bakeHfColorGradingCube, type BakeHfColorGradingCubeOptions } from "./colorGradingBake.js";
38
- export { firstFrameColourArgs, hdrToSdrToneMapFilter, parseFirstFrameColour, type ToneMapSourceColour, } from "./hdrToneMap.js";
38
+ export { firstFrameColourArgs, hdrToSdrToneMapFilter, keyframeTransferArgs, parseKeyframeTransfers, readsKeyframeTransfers, toneMapReferenceNits, parseFirstFrameColour, type ToneMapFrameColour, type ToneMapSourceColour, } from "./hdrToneMap.js";
39
39
  export { HEAVY_BITRATE, HEAVY_PIXEL_SHARE, PREVIEW_PROXY_BOX_PARAM, PREVIEW_PROXY_LIGHT_PARAM, PREVIEW_PROXY_PRIORITY_HEADER, PREVIEW_PROXY_PROGRESS_HEADER, PREVIEW_PROXY_RETRY_PARAM, PREVIEW_PROXY_STILL_PARAM, PREVIEW_QUALITY_LEVELS, formatPreviewProxyBox, isHeavyForPreview, isPreviewQuality, parsePreviewProxyBox, quantizePreviewProxyBox, scalePreviewProxyBox, type PreviewProxyBox, type PreviewQuality, type PreviewSourceFacts, } from "./previewProxyBox.js";
40
40
  export { HYPERFRAME_RUNTIME_ARTIFACTS, HYPERFRAME_RUNTIME_CONTRACT, loadHyperframeRuntimeSource, type HyperframeRuntimeContract, } from "./inline-scripts/hyperframe.js";
41
41
  export { HYPERFRAME_RUNTIME_GLOBALS, HYPERFRAME_BRIDGE_SOURCES, HYPERFRAME_CONTROL_ACTIONS, type HyperframeControlAction, } from "./inline-scripts/runtimeContract.js";
@@ -57,7 +57,7 @@ export { SCENE_CALLBACK_ERROR_PREFIX } from "./runtime/diagnostics.js";
57
57
  export { parseStartExpression, parseNumeric, type ReferenceExpression, } from "./runtime/startExpression.js";
58
58
  export { COMPOSITION_CONTRACT_VERSION, COMPOSITION_ATTRIBUTES, CANONICAL_AUTHORED_TIMING_ATTRIBUTES, DERIVED_TIMING_ATTRIBUTES, LEGACY_TIMING_ATTRIBUTES, readClipTiming, writeClipTiming, ClipTimingWriteError, type ClipTiming, type ClipTimingDiagnostic, type ClipTimingDiagnosticCode, type ClipTimingUpdate, } from "./compositionContract.js";
59
59
  export { createRuntimeStartTimeResolver } from "./runtime/startResolver.js";
60
- export { hasClipStarted, isClipVisibleAt, isInClipWindow } from "./runtime/clipWindow.js";
60
+ export { hasClipStarted, isClipOnScreenAt, isClipVisibleAt, isInClipWindow, } from "./runtime/clipWindow.js";
61
61
  export { MEDIA_ELEMENT_LEAD_SECONDS, mediaElementTime } from "./runtime/mediaClock.js";
62
62
  export { normalizePlaybackRate, normalizeRateSpec, parseStrictFiniteTimingNumber, readElementPlaybackRate, readElementRateSpec, readMediaStart, resolveNaturalMediaTimelineDuration, resolveNaturalMediaTimelineDurationFromValues, } from "./runtime/playbackRate.js";
63
63
  export { shiftRateLane, sourceTimeAt, timeAtSourceTime, type RateSpec } from "./speedRamp.js";
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ export { HF_COLOR_GRADING_ATTR, HF_COLOR_GRADING_ADJUST_KEYS, HF_COLOR_GRADING_A
31
31
  export { colorGroupOf, effectiveColorGrading, ensureColorGroupInertStyle, HF_COLOR_GROUP_ATTR, HF_COLOR_GROUP_TAG, resolveColorGroupElement, } from "./colorGroups.js";
32
32
  export { parseCubeLut, CubeLutParseError, } from "./colorLuts.js";
33
33
  export { bakeHfColorGradingCube } from "./colorGradingBake.js";
34
- export { firstFrameColourArgs, hdrToSdrToneMapFilter, parseFirstFrameColour, } from "./hdrToneMap.js";
34
+ export { firstFrameColourArgs, hdrToSdrToneMapFilter, keyframeTransferArgs, parseKeyframeTransfers, readsKeyframeTransfers, toneMapReferenceNits, parseFirstFrameColour, } from "./hdrToneMap.js";
35
35
  export { HEAVY_BITRATE, HEAVY_PIXEL_SHARE, PREVIEW_PROXY_BOX_PARAM, PREVIEW_PROXY_LIGHT_PARAM, PREVIEW_PROXY_PRIORITY_HEADER, PREVIEW_PROXY_PROGRESS_HEADER, PREVIEW_PROXY_RETRY_PARAM, PREVIEW_PROXY_STILL_PARAM, PREVIEW_QUALITY_LEVELS, formatPreviewProxyBox, isHeavyForPreview, isPreviewQuality, parsePreviewProxyBox, quantizePreviewProxyBox, scalePreviewProxyBox, } from "./previewProxyBox.js";
36
36
  // Inline scripts
37
37
  export { HYPERFRAME_RUNTIME_ARTIFACTS, HYPERFRAME_RUNTIME_CONTRACT, loadHyperframeRuntimeSource, } from "./inline-scripts/hyperframe.js";
@@ -59,7 +59,7 @@ export { COMPOSITION_CONTRACT_VERSION, COMPOSITION_ATTRIBUTES, CANONICAL_AUTHORE
59
59
  // (verify:packed-manifests catches exactly that).
60
60
  export { createRuntimeStartTimeResolver } from "./runtime/startResolver.js";
61
61
  // Also exposed via the ./runtime/clip-window subpath; re-exported here for the same dist-emit reason.
62
- export { hasClipStarted, isClipVisibleAt, isInClipWindow } from "./runtime/clipWindow.js";
62
+ export { hasClipStarted, isClipOnScreenAt, isClipVisibleAt, isInClipWindow, } from "./runtime/clipWindow.js";
63
63
  export { MEDIA_ELEMENT_LEAD_SECONDS, mediaElementTime } from "./runtime/mediaClock.js";
64
64
  export { normalizePlaybackRate, normalizeRateSpec, parseStrictFiniteTimingNumber, readElementPlaybackRate, readElementRateSpec, readMediaStart, resolveNaturalMediaTimelineDuration, resolveNaturalMediaTimelineDurationFromValues, } from "./runtime/playbackRate.js";
65
65
  export { shiftRateLane, sourceTimeAt, timeAtSourceTime } from "./speedRamp.js";
@@ -6,3 +6,5 @@ export declare const isInClipWindow: (time: number, start: number, end: number)
6
6
  * the terminal instant, so a finished film rests on its last frame instead of going blank.
7
7
  */
8
8
  export declare const isClipVisibleAt: (time: number, start: number, end: number, compositionDuration: number) => boolean;
9
+ /** The one on-screen rule render, snapshot and preview share: edges a hair off a frame count as on it. */
10
+ export declare const isClipOnScreenAt: (time: number, start: number, end: number, fps: number, compositionDuration: number) => boolean;
@@ -1,4 +1,5 @@
1
1
  import { sameInstant } from "../clipFacts.js";
2
+ import { exportClipWindow } from "../inline-scripts/parityContract.js";
2
3
  export const hasClipStarted = (time, start) => time >= start || sameInstant(time, start);
3
4
  /** Half-open: two back-to-back clips never both hold the shared boundary instant, float sums included. */
4
5
  export const isInClipWindow = (time, start, end) => hasClipStarted(time, start) && time < end && !sameInstant(time, end);
@@ -11,3 +12,8 @@ export const isClipVisibleAt = (time, start, end, compositionDuration) => isInCl
11
12
  (hasClipStarted(time, start) &&
12
13
  compositionDuration > 0 &&
13
14
  end >= compositionDuration - TERMINAL_EPSILON_SECONDS);
15
+ /** The one on-screen rule render, snapshot and preview share: edges a hair off a frame count as on it. */
16
+ export const isClipOnScreenAt = (time, start, end, fps, compositionDuration) => {
17
+ const snapped = exportClipWindow(start, end, fps);
18
+ return isClipVisibleAt(time, snapped.start, snapped.end, compositionDuration);
19
+ };
@@ -2,4 +2,10 @@
2
2
  export declare function recordStartupError(error: unknown): void;
3
3
  /** Starts the warning for a scene callback that threw; the render log shows it once per render. */
4
4
  export declare const SCENE_CALLBACK_ERROR_PREFIX = "[hyperframes] scene timeline callback threw:";
5
+ /**
6
+ * A rejected `window.__hf.buildReady[key]` is the composition saying its own setup failed, so
7
+ * readiness waits (render, snapshot, check) fail with the key and reason instead of capturing an
8
+ * unbuilt scene. Returns the recorded message so a teardown can clear exactly this error.
9
+ */
10
+ export declare function recordBuildReadyRejection(key: string, error: unknown): string;
5
11
  export declare function swallow(label: string, error?: unknown): void;
@@ -50,6 +50,25 @@ export function recordStartupError(error) {
50
50
  }
51
51
  /** Starts the warning for a scene callback that threw; the render log shows it once per render. */
52
52
  export const SCENE_CALLBACK_ERROR_PREFIX = "[hyperframes] scene timeline callback threw:";
53
+ /**
54
+ * A rejected `window.__hf.buildReady[key]` is the composition saying its own setup failed, so
55
+ * readiness waits (render, snapshot, check) fail with the key and reason instead of capturing an
56
+ * unbuilt scene. Returns the recorded message so a teardown can clear exactly this error.
57
+ */
58
+ export function recordBuildReadyRejection(key, error) {
59
+ let detail = "unknown error";
60
+ try {
61
+ detail = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
62
+ }
63
+ catch (err) {
64
+ swallow("runtime.buildReadyRejection", err);
65
+ }
66
+ const message = `window.__hf.buildReady[${JSON.stringify(key)}] rejected: ${detail}. ` +
67
+ `The composition reported that its own setup failed, so it cannot be rendered. Fix that ` +
68
+ `setup, or resolve the promise only once the scene is drawable.`;
69
+ window.__hfStartupError = message;
70
+ return message;
71
+ }
53
72
  export function swallow(label, error) {
54
73
  if (typeof window === "undefined")
55
74
  return;
@@ -11,7 +11,6 @@ export declare function isRuntimeElementVisibleAt(rawNode: Element, options: {
11
11
  currentTime: number;
12
12
  compositionDuration: number;
13
13
  canonicalFps: number;
14
- exportRenderSeek: boolean;
15
14
  timelineRegistry: Record<string, RuntimeTimelineLike | undefined>;
16
15
  resolver: ReturnType<typeof createRuntimeStartTimeResolver>;
17
16
  }): boolean;
@@ -7,8 +7,7 @@ import { readElementPlaybackRate, readMediaStart } from "./playbackRate.js";
7
7
  import { parseStrictFiniteTimingNumber, resolveMediaElementDurationSeconds, resolveNaturalMediaTimelineDuration, resolveTimedImageDurationSeconds, } from "./playbackRate.js";
8
8
  import { resolveCssStackingContextId } from "./stackingContext.js";
9
9
  import { createRuntimeStartTimeResolver } from "./startResolver.js";
10
- import { isClipVisibleAt } from "./clipWindow.js";
11
- import { exportClipWindow } from "../inline-scripts/parityContract.js";
10
+ import { isClipOnScreenAt } from "./clipWindow.js";
12
11
  import { isSceneLikeCompositionId } from "../slideshow/index.js";
13
12
  import { COMPOSITION_CONTRACT_VERSION } from "../compositionContract.js";
14
13
  import { runtimeProtocolMetadata } from "./protocol.js";
@@ -50,11 +49,7 @@ export function isRuntimeElementVisibleAt(rawNode, options) {
50
49
  const span = runtimeElementWindow(rawNode, options);
51
50
  if (!span)
52
51
  return false;
53
- // Export seeks snap to frame boundaries; interactive visibility uses authored seconds.
54
- const clipWindow = options.exportRenderSeek
55
- ? exportClipWindow(span.start, span.end, options.canonicalFps)
56
- : span;
57
- return isClipVisibleAt(options.currentTime, clipWindow.start, clipWindow.end, options.compositionDuration);
52
+ return isClipOnScreenAt(options.currentTime, span.start, span.end, options.canonicalFps, options.compositionDuration);
58
53
  }
59
54
  function parseNum(value) {
60
55
  return parseStrictFiniteTimingNumber(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.9.15",
3
+ "version": "0.9.17",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -437,9 +437,9 @@
437
437
  "linkedom": "^0.18.12",
438
438
  "postcss": "^8.5.8",
439
439
  "wawoff2": "^2.0.1",
440
- "@hyperframes/lint": "0.9.15",
441
- "@hyperframes/parsers": "0.9.15",
442
- "@hyperframes/studio-server": "0.9.15"
440
+ "@hyperframes/lint": "0.9.17",
441
+ "@hyperframes/parsers": "0.9.17",
442
+ "@hyperframes/studio-server": "0.9.17"
443
443
  },
444
444
  "devDependencies": {
445
445
  "@fontsource/archivo-black": "^5.2.8",