(params: {
startResolver: StartResolverLike;
timelineRegistry: Record<string, RuntimeTimelineLike | undefined>;
rootDuration: number;
})
| 107 | } |
| 108 | |
| 109 | export function createClipTree(params: { |
| 110 | startResolver: StartResolverLike; |
| 111 | timelineRegistry: Record<string, RuntimeTimelineLike | undefined>; |
| 112 | rootDuration: number; |
| 113 | }): ClipTree { |
| 114 | const { startResolver, timelineRegistry, rootDuration } = params; |
| 115 | const elementToNode = new Map<Element, MutableClipNode>(); |
| 116 | |
| 117 | const root = document.querySelector("[data-composition-id]"); |
| 118 | let ordinal = 0; |
| 119 | |
| 120 | for (const el of document.querySelectorAll("[data-start]")) { |
| 121 | if (el === root || DECORATIVE_TAGS.has(el.tagName)) continue; |
| 122 | const absoluteStart = startResolver.resolveStartForElement(el, 0); |
| 123 | if (resolveDuration(el, timelineRegistry, rootDuration, absoluteStart) <= 0) continue; |
| 124 | const node: MutableClipNode = { |
| 125 | id: stableClipId(el) ?? `__clip-${ordinal++}`, |
| 126 | element: el, |
| 127 | parentId: null, |
| 128 | children: [], |
| 129 | }; |
| 130 | elementToNode.set(el, node); |
| 131 | } |
| 132 | |
| 133 | linkParentChild(elementToNode); |
| 134 | |
| 135 | return { |
| 136 | roots: Array.from(elementToNode.values()).filter((n) => n.parentId === null), |
| 137 | }; |
| 138 | } |
no test coverage detected