create-pmos 0.644.0 → 0.646.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 (33) hide show
  1. package/package.json +27 -33
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/design-system/charts/README.md +2 -1
  4. package/payload/design-system/charts/components/Funnel/README.md +50 -0
  5. package/payload/design-system/charts/components/Funnel/preview.html +11 -0
  6. package/payload/design-system/charts/components/bundle.css +1 -0
  7. package/payload/design-system/charts/components/bundle.js +20 -1
  8. package/payload/design-system/charts/spec.md +2 -1
  9. package/payload/planning/evals/eval-calibration.md +1 -1
  10. package/payload/planning/okrs/health-budgets.md +1 -1
  11. package/payload/state/discoveries.md +1 -1
  12. package/workspace/changelog.json +26 -0
  13. package/workspace/design-system/charts/README.md +2 -1
  14. package/workspace/design-system/charts/components/Funnel/README.md +50 -0
  15. package/workspace/design-system/charts/components/Funnel/preview.html +11 -0
  16. package/workspace/design-system/charts/components/bundle.css +1 -0
  17. package/workspace/design-system/charts/components/bundle.js +20 -1
  18. package/workspace/design-system/charts/spec.md +2 -1
  19. package/workspace/guide/layout.md +15 -12
  20. package/workspace/package-lock.json +2 -2
  21. package/workspace/package.json +1 -1
  22. package/workspace/public/pm/charts.css +1 -0
  23. package/workspace/public/pm/cozy-today-app.js +10 -5
  24. package/workspace/public/pm/cozy-today-model.js +11 -5
  25. package/workspace/public/pm/cozy-today-page.css +50 -135
  26. package/workspace/public/pm/cozy-today-view.js +147 -98
  27. package/workspace/public/pm/cozy-vw-mtg.css +87 -74
  28. package/workspace/public/pm/cozy-vw-rp.css +52 -45
  29. package/workspace/public/pm/cozy-vw.css +83 -74
  30. package/workspace/public/pm/premium-vw-cal.css +21 -15
  31. package/workspace/public/pm/premium-vw-meet.css +11 -11
  32. package/workspace/public/pm/premium-vw-rec.css +11 -11
  33. package/workspace/public/pm/premium-vw-report.css +14 -14
@@ -1,146 +1,195 @@
1
- /* pm/cozy-today-view.js — Today, the markup (slice 5 of the six-place navigation; board 1 on Exploring 2; initiative today-log-page).
1
+ /* pm/cozy-today-view.js — Today, the markup (slice 5 of the six-place navigation; initiative today-log-page).
2
2
  * Pure: it turns pm/cozy-today-model.js into HTML, and Node imports it (today-log.test.js). home-app.js draws it into #tdPage on today.html
3
3
  * and handles every press (data-td="…").
4
4
  *
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
- * border; today's agenda is one grey box on the right.
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
- * 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
11
- * hover or focus three plain icons: done, move to tomorrow, set a date. A Lab finding has ✓ (keep: start an initiative) and ✕ (drop).
12
- * Waiting too long, a ✦ line under the row: PMOS suggests to drop it, ✓ ✕.
13
- * Press a row or an agenda event: the popup on its work (home-app.js). A meeting with a call that is not over has a play icon: one
14
- * press opens the call and starts the recording (meeting-buddy).
5
+ * On a desk the page is built only from PMOS design system parts (Komorebi, workspace/design-system/ui; agreed design "TodayDS" on the
6
+ * Exploring 3 canvas, page today, 2026-11-20). Layout Main + side:
7
+ * Main the head (the day, then the greeting); the Overview, a Summary block (pm-block): one sentence whose item names open the item, and
8
+ * PMOS's Suggestions (pm-sug, ✓ primary, ✕ outline); Today's log, a List block (pm-block list): its heading and one set of Tabs
9
+ * (pm-tabs: All, Reply, Do, Decide, Send with counts, a zero tab left out), the capture Input (pm-input), then the groups: Do first
10
+ * (the Now group, pm-group now, its first row lit), Today (pm-group), and Later folded (pm-fold "N can wait"), PMOS handled folded last.
11
+ * Row a ListRow (pm-li): the kind icon, the title, a why line ("for <work> · due <date>", or who waits), a late Badge (pm-badge alert),
12
+ * and on hover or focus icon Buttons: first by job (Done, Reply, Decide, Send), then Move to tomorrow and Set a date. A ✦ Suggestion
13
+ * under the row when PMOS proposes something on it (drop it, looks answered, draft them).
14
+ * Side a Timeline block (pm-block flat) with the day's events only: past ones dashed (pm-ev over), the rest raised, the now line in the
15
+ * alert colour, a link to Events; a meeting with a call has the play Button (join and record in one press, meeting-buddy). Below it,
16
+ * a Summary block for the meeting PMOS recorded and filed, with one Suggestion (keep it filed, or take it out).
15
17
  * Every icon-only button has an aria-label. The UI says PMOS. Text from records goes through esc(). */
16
18
 
17
19
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
18
20
  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>`;
21
+ /** The system's icon (pm-ic: stroke, size and caps come from the part). */
22
+ const ic = (d, w = 16, cls = '') => `<svg class="pm-ic${cls ? ' ' + cls : ''}" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
19
23
  export const I = {
20
24
  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',
21
25
  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', play: 'M8 5v14l11-7z',
26
+ reply: 'M5 5h14v10H9l-4 4z', decide: 'M12 4l8 8-8 8-8-8z', send: 'M4 12l16-8-6 16-3-7z',
27
+ spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z',
28
+ sun: 'M12 3v2M12 19v2M5 5l1.4 1.4M17.6 17.6L19 19M3 12h2M19 12h2M5 19l1.4-1.4M17.6 6.4L19 5M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8z',
22
29
  };
23
- /** The small sign of each type in the Type column (one stroke icon, the word beside it). */
30
+ /** The small sign of each type (one stroke icon). */
24
31
  const TI = {
25
32
  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',
26
33
  Task: 'M5 5h14v14H5z', Report: 'M7 3.5h7l4 4V20.5H7zM14 3.5v4h4M10 12h5M10 16h5', Note: 'M6 12h12',
27
34
  };
35
+ /** The kind icon of a row on a desk: its type, or what the PM typed (an event, a note), a PMOS finding, or done. */
36
+ const KIND = { event: ['M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16z', 'Event'], note: [TI.Note, 'Note'], lab: [I.spark, 'PMOS suggests'], done: [I.done, 'Done'] };
37
+ const kindOf = (r) => (r.done ? KIND.done : r.src === 'lab' ? KIND.lab : r.bullet === 'event' ? KIND.event : r.bullet === 'note' || r.src === 'note' ? KIND.note : [TI[r.type] || TI.Task, r.type || 'Task']);
28
38
  const BULLET = { task: ['•', 'Task'], event: ['○', 'Event'], note: ['–', 'Note'], lab: ['✦', 'PMOS suggests'] };
29
- const ib = (act, label, d, key, extra = '', v = '') => `<button type="button" class="td-ib pm-btn${v ? ' ' + v : ''}" data-td="${act}" data-key="${esc(key)}" aria-label="${esc(label)}" title="${esc(label)}"${extra}>${svg(d)}</button>`;
39
+ const ib = (act, label, d, key, extra = '', v = '') => `<button type="button" class="td-ib pm-btn${v ? ' ' + v : ''}" data-td="${act}" data-key="${esc(key)}" aria-label="${esc(label)}" title="${esc(label)}"${extra}>${ic(d)}</button>`;
40
+ const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
41
+ /** A Suggestion (pm-sug): ✦, one sentence, ✓ primary and ✕ outline. */
42
+ const sugHtml = (say, yes, no, key, cls = '') => `<div class="td-sg pm-sug${cls ? ' ' + cls : ''}" role="group" aria-label="PMOS suggests">${ic(I.spark, 16, 'pm-star')}<span class="say">${esc(say)}</span>`
43
+ + ib(yes[0], yes[1], I.yes, key, '', 'primary') + ib(no[0], no[1], I.no, key, '', 'outline') + '</div>';
30
44
 
31
- /** One row of the log. */
45
+ /** The late Badge of a row: how long it is late, or how long a person waits; '' when it is not late. */
46
+ export function lateOf(r) {
47
+ if (!r || !r.late || r.done || !(r.carried > 0)) return '';
48
+ return r.type === 'Ask' || (r.src !== 'move' && r.src !== 'item' && !/ late$/.test(r.reason || '')) ? plural(r.carried, 'day', 'days') : plural(r.carried, 'day', 'days') + ' late';
49
+ }
50
+ /** The why line under a title: "for <work> · due <date>", or who waits; what the Badge says is not said again. */
51
+ export function whyLine(r) {
52
+ const badge = lateOf(r);
53
+ let reason = r.reason || '';
54
+ if (badge && /^\d+ days? late$/.test(reason)) reason = '';
55
+ if (badge && r.type === 'Ask') reason = reason.replace(/ \d+ days?$/, '');
56
+ const when = r.when ? (r.late && !r.done && /^\d+ [A-Z][a-z]{2}/.test(r.when) ? 'due ' + r.when : r.when) : '';
57
+ return [r.work ? 'for ' + r.work : '', when, reason].filter(Boolean).join(' · ');
58
+ }
59
+ /** The first action of a row, by its job: Done for a thing to do, else the item opens where the PM replies, decides or sends. */
60
+ const JOB_ACT = { Reply: ['open', 'Reply', I.reply], Decide: ['open', 'Decide', I.decide], Send: ['open', 'Send', I.send] };
61
+
62
+ /** One row of the log: a ListRow (pm-li). o.lit: the lit first row of Do first; o.sopen: its members are listed. */
32
63
  export function rowHtml(r, o = {}) {
33
- const [b, bl] = r.done ? ['×', 'Done'] : BULLET[r.bullet] || BULLET.task;
34
- const acts = r.done || r.src === 'note' ? '' : r.src === 'lab'
35
- ? 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)
36
- : 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"');
37
- const cls = ['td-r', r.done ? 'done' : '', r.bullet === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.reason ? 'why' : '', r.member ? 'mem' : ''].filter(Boolean).join(' ');
64
+ const [kd, kl] = kindOf(r);
65
+ const t = r.title;
66
+ let acts = '';
67
+ if (!r.done && r.src !== 'note') {
68
+ if (r.src === 'lab') acts = ib('lab-keep', 'Keep it: start an initiative from ' + t, I.yes, r.key) + ib('lab-drop', 'Drop it: ' + t, I.no, r.key);
69
+ else {
70
+ const j = JOB_ACT[r.job];
71
+ acts = (j ? ib(j[0], j[1] + ': ' + t, j[2], r.key) : '') + ib('done', 'Done: ' + t, I.done, r.key)
72
+ + ib('tomorrow', 'Move to tomorrow: ' + t, I.tomorrow, r.key) + ib('date', 'Set a date: ' + t, I.date, r.key, ' aria-haspopup="dialog"');
73
+ }
74
+ }
75
+ const cls = ['td-li', 'pm-li', o.lit && !r.done ? 'now' : '', r.done ? 'done' : '', r.bullet === 'note' || r.src === 'note' ? 'note' : '', r.src === 'lab' ? 'lab' : '', r.member ? 'mem nest' : ''].filter(Boolean).join(' ');
38
76
  // a note, an own event and a done row open nothing: their words are the whole of it
39
77
  const opens = !r.done && r.src !== 'own' && r.src !== 'gone' && r.src !== 'note';
40
- const title = opens ? `<button type="button" class="td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(r.title)}${r.members ? svg(I.more, 13) : ''}</button>` : `<span class="td-t">${esc(r.title)}</span>`;
41
- const sug = r.drop ? `<div class="td-sg pm-sug" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span class="say">PMOS suggests: drop it from your log.</span>`
42
- + ib('drop', 'Drop it', I.yes, r.key, '', 'primary') + ib('keep', 'Keep it', I.no, r.key, '', 'outline') + '</div>' : '';
43
- const lk = r.looks && !r.done ? `<div class="td-sg pm-sug" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span class="say">Looks answered: ${esc(r.looks.who ? r.looks.who + ' replied' : 'someone replied')} “${esc(r.looks.text)}”. Close it?</span>`
44
- + ib('lk-yes', 'Yes, close it: it is answered', I.yes, r.key, '', 'primary') + ib('lk-no', 'No, it still waits on me', I.no, r.key, '', 'outline') + '</div>' : '';
45
- // the same step for N initiatives: PMOS drafts them, he approves once (audit round 2)
46
- const sj = r.members && r.drafts && !r.done ? `<div class="td-sg pm-sug" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span class="say">PMOS drafts them for you to read.</span>`
47
- + ib('same-yes', 'Yes, draft them', I.yes, r.key, '', 'primary') + ib('same-no', 'No, not now', I.no, r.key, '', 'outline') + '</div>' : '';
48
- const why = r.src === 'lab' && r.why ? `<div class="td-sg lab"><span>${esc(r.why)}</span></div>` : '';
78
+ const title = opens ? `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(t)}${r.members ? ic(I.more, 14) : ''}</button>` : `<span class="t td-t">${esc(t)}</span>`;
79
+ const first = r.first && !r.done && r.src === 'own' ? '<span class="pm-badge blue">First</span>' : '';
49
80
  // 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
50
81
  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>` : '';
51
- const reason = r.reason || did ? `<small class="td-rs">${did}${esc(r.reason || '')}</small>` : '';
52
- 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>';
53
- 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>`
54
- + `<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}`
55
- + `<span class="td-w" role="cell">${esc(r.work)}</span><span class="td-k" role="cell">${esc(r.job)}</span>`
56
- + `<span class="td-d${r.late && !r.done ? ' late' : ''}" role="cell">${esc(r.when)}</span><span class="td-a" role="cell">${acts}</span>${sug}${sj}${lk}${why}</div>`;
82
+ const why = r.member ? '' : whyLine(r);
83
+ const w = why || did ? `<span class="w td-rs">${did}${esc(why)}</span>` : '';
84
+ const late = lateOf(r);
85
+ const row = `<div class="${cls}" data-key="${esc(r.key)}"><span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${w}</span>`
86
+ + `${first}${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}${acts ? `<span class="acts td-a">${acts}</span>` : ''}</div>`;
87
+ const sug = r.drop ? sugHtml('PMOS suggests: drop it from your log.', ['drop', 'Drop it'], ['keep', 'Keep it'], r.key) : '';
88
+ const lk = r.looks && !r.done ? sugHtml('Looks answered: ' + (r.looks.who ? r.looks.who + ' replied' : 'someone replied') + ' “' + r.looks.text + '”. Close it?', ['lk-yes', 'Yes, close it: it is answered'], ['lk-no', 'No, it still waits on me'], r.key) : '';
89
+ // the same step for N initiatives: PMOS drafts them, he approves once (audit round 2)
90
+ const sj = r.members && r.drafts && !r.done ? sugHtml('PMOS drafts them for you to read.', ['same-yes', 'Yes, draft them'], ['same-no', 'No, not now'], r.key) : '';
91
+ const lab = r.src === 'lab' && r.why ? `<p class="td-sg lab pm-meta">${esc(r.why)}</p>` : '';
92
+ return row + sug + sj + lk + lab;
57
93
  }
58
94
 
59
- /** The Overview, one grey box under the head, written by PMOS (✦): where to start and why, the free time, the suggestions with ✓ ✕,
60
- * and the type chips (with their counts) that filter the log. O: overviewModel(). o.type: the chip that filters now. */
61
- export function overviewHtml(O, o = {}) {
62
- if (!O || (!O.said && !O.chips.length)) return '';
63
- const sug = O.suggest.map((x) => `<div class="td-ovs pm-sug" role="group" aria-label="PMOS suggests"><b aria-hidden="true">✦</b><span class="say">${esc(x.text)}</span>`
64
- + ib('ov-yes', x.text, I.yes, x.key, '', 'primary') + ib('ov-no', 'Keep them: ' + x.text, I.no, x.key, '', 'outline') + '</div>').join('');
65
- const total = O.chips.reduce((n, c) => n + c.n, 0);
66
- const chip = (t, label, n) => `<button type="button" class="td-chip pm-tab${(o.type || '') === t ? ' on' : ''}" data-td="type" data-key="${esc(t)}" aria-pressed="${(o.type || '') === t}">${esc(label)} <b>${esc(n)}</b></button>`;
67
- const chips = O.chips.length > 1 ? `<div class="td-chips pm-tabs" 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>` : '';
68
- return `<section class="td-ov pm-block" aria-label="Overview"><h2 class="pm-h-sm pm-row"><b aria-hidden="true">✦</b> Overview</h2>${O.said ? `<p>${esc(O.said)}</p>` : ''}${sug}${chips}</section>`;
95
+ /** The Overview, a Summary block written by PMOS (✦): one sentence whose item names open the item, then PMOS's Suggestions.
96
+ * O: overviewModel(). */
97
+ export function overviewHtml(O) {
98
+ if (!O || (!O.said && !(O.suggest || []).length)) return '';
99
+ let said = esc(O.said || '');
100
+ for (const x of O.refs || []) {
101
+ const t = esc(x.text), at = said.indexOf(t);
102
+ if (at >= 0) said = said.slice(0, at) + `<button type="button" class="td-ln" data-td="open" data-key="${esc(x.key)}">${t}</button>` + said.slice(at + t.length);
103
+ }
104
+ const sug = (O.suggest || []).map((x) => sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep them: ' + x.text], x.key, 'td-ovs')).join('');
105
+ return `<section class="td-ov pm-block" aria-label="Overview"><h2 class="pm-h-sm pm-row">${ic(I.spark, 16, 'pm-star')}Overview</h2>${said ? `<p>${said}</p>` : ''}${sug}</section>`;
69
106
  }
70
- const PLURAL = { Ask: 'Asks', Decision: 'Decisions', Check: 'Checks', Milestone: 'Milestones', Task: 'Tasks', Report: 'Reports', Note: 'Notes' };
71
-
72
- 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>';
73
- const groupRow = (label, n, now) => `<div class="td-gr pm-group${now ? ' now' : ''}" role="row"><span role="cell">${esc(label)}${n ? ` <em>${esc(n)}</em>` : ''}</span></div>`;
107
+ const PLURAL = { Ask: 'Asks', Decision: 'Decisions', Check: 'Checks', Milestone: 'Milestones', Task: 'Tasks', Report: 'Reports', Note: 'Notes' }; // the phone's type filter
108
+ /** The jobs the log's Tabs filter by, in order. */
109
+ export const JOBS = [['Reply', 'reply'], ['Do', 'do'], ['Decide', 'decide'], ['Send', 'send']];
74
110
 
75
- /** 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:
76
- * Do first (each line with its reason), Today, and Can wait folded to one line. L: logModel().
77
- * o: { draft: the line being typed, type: the chip that filters, open: Can wait is unfolded } */
111
+ /** Today's log, a List block: the heading and the Tabs, the capture Input, the groups Do first, Today, Later (folded) and PMOS handled.
112
+ * L: logModel(). o: { draft: the line being typed, job: the tab that filters ('' is All), open: Later is unfolded, handled, hopen, sopen } */
78
113
  export function logHtml(L, o = {}) {
79
- const head = `<div class="td-h head"><h2>Today’s log${L.open ? ' · ' + esc(L.open) : ''}</h2>${L.line ? `<span class="td-sum">${esc(L.line)}</span>` : ''}</div>`;
80
- 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>`
81
- + `<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" />`
82
- + `<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>`;
83
- const pick = (rows) => (o.type ? (rows || []).filter((r) => r.type === o.type) : rows || []);
114
+ const c = L.counts || {}, job = o.job || '';
115
+ const tab = (j, label, n) => `<button type="button" class="td-tab pm-tab" role="tab" data-td="job" data-key="${esc(j)}" aria-selected="${job === j}">${esc(label)} <span class="td-n">${esc(n)}</span></button>`;
116
+ const shownJobs = JOBS.filter(([, k]) => c[k]);
117
+ const tabs = shownJobs.length ? `<div class="td-tabs pm-tabs" role="tablist" aria-label="Show one job">${tab('', 'All', L.open || 0)}${shownJobs.map(([j, k]) => tab(j, j, c[k])).join('')}</div>` : '';
118
+ const head = `<div class="head"><h2 class="pm-h">Today’s log</h2><span class="sp"></span>${tabs}</div>`;
119
+ const cap = `<form class="td-in" id="tdCapF" autocomplete="off"><label class="td-vh" for="tdCap">Log a task, an event or a note</label>`
120
+ + `<input id="tdCap" class="pm-input" name="line" type="text" maxlength="240" placeholder="Log a task, an event or a note" value="${esc(o.draft || '')}" aria-describedby="tdCapKey" title="Start with o for an event, a dash for a note, ! for first" />`
121
+ + `<span class="td-vh" id="tdCapKey">Start with o for an event, a dash for a note, ! for first</span></form>`;
122
+ const pick = (rows) => (job ? (rows || []).filter((r) => r.job === job) : rows || []);
84
123
  const so = new Set(o.sopen || []);
85
- const rowHtml1 = (r) => (r.members ? rowHtml(r, { sopen: so.has(r.key) }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r));
124
+ const one = (r, lit) => (r.members ? rowHtml(r, { sopen: so.has(r.key), lit }) + (so.has(r.key) ? r.members.map((m) => rowHtml(m)).join('') : '') : rowHtml(r, { lit }));
86
125
  const first = pick(L.first), today = pick(L.todayRows), wait = pick(L.wait);
87
126
  let body = '';
88
- if (first.length) body += groupRow('Do first', 0, true) + first.map(rowHtml1).join('');
89
- if (today.length) body += groupRow('Today') + today.map(rowHtml1).join('');
127
+ if (first.length) body += `<div class="td-gr pm-group now">${ic(I.sun, 14)}Do first</div><div class="rows">${first.map((r, i) => one(r, i === 0)).join('')}</div>`;
128
+ if (today.length) body += `<div class="td-gr pm-group">Today</div><div class="rows">${today.map((r) => one(r)).join('')}</div>`;
90
129
  if (wait.length) {
91
130
  const oldest = Math.max(0, ...wait.map((r) => r.carried || 0));
92
- const said = (first.length || today.length ? wait.length + ' more' : plural2(wait.length)) + (oldest ? ' · the oldest waits ' + oldest + (oldest === 1 ? ' day' : ' days') : '');
93
- body += `<div class="td-gr fold" role="row"><span role="cell"><button type="button" class="td-fold pm-fold" data-td="fold" aria-expanded="${!!o.open}">Can wait <em>${esc(said)}</em>${svg(I.more, 14)}</button></span></div>`;
94
- if (o.open) body += wait.map(rowHtml1).join('');
131
+ const said = wait.length + ' can wait' + (oldest ? ' · the oldest waits ' + plural(oldest, 'day', 'days') : '');
132
+ body += `<button type="button" class="td-fold pm-fold" data-td="fold" aria-expanded="${!!o.open}">Later <span class="td-n">${esc(said)}</span>${ic(I.more, 14)}</button>`;
133
+ if (o.open) body += `<div class="rows">${wait.map((r) => one(r)).join('')}</div>`;
95
134
  }
96
135
  // PMOS handled · N: what the self check cleared today, folded last, Undo on each (design check of round 3, point 6)
97
136
  const hd = o.handled || [];
98
137
  if (hd.length) {
99
- body += `<div class="td-gr fold" role="row"><span role="cell"><button type="button" class="td-fold pm-fold" data-td="hfold" aria-expanded="${!!o.hopen}">PMOS handled <em>${esc(hd.length)}</em>${svg(I.more, 14)}</button></span></div>`;
100
- 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>`
101
- + `<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>`
102
- + `<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">`
103
- + `<button type="button" class="td-undo pm-btn" data-td="h-undo" data-key="${esc(h.id)}" aria-label="${esc('Undo: it still waits on me, ' + h.title)}" title="Undo">${svg(PI.undo, 15, 1.8)}</button></span></div>`).join('');
138
+ body += `<button type="button" class="td-fold pm-fold" data-td="hfold" aria-expanded="${!!o.hopen}">PMOS handled <span class="td-n">${esc(hd.length)}</span>${ic(I.more, 14)}</button>`;
139
+ if (o.hopen) body += '<div class="rows">' + hd.map((h) => `<div class="td-li pm-li done hd" data-key="hd:${esc(h.id)}"><span class="td-kind" role="img" aria-label="Done">${ic(I.done)}</span>`
140
+ + `<span class="txt"><span class="t td-t">${esc(h.title)}</span><span class="w td-rs">${esc(h.proof)}</span></span><span class="acts td-a">`
141
+ + `<button type="button" class="td-undo pm-btn" data-td="h-undo" data-key="${esc(h.id)}" aria-label="${esc('Undo: it still waits on me, ' + h.title)}" title="Undo">${ic(PI.undo)}</button></span></div>`).join('') + '</div>';
104
142
  }
105
- // no row in view names its work: the Work column goes, so What gets the room
106
- const shown = first.concat(today, o.open ? wait : []), noWork = shown.length > 0 && shown.every((r) => !r.work);
107
- 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>';
108
- return `<section class="td-log pm-block list" aria-label="Today’s log">${head}${cap}${table}</section>`;
143
+ const list = body || `<p class="td-none pm-meta">${job ? 'Nothing to ' + job.toLowerCase() + ' today.' : 'Nothing waits on you today.'}</p>`;
144
+ return `<section class="td-log pm-block list" aria-label="Today’s log">${head}${cap}${list}</section>`;
109
145
  }
110
- const plural2 = (n) => n + (n === 1 ? ' line' : ' lines');
111
146
 
112
- /** 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
113
- * 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().
114
- * Places are a share of the day (--t, --h), so the column fills the box, as tall as the log. */
147
+ const hm = (ms) => { const d = new Date(ms); return String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0'); };
148
+ /** Today's agenda, a Timeline block (pm-block flat): the day's events only, each at its time, past ones dashed, the now line in the alert
149
+ * colour where it falls, and a link to Events. No hour grid. A day with no event is one quiet line. A: agendaModel(). */
115
150
  export function agendaHtml(A) {
116
- const H = A.to - A.from, pc = (x) => (Math.round((x / H) * 10000) / 100) + '%';
117
- const hours = [];
118
- 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>`);
119
- const ev = A.items.map((x) => {
120
- const short = x.h < 0.8; // a short slot says its time and title on one line
121
- const st = `--t:${pc(x.top)};--h:${pc(x.h)};--c:${x.col || 0};--n:${x.cols || 1}`;
122
- const cls = ['td-ev', 'pm-ev', x.kind, short ? 'short' : '', (x.cols || 1) > 1 ? 'side' : '', x.past ? 'past over' : '', x.nowOn ? 'on' : ''].filter(Boolean).join(' ');
123
- 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>' : '';
151
+ const quiet = A.quiet && !A.items.length;
152
+ const head = `<div class="head"><h2 class="pm-h">Today</h2><span class="pm-meta">${esc(quiet ? A.sub.split(' · ')[0] : A.sub)}</span><span class="sp"></span><a class="td-evl" href="/premium-events.html">Events</a></div>`;
153
+ if (quiet) return `<aside class="td-ag pm-block flat" aria-label="Today’s agenda">${head}<p class="td-quiet pm-meta">${esc(A.quiet)}</p></aside>`;
154
+ const nowMin = A.now != null ? Math.round((A.from + A.now) * 60) : null;
155
+ const nowLine = nowMin != null ? `<span class="td-at td-nowt">${String(Math.floor(nowMin / 60)).padStart(2, '0')}:${String(nowMin % 60).padStart(2, '0')}</span><i class="td-now" aria-hidden="true"></i>` : '';
156
+ let placed = nowMin == null, rows = '';
157
+ for (const x of A.items) {
158
+ if (!placed && x.top > A.now) { rows += nowLine; placed = true; }
159
+ const soon = A.now != null && !x.past && !x.nowOn && x.top > A.now && (x.top - A.now) * 60 <= 60 ? 'in ' + Math.max(1, Math.round((x.top - A.now) * 60)) + ' min · ' : '';
160
+ const cls = ['td-ev', 'pm-ev', x.kind, x.past ? 'past over' : '', x.nowOn ? 'on' : ''].filter(Boolean).join(' ');
124
161
  const label = x.title + ', ' + x.sub;
125
- const inner = `<b>${mark}${esc(x.title)}</b><small>${esc(x.sub)}</small>`;
126
- if (x.kind === 'own' || x.kind === 'report') return `<div class="${cls}" style="${st}" aria-label="${esc(label)}">${inner}</div>`;
127
- 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>`;
128
- return `<button type="button" class="${cls}${x.play ? ' has-play' : ''}" style="${st}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}">${inner}</button>`
129
- // meeting-buddy: one press opens the call and starts the recording. A link, so the browser always opens the call, even when the
130
- // recording tab is held back; cozy-today-app.js starts the recording on the same press.
131
- + (x.play ? `<a class="td-play pm-btn primary" style="${st}" href="${esc(x.join)}" target="_blank" rel="noopener noreferrer" data-td="play" data-key="${esc(x.key)}" aria-label="${esc('Join ' + x.title + ' and record it')}" title="Join and record">${svg(I.play, 13)}</a>` : '');
132
- }).join('');
133
- const nowLine = A.now != null ? `<i class="td-now" style="--t:${pc(A.now)}" aria-hidden="true"></i>` : '';
134
- return `<aside class="td-ag pm-block flat${A.quiet && !A.items.length ? ' quiet' : ''}" aria-label="Today’s agenda"><div class="td-agh"><h2>Today</h2><small>${esc(A.quiet && !A.items.length ? A.sub.split(' · ')[0] : A.sub)}</small>`
135
- + `<a class="td-evl" href="/premium-events.html">Events</a></div>`
136
- + (A.quiet && !A.items.length ? `<p class="td-quiet">${esc(A.quiet)}</p></aside>` : `<div class="td-tl" style="--rows:${H}">${hours.join('')}${ev}${nowLine}</div></aside>`);
162
+ const inner = `<b>${esc(x.title)}</b><span class="pm-meta">${esc(soon + x.sub)}</span>`;
163
+ const ev = x.kind === 'own' || x.kind === 'report' ? `<div class="${cls}" aria-label="${esc(label)}">${inner}</div>`
164
+ : x.kind === 'focus' ? `<button type="button" class="${cls}" data-td="open" data-key="${esc(x.row)}" aria-label="${esc(label)}">${inner}</button>`
165
+ : `<button type="button" class="${cls}" data-td="ev" data-key="${esc(x.key)}" aria-label="${esc(label)}">${inner}</button>`;
166
+ // meeting-buddy: one press opens the call and starts the recording. A link, so the browser always opens the call, even when the
167
+ // recording tab is held back; cozy-today-app.js starts the recording on the same press.
168
+ const play = x.play ? `<a class="td-play pm-btn primary" href="${esc(x.join)}" target="_blank" rel="noopener noreferrer" data-td="play" data-key="${esc(x.key)}" aria-label="${esc('Join ' + x.title + ' and record it')}" title="Join and record">${ic(I.play)}</a>` : '';
169
+ rows += `<span class="td-at pm-meta">${esc(hm(x.a))}</span><div class="td-evw">${ev}${play}</div>`;
170
+ }
171
+ if (!placed) rows += nowLine;
172
+ return `<aside class="td-ag pm-block flat" aria-label="Today’s agenda">${head}<div class="td-tl">${rows}</div></aside>`;
173
+ }
174
+
175
+ /** The meeting PMOS recorded and filed, a Summary block under the agenda with one Suggestion: keep it filed there (✓), or take it out (✕).
176
+ * f: { id, title (the work), meeting, sub } from cozy-today-app.js filedLine(); '' with none. */
177
+ export function filedHtml(f) {
178
+ if (!f) return '';
179
+ return `<section class="td-rec pm-block" aria-label="The meeting you recorded"><h2 class="pm-h-sm pm-row">${ic(I.spark, 16, 'pm-star')}${esc((f.meeting || 'Your meeting') + ', recorded')}</h2>`
180
+ + `<p>${esc((f.sub ? f.sub + '. ' : '') + 'PMOS filed it under ' + f.title + '.')}</p>`
181
+ + sugHtml('Keep it filed under ' + f.title, ['filed-ok', 'Yes, keep it there'], ['filed-undo', 'No, take it out of ' + f.title], f.id) + '</section>';
137
182
  }
138
183
 
139
184
  /** The page head: the day and the time, small, then the greeting. Hd: headModel(). */
140
- export const headHtml = (Hd) => `<header class="td-top"><span class="td-when">${esc(Hd.when)}</span><h1>${esc(Hd.hello)}</h1></header>`;
185
+ export const headHtml = (Hd) => `<header class="td-top"><div class="td-when pm-meta">${esc(Hd.when)}</div><h1 class="title">${esc(Hd.hello)}</h1></header>`;
141
186
 
142
- /** The whole page: the Overview and the log at the left, the agenda beside them. o.overview: overviewModel(). */
143
- 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>`; }
187
+ /** The whole page, Main + side: the Overview and the log, then the agenda and the recorded meeting beside them.
188
+ * o: { head, overview: overviewModel(), filed, …logHtml's o } */
189
+ export function pageHtml(L, A, o = {}) {
190
+ return `${o.head ? headHtml(o.head) : ''}<div class="td"><div class="td-main">${o.overview ? overviewHtml(o.overview) : ''}${logHtml(L, o)}</div>`
191
+ + `<div class="td-side">${agendaHtml(A)}${filedHtml(o.filed)}</div></div>`;
192
+ }
144
193
 
145
194
  /* ── Today on a phone (phone design, boards Ph2_today, Ph2_todayzero, Ph2_recdone; build brief nav-structure/phone/build-brief-v2.md) ──
146
195
  * One column, no cards and no boxes: the day and the greeting, "Recording filed under …" with Undo after a meeting, the ✦ Overview with at