// THE SECTION TITLE (module `section-title`, a part of the shell): the // CURRENT section's name -- what chapter of the cut this is -- on one quiet // line centred just under the rail (`render.chrome.deck.sectionTitle`). The // sections are the rail's (rail.mjs, deck.mjs railSections): the stretch // before the first marker, then one from each marker on; a section's title // is the label of the marker that opened it, `first` before any, and a // marker with no label shows nothing for its section. It crossfades as the // marker crosses into another section (chrome-deck.mjs // sectionTitleTimeline). Independent of `rail.labels`: a rail with no words // on its track can still say which section it is in, here. // // Drawn in the deck's page (its row is deckLayout's `sectionTitle`, between // the track and the clip's title; the title moves down only by what the line // needs), so it slides away with the deck over a card and its frames are the // shell's: each title is an item of the page, keyed only on the frames it is // up on. Absent or `false`, the deck is the one it always was. import { DECK_DEFAULTS, MARKER_PALETTE_KEYS, SECTION_TITLE_COLORS, SECTION_TITLE_DEFAULTS, SECTION_TITLE_LIMITS, settingsOf } from "./settings.mjs"; import { defineModule } from "./contract.mjs"; const L = SECTION_TITLE_LIMITS; export default defineModule({ id: "section-title", version: 1, z: 16, kind: "part", host: "shell", slot: "inline", // Its form in the stacked vertical deck (vertical-deck.mjs). vertical: { slot: "inline" }, title: "Section title", summary: "The current section's name (the marker that opened it) on one quiet line under the rail.", configKey: "render.chrome.deck.sectionTitle", defaults: SECTION_TITLE_DEFAULTS, deps: ["rail.sections"], validate: settingsOf("section-title").validate, resolve(render) { const v = render?.chrome?.deck?.sectionTitle; if (v === true) return { ...SECTION_TITLE_DEFAULTS }; if (!v || typeof v !== "object" || Array.isArray(v)) return null; return { ...SECTION_TITLE_DEFAULTS, ...v, first: String(v.first ?? "").trim() }; }, ui: [ { key: "first", type: "text", label: "First section's title", default: "", help: `the section before the first marker (at most ${L.first} characters); the others are their markers' labels` }, { key: "size", type: "number", min: L.size[0], max: L.size[1], step: 1, label: "Size (px)", default: SECTION_TITLE_DEFAULTS.size }, { key: "opacity", type: "number", min: L.opacity[0], max: L.opacity[1], step: 0.05, label: "Opacity", default: SECTION_TITLE_DEFAULTS.opacity }, { key: "fade", type: "number", min: L.fade[0], max: L.fade[1], step: 0.05, label: "Crossfade (s)", default: SECTION_TITLE_DEFAULTS.fade }, { key: "color", type: "color", label: "Colour", default: SECTION_TITLE_DEFAULTS.color, help: `${SECTION_TITLE_COLORS.map((c) => `"${c}"`).join(" · ")} (its section's) · a #hex · ${MARKER_PALETTE_KEYS.join(", ")}` }, ], docs: { heading: "Section title", intro: "The current section's name on one quiet line centred under the rail (`render.chrome.deck.sectionTitle`): the label of the marker that opened the section ([Rail](#rail)), `first` before any marker; a marker with no label shows nothing for its section. Inside a subsection (a marker with `level: 2`) it says both, \"Section › Sub\" (the section's name alone when the subsection has no label). It crossfades as the rail's marker crosses into the next section, rides the deck away over a card, and is independent of `deck.rail.labels` -- the track can carry no words while this says where the cut is. Off unless set: absent or `false` draws the deck as it always was. The clip's title moves down only by what the line needs.", rows: [ ["`deck.sectionTitle`", "`true` (on, every default) · `false` · an object of the keys below · default off", "`umtool look

deck.sectionTitle=true`"], ["`deck.sectionTitle.first`", `the section before the first marker: a line of at most ${L.first} characters · default \`""\` (nothing)`, "`umtool look

deck.sectionTitle='{\"first\":\"Who she is\"}'`"], ["`deck.sectionTitle.size`", `${L.size[0]}–${L.size[1]} px · default ${SECTION_TITLE_DEFAULTS.size} (a touch under the subtitle's ${Math.round(DECK_DEFAULTS.title.size * 0.48)})`, "`umtool look

deck.sectionTitle.size=20`"], ["`deck.sectionTitle.opacity`", `${L.opacity[0]}–${L.opacity[1]} · default ${SECTION_TITLE_DEFAULTS.opacity}`, "`umtool look

deck.sectionTitle.opacity=0.7`"], ["`deck.sectionTitle.fade`", `${L.fade[0]}–${L.fade[1]} s: the old title out over its first half, the new in over the second (0: a cut) · default ${SECTION_TITLE_DEFAULTS.fade}`, "`umtool look

deck.sectionTitle.fade=0.6`"], ["`deck.sectionTitle.color`", `\`auto\` (the subtitle's muted grey, lifted toward the deck's fg only as far as it needs to read at 4.5:1 at that opacity) · \`section\` (its section's colour, fitted to 4.5:1) · a \`#hex\` · a palette key (${MARKER_PALETTE_KEYS.map((k) => `\`${k}\``).join(", ")}) · default \`auto\``, "`umtool look

deck.sectionTitle.color=section`"], ], }, });