@hyperframes/core 0.8.165 → 0.8.166

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,3 +1,3 @@
1
1
  import type { RuntimeTimelineLike } from "./types.js";
2
- /** A registered timeline's finite duration(); a partial, throwing or non-numeric entry reads as null. */
3
- export declare function readTimelineDurationSeconds(timeline: Pick<RuntimeTimelineLike, "duration"> | null | undefined): number | null;
2
+ /** A timeline's finite length, counting paused child timelines; a partial or throwing entry reads as null. */
3
+ export declare function readTimelineDurationSeconds(timeline: Pick<RuntimeTimelineLike, "duration" | "getChildren"> | null | undefined): number | null;
@@ -1,10 +1,16 @@
1
1
  import { swallow } from "./diagnostics.js";
2
- /** A registered timeline's finite duration(); a partial, throwing or non-numeric entry reads as null. */
2
+ const pausedChildEnd = (child) => child.paused?.() === true
3
+ ? (child.startTime?.() ?? 0) +
4
+ (child.totalDuration?.() ?? 0) / Math.abs(child.timeScale?.() || 1)
5
+ : 0;
6
+ /** A timeline's finite length, counting paused child timelines; a partial or throwing entry reads as null. */
3
7
  export function readTimelineDurationSeconds(timeline) {
4
8
  try {
5
9
  if (typeof timeline?.duration !== "function")
6
10
  return null;
7
- const seconds = Number(timeline.duration());
11
+ const held = timeline.getChildren?.(false, false, true);
12
+ const children = Array.isArray(held) ? held : [];
13
+ const seconds = Math.max(Number(timeline.duration()), ...children.map(pausedChildEnd));
8
14
  return Number.isFinite(seconds) ? seconds : null;
9
15
  }
10
16
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/core",
3
- "version": "0.8.165",
3
+ "version": "0.8.166",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -377,9 +377,9 @@
377
377
  "linkedom": "^0.18.12",
378
378
  "postcss": "^8.5.8",
379
379
  "wawoff2": "^2.0.1",
380
- "@hyperframes/lint": "0.8.165",
381
- "@hyperframes/studio-server": "0.8.165",
382
- "@hyperframes/parsers": "0.8.165"
380
+ "@hyperframes/lint": "0.8.166",
381
+ "@hyperframes/parsers": "0.8.166",
382
+ "@hyperframes/studio-server": "0.8.166"
383
383
  },
384
384
  "devDependencies": {
385
385
  "@fontsource/archivo-black": "^5.2.8",