// THE FLIPS PANEL (module `flips`, region `flips`): then-and-now pairs in the // side panel -- the thread rail's region, one or the other // (`render.chrome.flips`, flips.mjs). chrome-flips.mjs writes the page. import path from "node:path"; import { flipsHtml } from "../chrome-flips.mjs"; import { defineModule } from "./contract.mjs"; import { settingsOf } from "./settings.mjs"; import { sideRegion } from "./threads.mjs"; export default defineModule({ id: "flips", version: 1, z: 80, kind: "overlay-whole", slot: "side", title: "Flips", summary: "Pairs of what was said then and now, in the side panel.", validate: settingsOf("flips").validate, docs: { heading: "Flips", intro: "Then-and-now pairs in the side panel (`render.chrome.flips`, flips.mjs); the thread rail and the flips share the panel: one or the other.", rows: [ ["`render.chrome.flips`", "see flips.mjs", "manifest"], ], }, region: "flips", workers: "narrow", noun: "the flips panel's", configKey: "render.chrome.flips", on: (schedule) => !!schedule?.flips?.pairs?.length, check: (schedule) => (!schedule.flips?.pairs?.length ? "the flips region needs a schedule with flip pairs (render.chrome.flips)" : null), async page(ctx) { // The flips panel (chrome-flips.mjs): the deck's faces, no QR. const fonts = await ctx.fonts({ regular: "DeckSans", bold: "DeckSansBold" }, { strict: true }); return flipsHtml(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", "flips-frames"), "flips")]; }, // Its page is its live preview: Play the cut seeks it in the cut's seconds (contract.mjs, PLAY). play: { clock: "cut", ready: "flips:ready" }, // A cue interpreter like the deck's: keyed per frame (frame-keys.mjs). frameKeys: { data: "flips-data", omit: ["init", "cues", "window", "total", "ids"] }, });