create-pmos 0.441.0 → 0.442.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 (60) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +1 -1
  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/workspace/adler-seasons-art-test.js +106 -0
  7. package/workspace/adler-seasons-test.js +111 -0
  8. package/workspace/briefing-premium-board-test.js +19 -17
  9. package/workspace/briefing-premium-initiative-test.js +7 -4
  10. package/workspace/changelog.json +12 -0
  11. package/workspace/guide/adler.md +10 -0
  12. package/workspace/guide/home.md +2 -0
  13. package/workspace/ini-workflow-test.js +6 -2
  14. package/workspace/lib/settings-store.js +38 -0
  15. package/workspace/metric-drafts-ui-test.js +2 -2
  16. package/workspace/package-lock.json +2 -2
  17. package/workspace/package.json +1 -1
  18. package/workspace/premium-board-actions-test.js +2 -1
  19. package/workspace/premium-chat-attach-test.js +2 -0
  20. package/workspace/program-panel-test.js +1 -1
  21. package/workspace/public/pm/bd-ini-panel.js +2 -2
  22. package/workspace/public/pm/c3-ini-ui.js +1 -1
  23. package/workspace/public/pm/cozy-adler.css +21 -0
  24. package/workspace/public/pm/cozy-adler.js +415 -8
  25. package/workspace/public/pm/cozy-ev.css +16 -1
  26. package/workspace/public/pm/cozy-home.css +8 -0
  27. package/workspace/public/pm/cozy-news.js +1 -1
  28. package/workspace/public/pm/cozy-seasons.js +318 -0
  29. package/workspace/public/pm/cozy-settings.js +88 -5
  30. package/workspace/public/pm/cozy-viewer.js +8 -4
  31. package/workspace/public/pm/cozy.css +65 -0
  32. package/workspace/public/pm/dash-view.js +4 -2
  33. package/workspace/public/pm/home-app.js +8 -2
  34. package/workspace/public/pm/home-chat.js +1 -1
  35. package/workspace/public/pm/home-day.js +7 -4
  36. package/workspace/public/pm/home-ini.js +2 -2
  37. package/workspace/public/pm/home-mentions.js +1 -1
  38. package/workspace/public/pm/impact.js +1 -1
  39. package/workspace/public/pm/ini-groups.js +15 -10
  40. package/workspace/public/pm/ini-links.js +1 -1
  41. package/workspace/public/pm/ini-tasks.js +208 -44
  42. package/workspace/public/pm/ini-view-model.js +8 -2
  43. package/workspace/public/pm/ini-view.css +305 -1
  44. package/workspace/public/pm/ini-view.js +190 -80
  45. package/workspace/public/pm/mission.js +234 -0
  46. package/workspace/public/pm/premium-board.js +1 -1
  47. package/workspace/public/pm/premium-welcome.js +2 -2
  48. package/workspace/public/pm/split-merge.js +1 -1
  49. package/workspace/public/pm/stage-line.js +2 -2
  50. package/workspace/split-merge-ui-test.js +1 -1
  51. package/workspace/stage-card-test.js +48 -11
  52. package/workspace/task-links-test.js +2 -0
  53. package/workspace/task-milestones-test.js +5 -1
  54. package/workspace/task-plans-test.js +3 -3
  55. package/workspace/task-views-test.js +90 -37
  56. package/workspace/test-lists/adler-seasons-art.json +13 -0
  57. package/workspace/test-lists/batch18-adler-seasons.json +13 -0
  58. package/workspace/test-lists/mission.json +5 -0
  59. package/workspace/test-lists/viewer-tasks.json +5 -0
  60. package/workspace/tk-tasks-test.js +25 -30
@@ -3,13 +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, top to bottom: the summary card (what waits on you leads, with the one primary; else the status and why;
7
- * the meta line: the status when something waits, the owner, the workflow, the program), the stage card (the stage's
8
- * number and name, how much of its section is done, the day clock and the → to the next stage, then its one line:
9
- * each stage on its own dates with the milestone tasks as ◇, pm/stage-line.js, batch 11 item 21), Tasks as the WBS
10
- * (sections in workflow order), then Documents and Linked as folds. Under the stage card, the success measure Claude
11
- * drafted from the PRD (pm/metric-drafts.js, GET /api/metric-drafts scope initiative): the proposal, or once kept its
12
- * fold with Undo; nothing when nothing is drafted.
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. From about 900 px the card is a 420 px column on the left and the rest fills the right
9
+ * (XvpD1Desktop). 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.
13
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,
14
12
  * quick (each task's box carries the status caret and its date is a press: the host has h.status and h.dates),
15
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),
@@ -22,14 +20,16 @@
22
20
  * h.person(btn), h.stagePick(btn), h.planDates(btn), h.jira(btn) (batch 16 item 5c),
23
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,
24
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);
25
- * the stage card's line (batch 11 item 21, pm/stage-line.js): h.add(btn, { start, due }) a gap's + (a task on those dates),
26
- * h.hold(i, btn) a hold's ⏸ or calendar (o.hold: the host has it), h.openIni(id) "after <initiative>";
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),
24
+ * h.asks(btn) the ask's count (else the primary);
27
25
  * for planned versus actual (pm/ini-versions.js) h.where() → { ws, board }, h.reload() and h.toast(text, undo?)
28
26
  *
29
27
  * Tasks has three views (batch 9 item 5b; canvas In development, row "Tasks views"): the List (the WBS below), Timeline and Kanban
30
- * (pm/ini-tasks.js). The icon segment in the Tasks header switches them, and the last one is remembered for the PM. The group icon before
31
- * it (batch 11 item 20, pm/ini-groups.js) groups the same tasks by Stage, Epic, Your groups, Owner or Status in all three views; By epic
32
- * carries the send icons and Send to Jira, which used to be the old All tasks panel's.
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
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
+ * 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
+ * something open (the rest wait in one fold at its foot), and a stage folds after 3 tasks.
33
33
  *
34
34
  * Folds keep their state per initiative for the session (a section, the Later line, a WBS group, the done tasks). Icon-only presses carry
35
35
  * their words in aria-label and title. Zero is silence: a part with nothing on record draws nothing. */
@@ -40,7 +40,8 @@ import * as LK from './ini-links.js'; // links between tasks and quiet moves (
40
40
  import * as PP from './ini-props.js'; // what Claude proposes, under the one blue ✦ after the title (batch 12 items 2, 3 and 4)
41
41
  import * as G from './ini-groups.js'; // Group by and Send to Jira, in place of the old All tasks panel (batch 11 item 20)
42
42
  import { cardHtml as smCard, mergedHtml as smMerged } from './split-merge.js'; // split or merge: Claude's card, the merged summary (batch 11 item 14)
43
- import { lineHtml, fitLine } from './stage-line.js'; // the stage card's one line (batch 11 item 21)
43
+ import * as MI from './mission.js'; // the initiative as a mission, the stage line's place (batch 18 item 1)
44
+ import * as AD from './cozy-adler.js'; // Adler on the card: his face for the ask, his full body for a real win
44
45
  import * as MD from './metric-drafts.js'; // the success measure Claude drafts from the PRD (batch 15 item 1, canvas Iq9Initiative)
45
46
 
46
47
  const CSS = new URL('./ini-view.css', import.meta.url).href;
@@ -59,64 +60,112 @@ const FOLD = new Map(); // `${id}|${key}` → true (open) | false (shut): the
59
60
  const isOpen = (v, key, dflt) => { const k = (v.id || v.key) + '|' + key; return FOLD.has(k) ? FOLD.get(k) : !!dflt; };
60
61
  const SHOWN = new Map(); // id → the view last drawn, for the Kanban's stage picker
61
62
 
62
- /* ── the summary card ── */
63
- function summaryHtml(s, o = {}) {
64
- const dot = s.tone === 'you' ? 'you' : s.tone === 'warn' ? 'warn' : s.tone === 'ok' ? 'ok' : '';
65
- const go = s.primary ? `<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>` : '';
66
- const meta = [];
67
- // the dashed + after the people (batch 16 item 5c): Add a stakeholder, where it left the ⋯
68
- const addP = o.person ? `<button type="button" class="iv-addp" data-iv-person aria-label="Add a stakeholder" title="Add a stakeholder">${SVG(P.plus, 12, 2.4)}</button>` : '';
69
- if (s.status) meta.push(`<span class="iv-st ${esc(s.status.tone)}"><i aria-hidden="true"></i>${esc(s.status.text)}</span>`);
70
- meta.push((s.owner ? `<span class="iv-who"><span class="iv-av" aria-hidden="true">${esc(s.owner.av)}</span>${esc(s.owner.name)}</span>` : '<span class="iv-who q">No owner</span>') + addP);
71
- if (s.wf) meta.push(o.wf ? `<button type="button" class="iv-wf" data-iv-wf aria-haspopup="listbox" aria-label="${esc('Workflow: ' + (s.wf.name || 'Product feature') + '. Change')}" title="Change the workflow">${wfIcon(s.wf, 15)}${esc(s.wf.name || 'Product feature')}</button>`
72
- : `<span class="iv-wf">${wfIcon(s.wf, 15)}${esc(s.wf.name || 'Product feature')}</span>`);
73
- if (s.program) meta.push(`<button type="button" class="iv-prog" data-iv-program="${esc(s.program.id)}" title="Open the program ${esc(s.program.title)}">${SVG(P.prog, 15)}${esc(s.program.title)}</button>`);
74
- if (!s.line && !s.text && !go) return '';
75
- // nothing to say beyond the status (batch 16 item 7, "feels like wasting space"): one row. The owner is the avatar, the workflow its icon,
76
- // each named on hover and to a reader; the program keeps its name, because it is a press
77
- if (!s.text && !go) {
78
- const m = [];
79
- if (s.status) m.push(`<span class="iv-st ${esc(s.status.tone)}"><i aria-hidden="true"></i>${esc(s.status.text)}</span>`);
80
- m.push((s.owner ? `<span class="iv-who" title="${esc('Owner: ' + s.owner.name)}"><span class="iv-av" aria-hidden="true">${esc(s.owner.av)}</span><span class="iv-sr">${esc(s.owner.name)}</span></span>` : '<span class="iv-who q">No owner</span>') + addP);
81
- const wn = s.wf ? s.wf.name || 'Product feature' : '';
82
- if (s.wf) m.push(o.wf ? `<button type="button" class="iv-wf" data-iv-wf aria-haspopup="listbox" aria-label="${esc('Workflow: ' + wn + '. Change')}" title="${esc('Workflow: ' + wn + '. Change')}">${wfIcon(s.wf, 15)}<span class="iv-sr">${esc(wn)}</span></button>`
83
- : `<span class="iv-wf" title="${esc('Workflow: ' + wn)}">${wfIcon(s.wf, 15)}<span class="iv-sr">${esc(wn)}</span></span>`);
84
- if (s.program) m.push(`<button type="button" class="iv-prog" data-iv-program="${esc(s.program.id)}" title="Open the program ${esc(s.program.title)}">${SVG(P.prog, 15)}${esc(s.program.title)}</button>`);
85
- return `<section class="iv-sum iv-one" aria-label="Summary"><div class="iv-s1 ${dot}">${dot && dot !== 'ok' ? '<span class="iv-dot" aria-hidden="true"></span>' : ''}<b>${esc(s.line)}</b>`
86
- + `<p class="iv-meta">${m.join('')}</p>${s.right ? `<span class="iv-r">${esc(s.right)}</span>` : ''}</div></section>`;
87
- }
88
- return `<section class="iv-sum" aria-label="Summary"><div class="iv-s1 ${dot}">${dot && dot !== 'ok' ? '<span class="iv-dot" aria-hidden="true"></span>' : ''}<b>${esc(s.line)}</b>`
89
- + `${s.right ? `<span class="iv-r">${esc(s.right)}</span>` : ''}${go}</div>${s.text ? `<p class="iv-why">${esc(s.text)}</p>` : ''}`
90
- + `<p class="iv-meta">${meta.join('<span class="iv-sep" aria-hidden="true">·</span>')}</p></section>`;
63
+ /* ── the card: the ask, the meta line and the mission, one card (batch 18 item 1, agreed A; canvas XvpA1, XvpA2Dark, XvpE1States,
64
+ * XvpE2Stages, XvpE5Adler, XvpD1Desktop) ──
65
+ * 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).
66
+ * 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
67
+ * →, 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
68
+ * "+N", the workflow icon and the program chip, which truncates first. The mission (pm/mission.js) replaces the stage line; a tap on a
69
+ * 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
70
+ * 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
71
+ * Plan →, the mission steps aside that once). */
72
+ const LINE = new Map(); // id → what is unfolded under the mission ('' | 'list' | 'list+')
73
+ 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';
74
+ function metaHtml(s, o) {
75
+ 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>`
76
+ : `<span class="iv-mt iv-ring" role="img" aria-label="No owner" title="No owner">${SVG(RING, 16, 2)}</span>`;
77
+ const st = s.stake || [], shown = st.slice(0, 2), more = st.length - shown.length;
78
+ const stack = shown.map((p) => `<span class="iv-av" aria-hidden="true">${esc(p.av)}</span>`).join('') + (more > 0 ? `<span class="iv-avn" aria-hidden="true">+${more}</span>` : '');
79
+ const sw = st.length ? (o.person ? `<button type="button" class="iv-mt iv-avs" data-iv-person aria-label="${esc('Stakeholders: ' + st.map((p) => p.name).join(', ') + '. Add one')}" title="Stakeholders">${stack}</button>`
80
+ : `<span class="iv-mt iv-avs" role="img" aria-label="${esc('Stakeholders: ' + st.map((p) => p.name).join(', '))}">${stack}</span>`)
81
+ : o.person ? `<button type="button" class="iv-mt iv-addp" data-iv-person aria-label="Add a stakeholder" title="Add a stakeholder">${SVG(P.plus, 14, 2.2)}</button>` : '';
82
+ const wn = s.wf ? s.wf.name || 'Product feature' : '';
83
+ const wf = !s.wf ? '' : o.wf ? `<button type="button" class="iv-mt iv-wf" data-iv-wf aria-haspopup="listbox" aria-label="${esc('Workflow: ' + wn + '. Change')}" title="${esc('Workflow: ' + wn + '. Change')}">${wfIcon(s.wf, 17)}</button>`
84
+ : `<span class="iv-mt iv-wf" role="img" aria-label="${esc('Workflow: ' + wn)}" title="${esc('Workflow: ' + wn)}">${wfIcon(s.wf, 17)}</span>`;
85
+ const prog = s.program ? `<button type="button" class="iv-prog" data-iv-program="${esc(s.program.id)}" title="${esc('Open the program ' + s.program.title)}">${SVG(P.prog, 15)}<span>${esc(s.program.title)}</span></button>` : '';
86
+ return `<p class="iv-meta">${who}${sw}${wf}${prog}</p>`;
91
87
  }
92
-
93
- /* ── the stage card: its header and one line (batch 11 item 21, agreed A; it replaced the ladder, the dates line and the next stage) ──
94
- * The header: the stage's number and name, "N of M done" (a press shows the stage in Tasks), the clock, or the hold, done or draft chip that
95
- * replaces it, the calendar when a date is missing, and the next stage's name with → that opens the move sheet (blue when every task of the
96
- * stage is done and the next stage waits; batch 14 item 11: a bare → did not say where it goes). The line is pm/stage-line.js. */
97
- const CLOCK = 'M12 7.5V12l3 2M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17';
98
- const LINE = new Map(); // id → what is unfolded under the line ('' | 'list' | 'list+' | 'ms:<i>' | 'gap:<i>')
99
- function stageHtml(st, o, id) {
100
- const L = st.line;
88
+ function nextHtml(st, o, pri) {
89
+ const n = st.next; if (!n) return '';
90
+ const tag = o.next ? 'button type="button" data-iv-next' : 'span';
91
+ 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'}>`;
92
+ }
93
+ function missionBox(v, o, pri) {
94
+ const st = v.stage, L = st.line, id = v.id || v.key || '', M = MI.missionOf(L);
95
+ const open = LINE.get(id) || '';
101
96
  const tile = st.n ? `<span class="iv-no${st.ms ? ' ms' : ''}" aria-hidden="true">${st.ms ? '' : st.n}</span>` : '';
102
- const of = st.doneOf ? (st.key ? `<button type="button" class="iv-scd" data-iv-stage="${esc(st.key)}" title="Show ${esc(st.name)} in Tasks">${esc(st.doneOf)}</button>` : `<span class="iv-scd">${esc(st.doneOf)}</span>`) : '';
103
- const chip = L && L.chip ? `<span class="iv-chp ${esc(L.chip.tone)}">${L.chip.pause ? SVG(P.pause, 11, 2.4) : ''}${esc(L.chip.text)}</span>` : '';
104
- const clock = !chip && st.clock ? `<span class="iv-clk${st.dayOver ? ' w' : ''}">${SVG(CLOCK, 13, 2)}${esc(st.clock)}</span>` : '';
105
- const cal = L && L.cal === 'dates' ? `<button type="button" class="iv-ib iv-scb" data-iv-tlcal aria-label="No dates yet. Set them in Tasks" title="Set the dates">${SVG(P.cal, 16)}</button>`
106
- : L && L.cal === 'back' && o.hold ? `<button type="button" class="iv-ib iv-scb" data-iv-hold="${L.holdAt}" aria-label="On hold with no return date. Set it" title="Set the return date">${SVG(P.cal, 16)}</button>` : '';
107
- const n = st.next;
108
- const go = n ? `<${o.next ? 'button type="button" data-iv-next' : 'span'} class="iv-scgo${st.ready ? ' 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'}>` : '';
109
- // a phone puts "N of M done" and the clock on a line of their own under the name (ScxA2Phone)
110
- const meta = of || clock || chip ? `<span class="iv-scm">${of}${clock}${chip}</span>` : '';
111
- // the stage's name is the chip that moves it (batch 16 item 5c, FmI2Stage): every stage, Moves on by itself, hold, Won't do, Archive
112
- 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>${SVG(P.down, 12, 2.4)}</button>` : `<b>${esc(st.name)}</b>`;
113
- // the plan's dates are the chip that changes them; with none, a calendar says so
114
- const D = st.dates, dtxt = D && (D.start || D.end) ? [D.start, D.end].filter(Boolean).join(' – ') : '';
115
- const dates = o.planDates ? (dtxt ? `<button type="button" class="iv-dtc" data-iv-plandates aria-label="${esc('Plan dates: ' + dtxt + '. Change')}" title="Change the plan dates">${esc(dtxt)}</button>`
116
- : `<button type="button" class="iv-ib iv-scb" data-iv-plandates aria-label="No plan dates yet. Set them" title="Set the plan dates">${SVG(P.cal, 16)}</button>`) : '';
117
- const head = `<div class="iv-sch">${tile}${name}<span class="iv-sp"></span>${meta}${dates}${dates && cal && L.cal === 'dates' ? '' : cal}${go}</div>`;
118
- return `<section class="iv-sc" aria-label="${esc(st.aria || 'Stage · ' + st.name)}">${head}${lineHtml(L, { open: LINE.get(id) || '', hold: !!o.hold })}</section>`;
97
+ 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>`;
98
+ // no plan dates: the gap carries its next action
99
+ 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>` : '';
100
+ const go = pri ? nextHtml(st, o, true) : '';
101
+ // on hold: when it comes back, a press on it opens the hold (the host sets a return date)
102
+ 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>`
103
+ : `<span class="iv-chp ${esc(L.chip.tone)}">${SVG(P.pause, 11, 2.4)}${esc(L.chip.text)}</span>`) : '';
104
+ const head = `<div class="iv-sch"><span class="iv-shn">${tile}${name}</span><span class="iv-sp"></span>${ch}${set}${go}</div>`;
105
+ const nn = MI.nowName(M);
106
+ 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')}">`
107
+ + MI.missionSvg(M, { tap: !!o.openTask })
108
+ + (nn ? `<div class="iv-mi-nm" aria-hidden="true"><span class="${nn.late ? 'late' : ''}" style="left:${nn.x}%">${esc(nn.name)}</span></div>` : '')
109
+ + '<span class="iv-mi-tip" role="tooltip" hidden></span></div>';
110
+ // in place (XvpE2Stages, Wawan 10:59): the stage's dates, ⋯ the stage picker, the next stage; then the milestones, the same list as the
111
+ // desktop's Milestones card (the picture already shows the stages)
112
+ let below = '';
113
+ if (open) {
114
+ 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>` : '';
115
+ const D = st.dates, dt = D && (D.start || D.end) ? [D.start, D.end].filter(Boolean).join(' – ') + (D.left ? ' · ' + D.left : '') : '';
116
+ 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>`) : '';
117
+ below = `<div class="iv-mio"><div class="iv-mio-h">${dates}<span class="iv-sp"></span>${more}${pri ? '' : nextHtml(st, o, false)}</div>${msListHtml(v, o)}</div>`;
118
+ }
119
+ return `<div class="iv-sc iv-mis" aria-label="${esc(st.aria || 'Stage · ' + st.name)}">${head}${pic}${below}</div>`;
120
+ }
121
+ function cardHtml(v, o = {}) {
122
+ const s = v.summary, st = v.stage, id = v.id || v.key || '';
123
+ const on = AD.prefs()['adler.amount'] !== 'off';
124
+ const ask = s.tone === 'you' && s.primary;
125
+ const claude = !ask && s.claude;
126
+ const pri = !ask && !!st.ready && !!st.next;
127
+ // a real win: every task of the stage is done, on the first view only (pm/cozy-adler.js celebrateOnce), his thanks and Plan →
128
+ const win = pri && on && st.key && id && AD.prefs()['adler.amount'] === 'full' && AD.celebrateOnce('stage:' + id + ':' + st.key);
129
+ const meta = metaHtml(s, o);
130
+ if (win) {
131
+ 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>`
132
+ + `<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>`;
133
+ }
134
+ let top = '';
135
+ if (ask) {
136
+ 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>` : '';
137
+ 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}`
138
+ + `<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>`;
139
+ } else if (claude) top = `<div class="iv-ask cl">${AD.adler('thinking', 'm', { label: false })}<p class="iv-why">${esc(s.claude)}</p></div>`;
140
+ const box = missionBox(v, o, pri);
141
+ const adl = on && (ask || claude);
142
+ const body = ask || claude ? top + meta + '<div class="iv-hr"></div>' + box : box + '<div class="iv-hr"></div>' + meta;
143
+ return `<section class="iv-sum iv-card${adl ? ' adl' : ''}" aria-label="Summary and stage">${body}</section>`;
144
+ }
145
+ /* 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
146
+ * shown (XvpD1Desktop); on a phone the mission's tap opens them in place (XvpE2Stages; ini-view.css hides the card below two columns).
147
+ * "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
148
+ * says so; a row opens its task. */
149
+ const DIA = 'M12 3l9 9-9 9-9-9z';
150
+ function msListHtml(v, o) {
151
+ const L = v.stage && v.stage.line; if (!L || !L.ms) return '';
152
+ const seen = new Set(), all = [];
153
+ 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); }
154
+ if (!all.length) return '';
155
+ const rel = MI.releaseOf(L.ms), relId = rel && rel.item.id, next = all.find((x) => !x.done), done = all.filter((x) => x.done).length;
156
+ const row = (x) => {
157
+ const up = x === next, cls = x.done ? 'dn' : up ? (x.late ? 'up late' : 'up') : '';
158
+ 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' : '';
159
+ const when = x.date + (note ? ' · ' + note : '') + (x.id === relId && note !== 'release' ? ' · release' : '');
160
+ 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>`;
161
+ const tag = o.openTask ? 'button type="button"' : 'div';
162
+ 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'}>`;
163
+ };
164
+ 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>`;
119
165
  }
166
+ function msCardHtml(v, o) { const h = msListHtml(v, o); return h ? `<section class="iv-msc" aria-label="Milestones">${h}</section>` : ''; }
167
+ /** 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). */
168
+ const cardHasAdler = (v) => AD.prefs()['adler.amount'] !== 'off' && ((v.summary.tone === 'you' && !!v.summary.primary) || !!v.summary.claude);
120
169
 
121
170
  /* ── the WBS ── */
122
171
  function taskHtml(x, o, arch) {
@@ -144,7 +193,10 @@ function taskHtml(x, o, arch) {
144
193
  const chev = (open) => `<span class="iv-cv" aria-hidden="true">${SVG(open ? P.down : P.right, 15, 2)}</span>`;
145
194
  function bodyHtml(v, sec, o) {
146
195
  // By epic (batch 11 item 20): an epic's tickets first, or what comes next while nothing is drafted
147
- let h = G.tkRowsHtml(sec) + G.tkEmptyHtml(sec) + sec.top.map((x) => taskHtml(x, o)).join('');
196
+ // a stage folds after 3 tasks (batch 18 item 1): "N more" shows the rest
197
+ const mk = sec.key + ':more', mop = isOpen(v, mk, false), top = mop || sec.top.length <= 3 ? sec.top : sec.top.slice(0, 3);
198
+ let h = G.tkRowsHtml(sec) + G.tkEmptyHtml(sec) + top.map((x) => taskHtml(x, o)).join('');
199
+ if (sec.top.length > top.length) h += `<button type="button" class="iv-more" data-iv-fold="${esc(mk)}" aria-expanded="false">${esc((sec.top.length - top.length) + ' more')}${SVG(P.right, 14, 2)}</button>`;
148
200
  if (sec.jira) {
149
201
  const byEp = new Map(); for (const k of sec.jira.open) { const e = k.epic || ''; if (!byEp.has(e)) byEp.set(e, []); byEp.get(e).push(k); }
150
202
  const all = isOpen(v, sec.key + ':tk', false), shown = all ? sec.jira.open : sec.jira.open.slice(0, 3);
@@ -214,10 +266,15 @@ function tasksHtml(v0, o) {
214
266
  // links (batch 11 item 15): the blue ✦ (proposals), the grey ✦ (quiet moves), the late count, between the count and the version chip
215
267
  const lk = T.empty ? null : LK.of(v);
216
268
  o = { ...o, lk };
217
- 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 ? '' : TV.headExtraHtml(v, mode) + G.headHtml(v) + TV.switchHtml(mode)}${VS.liveHtml(v.vs)}${add}</div>`
269
+ 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>`
218
270
  + (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>` : '');
219
271
  // while Claude looks for a new initiative elsewhere, Tasks waits for what it finds (PiA1)
220
272
  if (T.empty && PP.lookHtml(v)) return head + PP.lookHtml(v);
273
+ if (T.empty && !cardHasAdler(v0) && AD.prefs()['adler.amount'] === 'full') {
274
+ // an empty space (XvpE5Adler 2): Adler rests in it with the next action; the card above keeps no face then (one Adler per screen)
275
+ return head + `<div class="iv-empty ad">${AD.adler('resting', 96, { label: 'Adler, resting' })}<p class="iv-q">No tasks yet. I can draft them, one section per stage. Nothing is saved until you keep it.</p>`
276
+ + `<div class="iv-ea">${o.draft ? `<button type="button" class="iv-pbtn" data-iv-draft>${SVG(P.draft, 16, 2)}Draft</button>` : ''}${o.add ? `<button type="button" class="iv-ib" data-iv-add aria-label="Add a task" title="Add a task">${SVG(P.plus, 16, 2.2)}</button>` : ''}</div></div>`;
277
+ }
221
278
  if (T.empty) {
222
279
  const sk = T.empty.stages.map((s) => `<span class="iv-sk"><span class="iv-no dash${s.ms ? ' ms' : ''}" aria-hidden="true">${s.ms ? '' : s.n}</span>${esc(s.name)}${s.now ? ' <i>· now</i>' : ''}</span>`).join('');
223
280
  return head + `<div class="iv-empty">${sk}<p class="iv-q">Claude drafts the breakdown, one section per stage. Nothing is saved until you keep it.</p>`
@@ -227,11 +284,24 @@ function tasksHtml(v0, o) {
227
284
  const fold = (k, d) => isOpen(v, k, d), q = { ...o, mark: markOf };
228
285
  const top = head + G.sumHtml(v);
229
286
  if (mode === 'timeline') return top + `<div class="iv-tk">${TV.timelineHtml(v, q, fold)}</div>`;
230
- if (mode === 'kanban') return top + `<div class="iv-tk">${TV.kanbanHtml(v, q, fold)}</div>`;
287
+ if (mode === 'kanban') return top + `<div class="iv-tk"><div class="ivk-pk">${TV.kanbanPickHtml(v)}</div>${TV.kanbanHtml(v, q, fold)}</div>`;
231
288
  const ol = T.by === 'mine' ? { ...o, gdrag: !!o.quick } : o;
232
289
  // the stage the card showed has no task: say so, and the ✕ in the header shows every stage again (batch 12 item 0)
233
290
  if (T.only && !T.sections.length) return top + `<p class="iv-q ig-none">No tasks in ${esc(T.only)} yet.</p>`;
234
- return top + `<div class="iv-wbs">${T.sections.map((s) => sectionHtml(v, s, ol)).join('')}</div>`;
291
+ // only the stages with something open show (batch 18 item 1, XvpA1); the rest wait in one fold at the foot. The stage card's filter shows
292
+ // its stage as it is.
293
+ // (by stage only: the PM's own groups stay, each a place to drop a task)
294
+ const hide = !T.only && (!T.by || T.by === 'stage');
295
+ const live = hide ? T.sections.filter(openIn) : T.sections, rest = hide ? T.sections.filter((s) => !openIn(s)) : [];
296
+ const rop = isOpen(v, 'rest', !live.length);
297
+ const restRow = rest.length ? `<button type="button" class="iv-grp iv-rest" data-iv-fold="rest" aria-expanded="${rop}"><b>${esc(rest.length + (rest.length === 1 ? ' stage' : ' stages'))}</b><span class="n">nothing open</span>${chev(rop)}</button>`
298
+ + (rop ? rest.map((s) => sectionHtml(v, s, ol)).join('') : '') : '';
299
+ return top + `<div class="iv-wbs">${live.map((s) => sectionHtml(v, s, ol)).join('')}${restRow}</div>`;
300
+ }
301
+ /** A section with something open: a task, a ticket, a work package, a drafted ticket, or By epic's next step. */
302
+ function openIn(sec) {
303
+ if (sec.stages) return sec.stages.some(openIn);
304
+ return !!((sec.top && sec.top.length) || (sec.groups && sec.groups.length) || (sec.jira && sec.jira.open.length) || (sec.tk && sec.tk.some((t) => t.cat !== 'done')) || sec.tkEmpty);
235
305
  }
236
306
  function foldsHtml(v, o) {
237
307
  const rows = [];
@@ -258,8 +328,11 @@ const VIEWED = new Map(); // initiative id → the view drawn last (the ✦ in
258
328
  export function viewHtml(v, o = {}) {
259
329
  if (v && v.id) VIEWED.set(v.id, v);
260
330
  // 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)
261
- const top = v.merged ? smMerged(v.merged) : summaryHtml(v.summary, o) + (o.sm !== false ? smCard(v.suggest, v.title) : '');
262
- return `<div class="iv" data-iv="${esc(v.id || v.key || '')}">${top}${v.merged ? '' : stageHtml(v.stage, o, v.id || v.key || '') + MD.iniHtml(v.id, '', v.title) + tasksHtml(v, o)}${foldsHtml(v, o)}${o.tail || ''}</div>`;
331
+ 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>`;
332
+ // two columns from about 820 px of room (XvpD1Desktop; "below about 900 px wide, the phone layout"): the card and what Claude proposes
333
+ // for it on the left, Tasks on the right from the same top (canvas v582), as one panel with its own scroll; one column below it
334
+ 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>`
335
+ + `<div class="iv-cr"><section class="iv-tasks" aria-label="Tasks">${tasksHtml(v, o)}</section>${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
263
336
  }
264
337
 
265
338
  /* ── the presses ── */
@@ -275,14 +348,40 @@ export function wireView(body, h) {
275
348
  G.attach(body, body.__iv); // the layout and the drafted tickets of the initiative shown (batch 11 item 20)
276
349
  if (body.__ivWired) return;
277
350
  body.__ivWired = true;
278
- // the stage line's labels are checked as drawn (pm/stage-line.js fitLine): after each draw and when the panel changes width
351
+ // the ✦ after the title and the drafted measure follow each draw
279
352
  if (typeof MutationObserver === 'function') {
280
- let q = 0; const fit = () => { if (q) return; q = requestAnimationFrame(() => { q = 0; fitLine(body); chip(); }); };
353
+ // two columns: Tasks fills the Viewer's height from its top and scrolls on its own (--iv-h, read by ini-view.css)
354
+ const tall = () => { const iv = body.querySelector('.iv'); if (!iv) return; const top = iv.getBoundingClientRect().top - body.getBoundingClientRect().top + body.scrollTop;
355
+ const h = Math.max(320, Math.round(body.clientHeight - top - 16)); if (iv.style.getPropertyValue('--iv-h') !== h + 'px') iv.style.setProperty('--iv-h', h + 'px'); };
356
+ let q = 0; const fit = () => { if (q) return; q = requestAnimationFrame(() => { q = 0; chip(); tall(); }); };
281
357
  new MutationObserver(fit).observe(body, { childList: true, subtree: true });
282
358
  if (typeof ResizeObserver === 'function') new ResizeObserver(fit).observe(body);
283
359
  fit();
284
360
  }
361
+ // 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
362
+ const missionPress = (e) => {
363
+ const H = body.__iv || {}, m = e.target.closest('[data-mi-ms]');
364
+ if (m && body.contains(m) && H.openTask) { e.preventDefault(); H.openTask(m.dataset.miMs, m); return true; }
365
+ const pic = e.target.closest('[data-iv-mi]'); if (!pic || !body.contains(pic) || e.target.closest('button, a')) return false;
366
+ const root = pic.closest('[data-iv]'); if (!root) return false;
367
+ e.preventDefault(); const id = root.dataset.iv; LINE.set(id, LINE.get(id) ? '' : 'list'); if (H.redraw) H.redraw();
368
+ later(pic, (r) => r.querySelector('[data-iv-mi]'), true);
369
+ return true;
370
+ };
371
+ body.addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches && e.target.matches('[data-mi-ms], [data-iv-mi]')) missionPress(e); });
372
+ // hover names a milestone and its date (XvpD1Desktop); a click opens its task
373
+ const tip = (m, show) => {
374
+ const box = m.closest('.iv-mi'), t = box && box.querySelector('.iv-mi-tip'); if (!t) return;
375
+ if (!show) { t.hidden = true; return; }
376
+ t.innerHTML = `<b>${esc(m.dataset.miTip)}</b><i>${esc((m.dataset.miDate ? m.dataset.miDate + ' · ' : '') + 'click to open its task')}</i>`;
377
+ t.style.left = m.dataset.miX + '%'; t.classList.toggle('r', +m.dataset.miX > 60); t.hidden = false;
378
+ };
379
+ const hov = typeof matchMedia === 'function' && matchMedia('(hover: hover)').matches;
380
+ for (const [ev, on] of [['mouseover', true], ['mouseout', false], ['focusin', true], ['focusout', false]]) {
381
+ body.addEventListener(ev, (e) => { const m = e.target.closest && e.target.closest('[data-mi-ms]'); if (m && body.contains(m) && (hov || ev.startsWith('focus'))) tip(m, on); });
382
+ }
285
383
  body.addEventListener('click', (e) => {
384
+ if (missionPress(e)) return;
286
385
  const H = body.__iv || {}, b = e.target.closest('button, a'); if (!b || !body.contains(b)) return;
287
386
  const root = b.closest('[data-iv]'); if (!root) return;
288
387
  const id = root.dataset.iv;
@@ -291,7 +390,7 @@ export function wireView(body, h) {
291
390
  if (VS.press(b, d, root, H)) return;
292
391
  if (G.press(b, d, root, H)) return;
293
392
  if (LK.press(b, d, root, { ...H, __dates: (x) => TV.press(x, { ivtBar: x.dataset.ivtBar }, root, H, e) })) return;
294
- if (TV.press(b, d, root, { ...H, __v: SHOWN.get(id) }, e)) return;
393
+ if (TV.press(b, d, root, { ...H, __v: SHOWN.get(id), __g: G.api(root, H) }, e)) return;
295
394
  if (d.ivFold) { e.preventDefault(); const k = id + '|' + d.ivFold; FOLD.set(k, b.getAttribute('aria-expanded') !== 'true'); if (H.redraw) H.redraw(); return; }
296
395
  if (d.ivCheck && H.check) { e.preventDefault(); H.check(d.ivCheck, b); return; }
297
396
  if (d.ivTask && H.openTask) { e.preventDefault(); H.openTask(d.ivTask, b); return; }
@@ -302,6 +401,7 @@ export function wireView(body, h) {
302
401
  if (d.sm && H.sm) { e.preventDefault(); H.sm(d.sm, b); return; }
303
402
  if (d.smOpen && H.openIni) { e.preventDefault(); H.openIni(d.smOpen, b); return; }
304
403
  if (d.ivPrimary && H.primary) { e.preventDefault(); H.primary(d.ivPrimary, b); return; }
404
+ if ('ivAsks' in d) { e.preventDefault(); if (H.asks) H.asks(b); else if (H.primary) { const p = root.querySelector('[data-iv-primary]'); if (p) H.primary(p.dataset.ivPrimary, p); } return; }
305
405
  if ('ivWf' in d && H.wf) { e.preventDefault(); H.wf(b); return; }
306
406
  if ('ivPerson' in d && H.person) { e.preventDefault(); H.person(b); return; }
307
407
  if ('ivStagepick' in d && H.stagePick) { e.preventDefault(); H.stagePick(b); return; }
@@ -331,6 +431,7 @@ function lineMove(b, d, id, H, e) {
331
431
  const fold = (k) => { LINE.set(id, LINE.get(id) === k ? '' : k); if (H.redraw) H.redraw(); };
332
432
  const inLine = !!b.closest('[data-iv-line]');
333
433
  if (d.ivStage != null) { e.preventDefault(); if (inLine && phone()) fold('list'); else showIn(b, id, H, d.ivStage, null); return true; }
434
+ 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
334
435
  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; }
335
436
  if (d.ivMsc != null) { e.preventDefault(); fold(phone() ? 'list' : 'ms:' + d.ivMsc); return true; }
336
437
  if (d.ivGap != null) { e.preventDefault(); fold(phone() ? 'list' : 'gap:' + d.ivGap); return true; }
@@ -354,11 +455,12 @@ function findRow(v, uid) {
354
455
  return null;
355
456
  }
356
457
  /** After the redraw: find the target in the view and bring it into sight, with a short highlight. */
357
- function later(b, pick) {
458
+ function later(b, pick, focus) {
358
459
  const body = b.closest('[data-iv]') && b.closest('[data-iv]').parentElement;
359
460
  const go = () => {
360
461
  const root = body && body.querySelector('[data-iv]'); if (!root) return;
361
462
  const el = pick(root); if (!el) return;
463
+ if (focus) { el.focus({ preventScroll: true }); return; } // the same press after a redraw keeps the focus, no highlight
362
464
  el.scrollIntoView({ block: 'center', behavior: 'smooth' });
363
465
  el.classList.add('iv-hit'); setTimeout(() => el.classList.remove('iv-hit'), 1600);
364
466
  };
@@ -368,8 +470,16 @@ function later(b, pick) {
368
470
  function showIn(b, id, H, key, uid) {
369
471
  // 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)
370
472
  if (key != null && !uid && G.onlyStage(id, key)) { if (H.redraw) H.redraw(); later(b, (root) => root.querySelector('.iv-th')); return; }
371
- if (key != null) { FOLD.set(id + '|sec:' + (key || 'none'), true); TV.setKanbanStage(id, key); }
372
- if (uid) { const v = SHOWN.get(id), f = v && findRow(v, uid); if (f && f.fold) FOLD.set(id + '|' + f.fold, true); }
473
+ if (key != null) {
474
+ FOLD.set(id + '|sec:' + (key || 'none'), true); TV.setKanbanStage(id, key);
475
+ // a stage with nothing open waits in the List's last fold: open it too
476
+ const v = SHOWN.get(id), sec = v && ((v.tasks && v.tasks.sections) || []).find((s) => (s.key || '') === key || (s.stages || []).some((c) => (c.key || '') === key));
477
+ if (sec && !openIn(sec)) FOLD.set(id + '|rest', true);
478
+ }
479
+ if (uid) {
480
+ const v = SHOWN.get(id), f = v && findRow(v, uid); if (f && f.fold) FOLD.set(id + '|' + f.fold, true);
481
+ if (f && !f.fold) FOLD.set(id + '|' + f.sec + ':more', true); // past the first 3
482
+ }
373
483
  if (H.redraw) H.redraw();
374
484
  const q = (v) => String(v).replace(/["\\]/g, '\\$&');
375
485
  later(b, (root) => {