// THE PROMISE CLOCK (module `promise`, region `promise`): from a promise on, // "SCALE VIDEO OFFERED 23 OCT · 13 DAYS · NONE POSTED" -- the days counted to // the in-record date of what is on screen, then on to the render date in the // finale; each check's words flashed under it; kept, "POSTED" in green. // Drawn over the finale by default (z 95). Read off the schedule's measure // slice (`render.chrome.deck.promise`; measure-extras.mjs promiseStates, // chrome-measure-extras.mjs promiseHtml). import path from "node:path"; import { promiseHtml } from "../chrome-measure-extras.mjs"; import { measureOf, promiseStates } from "../measure-extras.mjs"; import { avatarEntryOf, handleKey } from "../post-avatars.mjs"; import { anonymousHandlesOf, pseudonymOf } from "../post-anon.mjs"; import { measureExtraModule } from "./measure-extras-module.mjs"; import { PROMISE_CHECKS, resolveMeasureExtra } from "./measure-extras-settings.mjs"; /** * The other speakers on a promise (her claims, an outcome she reports): each * one's handle -- `promise.speakers[k].handle`, else the manifest's postAvatars * key that matches -- and her picture from postAvatars, copied in beside the * page. None found: the page draws a monogram. */ async function speakerOpts(ctx) { const m = measureOf(ctx.schedule); const cfg = resolveMeasureExtra("promise", ctx.render); const speakers = new Set(); for (const e of m?.events ?? []) if (e?.speaker && (e.kind === "promiseClaim" || e.kind === "promiseOutcome")) speakers.add(e.speaker); for (const s of m?.state ?? []) for (const p of s?.promises ?? []) for (const c of p?.claims ?? []) if (c?.speaker) speakers.add(c.speaker); const handles = {}; const avatars = {}; // A speaker whose handle is one of the video's anonymous ones (post-anon.mjs, the composer's pass): its pseudonym, // never its picture. const anon = anonymousHandlesOf(ctx.manifest); const anonHandles = {}; // A speaker's settings matched as a handle is -- without @, without regard to case -- so // `speakers.MadamSavvy` serves the measure's "madamsavvy" (post-avatars.mjs handleKey). const spCfg = (sp) => cfg?.speakers?.[sp] ?? Object.entries(cfg?.speakers ?? {}).find(([k]) => handleKey(k) === handleKey(sp))?.[1]; for (const sp of speakers) { const want = spCfg(sp)?.handle ?? sp; const entry = avatarEntryOf(ctx.manifest, want) ?? avatarEntryOf(ctx.manifest, sp); handles[sp] = String(spCfg(sp)?.handle ?? entry?.[0] ?? sp).replace(/^@/, ""); const shown = anon.get(handleKey(handles[sp])) ?? anon.get(handleKey(sp)) ?? anon.get(handleKey(want)) ?? null; if (shown) { anonHandles[sp] = pseudonymOf(shown); handles[sp] = pseudonymOf(shown); continue; } if (entry?.[1]?.src && ctx.manifestDir) { const src = path.resolve(ctx.manifestDir, entry[1].src); const url = await ctx.asset(src, `avatar-${sp.replace(/[^A-Za-z0-9_-]/g, "_")}${path.extname(src) || ".jpg"}`).catch(() => null); if (url) avatars[sp] = url; } } return { handles, avatars, anonHandles }; } export default measureExtraModule({ id: "promise", z: 95, title: "Promise clock", summary: "Days since a promise -- to the clip on screen, then to the render date -- with each check's words and whether it was kept.", states: promiseStates, html: promiseHtml, pageOpts: speakerOpts, needs: "a promise row", ui: [ { key: "label", type: "text", label: "What was promised (default the row's display)" }, { key: "verb", type: "text", label: "Verb", default: "offered" }, { key: "kept", type: "text", label: "Kept", default: "Posted" }, { key: "broken", type: "text", label: "Not kept", default: "None posted" }, { key: "checks", type: "enum", options: PROMISE_CHECKS, label: "A check's words", default: "label" }, { key: "claimVerb", type: "text", label: "What her claim says she did", default: "paid" }, { key: "claimColor", type: "color", label: "Her ink (another speaker's claims)", default: "#E37AB8" }, { key: "speakers", type: "object", label: "Speakers ({madamsavvy: {handle: \"MadamSavvy\", color: \"#E37AB8\"}})" }, ], docs: { intro: "A days-since counter for a promise (`render.chrome.deck.promise`, measure-extras.mjs), from the promise's event on: \"SCALE VIDEO OFFERED 23 OCT\", the days from the day he said it to the in-record date of the latest event on screen, and \"NONE POSTED\" in red until a row says it was kept (\"POSTED\", green). Each promise check's words come in under it with a flash (`checks`: the row's `label`, or its transcript `quote`). From the finale's start -- else 4 s after the last event -- the days count on, a day a step, to `measure.asOfRender`. Another party on the promise (CONTRACT addendum: a ledger row with a `speaker`, a `promise_claim`) shows under the header -- \"PAID 23 OCT BY @MadamSavvy\" (`claimVerb`, her `paidOn` else the claim's date), with her picture from the manifest's `postAvatars` (`umtool posts avatar`; else a monogram) -- and her words flash under the clock in her ink (`claimColor`, or `speakers..color`), his in amber. An outcome (`promise_outcome`) is drawn too: `refunded` slams on a stamp \"REFUNDED · by 31 Oct · no video\" while the days keep counting to the render date, `withdrawn` likewise in grey, `kept` turns it green (\"POSTED\") and stops the count on the day. Laid over the finale (z 95) unless `finale: \"hide\"`.", rows: [ ["`deck.promise`", "`true` · `false` · `{show, position, x, y, scale, hold, finale, label, verb, kept, broken, checks}` · default on with a measure slice", "`umtool look

deck.promise=false`"], ["`deck.promise.position`, `.x`/`.y`, `.scale`", "an anchor in the footage box · design px · 0.5–2 · default `top-center`, unset, 1", "`umtool look

deck.promise.position=bottom-center`"], ["`deck.promise.hold`, `.finale`", "0 (stays up) or 2–600 s · `hide` `show` · default 0, `show`", "`umtool look

deck.promise.finale=hide`"], ["`deck.promise.label`, `.verb`, `.kept`, `.broken`, `.checks`", "≤40 each · `label` `quote` · default the row's display, \"offered\", \"Posted\", \"None posted\", `label`", "`umtool look

deck.promise.label='scale video'`"], ["a `promise_outcome` row's `stampNote`", "one line, 1–80 characters · unset (default): the clock's own words under the stamp, \"by · no video\". The row's note is that second line instead (REFUNDED / \"by her account · no receipt\"); the strip over a post's card, which has one line for everything, shows its first clause (to its first `·`, `;`, `—`, `, ` or ` -- `: \"refunded · by her account\"). It is the ledger row's, so every take of the project reads it. `umtool lint` warns past 26 characters (the stamp's line is never wrapped: a longer one runs past its border)", "`umtool ledger

set --stampNote \"by her account · no receipt\"` · off again: `--stampNote null`"], ["`deck.promise.speakers`, `.claimVerb`, `.claimColor`", "`{: {handle, color}}` · ≤40 · #hex · default `{}` (the postAvatars handle), \"paid\", #E37AB8", "`umtool look

deck.promise.speakers='{\"madamsavvy\":{\"handle\":\"MadamSavvy\"}}'`"], ], }, });