@hyperframes/core 0.8.207 → 0.8.209

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.
Files changed (34) hide show
  1. package/dist/atomicFile.js +18 -19
  2. package/dist/compiler/compositionScoping.d.ts +2 -0
  3. package/dist/compiler/compositionScoping.js +9 -0
  4. package/dist/compiler/htmlBundler.js +2 -8
  5. package/dist/compiler/htmlDocument.d.ts +4 -0
  6. package/dist/compiler/htmlDocument.js +22 -0
  7. package/dist/compiler/index.d.ts +1 -1
  8. package/dist/compiler/index.js +1 -1
  9. package/dist/generated/runtime-inline.js +1 -1
  10. package/dist/hyperframe.runtime.iife.js +67 -67
  11. package/dist/removeScratch.d.ts +5 -0
  12. package/dist/removeScratch.js +23 -0
  13. package/dist/renameWithRetry.d.ts +16 -0
  14. package/dist/renameWithRetry.js +81 -0
  15. package/dist/runtime/applyVariableBindings.d.ts +6 -4
  16. package/dist/runtime/applyVariableBindings.js +23 -11
  17. package/dist/runtime/clock.js +1 -1
  18. package/dist/runtime/getVariables.js +5 -4
  19. package/dist/runtime/mediaSteer.d.ts +1 -0
  20. package/dist/runtime/mediaSteer.js +1 -0
  21. package/dist/runtime/state.d.ts +1 -2
  22. package/dist/runtime/timeline.js +4 -4
  23. package/dist/runtime/types.d.ts +21 -0
  24. package/dist/runtime/variableScope.d.ts +2 -0
  25. package/dist/runtime/variableScope.js +9 -3
  26. package/package.json +12 -4
  27. package/dist/runtime/adapters/seek-dispatch.d.ts +0 -37
  28. package/dist/runtime/adapters/seek-dispatch.js +0 -143
  29. package/dist/runtime/media.d.ts +0 -131
  30. package/dist/runtime/media.js +0 -586
  31. package/dist/runtime/preloadMedia.d.ts +0 -12
  32. package/dist/runtime/preloadMedia.js +0 -108
  33. package/dist/runtime/timedClipHide.d.ts +0 -12
  34. package/dist/runtime/timedClipHide.js +0 -93
@@ -1,131 +0,0 @@
1
- import { type VolumeKeyframe } from "./mediaVolumeEnvelope.js";
2
- import { type AudioFades } from "../audioFade.js";
3
- import { type RateSpec } from "../speedRamp.js";
4
- import { type HostSlot } from "../mediaTiming.js";
5
- export { MEDIA_SYNC_TOLERANCE_SECONDS } from "./mediaSteer.js";
6
- export { readElementPlaybackRate, readElementRateSpec, resolveNaturalMediaTimelineDuration, } from "./playbackRate.js";
7
- export declare function readElementPlaybackStart(el: Element): number;
8
- export declare const HOLD_CAP_MS = 5000;
9
- /**
10
- * Resolve a media element's timeline window without conflating a video's
11
- * authored display slot with the amount of source left to decode.
12
- *
13
- * An explicit video slot may outlive its source and holds the final frame.
14
- * Audio remains source-bounded because it has no visual hold state.
15
- */
16
- export declare function resolveRuntimeMediaClipDuration(params: {
17
- isVideo: boolean;
18
- sourceDuration: number | null;
19
- hostRemaining: number | null;
20
- explicitDuration: number | null;
21
- }): number | null;
22
- export type RuntimeMediaClip = {
23
- el: HTMLVideoElement | HTMLAudioElement;
24
- start: number;
25
- /** The clip's own t=0 when a host's in-point cut its head; source time, lanes and fades run from it. */
26
- origin?: number;
27
- mediaStart: number;
28
- duration: number;
29
- end: number;
30
- volume: number | null;
31
- playbackRate: number;
32
- /** The rate lane when the clip has one; otherwise `playbackRate`. */
33
- rate?: RateSpec;
34
- loop: boolean;
35
- /** Source media duration in seconds (from el.duration). Used for loop wrapping. */
36
- sourceDuration: number | null;
37
- /**
38
- * Probed volume keyframes from the GSAP timeline (same probe the renderer
39
- * uses). When present, `syncRuntimeMedia` drives volume from the envelope
40
- * rather than from `data-volume` + GSAP-change tracking, eliminating the
41
- * race between the 60 Hz transport tick and GSAP's own seek.
42
- */
43
- volumeKeyframes?: VolumeKeyframe[];
44
- /** Clip-edge fades from `data-fade-in` / `data-fade-out`; see audioFade.ts. */
45
- fades?: AudioFades;
46
- };
47
- export declare function refreshRuntimeMediaCache(params?: {
48
- resolveStartSeconds?: (element: Element) => number;
49
- resolveDurationSeconds?: (element: HTMLVideoElement | HTMLAudioElement) => number | null;
50
- resolveHostSlots?: (element: HTMLVideoElement | HTMLAudioElement) => HostSlot[];
51
- shouldIncludeElement?: (element: HTMLVideoElement | HTMLAudioElement) => boolean;
52
- /**
53
- * Build clips for exactly these elements instead of scanning the document for
54
- * them. For a caller that already knows which media it needs this pass — the
55
- * per-seek sync only touches the clips whose active state can change — and so
56
- * should not pay to re-derive the window of every clip in the composition.
57
- *
58
- * Every field is still read FRESH from the element. This narrows which
59
- * elements are visited, never how current the answer is: `el.duration` can be
60
- * reset under the caller by an `el.load()` it did not make.
61
- */
62
- elements?: Array<HTMLVideoElement | HTMLAudioElement>;
63
- }): {
64
- timedMediaEls: Array<HTMLVideoElement | HTMLAudioElement>;
65
- mediaClips: RuntimeMediaClip[];
66
- videoClips: RuntimeMediaClip[];
67
- maxMediaEnd: number;
68
- };
69
- export declare function isUnplayable(el: HTMLMediaElement): boolean;
70
- /**
71
- * Drop every per-source sync baseline tracked for `el` — offset drift
72
- * samples, the seek-past-buffered-range retry latch, and the last
73
- * runtime-applied volume — so the next `syncRuntimeMedia` tick treats it as
74
- * a first tick (hard resync, fresh drift baseline) instead of comparing
75
- * against state computed for a different file. Used both when a clip leaves
76
- * its active window (below) and by the runtime's proxy-swap helper
77
- * (mediaProxy.ts) right after an in-place `src` swap, which points the same
78
- * element at a different file without ever leaving its active window.
79
- */
80
- export declare function evictMediaSyncState(el: HTMLMediaElement): void;
81
- /** Test-only seam: whether any per-source sync state is still tracked for `el`. */
82
- export declare function hasMediaSyncStateForTest(el: HTMLMediaElement): boolean;
83
- export declare const MEDIA_HARD_SYNC_SECONDS = 0.5;
84
- export declare const MEDIA_PRESEEK_SECONDS = 1.5;
85
- export declare function mediaSourceTimeAt(clip: RuntimeMediaClip, timeSeconds: number): number;
86
- export declare function syncRuntimeMedia(params: {
87
- clips: RuntimeMediaClip[];
88
- timeSeconds: number;
89
- playing: boolean;
90
- playbackRate: number;
91
- /** Force-mute every element (parent-frame proxy owns all audio). Asserted per
92
- * tick so sub-composition media added mid-playback inherits the silence. */
93
- outputMuted?: boolean;
94
- /**
95
- * User's explicit mute preference (set via `onSetMuted`). Symmetric to
96
- * `outputMuted` — also asserted per tick — so a sub-composition that
97
- * activates after the user mutes doesn't briefly play at author volume
98
- * before the next bridge message lands.
99
- */
100
- userMuted?: boolean;
101
- /**
102
- * User's volume preference (0–1, set via `onSetVolume`). Multiplied with the
103
- * per-clip author volume so `data-volume="0.5"` at user volume 0.8 yields 0.4.
104
- */
105
- userVolume?: number;
106
- /**
107
- * Invoked at most once when a media element's `play()` promise rejects with
108
- * `NotAllowedError`. The caller is expected to latch and post a single
109
- * outbound message; further invocations are suppressed by the caller.
110
- */
111
- onAutoplayBlocked?: () => 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, unfadedVolume?: number) => void;
114
- /** Is THIS element owned by the Web Audio transport? Owned → mute it (transport
115
- * plays it); not owned → leave audible (HTMLMedia fallback). Per-element, not a
116
- * global flag, so a not-yet-claimed track isn't muted by other tracks. */
117
- isWebAudioOwned?: (el: HTMLMediaElement) => boolean;
118
- /** Native media routed through WebAudio keeps its upstream element volume at
119
- * unity; do not mistake that transport write for an authored volume edit. */
120
- isWebAudioRouted?: (el: HTMLMediaElement) => boolean;
121
- forceSync?: boolean;
122
- /** False while the playhead is not moving (audio output has not started): a paused video waits for it. */
123
- clockAdvancing?: boolean;
124
- /** How far the next tick will move the playhead: an audio clip due within it starts now. */
125
- cueAheadSeconds?: number;
126
- /** Seeks a sounding element under a gain dip; false when it has no dip stage and the sync seeks it plainly. */
127
- seekUnderDip?: (el: HTMLMediaElement, target: number) => boolean;
128
- /** Lets a video clip that runs to the composition end hold its last frame at the terminal time.
129
- * A thunk, because deriving the duration is only worth it for a clip past its own end. */
130
- getCompositionDuration: () => number;
131
- }): void;