// THE DIET BADGE (module `diet`, region `diet`): the diet he names as a // rubber stamp that slams on at each change of regime or diet number ("KETO // · DIET #6"), in the regime's ink; a null diet after one fades to "NO DIET". // It draws the state's diet as the producer left it (the off-scope rule is // the ledger's). Read off the schedule's measure slice // (`render.chrome.deck.diet`; measure-extras.mjs dietStates, // chrome-measure-extras.mjs dietHtml). import { dietHtml } from "../chrome-measure-extras.mjs"; import { dietStates } from "../measure-extras.mjs"; import { measureExtraModule } from "./measure-extras-module.mjs"; import { DIET_BACK_MIN, DIET_FORMS, DIET_OVERLAP, DIET_TAGS, dietOverlapMax } from "./measure-extras-settings.mjs"; export default measureExtraModule({ id: "diet", z: 66, title: "Diet badge", summary: "The diet he names as a stamp that slams on at each change, with its number; \"No diet\" when the state says so.", states: dietStates, html: dietHtml, needs: "a diet", ui: [ { key: "colors", type: "object", label: "Ink per regime ({keto: \"#E0913C\", …})" }, { key: "labels", type: "object", label: "Words per regime ({glp1: \"Ozempic\", …})" }, { key: "form", type: "enum", options: DIET_FORMS, label: "Drawn as (default: the stamp, the tags on the shelf)" }, { key: "tags", type: "number", min: DIET_TAGS[0], max: DIET_TAGS[1], step: 1, label: "Tags in the row", default: 3, when: { form: "tags" } }, { key: "overlap", type: "number", min: DIET_OVERLAP[0], max: DIET_OVERLAP[1], step: 0.05, label: "Overlap (0: side by side; the share of each older tag behind the one in front)", default: 0, when: { form: "tags" } }, { key: "days", type: "boolean", label: "Days on the diet, on the front tag", default: false, when: { form: "tags" } }, { key: "flash", type: "boolean", label: "Flash its outline when its value changes (unset: deck.measure.flash)" }, ], docs: { intro: "The diet he names as a rubber stamp in a corner of the footage box (`render.chrome.deck.diet`, measure-extras.mjs): at each change of the state's diet -- its regime or its diet number -- a new stamp slams on (in big and turned, onto the page, a shake), the regime's word in its ink and \"DIET #n\" under it with the ledger's words when they say more (\"Keto · 5 carbs a day\"); a change of words alone fades the new stamp in. A null diet after one fades to \"NO DIET\" in grey. It draws `state.diet` as the measure slice gives it -- the off-scope rule (\"off GLP-1\" while on keto is still keto) is the ledger's. The inks default to the quartering-diet regimes' (keto #E0913C, carnivore #C9534B, fasting #4E9BD8, calories #3FA9A0, glp1 #B168C6, other #8E97A8, off #98A29B).", rows: [ ["`deck.diet`", "`true` · `false` · `{show, position, x, y, scale, hold, finale, colors, labels}` · default on with a measure slice", "`umtool look
deck.diet=false`"], ["`deck.diet.position`, `.x`/`.y`, `.scale`", "an anchor in the footage box · design px · 0.5–2 · default `bottom-left`, unset, 1", "`umtool look
deck.diet.position=top-right`"], ["`deck.diet.hold`, `.finale`", "0 (up from the first diet on) or 2–600 s · `hide` `show` · default 0, `hide`", "`umtool look
deck.diet.hold=15`"], ["`deck.diet.form`, `.tags`", "`stamp` · `tags`: the last `tags` diets as a row of dated tags -- each a small stamp with the regime's word in its ink, \"DIET #n\" and the ledger's words (less the regime they open with: \"5 carbs a day\"), and the day he switched to it (`state.diet.since`, \"Mar 14, 2025\"; new words for the same diet keep that day); at each change the new tag slams in at the left, the older slide right and dim, the one past `tags` falls off; a change of words alone fades the new tag over the old; a null diet is a grey \"NO DIET\" tag with its date · 1–4 · default `stamp` (`tags` on the shelf), 3", "`umtool look
deck.diet.form=tags deck.diet.tags=2`"], ["`deck.diet.overlap`", `${DIET_OVERLAP[0]}–${DIET_OVERLAP[1]}, the share of each older tag hidden behind the one in front · default 0 (side by side, the slam and the dim). Above 0 the tags FAN sideways the way the goal stack's notes pile: the newest in front at the left, landing from above like a goal note, each older one a place to the right behind it with its own small turn, keeping its colours (the depth is the overlap and the shadow), showing its regime word and date in the strip beside the one in front; the one past \`tags\` slides off the back. The fan is narrower by what hides. An older tag's word and date need ${DIET_BACK_MIN} design px of it, so it is refused past ${dietOverlapMax(false)} (${dietOverlapMax(true)} with \`days\`)`, "`umtool look
deck.diet.overlap=0.5`"], ["`deck.diet.days`", "`true` · `false`: the front tag's running count of days on its diet (to the in-record date at the playhead, the streak chain's \"Day N\"), in a column of its own -- the tag 300 design px wide · default `false`", "`umtool look
deck.diet.days=true`"],
["`deck.diet.colors`, `.labels`", "`{ deck.diet.labels='{\"glp1\":\"Ozempic\"}'`"],
["`deck.diet.flash`", "bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): with `form: \"tags\"`: the new front tag lights, in its ink, at a new diet or new words for it -- never the running day count, never the first tag; the stamp form does not flash; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away", "`umtool look deck.diet.flash=false`"],
],
},
});