fix(player,studio): resolve root timeline from DOM instead of last key (#247)

Bundled previews register a master composition alongside its sub-compositions
in `window.__timelines`, e.g. { main, intro, scene2, scene5 }. Both the
player's probe and studio's getAdapter() were using `keys[keys.length - 1]`
to pick the adapter, which returned whichever timeline was registered last.

That made the player report the final sub-composition's duration as the
video length (e.g. 3.2s instead of the master's 14s) and play/pause/seek
targeted that sub-composition instead of the full composition.

Look up the outermost `[data-composition-id]` element in the iframe DOM
and use its id to select the right timeline. Falls back to last-key when
no element is present (standalone sub-composition previews) so drill-down
views keep working.

Also restores `main`/`import` entry points on @hyperframes/player to
point at compiled dist output (the src/ paths broke workspace consumers
that only receive the published tarball).
This commit is contained in:
Miguel Ángel
2026-04-13 23:15:08 +02:00
committed by GitHub
parent 1dd898786c
commit f40447f2e8
3 changed files with 26 additions and 7 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@hyperframes/player",
"version": "0.2.5",
"version": "0.2.6",
"description": "Embeddable web component for HyperFrames compositions",
"repository": {
"type": "git",
@@ -11,13 +11,13 @@
"dist"
],
"type": "module",
"main": "./src/hyperframes-player.ts",
"types": "./src/hyperframes-player.ts",
"main": "./dist/hyperframes-player.js",
"types": "./dist/hyperframes-player.d.ts",
"exports": {
".": {
"types": "./src/hyperframes-player.ts",
"types": "./dist/hyperframes-player.d.ts",
"script": "./dist/hyperframes-player.global.js",
"import": "./src/hyperframes-player.ts",
"import": "./dist/hyperframes-player.js",
"require": "./dist/hyperframes-player.cjs"
}
},