// THE SHELF (module `shelf`, region `shelf`): a strip cleared beside the footage // -- under it (the footage moved to the frame's top) or over it -- for what a // video wants in view without standing on the picture (`render.chrome.deck.shelf`, // shelf-settings.mjs; deck.mjs deckGeometry moves the footage and names the // strip). Its occupants stand in it left to right (measure-extras.mjs // shelfLayout): the measure extras that take `position: "shelf"` -- the diet's // dated tags, the streak chain, a goal stack, the moving start -- each its own // module's page in its slot, and an entry's `shelfNote`, drawn by this module's // own page (chrome-shelf.mjs) in the slot that is left. import path from "node:path"; import { shelfHtml, shelfNoteGeometry, shelfNotes, shelfOn } from "../chrome-shelf.mjs"; import { assertRegion, defineModule } from "./contract.mjs"; import { resolveShelf, SHELF_DEFAULTS, SHELF_FINALE, SHELF_ITEMS, SHELF_LIMITS, SHELF_MIN, SHELF_NOTE_MAX, SHELF_SIDES } from "./shelf-settings.mjs"; import { settingsOf } from "./settings.mjs"; export default defineModule({ id: "shelf", version: 1, z: 64, kind: "overlay-whole", slot: "shelf", // Its form in the stacked vertical deck (vertical-deck.mjs). vertical: { slot: "shelf" }, title: "Shelf", summary: "A strip cleared under (or over) the footage for the diet's dated tags, the streak chain, a goal stack or an entry's note -- nothing on it stands on the picture.", configKey: "render.chrome.deck.shelf", defaults: SHELF_DEFAULTS, validate: settingsOf("shelf").validate, resolve: resolveShelf, ui: [ { key: "show", type: "boolean", label: "A shelf beside the footage", default: true }, { key: "side", type: "enum", options: SHELF_SIDES, label: "Side of the footage", default: "below" }, { key: "items", type: "list", options: SHELF_ITEMS, label: "On it, left to right", help: "default: the measure extras whose position is \"shelf\", then the note" }, { key: "gap", type: "number", min: SHELF_LIMITS.gap[0], max: SHELF_LIMITS.gap[1], label: "Air between two (design px)", default: SHELF_DEFAULTS.gap }, { key: "finale", type: "enum", options: SHELF_FINALE, label: "Over the finale", default: "hide" }, ], docs: { heading: "Shelf", intro: `A strip of the frame cleared beside the footage (\`render.chrome.deck.shelf\`, shelf-settings.mjs): the footage moves to the frame's top, \`railGap\` (24 px) in (\`side: "below"\`), or down onto the deck (\`"above"\`), and what it leaves -- as wide as the footage, 24 px clear of it and of the frame's edge or the deck -- is the shelf (beside the instruments' column, 1248×116 at (24, 750)). Everything that reads the footage box (the instruments, the posts, the chapter band, the finale, Play) follows it. Its occupants stand in it left to right in \`items\` order, \`gap\` apart, each at its own width scaled to the shelf's height (all a size down together when they would not fit; a goal stack on it takes the width left over, its notes fanning wider, so the shelf does not end in a gap): the measure extras that take \`position: "shelf"\` -- \`diet\` (its dated tags by default: \`deck.diet.form\`), \`streak\`, \`goals\`, \`peak\` -- and \`note\`, an entry's \`shelfNote\` in the width left (a chip that comes and goes with its entry; at least 160 px). Nothing covers the shelf, so its occupants never dodge a post card or a chapter band (an entry's \`hideModules\` still hides one). It needs ${SHELF_MIN} px of room or the deck refuses, naming the way out (a smaller \`footageScale\`, or \`subtitle.lines 1\`): with the instruments' column it is 116 px, 77 with \`subtitle.lines: 2\`; full-width footage at the default 0.82 leaves none. Off (absent, \`false\`), the footage stands where it always did.`, rows: [ ["`deck.shelf`", "`true` · `false` · `{show, side, items, gap, finale}` · default off", "`umtool look
deck.shelf=true deck.diet.position=shelf deck.streak.position=shelf`"], ["`deck.shelf.side`", "`below` (the footage at the top) · `above` (the footage on the deck) · default `below`", "`umtool look
deck.shelf.side=above`"], ["`deck.shelf.items`", `a list of distinct ${SHELF_ITEMS.map((i) => `\`${i}\``).join(" ")} · default the measure extras whose \`position\` is \`shelf\`, then \`note\`; an extra listed here is on the shelf, and one whose position is \`shelf\` must be listed`, "`umtool look
deck.shelf.items='[\"diet\",\"streak\"]'`"], ["`deck.shelf.gap`, `.finale`", `${SHELF_LIMITS.gap.join("–")} design px · \`hide\` \`show\` · default ${SHELF_DEFAULTS.gap}, \`hide\` (its occupants hide over the finale with it)`, "`umtool look
deck.shelf.finale=show`"], ["a timeline entry's `shelfNote`", `one line of at most ${SHELF_NOTE_MAX} characters, shown in the shelf's \`note\` slot over the entry's span · any entry`, "`umtool set