@hyperframes/core 0.8.181 → 0.8.184

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.
@@ -1,5 +1,5 @@
1
- import { buildSync } from "esbuild";
2
1
  import { existsSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
3
  import { dirname, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  function applyDefaultParityMode(script, enabled) {
@@ -19,6 +19,7 @@ export function buildHyperframesRuntimeScript(options = {}) {
19
19
  const entryPath = resolve(dirname(fileURLToPath(import.meta.url)), "../runtime/entry.ts");
20
20
  if (!existsSync(entryPath))
21
21
  return null;
22
+ const { buildSync } = createRequire(import.meta.url)("esbuild");
22
23
  const result = buildSync({
23
24
  entryPoints: [entryPath],
24
25
  bundle: true,
@@ -1,41 +1 @@
1
- export declare const MEDIA_START_BASIS_ATTR = "data-hf-media-start-basis";
2
- export type MediaStartBasis = "local" | "global";
3
- export declare function readMediaStartBasis(value: string | null | undefined): MediaStartBasis;
4
- /** Resolve authored media time onto the root timeline. Nested media is local
5
- * by default; only an explicit compatibility marker preserves a legacy
6
- * root-global value. */
7
- export declare function resolveAbsoluteMediaStartSeconds(input: {
8
- authoredStart: number;
9
- hostStart: number;
10
- basis?: string | null;
11
- }): number;
12
- /** The one rule for a media element's root-timeline start; the runtime and the CLI both call it.
13
- * `hostStart` is the composition's origin. With no literal start, an auto-injected start, or an
14
- * origin at 0 there is nothing for the basis to disambiguate, so ordinary resolution applies. */
15
- export declare function resolveMediaStartSeconds(input: MediaStartInput & {
16
- ordinaryStart: () => number;
17
- }): number;
18
- /** True when the authored start is already root time, so no host offset applies. */
19
- export declare function isRootGlobalMediaStart(input: MediaStartInput): boolean;
20
- export interface MediaStartInput {
21
- authoredStart: number | null;
22
- hostStart: number;
23
- hasAutoStart: boolean;
24
- basis?: string | null;
25
- }
26
- /** A composition host's in-point; only a host with one shifts or cuts what it holds. */
27
- export declare function hostInPointSeconds(host: Pick<Element, "getAttribute">): number;
28
- /** Main-timeline time of a sub-composition's local t=0: its host's start minus its in-point. */
29
- export declare function compositionOriginSeconds(hostStart: number, host: Pick<Element, "getAttribute">): number;
30
- export interface HostSlot {
31
- start: number;
32
- end: number;
33
- }
34
- /** Each in-point host cuts the span to its own window. */
35
- export declare function cutToHostSlots(span: {
36
- start: number;
37
- end: number;
38
- }, hosts: readonly HostSlot[]): {
39
- start: number;
40
- end: number;
41
- };
1
+ export * from "@hyperframes/parsers/media-timing";
@@ -1,47 +1,2 @@
1
- import { readMediaOffsetSeconds } from "@hyperframes/parsers/media-duration";
2
- export const MEDIA_START_BASIS_ATTR = "data-hf-media-start-basis";
3
- export function readMediaStartBasis(value) {
4
- return value?.trim().toLowerCase() === "global" ? "global" : "local";
5
- }
6
- /** Resolve authored media time onto the root timeline. Nested media is local
7
- * by default; only an explicit compatibility marker preserves a legacy
8
- * root-global value. */
9
- export function resolveAbsoluteMediaStartSeconds(input) {
10
- return readMediaStartBasis(input.basis) === "global"
11
- ? input.authoredStart
12
- : input.hostStart + input.authoredStart;
13
- }
14
- /** The one rule for a media element's root-timeline start; the runtime and the CLI both call it.
15
- * `hostStart` is the composition's origin. With no literal start, an auto-injected start, or an
16
- * origin at 0 there is nothing for the basis to disambiguate, so ordinary resolution applies. */
17
- export function resolveMediaStartSeconds(input) {
18
- if (!hasLiteralNestedStart(input))
19
- return input.ordinaryStart();
20
- return resolveAbsoluteMediaStartSeconds({
21
- authoredStart: input.authoredStart,
22
- hostStart: input.hostStart,
23
- basis: input.basis,
24
- });
25
- }
26
- /** True when the authored start is already root time, so no host offset applies. */
27
- export function isRootGlobalMediaStart(input) {
28
- return hasLiteralNestedStart(input) && readMediaStartBasis(input.basis) === "global";
29
- }
30
- function hasLiteralNestedStart(input) {
31
- return !input.hasAutoStart && input.authoredStart != null && input.hostStart !== 0;
32
- }
33
- /** A composition host's in-point; only a host with one shifts or cuts what it holds. */
34
- export function hostInPointSeconds(host) {
35
- return readMediaOffsetSeconds((name) => host.getAttribute(name));
36
- }
37
- /** Main-timeline time of a sub-composition's local t=0: its host's start minus its in-point. */
38
- export function compositionOriginSeconds(hostStart, host) {
39
- return hostStart - hostInPointSeconds(host);
40
- }
41
- /** Each in-point host cuts the span to its own window. */
42
- export function cutToHostSlots(span, hosts) {
43
- return hosts.reduce((kept, host) => {
44
- const start = Math.max(kept.start, host.start);
45
- return { start, end: Math.max(start, Math.min(kept.end, host.end)) };
46
- }, span);
47
- }
1
+ // Kept for existing importers; the rule lives in @hyperframes/parsers.
2
+ export * from "@hyperframes/parsers/media-timing";
@@ -384,12 +384,13 @@ export function syncRuntimeMedia(params) {
384
384
  // fallback played at full level.
385
385
  const silencedByHidden = el.closest("[data-hidden]") !== null || isMemberGroupHidden(el.ownerDocument, el);
386
386
  const effectiveVolume = silencedByHidden ? 0 : clampVolume(authorVolume * userVol);
387
- el.volume = effectiveVolume;
387
+ if (Math.abs(el.volume - effectiveVolume) > 1e-6)
388
+ el.volume = effectiveVolume;
388
389
  lastRuntimeAppliedVolume.set(el, effectiveVolume);
389
390
  params.onElementVolume?.(el, effectiveVolume, authorVolume);
390
391
  // Mute only when force-muted or the transport owns this element; an unclaimed
391
392
  // track stays audible via the HTMLMedia fallback.
392
- if (forceMuteAll || params.isWebAudioOwned?.(el))
393
+ if ((forceMuteAll || params.isWebAudioOwned?.(el)) && !el.muted)
393
394
  el.muted = true;
394
395
  // Ensure full preload for every active media element. Streaming
395
396
  // formats (MP3) may arrive with preload="metadata", which only
@@ -261,6 +261,7 @@ export type RuntimeTimelineLike = {
261
261
  seek: (timeSeconds?: number, suppressEvents?: boolean) => unknown;
262
262
  totalTime?: (timeSeconds?: number, suppressEvents?: boolean) => unknown;
263
263
  totalDuration?: () => number;
264
+ shiftChildren?: (amount: number) => unknown;
264
265
  progress?: (value?: number, suppressEvents?: boolean) => unknown;
265
266
  time: () => number;
266
267
  duration: () => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.8.181",
3
+ "version": "0.8.184",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -381,9 +381,9 @@
381
381
  "linkedom": "^0.18.12",
382
382
  "postcss": "^8.5.8",
383
383
  "wawoff2": "^2.0.1",
384
- "@hyperframes/lint": "0.8.181",
385
- "@hyperframes/parsers": "0.8.181",
386
- "@hyperframes/studio-server": "0.8.181"
384
+ "@hyperframes/lint": "0.8.184",
385
+ "@hyperframes/studio-server": "0.8.184",
386
+ "@hyperframes/parsers": "0.8.184"
387
387
  },
388
388
  "devDependencies": {
389
389
  "@fontsource/archivo-black": "^5.2.8",