// THE TEASER (module `teaser`, a segment): a full-frame card of lines that pop // in on the beat, inserted into the cut as a timeline entry of its own // (`{ type: "teaser" }`, deck.mjs). chrome-teaser.mjs writes the page; the // build encodes its frames into segments/.mp4 (build-video's // buildTeaserSegment). import { teaserSeconds, validateTeaser, validateTeasers } from "../deck.mjs"; import { defineModule } from "./contract.mjs"; export default defineModule({ id: "teaser", version: 1, z: 0, kind: "segment", slot: "full", // Its form in the stacked vertical deck (vertical-deck.mjs). vertical: { slot: "segment" }, title: "Teaser", summary: "A full-frame card of lines popping in on the beat, inserted as its own segment.", validate: (_value, { manifest }) => validateTeasers(manifest), docs: { heading: "Teaser", intro: "A timeline entry `{ type: \"teaser\", lines, … }`: a full-frame card whose lines pop in on the beat, cut in as its own segment (deck.mjs `validateTeaser`; [report-video.md](report-video.md)). Full frame: the deck, the instruments and the feed slide away over it, and every layer that keeps no time of its own -- the diet strip, the promise clock, the goals, the streak, the side panels, the chapters, the finale's pages -- is left out from its first frame (a dip's black) to the frame before its dissolve out ends ([report-video.md](report-video.md#no-chrome-over-a-full-frame-item)); its stamps stay when it carries marks; a teaser that counts (marks, no dip) keeps the deck and every layer up.", rows: [ ["a `teaser` entry", "`lines` (each `{text, role?, hold?, …}`), `tail?`, `dip?`", "`umtool timeline

insert …`"], ], }, region: "teaser", workers: "wide", noun: "the teaser's", entry(manifest, segment) { const teaser = (manifest.timeline ?? []).find((e) => e.id === segment && e.type === "teaser") ?? null; if (!teaser) return null; const errors = validateTeaser(teaser); if (errors.length) throw new Error(`teaser ${teaser.id}: ${errors.join("; ")}`); return teaser; }, seconds: (entry, D, fps) => teaserSeconds(entry, D, fps), names: ({ preview, entry }) => ({ project: `teaser-${preview ? "preview-" : ""}${entry.id}`, stem: `teaser-${entry.id}` }), async page(ctx) { // A page module reached by a dynamic import, so nothing that imports this // file -- umtool's preview helper, the build -- loads its face's URL // unless a teaser is being composed (docs/quirks.md). const { teaserHtml, TEASER_FONT_FILE, TEASER_FONT_ASSET } = await import("../chrome-teaser.mjs"); await ctx.projectFile(TEASER_FONT_FILE, TEASER_FONT_ASSET); return teaserHtml(ctx.entry, ctx.render, { font: TEASER_FONT_ASSET, transition: ctx.transition }); }, // A cue interpreter: a teaser whose words changed recaptures only the frames they are on. frameKeys: { data: "teaser-data", omit: ["init", "cues"] }, });