create-pmos 0.610.0 → 0.612.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 (164) hide show
  1. package/package.json +135 -27
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/board-columns-test.js +2 -1
  8. package/workspace/board-deliveries-test.js +2 -1
  9. package/workspace/board-programs-test.js +7 -3
  10. package/workspace/board-publish-ui-test.js +2 -1
  11. package/workspace/board-shared-ui-test.js +2 -1
  12. package/workspace/board-workflows-test.js +2 -1
  13. package/workspace/briefing-premium-board-test.js +3 -2
  14. package/workspace/briefing-premium-calendar-2-test.js +3 -2
  15. package/workspace/briefing-premium-calendar-3-test.js +1 -1
  16. package/workspace/briefing-premium-calendar-test.js +1 -1
  17. package/workspace/briefing-premium-doc-edit-test.js +2 -1
  18. package/workspace/briefing-premium-insights-test.js +4 -3
  19. package/workspace/briefing-premium-test.js +3 -2
  20. package/workspace/calm-timeline-test.js +2 -1
  21. package/workspace/changelog.json +134 -0
  22. package/workspace/core-docs-workflow-test.js +2 -1
  23. package/workspace/ev-everywhere-test.js +3 -2
  24. package/workspace/guide/home.md +2 -2
  25. package/workspace/guide/index.md +4 -0
  26. package/workspace/guide/layout.md +97 -3
  27. package/workspace/guide/programs.md +16 -2
  28. package/workspace/guide/routine.md +65 -0
  29. package/workspace/guide/scheduled-tasks-and-cli.md +1 -1
  30. package/workspace/guide/settings-and-switches.md +2 -2
  31. package/workspace/impact-screens-test.js +3 -1
  32. package/workspace/ini-workflow-test.js +2 -1
  33. package/workspace/lib/board-premium.js +12 -4
  34. package/workspace/lib/classic-board.js +15 -0
  35. package/workspace/lib/cos-chat.js +1 -0
  36. package/workspace/lib/doc-library.js +43 -12
  37. package/workspace/lib/doc-path.js +30 -0
  38. package/workspace/lib/engine/boards.js +4 -2
  39. package/workspace/lib/events-place.js +368 -0
  40. package/workspace/lib/events-stated.js +129 -0
  41. package/workspace/lib/initiative-chat.js +1 -0
  42. package/workspace/lib/insights-premium.js +13 -1
  43. package/workspace/lib/library-find.js +162 -0
  44. package/workspace/lib/library-items.js +250 -0
  45. package/workspace/lib/notes.js +9 -1
  46. package/workspace/lib/plan-items.js +17 -3
  47. package/workspace/lib/route-modules.js +4 -0
  48. package/workspace/lib/routes-artefacts.js +5 -2
  49. package/workspace/lib/routes-boards.js +6 -2
  50. package/workspace/lib/routes-doc-sheet.js +1 -0
  51. package/workspace/lib/routes-events-place.js +203 -0
  52. package/workspace/lib/routes-library.js +155 -0
  53. package/workspace/lib/routes-pop-work.js +39 -0
  54. package/workspace/lib/routes-report-setups.js +32 -1
  55. package/workspace/lib/routes-today-log.js +48 -0
  56. package/workspace/lib/routine-reports.js +84 -0
  57. package/workspace/lib/status-when.js +36 -0
  58. package/workspace/lib/task-items.js +5 -3
  59. package/workspace/lib/today-log.js +131 -0
  60. package/workspace/live-pill-round-test.js +10 -7
  61. package/workspace/metric-drafts-ui-test.js +3 -1
  62. package/workspace/milestone-pins-test.js +2 -1
  63. package/workspace/milestone-suggest-test.js +3 -1
  64. package/workspace/package-lock.json +2 -2
  65. package/workspace/package.json +1 -1
  66. package/workspace/panels-test.js +2 -1
  67. package/workspace/premium-board-actions-test.js +3 -1
  68. package/workspace/premium-rec-tab-test.js +2 -1
  69. package/workspace/premium-vw-backlog-test.js +3 -1
  70. package/workspace/premium-vw-item-test.js +3 -1
  71. package/workspace/premium-vw-jira-test.js +3 -1
  72. package/workspace/premium-vw-meet-test.js +2 -1
  73. package/workspace/premium-vw-notes-test.js +3 -2
  74. package/workspace/product-lane-test.js +2 -1
  75. package/workspace/program-charter-test.js +3 -1
  76. package/workspace/program-leave-test.js +2 -1
  77. package/workspace/program-order-test.js +2 -1
  78. package/workspace/program-panel-test.js +3 -1
  79. package/workspace/public/pm/artefact-kind.js +87 -0
  80. package/workspace/public/pm/bd-ini-panel.js +77 -12
  81. package/workspace/public/pm/bd-prog-panel.js +55 -8
  82. package/workspace/public/pm/bd-span.js +5 -0
  83. package/workspace/public/pm/bd-work.css +192 -0
  84. package/workspace/public/pm/bd-work.js +483 -0
  85. package/workspace/public/pm/cozy-bar.css +11 -0
  86. package/workspace/public/pm/cozy-bar.js +99 -0
  87. package/workspace/public/pm/cozy-day-pick.css +27 -0
  88. package/workspace/public/pm/cozy-day-pick.js +97 -0
  89. package/workspace/public/pm/cozy-ev.css +2 -5
  90. package/workspace/public/pm/cozy-events-view.js +274 -0
  91. package/workspace/public/pm/cozy-events.css +179 -0
  92. package/workspace/public/pm/cozy-events.js +278 -0
  93. package/workspace/public/pm/cozy-evmodel.js +1 -1
  94. package/workspace/public/pm/cozy-goals.css +172 -0
  95. package/workspace/public/pm/cozy-library.css +125 -0
  96. package/workspace/public/pm/cozy-live-pill.js +1 -0
  97. package/workspace/public/pm/cozy-nav.js +6 -7
  98. package/workspace/public/pm/cozy-pick.css +3 -0
  99. package/workspace/public/pm/cozy-pop-work.css +224 -0
  100. package/workspace/public/pm/cozy-pop-work.js +668 -0
  101. package/workspace/public/pm/cozy-popup.css +11 -2
  102. package/workspace/public/pm/cozy-popup.js +67 -9
  103. package/workspace/public/pm/cozy-routine-job.js +203 -0
  104. package/workspace/public/pm/cozy-routine-model.js +219 -0
  105. package/workspace/public/pm/cozy-routine-pop.js +318 -0
  106. package/workspace/public/pm/cozy-routine.css +155 -0
  107. package/workspace/public/pm/cozy-routine.js +335 -0
  108. package/workspace/public/pm/cozy-schedwork.js +6 -5
  109. package/workspace/public/pm/cozy-settings.js +1 -5
  110. package/workspace/public/pm/cozy-status-when.js +48 -0
  111. package/workspace/public/pm/cozy-today-app.js +236 -0
  112. package/workspace/public/pm/cozy-today-model.js +176 -0
  113. package/workspace/public/pm/cozy-today-page.css +100 -0
  114. package/workspace/public/pm/cozy-today-view.js +76 -0
  115. package/workspace/public/pm/cozy-viewer.js +19 -8
  116. package/workspace/public/pm/cozy-vw-mtg.css +39 -0
  117. package/workspace/public/pm/goals-model.js +205 -0
  118. package/workspace/public/pm/goals-open.js +124 -0
  119. package/workspace/public/pm/home-app.js +18 -3
  120. package/workspace/public/pm/home-chat.js +4 -2
  121. package/workspace/public/pm/home-ini.js +43 -10
  122. package/workspace/public/pm/ini-edit.js +3 -1
  123. package/workspace/public/pm/ini-view-model.js +1 -1
  124. package/workspace/public/pm/library-model.js +197 -0
  125. package/workspace/public/pm/library-open.js +37 -0
  126. package/workspace/public/pm/page-chat.js +12 -2
  127. package/workspace/public/pm/pop-work-model.js +493 -0
  128. package/workspace/public/pm/premium-board.js +204 -17
  129. package/workspace/public/pm/premium-goals.js +213 -0
  130. package/workspace/public/pm/premium-library.js +436 -0
  131. package/workspace/public/pm/premium-shell.js +1 -1
  132. package/workspace/public/pm/premium-vw-mtg.js +79 -1
  133. package/workspace/public/pm/scope-chip.js +204 -0
  134. package/workspace/public/premium-board.html +1 -0
  135. package/workspace/public/premium-events.html +44 -0
  136. package/workspace/public/premium-goals.html +37 -0
  137. package/workspace/public/premium-library.html +39 -0
  138. package/workspace/public/premium-routine.html +33 -0
  139. package/workspace/public/today.html +50 -0
  140. package/workspace/ready-dash-ui-test.js +3 -1
  141. package/workspace/rename-test.js +2 -1
  142. package/workspace/run-tests.js +4 -1
  143. package/workspace/server.js +4 -2
  144. package/workspace/sort-order-test.js +2 -1
  145. package/workspace/split-merge-ui-test.js +3 -1
  146. package/workspace/stage-card-tasks-test.js +3 -1
  147. package/workspace/stage-card-test.js +2 -1
  148. package/workspace/task-delete-test.js +2 -1
  149. package/workspace/task-links-test.js +2 -1
  150. package/workspace/task-milestones-test.js +4 -2
  151. package/workspace/task-plans-test.js +3 -1
  152. package/workspace/task-press-test.js +3 -1
  153. package/workspace/task-views-test.js +3 -1
  154. package/workspace/test-lists/doc-path.json +9 -0
  155. package/workspace/test-lists/events-place.json +11 -0
  156. package/workspace/test-lists/goals-place.json +9 -0
  157. package/workspace/test-lists/library-place.json +9 -0
  158. package/workspace/test-lists/pop-work.json +9 -0
  159. package/workspace/test-lists/routine-place.json +9 -0
  160. package/workspace/test-lists/status-when.json +9 -0
  161. package/workspace/test-lists/today-log.json +9 -0
  162. package/workspace/test-lists/work-view.json +9 -0
  163. package/workspace/timeline-holds-test.js +3 -1
  164. package/workspace/tk-tasks-test.js +2 -1
@@ -0,0 +1,48 @@
1
+ /* pm/cozy-status-when.js — "When did this happen?" after a status pick (popup round 3 point 18). A person often moves a task days after the work
2
+ * moved, so the move can carry the real day apart from when it was recorded. One function for every place that moves a status (the popup's
3
+ * Work breakdown, and Work). The server checks the same limits (lib/status-when.js).
4
+ *
5
+ * whenLimits({ today, since }) → { min, max, yesterday } — never after today, never before since (the previous move's day); yesterday is
6
+ * null when it falls before since
7
+ * whenWords(state, happened, today) → the toast: "Done." on today, "Done on 14 Nov, noted today." on an earlier day
8
+ * askWhen(el, { today, since, onPick(iso) }) draws the line into el: When did this happen? [Today] [Yesterday] [Pick a date]. Today is
9
+ * preselected, so Enter saves it; Pick a date opens the app's own day field (pm/cozy-day-pick.js) inside the limits.
10
+ * Returns { save() } (saves the preselected day). Its presses stop at el. */
11
+ import { mountDay, localToday, dayText } from './cozy-day-pick.js';
12
+
13
+ const ms = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) : null; };
14
+ const iso = (n) => new Date(n).toISOString().slice(0, 10);
15
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
16
+
17
+ export function whenLimits({ today = localToday(), since = null } = {}) {
18
+ const s = ms(since) != null ? String(since).slice(0, 10) : null;
19
+ const min = s && s <= today ? s : null;
20
+ const y = iso(ms(today) - 864e5);
21
+ return { min, max: today, yesterday: !min || y >= min ? y : null };
22
+ }
23
+ export function whenWords(state, happened, today = localToday()) {
24
+ if (!happened || happened >= today) return state + '.';
25
+ const d = new Date(ms(happened)), y = d.getUTCFullYear() !== +String(today).slice(0, 4) ? ' ' + d.getUTCFullYear() : '';
26
+ return state + ' on ' + d.getUTCDate() + ' ' + MON[d.getUTCMonth()] + y + ', noted today.';
27
+ }
28
+ export function askWhen(el, o = {}) {
29
+ const today = o.today || localToday(), L = whenLimits({ today, since: o.since });
30
+ const done = (v) => { if (o.onPick) o.onPick(v); };
31
+ el.classList.add('sw');
32
+ el.innerHTML = '<p class="sw-q" id="swQ">When did this happen?</p><div class="sw-ch" role="group" aria-labelledby="swQ">'
33
+ + '<button type="button" class="sw-b" data-sw="today" aria-pressed="true">Today</button>'
34
+ + (L.yesterday ? '<button type="button" class="sw-b" data-sw="yday" aria-pressed="false">Yesterday</button>' : '')
35
+ + (L.min === today ? '' : '<button type="button" class="sw-b" data-sw="pick" aria-pressed="false" aria-expanded="false">Pick a date</button>') + '</div><div class="sw-day"></div>';
36
+ el.addEventListener('click', (e) => {
37
+ const b = e.target.closest('[data-sw]'); if (!b || !el.contains(b)) return;
38
+ e.stopPropagation();
39
+ if (b.dataset.sw === 'today') return done(today);
40
+ if (b.dataset.sw === 'yday') return done(L.yesterday);
41
+ el.querySelectorAll('[data-sw]').forEach((x) => x.setAttribute('aria-pressed', String(x === b)));
42
+ b.setAttribute('aria-expanded', 'true');
43
+ const box = el.querySelector('.sw-day');
44
+ if (!box.firstChild) mountDay(box, { label: 'Day', value: L.yesterday || today, min: L.min, max: today, today, open: true, onPick: done }).focus();
45
+ });
46
+ el.addEventListener('keydown', (e) => { if (e.key === 'Enter' && !e.target.closest('button, input, .sw-day')) { e.preventDefault(); e.stopPropagation(); done(today); } });
47
+ return { save: () => done(today), limits: L, text: (v) => dayText(v) };
48
+ }
@@ -0,0 +1,236 @@
1
+ /* pm/cozy-today-app.js — Today on a desk (slice 5 of the six-place navigation; board 1 on Exploring 2; initiative today-log-page).
2
+ *
3
+ * mountToday(ctx) once, from home-app.js on today.html (body[data-today]). ctx is what Home already has:
4
+ * { S, VW, POP, pmGet, pmPost, toast, toastUndo, isPhone, now(), rank() → rankMove's answer, rows() → Home's rows by id (a Map),
5
+ * titleOf(ini), hasIni(ini), boardWs(), boardId(), goIni(id), select(id), movePress(btn), openFinished(f), openReviewVw(), openMeeting(m),
6
+ * openCalendar(), openInbox(), openLab(l), reload(), review() → the weekly review's model, meetings() → today's meetings, news() → how
7
+ * many are new for you, chatNow() → the chat's target }
8
+ * → { on() → Today is drawn, draw(), read() }
9
+ *
10
+ * Today draws into #tdPage, the only thing on the white page panel; Home's list and chat column are not drawn (cozy-today-page.css), so the
11
+ * Viewer no longer floats over a chat on a laptop. A row's press opens its work in the one popup (cozy-popup.js) with Home's chat beside it.
12
+ * The capture line adds a row and does nothing else: no popup, no session. Every write is a press: today-log marks and own entries
13
+ * (POST /api/today-log/*), a task's state or due day (the Board's own routes), an item's done, defer, due or remove (POST /api/pm-items/*),
14
+ * a Lab finding kept or dropped (POST /api/lab/*). Each says what it did in the toast, with Undo. Reads: GET /api/today-log. */
15
+ import * as TM from './cozy-today-model.js';
16
+ import * as TP from './cozy-today-view.js';
17
+
18
+ const ASK_SEND = new Set(['session']);
19
+ export function mountToday(ctx) {
20
+ const X = { log: { entries: [], marks: {} }, html: '', model: null, agenda: null, read: false, busy: new Set() };
21
+ const el = document.getElementById('tdPage');
22
+ const on = () => !!el && !ctx.isPhone();
23
+ const day = () => TM.dayKey(ctx.now());
24
+
25
+ async function read() {
26
+ const r = await ctx.pmGet('/api/today-log?day=' + day()).catch(() => null);
27
+ if (r && r.ok) X.log = { entries: r.entries || [], marks: r.marks || {} };
28
+ X.read = true;
29
+ draw();
30
+ }
31
+ const tdItems = () => {
32
+ const tabs = (ctx.S.D.work && ctx.S.D.work.queue && ctx.S.D.work.queue.tabs) || [];
33
+ return ((tabs.find((t) => t.key === 'today') || { groups: [] }).groups || []).flatMap((g) => g.rows || []);
34
+ };
35
+ function models() {
36
+ const S = ctx.S, D = S.D, now = ctx.now(), byId = ctx.rows();
37
+ // Your move's rows, with what Home's own rows know of each (its task and its due day): a late task is dated, a next step is not
38
+ const move = ((S.M && S.M.move) || []).map((r) => { const f = byId.get(r.id) || {}; return { ...r, ini: f.ini || r.ini || null, task: f.task || null, due: f.due || (f.task && f.task.end) || '' }; });
39
+ const PD = D.phoneDay || null;
40
+ const drafts = (PD && Array.isArray(PD.finished) ? PD.finished : []).filter((x) => x && !x.seen && x.status !== 'sent').map((x) => ({ id: x.id || x.key || x.title, title: x.title, ini: x.initiative || null, fin: x }));
41
+ const R = ctx.review();
42
+ const lab = (S.lab || []).flatMap((l) => (l.items || []).map((f) => ({ ...f, ws: l.ws, board: l.board })));
43
+ const L = TM.logModel({ rank: ctx.rank(), move, items: tdItems(), drafts, review: R && R.open && !R.done ? { title: 'Your weekly review' } : null,
44
+ own: X.log.entries, marks: X.log.marks, lab, titleOf: ctx.titleOf, now });
45
+ const A = TM.agendaModel({ meetings: ctx.meetings(), own: X.log.entries, now,
46
+ iniOf: (m) => (m && (m.initiative || (m.level && m.level.kind === 'initiative' && m.level.id) || (m.about && m.about.kind === 'initiative' && m.about.id))) || null });
47
+ return { L, A };
48
+ }
49
+ function draw() {
50
+ document.body.classList.toggle('cz-today', on());
51
+ if (!el) return;
52
+ if (!on()) { el.hidden = true; return; }
53
+ el.hidden = false;
54
+ if (!ctx.S.ready) { if (!el.firstChild) el.innerHTML = '<p class="td-none">Reading your day.</p>'; return; }
55
+ const { L, A } = models();
56
+ X.model = L; X.agenda = A;
57
+ const cap = document.getElementById('tdCap'), draft = cap ? cap.value : '', focus = !!cap && document.activeElement === cap;
58
+ const html = TP.pageHtml(L, A, { news: ctx.news(), draft });
59
+ if (html === X.html && el.firstChild) return;
60
+ X.html = html;
61
+ const st = el.parentNode ? el.parentNode.scrollTop : 0;
62
+ el.innerHTML = html;
63
+ if (el.parentNode) el.parentNode.scrollTop = st;
64
+ const c2 = document.getElementById('tdCap'); if (c2 && focus) { c2.focus(); c2.setSelectionRange(c2.value.length, c2.value.length); }
65
+ }
66
+ const rowOf = (key) => (X.model ? X.model.rows.find((r) => r.key === key) : null);
67
+ const snap = (r) => ({ title: r.title, work: r.work, job: r.job });
68
+ async function mark(key, act, extra = {}) {
69
+ const r = await ctx.pmPost('/api/today-log/mark', { key, act, day: day(), ...extra }).catch(() => null);
70
+ return r && r.ok ? r : { ok: false, error: (r && r.error) || 'the server did not answer' };
71
+ }
72
+ /** After a write: read the log again, and Home's own lists when the source changed. */
73
+ const after = async (src) => { if (src) await ctx.reload(); await read(); };
74
+ const pop = (r) => ctx.VW.popNext({ keep: true, id: r.ini || r.key, kind: r.ini ? 'initiative' : 'item', title: r.ini ? ctx.titleOf(r.ini) : r.title });
75
+ /** A chat-only press (a session that asks): the popup with that chat and the sessions on its left. */
76
+ const chatPop = () => setTimeout(() => { if (!ctx.VW.popOpen()) { ctx.VW.popNext(null); const t = ctx.chatNow(); if (t) ctx.POP.openCos(t); } }, 120);
77
+
78
+ function open(r) {
79
+ if (!r) return;
80
+ const ref = r.ref || {};
81
+ if (r.src === 'ask') {
82
+ if (ref.kind === 'call') { const c = ref.call || {}; if (c.ini && ctx.hasIni(c.ini) && !ASK_SEND.has(c.kind)) { ctx.goIni(c.ini); return; } pop(r); ctx.select(c.id); if (ASK_SEND.has(c.kind)) chatPop(); return; }
83
+ pop(r); ctx.movePress({ dataset: { yd: 'mv-open', key: ref.key }, disabled: false }); return;
84
+ }
85
+ if (r.src === 'move') { if (ref.kind === 'task' && r.ini && ctx.hasIni(r.ini)) { ctx.goIni(r.ini); return; } pop(r); ctx.select(r.key); if (ref.kind === 'session') chatPop(); return; }
86
+ if (r.src === 'item') { if (r.ini && ctx.hasIni(r.ini)) { ctx.goIni(r.ini); return; } pop(r); import('./home-work.js').then((M) => M.openWorkItem(ref.key)).catch(() => {}); return; }
87
+ if (r.src === 'draft') { pop(r); ctx.openFinished(ref.fin); return; }
88
+ if (r.src === 'review') { pop(r); ctx.openReviewVw(); return; }
89
+ if (r.src === 'lab') { pop(r); ctx.openLab(ref); }
90
+ }
91
+
92
+ async function done(r) {
93
+ const ref = r.ref || {};
94
+ if (r.src === 'move' && ref.task && ref.task.uid) {
95
+ const t = ref.task, w = { ws: t.ws || ctx.boardWs(), board: t.board || ctx.boardId(), task: t.uid };
96
+ const res = await ctx.pmPost('/api/boards/tasks/state', { ...w, state: 'Done' }).catch(() => null);
97
+ if (!res || !res.ok) return ctx.toast((res && res.error) || 'It was not marked done. Nothing changed.');
98
+ await mark(r.key, 'done', { snap: snap(r) });
99
+ ctx.toastUndo('Done: ' + r.title + '.', async () => { const u = await ctx.pmPost('/api/boards/tasks/state', { ...w, state: t.status || 'To do' }).catch(() => null); await mark(r.key, 'undone'); after(true); return u || { ok: false }; });
100
+ return after(true);
101
+ }
102
+ if (r.src === 'item') {
103
+ const res = await ctx.pmPost('/api/pm-items/done', { id: ref.id }).catch(() => null);
104
+ if (!res || !res.ok) return ctx.toast((res && res.error) || 'It was not marked done. Nothing changed.');
105
+ await mark(r.key, 'done', { snap: snap(r) });
106
+ ctx.toastUndo('Done: ' + r.title + '.', async () => { const u = await ctx.pmPost('/api/pm-items/reopen', { id: ref.id }).catch(() => null); await mark(r.key, 'undone'); after(true); return u || { ok: false }; });
107
+ return after(true);
108
+ }
109
+ const m = await mark(r.key, 'done', { snap: snap(r) });
110
+ if (!m.ok) return ctx.toast('It was not marked done: ' + m.error + '.');
111
+ ctx.toastUndo('Done: ' + r.title + '.', async () => { const u = await mark(r.key, 'undone'); after(false); return u; });
112
+ return after(false);
113
+ }
114
+ async function later(r, until) {
115
+ const ref = r.ref || {}, tomorrow = until === TM.addDays(day(), 1), word = tomorrow ? 'tomorrow' : until;
116
+ if (r.src === 'item' && tomorrow) {
117
+ const res = await ctx.pmPost('/api/pm-items/defer', { id: ref.id, until }).catch(() => null);
118
+ if (!res || !res.ok) return ctx.toast((res && res.error) || 'It was not moved. Nothing changed.');
119
+ ctx.toastUndo('Moved to ' + word + '.', async () => { const u = await ctx.pmPost('/api/pm-items/defer', { id: ref.id, until: null }).catch(() => null); after(true); return u || { ok: false }; });
120
+ return after(true);
121
+ }
122
+ const m = await mark(r.key, 'later', { until });
123
+ if (!m.ok) return ctx.toast('It was not moved: ' + m.error + '.');
124
+ ctx.toastUndo('Moved to ' + word + '.', async () => { const u = await mark(r.key, 'now'); after(false); return u; });
125
+ return after(false);
126
+ }
127
+ /** Set a date: a task's or an item's own due day; any other row leaves the log until that day. */
128
+ async function setDate(r, d) {
129
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(d)) return;
130
+ const ref = r.ref || {};
131
+ if (r.src === 'move' && ref.task && ref.task.uid) {
132
+ const t = ref.task, w = { ws: t.ws || ctx.boardWs(), board: t.board || ctx.boardId(), task: t.uid };
133
+ const res = await ctx.pmPost('/api/boards/tasks/edit', { ...w, due: d }).catch(() => null);
134
+ if (!res || !res.ok) return ctx.toast((res && res.error) || 'The date was not changed. Nothing changed.');
135
+ ctx.toastUndo('Due ' + d + '.', async () => { const u = await ctx.pmPost('/api/boards/tasks/edit', { ...w, due: t.end || '' }).catch(() => null); after(true); return u || { ok: false }; });
136
+ return after(true);
137
+ }
138
+ if (r.src === 'item') {
139
+ const res = await ctx.pmPost('/api/pm-items/edit', { id: ref.id, fields: { due: d } }).catch(() => null);
140
+ if (!res || !res.ok) return ctx.toast((res && res.error) || 'The date was not changed. Nothing changed.');
141
+ ctx.toastUndo('Due ' + d + '.', async () => { const u = await ctx.pmPost('/api/pm-items/edit', { id: ref.id, fields: { due: ref.due || null } }).catch(() => null); after(true); return u || { ok: false }; });
142
+ return after(true);
143
+ }
144
+ if (d <= day()) return ctx.toast('It is in today’s log already.');
145
+ return later(r, d);
146
+ }
147
+ async function drop(r) {
148
+ const ref = r.ref || {};
149
+ if (r.src === 'item') {
150
+ const res = await ctx.pmPost('/api/pm-items/remove', { id: ref.id }).catch(() => null);
151
+ if (!res || !res.ok) return ctx.toast((res && res.error) || 'It was not dropped. Nothing changed.');
152
+ ctx.toastUndo('Dropped: ' + r.title + '.', async () => { const u = await ctx.pmPost('/api/pm-items/undo', { id: ref.id }).catch(() => null); after(true); return u || { ok: false }; });
153
+ return after(true);
154
+ }
155
+ const m = await mark(r.key, 'drop');
156
+ if (!m.ok) return ctx.toast('It was not dropped: ' + m.error + '.');
157
+ ctx.toastUndo('Dropped from your log.', async () => { const u = await mark(r.key, 'undrop'); after(false); return u; });
158
+ return after(false);
159
+ }
160
+ async function keep(r) {
161
+ const m = await mark(r.key, 'keep');
162
+ if (!m.ok) return ctx.toast('It was not kept: ' + m.error + '.');
163
+ ctx.toast('Kept. PMOS will not suggest it again for a month.');
164
+ return after(false);
165
+ }
166
+ async function lab(r, yes) {
167
+ const f = r.ref || {};
168
+ const res = await ctx.pmPost(yes ? '/api/lab/keep' : '/api/lab/drop', { ws: f.ws || undefined, id: f.id }).catch(() => null);
169
+ if (!res || !res.ok) return ctx.toast((res && res.error) || 'It did not go through. Nothing changed.');
170
+ const undo = res.batch ? async () => { const u = await ctx.pmPost('/api/lab/undo', { ws: f.ws || undefined, batch: res.batch }).catch(() => null); after(true); return u || { ok: false }; } : null;
171
+ const said = yes ? res.said || 'Kept. The initiative is on its board.' : 'Dropped.';
172
+ if (undo) ctx.toastUndo(said, undo); else ctx.toast(said);
173
+ return after(true);
174
+ }
175
+ /** The date chooser beside a row: one date field; Enter or a change sets it, Escape or a press outside closes it. */
176
+ function chooseDate(r, btn) {
177
+ document.querySelectorAll('.td-dp').forEach((x) => x.remove());
178
+ const box = document.createElement('div');
179
+ box.className = 'td-dp'; box.setAttribute('role', 'dialog'); box.setAttribute('aria-label', 'Set a date: ' + r.title);
180
+ const due = (r.ref && (r.ref.due || (r.ref.task && r.ref.task.end))) || TM.addDays(day(), 1);
181
+ box.innerHTML = `<input type="date" aria-label="Date" value="${TP.esc(due)}" min="${TP.esc(day())}" />`;
182
+ document.body.appendChild(box);
183
+ const b = btn.getBoundingClientRect();
184
+ box.style.top = Math.min(innerHeight - 64, b.bottom + 6) + 'px'; box.style.left = Math.max(12, b.right - box.offsetWidth) + 'px';
185
+ const i = box.querySelector('input');
186
+ const close = () => { box.remove(); removeEventListener('pointerdown', out, true); if (btn.isConnected) btn.focus(); };
187
+ const out = (e) => { if (!box.contains(e.target)) close(); };
188
+ addEventListener('pointerdown', out, true);
189
+ const go = () => { const v = i.value; close(); if (v && v !== due) setDate(r, v); };
190
+ i.addEventListener('change', go);
191
+ i.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.stopPropagation(); close(); } if (e.key === 'Enter') { e.preventDefault(); go(); } });
192
+ i.focus();
193
+ try { i.showPicker(); } catch { /* the field itself is the chooser */ }
194
+ }
195
+
196
+ if (el) {
197
+ el.addEventListener('click', async (e) => {
198
+ const b = e.target.closest('[data-td]'); if (!b || b.disabled) return;
199
+ const act = b.dataset.td, key = b.dataset.key || '';
200
+ if (act === 'cal') { ctx.openCalendar(); return; }
201
+ if (act === 'news') { ctx.VW.popNext({ keep: true, id: 'news', kind: 'item', title: 'New for you' }); ctx.openInbox(); return; }
202
+ if (act === 'ev') {
203
+ const x = X.agenda && X.agenda.items.find((y) => y.key === key); if (!x) return;
204
+ if (x.ini && ctx.hasIni(x.ini)) { ctx.goIni(x.ini); return; }
205
+ ctx.VW.popNext({ keep: true, id: x.key, kind: 'meeting', title: x.title }); ctx.openMeeting(x.ref); return;
206
+ }
207
+ const r = rowOf(key); if (!r) return;
208
+ if (act === 'open') { open(r); return; }
209
+ if (act === 'date') { chooseDate(r, b); return; }
210
+ if (X.busy.has(key)) return;
211
+ X.busy.add(key); b.disabled = true;
212
+ try {
213
+ if (act === 'done') await done(r);
214
+ else if (act === 'tomorrow') await later(r, TM.addDays(day(), 1));
215
+ else if (act === 'drop') await drop(r);
216
+ else if (act === 'keep') await keep(r);
217
+ else if (act === 'lab-keep' || act === 'lab-drop') await lab(r, act === 'lab-keep');
218
+ } finally { X.busy.delete(key); if (b.isConnected) b.disabled = false; }
219
+ });
220
+ // the first line: Enter adds the row, and nothing else happens (no popup, no session)
221
+ el.addEventListener('submit', async (e) => {
222
+ if (e.target.id !== 'tdCapF') return;
223
+ e.preventDefault();
224
+ const i = document.getElementById('tdCap'); if (!i || !i.value.trim() || i.disabled) return;
225
+ i.disabled = true;
226
+ const r = await ctx.pmPost('/api/today-log/add', { text: i.value, day: day() }).catch(() => null);
227
+ i.disabled = false;
228
+ if (!r || !r.ok) { ctx.toast((r && r.error) || 'It was not logged. Nothing changed.'); i.focus(); return; }
229
+ X.log.entries = X.log.entries.concat(r.entry);
230
+ i.value = '';
231
+ draw();
232
+ const j = document.getElementById('tdCap'); if (j) j.focus();
233
+ });
234
+ }
235
+ return { on, draw, read };
236
+ }
@@ -0,0 +1,176 @@
1
+ /* pm/cozy-today-model.js — Today, the model (slice 5 of the six-place navigation; board 1 "Today: your log and today's agenda" on Exploring 2,
2
+ * page "Navigation: Today, Work, Goals, Events, Library, Routine"; build plan /mnt/project-files/nav-structure/build-plan.md; initiative
3
+ * today-log-page). Pure: Node imports it (today-log.test.js).
4
+ *
5
+ * The job of Today: show the few things only the PM can move today, and let them finish or move each one here, so nothing is left hanging.
6
+ *
7
+ * logModel(o) → { rows, done, counts, line } Today's log, kept the Bullet Journal way
8
+ * agendaModel(o) → { items, from, to, now, sub, empty } today's agenda, one column of hours
9
+ * dayKey(ms) · addDays(day, n) · whenWord(...)
10
+ *
11
+ * WHERE THE ROWS COME FROM. Nothing here is invented: every row is a record PMOS already reads, or a line the PM typed.
12
+ * ask the ranked asks of Your move (pm/move-rank.js rankMove: rows, then Can wait), every product Today reads. A call only the PM can
13
+ * make (a session that asks, a decision, blocked work) is one of them (kind 'call'). Job: Send for a draft to send (the outbox, a
14
+ * conversation that waits on a reply, the weekly update), else Decide.
15
+ * move the rest of Your move that is no call: the PM's own late tasks and the next steps (home-list.js move rows). Job: Do.
16
+ * item the PM's own items placed in Today (GET /api/my-work-premium, its Today tab). Job: Do.
17
+ * draft what PMOS drafted today and the PM has not seen (GET /api/phone-day finished). Job: Send.
18
+ * review the weekly review while it is open. Job: Do.
19
+ * own what the PM typed in the first line (GET /api/today-log entries): • a task (Do), ○ an event, – a note.
20
+ * lab a finding that fits no initiative (GET /api/lab loose, the old Lab): a ✦ suggestion; ✓ keeps it and starts an initiative, ✕ drops it.
21
+ * The PM's marks (GET /api/today-log marks) hide a row moved to a later day or dropped, and keep a row done today with its × bullet.
22
+ *
23
+ * MIGRATION. What is not finished is carried to the next day and says for how long: an ask from the day PMOS filed it, a task from the day
24
+ * it was due, an item from its due day (else the day it was added), an own entry from the day it was written. Carried CARRY_DROP days or
25
+ * more, PMOS suggests to drop it (one ✦ line under the row, ✓ ✕), unless the PM kept it in the last CARRY_DROP days.
26
+ * FIRST ("!"). What the PM marked first, a verdict or a grill finding on shipped or late work (move-rank's ranks 1 and 2), and a send that
27
+ * goes out today. The rest follow in the rank's order. Done rows close the table. */
28
+
29
+ export const CARRY_DROP = 30; // days carried before PMOS suggests to drop it
30
+ export const LATE_DAYS = 14; // a row carried this long reads late (the one colour in the When column)
31
+ const DAY = 864e5;
32
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
33
+ const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
34
+ const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
35
+ const DAY_RE = /^(\d{4})-(\d{2})-(\d{2})/;
36
+
37
+ /** The PM's local day of a time: YYYY-MM-DD. */
38
+ export const dayKey = (ms) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
39
+ const dayMs = (k) => { const m = DAY_RE.exec(String(k || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]).getTime() : null; };
40
+ /** The day n days after a YYYY-MM-DD day. */
41
+ export const addDays = (k, n) => { const t = dayMs(k); return t == null ? '' : dayKey(new Date(t).setDate(new Date(t).getDate() + n)); };
42
+ /** Whole days from day a to day b (b later is positive). */
43
+ const between = (a, b) => { const x = dayMs(a), y = dayMs(b); return x == null || y == null ? null : Math.round((y - x) / DAY); };
44
+ /** "2 Nov", or "2 Nov 2025" outside this year. */
45
+ const dm = (k, today) => { const m = DAY_RE.exec(String(k || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] + (m[1] !== String(today).slice(0, 4) ? ' ' + m[1] : '') : ''; };
46
+
47
+ /** The words of the When column. o: { late (days late of a dated task), due, carried (days), time, send } */
48
+ export function whenWord(o, today) {
49
+ if (o.time) return o.time;
50
+ if (o.late > 0) return dm(o.due, today) + ', ' + plural(o.late, 'day', 'days') + ' late';
51
+ if (o.carried > 0) return 'carried ' + plural(o.carried, 'day', 'days');
52
+ if (o.send) return o.send;
53
+ if (o.due && o.due === today) return 'today';
54
+ return '';
55
+ }
56
+
57
+ const SEND_KINDS = new Set(['outbox', 'mention']);
58
+ const jobOfAsk = (r) => (r.kind === 'call' ? (r.call && r.call.kind === 'update' ? 'Send' : 'Decide') : SEND_KINDS.has(r.kind) ? 'Send' : 'Decide');
59
+
60
+ /**
61
+ * o: { rank: { rows, wait } (rankMove), move: home-list move rows, items: my-work-premium Today rows ({ key, id, title, ini, at, due?, overdue }),
62
+ * drafts: [{ id, title, ini? }], review: { title } | null, own: today-log entries, marks: today-log marks, lab: [{ ws, board, id, title, why }],
63
+ * titleOf(ini) → the initiative's name, now }
64
+ * A row: { key, src, bullet, first, title, work, ini, ws, job, when, late, carried, done, dates: 'task' | 'item' | 'mark', drop, ref }
65
+ */
66
+ export function logModel(o = {}) {
67
+ const now = o.now || Date.now(), today = dayKey(now);
68
+ const marks = o.marks || {}, titleOf = typeof o.titleOf === 'function' ? o.titleOf : () => '';
69
+ const out = [], seen = new Set();
70
+ const work = (ini, fallback) => (ini ? titleOf(ini) || fallback || '' : fallback || '');
71
+ const put = (r) => {
72
+ if (!r.key || seen.has(r.key)) return;
73
+ seen.add(r.key);
74
+ const m = marks[r.key] || {};
75
+ if (m.dropped) return;
76
+ if (m.until && m.until > today) return;
77
+ const done = !!m.done || !!r.done;
78
+ const drop = !done && r.carried >= CARRY_DROP && !(m.kept && between(m.kept, today) < CARRY_DROP) && r.src !== 'lab';
79
+ out.push({ first: false, bullet: 'task', work: '', ini: null, ws: '', job: '', when: '', late: false, carried: 0, dates: 'mark', ...r, done, drop });
80
+ };
81
+ // the asks, in the rank's order: the first five, then Can wait
82
+ const rank = o.rank || {};
83
+ const asks = (rank.rows || []).concat(rank.wait || []);
84
+ const callIds = new Set();
85
+ for (const r of asks) {
86
+ if (!r || !r.key || r.kind === 'extra' && r.go === 'lab') continue; // the Lab's findings are their own rows (below)
87
+ const c = r.kind === 'call' ? r.call || {} : null;
88
+ if (c) callIds.add(c.id);
89
+ const carried = c ? 0 : Math.max(0, r.days || 0);
90
+ const send = c && c.when ? 'goes out ' + c.when : '';
91
+ put({ key: c ? 'call:' + c.id : r.key, src: 'ask', bullet: 'task', title: r.title || (c && c.name) || '', ini: r.ini || (c && c.ini) || null, ws: r.ws || '',
92
+ work: work(r.ini || (c && c.ini), c ? c.sub : (r.shared || [])[0] || ''), job: jobOfAsk(r), carried, late: carried >= LATE_DAYS,
93
+ when: whenWord({ carried, send }, today), first: r.rank <= 2 || (c && c.kind === 'update' && /^(today|now)/i.test(String(c.when || ''))) || false, ref: r });
94
+ }
95
+ // the rest of Your move: the PM's own late tasks and the next steps (a call is in the asks already; an item is in the items)
96
+ for (const r of o.move || []) {
97
+ if (!r || !r.id || callIds.has(r.id) || r.call || r.kind === 'item' || r.kind === 'update' || r.kind === 'session') continue;
98
+ const due = r.due || (r.task && r.task.end) || '';
99
+ const late = r.kind === 'task' && due && due < today ? between(due, today) : 0;
100
+ put({ key: r.id, src: 'move', bullet: 'task', title: r.name, ini: r.ini || null, work: work(r.ini, r.sub), job: 'Do', late: late > 0, carried: late,
101
+ when: whenWord({ late, due }, today), dates: r.kind === 'task' ? 'task' : 'mark', ref: r });
102
+ }
103
+ // the PM's own items placed in Today
104
+ for (const it of o.items || []) {
105
+ if (!it || !it.id) continue;
106
+ const from = it.due && it.due < today ? it.due : !it.due && it.at ? dayKey(Date.parse(it.at)) : '';
107
+ const carried = from && from < today ? between(from, today) : 0;
108
+ put({ key: 'work:' + it.id, src: 'item', bullet: 'task', title: it.title, ini: it.ini || null, work: work(it.ini, ''), job: 'Do', carried, late: !!it.overdue || carried >= LATE_DAYS,
109
+ when: whenWord({ carried, due: it.due }, today), dates: 'item', ref: it });
110
+ }
111
+ for (const d of o.drafts || []) if (d && d.id) put({ key: 'draft:' + d.id, src: 'draft', bullet: 'task', title: d.title, ini: d.ini || null, work: work(d.ini, ''), job: 'Send', ref: d });
112
+ if (o.review && o.review.title) put({ key: 'review:' + today, src: 'review', bullet: 'task', title: o.review.title, job: 'Do', ref: o.review });
113
+ // what the PM typed: a task, an event or a note, carried from the day it was written until it is done
114
+ for (const e of o.own || []) {
115
+ if (!e || !e.key) continue;
116
+ const carried = e.day && e.day < today && !e.done ? between(e.day, today) : 0;
117
+ put({ key: e.key, src: 'own', bullet: e.bullet, first: !!e.first, title: e.text, job: e.bullet === 'task' ? 'Do' : '', carried, late: carried >= LATE_DAYS,
118
+ when: whenWord({ carried, time: e.bullet === 'event' && !carried ? e.time : '' }, today), done: !!e.done, ref: e });
119
+ }
120
+ for (const f of o.lab || []) if (f && f.id) put({ key: 'lab:' + (f.ws || '') + ':' + f.id, src: 'lab', bullet: 'lab', title: f.title, work: '', job: 'Decide', why: f.why || '', ref: f });
121
+ // a row done today whose source has let it go keeps its × from what it said when it was done
122
+ for (const [k, m] of Object.entries(marks)) {
123
+ if (!m || !m.done || seen.has(k) || !m.snap) continue;
124
+ seen.add(k);
125
+ out.push({ key: k, src: 'gone', bullet: 'task', first: false, title: m.snap.title || '', work: m.snap.work || '', ini: null, ws: '', job: m.snap.job || '', when: '', late: false, carried: 0, done: true, drop: false, dates: 'mark', ref: null });
126
+ }
127
+ const open = out.filter((r) => !r.done), done = out.filter((r) => r.done);
128
+ const rows = open.filter((r) => r.first).concat(open.filter((r) => !r.first));
129
+ const n = (j) => open.filter((r) => r.job === j).length;
130
+ const counts = { decide: n('Decide'), do: n('Do'), send: n('Send'), notes: open.filter((r) => r.bullet === 'note').length, events: open.filter((r) => r.bullet === 'event').length };
131
+ // one quiet line counts the log; a part that is zero is left out
132
+ const line = [counts.decide && counts.decide + ' to decide', counts.do && counts.do + ' to do', counts.send && counts.send + ' to send'].filter(Boolean).join(' · ');
133
+ return { rows: rows.concat(done), open: rows.length, done: done.length, counts, line, today };
134
+ }
135
+
136
+ /* ── today's agenda ── */
137
+ const span = (m) => { const a = Date.parse(m.start); const b = m.end ? Date.parse(m.end) : a + (m.minutes || 30) * 60000; return { a, b: b > a ? b : a + 30 * 60000 }; };
138
+ const hm = (ms) => { const d = new Date(ms); return String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0'); };
139
+ /** The free stretches of 30 minutes or more between now (or 09:00) and 18:00, between the agenda's items. Minutes, summed. */
140
+ function freeMinutes(items, now) {
141
+ const d0 = new Date(now); d0.setHours(9, 0, 0, 0); const d1 = new Date(now); d1.setHours(18, 0, 0, 0);
142
+ let at = Math.max(now, d0.getTime()), free = 0;
143
+ for (const x of items.slice().sort((p, q) => p.a - q.a)) { if (x.b <= at) continue; if (x.a - at >= 30 * 60000) free += Math.min(x.a, d1.getTime()) - at; at = Math.max(at, x.b); }
144
+ if (d1.getTime() - at >= 30 * 60000) free += d1.getTime() - at;
145
+ return Math.max(0, Math.round(free / 60000));
146
+ }
147
+ const durWord = (mins) => (mins >= 60 ? (Math.round(mins / 30) / 2).toString().replace(/\.0$/, '') + ' h' : mins + ' min');
148
+
149
+ /** o: { meetings: brief-page today rows ({ id, title, start, end?, minutes?, state, initiative? }), own: today-log events of today with a
150
+ * time, iniOf(m) → the meeting's initiative id or null, now }.
151
+ * → { items: [{ key, kind: 'meeting' | 'own', title, sub, a, b, top, h, ini, ref, past, nowOn }], from, to (whole hours), now (ms or null
152
+ * outside the hours), sub ("Wed 18 Nov · 2 h free"), empty } */
153
+ export function agendaModel(o = {}) {
154
+ const now = o.now || Date.now(), today = dayKey(now), iniOf = typeof o.iniOf === 'function' ? o.iniOf : () => null;
155
+ const items = [];
156
+ for (const m of o.meetings || []) {
157
+ if (!m || !m.start || Number.isNaN(Date.parse(m.start)) || dayKey(Date.parse(m.start)) !== today) continue;
158
+ const s = span(m);
159
+ items.push({ key: 'm:' + (m.id || m.start + m.title), kind: 'meeting', title: m.title || 'Meeting', sub: hm(s.a) + ' to ' + hm(s.b), a: s.a, b: s.b, ini: iniOf(m) || null, ref: m });
160
+ }
161
+ for (const e of o.own || []) {
162
+ if (!e || e.bullet !== 'event' || !e.time || e.day !== today || e.done) continue;
163
+ const [h, mi] = e.time.split(':').map(Number); const a = new Date(now); a.setHours(h, mi, 0, 0);
164
+ items.push({ key: e.key, kind: 'own', title: e.text, sub: e.time + ' · your event', a: a.getTime(), b: a.getTime() + 30 * 60000, ini: null, ref: e });
165
+ }
166
+ items.sort((x, y) => x.a - y.a);
167
+ const first = items.length ? new Date(items[0].a).getHours() : 8, last = items.length ? Math.max(...items.map((x) => new Date(x.b - 1).getHours() + 1)) : 18;
168
+ const from = Math.min(8, first), to = Math.max(18, Math.min(24, last));
169
+ const base = new Date(now); base.setHours(from, 0, 0, 0);
170
+ const H = 60 * 60000;
171
+ for (const x of items) { x.top = (x.a - base.getTime()) / H; x.h = Math.max(0.5, (x.b - x.a) / H); x.past = x.b <= now; x.nowOn = x.a <= now && now < x.b; }
172
+ const t = (now - base.getTime()) / H;
173
+ const d = new Date(now), free = freeMinutes(items, now);
174
+ const sub = DOW[d.getDay()] + ' ' + d.getDate() + ' ' + MON[d.getMonth()] + (free ? ' · ' + durWord(free) + ' free' : '');
175
+ return { items, from, to, now: t >= 0 && t <= to - from ? t : null, sub, empty: !items.length };
176
+ }
@@ -0,0 +1,100 @@
1
+ /* pm/cozy-today-page.css — Today, the place (slice 5 of the six-place navigation; board 1 on Exploring 2; pm/cozy-today-view.js draws it).
2
+ * today.html on a desk: the white page panel (#hmDesk) holds Today only. Home's list and chat column are not drawn; the chat is the
3
+ * popup's (pm/cozy-popup.js). One container: the log is one card with a thin border, the agenda one grey box on the right.
4
+ * Token vars only (cozy.css :root holds every raw value, and its dark block the dark ones). Nothing animates. The phone keeps Home. */
5
+
6
+ @media (min-width: 761px) {
7
+ body.cz-today #hmDesk > .hm-list, body.cz-today #hmDesk > .hm-chat, body.cz-today #hmDesk > .cz-pn-div, body.cz-today #hmUnfold, body.cz-today .hm-top { display: none !important; }
8
+ /* the white page panel: the only big container, beside the rail (as the Board's) */
9
+ body.cz-home.cz-today #hmDesk { display: block; overflow: auto; top: 16px; right: 16px; bottom: 16px; left: var(--cz-railx, 16px); padding: 28px 32px 32px; background: var(--cz-card); border-radius: 28px; box-shadow: var(--cz-lift); }
10
+ body.cz-today .td-page { display: block; max-width: 1360px; margin: 0 auto; }
11
+ /* a thing that still opens beside the page (the PM's "open work beside the page", a deep link) slides over Today on the right:
12
+ the one slide-over of the panel rule, so Today is never squeezed or covered by a column it does not own */
13
+ body.cz-today #hmDesk > .hm-vw { position: fixed; top: 16px; right: 16px; bottom: 16px; z-index: 40; border-radius: 24px; box-shadow: var(--cz-lift); background: var(--cz-card); }
14
+ body.cz-today #hmDesk > .hm-vw .cz-vw { width: min(520px, calc(100vw - var(--cz-railx, 16px) - 120px)); flex-basis: auto; }
15
+ }
16
+ .td-page[hidden] { display: none !important; }
17
+
18
+ .td { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; font-family: var(--cz-sans); color: var(--cz-ink); }
19
+ @media (max-width: 1100px) { .td { grid-template-columns: minmax(0, 1fr); } }
20
+ .td h2 { margin: 0; font-size: var(--fs-section); font-weight: var(--fw-strong); line-height: var(--lh-section); color: var(--cz-ink); }
21
+ .td-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
22
+ .td button { font-family: var(--cz-sans); }
23
+
24
+ /* the title and its one quiet line */
25
+ .td-h { display: flex; align-items: baseline; gap: 12px; margin: 0 0 12px; }
26
+ .td-sum { font-size: var(--fs-meta); color: var(--cz-ink3); }
27
+
28
+ /* the capture line */
29
+ .td-in { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 14px; background: var(--cz-well); margin: 0 0 12px; box-sizing: border-box; }
30
+ .td-in:focus-within { box-shadow: inset 0 0 0 1.5px var(--cz-blue); }
31
+ .td-in-l { display: inline-flex; color: var(--cz-ink3); cursor: text; }
32
+ .td-in input { flex: 1 1 auto; min-width: 0; border: 0; background: none; font: inherit; font-size: var(--fs-row); color: var(--cz-ink); outline: none; }
33
+ .td-in input::placeholder { color: var(--cz-ink3); }
34
+ .td-key { flex: none; font-size: var(--fs-meta); color: var(--cz-ink3); letter-spacing: .02em; white-space: nowrap; }
35
+ .td-key em { font-style: normal; margin: 0 10px 0 3px; }
36
+ .td-key em:last-child { margin-right: 0; }
37
+ @media (max-width: 980px) { .td-key { display: none; } }
38
+
39
+ /* the log: one card, one row height, one text size */
40
+ .td-tt { border-radius: 16px; box-shadow: inset 0 0 0 1px var(--cz-hair); background: var(--cz-card); overflow: hidden; }
41
+ .td-r { display: grid; grid-template-columns: 18px 20px minmax(0, 1fr) minmax(0, 160px) 56px 128px 92px; align-items: center; column-gap: 8px; min-height: 44px; padding: 0 12px; font-size: var(--fs-row); line-height: var(--lh-row); }
42
+ .td-r + .td-r { box-shadow: inset 0 1px 0 var(--cz-hair); }
43
+ .td-hd { min-height: 36px; background: var(--cz-well); font-size: var(--fs-meta); font-weight: var(--fw-strong); color: var(--cz-ink3); }
44
+ .td-p b { color: var(--cz-late); font-weight: var(--fw-strong); display: block; text-align: center; }
45
+ .td-b i { font-style: normal; display: block; text-align: center; font-size: var(--fs-panel); line-height: 1; color: var(--cz-ink); }
46
+ .td-r.lab .td-b i { color: var(--cz-blueink); font-size: var(--fs-badge); }
47
+ .td-wt { min-width: 0; }
48
+ .td-t { display: block; max-width: 100%; text-align: left; border: 0; background: none; padding: 0; font: inherit; font-weight: var(--fw-strong); color: var(--cz-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
49
+ button.td-t { cursor: pointer; }
50
+ button.td-t:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; border-radius: 4px; }
51
+ .td-r.note .td-t { font-weight: var(--fw-regular); color: var(--cz-ink2); }
52
+ .td-w { font-size: var(--fs-meta); color: var(--cz-ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
53
+ .td-k { font-size: var(--fs-meta); font-weight: var(--fw-strong); color: var(--cz-ink2); }
54
+ .td-d { font-size: var(--fs-meta); color: var(--cz-ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
55
+ .td-d.late { color: var(--cz-late); font-weight: var(--fw-strong); }
56
+ .td-a { display: flex; gap: 2px; justify-content: flex-end; opacity: 0; }
57
+ .td-r:hover, .td-r:focus-within { background: var(--cz-well); }
58
+ .td-hd:hover { background: var(--cz-well); }
59
+ .td-r:hover .td-a, .td-r:focus-within .td-a { opacity: 1; }
60
+ @media (hover: none) { .td-a { opacity: 1; } }
61
+ .td-ib { width: 28px; height: 28px; border-radius: 8px; border: 0; padding: 0; background: none; color: var(--cz-ink2); display: inline-grid; place-items: center; cursor: pointer; flex: none; }
62
+ .td-ib:hover { background: var(--cz-card); color: var(--cz-ink); }
63
+ .td-ib:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
64
+ .td-ib:disabled { opacity: .45; cursor: default; }
65
+ .td-r.done .td-t, .td-r.done .td-w, .td-r.done .td-k { color: var(--cz-ink3); font-weight: var(--fw-regular); text-decoration: line-through; text-decoration-color: var(--cz-hair); }
66
+ .td-r.done .td-b i { color: var(--cz-ink3); }
67
+
68
+ /* a suggestion under its row: ✦ and one sentence, ✓ ✕ */
69
+ .td-sg { grid-column: 3 / -1; display: flex; align-items: center; gap: 8px; padding: 0 0 10px; font-size: var(--fs-meta); color: var(--cz-ink2); }
70
+ .td-sg b { color: var(--cz-blueink); font-weight: var(--fw-strong); }
71
+ .td-sg .td-ib { width: 26px; height: 26px; border-radius: 999px; background: var(--cz-card); box-shadow: inset 0 0 0 1px var(--cz-hair); }
72
+ .td-sg.lab { color: var(--cz-ink3); }
73
+ .td-none { margin: 6px 2px; font-size: var(--fs-row); color: var(--cz-ink3); }
74
+ .td-more { margin-top: 10px; border: 0; background: none; padding: 4px 2px; font-size: var(--fs-meta); font-weight: var(--fw-strong); color: var(--cz-blueink); cursor: pointer; }
75
+
76
+ /* today's agenda: one grey box */
77
+ .td-ag { border-radius: 20px; background: var(--cz-well); padding: 16px 16px 14px; box-sizing: border-box; }
78
+ .td-agh { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; }
79
+ .td-agh small { font-size: var(--fs-meta); color: var(--cz-ink3); margin-right: auto; }
80
+ .td-agh .td-ib { align-self: center; }
81
+ .td-tl { position: relative; height: calc(var(--rows) * var(--px)); margin: 6px 0 4px 46px;
82
+ background-image: repeating-linear-gradient(to bottom, var(--cz-hair) 0, var(--cz-hair) 1px, transparent 1px, transparent var(--px)); }
83
+ .td-hr { position: absolute; left: -46px; top: var(--y); transform: translateY(-50%); font-size: var(--fs-badge); color: var(--cz-ink3); }
84
+ .td-ev { position: absolute; left: 4px; right: 0; top: var(--y); height: var(--h); box-sizing: border-box; overflow: hidden; border: 0; border-radius: 10px; padding: 5px 9px; text-align: left;
85
+ background: var(--cz-card); box-shadow: inset 0 0 0 1px var(--cz-hair); font: inherit; color: var(--cz-ink); display: flex; flex-direction: column; gap: 1px; }
86
+ button.td-ev { cursor: pointer; }
87
+ button.td-ev:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
88
+ .td-ev b { font-size: var(--fs-meta); font-weight: var(--fw-strong); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
89
+ .td-ev small { font-size: var(--fs-badge); color: var(--cz-ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
90
+ .td-ev.short { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 0; padding-bottom: 0; }
91
+ .td-ev.short small { flex: none; }
92
+ .td-ev.own { background: none; box-shadow: inset 0 0 0 1.5px var(--cz-hair); }
93
+ .td-ev.on { box-shadow: inset 0 0 0 1.5px var(--cz-blue); }
94
+ .td-ev.past b { color: var(--cz-ink3); }
95
+ .td-now { position: absolute; left: -6px; right: 0; top: var(--y); height: 2px; background: var(--cz-late); }
96
+ .td-now::before { content: ''; position: absolute; left: -3px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--cz-late); }
97
+
98
+ /* the date chooser beside a row (set a date) */
99
+ .td-dp { position: fixed; z-index: 80; display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 14px; background: var(--cz-card); box-shadow: var(--cz-lift); }
100
+ .td-dp input { font: inherit; font-size: var(--fs-row); color: var(--cz-ink); background: var(--cz-well); border: 0; border-radius: 10px; padding: 6px 8px; color-scheme: light dark; }