// THE DESIGN UNITS every chrome module lays out in (release 39, the // video-modules toolkit). A module's own pixel constants are in these units -- // a 1920×1080 frame -- and the layout engine (layout.mjs) scales them to the // output size. A constant another module needs lives HERE, once: no module // owns a pixel constant for another (the tally's 124 px cell used to be // written in deck.mjs and again in factcheck.mjs). // // No imports. deck.mjs, factcheck.mjs and the modules all read this file, and // it must evaluate before any of them whatever imports first (a cycle through // a module that computes a constant from another's at load is a TDZ error). /** The design frame: every design-unit constant is a pixel of a frame this size. */ export const DESIGN = Object.freeze({ width: 1920, height: 1080 }); /** The deck's side padding: the rail's ends, the text's left, the QR's right. */ export const DECK_PAD_X = 48; /** * The counter's (the fact-check tally's) cell: one per series the cut counts, * `cell` wide with `gap` between, its label in the cell less `labelPad` a side. */ export const COUNTER_CELL = Object.freeze({ cell: 124, gap: 10, labelPad: 6 }); /** * THE DENSE COUNTER (lane leaflit-labels): past 8 series (up to 12, counter.mjs * COUNTER_LIMITS) the cells share `budget` px -- the room 8 cells took less a * cell, so the deck's title keeps a column -- `gap` apart. 9 cells are 99 px, * 12 are 72; a label that does not fit its narrower cell is drawn smaller, * then cut (factcheck.mjs fitTallyLabel). */ export const COUNTER_DENSE = Object.freeze({ budget: 1040, gap: 8, from: 9 }); /** The counter's cell for `n` series: COUNTER_CELL's up to 8, else the dense row's. */ export function counterCell(n) { if (!(n >= COUNTER_DENSE.from)) return { cell: COUNTER_CELL.cell, gap: COUNTER_CELL.gap, labelPad: COUNTER_CELL.labelPad }; const { budget, gap } = COUNTER_DENSE; return { cell: Math.floor((budget - gap * (n - 1)) / n), gap, labelPad: COUNTER_CELL.labelPad }; } /** A design-unit length at this render's width (what the scaled geometry multiplies by). */ export const designScale = (render) => (render?.width ?? DESIGN.width) / DESIGN.width;