()
| 1807 | return sig; |
| 1808 | }; |
| 1809 | const postTimeline = () => { |
| 1810 | sanitizeCompositionDurationAttributes(); |
| 1811 | applyCompositionSizing(); |
| 1812 | applyClipLayout(); |
| 1813 | // Post resolved stage size so the parent can scale the iframe container |
| 1814 | const stageSizeRootEl = resolveRootCompositionElement(); |
| 1815 | if (stageSizeRootEl) { |
| 1816 | const w = parseDimensionPx(stageSizeRootEl.getAttribute("data-width")); |
| 1817 | const h = parseDimensionPx(stageSizeRootEl.getAttribute("data-height")); |
| 1818 | const width = w ? parseInt(w, 10) : 0; |
| 1819 | const height = h ? parseInt(h, 10) : 0; |
| 1820 | if (width > 0 && height > 0) { |
| 1821 | postRuntimeMessage({ source: "hf-preview", type: "stage-size", width, height }); |
| 1822 | } |
| 1823 | } |
| 1824 | bindRootTimelineIfAvailable(); |
| 1825 | const payload = collectRuntimeTimelinePayload({ |
| 1826 | canonicalFps: state.canonicalFps, |
| 1827 | }); |
| 1828 | window.__clipManifest = payload; |
| 1829 | |
| 1830 | const currentSignature = computeClipTreeSignature(); |
| 1831 | if (clipTreeSignature !== currentSignature) { |
| 1832 | // The timed-element set changed — leaf/in-flow caches may be stale. |
| 1833 | invalidateTimedClipCaches(); |
| 1834 | } |
| 1835 | if (!window.__clipTree || clipTreeSignature !== currentSignature) { |
| 1836 | const runtimeWindow = window as Window & { |
| 1837 | __timelines?: Record<string, RuntimeTimelineLike | undefined>; |
| 1838 | }; |
| 1839 | window.__clipTree = createClipTree({ |
| 1840 | startResolver: createRuntimeStartTimeResolver({ |
| 1841 | timelineRegistry: runtimeWindow.__timelines ?? {}, |
| 1842 | includeAuthoredTimingAttrs: true, |
| 1843 | }), |
| 1844 | timelineRegistry: runtimeWindow.__timelines ?? {}, |
| 1845 | rootDuration: payload.durationInFrames / state.canonicalFps, |
| 1846 | }); |
| 1847 | clipTreeSignature = currentSignature; |
| 1848 | } |
| 1849 | |
| 1850 | postRuntimeMessage(payload); |
| 1851 | scheduleRootStageLayoutDiagnostics(); |
| 1852 | }; |
| 1853 | |
| 1854 | const runAdapters = (method: "discover" | "pause" | "play", timeSeconds = 0) => { |
| 1855 | for (const adapter of state.deterministicAdapters) { |
no test coverage detected