@hyperframes/core 0.8.186 → 0.8.189

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
@@ -32,7 +32,7 @@ export { clearGifFramesBeforeNext, gifClearsAfterLeavingFrameInPlace, parseAnima
32
32
  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";
33
33
  export { parseCubeLut, CubeLutParseError, type ParseCubeLutOptions } from "./colorLuts.js";
34
34
  export { firstFrameColourArgs, hdrToSdrToneMapFilter, parseFirstFrameColour, type ToneMapSourceColour, } from "./hdrToneMap.js";
35
- export { PREVIEW_PROXY_BOX_PARAM, formatPreviewProxyBox, parsePreviewProxyBox, type PreviewProxyBox, } from "./previewProxyBox.js";
35
+ export { PREVIEW_PROXY_BOX_PARAM, formatPreviewProxyBox, parsePreviewProxyBox, quantizePreviewProxyBox, type PreviewProxyBox, } from "./previewProxyBox.js";
36
36
  export { HYPERFRAME_RUNTIME_ARTIFACTS, HYPERFRAME_RUNTIME_CONTRACT, loadHyperframeRuntimeSource, type HyperframeRuntimeContract, } from "./inline-scripts/hyperframe.js";
37
37
  export { HYPERFRAME_RUNTIME_GLOBALS, HYPERFRAME_BRIDGE_SOURCES, HYPERFRAME_CONTROL_ACTIONS, type HyperframeControlAction, } from "./inline-scripts/runtimeContract.js";
38
38
  export { getHyperframeRuntimeScript } from "./generated/runtime-inline.js";
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ export { clearGifFramesBeforeNext, gifClearsAfterLeavingFrameInPlace, parseAnima
28
28
  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";
29
29
  export { parseCubeLut, CubeLutParseError } from "./colorLuts.js";
30
30
  export { firstFrameColourArgs, hdrToSdrToneMapFilter, parseFirstFrameColour, } from "./hdrToneMap.js";
31
- export { PREVIEW_PROXY_BOX_PARAM, formatPreviewProxyBox, parsePreviewProxyBox, } from "./previewProxyBox.js";
31
+ export { PREVIEW_PROXY_BOX_PARAM, formatPreviewProxyBox, parsePreviewProxyBox, quantizePreviewProxyBox, } from "./previewProxyBox.js";
32
32
  // Inline scripts
33
33
  export { HYPERFRAME_RUNTIME_ARTIFACTS, HYPERFRAME_RUNTIME_CONTRACT, loadHyperframeRuntimeSource, } from "./inline-scripts/hyperframe.js";
34
34
  export { HYPERFRAME_RUNTIME_GLOBALS, HYPERFRAME_BRIDGE_SOURCES, HYPERFRAME_CONTROL_ACTIONS, } from "./inline-scripts/runtimeContract.js";
@@ -3,6 +3,9 @@ export type HyperframesRuntimeBuildOptions = {
3
3
  defaultParityMode?: boolean;
4
4
  minify?: boolean;
5
5
  };
6
+ export declare const RUNTIME_ESBUILD_DEFINE: {
7
+ console: string;
8
+ };
6
9
  /**
7
10
  * Build the runtime IIFE from source via esbuild.
8
11
  *
@@ -2,6 +2,7 @@ import { existsSync } from "node:fs";
2
2
  import { createRequire } from "node:module";
3
3
  import { dirname, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
+ export const RUNTIME_ESBUILD_DEFINE = { console: "globalThis.console" };
5
6
  function applyDefaultParityMode(script, enabled) {
6
7
  const parityFlagPattern = /var\s+_parityModeEnabled\s*=\s*(?:true|false)\s*;/;
7
8
  if (!parityFlagPattern.test(script))
@@ -29,6 +30,7 @@ export function buildHyperframesRuntimeScript(options = {}) {
29
30
  target: ["es2020"],
30
31
  minify: options.minify ?? true,
31
32
  legalComments: "none",
33
+ define: RUNTIME_ESBUILD_DEFINE,
32
34
  });
33
35
  let script = result.outputFiles[0]?.text ?? "";
34
36
  if (typeof options.defaultParityMode === "boolean") {
@@ -109,7 +109,8 @@ export declare function syncRuntimeMedia(params: {
109
109
  * outbound message; further invocations are suppressed by the caller.
110
110
  */
111
111
  onAutoplayBlocked?: () => void;
112
- onElementVolume?: (el: HTMLMediaElement, effectiveVolume: number, authorVolume: number) => void;
112
+ /** `clipGain` is `data-volume` for a routed clip, played ahead of its FX; 1 otherwise. */
113
+ onElementVolume?: (el: HTMLMediaElement, effectiveVolume: number, authorVolume: number, clipGain: number) => void;
113
114
  /** Is THIS element owned by the Web Audio transport? Owned → mute it (transport
114
115
  * plays it); not owned → leave audible (HTMLMedia fallback). Per-element, not a
115
116
  * global flag, so a not-yet-claimed track isn't muted by other tracks. */
@@ -6,7 +6,7 @@ import { elementVolumeLaneGain } from "./audioAutomationVolume.js";
6
6
  import { fadeGain, NO_FADES, readElementFades } from "../audioFade.js";
7
7
  import { readElementPlaybackRate, readElementRateSpec, readMediaStart } from "./playbackRate.js";
8
8
  import { rateAt, sourceTimeAt, timeAtSourceTime } from "../speedRamp.js";
9
- import { clampAudioGain } from "../audioGain.js";
9
+ import { clampAudioGain, clipGain, gainTimesLane } from "../audioGain.js";
10
10
  import { isMemberGroupHidden } from "../audioGroups.js";
11
11
  import { findInjectedRenderFrame } from "./renderFrameSibling.js";
12
12
  import { registerSeekCompletion } from "./adapters/seek-dispatch.js";
@@ -312,7 +312,7 @@ export function syncRuntimeMedia(params) {
312
312
  const previousRuntimeVolume = lastRuntimeAppliedVolume.get(el);
313
313
  const currentElementVolume = clampVolume(el.volume);
314
314
  let authorVolume;
315
- // An explicit volume lane owns the fader. It is checked before the probed
315
+ // An explicit volume lane, times `data-volume`, sets the level. Checked before the probed
316
316
  // keyframes because the two would otherwise fight, and it is the one the
317
317
  // author drew — `lint` warns when a track carries both.
318
318
  // Clip-local, NOT `relTime`. A lane's `t` is "seconds from the start of
@@ -324,9 +324,11 @@ export function syncRuntimeMedia(params) {
324
324
  // trimmed clip. The FX lanes on this same feature use clip-local elapsed;
325
325
  // there is one time base, and this is it.
326
326
  const laneGain = elementVolumeLaneGain(el, params.timeSeconds - origin);
327
+ const routed = params.isWebAudioRouted?.(el) === true;
328
+ const tweened = laneGain === null && (clip.volumeKeyframes?.length ?? 0) > 0;
329
+ const preFxGain = routed ? clipGain(fallbackAuthorVolume, tweened) : 1;
327
330
  if (laneGain !== null) {
328
- const transportOwnsLane = params.isWebAudioRouted?.(el);
329
- authorVolume = transportOwnsLane ? 1 : clampAudioGain(laneGain);
331
+ authorVolume = routed ? 1 : gainTimesLane(fallbackAuthorVolume, laneGain);
330
332
  }
331
333
  else if (clip.volumeKeyframes && clip.volumeKeyframes.length > 0) {
332
334
  // Keyframes probed from the GSAP timeline — same source as the renderer.
@@ -339,8 +341,8 @@ export function syncRuntimeMedia(params) {
339
341
  const elapsedInClip = params.timeSeconds - origin;
340
342
  authorVolume = clampAudioGain(interpolateVolumeGain(clip.volumeKeyframes, elapsedInClip));
341
343
  }
342
- else if (params.isWebAudioRouted?.(el)) {
343
- authorVolume = fallbackAuthorVolume;
344
+ else if (routed) {
345
+ authorVolume = 1;
344
346
  }
345
347
  else if (previousRuntimeVolume === undefined) {
346
348
  // First tick this clip is active. The transport has already seeked GSAP
@@ -388,7 +390,7 @@ export function syncRuntimeMedia(params) {
388
390
  if (Math.abs(el.volume - effectiveVolume) > 1e-6)
389
391
  el.volume = effectiveVolume;
390
392
  lastRuntimeAppliedVolume.set(el, effectiveVolume);
391
- params.onElementVolume?.(el, effectiveVolume, authorVolume);
393
+ params.onElementVolume?.(el, effectiveVolume, authorVolume, preFxGain);
392
394
  // Mute only when force-muted or the transport owns this element; an unclaimed
393
395
  // track stays audible via the HTMLMedia fallback.
394
396
  if ((forceMuteAll || params.isWebAudioOwned?.(el)) && !el.muted)
@@ -17,7 +17,7 @@
17
17
  */
18
18
  /**
19
19
  * The render id an element is addressed by: its stamped, document-unique id
20
- * when the producer compiled this document, else its author id. The two are
20
+ * when the compiler stamped this document, else its author id. The two are
21
21
  * the same string whenever no collision forced a suffix.
22
22
  */
23
23
  export declare function readMediaRenderId(media: Element): string | null;
@@ -19,7 +19,7 @@ import { MEDIA_RENDER_ID_ATTR } from "../compiler/mediaRenderIds.js";
19
19
  import { isImageElement } from "./domRealm.js";
20
20
  /**
21
21
  * The render id an element is addressed by: its stamped, document-unique id
22
- * when the producer compiled this document, else its author id. The two are
22
+ * when the compiler stamped this document, else its author id. The two are
23
23
  * the same string whenever no collision forced a suffix.
24
24
  */
25
25
  export function readMediaRenderId(media) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.8.186",
3
+ "version": "0.8.189",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -385,9 +385,9 @@
385
385
  "linkedom": "^0.18.12",
386
386
  "postcss": "^8.5.8",
387
387
  "wawoff2": "^2.0.1",
388
- "@hyperframes/lint": "0.8.186",
389
- "@hyperframes/studio-server": "0.8.186",
390
- "@hyperframes/parsers": "0.8.186"
388
+ "@hyperframes/lint": "0.8.189",
389
+ "@hyperframes/parsers": "0.8.189",
390
+ "@hyperframes/studio-server": "0.8.189"
391
391
  },
392
392
  "devDependencies": {
393
393
  "@fontsource/archivo-black": "^5.2.8",