// THE STREAK CHAIN (module `streak`, region `streak`): a chain per run along // the in-record dates -- a run starts a chain, each day it holds extends it, // and when it ends (the diet off, a new run, a lapse) the chain cracks with a // snap and its length ("KETO · 41 days"); past chains stay dimmed in the row, // so the stop-start rhythm shows. Source-agnostic: each source is an adapter // to runs (measure-extras.mjs dietRuns, lostRunsRuns, pledgeRuns) and the // drawing reads only runs (`render.chrome.deck.streak`; // chrome-measure-extras.mjs streakHtml). It and the diet badge share the // bottom of the footage box: either or both. import { streakHtml } from "../chrome-measure-extras.mjs"; import { streakStates } from "../measure-extras.mjs"; import { measureExtraModule } from "./measure-extras-module.mjs"; import { STREAK_AXES, STREAK_SOURCES } from "./measure-extras-settings.mjs"; export default measureExtraModule({ id: "streak", z: 65, title: "Streak chain", summary: "A chain per run along the in-record dates, cracked with its length when the run ends; past runs dimmed in a row.", states: (schedule, render) => streakStates(schedule, render).states, html: streakHtml, needs: "a run of its source (a diet, a lost-weight run, a pledge)", ui: [ { key: "source", type: "enum", options: STREAK_SOURCES, label: "Runs of", default: "diet" }, { key: "axis", type: "enum", options: STREAK_AXES, label: "Laid on", default: "date" }, { key: "title", type: "text", label: "Heading (default the source's)" }, { key: "color", type: "color", label: "Chain colour (lost runs, pledges; default the palette's accent)" }, { key: "colors", type: "object", label: "Diet runs: ink per regime" }, { key: "labels", type: "object", label: "Diet runs: words per regime" }, ], docs: { intro: "A chain per run along a time axis by in-record date (`render.chrome.deck.streak`, measure-extras.mjs): a run starts a chain, each day it holds extends it (the live chain grows with the in-record date of what is on screen, its day count beside it), and when the run ends the chain cracks -- its tip snaps off, a red break, its length tagged (\"KETO · 41 days\", a lapse \"after 73 days\") -- then dims into the row, so the stop-start rhythm stays on screen. `source` picks the runs: `diet` (the state's diet turning on or changing -- a new regime or diet number -- ends the last and starts the next; off ends it), `lostRuns` (the odometer's runs, each from its start to the next one's), `pledges` (the sobriety video's: a `pledge` event starts a run, a `lapse` snaps it -- an adapter only until the ledger writes those kinds). `axis: \"runs\"` lays the chains one after another, each as wide as the square root of its length, instead of on the dates. It sits bottom-centre, between the diet badge and the goal stack, so the diet badge, the chain, or both can run (`umtool look

deck.diet=false` / `deck.streak=false`).", rows: [ ["`deck.streak`", "`true` · `false` · `{show, position, x, y, scale, hold, finale, source, axis, title, color, colors, labels}` · default on with a measure slice", "`umtool look

deck.streak=false`"], ["`deck.streak.source`, `.axis`", "`diet` `lostRuns` `pledges` · `date` `runs` · default `diet`, `date`", "`umtool look

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

deck.streak.position=bottom-left`"], ["`deck.streak.hold`, `.finale`", "0 (up from the first run on) or 2–600 s · `hide` `show` · default 0, `hide`", "`umtool look

deck.streak.hold=15`"], ["`deck.streak.title`, `.color`, `.colors`, `.labels`", "≤40 · #hex · `{: #hex}` · `{: words}` · default the source's word, the accent, the regimes' inks and names", "`umtool look

deck.streak.title='Every diet'`"], ], }, });