// THE THREAD RAIL (module `threads`, region `threads`): the left panel beside // the footage, a card per thread lit as its clips play (`render.chrome.threads`, // threads.mjs). chrome-threads.mjs writes the page. import path from "node:path"; import { threadsGeometry } from "../deck.mjs"; import { threadsHtml } from "../chrome-threads.mjs"; import { assertRegion, defineModule } from "./contract.mjs"; import { settingsOf } from "./settings.mjs"; /** The side panel as an overlay region (the thread rail's and the flips'). */ export function sideRegion(render, frames, name) { const { cards: _c, ...box } = threadsGeometry(render); return assertRegion({ name, frames, ...box }); } export default defineModule({ id: "threads", version: 1, z: 70, kind: "overlay-whole", slot: "side", title: "Thread rail", summary: "A card per thread beside the footage, lit as its clips play.", validate: settingsOf("threads").validate, docs: { heading: "Thread rail", intro: "A card per thread in the side panel beside the footage, lit as its clips play; a thread’s outcome stamped on its last clip (`render.chrome.threads`, threads.mjs).", rows: [ ["`render.chrome.threads.list[]`", "`{id, label, outcome?: {verdict, label?}}`; a clip names its thread with `thread`", "`umtool look

chrome.threads=…` (manifest)"], ], }, region: "threads", workers: "narrow", noun: "the thread rail's", configKey: "render.chrome.threads", on: (schedule) => !!schedule?.threads?.threads?.length, check: (schedule) => (!schedule.threads?.threads?.length ? "the threads region needs a schedule with a thread rail (render.chrome.threads)" : null), async page(ctx) { // The thread rail (chrome-threads.mjs): the deck's faces, no QR. const fonts = await ctx.fonts({ regular: "DeckSans", bold: "DeckSansBold" }, { strict: true }); return threadsHtml(ctx.schedule, ctx.render, { fonts, from: ctx.from, duration: ctx.duration }); }, regions(_schedule, { render, outDir, frames = null }) { return [sideRegion(render, frames ?? path.join(outDir, "chrome", "threads-frames"), "threads")]; }, // Its page is its live preview: Play the cut seeks it in the cut's seconds (contract.mjs, PLAY). play: { clock: "cut", ready: "threads:ready" }, // A cue interpreter like the deck's: keyed per frame (frame-keys.mjs). frameKeys: { data: "threads-data", omit: ["init", "cues", "window", "total", "ids"] }, });