create-pmos 0.613.0 → 0.615.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 (38) hide show
  1. package/package.json +27 -39
  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/changelog.json +26 -0
  7. package/workspace/guide/cli.md +2 -1
  8. package/workspace/guide/layout.md +24 -10
  9. package/workspace/guide/settings-and-switches.md +1 -0
  10. package/workspace/lib/events-place.js +46 -10
  11. package/workspace/lib/mention-cli.js +6 -3
  12. package/workspace/lib/mention-store.js +49 -10
  13. package/workspace/lib/routes-events-place.js +2 -1
  14. package/workspace/package-lock.json +2 -2
  15. package/workspace/package.json +1 -1
  16. package/workspace/public/pm/cozy-events-view.js +23 -4
  17. package/workspace/public/pm/cozy-events.js +8 -2
  18. package/workspace/public/pm/cozy-home-rows.css +55 -0
  19. package/workspace/public/pm/cozy-nav.js +15 -2
  20. package/workspace/public/pm/cozy-pop-work.css +3 -0
  21. package/workspace/public/pm/cozy-pop-work.js +5 -3
  22. package/workspace/public/pm/cozy-today-app.js +119 -12
  23. package/workspace/public/pm/cozy-today-model.js +278 -21
  24. package/workspace/public/pm/cozy-today-page.css +74 -15
  25. package/workspace/public/pm/cozy-today-view.js +89 -31
  26. package/workspace/public/pm/home-app.js +14 -6
  27. package/workspace/public/pm/home-data.js +1 -1
  28. package/workspace/public/pm/home-ini.js +17 -1
  29. package/workspace/public/pm/home-mentions.js +121 -6
  30. package/workspace/public/pm/ini-edit.js +2 -0
  31. package/workspace/public/pm/ini-view.css +2 -0
  32. package/workspace/public/pm/mention-one-model.js +115 -0
  33. package/workspace/public/pm/pop-work-model.js +17 -11
  34. package/workspace/public/pm/scope-chip.js +5 -2
  35. package/workspace/run-tests.js +11 -4
  36. package/workspace/server.js +8 -0
  37. package/workspace/skills/morning-brief.skill +1 -1
  38. package/workspace/test-run.js +2 -0
@@ -5,9 +5,11 @@
5
5
  * One page, no views (one container rule): the title and the quiet count line sit on the panel; Today's log is one card with a thin
6
6
  * border; today's agenda is one grey box on the right.
7
7
  * The first line captures a task, an event or a note. Enter only adds the row: it opens no popup and starts no session.
8
- * A row: "!" when it comes first, its bullet (• task, ○ event, – note, × done, ✦ a PMOS suggestion), What, Work, Job, When, and on
8
+ * Round 2 (Wawan on his real data): the Overview on top (overviewHtml), the log in three groups (Do first with each reason, Today, and
9
+ * Can wait folded to one line), a Type column after What, and Reply for an ask from a person.
10
+ * A row: "!" when the PM marked it first, its bullet (• task, ○ event, – note, × done, ✦ a PMOS suggestion), What, Work, Job, When, and on
9
11
  * hover or focus three plain icons: done, move to tomorrow, set a date. A Lab finding has ✓ (keep: start an initiative) and ✕ (drop).
10
- * Carried too long, a ✦ line under the row: PMOS suggests to drop it, ✓ ✕.
12
+ * Waiting too long, a ✦ line under the row: PMOS suggests to drop it, ✓ ✕.
11
13
  * Press a row or an agenda event: the popup on its work (home-app.js).
12
14
  * Every icon-only button has an aria-label. The UI says PMOS. Text from records goes through esc(). */
13
15
 
@@ -15,7 +17,12 @@ export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) =>
15
17
  const svg = (d, w = 15, sw = 1.9) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
16
18
  export const I = {
17
19
  done: 'M5 12.5l4.5 4.5L19 7.5', tomorrow: 'M5 12h14M13 6l6 6-6 6', date: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', plus: 'M12 6v12M6 12h12',
18
- yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', cal: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4',
20
+ yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', cal: 'M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4', more: 'M8 10l4 4 4-4',
21
+ };
22
+ /** The small sign of each type in the Type column (one stroke icon, the word beside it). */
23
+ const TI = {
24
+ Ask: 'M5 5h14v10H9l-4 4z', Decision: 'M12 4l8 8-8 8-8-8z', Check: 'M5 12.5l4.5 4.5L19 7.5', Milestone: 'M6 20V4M6 5h11l-2.5 3.5L17 12H6',
25
+ Task: 'M5 5h14v14H5z', Report: 'M7 3.5h7l4 4V20.5H7zM14 3.5v4h4M10 12h5M10 16h5', Note: 'M6 12h12',
19
26
  };
20
27
  const BULLET = { task: ['•', 'Task'], event: ['○', 'Event'], note: ['–', 'Note'], lab: ['✦', 'PMOS suggests'] };
21
28
  const ib = (act, label, d, key, extra = '') => `<button type="button" class="td-ib" data-td="${act}" data-key="${esc(key)}" aria-label="${esc(label)}" title="${esc(label)}"${extra}>${svg(d)}</button>`;
@@ -23,54 +30,105 @@ const ib = (act, label, d, key, extra = '') => `<button type="button" class="td-
23
30
  /** One row of the log. */
24
31
  export function rowHtml(r) {
25
32
  const [b, bl] = r.done ? ['×', 'Done'] : BULLET[r.bullet] || BULLET.task;
26
- const acts = r.done ? '' : r.src === 'lab'
33
+ const acts = r.done || r.src === 'note' ? '' : r.src === 'lab'
27
34
  ? ib('lab-keep', 'Keep it: start an initiative from ' + r.title, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + r.title, I.no, r.key)
28
35
  : ib('done', 'Done: ' + r.title, I.done, r.key) + ib('tomorrow', 'Move to tomorrow: ' + r.title, I.tomorrow, r.key) + ib('date', 'Set a date: ' + r.title, I.date, r.key, ' aria-haspopup="dialog"');
29
- const cls = ['td-r', r.done ? 'done' : '', r.bullet === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : ''].filter(Boolean).join(' ');
36
+ const cls = ['td-r', r.done ? 'done' : '', r.bullet === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.reason ? 'why' : ''].filter(Boolean).join(' ');
30
37
  // a note, an own event and a done row open nothing: their words are the whole of it
31
- const opens = !r.done && r.src !== 'own' && r.src !== 'gone';
38
+ const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
32
39
  const title = opens ? `<button type="button" class="td-t" data-td="open" data-key="${esc(r.key)}">${esc(r.title)}</button>` : `<span class="td-t">${esc(r.title)}</span>`;
33
- const sug = r.drop ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>Carried ${esc(r.carried)} days. PMOS suggests: drop it from your log.</span>`
40
+ const sug = r.drop ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>PMOS suggests: drop it from your log.</span>`
34
41
  + ib('drop', 'Drop it', I.yes, r.key) + ib('keep', 'Keep it', I.no, r.key) + '</div>' : '';
42
+ const lk = r.looks && !r.done ? `<div class="td-sg" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>Looks answered: ${esc(r.looks.who ? r.looks.who + ' replied' : 'someone replied')} “${esc(r.looks.text)}”. Close it?</span>`
43
+ + ib('lk-yes', 'Yes, close it: it is answered', I.yes, r.key) + ib('lk-no', 'No, it still waits on me', I.no, r.key) + '</div>' : '';
35
44
  const why = r.src === 'lab' && r.why ? `<div class="td-sg lab"><span>${esc(r.why)}</span></div>` : '';
36
- return `<div class="${cls}" data-key="${esc(r.key)}" role="row"><span class="td-p" role="cell">${r.first && !r.done ? '<b aria-label="First">!</b>' : ''}</span>`
37
- + `<span class="td-b" role="cell"><i role="img" aria-label="${esc(bl)}">${b}</i></span><span role="cell" class="td-wt">${title}</span>`
45
+ // what PMOS did on it, from records (round 3 point 13): a small ✦ with the count; its words on hover and for a screen reader
46
+ const did = r.did && r.did.length && !r.done ? `<span class="td-did" title="${esc('PMOS did: ' + r.did.join('; '))}" aria-label="${esc('PMOS did: ' + r.did.join('; '))}"><b aria-hidden="true">✦</b>${r.did.length}</span>` : '';
47
+ const reason = r.reason || did ? `<small class="td-rs">${did}${esc(r.reason || '')}</small>` : '';
48
+ const type = r.type ? `<span class="td-ty" role="cell">${svg(TI[r.type] || TI.Task, 13, 1.8)}<span>${esc(r.type)}</span></span>` : '<span class="td-ty" role="cell"></span>';
49
+ return `<div class="${cls}" data-key="${esc(r.key)}" role="row"><span class="td-p" role="cell">${r.first && !r.done && r.src === 'own' ? '<b aria-label="First">!</b>' : ''}</span>`
50
+ + `<span class="td-b" role="cell"><i role="img" aria-label="${esc(bl)}">${b}</i></span><span role="cell" class="td-wt">${title}${reason}</span>${type}`
38
51
  + `<span class="td-w" role="cell">${esc(r.work)}</span><span class="td-k" role="cell">${esc(r.job)}</span>`
39
- + `<span class="td-d${r.late && !r.done ? ' late' : ''}" role="cell">${esc(r.when)}</span><span class="td-a" role="cell">${acts}</span>${sug}${why}</div>`;
52
+ + `<span class="td-d${r.late && !r.done ? ' late' : ''}" role="cell">${esc(r.when)}</span><span class="td-a" role="cell">${acts}</span>${sug}${lk}${why}</div>`;
53
+ }
54
+
55
+ /** The Overview, one grey box under the head, written by PMOS (✦): where to start and why, the free time, the suggestions with ✓ ✕,
56
+ * and the type chips (with their counts) that filter the log. O: overviewModel(). o.type: the chip that filters now. */
57
+ export function overviewHtml(O, o = {}) {
58
+ if (!O || (!O.said && !O.chips.length)) return '';
59
+ const sug = O.suggest.map((x) => `<div class="td-ovs" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span>${esc(x.text)}</span>`
60
+ + ib('ov-yes', x.text, I.yes, x.key) + ib('ov-no', 'Keep them: ' + x.text, I.no, x.key) + '</div>').join('');
61
+ const total = O.chips.reduce((n, c) => n + c.n, 0);
62
+ const chip = (t, label, n) => `<button type="button" class="td-chip${(o.type || '') === t ? ' on' : ''}" data-td="type" data-key="${esc(t)}" aria-pressed="${(o.type || '') === t}">${esc(label)} <b>${esc(n)}</b></button>`;
63
+ const chips = O.chips.length > 1 ? `<div class="td-chips" role="group" aria-label="Show one type">${chip('', 'All', total)}${O.chips.map((c) => chip(c.type, PLURAL[c.type] || c.type, c.n)).join('')}</div>` : '';
64
+ return `<section class="td-ov" aria-label="Overview"><h2><b aria-hidden="true">✦</b> Overview</h2>${O.said ? `<p>${esc(O.said)}</p>` : ''}${sug}${chips}</section>`;
40
65
  }
66
+ const PLURAL = { Ask: 'Asks', Decision: 'Decisions', Check: 'Checks', Milestone: 'Milestones', Task: 'Tasks', Report: 'Reports', Note: 'Notes' };
41
67
 
42
- /** Today's log: the title and its count line, the capture line, the one card. L: logModel(). o: { news: N new for you, draft: the line being typed } */
68
+ const HEAD_ROW = '<div class="td-r td-hd" role="row"><span role="columnheader"></span><span role="columnheader"><span class="td-vh">Bullet</span></span><span role="columnheader">What</span><span role="columnheader">Type</span><span role="columnheader" class="td-wh">Work</span><span role="columnheader">Job</span><span role="columnheader">When</span><span role="columnheader"><span class="td-vh">Actions</span></span></div>';
69
+ const groupRow = (label, n) => `<div class="td-gr" role="row"><span role="cell">${esc(label)}${n ? ` <em>${esc(n)}</em>` : ''}</span></div>`;
70
+
71
+ /** Today's log: the title with its count at the left and the jobs at the right, the capture line, the one card in three groups:
72
+ * Do first (each line with its reason), Today, and Can wait folded to one line. L: logModel().
73
+ * o: { draft: the line being typed, type: the chip that filters, open: Can wait is unfolded } */
43
74
  export function logHtml(L, o = {}) {
44
- const head = `<div class="td-h"><h2>Today’s log</h2>${L.line ? `<span class="td-sum">${esc(L.line)}</span>` : ''}</div>`;
75
+ const head = `<div class="td-h"><h2>Today’s log${L.open ? ' · ' + esc(L.open) : ''}</h2>${L.line ? `<span class="td-sum">${esc(L.line)}</span>` : ''}</div>`;
45
76
  const cap = `<form class="td-in" id="tdCapF" autocomplete="off"><label class="td-in-l" for="tdCap">${svg(I.plus, 16)}<span class="td-vh">Log a task, an event or a note</span></label>`
46
77
  + `<input id="tdCap" name="line" type="text" maxlength="240" placeholder="Log a task, an event or a note" value="${esc(o.draft || '')}" aria-describedby="tdCapKey" />`
47
78
  + `<span class="td-key" id="tdCapKey" aria-label="Start with o for an event, a dash for a note, ! for first">•<em>task</em>o<em>event</em>–<em>note</em>!<em>first</em></span></form>`;
48
- const rows = L.rows.length ? L.rows.map(rowHtml).join('') : '';
49
- const table = rows ? `<div class="td-tt" role="table" aria-label="Today’s log"><div class="td-r td-hd" role="row"><span role="columnheader"></span><span role="columnheader"><span class="td-vh">Bullet</span></span><span role="columnheader">What</span><span role="columnheader">Work</span><span role="columnheader">Job</span><span role="columnheader">When</span><span role="columnheader"><span class="td-vh">Actions</span></span></div>${rows}</div>`
50
- : '<p class="td-none">Nothing waits on you today.</p>';
51
- const news = o.news > 0 ? `<button type="button" class="td-more" data-td="news">${esc(o.news)} new for you</button>` : '';
52
- return `<section class="td-log" aria-label="Today’s log">${head}${cap}${table}${news}</section>`;
79
+ const pick = (rows) => (o.type ? (rows || []).filter((r) => r.type === o.type) : rows || []);
80
+ const first = pick(L.first), today = pick(L.todayRows), wait = pick(L.wait);
81
+ let body = '';
82
+ if (first.length) body += groupRow('Do first') + first.map(rowHtml).join('');
83
+ if (today.length) body += groupRow('Today') + today.map(rowHtml).join('');
84
+ if (wait.length) {
85
+ const oldest = Math.max(0, ...wait.map((r) => r.carried || 0));
86
+ const said = (first.length || today.length ? wait.length + ' more' : plural2(wait.length)) + (oldest ? ' · the oldest waits ' + oldest + (oldest === 1 ? ' day' : ' days') : '');
87
+ body += `<div class="td-gr" role="row"><span role="cell"><button type="button" class="td-fold" data-td="fold" aria-expanded="${!!o.open}">Can wait <em>${esc(said)}</em>${svg(I.more, 14)}</button></span></div>`;
88
+ if (o.open) body += wait.map(rowHtml).join('');
89
+ }
90
+ // PMOS handled · N: what the self check cleared today, folded last, Undo on each (design check of round 3, point 6)
91
+ const hd = o.handled || [];
92
+ if (hd.length) {
93
+ body += `<div class="td-gr" role="row"><span role="cell"><button type="button" class="td-fold" data-td="hfold" aria-expanded="${!!o.hopen}">PMOS handled <em>${esc(hd.length)}</em>${svg(I.more, 14)}</button></span></div>`;
94
+ if (o.hopen) body += hd.map((h) => `<div class="td-r done hd" data-key="hd:${esc(h.id)}" role="row"><span class="td-p" role="cell"></span><span class="td-b" role="cell"><i role="img" aria-label="Done">×</i></span>`
95
+ + `<span role="cell" class="td-wt"><span class="td-t">${esc(h.title)}</span><small class="td-rs">${esc(h.proof)}</small></span><span class="td-ty" role="cell">${svg(TI.Ask, 13, 1.8)}<span>Ask</span></span>`
96
+ + `<span class="td-w" role="cell"></span><span class="td-k" role="cell"></span><span class="td-d" role="cell"></span><span class="td-a" role="cell">`
97
+ + `<button type="button" class="td-undo" data-td="h-undo" data-key="${esc(h.id)}" aria-label="${esc('Undo: it still waits on me, ' + h.title)}">Undo</button></span></div>`).join('');
98
+ }
99
+ // no row in view names its work: the Work column goes, so What gets the room
100
+ const shown = first.concat(today, o.open ? wait : []), noWork = shown.length > 0 && shown.every((r) => !r.work);
101
+ const table = body ? `<div class="td-tt${noWork ? ' nowork' : ''}" role="table" aria-label="Today’s log">${HEAD_ROW}${body}</div>` : '<p class="td-none">Nothing waits on you today.</p>';
102
+ return `<section class="td-log" aria-label="Today’s log">${head}${cap}${table}</section>`;
53
103
  }
104
+ const plural2 = (n) => n + (n === 1 ? ' line' : ' lines');
54
105
 
55
- /** Today's agenda in one grey box: the hours, the meetings and the PM's own events, the line for now. A: agendaModel(). */
106
+ /** Today's agenda in one grey box: the day by hours (a line every hour, a label every two), the meetings, the reports that go out, the
107
+ * PM's own events and the focus time PMOS holds (dashed), and the red line for now. The grid shows on an empty day too. A: agendaModel().
108
+ * Places are a share of the day (--t, --h), so the column fills the box, as tall as the log. */
56
109
  export function agendaHtml(A) {
57
- const PX = 56;
110
+ const H = A.to - A.from, pc = (x) => (Math.round((x / H) * 10000) / 100) + '%';
58
111
  const hours = [];
59
- for (let h = A.from; h <= A.to; h += 2) hours.push(`<span class="td-hr" style="--y:${(h - A.from) * PX}px">${String(h).padStart(2, '0')}:00</span>`);
112
+ for (let h = A.from; h <= A.to; h += 2) hours.push(`<span class="td-hr" style="--t:${pc(h - A.from)}">${String(h).padStart(2, '0')}:00</span>`);
60
113
  const ev = A.items.map((x) => {
61
- const short = x.h * PX < 46; // a short slot says its time and title on one line
62
- const st = `--y:${Math.round(x.top * PX) + 1}px;--h:${Math.max(30, Math.round(x.h * PX) - 3)}px`;
63
- const cls = ['td-ev', x.kind, short ? 'short' : '', x.past ? 'past' : '', x.nowOn ? 'on' : ''].filter(Boolean).join(' ');
114
+ const short = x.h < 0.8; // a short slot says its time and title on one line
115
+ const st = `--t:${pc(x.top)};--h:${pc(x.h)};--c:${x.col || 0};--n:${x.cols || 1}`;
116
+ const cls = ['td-ev', x.kind, short ? 'short' : '', (x.cols || 1) > 1 ? 'side' : '', x.past ? 'past' : '', x.nowOn ? 'on' : ''].filter(Boolean).join(' ');
117
+ const mark = x.kind === 'report' ? '<i class="td-dk" aria-hidden="true"></i>' : x.kind === 'focus' || x.kind === 'meeting' ? '<i class="td-dm" aria-hidden="true"></i>' : '';
64
118
  const label = x.title + ', ' + x.sub;
65
- return x.kind === 'own' ? `<div class="${cls}" style="${st}" aria-label="${esc(label)}"><b>${esc(x.title)}</b><small>${esc(x.sub)}</small></div>`
66
- : `<button type="button" class="${cls}" style="${st}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}"><b>${esc(x.title)}</b><small>${esc(x.sub)}</small></button>`;
119
+ const inner = `<b>${mark}${esc(x.title)}</b><small>${esc(x.sub)}</small>`;
120
+ if (x.kind === 'own' || x.kind === 'report') return `<div class="${cls}" style="${st}" aria-label="${esc(label)}">${inner}</div>`;
121
+ if (x.kind === 'focus') return `<button type="button" class="${cls}" style="${st}" data-td="open" data-key="${esc(x.row)}" aria-label="${esc(label)}">${inner}</button>`;
122
+ return `<button type="button" class="${cls}" style="${st}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}">${inner}</button>`;
67
123
  }).join('');
68
- const nowLine = A.now != null ? `<i class="td-now" style="--y:${Math.round(A.now * PX)}px" aria-hidden="true"></i>` : '';
69
- const grid = A.empty ? '<p class="td-none">No meeting today.</p>'
70
- : `<div class="td-tl" style="--rows:${A.to - A.from};--px:${PX}px">${hours.join('')}${ev}${nowLine}</div>`;
124
+ const nowLine = A.now != null ? `<i class="td-now" style="--t:${pc(A.now)}" aria-hidden="true"></i>` : '';
71
125
  return `<aside class="td-ag" aria-label="Today’s agenda"><div class="td-agh"><h2>Today</h2><small>${esc(A.sub)}</small>`
72
- + `<button type="button" class="td-ib" data-td="cal" aria-label="Open the calendar" title="Open the calendar">${svg(I.cal, 16)}</button></div>${grid}</aside>`;
126
+ + `<a class="td-evl" href="/premium-events.html">Events</a></div>`
127
+ + `<div class="td-tl" style="--rows:${H}">${hours.join('')}${ev}${nowLine}</div></aside>`;
73
128
  }
74
129
 
75
- /** The whole page. */
76
- export function pageHtml(L, A, o = {}) { return `<div class="td">${logHtml(L, o)}${agendaHtml(A)}</div>`; }
130
+ /** The page head: the day and the time, small, then the greeting. Hd: headModel(). */
131
+ export const headHtml = (Hd) => `<header class="td-top"><span class="td-when">${esc(Hd.when)}</span><h1>${esc(Hd.hello)}</h1></header>`;
132
+
133
+ /** The whole page: the Overview and the log at the left, the agenda beside them. o.overview: overviewModel(). */
134
+ export function pageHtml(L, A, o = {}) { return `${o.head ? headHtml(o.head) : ''}<div class="td"><div class="td-main">${o.overview ? overviewHtml(o.overview, o) : ''}${logHtml(L, o)}</div>${agendaHtml(A)}</div>`; }
@@ -57,7 +57,7 @@ import * as MSG from './ms-suggest.js'; // Your move's ✓ on a program's mile
57
57
  import * as AD from './cozy-adler.js'; // Adler, Claude's face (batch 16 item 2)
58
58
  import * as OKL from './okr-list.js'; // the product page's Goals line (batch 16 item 6, GsProduct)
59
59
  import { canDictate, dictate } from './home-dictate.js';
60
- import { mountIni, iniList, iniOverview, iniPage, iniAddTask, iniFresh } from './home-ini.js'; // the initiative's page, its stage move, Tasks and Core documents (premium-uncovered-features, HbC)
60
+ import { mountIni, iniList, iniOverview, iniPage, iniAddTask, iniFresh, iniLight } from './home-ini.js'; // the initiative's page, its stage move, Tasks and Core documents (premium-uncovered-features, HbC)
61
61
  import * as MEN from './home-mentions.js';
62
62
  import * as LS from './load-shapes.js'; // the last view, the grey shapes and the held Viewer column while Home reads (page-open-speed) // @Mentions, the permanent row at the top of Home and its Viewer (Viewer kit, XvANew)
63
63
  import { mountRecRow, clockOf as recClock } from './home-rec-row.js';
@@ -368,7 +368,8 @@ function homeListHtml() {
368
368
  const M = L.homeList(S.D, { now: NOW(), filter: S.filter });
369
369
  S.M = M;
370
370
  // Adler's ears over the floating button (batch 17 item 4-B, AdP6): the place menu hears how many calls are the PM's
371
- { const n = (M.move || []).filter((r) => r.call).length; if (n !== S.calls) { S.calls = n; document.dispatchEvent(new CustomEvent('cz:calls', { detail: { count: n } })); } }
371
+ // on Today (a desk) the number is Today's own (pm/cozy-today-app.js: Do first and what waits today), so it is not sent here
372
+ if (!(TD_PAGE && !isPhone())) { const n = (M.move || []).filter((r) => r.call).length; if (n !== S.calls) { S.calls = n; document.dispatchEvent(new CustomEvent('cz:calls', { detail: { count: n } })); } }
372
373
  // the ✦ chip on "Not in an initiative" is gone (UI grill delete list): Claude's clean-up is a row in Your move (rankIn extra)
373
374
  const R = L.reviewModel(S.D, NOW());
374
375
  // a group is open until the PM folds it; another product starts folded; "Not in an initiative" starts folded on a phone (HvAC, HvACDesk)
@@ -429,8 +430,8 @@ function rankIn() {
429
430
  // the UI grill's delete list: Your impact's card and the ✦ chip on "Not in an initiative" are gone from Home; they land here instead
430
431
  const extra = [];
431
432
  if (S.impact && S.impact.c && !S.impact.c.looked) extra.push({ key: 'impact', go: 'impact', title: 'Your impact: ' + S.impact.c.label + ' is ready to check', sub: 'A thank-you and what really moved, from your records.' });
432
- const lp = LPV.chipOf(); if (lp) extra.push({ key: 'loose', go: 'loose', title: 'Not in an initiative: ' + lp.n + (lp.n === 1 ? ' row' : ' rows') + ' to tidy', sub: 'PMOS proposes where each one belongs.' });
433
- for (const l of S.lab || []) extra.push({ key: 'lab:' + l.ws, go: 'lab', ws: l.ws, board: l.board, title: 'Lab: ' + l.n + (l.n === 1 ? ' finding fits' : ' findings fit') + ' no initiative', sub: l.say || 'Keep one to start an initiative, or let it go.' });
433
+ const lp = LPV.chipOf(); if (lp) extra.push({ key: 'loose', go: 'loose', title: lp.n + (lp.n === 1 ? ' loose row' : ' loose rows') + ' to place in an initiative', sub: 'PMOS proposes where each one belongs.' });
434
+ for (const l of S.lab || []) extra.push({ key: 'lab:' + l.ws, go: 'lab', ws: l.ws, board: l.board, title: l.n + (l.n === 1 ? ' Lab finding' : ' Lab findings') + ' to keep or drop', sub: l.say || 'Keep one to start an initiative, or let it go.' });
434
435
  return { products, programs: S.D.programs || [], move: S.move || {}, mentions: MEN.mentionsOf(S.D).waiting, outbox: S.outbox || [], gaps: (S.wait && S.wait.gaps) || [], extra };
435
436
  }
436
437
  /** Each product's GET /api/your-move, read when Your day opens (never on Home's first draw: page speed). */
@@ -1497,6 +1498,7 @@ async function goIni(id, o = {}) {
1497
1498
  const was = S.ini;
1498
1499
  S.ini = id; S.sel = null; S.head = id === 'product' ? productKey() : null; S.doneOpen = false; S.stepsMore = false;
1499
1500
  if (was !== id) { S.IM = null; S.IMid = null; }
1501
+ iniLight(id, o.task || null); // a Today task row: the page opens at that task, lit (round 3 item 11b); any other open lights nothing
1500
1502
  if (isPhone()) sheet(false);
1501
1503
  drawList();
1502
1504
  // the address follows the page, so the entry before it (the trail's start, batch 14 item 7) keeps Home's own address
@@ -1814,7 +1816,7 @@ function openUpdateViewer(o = {}) {
1814
1816
  const it = (x) => x.key ? `<div class="czs-it"><span class="w">${esc(x.title)}<span>${esc([x.meta, x.text].filter(Boolean).join(' · '))}</span></span></div>` : `<button type="button" class="czs-it" data-hv-ini="${esc(x.id)}"><span class="w">${esc(x.title)}<span>${esc([x.meta, x.text].filter(Boolean).join(' · '))}</span>${x.flag ? `<span class="flag">${esc(x.flag)}</span>` : ''}</span></button>`;
1815
1817
  // "Before you send": Claude's risks the PM has not confirmed, with one press that confirms them all (each a ✓ Keep on its program's charter)
1816
1818
  const confirmAll = (L) => { const say = L.length === 1 ? 'Confirm this risk' : 'Confirm all ' + L.length + ' risks'; return `<p><button type="button" class="hv-chip" data-hv-confirm aria-label="${say}" title="${say}">${SVG(I.check, 15, 2.4)}</button></p>`; };
1817
- const secs = VW.czSections(U.sections.filter(([k, , L]) => L.length || k !== 'none').map(([k, h, L]) => ({ id: k, title: h, count: L.length, open: k !== 'ok' && L.length > 0, html: L.map(it).join('') + (k === 'confirm' && L.length ? confirmAll(L) : '') }))
1819
+ const secs = VW.czSections(U.sections.filter(([, , L]) => L.length).map(([k, h, L]) => ({ id: k, title: h, count: L.length, open: k !== 'ok' && L.length > 0, html: L.map(it).join('') + (k === 'confirm' && L.length ? confirmAll(L) : '') }))
1818
1820
  .concat([{ id: 'src', title: 'Sources', count: 'Jira, plan dates, confirmed risks · ' + H.hm(new Date(S.D.now).toISOString()), html: '<p>Drafted by Communicator from what PMOS read: the Jira tickets, the dates of the plan items and the risks you confirmed. An initiative nothing was read for is under Not read, never under On track.</p>' }]), { key: 'weekly' });
1819
1821
  const to = edit ? `<div class="hv-to"><span>To</span>${U.to.map((x, i) => `<button type="button" class="hv-chip" data-hv-rm="${i}" aria-label="Remove ${esc(x)}" title="Remove">${esc(x)}</button>`).join('')}<input id="hvTo" placeholder="${U.to.length ? 'Add' : 'Who gets it: a name, a mail or #channel'}" aria-label="Add a recipient"></div>` : '';
1820
1822
  const old = past ? `<div class="czs-secs"><div class="czs-body" style="padding-top:12px">${(U.sent || []).length ? U.sent.slice().reverse().map((x) => `<div class="czs-it"><span class="w">Week ${esc(x.week)}<span>${esc(new Date(x.at).toDateString())} · to ${esc((x.to || []).join(', '))}</span></span></div>`).join('') : '<p>No update was sent yet.</p>'}</div></div>` : '';
@@ -2398,7 +2400,11 @@ mountPanels({
2398
2400
  if (TD_PAGE) TDY = mountToday({ S, VW, POP, pmGet, pmPost, toast, toastUndo, isPhone, now: NOW,
2399
2401
  rank: () => { S.topRank = rankMove({ ...rankIn(), calls: YD.callsOf((S.M && S.M.move) || []), now: NOW() }); return S.topRank; },
2400
2402
  rows: () => new Map(allRows().map((r) => [r.id, r])), titleOf: (id) => (iniRowOf(id) ? iniTitle(id) : String(id || '').replace(/[-_]+/g, ' ').replace(/^./, (c) => c.toUpperCase())), hasIni: (id) => !!(id && iniRowOf(id)), boardWs, boardId,
2401
- goIni: (id) => goIni(id), select: (id) => select(id), movePress: (b) => movePress(b), openFinished, openReviewVw, openMeeting: (m) => openMeeting(m), openCalendar,
2403
+ goIni: (id, o) => goIni(id, o || {}), select: (id) => select(id),
2404
+ // a mention row opens that one mention (Today round 3), never the Mentions list
2405
+ openMention: (id, o) => { const L = MEN.mentionsOf(S.D), m = [...L.waiting, ...L.toread, ...L.answered].find((x) => x.id === id) || (o && o.m); if (!m) return false; MEN.openOneMention(m, menCtx(), o || {}); return true; },
2406
+ mentions: () => MEN.mentionsOf(S.D), mentionAct: (id, act) => pmPost('/api/mentions/act', { id, act }), reloadMentions: () => MEN.load(menCtx()).then(() => drawList()),
2407
+ movePress: (b) => movePress(b), openFinished, openReviewVw, openMeeting: (m) => openMeeting(m), openCalendar,
2402
2408
  openInbox: () => MORE.openInbox(searchGo, ''), reload: () => load(), review: () => L.reviewModel(S.D, NOW()), meetings: () => H.todayOf(S.D),
2403
2409
  news: () => (S.news && S.news.ok ? S.news.count || 0 : 0), chatNow: () => (chat.current ? chat.current() : null),
2404
2410
  openLab: (f) => import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: f.ws, board: f.board }), iniHref: (id) => '/premium-initiative.html?' + (f.ws ? 'ws=' + encodeURIComponent(f.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })) });
@@ -2436,6 +2442,8 @@ load().then(() => {
2436
2442
  if (open && !blockOpen) {
2437
2443
  // ?item=pt:<program>:<key> (the program panel's link to a program task) names the row by its id; Home lists no task, so the chat opens
2438
2444
  const r = allRows().find((x) => x.key === open || (/^pt:/.test(open) && x.id === open));
2445
+ // on Today the item opens in the one popup (design audit of slice 5); on Home, beside the list as before
2446
+ if (r && TD_PAGE && !isPhone()) VW.popNext({ keep: true, id: r.id, kind: 'item', title: r.name || r.title || '' });
2439
2447
  if (r) select(r.id); else if (KEY.test(open)) openTarget({ ...homeTarget(), key: open, title: open });
2440
2448
  }
2441
2449
  else if (sid) { const s = S.D.sessions.find((x) => x.id === sid); if (s) { S.sel = 's:' + s.id; openTarget(sessionTarget(s)); followViewer(s); drawList(); } else { openTarget(homeTarget()); toast('That session is not on this machine.'); } }
@@ -219,7 +219,7 @@ export function weeklyUpdate(D, now = Date.now()) {
219
219
  const t = trail[r.id], u = t && usual[String(r.stage || '').toLowerCase()];
220
220
  const days = t && t.days != null ? 'In ' + r.stage + ' for ' + plural(t.days, 'day', 'days') : 'In ' + (r.stage || 'no stage');
221
221
  const over = t && u && u.days != null && t.days > u.days ? ', ' + plural(t.days - u.days, 'day', 'days') + ' over its usual time' : '';
222
- const fin = r.finish ? '. Planned finish ' + r.finish : '';
222
+ const fin = r.finish ? (/^not planned$/i.test(String(r.finish).trim()) ? '. No planned finish' : '. Planned finish ' + r.finish) : '';
223
223
  const why = r.signal && r.signal.why ? '. ' + r.signal.why : '';
224
224
  return days + over + fin + why + '.';
225
225
  };
@@ -35,6 +35,7 @@ import { viewHtml, wireView } from './ini-view.js'; // the one initiative view
35
35
  import { ensureCss as ensureStepsCss } from './cozy-steps.js'; // stage card D: the card's last node and the move sheet's words // D99: the initiative's own workflow (Change picker, switch, Won't do, Archive)
36
36
  import * as DB from './dash-view.js'; // the ready-made Dashboard view (batch 17 item 1)
37
37
  import * as TL from './ini-tail.js';
38
+ import * as ED from './ini-edit.js'; // round 3 item 11b: a Today task row opens its initiative with that task's row open in place
38
39
  import * as PW from './cozy-pop-work.js'; // what the popup shows for work (slice 3 of the six-place navigation): in the popup, in place of the old page
39
40
  import * as PP from './ini-props.js'; // everything PMOS suggests, as a drill-in (the popup's ⋯) // under Linked, as the Board draws it (UI grill U1): drafted tickets, the PRD drift, Your impact
40
41
  import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
@@ -525,6 +526,21 @@ export function iniAddTask() {
525
526
  const KIND = { docs: 'Documents', stage: 'Stage' };
526
527
  const ICON = { docs: 'doc', stage: 'goal' };
527
528
  let BODY = null;
529
+ /* round 3 item 11b: a Today row that is a task opens its initiative at that task: the row lit, open in place (date, owner, status), in view */
530
+ let LIT = null; // { id, uid, seen }
531
+ /** The task the initiative's next draw lights. id: the initiative; uid: the task. */
532
+ export function iniLight(id, uid) {
533
+ LIT = id && uid ? { id, uid: String(uid), seen: false } : null;
534
+ if (id) PW.focus(id, LIT ? LIT.uid : '');
535
+ if (LIT) ED.openRow(id, LIT.uid);
536
+ }
537
+ function light(b, id) {
538
+ if (!LIT || LIT.id !== id || !b) return;
539
+ const sel = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(LIT.uid) : LIT.uid.replace(/["\\]/g, '');
540
+ const row = b.querySelector('[data-iv-r="' + sel + '"],[data-pw-row="' + sel + '"]'); if (!row) return;
541
+ row.classList.add('lit');
542
+ if (!LIT.seen) { LIT.seen = true; try { row.scrollIntoView({ block: 'center' }); } catch { /* an old browser: it stays where it is */ } }
543
+ }
528
544
  function segHtml(v) { return `<div class="cz-seg hi-seg" role="group" aria-label="Show">${Object.entries(KIND).map(([k, l]) => `<button type="button" data-hi-view="${k}" aria-pressed="${k === v}">${l}</button>`).join('')}</div>`; }
529
545
  function docRowHtml(d, cur, later, phases) {
530
546
  const draft = d.act && d.act.kind === 'draft' && !d.running && !d.path && d.st !== 'stale';
@@ -575,7 +591,7 @@ function draw(b) {
575
591
  const v = X.view;
576
592
  if (v !== 'page') b.__pg = null;
577
593
  if (v === 'page' && dashFor(id) && dashFor(id).shows()) { b.__pg = null; b.innerHTML = dashFor(id).html(() => ''); return; }
578
- if (v === 'page') { const h = PW.on(b) ? popHtml(id, M) : pageHtml(id, M); if (b.__pg !== h || !b.firstChild) { b.__pg = h; b.innerHTML = h; } return; }
594
+ if (v === 'page') { const h = PW.on(b) ? popHtml(id, M) : pageHtml(id, M); if (b.__pg !== h || !b.firstChild) { b.__pg = h; b.innerHTML = h; } light(b, id); return; }
579
595
  // Documents is shell A (XvADocs): no tabs, the summary card and folding groups straight in the body
580
596
  if (v === 'docs') { b.innerHTML = docsView(id, M) + '<p class="hi-small" role="status" id="ovMsg"></p>'; return; }
581
597
  // the phone keeps the Documents | Stage switch (PgTkList); in shell A on a desktop the other view sits under ⋯ (XvATasks)
@@ -27,6 +27,7 @@
27
27
  * copies the reply and opens the source, and the PM sends it there. Mentions owns every mention: New for you shows none. */
28
28
  import * as VW from './cozy-viewer.js';
29
29
  import { adler } from './cozy-adler.js';
30
+ import * as OM from './mention-one-model.js'; // one mention as Today opens it (Today round 3)
30
31
 
31
32
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
32
33
  const SRC = { slack: 'Slack', jira: 'Jira', confluence: 'Confluence', mail: 'email', gmail: 'Gmail', figma: 'Figma', doc: 'the document' };
@@ -82,7 +83,7 @@ export function mentionsOf(D) {
82
83
  const A = (k) => (m && Array.isArray(m[k]) ? m[k] : []);
83
84
  const toread = m && Array.isArray(m.toread) ? m.toread : A('recent').filter((x) => x.fyi), answered = m && Array.isArray(m.answered) ? m.answered : A('recent').filter((x) => !x.fyi);
84
85
  return { waiting: A('waiting'), toread, answered, gaps: A('gaps'), watching: A('watching'), landed: A('landed'), sources: A('sources'),
85
- as_of: (m && m.as_of) || null, failed: !!(m && m.failed), from: (m && m.from) || 0, loaded: !!m };
86
+ as_of: (m && m.as_of) || null, reads_at: (m && m.reads_at) || {}, failed: !!(m && m.failed), from: (m && m.from) || 0, loaded: !!m };
86
87
  }
87
88
  const allOf = (L) => [...L.waiting, ...L.toread, ...L.answered];
88
89
  /** A task made from a mention closes itself when the PM replies in the source (MnGrill). */
@@ -337,8 +338,11 @@ export function openMentions(ctx, o = {}) {
337
338
  // the desktop opens wide, so the list and the conversation sit side by side (MnA4); "Back to the side" keeps the one-column list
338
339
  if (!(typeof innerWidth === 'number' && innerWidth < 1280)) { VW.wide(true); if (LIST && LIST.body === body && canSplit(body) !== X.split) draw(body); }
339
340
  // the Viewer's width changes without a new open (the PM folds or unfolds Home's list, drags the divider): side by side follows it (batch 20 item 6)
341
+ // round 3 (Wawan: a task row drew the Mentions page under the initiative's title): the popup's body is shared, so a resize redraws the list
342
+ // only while the list is what the popup shows, and with this open's own state (a later open replaces the handler)
343
+ body.__mnFit = () => { const c = VW.current(); if (c && c.id === 'mentions' && body.isConnected && LIST && LIST.body === body && canSplit(body) !== X.split) draw(body); };
340
344
  if (typeof ResizeObserver === 'function' && !body.__mnRo) {
341
- body.__mnRo = new ResizeObserver(() => { if (body.isConnected && LIST && LIST.body === body && canSplit(body) !== X.split) draw(body); });
345
+ body.__mnRo = new ResizeObserver(() => { if (body.__mnFit) body.__mnFit(); });
342
346
  body.__mnRo.observe(body);
343
347
  }
344
348
  // one column: the asked conversation opens over the list, as a press on its row does
@@ -358,9 +362,10 @@ const SAID = {
358
362
  answered: (m) => 'Marked answered: ' + nameOf(m) + '’s ' + (isMail(m.source) ? 'email' : 'ask'),
359
363
  snooze: (m) => 'I’ll bring ' + nameOf(m) + '’s back at 09:00',
360
364
  notask: (m) => 'Not an ask: ' + nameOf(m) + '’s stops counting',
361
- keep: () => 'Kept waiting. I’ll ask again in 30 days.',
365
+ keep: () => 'Kept waiting. I won’t ask again unless the thread moves.',
362
366
  watch: (m) => 'I’ll watch for ' + ((m.offer && m.offer.what) || 'it') + ' and tell you when it lands',
363
367
  nowatch: () => 'I won’t watch for it',
368
+ reopen: (m) => nameOf(m) + '’s ask waits on you again',
364
369
  };
365
370
  async function act(ctx, m, kind, extra = {}) {
366
371
  const r = await ctx.pmPost('/api/mentions/act', { id: m.id, act: kind, ...extra });
@@ -423,8 +428,8 @@ async function makeTask(ctx, m) {
423
428
  });
424
429
  }
425
430
  /** Send: PMOS never posts. It copies the reply, opens the source, and the row says "Sent from Slack? I’ll see it at the next read." */
426
- async function sendReply(ctx, m) {
427
- const text = m.draft || '';
431
+ async function sendReply(ctx, m, filled) {
432
+ const text = filled || m.draft || '';
428
433
  let copied = false;
429
434
  try { if (text && navigator.clipboard) { await navigator.clipboard.writeText(text); copied = true; } } catch { copied = false; }
430
435
  const l = https(m.link); if (l) window.open(l, '_blank', 'noopener');
@@ -436,7 +441,7 @@ async function sendReply(ctx, m) {
436
441
  /** The messages, by day; the PM's on the right (the store marks them me: true). Only what the record holds: the thread when the read kept
437
442
  * it, else the conversation's latest words. */
438
443
  export function messagesHtml(m) {
439
- const th = Array.isArray(m.thread) && m.thread.length ? m.thread : [{ who: m.who, at: m.since || m.last, text: m.text || '' }];
444
+ const th = Array.isArray(m.thread) && m.thread.length ? m.thread : [{ who: fullNames(m), at: m.since || m.last, text: m.text || m.gist || '' }];
440
445
  const many = peopleOf(m).length > 1;
441
446
  let out = '', cur = '';
442
447
  for (const x of th) {
@@ -519,6 +524,116 @@ export function openOne(m, ctx, o = {}) {
519
524
  return out;
520
525
  }
521
526
 
527
+ /* ── one mention, as Today opens it (Today round 3: "I click a particular log but why it shows all the mentions") ──
528
+ * The popup holds this one mention and nothing else: who and where with the self check's line, PMOS did and Left for you, the ask said once
529
+ * with its source link, the reply (its blanks as fields), the four acts, the thread with a name and a time on each line, and the work it is
530
+ * about. No list of other mentions; a quiet "‹ All mentions (N)" opens the full page. o: { step(dir) → true when Today stepped }. */
531
+ function oneThreadHtml(m, now) {
532
+ const th = Array.isArray(m.thread) && m.thread.length ? m.thread : [{ who: fullNames(m), at: m.since || m.last, text: m.text || m.gist || '' }];
533
+ const TM = OM.threadModel(th, { keep: 5 });
534
+ const line = (x) => `<li class="mn1-m${x.me ? ' me' : ''}"><p class="mn1-mh"><b>${esc(x.me ? 'You' : x.who)}</b><time>${esc(OM.whenText(x.at || x.last, now))}</time>${x.n > 1 ? `<em aria-label="${x.n} times">×${x.n}</em>` : ''}</p><p>${esc(x.text)}</p></li>`;
535
+ const early = TM.earlier.length ? `<li class="mn1-early"><details><summary>${TM.earlier.length} earlier</summary><ul>${TM.earlier.map(line).join('')}</ul></details></li>` : '';
536
+ return `<section class="mn1-sec" aria-label="The messages"><h3>The messages</h3><ul class="mn1-thr">${early}${TM.shown.map(line).join('')}</ul></section>`;
537
+ }
538
+ const WRITE = new Set(); // the mentions whose empty reply field is open (no draft: the PM writes it here)
539
+ function oneReplyHtml(m) {
540
+ if (!m.waiting) return '';
541
+ if (m.drafted) return `<p class="mn-sent">${svg(P.send, 12, 2.2)}<span>Copied for ${esc(srcName(m.source))}. When you send it there, I see it at the next read.</span></p>`;
542
+ if (m.draft) {
543
+ const bl = OM.blanksOf(m.draft);
544
+ let i = 0;
545
+ const body = esc(m.draft).replace(/\[([^\[\]\n]{1,40})\]/g, (all, lab) => `<input class="mn1-blank" data-mn-blank="${i++}" placeholder="${lab}" aria-label="${lab}" size="${Math.max(6, Math.min(24, lab.length + 2))}">`);
546
+ return `<div class="mn1-reply"><p class="mn1-k">${svg(P.spark, 12, 2)}<span>${bl.length ? 'PMOS started your reply' : 'PMOS drafted your reply'}</span></p><p class="mn1-dt" data-mn-draft>${body}</p>`
547
+ + `<div class="mn1-ra">${ib(`data-mn="pen" data-id="${esc(m.id)}"`, 'Change it with PMOS', P.pen)}${ib(`data-mn="send" data-id="${esc(m.id)}"`, 'Copy it and open ' + srcName(m.source) + '. PMOS never posts.', P.send, true)}</div></div>`;
548
+ }
549
+ // no draft: one ✦ line says why, one icon opens an empty reply field (design check of round 3, point 5)
550
+ if (WRITE.has(m.id)) return `<div class="mn1-reply"><textarea class="mn1-free" data-mn-free rows="4" aria-label="Your reply to ${esc(OM_first(fullNames(m)))}" placeholder="Your reply"></textarea>`
551
+ + `<div class="mn1-ra">${ib(`data-mn="pen" data-id="${esc(m.id)}"`, 'Write it with PMOS', P.pen)}${ib(`data-mn="send" data-id="${esc(m.id)}"`, 'Copy it and open ' + srcName(m.source) + '. PMOS never posts.', P.send, true)}</div></div>`;
552
+ const why = ': ' + (m.nodraft ? String(m.nodraft).replace(/^[A-Z](?=[a-z])/, (c) => c.toLowerCase()) : 'nothing on record to answer from'); // always why, in a few words
553
+ return `<div class="mn1-nod">${svg(P.spark, 12, 2)}<p>PMOS can’t draft this one${esc(why)}</p>${ib(`data-mn="write" data-id="${esc(m.id)}"`, 'Write the reply', P.pen)}</div>`;
554
+ }
555
+ export function oneHtml(m, ctx, o = {}) {
556
+ const now = o.now || Date.now(), L = mentionsOf(ctx.D());
557
+ const ck = OM.checkOf(m, L, now), DL = OM.didLeft(m, { now });
558
+ const src = srcName(m.source), where = placeOf(m), n = L.waiting.length;
559
+ const all = `<button type="button" class="mn1-all" data-mn="all">‹ All mentions${n ? ' (' + n + ')' : ''}</button>`;
560
+ const head = `<div class="mn1-h">${face(m)}<div class="mn1-ht"><p class="mn1-who"><b>${esc(fullNames(m))}</b><span class="mn1-src">${esc(src === where || /^comment|^email/.test(where) ? where : src + ' · ' + where)}</span></p>`
561
+ + `<p class="mn1-sub"><span class="mn1-kind">${!m.waiting && !m.proof ? 'For your information' : 'Ask'}</span>${m.waiting && m.since ? `<span class="${late(m.since, now) ? 'late' : ''}">Asks you · ${esc(age(m.since, now))}</span>` : `<span>${esc(statusLine(m))}</span>`}`
562
+ + (ck.text ? `<span class="mn1-ck ${ck.state}">${esc(ck.text)}</span>` : '') + `</p></div>${all}</div>`;
563
+ const did = DL.did.length ? `<div class="mn1-did"><p class="mn1-k">${svg(P.spark, 12, 2)}<span>PMOS did</span></p><ul>${DL.did.map((t) => `<li>${esc(t)}</li>`).join('')}</ul></div>` : '';
564
+ const fyi = !m.waiting && !m.proof; // nothing to do: ✓ clears it (design check of round 3, point 2)
565
+ const left = `<div class="mn1-left"><p class="mn1-k"><span>Left for you</span></p><p class="mn1-lt">${esc(DL.left)}</p>`
566
+ + (fyi ? `<button type="button" class="hr-ckb mn1-clr" data-mn="fyi-ok" data-id="${esc(m.id)}" aria-label="Clear it: read" title="Clear it: read">${svg(P.tick, 15, 2.2)}</button>` : '') + '</div>';
567
+ // the ask said once: the title says it; PMOS's sentence of what they want shows only when it says more than the title
568
+ const g = OM.saysMore(m.gist, OM.askTitle(m)) ? m.gist : '';
569
+ const ask = `<section class="mn1-ask" aria-label="The ask">${g ? `<p class="mn1-aq">${esc(g)}</p>` : ''}${https(m.link) ? `<button type="button" class="mn1-go" data-mn="src" data-id="${esc(m.id)}">Open in ${esc(src)} ›</button>` : ''}</section>`;
570
+ const looks = m.looks && m.waiting ? `<div class="mn1-looks" role="group" aria-label="Looks answered">${svg(P.spark, 12, 2)}<p>Looks answered: ${esc(m.looks.who ? OM_first(m.looks.who) + ' replied' : 'someone replied')} “${esc(m.looks.text)}”${m.looks.on ? ' on ' + esc(OM.whenText(m.looks.on, now)) : ''}. Close it?</p>`
571
+ + `<button type="button" class="hr-ckb" data-mn="lk-yes" data-id="${esc(m.id)}" aria-label="Yes, it is answered" title="Yes, it is answered">${svg(P.tick, 15, 2.2)}</button>`
572
+ + `<button type="button" class="hr-ckb" data-mn="lk-no" data-id="${esc(m.id)}" aria-label="No, it still waits on me" title="No, it still waits on me">${svg(P.x, 15, 2.2)}</button></div>` : '';
573
+ const still = m.check && m.waiting ? checkHtml(m).replace('Did you answer this already?', 'Still needed?') : '';
574
+ const proof = !m.waiting && m.proof ? `<p class="mn1-proof">${svg(P.tick, 13, 2.2)}<span>${esc(OM.proofText(m.proof, now))}</span>${m.auto ? `<button type="button" class="mn1-undo" data-mn="reopen" data-id="${esc(m.id)}">It still waits on me</button>` : ''}</p>` : '';
575
+ const four = m.waiting ? `<div class="mn1-acts">${[['answered', 'Mark it answered', P.tick], ['snooze', 'Remind me at 09:00', P.clock], ['task', 'Make it a task', P.task], ['notask', 'Not for me', P.x]]
576
+ .map(([k, l, d]) => ib(`data-mn="${k}" data-id="${esc(m.id)}"`, l, d)).join('')}</div>` : '';
577
+ const about = m.initiative ? `<button type="button" class="mn1-about" data-mn="about" data-id="${esc(m.id)}">About: ${esc(ctx.iniTitle ? ctx.iniTitle(m.initiative) : m.initiative)} ›</button>` : '';
578
+ return `<div class="mn1">${head}<div class="mn1-box">${did}${left}</div>${proof}${looks}${still}${ask}${oneReplyHtml(m)}${four}${oneThreadHtml(m, now)}${about}</div>`;
579
+ }
580
+ const OM_first = (w) => String(w || '').trim().split(/\s+/)[0];
581
+ /** One mention in the popup (Today round 3). The title is the ask; ↑ ↓ (or k j) step to the previous or next Today row (o.step). */
582
+ export function openOneMention(m, ctx, o = {}) {
583
+ sheet();
584
+ const id = m.id;
585
+ const cur = () => allOf(mentionsOf(ctx.D())).find((x) => x.id === id) || m;
586
+ markRead(ctx, m);
587
+ let body = null;
588
+ const values = () => [...(body ? body.querySelectorAll('[data-mn-blank]') : [])].map((i) => i.value);
589
+ const draw = (b) => {
590
+ body = b; ONE = { id, body: b, draw };
591
+ const keep = values(), free = (b.querySelector && b.querySelector('[data-mn-free]') || {}).value || '';
592
+ b.innerHTML = oneHtml(cur(), ctx, o);
593
+ b.querySelectorAll('[data-mn-blank]').forEach((i, k) => { if (keep[k]) i.value = keep[k]; });
594
+ if (free) { const f = b.querySelector('[data-mn-free]'); if (f) f.value = free; }
595
+ b.onclick = async (e) => {
596
+ const t = e.target.closest('[data-mn]'); if (!t || !b.contains(t)) return;
597
+ const k = t.dataset.mn, x = cur();
598
+ if (k === 'all') { openMentions(ctx, { sel: id }); return; }
599
+ if (k === 'about') { if (x.initiative && ctx.goIni) { VW.drill(); ctx.goIni(x.initiative); } return; }
600
+ if (k === 'lk-yes') { await act(ctx, x, 'answered'); return; }
601
+ if (k === 'lk-no') { await act(ctx, x, 'keep'); return; }
602
+ if (k === 'reopen') { await act(ctx, x, 'reopen'); return; }
603
+ if (k === 'write') { WRITE.add(id); draw(b); const f = b.querySelector('[data-mn-free]'); if (f) f.focus(); return; }
604
+ if (k === 'fyi-ok') { markRead(ctx, x); VW.close(); ctx.toast('Cleared: ' + OM_first(fullNames(x)) + '’s message.'); if (ctx.redrawList) ctx.redrawList(); return; }
605
+ if (k === 'send' && !x.draft && WRITE.has(id)) {
606
+ const f = b.querySelector('[data-mn-free]'), v = f ? f.value.trim() : '';
607
+ if (!v) { ctx.toast('Write the reply first.'); if (f) f.focus(); return; }
608
+ await sendReply(ctx, x, v); WRITE.delete(id); return;
609
+ }
610
+ if (k === 'send' && OM.blanksOf(x.draft).length) {
611
+ const v = values();
612
+ if (v.some((s) => !String(s || '').trim())) { ctx.toast('Fill in ' + (v.filter((s) => !String(s || '').trim()).length === 1 ? 'the blank' : 'the blanks') + ' first.'); const f = [...b.querySelectorAll('[data-mn-blank]')].find((i) => !i.value.trim()); if (f) f.focus(); return; }
613
+ await sendReply(ctx, x, OM.fill(x.draft, v)); return;
614
+ }
615
+ await onAct(ctx, x, k);
616
+ };
617
+ b.onkeydown = (e) => {
618
+ if (!o.step || e.target.closest('input,textarea,[contenteditable]') || e.metaKey || e.ctrlKey || e.altKey) return;
619
+ const d = e.key === 'ArrowDown' || e.key === 'j' ? 1 : e.key === 'ArrowUp' || e.key === 'k' ? -1 : 0;
620
+ if (d && o.step(d)) { e.preventDefault(); e.stopPropagation(); }
621
+ };
622
+ };
623
+ const x = cur();
624
+ const out = VW.open({ id: 'mention:' + id, kind: 'Ask', title: OM.askTitle(x), icon: 'at', render: draw, back: !!o.back });
625
+ if (body) { body.tabIndex = -1; try { body.focus({ preventScroll: true }); } catch { /* a body that cannot take focus */ } }
626
+ // the self check runs fresh as it opens (round 3 point 10a): read again, and draw what the check says now
627
+ load(ctx).then(() => { const c = VW.current(); if (c && c.id === 'mention:' + id && body && body.isConnected) { draw(body); ctx.redrawList(); } });
628
+ const tick = async () => {
629
+ const c = VW.current(); if (!c || c.id !== 'mention:' + id || !body || !body.isConnected) return;
630
+ if (typeof document === 'undefined' || !document.hidden) { const was = JSON.stringify(cur()); await load(ctx); if (JSON.stringify(cur()) !== was && body.isConnected && VW.current() && VW.current().id === 'mention:' + id) draw(body); }
631
+ setTimeout(tick, 5000);
632
+ };
633
+ setTimeout(tick, 5000);
634
+ return out;
635
+ }
636
+
522
637
  /* ── the look: cozy-home-rows.css, loaded once ── */
523
638
  export function sheet() {
524
639
  if (typeof document === 'undefined' || document.getElementById('czHomeRowsCss')) return;
@@ -47,6 +47,8 @@ const STAGES = new Map(); // initiative id → [{ key, name }] the stages a ta
47
47
  const VIEW = new Map(); // initiative id → the view the List drew last (the drag reads its stages' tasks)
48
48
  export const openOf = (id) => OPEN.get(id) || '';
49
49
  export const addOf = (id) => (ADD.has(id) ? ADD.get(id) : null);
50
+ /** Open one task's row in place from outside the page (a Today row opens its initiative at that task, round 3 item 11b). */
51
+ export const openRow = (id, uid) => { if (id && uid) { OPEN.set(id, String(uid)); ADD.delete(id); } };
50
52
  /** For the tests: close every open row and field. */
51
53
  export const reset = () => { OPEN.clear(); ADD.clear(); ADD_D.clear(); STAGES.clear(); VIEW.clear(); };
52
54
  /** The stages of the view by stage (v0), in workflow order, then Not in a stage. Folded lines (past, Later) hold their stages inside.
@@ -1383,3 +1383,5 @@ button.ia-xr:hover { background: var(--cz-well); }
1383
1383
  .ik-tl .ab.risk { fill: var(--cz-risk); }
1384
1384
  .ik-tl .ab.late { fill: var(--cz-late); }
1385
1385
  .ik-tl .ab.done { fill: var(--cz-ink3); }
1386
+ /* round 3 item 11b: the task a Today row opened */
1387
+ .iv-tr.lit { background: var(--cz-bluebg); box-shadow: inset 3px 0 0 var(--cz-blue); }