// THE SHELL (module `shell`, region `deck`): the deck's one page at the foot // of the frame -- its panel and title, and the band its parts draw in: the // subtitle (subtitle.mjs), the QR (qr.mjs), the rail (rail.mjs), the counter // (counter.mjs) and the claim checks (claims.mjs) are parts of this page, so // their frames are the shell's. chrome-deck.mjs writes the page; deck.mjs // holds its arithmetic. import path from "node:path"; import { deckGeometry, deckLayout } from "../deck.mjs"; import { deckHtml } from "../chrome-deck.mjs"; import { stackedDeckHtml, wordmarkOf } from "../chrome-vdeck.mjs"; import { STACKED_QR_SHARE, stackedOn } from "../vertical-deck.mjs"; import { instrumentFonts } from "./instruments-shared.mjs"; import { assertRegion, defineModule } from "./contract.mjs"; import { DECK_DEFAULTS, settingsOf } from "./settings.mjs"; export default defineModule({ id: "shell", version: 1, z: 10, kind: "overlay-whole", slot: "footer", // Its form in the stacked vertical deck (vertical-deck.mjs). vertical: { slot: "frame" }, title: "Deck", summary: "The panel at the foot of the frame: each clip's title, and the band the subtitle, QR, rail and counter draw in.", configKey: "render.chrome.deck", defaults: { height: DECK_DEFAULTS.height, footageScale: DECK_DEFAULTS.footageScale, background: DECK_DEFAULTS.background, overCards: DECK_DEFAULTS.overCards, title: DECK_DEFAULTS.title, motion: DECK_DEFAULTS.motion, }, validate: settingsOf("shell").validate, ui: [ { key: "height", type: "number", min: 120, max: 400, label: "Deck height (px)", default: DECK_DEFAULTS.height }, { key: "footageScale", type: "number", min: 0.5, max: 1, step: 0.01, label: "Footage scale", default: DECK_DEFAULTS.footageScale }, { key: "background", type: "enum", options: ["panel", "flush"], label: "Ground", default: DECK_DEFAULTS.background }, { key: "overCards", type: "enum", options: ["hide", "show"], label: "Over cards", default: DECK_DEFAULTS.overCards }, { key: "title.size", type: "number", min: 24, max: 96, label: "Title size", default: DECK_DEFAULTS.title.size }, { key: "title.maxChars", type: "number", min: 10, max: 120, label: "Title characters", default: DECK_DEFAULTS.title.maxChars }, { key: "motion.out", type: "number", min: 0, max: 2, step: 0.05, label: "Text out (s)", default: DECK_DEFAULTS.motion.out }, { key: "motion.in", type: "number", min: 0, max: 2, step: 0.05, label: "Text in (s)", default: DECK_DEFAULTS.motion.in }, { key: "motion.pip", type: "number", min: 0, max: 3, step: 0.05, label: "Marker move (s)", default: DECK_DEFAULTS.motion.pip }, ], docs: { heading: "Deck (the shell)", intro: "The panel at the foot of the frame and each clip's title (`render.chrome.deck`); its parts -- the subtitle, the QR, the rail, the counter, the claim checks -- are their own modules below.", rows: [ ["`deck.height`", "120–400 px · default 190", "`umtool look

deck.height=210`"], ["`deck.footageScale`", "0.5–1 (the footage must fit above the deck) · default 0.82", "`umtool look

deck.footageScale=0.8`"], ["`deck.background`", "`panel` · `flush` · default `panel`", "`umtool look

deck.background=flush`"], ["`deck.overCards`", "`hide` (the deck slides away over a card, and the layers that keep no time of their own are left out over it: a full-frame item, [report-video.md](report-video.md#no-chrome-over-a-full-frame-item)) · `show` (the deck and every layer stay over it) · default `hide`", "`umtool look

deck.overCards=show`"], ["`deck.title`", "`{size 24–96, maxChars 10–120}` · default 54, 48", "`umtool look

deck.title='{\"size\":60}'`"], ["`deck.motion`", "`{out 0–2, in 0–2, pip 0–3}` s · default 0.3, 0.45, 0.7", "`umtool look

deck.motion='{\"in\":0.6}'`"], ], }, region: "deck", // It slides away over a full-frame item and back on its own (deckChoreography): only a video entry's and an // analysis item's spans are left out of it (full-frame.mjs). fullFrame: { followsDeck: true }, workers: "wide", noun: "the deck's", on: () => true, async page(ctx) { const { render, schedule } = ctx; // THE STACKED VERTICAL DECK (vertical-deck.mjs): the same schedule, drawn over the 9:16 frame -- the rail, // each segment's source block and its QR, the tally, the wordmark (chrome-vdeck.mjs). if (stackedOn(render)) { const fonts = await instrumentFonts(ctx); const qrSrcs = {}; const byUrl = await ctx.qrs(schedule.segments.map((s) => s.qrUrl), Math.round(render.width * STACKED_QR_SHARE)); for (const s of schedule.segments) if (s.qrUrl) qrSrcs[s.id] = byUrl.get(s.qrUrl); return stackedDeckHtml(schedule, render, { fonts, qrSrcs, from: ctx.from, duration: ctx.duration, site: wordmarkOf(ctx.manifest?.provenance) }); } const fonts = await ctx.fonts({ regular: "DeckSans", bold: "DeckSansBold" }, { strict: true }); // With the schedule: a staggered marker band moves the QR down and may shrink it. const lay = deckLayout(render, { schedule }); const qrSrcs = {}; if (lay.qr) { const byUrl = await ctx.qrs(schedule.segments.map((s) => s.qrUrl), lay.qr.size); for (const s of schedule.segments) if (s.qrUrl) qrSrcs[s.id] = byUrl.get(s.qrUrl); } // Its items -- each segment's text, each pip -- go to the frame keys. const items = []; const html = deckHtml(schedule, render, { fonts, qrSrcs, from: ctx.from, duration: ctx.duration, items }); return { html, items }; }, regions(_schedule, { render, outDir, frames = null }) { const { deck } = deckGeometry(render); return [assertRegion({ name: "deck", frames: frames ?? path.join(outDir, "chrome", "deck-frames"), ...deck })]; }, frameKeys: { data: "deck-data", omit: ["init", "cues", "window", "total", "ids"] }, });