create-pmos 0.456.0 → 0.458.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/package.json +101 -80
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +1 -1
  8. package/workspace/briefing-premium-board-test.js +17 -17
  9. package/workspace/briefing-premium-initiative-test.js +8 -10
  10. package/workspace/changelog.json +270 -1845
  11. package/workspace/ev-everywhere-test.js +24 -1
  12. package/workspace/guide/adler.md +1 -1
  13. package/workspace/guide/initiatives-screen.md +12 -2
  14. package/workspace/guide/settings.md +13 -3
  15. package/workspace/ini-workflow-test.js +5 -9
  16. package/workspace/lib/kit-update.js +1 -1
  17. package/workspace/lib/settings-store.js +1 -1
  18. package/workspace/metric-drafts-ui-test.js +11 -9
  19. package/workspace/package-lock.json +2 -2
  20. package/workspace/package.json +1 -1
  21. package/workspace/premium-board-actions-test.js +3 -3
  22. package/workspace/premium-vw-backlog-test.js +1 -1
  23. package/workspace/premium-vw-item-test.js +1 -1
  24. package/workspace/premium-vw-jira-test.js +1 -1
  25. package/workspace/program-panel-test.js +2 -2
  26. package/workspace/public/pm/cozy-ev.css +21 -4
  27. package/workspace/public/pm/cozy-settings.js +43 -19
  28. package/workspace/public/pm/ini-about.js +145 -0
  29. package/workspace/public/pm/ini-tasks.js +6 -34
  30. package/workspace/public/pm/ini-view-model.js +12 -2
  31. package/workspace/public/pm/ini-view.css +180 -143
  32. package/workspace/public/pm/ini-view.js +137 -145
  33. package/workspace/public/pm/metric-drafts.js +8 -2
  34. package/workspace/public/pm/mission.js +159 -135
  35. package/workspace/public/pm/premium-shell.js +24 -24
  36. package/workspace/public/pm/premium.css +11 -14
  37. package/workspace/public/pm/stage-line.js +4 -1
  38. package/workspace/public/pm/upd-weeks.js +56 -0
  39. package/workspace/split-merge-ui-test.js +1 -1
  40. package/workspace/stage-card-tasks-test.js +2 -2
  41. package/workspace/stage-card-test.js +48 -51
  42. package/workspace/task-links-test.js +8 -9
  43. package/workspace/task-press-test.js +2 -2
  44. package/workspace/task-views-test.js +15 -76
  45. package/workspace/test-lists/initiative-mission-control.json +5 -0
  46. package/workspace/test-lists/mission.json +7 -3
  47. package/workspace/test-lists/update-weeks.json +5 -0
  48. package/workspace/tk-tasks-test.js +3 -3
@@ -3,11 +3,11 @@
3
3
  * markup in the Viewer's shell; only the host's chrome differs (the Board floats it with its grip, Home sets it beside the chat, the phone
4
4
  * shows it full screen). The look is pm/ini-view.css, loaded here once.
5
5
  *
6
- * viewHtml(v, o) the body: the card (batch 18 item 1, XvpA1: Adler's ask with the one primary, the meta line of icons, then the
7
- * mission, pm/mission.js, in the stage line's place), then Tasks as the WBS (sections in workflow order), then Documents
8
- * and Linked as folds. The compact desktop summary and milestones sit above full-width Tasks.
9
- * Under the card, the success measure Claude drafted from the PRD (pm/metric-drafts.js, GET
10
- * /api/metric-drafts scope initiative): the proposal, or once kept its fold with Undo; nothing when nothing is drafted.
6
+ * viewHtml(v, o) the body: the mission, one component on one surface (initiative-mission-control): the ask strip when there is one, the
7
+ * telemetry card (pm/mission.js draws the mission as a trajectory), the way to finish this stage and About (pm/ini-about.js:
8
+ * the description and the success measure Claude drafted from the PRD, pm/metric-drafts.js), with one hide for the three;
9
+ * then Tasks as the WBS (sections in workflow order), then Documents and Linked as folds. In a viewer 1000 px wide the way
10
+ * to finish stands beside the telemetry card.
11
11
  * o: { add (the Tasks + icon), adding (the inline field is open), next (the next stage is a press: Home's move sheet), openTask, docs: { n, html? } | null,
12
12
  * quick (each task's box carries the status caret and its date is a press: the host has h.status and h.dates),
13
13
  * draft (the empty breakdown's Draft it), program (the chip opens the program), wf (the workflow on the meta line opens the Change picker),
@@ -20,13 +20,13 @@
20
20
  * h.person(btn), h.stagePick(btn), h.planDates(btn), h.jira(btn) (batch 16 item 5c),
21
21
  * h.sm(act, btn) a press on Claude's split or merge card (pm/split-merge.js press), h.openIni(id) the merged summary's link,
22
22
  * h.status(uid, state) and h.dates(uid, { start?, due? }) (the quick changes, each saved at once with Undo in the host's toast);
23
- * the mission: h.openTask(uid) a flag, the planet or the dish, h.hold(i, btn) the hold's chip (o.hold: the host has it),
23
+ * the mission: h.openTask(uid) a diamond, the planet, the dish or a row of the way to finish, h.hold(i, btn) the hold's chip (o.hold: the host has it),
24
24
  * h.asks(btn) the ask's count (else the primary);
25
25
  * for planned versus actual (pm/ini-versions.js) h.where() → { ws, board }, h.reload() and h.toast(text, undo?)
26
26
  *
27
27
  * Tasks has three views (batch 9 item 5b; canvas In development, row "Tasks views"): the List (the WBS below), Timeline and Kanban
28
28
  * (pm/ini-tasks.js). The Tasks header holds one view button and + (batch 18 item 1, XvpA4Sheet): the button opens the view sheet, three
29
- * rows of the same shape: View, Group by and the Timeline's Zoom (Weeks, Months, All). The last view is remembered for the PM. Group by
29
+ * rows of the same shape: View, Group by and the Timeline's Zoom (Weeks, Months, All). The last view is remembered for the PM. A phone shows the List only. Group by
30
30
  * (batch 11 item 20, pm/ini-groups.js) groups the same tasks by Stage, Owner or Status (the sheet's ⋯: Epic, Your groups) in all three
31
31
  * views; By epic carries the send icons and Send to Jira, which used to be the old All tasks panel's. The List shows only the stages with
32
32
  * something open (the rest wait in one fold at its foot), and a stage folds after 3 tasks.
@@ -43,6 +43,7 @@ import { cardHtml as smCard, mergedHtml as smMerged } from './split-merge.js';
43
43
  import * as MI from './mission.js'; // the initiative as a mission, the stage line's place (batch 18 item 1)
44
44
  import * as AD from './cozy-adler.js'; // Adler on the card: his face for the ask, his full body for a real win
45
45
  import * as MD from './metric-drafts.js'; // the success measure Claude drafts from the PRD (batch 15 item 1, canvas Iq9Initiative)
46
+ import * as AB from './ini-about.js'; // About: the description and the success measure, folded to one line (initiative-mission-control R6)
46
47
  import * as ED from './ini-edit.js'; // a task changed where it sits in the List: open in place, ⋯, + per stage, drag (batch 18 item 16)
47
48
 
48
49
  const CSS = new URL('./ini-view.css', import.meta.url).href;
@@ -61,16 +62,31 @@ const FOLD = new Map(); // `${id}|${key}` → true (open) | false (shut): the
61
62
  const isOpen = (v, key, dflt) => { const k = (v.id || v.key) + '|' + key; return FOLD.has(k) ? FOLD.get(k) : !!dflt; };
62
63
  const SHOWN = new Map(); // id → the view last drawn, for the Kanban's stage picker
63
64
 
64
- /* ── the card: the ask, the meta line and the mission, one card (batch 18 item 1, agreed A; canvas XvpA1, XvpA2Dark, XvpE1States,
65
- * XvpE2Stages, XvpE5Adler, XvpD1Desktop) ──
66
- * The ask: Adler's Needs you face where the dot and the label stood, the ask in his voice, one → (a small count opens the other asks).
67
- * With Adler on the card (he asks, or Claude works) the whole card takes his wash; without him it is plain. One primary per card: the ask's
68
- * →, else Plan → once every task of the stage is done. The meta line: the owner (face or an empty ring), the stakeholders as a stack with
69
- * "+N", the workflow icon and the program chip, which truncates first. The mission (pm/mission.js) replaces the stage line; a tap on a
70
- * flag, the planet or the dish opens that milestone's task, a tap anywhere else opens the stages and milestones in place (2 of 4 done, ⋯ for
71
- * the stage picker, the next stage). His full body shows only on a real win (the stage's tasks are all done, the first view: his thanks and
72
- * Plan →, the mission steps aside that once). */
73
- const LINE = new Map(); // id → what is unfolded under the mission ('' | 'list' | 'list+')
65
+ /* ── the mission control: the telemetry card, the way to finish the stage and About, one component with one hide (initiative-mission-control) ──
66
+ * R1 one `section.iv-mc` on one surface: the ask strip when there is one (Adler's Needs you face, the ask in his voice, the count, one →; or
67
+ * Claude's working line; or, on a real win, his full body with his thanks and the next stage), then the telemetry card beside the way to
68
+ * finish this stage, then About. R2 the chevron on the telemetry card hides all three into one banner (the stage, the dates, the days left, the
69
+ * count, the success measure and the next-stage button); unhiding returns the telemetry first, and the way to finish and About keep their own
70
+ * folds. The three are kept per initiative in the browser (the PM's own changes only; the defaults follow the screen). R3 the telemetry card
71
+ * draws the mission as a trajectory (pm/mission.js trajSvg) at the size it has, measured after each draw (fitMission). R5 the way to finish:
72
+ * the stage's count and marks, its open milestone tasks (a row opens its task), and the next-stage move, the one primary once every task of the
73
+ * stage is done, else quiet. The people stay with it: the owner (face or empty ring), the stakeholders as a stack with "+N", the workflow icon
74
+ * and the program chip, which truncates first. R6 About: pm/ini-about.js. */
75
+ const MCS = new Map(); // id → the PM's own changes to { mc, gx, ab } (true = open), kept in the browser
76
+ const MCK = 'pmos.iv.mc.';
77
+ const store = () => { try { return typeof localStorage !== 'undefined' ? localStorage : null; } catch { return null; } };
78
+ /** The three folds of one initiative: the PM's own, else the defaults (the way to finish is open on a wide screen, About is folded; on a phone both are folded; About opens by itself while a success measure waits on a ✓). */
79
+ export function mcState(id, o = {}) {
80
+ let mine = MCS.get(id);
81
+ if (!mine) { mine = {}; try { const s = store(), j = s && JSON.parse(s.getItem(MCK + id) || 'null'); if (j && typeof j === 'object') for (const k of ['mc', 'gx', 'ab']) if (typeof j[k] === 'boolean') mine[k] = j[k]; } catch { mine = {}; } MCS.set(id, mine); }
82
+ const dflt = { mc: true, gx: !phone(), ab: !!o.proposal };
83
+ return { mc: 'mc' in mine ? mine.mc : dflt.mc, gx: 'gx' in mine ? mine.gx : dflt.gx, ab: 'ab' in mine ? mine.ab : dflt.ab };
84
+ }
85
+ export function mcToggle(id, key, o) {
86
+ const cur = mcState(id, o)[key], mine = MCS.get(id) || {}; mine[key] = !cur; MCS.set(id, mine);
87
+ try { const s = store(); if (s) s.setItem(MCK + id, JSON.stringify(mine)); } catch { /* the choice holds for the session */ }
88
+ return !cur;
89
+ }
74
90
  const MORE = 'M5 12h.01M12 12h.01M19 12h.01', RING = 'M12 12a3.5 3.5 0 1 0 0-7a3.5 3.5 0 1 0 0 7M5.5 19.5a6.5 6.5 0 0 1 13 0';
75
91
  function metaHtml(s, o) {
76
92
  const who = s.owner ? `<span class="iv-mt iv-own" title="${esc('Owner: ' + s.owner.name)}"><span class="iv-av" aria-hidden="true">${esc(s.owner.av)}</span><span class="iv-sr">${esc('Owner: ' + s.owner.name)}</span></span>`
@@ -91,85 +107,103 @@ function nextHtml(st, o, pri) {
91
107
  const tag = o.next ? 'button type="button" data-iv-next' : 'span';
92
108
  return `<${tag} class="iv-scgo${pri ? ' on' : ''}"${n.ms ? ' data-ms="1"' : ''} aria-label="${esc('Next: ' + (n.ms ? '◆ ' : '') + n.name + (o.next ? '. Move to ' + n.name : ''))}" title="${esc('Next: ' + n.name)}"><span class="iv-scgn">${n.ms ? '◆ ' : ''}${esc(n.name)}</span>${SVG(P.go, 16, 2.2)}</${o.next ? 'button' : 'span'}>`;
93
109
  }
94
- function missionBox(v, o, pri) {
95
- const st = v.stage, L = st.line, id = v.id || v.key || '', M = MI.missionOf(L);
96
- const open = LINE.get(id) || '';
97
- const tile = st.n ? `<span class="iv-no${st.ms ? ' ms' : ''}" aria-hidden="true">${st.ms ? '' : st.n}</span>` : '';
98
- const name = o.stagePick ? `<button type="button" class="iv-stc" data-iv-stagepick aria-haspopup="menu" aria-expanded="false" aria-label="${esc('Stage: ' + st.name + '. Change')}" title="Change the stage"><b>${esc(st.name)}</b></button>` : `<b>${esc(st.name)}</b>`;
99
- // no plan dates: the gap carries its next action
110
+
111
+ const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
112
+ const BANG = 'M12 6v8M12 18h.01', CHEV = 'M7 10l5 5 5-5', DIA = 'M12 3l9 9-9 9-9-9z';
113
+ const TRAJ = new Map(); // id → { M, today, tap }: what each picture draws, for fitMission
114
+ const tileOf = (st) => (st.n ? `<span class="iv-no${st.ms ? ' ms' : ''}" aria-hidden="true">${st.ms ? '' : st.n}</span>` : '');
115
+ const nameOf = (st, o) => (o.stagePick ? `<button type="button" class="iv-stc" data-iv-stagepick aria-haspopup="menu" aria-expanded="false" aria-label="${esc('Stage: ' + st.name + '. Change')}" title="Change the stage"><b>${esc(st.name)}</b></button>` : `<b>${esc(st.name)}</b>`);
116
+ const dateText = (D) => (D && (D.start || D.end) ? [D.start, D.end].filter(Boolean).join(' – ') : '');
117
+ /** The readouts beside the title (R3, R4): numbers from the plan's dates; none with no dates, on hold (the chip says it) or with one date. */
118
+ function readoutsHtml(st) {
119
+ const L = st.line, D = st.dates, n = D && D.n;
120
+ if (L && L.chip && L.chip.pause) return '';
121
+ const one = (k, v, u, cls) => `<div${cls ? ` class="${cls}"` : ''}><small>${esc(k)}</small><b>${v}${u ? `<i>${esc(u)}</i>` : ''}</b></div>`;
122
+ if (L && L.finished) return D && D.end ? `<div class="iv-ro">${one('Finished', esc(D.end), '')}</div>` : '';
123
+ if (!n) return '';
124
+ if (n.gone < 0) return `<div class="iv-ro">${one('Starts in', -n.gone, -n.gone === 1 ? 'day' : 'days')}</div>`;
125
+ if (n.left < 0) return `<div class="iv-ro">${one('Over by', -n.left, -n.left === 1 ? 'day' : 'days', 'hot')}</div>`;
126
+ if (n.left === 0) return `<div class="iv-ro">${one('Ends', 'today', '')}</div>`;
127
+ return `<div class="iv-ro">${one('Time left', n.left, n.left === 1 ? 'day' : 'days')}${one('Elapsed', n.gone, 'of ' + n.total + ' d')}</div>`;
128
+ }
129
+ const holdChip = (L, o) => (L && L.chip && L.chip.pause ? (o.hold && L.holdAt != null ? `<button type="button" class="iv-chp ${esc(L.chip.tone)}" data-iv-hold="${L.holdAt}" title="Open the hold">${SVG(P.pause, 11, 2.4)}${esc(L.chip.text)}</button>`
130
+ : `<span class="iv-chp ${esc(L.chip.tone)}">${SVG(P.pause, 11, 2.4)}${esc(L.chip.text)}</span>`) : '');
131
+ const pipsOf = (st, cls) => {
132
+ const n = st.nTotal || 0; if (n < 1 || n > 6 || / in Jira$/.test(st.doneOf || '')) return '';
133
+ const d = Math.min(n, st.nDone || 0), l = Math.min(n - d, st.nLate || 0);
134
+ return `<span class="iv-pips${cls ? ' ' + cls : ''}" aria-hidden="true">${Array.from({ length: n }, (_, i) => `<i class="${i < d ? 'd' : i < d + l ? 'l' : 'o'}"></i>`).join('')}</span>`;
135
+ };
136
+ /** The telemetry card, and with it the banner it folds into (R2, R3). */
137
+ function telHtml(v, o, pri, mc) {
138
+ const st = v.stage, L = st.line, id = v.id || v.key || '', M = MI.missionOf(L), D = st.dates;
100
139
  const set = L && L.empty && o.planDates ? `<button type="button" class="iv-setd" data-iv-plandates aria-label="No plan dates yet. Set them" title="Set the plan dates">${SVG(P.cal, 15, 2)}Set dates</button>` : '';
101
- const go = pri ? nextHtml(st, o, true) : '';
102
- // on hold: when it comes back, a press on it opens the hold (the host sets a return date)
103
- const ch = L && L.chip && L.chip.pause ? (o.hold && L.holdAt != null ? `<button type="button" class="iv-chp ${esc(L.chip.tone)}" data-iv-hold="${L.holdAt}" title="Open the hold">${SVG(P.pause, 11, 2.4)}${esc(L.chip.text)}</button>`
104
- : `<span class="iv-chp ${esc(L.chip.tone)}">${SVG(P.pause, 11, 2.4)}${esc(L.chip.text)}</span>`) : '';
105
- const head = `<div class="iv-sch"><span class="iv-shn">${tile}${name}</span><span class="iv-sp"></span>${ch}${set}${go}</div>`;
106
- const nn = MI.nowName(M);
107
- const pic = `<div class="iv-mi" role="button" tabindex="0" data-iv-mi aria-expanded="${!!open}" aria-label="${esc('Stage ' + st.name + '. Show the stages and milestones')}">`
108
- + MI.missionSvg(M, { tap: !!o.openTask })
109
- + (nn ? `<div class="iv-mi-nm" aria-hidden="true"><span class="${nn.late ? 'late' : ''}" style="left:${nn.x}%">${esc(nn.name)}</span></div>` : '')
110
- + '<span class="iv-mi-tip" role="tooltip" hidden></span></div>';
111
- // in place (XvpE2Stages, Wawan 10:59): the stage's dates, ⋯ the stage picker, the next stage; then the milestones, the same list as the
112
- // desktop's Milestones card (the picture already shows the stages)
113
- // on a desktop the dates line always shows under the picture and the Milestones card holds the list (Wawan 11:58: the line was missing,
114
- // and an open picture showed the milestones twice); on a phone both wait for the picture's tap
115
- let below = '';
116
- {
117
- const more = o.stagePick ? `<button type="button" class="iv-ib iv-mo" data-iv-stagepick aria-haspopup="menu" aria-expanded="false" aria-label="${esc('Stage: ' + st.name + '. Change')}" title="Change the stage">${SVG(MORE, 18, 3)}</button>` : '';
118
- const D = st.dates, dt = D && (D.start || D.end) ? [D.start, D.end].filter(Boolean).join(' – ') + (D.left ? ' · ' + D.left : '') : '';
119
- const dates = dt ? (o.planDates ? `<button type="button" class="iv-dtc${D.over ? ' w' : ''}" data-iv-plandates aria-label="${esc('Plan dates: ' + dt + '. Change')}" title="Change the plan dates">${esc(dt)}</button>` : `<span class="iv-dtc${D.over ? ' w' : ''}">${esc(dt)}</span>`) : '';
120
- below = `<div class="iv-mio${open ? ' on' : ''}"><div class="iv-mio-h">${dates}<span class="iv-mio-b">${more}${pri ? '' : nextHtml(st, o, false)}</span></div>${msListHtml(v, o)}</div>`;
121
- }
122
- return `<div class="iv-sc iv-mis" aria-label="${esc(st.aria || 'Stage · ' + st.name)}">${head}${pic}${below}</div>`;
140
+ const dt = dateText(D);
141
+ const dates = dt ? (o.planDates ? `<button type="button" class="iv-dtc${D.over ? ' w' : ''}" data-iv-plandates aria-label="${esc('Plan dates: ' + dt + '. Change')}" title="Change the plan dates">${esc(dt)}</button>` : `<span class="iv-dtc${D.over ? ' w' : ''}">${esc(dt)}</span>`) : '';
142
+ const today = v.today ? dateYOf(v.today) : '';
143
+ TRAJ.set(id, { M, today, tap: !!o.openTask });
144
+ const svg = M ? MI.trajSvg(M, { w: 640, h: 200, tap: !!o.openTask, today }) : '';
145
+ // the banner (hidden): the stage, the dates, the days left, the count, the measure, the next move
146
+ const left = D && D.left ? `<span class="iv-chp2${D.over ? ' late' : ''}">${esc(D.left)}</span>` : L && L.chip ? `<span class="iv-chp2">${esc(L.chip.text)}</span>` : '';
147
+ const count = st.nTotal ? `<span class="iv-chp2${st.nLate ? ' late' : ''}">${pipsOf(st, 'sm')}${esc(st.doneOf || st.nDone + ' of ' + st.nTotal + ' done')}</span>` : '';
148
+ const bn = mc ? '' : `<div class="iv-bn"><div class="iv-bt"><span class="iv-shn">${tileOf(st)}<b>${esc(st.name)}</b></span>${dt ? `<span class="s">${esc(dt)}</span>` : ''}</div><div class="iv-chips">${left}${count}${AB.chipHtml(v, o)}</div>${nextHtml(st, o, pri)}</div>`;
149
+ const tg = `<button type="button" class="iv-mctg" data-iv-mc="mc" aria-expanded="${!!mc}" aria-label="${mc ? 'Hide the mission' : 'Show the mission'}" title="${mc ? 'Hide' : 'Show'}">${SVG(CHEV, 16, 2)}</button>`;
150
+ return `<div class="iv-tel" data-iv-tel aria-label="${esc(st.aria || 'Stage · ' + st.name)}">`
151
+ + (mc ? `<div class="iv-tj" data-iv-tj="${esc(id)}">${svg}</div>`
152
+ + `<div class="iv-tel-ct"><div class="iv-tel-t"><span class="iv-shn">${tileOf(st)}${nameOf(st, o)}</span>${holdChip(L, o)}${set}${dates}</div>${readoutsHtml(st)}</div>` : bn)
153
+ + `${tg}<span class="iv-mi-tip" role="tooltip" hidden></span></div>`;
123
154
  }
124
- function cardHtml(v, o = {}) {
155
+ /** The way to finish this stage (R5): the count with its marks, the next move, the open milestone tasks, and the people. */
156
+ function gatesHtml(v, o, pri, open) {
157
+ const st = v.stage, G = st.gates || { open: [], done: 0 }, s = v.summary, id = v.id || v.key || '';
158
+ const when = (g) => (g.late ? plural(g.ago, 'day', 'days') + ' late' : g.left === 0 ? 'today' : g.left === 1 ? 'tomorrow' : g.left ? 'in ' + g.left + ' days' : g.date);
159
+ const row = (g) => {
160
+ const tag = o.openTask ? 'button type="button"' : 'div', w = when(g);
161
+ return `<${tag} class="iv-gr${g.late ? ' late' : ''}"${o.openTask ? ` data-iv-ms="${esc(g.id)}"` : ''} aria-label="${esc('Milestone ' + g.name + (w ? ', ' + w : '') + (o.openTask ? '. Open its task' : ''))}"><span class="iv-grk">${g.late ? SVG(BANG, 14, 2.6) : SVG(DIA, 13, 2.4)}</span>`
162
+ + `<span class="iv-grn">${esc(g.name)}</span>${g.av ? `<span class="iv-av" aria-hidden="true" title="${esc(g.owner)}">${esc(g.av)}</span>` : ''}<span class="iv-grw">${esc(w)}</span></${o.openTask ? 'button' : 'div'}>`;
163
+ };
164
+ const sub = st.next ? 'Then: ' + (st.next.ms ? '◆ ' : '') + st.next.name : st.line && st.line.finished ? '' : 'The last stage';
165
+ const rows = G.open.length ? `<div class="iv-gx-l" role="list">${G.open.slice(0, 3).map(row).join('')}${G.open.length > 3 ? `<p class="iv-gx-dn">${G.open.length - 3} more in Tasks</p>` : ''}${G.done ? `<p class="iv-gx-dn">${plural(G.done, 'milestone', 'milestones')} done</p>` : ''}</div>`
166
+ : G.done ? `<div class="iv-gx-l"><p class="iv-gx-dn">${plural(G.done, 'milestone', 'milestones')} done</p></div>` : '';
167
+ const title = st.line && st.line.finished ? 'This stage is done' : 'To finish this stage';
168
+ return `<section class="iv-gx" aria-label="${esc(title)}"><button type="button" class="iv-gx-t" data-iv-mc="gx" aria-expanded="${!!open}"><span class="chev" aria-hidden="true">${SVG(CHEV, 16, 2)}</span><span class="tx"><b>${title}</b>${sub ? `<span class="s">${esc(sub)}</span>` : ''}</span></button>`
169
+ + `${st.nTotal ? `<span class="iv-gx-c">${pipsOf(st)}<small>${esc(st.doneOf || st.nDone + ' of ' + st.nTotal + ' done')}</small></span>` : ''}<div class="iv-gx-a">${nextHtml(st, o, pri)}</div>${open ? rows : ''}<div class="iv-gx-ft">${metaHtml(s, o)}</div></section>`;
170
+ }
171
+ function ctrlHtml(v, o = {}) {
125
172
  const s = v.summary, st = v.stage, id = v.id || v.key || '';
126
173
  const on = AD.prefs()['adler.amount'] !== 'off';
127
174
  const ask = s.tone === 'you' && s.primary;
128
175
  const claude = !ask && s.claude;
129
176
  const pri = !ask && !!st.ready && !!st.next;
130
- // a real win: every task of the stage is done, on the first view only (pm/cozy-adler.js celebrateOnce), his thanks and Plan →
177
+ // a real win: every task of the stage is done, on the first view only (pm/cozy-adler.js celebrateOnce), his thanks and the next stage
131
178
  const win = pri && on && st.key && id && AD.prefs()['adler.amount'] === 'full' && AD.celebrateOnce('stage:' + id + ':' + st.key);
132
- const meta = metaHtml(s, o);
133
- if (win) {
134
- return `<section class="iv-sum iv-card adl win" aria-label="Summary and stage"><div class="iv-win"><span class="iv-wfig">${AD.adler('celebrating', 'l', { label: 'Adler, glad' })}</span>`
135
- + `<div class="iv-wt"><p>${esc(st.name + ' is done. Thanks for the work that got it there.')}</p>${nextHtml(st, o, true)}</div></div>${meta}</section>`;
136
- }
179
+ const M = MD.measuresOf(id), S = mcState(id, { proposal: !!(M && M.mode === 'open') });
137
180
  let top = '';
138
- if (ask) {
181
+ if (win) top = `<div class="iv-mc-top win"><div class="iv-win"><span class="iv-wfig">${AD.adler('celebrating', 'l', { label: 'Adler, glad' })}</span><div class="iv-wt"><p>${esc(st.name + ' is done. Thanks for the work that got it there.')}</p>${nextHtml(st, o, true)}</div></div></div>`;
182
+ else if (ask) {
139
183
  const n = s.n > 1 ? `<button type="button" class="iv-cnt" data-iv-asks aria-label="${esc(s.n + ' asks wait on you. Show them')}" title="Show the other asks">${s.n}</button>` : '';
140
- top = `<div class="iv-ask">${AD.adler('needs-you', 'm', { label: false })}<p class="iv-why">${esc(s.say || s.text || s.primary.label)}</p>${n}`
141
- + `<button type="button" class="iv-go" data-iv-primary="${esc(s.primary.act)}" aria-label="${esc(s.primary.label)}" title="${esc(s.primary.label)}">${SVG(P.go, 16, 2.2)}</button></div>`;
142
- } else if (claude) top = `<div class="iv-ask cl">${AD.adler('thinking', 'm', { label: false })}<p class="iv-why">${esc(s.claude)}</p></div>`;
143
- const box = missionBox(v, o, pri);
144
- const adl = on && (ask || claude);
145
- const body = ask || claude ? top + meta + '<div class="iv-hr"></div>' + box : box + '<div class="iv-hr"></div>' + meta;
146
- return `<section class="iv-sum iv-card${adl ? ' adl' : ''}" aria-label="Summary and stage">${body}</section>`;
147
- }
148
- /* the milestones, one list for both sizes (Wawan 10:53 and 10:59, canvas v586 and v589): on a desktop their own card under the card, always
149
- * shown (XvpD1Desktop); on a phone the mission's tap opens them in place (XvpE2Stages; ini-view.css hides the card below two columns).
150
- * "Milestones · 1 of 4 done"; a done one has a green tick, the next one is blue with "in N days" (orange with its days late), the release
151
- * says so; a row opens its task. */
152
- const DIA = 'M12 3l9 9-9 9-9-9z';
153
- function msListHtml(v, o) {
154
- const L = v.stage && v.stage.line; if (!L || !L.ms) return '';
155
- const seen = new Set(), all = [];
156
- for (const m of L.ms) for (const x of m.items || []) if (x.id && !seen.has(x.id)) { seen.add(x.id); all.push(x); }
157
- if (!all.length) return '';
158
- const rel = MI.releaseOf(L.ms), relId = rel && rel.item.id, next = all.find((x) => !x.done), done = all.filter((x) => x.done).length;
159
- const row = (x) => {
160
- const up = x === next, cls = x.done ? 'dn' : up ? (x.late ? 'up late' : 'up') : '';
161
- const note = x.done ? '' : up ? (x.late ? (x.ago ? x.ago + (x.ago === 1 ? ' day late' : ' days late') : 'late') : x.left === 0 ? 'today' : x.left === 1 ? 'tomorrow' : x.left ? 'in ' + x.left + ' days' : '') : x.id === relId ? 'release' : '';
162
- const when = x.date + (note ? ' · ' + note : '') + (x.id === relId && note !== 'release' ? ' · release' : '');
163
- const mk = x.done ? `<span class="iv-msk dn">${SVG(P.check, 11, 3)}</span>` : `<span class="iv-msk">${SVG(DIA, 13, 2.4)}</span>`;
164
- const tag = o.openTask ? 'button type="button"' : 'div';
165
- return `<${tag} class="iv-msr${cls ? ' ' + cls : ''}" role="listitem"${o.openTask ? ` data-iv-ms="${esc(x.id)}"` : ''} aria-label="${esc('Milestone ' + x.name + ', ' + when + (o.openTask ? '. Open its task' : ''))}">${mk}<span class="iv-msn">${esc(x.name)}</span><span class="iv-msd">${esc(when)}</span></${o.openTask ? 'button' : 'div'}>`;
166
- };
167
- return `<div class="iv-msh"><b>Milestones</b><span class="n">${esc(done + ' of ' + all.length + ' done')}</span></div><div class="iv-msl" role="list">${all.map(row).join('')}</div>`;
184
+ top = `<div class="iv-mc-top adl"><div class="iv-ask">${AD.adler('needs-you', 'm', { label: false })}<p class="iv-why">${esc(s.say || s.text || s.primary.label)}</p>${n}`
185
+ + `<button type="button" class="iv-go" data-iv-primary="${esc(s.primary.act)}" aria-label="${esc(s.primary.label)}" title="${esc(s.primary.label)}">${SVG(P.go, 16, 2.2)}</button></div></div>`;
186
+ } else if (claude) top = `<div class="iv-mc-top adl"><div class="iv-ask cl">${AD.adler('thinking', 'm', { label: false })}<p class="iv-why">${esc(s.claude)}</p></div></div>`;
187
+ return `<section class="iv-sum iv-mc${S.mc ? '' : ' shut-mc'}${S.gx ? '' : ' shut-gx'}${S.ab ? '' : ' shut-ab'}${top ? ' has-top' : ''}" aria-label="Mission">${top}`
188
+ + `<div class="iv-mc-row">${telHtml(v, o, pri, S.mc)}${S.mc ? gatesHtml(v, o, pri, S.gx) : ''}</div>${S.mc ? AB.aboutHtml(v, o, S.ab) : ''}</section>`;
168
189
  }
169
- function msCardHtml(v, o) { const h = msListHtml(v, o); return h ? `<section class="iv-msc" aria-label="Milestones">${h}</section>` : ''; }
170
- /** Adler is on the card (his face asks or Claude works, or his full body on a win): the empty Tasks then draws no figure (one Adler per screen). */
190
+ /** The date of an ISO day, as the model says dates ("Oct 30"). */
191
+ const dateYOf = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+m[2] - 1] + ' ' + +m[3] : ''; };
192
+ /** Adler is on the component (his face asks or Claude works, or his full body on a win): the empty Tasks then draws no figure (one Adler per screen). */
171
193
  const cardHasAdler = (v) => AD.prefs()['adler.amount'] !== 'off' && ((v.summary.tone === 'you' && !!v.summary.primary) || !!v.summary.claude);
172
194
 
195
+ /** The picture at the size it has (R3): after each draw, and when the card's size changes, each picture is drawn again at its own pixels. */
196
+ export function fitMission(body) {
197
+ if (!body || !body.querySelectorAll) return;
198
+ for (const el of body.querySelectorAll('[data-iv-tj]')) {
199
+ const t = TRAJ.get(el.dataset.ivTj); if (!t || !t.M) continue;
200
+ const w = Math.round(el.clientWidth), h = Math.round(el.clientHeight);
201
+ if (w < 160 || h < 90 || (el.dataset.w === String(w) && el.dataset.h === String(h))) continue;
202
+ el.dataset.w = String(w); el.dataset.h = String(h);
203
+ el.innerHTML = MI.trajSvg(t.M, { w, h, tap: t.tap, today: t.today });
204
+ }
205
+ }
206
+
173
207
  /* ── the WBS ── */
174
208
  const GRIP = 'M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01';
175
209
  function taskHtml(x, o, arch) {
@@ -298,7 +332,7 @@ function tasksHtml(v0, o) {
298
332
  const ivId = o.quick ? v.id || v.key || '' : '';
299
333
  if (ivId) ED.stagesSet(ivId, v0, v);
300
334
  o = { ...o, lk, ivId, stageMode, addIn: !!(o.add && o.quick), jiraRead: v.jiraRead || v0.jiraRead || '' };
301
- const head = `<div class="iv-th"><b>Tasks</b>${cnt ? `<span class="n">${esc(cnt)}</span>` : ''}${LK.headHtml(lk)}${VS.headHtml(v.vs)}<span class="iv-sp"></span>${T.empty ? '' : G.headHtml(v) + TV.viewBtnHtml(mode) + TV.fullBtnHtml(mode)}${VS.liveHtml(v.vs)}${add}</div>`
335
+ const head = `<div class="iv-th"><b>Tasks</b>${cnt ? `<span class="n">${esc(cnt)}</span>` : ''}${LK.headHtml(lk)}${VS.headHtml(v.vs)}<span class="iv-sp"></span>${T.empty ? '' : G.headHtml(v) + TV.viewBtnHtml(mode)}${VS.liveHtml(v.vs)}${add}</div>`
302
336
  + (o.adding ? `<form class="iv-addf" data-iv-addform><input id="ivAddTask" type="text" maxlength="160" autocomplete="off" placeholder="A task for ${esc(v.title)}${o.addHint ? esc(', ' + o.addHint) : ''}" aria-label="New task"><button type="submit" class="iv-go" aria-label="Add the task" title="Add (Enter). Esc cancels.">${SVG(P.check, 16, 2.2)}</button></form>` : '');
303
337
  // while Claude looks for a new initiative elsewhere, Tasks waits for what it finds (PiA1)
304
338
  if (T.empty && PP.lookHtml(v)) return head + PP.lookHtml(v);
@@ -357,12 +391,13 @@ function foldsHtml(v, o) {
357
391
  return rows.length ? `<div class="iv-folds">${rows.join('')}</div>` : '';
358
392
  }
359
393
  const VIEWED = new Map(); // initiative id → the view drawn last (the ✦ in the Viewer's header reads it)
394
+ const OPTS = new Map(); // initiative id → the options it was drawn with, so About can draw alone when its description arrives
360
395
  export function viewHtml(v, o = {}) {
361
- if (v && v.id) VIEWED.set(v.id, v);
396
+ if (v && v.id) { VIEWED.set(v.id, v); OPTS.set(v.id, o); }
362
397
  // a merged initiative leads with where its work went, and draws no stage or tasks (they moved; its folds stay); an open one shows Claude's split or merge card under the summary (batch 11 item 14)
363
398
  if (v.merged) return `<div class="iv" data-iv="${esc(v.id || v.key || '')}"><div class="iv-cols"><div class="iv-cl">${smMerged(v.merged)}</div><div class="iv-cr">${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
364
399
  // One reading column: summary, milestones and proposals, then content-sized Tasks and document folds.
365
- return `<div class="iv" data-iv="${esc(v.id || v.key || '')}"><div class="iv-cols"><div class="iv-cl">${cardHtml(v, o)}${msCardHtml(v, o)}${o.sm !== false ? smCard(v.suggest, v.title) : ''}${MD.iniHtml(v.id, '', v.title)}</div>`
400
+ return `<div class="iv" data-iv="${esc(v.id || v.key || '')}"><div class="iv-cols"><div class="iv-cl">${ctrlHtml(v, o)}${o.sm !== false ? smCard(v.suggest, v.title) : ''}</div>`
366
401
  + `<div class="iv-cr"><section class="iv-tasks" aria-label="Tasks">${tasksHtml(v, o)}</section>${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
367
402
  }
368
403
 
@@ -372,9 +407,13 @@ export function wireView(body, h) {
372
407
  const idOf = () => { const n = body.querySelector('[data-iv]'); return n ? n.dataset.iv : null; };
373
408
  body.__iv = LK.wrap(VS.wrap(ED.writes({ ...h, __id: idOf }), body, (id) => SHOWN.get(id)), idOf);
374
409
  // the one blue ✦ after the title (pm/ini-props.js), drawn again with each draw of the initiative
375
- const chip = () => { const id = idOf(); if (id && VIEWED.has(id)) PP.sync(VIEWED.get(id), body.__iv || {}); drafts(id); };
410
+ const chip = () => { const id = idOf(); if (id && VIEWED.has(id)) PP.sync(VIEWED.get(id), body.__iv || {}); drafts(id); about(id); fitMission(body); };
376
411
  // the success measure Claude drafted: read once per page load, the view draws again when it arrives
377
412
  const drafts = (id) => { const H = body.__iv || {}; if (id && VIEWED.has(id)) MD.want(((H.where && H.where()) || {}).ws || '', 'initiative', id, () => { if (idOf() === id && H.redraw) H.redraw(); }); };
413
+ // the description: the PRD, read once per path through /api/doc; the view draws again when it arrives
414
+ // About draws alone when its description arrives: a full redraw would close a task row the PM has open
415
+ const about = (id) => { const H = body.__iv || {}, v = id && VIEWED.get(id), prd = v && v.links && v.links.prd;
416
+ if (prd) AB.want(((H.where && H.where()) || {}).ws || '', prd, () => { const at = idOf() === id && body.querySelector('.iv-ab'); if (!at) return; const M = MD.measuresOf(id); at.outerHTML = AB.aboutHtml(v, OPTS.get(id) || {}, mcState(id, { proposal: !!(M && M.mode === 'open') }).ab); }); };
378
417
  chip();
379
418
  G.attach(body, body.__iv); // the layout and the drafted tickets of the initiative shown (batch 11 item 20)
380
419
  if (body.__ivWired) return;
@@ -386,20 +425,16 @@ export function wireView(body, h) {
386
425
  if (typeof ResizeObserver === 'function') new ResizeObserver(fit).observe(body);
387
426
  fit();
388
427
  }
389
- // the mission (batch 18 item 1): a flag, the planet or the dish opens its milestone's task; anywhere else on it opens the list in place
428
+ // the mission: a diamond, the planet or the dish opens its milestone's task
390
429
  const missionPress = (e) => {
391
430
  const H = body.__iv || {}, m = e.target.closest('[data-mi-ms]');
392
431
  if (m && body.contains(m) && H.openTask) { e.preventDefault(); H.openTask(m.dataset.miMs, m); return true; }
393
- const pic = e.target.closest('[data-iv-mi]'); if (!pic || !body.contains(pic) || e.target.closest('button, a')) return false;
394
- const root = pic.closest('[data-iv]'); if (!root) return false;
395
- e.preventDefault(); const id = root.dataset.iv; LINE.set(id, LINE.get(id) ? '' : 'list'); if (H.redraw) H.redraw();
396
- later(pic, (r) => r.querySelector('[data-iv-mi]'), true);
397
- return true;
432
+ return false;
398
433
  };
399
- body.addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches && e.target.matches('[data-mi-ms], [data-iv-mi]')) missionPress(e); });
400
- // hover names a milestone and its date (XvpD1Desktop); a click opens its task
434
+ body.addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches && e.target.matches('[data-mi-ms]')) missionPress(e); });
435
+ // hover names a milestone and its date; a click opens its task
401
436
  const tip = (m, show) => {
402
- const box = m.closest('.iv-mi'), t = box && box.querySelector('.iv-mi-tip'); if (!t) return;
437
+ const box = m.closest('.iv-tel'), t = box && box.querySelector('.iv-mi-tip'); if (!t) return;
403
438
  if (!show) { t.hidden = true; return; }
404
439
  t.innerHTML = `<b>${esc(m.dataset.miTip)}</b><i>${esc((m.dataset.miDate ? m.dataset.miDate + ' · ' : '') + 'click to open its task')}</i>`;
405
440
  t.style.left = m.dataset.miX + '%'; t.classList.toggle('r', +m.dataset.miX > 60); t.hidden = false;
@@ -414,6 +449,8 @@ export function wireView(body, h) {
414
449
  const root = b.closest('[data-iv]'); if (!root) return;
415
450
  const id = root.dataset.iv;
416
451
  const d = b.dataset;
452
+ if (d.ivMc) { e.preventDefault(); const M = MD.measuresOf(id); mcToggle(id, d.ivMc, { proposal: !!(M && M.mode === 'open') }); if (H.redraw) H.redraw(); later(b, (r) => r.querySelector(`[data-iv-mc="${d.ivMc}"]`), true); return; }
453
+ if (d.abMore && AB.pressMore(b, H.redraw)) { e.preventDefault(); return; }
417
454
  if (d.md && MD.press(b, { redraw: H.redraw, toast: H.toast })) { e.preventDefault(); return; }
418
455
  if (VS.press(b, d, root, H)) return;
419
456
  if (G.press(b, d, root, H)) return;
@@ -452,38 +489,14 @@ export function wireView(body, h) {
452
489
  TV.wireDrag(body, () => { LK.draw(body, true); const n = body.querySelector('[data-iv]'); if (n) LK.sweep(n.dataset.iv, body.__iv || {}); });
453
490
  body.addEventListener('keydown', (e) => { if (e.key === 'Escape' && e.target.id === 'ivAddTask') { e.stopPropagation(); const H = body.__iv || {}; if (H.addCancel) H.addCancel(); } });
454
491
  }
455
- /* ── the stage card's presses (batch 11 item 21) ──
456
- * A part of the line or "N of M done" shows that stage in Tasks: its section opens and scrolls into view (the Kanban turns to that stage).
457
- * A ◇ shows its task there. On a phone a tap on the line lists the stages and milestones under it instead (ScxA2Phone). A counted ◇, a
458
- * gap and the phone's list unfold under the line; a second press folds them. */
492
+ /* ── the component's presses ──
493
+ * A milestone row of the way to finish opens its task; the hold chip opens the hold. A fold or the master hide is wired where the presses are. */
459
494
  const phone = () => typeof matchMedia === 'function' && matchMedia('(max-width: 760px)').matches;
460
495
  function lineMove(b, d, id, H, e) {
461
- const fold = (k) => { LINE.set(id, LINE.get(id) === k ? '' : k); if (H.redraw) H.redraw(); };
462
- const inLine = !!b.closest('[data-iv-line]');
463
- if (d.ivStage != null) { e.preventDefault(); if (inLine && phone()) fold('list'); else showIn(b, id, H, d.ivStage, null); return true; }
464
- if (d.ivMs && b.closest('.iv-mio, .iv-msc') && H.openTask) { e.preventDefault(); H.openTask(d.ivMs, b); return true; } // the mission's list and the Milestones card: a milestone opens its task
465
- if (d.ivMs) { e.preventDefault(); if (inLine && phone()) { fold('list'); return true; } const v = SHOWN.get(id), f = v && findRow(v, d.ivMs); showIn(b, id, H, f ? f.sec : null, d.ivMs); return true; }
466
- if (d.ivMsc != null) { e.preventDefault(); fold(phone() ? 'list' : 'ms:' + d.ivMsc); return true; }
467
- if (d.ivGap != null) { e.preventDefault(); fold(phone() ? 'list' : 'gap:' + d.ivGap); return true; }
468
- if ('ivTlall' in d) { e.preventDefault(); LINE.set(id, LINE.get(id) === 'list+' ? 'list' : 'list+'); if (H.redraw) H.redraw(); return true; }
469
- if (d.ivGapadd && H.add) { e.preventDefault(); const [start, due] = d.ivGapadd.split(' '); LINE.set(id, ''); H.add(b, { start, due }); return true; }
470
- if ('ivTlcal' in d) { e.preventDefault(); TV.setViewMode('timeline'); if (H.redraw) H.redraw(); later(b, (root) => root.querySelector('.iv-th')); return true; }
496
+ if (d.ivMs && b.closest('.iv-gx') && H.openTask) { e.preventDefault(); H.openTask(d.ivMs, b); return true; }
471
497
  if (d.ivHold != null && H.hold) { e.preventDefault(); H.hold(+d.ivHold, b); return true; }
472
- if (d.ivIni && H.openIni) { e.preventDefault(); H.openIni(d.ivIni, b); return true; }
473
498
  return false;
474
499
  }
475
- /** A task row of the view by its id: { x, sec, fold } — fold: the fold inside its section that holds it (a WBS group or Done), or ''. */
476
- function findRow(v, uid) {
477
- for (const s of (v.tasks && v.tasks.sections) || []) {
478
- const inner = s.stages ? s.stages : [s];
479
- for (const c of inner) {
480
- if ((c.top || []).some((x) => x.uid === uid)) return { x: c.top.find((x) => x.uid === uid), sec: c.key, fold: '' };
481
- for (const g of c.groups || []) if (g.rows.some((x) => x.uid === uid)) return { x: g.rows.find((x) => x.uid === uid), sec: c.key, fold: c.key + ':g:' + g.key };
482
- if ((c.done || []).some((x) => x.uid === uid)) return { x: c.done.find((x) => x.uid === uid), sec: c.key, fold: c.key + ':done' };
483
- }
484
- }
485
- return null;
486
- }
487
500
  /** After the redraw: find the target in the view and bring it into sight, with a short highlight. */
488
501
  function later(b, pick, focus) {
489
502
  const body = b.closest('[data-iv]') && b.closest('[data-iv]').parentElement;
@@ -496,27 +509,6 @@ function later(b, pick, focus) {
496
509
  };
497
510
  if (typeof requestAnimationFrame === 'function') requestAnimationFrame(go); else go();
498
511
  }
499
- /** Show a stage (and one task of it) in Tasks: its section opens in the List and the Timeline, the Kanban turns to it. */
500
- function showIn(b, id, H, key, uid) {
501
- // grouped by epic (or any grouping but Stage) there is no stage section to open: Tasks shows that stage's tasks only (batch 12 item 0)
502
- if (key != null && !uid && G.onlyStage(id, key)) { if (H.redraw) H.redraw(); later(b, (root) => root.querySelector('.iv-th')); return; }
503
- if (key != null) {
504
- FOLD.set(id + '|sec:' + (key || 'none'), true); TV.setKanbanStage(id, key);
505
- // a stage with nothing open waits in the List's last fold: open it too
506
- const v = SHOWN.get(id), sec = v && ((v.tasks && v.tasks.sections) || []).find((s) => (s.key || '') === key || (s.stages || []).some((c) => (c.key || '') === key));
507
- if (sec && !openIn(sec)) FOLD.set(id + '|rest', true);
508
- }
509
- if (uid) {
510
- const v = SHOWN.get(id), f = v && findRow(v, uid); if (f && f.fold) FOLD.set(id + '|' + f.fold, true);
511
- if (f && !f.fold) FOLD.set(id + '|' + f.sec + ':more', true); // past the first 3
512
- }
513
- if (H.redraw) H.redraw();
514
- const q = (v) => String(v).replace(/["\\]/g, '\\$&');
515
- later(b, (root) => {
516
- if (uid) { const t = root.querySelector(`.iv-tk [data-iv-task="${q(uid)}"], .iv-wbs [data-iv-task="${q(uid)}"], .iv-wbs [data-iv-check="${q(uid)}"], .iv-tk [data-ivt-bar="${q(uid)}"], .iv-tk [data-iv-check="${q(uid)}"]`); if (t) return t.closest('.iv-tr') || t; }
517
- return root.querySelector(`[data-iv-fold="sec:${q(key || 'none')}"]`) || root.querySelector('.iv-th');
518
- });
519
- }
520
512
 
521
513
  /** For the tests: forget every fold the PM opened or shut. */
522
- export const resetFolds = () => { LINE.clear(); FOLD.clear(); TV.resetViews(); VS.resetVersions(); LK.resetLinks(); G.resetGroups(); ED.reset(); };
514
+ export const resetFolds = () => { MCS.clear(); AB.resetAbout(); FOLD.clear(); TV.resetViews(); VS.resetVersions(); LK.resetLinks(); G.resetGroups(); ED.reset(); };
@@ -83,7 +83,7 @@ const ticketText = (t) => { const s = String((t && (t.text || (t.key ? t.key + '
83
83
  const ticketPill = (t) => `<span class="md-pill">${esc(ticketText(t))}</span>`;
84
84
  const nowOf = (r) => (r.now == null && !r.nowTxt ? '—' : r.nowTxt || String(r.now));
85
85
  const homeHref = (o) => { const q = new URLSearchParams(); for (const [k, v] of Object.entries(o)) if (v) q.set(k, v); return '/premium.html?' + q.toString(); };
86
- const ib = (o) => (o.href
86
+ export const ib = (o) => (o.href
87
87
  ? `<a class="md-ib" href="${esc(o.href)}" aria-label="${esc(o.label)}" title="${esc(o.title || o.label)}">${SVG(o.icon)}</a>`
88
88
  : `<button type="button" class="md-ib${o.solid ? ' solid' : ''}" data-md="${esc(o.act)}" data-md-scope="${esc(o.scope)}" data-md-id="${esc(o.id)}" aria-label="${esc(o.label)}" title="${esc(o.title || o.label)}"${o.busy ? ' disabled' : ''}>${SVG(o.icon, 16, o.solid ? 2.2 : 1.8)}</button>`);
89
89
  const head = (label, src) => `<div class="md-hd"><span class="md-sp ad">${adler('needs-you', 32, { label: false })}</span><b>${esc(label)}</b>${src ? `<span class="md-src">${esc(src)}</span>` : ''}</div>`;
@@ -136,9 +136,15 @@ export function progHtml(p, ws) {
136
136
 
137
137
  /* ── the initiative: the proposed success measure, then the kept fold ── */
138
138
  const ROLE = [[/proves/i, 'Proves it worked · 4 weeks after release'], [/early|signal/i, 'Early signal · shows in days'], [/guard/i, 'Guardrail']];
139
- const roleOf = (r) => { const m = ROLE.find(([re]) => is(r, re)); return m ? m[1] : String(r.group || ''); };
139
+ export const roleOf = (r) => { const m = ROLE.find(([re]) => is(r, re)); return m ? m[1] : String(r.group || ''); };
140
140
  const order = (r) => { const j = ROLE.findIndex(([re]) => is(r, re)); return j < 0 ? ROLE.length : j; };
141
141
  const targetOf = (r) => r.targetTxt || (r.target == null ? '' : String(r.target));
142
+ /** The initiative's measure rows for About (initiative-mission-control R6): { mode: 'open' | 'kept', rows (in role order), busy } or null. */
143
+ export function measuresOf(id) {
144
+ if (!id) return null;
145
+ const P = partOf('initiative', id); if (!P) return null;
146
+ return { mode: P.mode, rows: P.rows.slice().sort((a, b) => order(a) - order(b)), busy: P.busy };
147
+ }
142
148
  export function iniHtml(id, ws, title) {
143
149
  if (!id) return '';
144
150
  const P = partOf('initiative', id); if (!P) return '';