// THE RAIL (module `rail`, a part of the shell): the deck's pip track -- a // pip per clip, the marker on the one playing, the fuse burning toward the // next -- and the markers' flags over it (deck.mjs `pipXs`, `deckMarkers`; // chrome-deck.mjs `deckCues`). The finale redraws it large (finale.mjs). // // `pip.spacing`: // - "even" (the default): the pips spread evenly over the track. // - "time": each pip at its clip's middle in the cut's clock. // - "pitch": each pip `pip.pitch` px after the one before, from the track's // left end, and the fuse measured against the whole track -- so a pip's // place, and the fuse's progress to it, depend on the clips before it // alone, and a clip inserted later moves nothing drawn before it (the // frame keys then reuse those frames). The pips the cut has not reached // are not drawn until the fuse sets off toward them. A cut with more pips // than the track holds at that pitch lays them at the pitch that fits. // // `pip.color: "section"`: the rail in SECTIONS -- from one marker's boundary // to the next, in that marker's colour (before the first, `pip.sectionColor0`, // else the accent). Every pip (dim until lit), the fuse (a bar per section) // and the marker's ring take their section's colour, fitted to 3:1 on the // deck's ground. A marker may have no label: a tick at its boundary, no // words, and no band over the track for it; `rail.labels: false` drops every // marker's words. A marker with `level: 2` is a SUBSECTION: a shorter flag in // its section's colour, a quieter label, no section colour of its own. import { DECK_DEFAULTS, MARKER_ALIGNS, MARKER_LAYOUTS, PIP_COLORS, PIP_PITCH, PIP_PITCH_DEFAULT, PIP_SPACINGS, settingsOf } from "./settings.mjs"; import { defineModule } from "./contract.mjs"; export default defineModule({ id: "rail", version: 1, z: 13, kind: "part", host: "shell", slot: "inline", // Its form in the stacked vertical deck (vertical-deck.mjs). vertical: { slot: "inline" }, title: "Rail", summary: "The deck's pip track: a pip per clip, the marker, the fuse, and the markers' flags.", configKey: "render.chrome.deck.pip", configKeys: ["render.chrome.deck.markers", "render.chrome.deck.markerLayout", "render.chrome.deck.rail"], defaults: { pip: DECK_DEFAULTS.pip, markers: DECK_DEFAULTS.markers, markerLayout: DECK_DEFAULTS.markerLayout }, provides: ["rail.layout", "rail.sections"], validate: settingsOf("rail").validate, resolve(render) { const d = render?.chrome?.deck ?? {}; const pip = { ...DECK_DEFAULTS.pip, ...(d.pip ?? {}) }; return { pip: pip.spacing === "pitch" ? { ...pip, pitch: pip.pitch ?? PIP_PITCH_DEFAULT } : pip, markers: d.markers ?? DECK_DEFAULTS.markers, markerLayout: d.markerLayout ?? DECK_DEFAULTS.markerLayout, // Only when set: a deck without it resolves as it did. ...(d.rail !== undefined ? { rail: d.rail } : {}), }; }, ui: [ { key: "pip.spacing", type: "enum", options: PIP_SPACINGS, label: "Spacing", default: "even" }, { key: "pip.pitch", type: "number", min: PIP_PITCH[0], max: PIP_PITCH[1], label: "Pitch (px)", default: PIP_PITCH_DEFAULT, when: { "pip.spacing": "pitch" } }, { key: "pip.size", type: "number", min: 2, max: 24, label: "Pip size", default: 6 }, { key: "pip.activeSize", type: "number", min: 2, max: 40, label: "Marker size", default: 12 }, { key: "pip.color", type: "enum", options: PIP_COLORS, label: "Lit pip colour", default: "accent" }, { key: "pip.sectionColor0", type: "color", label: "First section's colour", default: "accent", when: { "pip.color": "section" } }, { key: "markers", type: "markers", label: "Markers (label optional; colour = its section's)", align: MARKER_ALIGNS }, { key: "markerLayout", type: "enum", options: MARKER_LAYOUTS, label: "Crowded labels", default: "stagger" }, { key: "rail.labels", type: "boolean", label: "Markers' words", default: true }, ], docs: { heading: "Rail", intro: "The pip track along the top of the deck; the markers' flags stand over it ([markers](#the-cut)).", rows: [ ["`deck.pip.spacing`", "`even` · `time` (each pip at its clip's middle) · `pitch` (each `pip.pitch` px after the last, from the left; the pips not yet reached are not drawn, so an insert keeps the frames before it) · default `even`", "`umtool look
deck.pip='{\"spacing\":\"pitch\",\"pitch\":24}'`"], ["`deck.pip.pitch`", `${PIP_PITCH[0]}–${PIP_PITCH[1]} px · default ${PIP_PITCH_DEFAULT} (only with \`spacing: "pitch"\`; a cut with more pips than the track holds at it is laid at the pitch that fits)`, "same"], ["`deck.pip.size`, `deck.pip.activeSize`", "2–24 · 2–40 px, the marker at least the pip · default 6, 12", "`umtool look
deck.pip='{\"size\":8}'`"], ["`deck.pip.color`", "`accent` · `verdict` (a counted clip's pip takes its series' colour and shape) · `section` (every pip, the fuse and the marker's ring in the colour of the section it stands in: from one marker to the next, in that marker's `color`; fitted to 3:1 on the deck) · default `accent`", "`umtool look
deck.pip='{\"color\":\"verdict\"}'`"], ["`deck.pip.sectionColor0`", "the section before the first marker, with `color: \"section\"`: a `#hex` or a palette key (`fg`, `muted`, `accent`, `amber`, `dim`) · default the accent", "`umtool look
deck.pip='{\"color\":\"section\",\"sectionColor0\":\"#5fa8d3\"}'`"], ["`deck.markers[].label`", "optional: a marker with none (or `\"\"`) draws a tick at its boundary, no words, and takes no band over the track", "`umtool look
deck.markers='[{\"after\":\"c04\",\"color\":\"#e07a9a\"}]'`"], ["`deck.markers[].level`", "`1` (a section, the default) · `2` (a subsection of the section before it: a shorter flag or a half-height tick, its label smaller and quieter, and in sections no colour of its own -- its pips, fuse and ring keep its section's; to every edit a section like any other; the cut's first marker must be a section) · at most 32 markers in all; past a dozen labelled, a label too crowded to say anything is drawn as a tick", "`umtool look
deck.markers='[{\"after\":\"c04\",\"label\":\"Early days\",\"level\":2}]'`"], ["a rail of one or two pips", "never drawn (deck.mjs `RAIL_MIN_PIPS`, 3): a cut -- or a window take, which lays only the clips it covers -- of one or two clips draws no pip track, no fuse, no marker and no flags; the stacked deck no rail and no count; the finale no large rail. Nothing moves into the room. No setting draws one under three", "—"], ["`deck.rail.labels`", "`false` draws every marker as a tick, no words, and no band over the track (the current section's name can stand under the rail instead: [Section title](#section-title)) · default `true`","`umtool look
deck.rail='{\"labels\":false}'`"], ], }, });