@hyperframes/studio 0.8.221 → 0.8.222
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/assets/{hyperframes-player-B_wvwarc.js → hyperframes-player-Dka6e1BG.js} +1 -1
- package/dist/assets/{index-BDE7dwov.js → index-C8VIUiGz.js} +117 -117
- package/dist/assets/{index-D0jGq2dS.js → index-CVPNbydK.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/index.js +7 -2
- package/package.json +8 -8
- package/src/player/hooks/timelineDomBinding.test.ts +21 -0
- package/src/player/hooks/timelineSyncHydration.ts +11 -8
- package/src/player/lib/timelineDOM.ts +9 -0
- package/src/utils/timelineElementSplit.ts +2 -3
package/dist/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
document.documentElement.dataset.theme = "paper";
|
|
15
15
|
}
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/assets/index-C8VIUiGz.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/assets/index-RUPGNyct.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
package/dist/index.js
CHANGED
|
@@ -178,6 +178,7 @@ import {
|
|
|
178
178
|
splitTimelineElementKey,
|
|
179
179
|
studioApiFetch,
|
|
180
180
|
toHexColor,
|
|
181
|
+
withSelectorIndexPass,
|
|
181
182
|
wrapTimeline
|
|
182
183
|
} from "./chunk-OGIOFEC7.js";
|
|
183
184
|
import "./chunk-MLKGABMK.js";
|
|
@@ -19758,7 +19759,7 @@ var TimelineClip = memo14(function TimelineClip2({
|
|
|
19758
19759
|
});
|
|
19759
19760
|
|
|
19760
19761
|
// src/utils/timelineElementSplit.ts
|
|
19761
|
-
|
|
19762
|
+
import { SPLIT_BOUNDARY_EPSILON_S } from "@hyperframes/core/composition-contract";
|
|
19762
19763
|
function isSplitTimeWithinBounds(splitTime, clipStart2, clipDuration2) {
|
|
19763
19764
|
return splitTime >= clipStart2 + SPLIT_BOUNDARY_EPSILON_S && splitTime <= clipStart2 + clipDuration2 - SPLIT_BOUNDARY_EPSILON_S;
|
|
19764
19765
|
}
|
|
@@ -30390,6 +30391,9 @@ function createTimelineElementFromManifestClip(params) {
|
|
|
30390
30391
|
return entry3;
|
|
30391
30392
|
}
|
|
30392
30393
|
function parseTimelineFromDOM(doc, rootDuration, timelines) {
|
|
30394
|
+
return withSelectorIndexPass(doc, () => scanTimelineFromDOM(doc, rootDuration, timelines));
|
|
30395
|
+
}
|
|
30396
|
+
function scanTimelineFromDOM(doc, rootDuration, timelines) {
|
|
30393
30397
|
const rootComp = doc.querySelector("[data-composition-id]");
|
|
30394
30398
|
const nodes = doc.querySelectorAll("[data-start]");
|
|
30395
30399
|
const els = [];
|
|
@@ -30665,7 +30669,7 @@ function safeContentDocument(iframe) {
|
|
|
30665
30669
|
}
|
|
30666
30670
|
function buildTimelineElementsFromClips(clips, iframeDoc) {
|
|
30667
30671
|
const resolveHost = iframeDoc ? createTimelineDomNodeResolver(iframeDoc) : null;
|
|
30668
|
-
|
|
30672
|
+
const build = () => clips.map((clip, index2) => {
|
|
30669
30673
|
const hostEl = resolveHost?.(clip, index2) ?? null;
|
|
30670
30674
|
return createTimelineElementFromManifestClip({
|
|
30671
30675
|
clip,
|
|
@@ -30674,6 +30678,7 @@ function buildTimelineElementsFromClips(clips, iframeDoc) {
|
|
|
30674
30678
|
hostEl
|
|
30675
30679
|
});
|
|
30676
30680
|
});
|
|
30681
|
+
return iframeDoc ? withSelectorIndexPass(iframeDoc, build) : build();
|
|
30677
30682
|
}
|
|
30678
30683
|
function syncManifestTimeline(els, manifestDuration, storeDuration, sync) {
|
|
30679
30684
|
const hasDuration = manifestDuration > 0 && els.length > 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/studio",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.222",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"dockview-react": "8.3.1",
|
|
61
61
|
"gsap": "^3.13.0",
|
|
62
62
|
"mediabunny": "^1.45.3",
|
|
63
|
-
"@hyperframes/core": "0.8.
|
|
64
|
-
"@hyperframes/parsers": "0.8.
|
|
65
|
-
"@hyperframes/player": "0.8.
|
|
66
|
-
"@hyperframes/sdk": "0.8.
|
|
67
|
-
"@hyperframes/
|
|
68
|
-
"@hyperframes/
|
|
63
|
+
"@hyperframes/core": "0.8.222",
|
|
64
|
+
"@hyperframes/parsers": "0.8.222",
|
|
65
|
+
"@hyperframes/player": "0.8.222",
|
|
66
|
+
"@hyperframes/sdk": "0.8.222",
|
|
67
|
+
"@hyperframes/shader-transitions": "0.8.222",
|
|
68
|
+
"@hyperframes/studio-server": "0.8.222"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"vite": "^6.4.2",
|
|
83
83
|
"vitest": "^4.1.11",
|
|
84
84
|
"zustand": "^5.0.0",
|
|
85
|
-
"@hyperframes/producer": "0.8.
|
|
85
|
+
"@hyperframes/producer": "0.8.222"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"react": "19",
|
|
@@ -167,3 +167,24 @@ describe("live DOM manifest hydration", () => {
|
|
|
167
167
|
expect(findTimelineDomNodeForClip(doc, clip({ start: 9 }), 0)?.id).toBe("stable");
|
|
168
168
|
});
|
|
169
169
|
});
|
|
170
|
+
|
|
171
|
+
describe("selector occurrence indexes while hydrating many clips", () => {
|
|
172
|
+
it("queries the document once for a class many clips share, not once per clip", () => {
|
|
173
|
+
const count = 200;
|
|
174
|
+
const spans = Array.from(
|
|
175
|
+
{ length: count },
|
|
176
|
+
(_, i) =>
|
|
177
|
+
`<span class="clip w" data-start="${i}" data-duration="1" data-track-index="0"></span>`,
|
|
178
|
+
).join("");
|
|
179
|
+
const doc = documentWith(spans);
|
|
180
|
+
const query = vi.spyOn(doc, "querySelectorAll");
|
|
181
|
+
const clips = Array.from({ length: count }, (_, i) => clip({ tagName: "span", start: i }));
|
|
182
|
+
|
|
183
|
+
const elements = buildTimelineElementsFromClips(clips, doc);
|
|
184
|
+
|
|
185
|
+
expect(elements).toHaveLength(count);
|
|
186
|
+
expect(query.mock.calls.filter(([selector]) => selector === ".w").length).toBeLessThanOrEqual(
|
|
187
|
+
1,
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* an argument, so each is callable — and readable — on its own.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import { withSelectorIndexPass } from "../../utils/sourceScopedSelectorIndex";
|
|
12
13
|
import { createTimelineDomNodeResolver, findClipElementById } from "../lib/timelineElementHelpers";
|
|
13
14
|
import { usePlayerStore } from "../store/playerStore";
|
|
14
15
|
import type { TimelineElement, DomClipChild, SubCompositionHostState } from "../store/playerStore";
|
|
@@ -214,15 +215,17 @@ export function buildTimelineElementsFromClips(
|
|
|
214
215
|
iframeDoc: Document | null,
|
|
215
216
|
): TimelineElement[] {
|
|
216
217
|
const resolveHost = iframeDoc ? createTimelineDomNodeResolver(iframeDoc) : null;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
218
|
+
const build = () =>
|
|
219
|
+
clips.map((clip, index) => {
|
|
220
|
+
const hostEl = resolveHost?.(clip, index) ?? null;
|
|
221
|
+
return createTimelineElementFromManifestClip({
|
|
222
|
+
clip,
|
|
223
|
+
fallbackIndex: index,
|
|
224
|
+
doc: iframeDoc,
|
|
225
|
+
hostEl,
|
|
226
|
+
});
|
|
224
227
|
});
|
|
225
|
-
|
|
228
|
+
return iframeDoc ? withSelectorIndexPass(iframeDoc, build) : build();
|
|
226
229
|
}
|
|
227
230
|
|
|
228
231
|
/**
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import type { TimelineElement } from "../store/playerStore";
|
|
12
12
|
import type { ClipManifestClip, IframeWindow, TimelineLike } from "./playbackTypes";
|
|
13
|
+
import { withSelectorIndexPass } from "../../utils/sourceScopedSelectorIndex";
|
|
13
14
|
import { resolveCssStackingContextId } from "@hyperframes/core/runtime/stacking-context";
|
|
14
15
|
import { readClipTiming } from "@hyperframes/core/composition-contract";
|
|
15
16
|
import { readMasterFxChain } from "@hyperframes/core/audio-groups";
|
|
@@ -234,6 +235,14 @@ export function parseTimelineFromDOM(
|
|
|
234
235
|
doc: Document,
|
|
235
236
|
rootDuration: number,
|
|
236
237
|
timelines?: Readonly<Record<string, TimelineLike>>,
|
|
238
|
+
): TimelineElement[] {
|
|
239
|
+
return withSelectorIndexPass(doc, () => scanTimelineFromDOM(doc, rootDuration, timelines));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function scanTimelineFromDOM(
|
|
243
|
+
doc: Document,
|
|
244
|
+
rootDuration: number,
|
|
245
|
+
timelines?: Readonly<Record<string, TimelineLike>>,
|
|
237
246
|
): TimelineElement[] {
|
|
238
247
|
const rootComp = doc.querySelector("[data-composition-id]");
|
|
239
248
|
const nodes = doc.querySelectorAll("[data-start]");
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { SPLIT_BOUNDARY_EPSILON_S } from "@hyperframes/core/composition-contract";
|
|
1
2
|
import type { TimelineElement } from "../player/store/playerStore";
|
|
2
3
|
|
|
3
4
|
export { buildPatchTarget, readFileContent } from "../hooks/timelineEditingHelpers";
|
|
4
|
-
|
|
5
|
-
/** Minimum distance (seconds) from clip boundaries to allow a split. */
|
|
6
|
-
export const SPLIT_BOUNDARY_EPSILON_S = 0.03;
|
|
5
|
+
export { SPLIT_BOUNDARY_EPSILON_S };
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* True when splitTime leaves at least SPLIT_BOUNDARY_EPSILON_S on both sides
|