Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(producer): preserve inner root element when inlining sub-compositions
Miguel Ángel5aff328a9bd8
diff --git a/packages/producer/src/services/htmlCompiler.ts b/packages/producer/src/services/htmlCompiler.tsindex 533e04c7ed..2203b764e1 100644--- a/packages/producer/src/services/htmlCompiler.ts+++ b/packages/producer/src/services/htmlCompiler.ts@@ -559,6 +559,19 @@ function inlineSubCompositions(if (!hosts.length) return html;+ const FLATTENED_INNER_ROOT_STRIP_ATTRS = [+ "data-composition-id",+ "data-composition-file",+ "data-start",+ "data-duration",+ "data-end",+ "data-track-index",+ "data-track",+ "data-composition-src",+ "data-hf-authored-duration",+ "data-hf-authored-end",+ ];+const result = inlineSubCompositionsShared(document as unknown as Document,hosts as unknown as Element[],@@ -574,6 +587,19 @@ function inlineSubCompositions(return compHtml;},parseHtml: (htmlStr: string) => parseHTML(htmlStr).document as unknown as Document,+ flattenInnerRoot: (innerRoot: Element): Element => {+ const prepared = innerRoot.cloneNode(true) as Element;+ const authoredRootId = prepared.getAttribute("id")?.trim();+ for (const attrName of FLATTENED_INNER_ROOT_STRIP_ATTRS) {+ prepared.removeAttribute(attrName);+ }+ if (authoredRootId) {+ prepared.removeAttribute("id");+ prepared.setAttribute("data-hf-authored-id", authoredRootId);+ }+ prepared.setAttribute("data-hf-inner-root", "true");+ return prepared;+ },scriptErrorLabel: "[Compiler] Composition script failed",},);