create-pmos 0.421.0 → 0.422.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 (68) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/scripts/anchor-resolve.js +93 -15
  6. package/payload/state/discoveries.md +1 -1
  7. package/workspace/board-programs-test.js +59 -3
  8. package/workspace/briefing-premium-board-test.js +1 -1
  9. package/workspace/changelog.json +12 -0
  10. package/workspace/fixtures/report-api/draft.json +2 -1
  11. package/workspace/guide/briefing-premium.md +1 -0
  12. package/workspace/guide/home.md +5 -2
  13. package/workspace/guide/programs.md +4 -3
  14. package/workspace/home-other-product-test.js +55 -0
  15. package/workspace/lib/board-premium.js +18 -4
  16. package/workspace/lib/doc-live-root.js +37 -0
  17. package/workspace/lib/engine/anchor-resolve.js +93 -15
  18. package/workspace/lib/engine/boards.js +7 -2
  19. package/workspace/lib/engine/intake.js +1 -1
  20. package/workspace/lib/hold-spans.js +24 -10
  21. package/workspace/lib/kg.js +1 -1
  22. package/workspace/lib/report-draft.js +3 -0
  23. package/workspace/lib/route-modules.js +1 -0
  24. package/workspace/lib/routes-board-premium.js +6 -0
  25. package/workspace/lib/routes-boards.js +48 -9
  26. package/workspace/lib/routes-doc-sheet.js +29 -1
  27. package/workspace/lib/routes-programs.js +44 -5
  28. package/workspace/lib/routes-task-plans.js +333 -0
  29. package/workspace/lib/task-cli.js +16 -9
  30. package/workspace/lib/task-items.js +1 -1
  31. package/workspace/lib/task-plans.js +232 -0
  32. package/workspace/lib/vendor/scripts/anchor-resolve.js +93 -15
  33. package/workspace/lib/vendor/scripts/intake.js +1 -1
  34. package/workspace/package-lock.json +2 -2
  35. package/workspace/package.json +1 -1
  36. package/workspace/premium-vw-doc-test.js +26 -3
  37. package/workspace/program-leave-test.js +203 -0
  38. package/workspace/public/pm/bd-acts.js +5 -2
  39. package/workspace/public/pm/bd-ini-panel.js +20 -7
  40. package/workspace/public/pm/bd-prog-panel.js +22 -7
  41. package/workspace/public/pm/bd-span.js +175 -25
  42. package/workspace/public/pm/cozy-board.css +80 -0
  43. package/workspace/public/pm/cozy-home.css +3 -0
  44. package/workspace/public/pm/doc-follow.js +36 -0
  45. package/workspace/public/pm/home-app.js +38 -7
  46. package/workspace/public/pm/home-ini.js +11 -2
  47. package/workspace/public/pm/home-list.js +2 -2
  48. package/workspace/public/pm/home-today.js +3 -1
  49. package/workspace/public/pm/ini-tasks.js +81 -16
  50. package/workspace/public/pm/ini-versions.js +343 -0
  51. package/workspace/public/pm/ini-view-model.js +27 -41
  52. package/workspace/public/pm/ini-view.css +82 -0
  53. package/workspace/public/pm/ini-view.js +17 -10
  54. package/workspace/public/pm/premium-board.js +109 -18
  55. package/workspace/public/pm/premium-report-read.js +20 -1
  56. package/workspace/public/pm/premium-shell.js +29 -4
  57. package/workspace/public/pm/premium-vw-doc.js +46 -11
  58. package/workspace/public/pm/prog-move.js +69 -0
  59. package/workspace/public/pm/task-card.css +3 -0
  60. package/workspace/public/pm/task-card.js +10 -3
  61. package/workspace/task-milestones-test.js +176 -0
  62. package/workspace/task-plans-test.js +175 -0
  63. package/workspace/task-views-test.js +2 -2
  64. package/workspace/test-lists/program-leave.json +6 -0
  65. package/workspace/test-lists/task-milestones.json +6 -0
  66. package/workspace/test-lists/task-plans.json +6 -0
  67. package/workspace/test-lists/viewer-live-file.json +9 -0
  68. package/workspace/timeline-holds-test.js +61 -4
@@ -26,6 +26,7 @@ import * as SC from './home-stage-card.js'; // the initiative's stage card D
26
26
  import * as WFM from './ini-wf-model.js'; // D99: the workflow an initiative runs (kind line, usual days)
27
27
  import { wfIcon, wfOf } from './wf-model.js';
28
28
  import { iniView } from './ini-view-model.js'; // the one initiative view (batch 6 item 1): the same model the Board's panel draws
29
+ import { rowFor } from './ini-versions.js'; // planned versus actual (batch 11 item 8): Live or the draft the PM shows, with the plan line
29
30
  import { programOf } from './program-model.js';
30
31
  import { startAgent } from './page-agent.js';
31
32
  import { mdHtml } from './chat-md.js';
@@ -39,6 +40,7 @@ import { mountIni, iniList, iniOverview, iniPage } from './home-ini.js'; // th
39
40
  import * as MEN from './home-mentions.js'; // @Mentions, the permanent row at the top of Home and its Viewer (Viewer kit, XvANew)
40
41
  import { mountRecRow, clockOf as recClock } from './home-rec-row.js';
41
42
  import { mountSesName } from './home-ses-name.js'; // session names A: tap the session's name to rename it (canvas XmsNames)
43
+ import * as PM from './prog-move.js'; // move an initiative out of its program, or to another (canvas LpA1More, LpA2Other, LpA4Phone)
42
44
  import * as PO from './prog-order.js'; // a program's order on Home: the grip, hold-then-drag on a phone, ✦ Claude's order from the dates (canvas RoAPhone)
43
45
  import { initiativeRename, taskRename } from './rename-press.js'; // tap the title to rename (canvas RnATask, RnASaved) // the pinned recording row above it (XvARecHome)
44
46
 
@@ -87,6 +89,7 @@ const S = {
87
89
  sel: null, // the selected row's id
88
90
  allNeeds: false, kids: new Set(), shut: new Set(JSON.parse(store.get('pmos.home.shut') || '[]')), folded: store.get('pmos.home.fold') === '1',
89
91
  IM: null, IMid: null, // the selected initiative's model (GET /api/initiative-premium)
92
+ iniWs: {}, // another product's initiative found by a read (loadIni), by id: the workspace it was found in
90
93
  doneOpen: false, stepsMore: false, sheet: false, rec: {}, pin: new Set(JSON.parse(store.get('pmos.home.pin') || '[]')),
91
94
  cardFold: store.get('pmos.home.cardfold') === '1', // the card's checklist folded to one line (AgInitSpec), kept in this browser
92
95
  // the one list (premium-uncovered-features): the filter, the picked product, which groups and initiatives are open, kept in this browser
@@ -120,7 +123,9 @@ const taskRenameOf = (t) => taskRename({ pmPost, ws: t.ws || boardWs(), board: t
120
123
  toastUndo('Renamed', async () => { const u = await o.undo(); if (u.ok) { renamedHere('task', t.uid, u.title); t.title = u.title; { const c = VW.current(); if (c && String(c.id).endsWith(t.uid)) VW.retitle(c.id, u.title); } load(); } return u; });
121
124
  load();
122
125
  } });
123
- const iniRenameOf = (id, prefix) => initiativeRename({ pmPost, ws: WS || undefined, id, epics: ((H.boardRows(S.D).find((r) => r.id === id) || {}).epics) || [],
126
+ // another product's initiative renames in ITS workspace, not Home's (batch 11 item 9: "no initiative psle-microsite-revamp")
127
+ const iniWsOf = (id) => { const o = otherIni(id); return (o && o.ws) || WS || undefined; };
128
+ const iniRenameOf = (id, prefix) => initiativeRename({ pmPost, ws: iniWsOf(id), id, epics: ((iniRowOf(id) || {}).epics) || [],
124
129
  onSaved: (o) => {
125
130
  renamedHere('ini', id, o.title);
126
131
  if (o.jira) { S.phoneChat = isPhone(); openTarget(iniTarget(id)); setTimeout(() => { const ta = $('#hmIn'); if (ta) { ta.value = o.jira; ta.dispatchEvent(new Event('input', { bubbles: true })); ta.focus(); } }, 0); }
@@ -188,7 +193,15 @@ async function loadIni() {
188
193
  if (!id || id === 'product') { S.IM = null; S.IMid = id; S.D.files = []; return; }
189
194
  // an initiative of another product is read from its own board, not this one (it is not on this board, so the read said it could not be read)
190
195
  const oi = otherIni(id), b = oi ? { ws: oi.ws, id: oi.board } : (S.D.board && S.D.board.board) || {};
191
- const r = await getRetry('/api/initiative-premium?id=' + encodeURIComponent(id) + (b.ws ? '&ws=' + encodeURIComponent(b.ws) : wsQ('&')) + (b.id ? '&board=' + encodeURIComponent(b.id) : boardQ('&')), 16);
196
+ // another product's board unknown: its own workspace's default board, never this board's id
197
+ let r = await getRetry('/api/initiative-premium?id=' + encodeURIComponent(id) + (b.ws ? '&ws=' + encodeURIComponent(b.ws) : wsQ('&')) + (b.id ? '&board=' + encodeURIComponent(b.id) : oi ? '' : boardQ('&')), 16);
198
+ // not on this board and on no list Home read (batch 11 item 10): try each other product Home reads, and remember where it was found
199
+ if (!(r && r.ok && r.model) && !oi) {
200
+ for (const o of S.D.others || []) {
201
+ const t = await getRetry('/api/initiative-premium?id=' + encodeURIComponent(id) + '&ws=' + encodeURIComponent(o.ws), 4);
202
+ if (t && t.ok && t.model) { S.iniWs[id] = o.ws; r = t; break; }
203
+ }
204
+ }
192
205
  S.IM = r && r.ok && r.model ? r.model : null; S.IMid = id;
193
206
  if (S.IM) { import('./premium-vw-jira.js').catch(() => {}); import('./premium-vw-item.js').catch(() => {}); } // the Overview's ticket, sprint and record views, ready before a press
194
207
  S.D.files = S.IM ? (S.IM.docs.rows || []).filter((d) => d.path).map((d) => ({ name: d.title, path: d.path, meta: [d.state, d.when].filter(Boolean).join(' · ') })) : [];
@@ -299,7 +312,7 @@ function iniViewOf(id) {
299
312
  const B = S.D.board || {}, t = S.D.trail && S.D.trail.items && S.D.trail.items[id];
300
313
  const need = H.needsOf(S.D).find((r) => r.ini === id);
301
314
  const p = programOf(S.D.programs || [], row.ws || (B.board || {}).ws || '', id);
302
- return iniView({ ...row, trail: t || row.trail || null }, { steps: B.steps || STEPS, today: B.today, usual: WFM.usualOf(S.D.trail, row),
315
+ return iniView(rowFor({ ...row, trail: t || row.trail || null }), { steps: B.steps || STEPS, today: B.today, usual: WFM.usualOf(S.D.trail, row),
303
316
  ask: need ? { title: need.name } : null, program: p ? { id: p.id, title: p.title } : null });
304
317
  }
305
318
  /** An initiative no board Home reads holds (its own read only, GET /api/initiative-premium): the row the one view needs, from that read. */
@@ -318,7 +331,13 @@ function otherIni(id) {
318
331
  const row = rows.find((r) => r.id === id);
319
332
  if (row) return { ws: o.ws, board: (o.model.board || {}).id || null, row };
320
333
  }
321
- return null;
334
+ // one the board lists do not hold (batch 11 item 10): `pmos initiative new` puts it in Later, and a product's model lists only Now and the
335
+ // late and at-risk rows. Its next step names its workspace, or a read found it there (loadIni)
336
+ const own = boardWs(), need = H.needsOf(S.D).find((x) => x.ini === id && x.row && x.row.ws && x.row.ws !== own);
337
+ const ws = (need && need.row.ws) || S.iniWs[id];
338
+ if (!ws || ws === own) return null;
339
+ const o = (S.D.others || []).find((x) => x && x.ws === ws);
340
+ return { ws, board: (o && o.model && o.model.board && o.model.board.id) || null, row: need && need.row.subject ? { id, title: String(need.row.subject).split(' · ')[0], made: true } : null };
322
341
  }
323
342
  function headOf(id) {
324
343
  const row = iniRowOf(id) || {};
@@ -558,7 +577,8 @@ async function workItem(text, t) {
558
577
  const r = await pmPost('/api/home-desk/work-item', { ws: b.ws || WS || undefined, initiative: ini, text, key: (t && (t.key || t.sid)) || '' });
559
578
  toast(r && r.ok ? 'Drafted ' + (r.id || 'a work-item') + ' in ' + iniTitle(ini) + '. Nothing reaches Jira until your Commit.' : (r && r.error) || 'The work-item was not drafted.');
560
579
  }
561
- const iniTitle = (id) => (id === 'product' ? H.productName(S.D) + ' · product' : (iniRowOf(id) || {}).title || (S.IM && S.IM.title) || id);
580
+ // a row made from a next step (otherIni) carries its clipped subject: the initiative's own title wins once it is read
581
+ const iniTitle = (id) => { if (id === 'product') return H.productName(S.D) + ' · product'; const r = iniRowOf(id) || {}, m = S.IM && S.IMid === id ? S.IM.title : null; return (r.made && m) || r.title || (S.IM && S.IM.title) || id; };
562
582
  const scopeOf = (ini) => (ini ? { text: iniTitle(ini), icon: I.flag } : { text: 'All work', icon: I.home, loose: false });
563
583
  const rich = () => !!S.ini;
564
584
  function iniTarget(id) {
@@ -689,6 +709,16 @@ async function turnProgram(id) {
689
709
  toast('Now a program · ' + iniTitle(id) + '.');
690
710
  await load(); goProgram(res.program.id);
691
711
  }
712
+ /** The page's ⋯ items for an initiative in a program (pm/prog-move.js): Move out of it, Move to another program. openList is home-ini.js's menu. */
713
+ function moveItems(id, openList) {
714
+ const row = iniRowOf(id) || {}, o = otherIni(id), B = S.D.board || {};
715
+ const other = o ? ((S.D.others || []).find((x) => x && x.ws === o.ws) || {}).model || {} : null;
716
+ const product = other ? (o.row && o.row.product) || (other.board || {}).product || (other.board || {}).name || '' : H.productName(S.D);
717
+ return PM.moveItems({ programs: () => S.D.programs || [], ws: row.ws || (o && o.ws) || (B.board || {}).ws || '', id, product, pmPost, phone: isPhone, openList,
718
+ say: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)),
719
+ stateOf: (p) => (((S.M && S.M.groups) || []).find((g) => g.kind === 'program' && g.program.id === p.id) || {}).st || null,
720
+ reload: async () => { await load(); if (S.ini === id && VW.isOpen()) iniPage(); } });
721
+ }
692
722
  /** A program's conversation (?ask=program:<id>, a program task's row): Claude with the program as its scope. task names the open row. */
693
723
  function programTarget(id, task) {
694
724
  const pr = (S.D.programs || []).find((p) => p && p.id === id) || { id, title: (P.get('label') || '').slice(0, 80) || id };
@@ -1093,7 +1123,8 @@ async function openFile(f) {
1093
1123
  if (typeof V.openDoc === 'function') { try { return V.openDoc(f.path, { ws: deskWs() }); } catch { /* the plain view below */ } }
1094
1124
  // a Markdown document opens as its page (premium-vw-doc.js): read, edit, its edit log, health, relations and copies, in the Viewer
1095
1125
  const fws = () => (S.ini && S.IM && S.IM.board && S.IM.board.ws) || deskWs(); // an initiative's document lives in its board's workspace
1096
- if (/\.md$/i.test(f.path)) { try { const M = await import('./premium-vw-doc.js'); if (M.openDocPage({ path: f.path, title: f.name || f.path.split('/').pop() }, { ws: () => fws() })) return; } catch { /* the plain view below */ } }
1126
+ const ini = S.ini || ''; // its chat edits the document in the initiative's own worktree: the page reads it there (premium-vw-doc.js)
1127
+ if (/\.md$/i.test(f.path)) { try { const M = await import('./premium-vw-doc.js'); if (M.openDocPage({ path: f.path, title: f.name || f.path.split('/').pop() }, { ws: () => fws(), ini })) return; } catch { /* the plain view below */ } }
1097
1128
  const body = VW.open({ id: 'file:' + f.path, kind: 'File · ' + f.path, title: f.name || f.path, icon: 'doc', html: '<p class="hx-n hv">Reading the file.</p>' });
1098
1129
  let txt = null;
1099
1130
  try { const r = await fetch('/api/doc?path=' + encodeURIComponent(f.path) + (deskWs() ? '&ws=' + encodeURIComponent(deskWs()) : ''), { credentials: 'same-origin' }); txt = r.ok ? await r.text() : null; } catch { txt = null; }
@@ -1482,7 +1513,7 @@ function cta() {
1482
1513
  mountIni({ S, VW, pmGet, pmPost, toast, rowOf: (id) => iniRowOf(id), renameIni: (id, pre) => iniRenameOf(id, pre), renameTask: (t) => taskRenameOf(t), load: () => load(), loadIni: () => loadIni(), openFile: (f) => openFile(f), iniTitle: (id) => iniTitle(id), drawList: () => drawList(), wait: MORE.WAIT,
1483
1514
  // the initiative's page (HbCDesk): its card, its header and its ⋯
1484
1515
  openBoardTask: (t) => openBoardTask(t),
1485
- cardHtml: (id, o) => cardHtml(id, o), kindOf: (id) => kindOf(id), cta: () => cta(), overviewAsk: (id) => overviewAsk(id), newIn: (id) => newIn(id), addPerson: () => addPerson(), turnProgram: (id) => turnProgram(id), talk: () => talk(), view: (id) => iniViewOf(id), head: (id) => (S.H = headOf(id)), goProgram: (id) => goProgram(id),
1516
+ cardHtml: (id, o) => cardHtml(id, o), kindOf: (id) => kindOf(id), cta: () => cta(), overviewAsk: (id) => overviewAsk(id), newIn: (id) => newIn(id), addPerson: () => addPerson(), turnProgram: (id) => turnProgram(id), moveItems: (id, openList) => moveItems(id, openList), talk: () => talk(), view: (id) => iniViewOf(id), head: (id) => (S.H = headOf(id)), goProgram: (id) => goProgram(id),
1486
1517
  foldCard: () => { S.cardFold = !S.cardFold; store.set('pmos.home.cardfold', S.cardFold ? '1' : null); } });
1487
1518
  /* The program panel in Home's Viewer (HbCProg): Home's board model and programs; an initiative of it opens here, with ← back to the program.
1488
1519
  * Read on the first program press, never at start: the panel's modules load premium-shell.js, whose start reads ?session= for the old dialog. */
@@ -275,12 +275,17 @@ function wirePage(b, id) {
275
275
  const C = X.ctx, say = (m) => C.toast(m);
276
276
  wireView(b, {
277
277
  redraw: () => redrawView(),
278
+ // planned versus actual (batch 11 item 8, pm/ini-versions.js): where a draft's writes go, the read after Make live, the toast with Undo
279
+ where: () => { const M = curM(); return M ? bw(M) : {}; },
280
+ reload: async () => { await C.load(); redrawView(); },
281
+ toast: (m, undo) => (undo ? undoToast(m, undo) : say(m)),
278
282
  // one press on the box marks done, with Undo in the toast (batch 9 item 5b); the caret and the date press change the rest
279
283
  check: async (uid, btn) => {
280
284
  await setState(id, uid, btn.getAttribute('aria-pressed') === 'true' ? 'To do' : 'Done');
281
285
  },
282
286
  status: (uid, state) => setState(id, uid, state),
283
287
  dates: (uid, patch) => setDates(id, uid, patch),
288
+ milestone: (uid, on) => setDates(id, uid, { milestone: !!on }), // the ◇ in the status picker (batch 11 item 3)
284
289
  openTask: (uid) => {
285
290
  const M = curM();
286
291
  const row = M && (M.tasks.rows || []).find((x) => x.uid === uid || x.key === uid || x.key === 'task:' + uid);
@@ -335,7 +340,8 @@ async function setDates(id, uid, patch) {
335
340
  const r = await C.pmPost('/api/boards/tasks/edit', { ...body, ...patch });
336
341
  if (!r || r.ok === false) { C.toast((r && r.error) || 'Nothing was changed.'); return; }
337
342
  await C.load(); redrawView();
338
- const back = {}; for (const f of Object.keys(patch)) back[f] = k ? (f === 'due' ? k.end : k[f]) || '' : '';
343
+ const back = {}; for (const f of Object.keys(patch)) back[f] = f === 'milestone' ? (r.from && 'milestone' in r.from ? !!r.from.milestone : !patch.milestone) : k ? (f === 'due' ? k.end : k[f]) || '' : '';
344
+ if ('milestone' in patch) { undoToast((patch.milestone ? 'Milestone: ' : 'Not a milestone: ') + (k ? k.title : uid) + '.', async () => { const u = await C.pmPost('/api/boards/tasks/edit', { ...body, ...back }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); }); return; }
339
345
  if (k) undoToast('Dates saved: ' + k.title + '.', async () => { const u = await C.pmPost('/api/boards/tasks/edit', { ...body, ...back }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
340
346
  else C.toast('Dates saved.');
341
347
  }
@@ -352,7 +358,10 @@ function pageMore(id) {
352
358
  if (mv.canBack) out.push({ label: 'Move back a stage', note: mv.prev, on: (b) => popBack(b || document.querySelector('#czViewer [data-cz-vw="more"]'), id, M, mv) });
353
359
  if ((M.acts.stages || []).length && !M.acts.self) out.push({ label: 'Move to a stage', on: () => iniOverview('stage', { back: true }) });
354
360
  out.push({ label: 'Add a stakeholder', on: () => X.ctx.addPerson() });
355
- if (X.ctx.turnProgram) out.push({ label: 'Turn into a program', on: () => X.ctx.turnProgram(id) });
361
+ // P7: an initiative in no program can become one; one in a program can move out of it or to another (batch 11 item 2, canvas LpA1More)
362
+ const pm = X.ctx.moveItems ? X.ctx.moveItems(id, (b, label, rows) => menu(b || moreBtn(), [{ head: label }, ...rows], 'Move to another program')) : [];
363
+ if (X.ctx.turnProgram && !pm.length) out.push({ label: 'Turn into a program', on: () => X.ctx.turnProgram(id) });
364
+ if (pm.length) out.push({ sep: true }, ...pm);
356
365
  out.push({ sep: true }, { label: 'Open on the Board', on: () => { location.href = '/premium-board.html?focus=' + encodeURIComponent(id) + (M.board.ws ? '&ws=' + encodeURIComponent(M.board.ws) : '') + (M.board.id ? '&board=' + encodeURIComponent(M.board.id) : ''); } },
357
366
  { label: 'The record', on: async () => (X.ctx.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }) });
358
367
  // Won't do and Archive hold from any stage (wfRules); Won't do comes back to Triage. Cancel stays red and last (HbCMore)
@@ -89,7 +89,7 @@ export function tasksOf(D, ini, now = Date.now()) {
89
89
  return items.map((t) => {
90
90
  const ow = String(t.owner || '').toLowerCase();
91
91
  const mine = !ow || /^(pm|you)(:|$)/.test(ow) || (!!me && (ow === me || ow.startsWith(me + ' ')));
92
- return { id: 't:' + t.uid, kind: 'task', ini, name: t.title, hint: taskHint(t, now, mine), state: mine ? 'quiet' : 'wait', mine, due: t.end || '', late: !!(t.end && dayDiff(t.end, now) < 0), task: t };
92
+ return { id: 't:' + t.uid, kind: 'task', ini, name: t.title, hint: taskHint(t, now, mine), state: mine ? 'quiet' : 'wait', mine, due: t.end || '', late: !!(t.end && dayDiff(t.end, now) < 0), task: t, ...(t.milestone ? { ms: true } : {}) };
93
93
  }).map((r) => ({ ...r, rank: urgency(r.task, now) }))
94
94
  .sort((a, b) => (b.mine - a.mine) || (a.rank[0] - b.rank[0]) || (a.rank[1] - b.rank[1]));
95
95
  }
@@ -248,7 +248,7 @@ export function homeList(D, o = {}) {
248
248
  * { id, name, sub (its initiative, or the hint of a row with none), late, state, when (the weekly update's send time) }. */
249
249
  function moveOf(groups, needs) {
250
250
  const late = [], rest = [], seen = new Set();
251
- const put = (L, r, sub) => { if (!r || seen.has(r.id)) return; seen.add(r.id); L.push({ id: r.id, name: r.name, sub: sub || '', late: !!r.late, state: r.state || 'needs', check: !!(r.check || r.kind === 'task'), when: whenOf(r) }); };
251
+ const put = (L, r, sub) => { if (!r || seen.has(r.id)) return; seen.add(r.id); L.push({ id: r.id, name: r.name, sub: sub || '', late: !!r.late, state: r.state || 'needs', check: !!(r.check || r.kind === 'task'), when: whenOf(r), ...(r.ms ? { ms: true } : {}) }); };
252
252
  for (const g of groups) {
253
253
  if (g.kind === 'loose') { for (const r of g.rows) if (r.check && r.late) put(late, r); else if (r.state === 'needs' || r.state === 'blocked') put(rest, r, r.kind === 'session' ? '' : bareHint(r)); continue; }
254
254
  for (const t of g.tasks || []) if (t.mine && t.late) put(late, t, g.name);
@@ -51,6 +51,8 @@ function checkHtml(r) {
51
51
  const isCheck = (r) => r.check || r.kind === 'task' || r.done;
52
52
  const track = (at, label, steps) => (at < 0 ? '' : `<span class="hv-mt" role="img" aria-label="${esc(label)}">${(steps || STEPS).map((x, i) => `<i class="${[i < at ? 'on' : i === at ? 'now' : '', x.ms ? 'ms' : ''].filter(Boolean).join(' ')}"></i>`).join('')}</span>`);
53
53
  const clock = (when) => (when ? `<span class="hv-st">${svg(P.clock, 13)}${esc(String(when).split(' ')[0])}</span>` : '');
54
+ /** The small grey ◇ after a milestone task's name (feedback batch 11 item 3): the same glyph as the initiative's Tasks rows. */
55
+ const MS = '<span class="hv-ms" role="img" aria-label="Milestone" title="Milestone"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round" aria-hidden="true"><path d="M12 4l8 8-8 8-8-8z"/></svg></span>';
54
56
  /** A row of the list: a next step, a task, a note, a mention, a session or a meeting. o: { sel, kid } */
55
57
  export function rowHtml(r, o) {
56
58
  const sel = o.sel === r.id;
@@ -61,7 +63,7 @@ export function rowHtml(r, o) {
61
63
  : r.kind === 'need' && r.row && r.row.kind !== 'source' ? `<button type="button" class="ut-ib hm-x" data-hm-end="${esc(r.id)}" aria-label="Put off ${esc(r.name)} until tomorrow" title="Put off until tomorrow">${svg(P.x, 14)}</button>` : '';
62
64
  const link = r.link && r.kind === 'loose-rec' ? '<span class="hv-st">Link it</span>' : '';
63
65
  return `<div class="${cls}" data-id="${esc(r.id)}">${lead}<button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"${sel ? ' aria-current="true"' : ''}${r.hint ? ` title="${esc(r.hint)}"` : ''}>${lead ? '' : markHtml(r)}`
64
- + `<span class="hm-rt"><b>${esc(r.name)}</b></span>${clock(r.when || whenOf(r))}${link}</button>${end}</div>`;
66
+ + `<span class="hm-rt${r.ms ? ' ms' : ''}"><b>${esc(r.name)}</b>${r.ms ? MS : ''}</span>${clock(r.when || whenOf(r))}${link}</button>${end}</div>`;
65
67
  }
66
68
  /** The chat's header line on a desktop (HvACDesk .ch): the open row's mark, its title and the chip of where it sits (the initiative's stage
67
69
  * track and name, or the program's tile and name). h: { row, title, scope, at, stage, prog }. A chip that repeats the title is left out, and
@@ -22,7 +22,13 @@ const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" heigh
22
22
  export const P = {
23
23
  list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01', time: 'M4 6h9M8 12h11M6 18h7', kanban: 'M4 4h4v16H4zM10 4h4v10h-4zM16 4h4v13h-4z',
24
24
  down: 'M7 10l5 5 5-5', right: 'M10 7l5 5-5 5', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', jira: 'M12 3l9 9-9 9-9-9z', check: 'M5 12l5 5 9-10',
25
+ dia: 'M12 4l8 8-8 8-8-8z', skip: 'M6 7l5 5-5 5M13 7l5 5-5 5',
25
26
  };
27
+ /** The small grey ◇ after a milestone task's title (batch 11 item 3), on every task row: List, Kanban, Timeline. The Jira mark is another
28
+ * shape (blue, nested) and stays as it is. */
29
+ export const msGlyph = (x) => (x && x.ms ? `<span class="iv-ms${x.done ? ' dn' : ''}" role="img" aria-label="Milestone" title="Milestone">${SVG(P.dia, 11, 2.4)}</span>` : '');
30
+ /** A milestone with no due date is not drawn anywhere; its List row asks for the date instead (every gap has its next action). */
31
+ export const msNoDate = (x) => !!(x && x.ms && !x.end && !x.closed);
26
32
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
27
33
  const VIEWS = [['list', 'List', P.list], ['timeline', 'Timeline', P.time], ['kanban', 'Kanban', P.kanban]];
28
34
  const ZOOMS = [['week', 'Weeks', 14], ['month', 'Months', 4], ['quarter', 'Quarters', 1.6]];
@@ -82,17 +88,30 @@ const flat = (sec) => (sec.stages ? sec.stages.flatMap((s) => flat(s)) : [...sec
82
88
  const flatDone = (sec) => (sec.stages ? sec.stages.flatMap((s) => flatDone(s)) : sec.done);
83
89
  const jiraOf = (sec) => (sec.stages ? sec.stages.flatMap((s) => jiraOf(s)) : sec.jira ? sec.jira.open : []);
84
90
  const box = (x, o) => {
91
+ // a draft's task (batch 11 item 8) is an assumption: a dashed box that marks nothing; its caret still changes the status in the draft
92
+ if (x.dr) return `<span class="iv-bxw"><span class="iv-cb dr" aria-hidden="true"></span>` + (o.quick ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" aria-haspopup="dialog" aria-label="${esc('Change the status in the draft: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '') + '</span>';
85
93
  const cls = ['iv-cb', x.done ? 'on' : '', x.prog ? 'pr' : '', x.wont ? 'wo' : ''].filter(Boolean).join(' ');
86
94
  return `<span class="iv-bxw"><button type="button" class="${cls}" data-iv-check="${esc(x.uid)}" aria-pressed="${x.done}" aria-label="${esc((x.done ? 'Reopen: ' : 'Mark done: ') + x.title)}" title="${x.done ? 'Reopen' : 'Mark done'}">${x.done ? SVG(P.check, 12, 3) : ''}</button>`
87
- + (o.quick ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" aria-haspopup="dialog" aria-label="${esc('Change the status: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '') + '</span>';
95
+ + (o.quick ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" data-ms="${x.ms ? 1 : 0}" aria-haspopup="dialog" aria-label="${esc('Change the status: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '') + '</span>';
88
96
  };
89
97
  const jmark = (k) => `<span class="iv-jm" role="img" aria-label="${esc('Jira ticket, ' + (k.status || 'To do') + '. Status and dates come from Jira')}" title="${esc('Jira · ' + (k.status || 'To do'))}">${SVG(P.jira, 14, 2)}</span>`;
90
- const title = (x, o) => (o.openTask && x.uid ? `<button type="button" class="iv-tt" data-iv-task="${esc(x.uid)}">${esc(x.title)}</button>` : `<b class="iv-tt">${esc(x.title)}</b>`);
98
+ const title = (x, o) => (o.openTask && x.uid && !x.dr ? `<button type="button" class="iv-tt" data-iv-task="${esc(x.uid)}">${esc(x.title)}</button>` : `<b class="iv-tt">${esc(x.title)}</b>`) + msGlyph(x) + addedMark(x);
99
+ /* ── planned versus actual (batch 11 item 8; canvas PvaAC1Live): ⊕ after a title added after the compared version, the slip after a date ── */
100
+ const ADDED = 'M12 8v8M8 12h8M12 3a9 9 0 1 0 0 18 9 9 0 1 0 0-18';
101
+ export const addedMark = (x) => (x.added ? `<span class="vs-add" role="img" aria-label="Added after the plan" title="Added after the plan">${SVG(ADDED, 14, 1.8)}</span>` : '');
102
+ /** The days a task's end moved against the compared version: +4d late, −3d early; nothing on the same day (zero is silence). */
103
+ export const slipOf = (x) => { if (!x.cmp || !x.end || !x.cmp.due || x.wont) return 0; const a = dn(x.end), b = dn(x.cmp.due); return a == null || b == null ? 0 : a - b; };
104
+ export function slipHtml(x) {
105
+ const n = slipOf(x); if (!n) return '';
106
+ return ` <span class="vs-sl${n > 0 ? ' late' : ''}" role="img" aria-label="${esc((n > 0 ? n + ' days late' : -n + ' days early') + ' against the plan')}">${n > 0 ? '+' + n : '\u2212' + -n}d</span>`;
107
+ }
91
108
  const ttitle = (k) => `<button type="button" class="iv-tt" data-iv-ticket="${esc(k.key)}"><em>${esc(k.key)}</em> ${esc(k.title)}</button>`;
92
109
  /** The date press: the task card's start and due picker opens right under it. No dates: a calendar icon, shown on hover. */
93
110
  export function dateBtn(x, o) {
94
111
  if (!o.quick || !x.uid) return x.days ? `<span class="${x.late ? 'w' : ''}">${esc(x.days)}</span>` : '';
95
112
  const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" title="Start and due"`;
113
+ // a milestone with no due date: a dashed chip asks for it, shown always (canvas XmlA6Suggest)
114
+ if (msNoDate(x)) return `<button type="button" class="iv-dc ms" ${a} aria-label="${esc('Set the due date: ' + x.title)}">${SVG(P.cal, 13)}Set the due date</button>`;
96
115
  return x.days ? `<button type="button" class="iv-dc${x.late ? ' w' : ''}" ${a} aria-label="${esc('Dates: ' + x.days + '. Change')}">${esc(x.days)}</button>`
97
116
  : `<button type="button" class="iv-dc none" ${a} aria-label="${esc('Add dates: ' + x.title)}">${SVG(P.cal, 14)}</button>`;
98
117
  }
@@ -104,7 +123,7 @@ export function timelineHtml(v, o, isOpen) {
104
123
  const S = v.tasks.sections;
105
124
  // the range: the open tasks around today, a little air each side; never more than a few years
106
125
  const ns = [];
107
- for (const s of S) { for (const x of flat(s).concat(flatDone(s))) { const a = dn(x.start), b = dn(x.end); if (a != null) ns.push(a); if (b != null) ns.push(b); } for (const k of jiraOf(s)) { const b = dn(k.due); if (b != null) ns.push(b); } }
126
+ for (const s of S) { for (const x of flat(s).concat(flatDone(s))) { const a = dn(x.start), b = dn(x.end); if (a != null) ns.push(a); if (b != null) ns.push(b); if (x.cmp) { const c = dn(x.cmp.start), d = dn(x.cmp.due); if (c != null) ns.push(c); if (d != null) ns.push(d); } } for (const k of jiraOf(s)) { const b = dn(k.due); if (b != null) ns.push(b); } }
108
127
  const lo = Math.max(today - 730, Math.min(today - 14, ...ns) - 4), hi = Math.min(today + 1095, Math.max(today + 42, ...ns) + 10);
109
128
  const O = lo - ((new Date(lo * 864e5).getUTCDay() + 6) % 7); // start on a Monday
110
129
  const W = Math.ceil((hi - O + 1) * px), X = (n) => Math.round((n - O) * px);
@@ -117,25 +136,57 @@ export function timelineHtml(v, o, isOpen) {
117
136
  if (z[0] === 'quarter' && d.getUTCDate() === 1 && m % 3 === 0) ticks.push({ x: X(n), t: 'Q' + (m / 3 + 1) + ' ' + y, b: m === 0 });
118
137
  }
119
138
  const drag = o.quick ? ' data-ivt-drag="1"' : '';
120
- const barOf = (x) => {
121
- const a = dn(x.start), b = dn(x.end), cls = tone(x), lbl = [x.days || 'No dates', x.owner && x.owner !== 'You' ? x.owner : '', x.closed ? x.status.toLowerCase() : x.late ? 'late' : x.prog ? 'in progress' : ''].filter(Boolean).join(', ');
139
+ // the compared version's days: a thin dark line with end caps under the bar, only where they differ; a dropped task keeps only its line
140
+ const planLine = (x) => {
141
+ if (!x.cmp) return '';
142
+ const a = dn(x.cmp.start || x.cmp.due), b = dn(x.cmp.due || x.cmp.start); if (a == null) return '';
143
+ const vs = v.vs && v.vs.cmp ? v.vs.cmp.name : 'the plan';
144
+ return `<span class="ivt-pl" role="img" data-tlx="${X(a)}" data-tlw="${Math.max(4, X(Math.max(a, b) + 1) - X(a))}" aria-label="${esc('In ' + vs + ': ' + spanText(a, b))}" title="${esc(vs + ' · ' + spanText(a, b))}"></span>`;
145
+ };
146
+ const slipLab = (x) => { const n = slipOf(x), e = dn(x.end); return n && e != null ? `<span class="ivt-sl" data-tlx="${X(e + 1) + 8}">${esc(md(e))}${slipHtml(x)}</span>` : ''; };
147
+ const barOf = (x) => (x.wont && x.cmp ? planLine(x) : barOf0(x) + planLine(x) + slipLab(x));
148
+ const barOf0 = (x) => {
149
+ const a = dn(x.start), b = dn(x.end), cls = tone(x) + (x.dr ? ' dr' : ''), lbl = [x.days || 'No dates', x.owner && x.owner !== 'You' ? x.owner : '', x.closed ? x.status.toLowerCase() : x.late ? 'late' : x.prog ? 'in progress' : ''].filter(Boolean).join(', ');
122
150
  const av = x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : '';
123
151
  const at = `data-ivt-bar="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}"${o.quick && !x.closed ? drag : ''} aria-label="${esc(lbl + '. Change the dates')}"`;
124
152
  if (a == null && b == null) return x.closed || !o.quick ? '' : `<button type="button" class="ivt-g" data-iv-date="${esc(x.uid)}" data-s="" data-e="" data-tlx="${X(today) - 18}" aria-label="${esc('No dates yet. Set dates: ' + x.title)}" title="Set dates">${SVG(P.cal, 13)}</button>`;
125
153
  if (a == null) return `<button type="button" class="ivt-d ${cls}" ${at} data-only="due" data-tlx="${X(b) + Math.round(px / 2)}"></button>`;
126
154
  const e = b == null ? a : Math.max(a, b);
127
155
  return `<button type="button" class="ivt-b ${cls}" ${at} data-tlx="${X(a)}" data-tlw="${Math.max(10, X(e + 1) - X(a))}">`
128
- + (o.quick && !x.closed ? '<span class="ivt-gp l" data-grip="start" aria-hidden="true"></span><span class="ivt-gp r" data-grip="end" aria-hidden="true"></span>' : '') + av + '</button>';
156
+ + (o.quick && !x.closed ? '<span class="ivt-gp l" data-grip="start" aria-hidden="true"></span><span class="ivt-gp r" data-grip="end" aria-hidden="true"></span>' : '') + av + '</button>' + msEnd(x);
129
157
  };
158
+ // a milestone task's bar ends in its ◇ with the date beside it (canvas XmlA3Viewer); a faint dashed guide drops through the grid there.
159
+ // Won't do and Archived draw none; no due date draws none (the List asks for it). Dragging the bar's end moves the due date as before.
160
+ const msEnd = (x) => { const b = dn(x.end); if (!x.ms || b == null || x.wont || x.status === 'Archived') return '';
161
+ return `<span class="ivt-ms${x.done ? ' dn' : x.late ? ' lt' : ''}" data-tlx="${X(b + 1)}" role="img" aria-label="${esc('Milestone ' + x.title + ', ' + md(b) + (x.done ? ', done' : x.late ? ', late' : ''))}" title="${esc(x.title + ' · ' + md(b))}"><i></i><b>${esc(md(b))}</b></span>`; };
162
+ const guides = [...new Set(S.flatMap((s) => flat(s).concat(flatDone(s))).filter((x) => x.ms && !x.wont && x.status !== 'Archived' && dn(x.end) != null).map((x) => X(dn(x.end) + 1)))]
163
+ .map((gx) => `<i class="ms" data-tlx="${gx}"></i>`).join('');
130
164
  const jbar = (k) => { const b = dn(k.due); return b == null ? '' : `<span class="ivt-d jr" role="img" data-tlx="${X(b) + Math.round(px / 2)}" aria-label="${esc('Due ' + md(b) + ' in Jira')}" title="${esc('Jira · ' + md(b))}"></span>`; };
131
165
  const row = (n, c, cls = '') => `<div class="ivt-r${cls}"><div class="ivt-n">${n}</div><div class="ivt-c">${c}</div></div>`;
132
166
  const band = (rs) => { const ds = rs.flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null); if (!ds.length) return ''; const a = Math.min(...ds), b = Math.max(...ds); return `<span class="ivt-band" data-tlx="${X(a)}" data-tlw="${Math.max(8, X(b + 1) - X(a))}"></span>`; };
167
+ // a skipped stage keeps its group row: a hairline from the band before it to the band after it, with » on it (batch 11 item 13, XgapA2Tasks);
168
+ // a skip before the first dated stage or after the last draws nothing
169
+ const spanOf = (sec) => { const ds = flat(sec).concat(flatDone(sec)).flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null); return ds.length ? [Math.min(...ds), Math.max(...ds)] : null; };
170
+ const SP = S.map((sec) => (sec.kind === 'stage' ? spanOf(sec) : null));
171
+ const skipLine = (i) => {
172
+ const sec = S[i]; let p = null, q = null;
173
+ for (let j = i - 1; j >= 0 && !p; j--) p = SP[j];
174
+ for (let j = i + 1; j < S.length && !q; j++) q = SP[j];
175
+ if (!p || !q) return '';
176
+ const a = p[1] + 1, b = q[0], z = b - 1, why = sec.name + ' skipped' + (sec.skipWhy ? ': ' + sec.skipWhy.replace(/\.$/, '').replace(/^./, (c) => c.toLowerCase()) : '');
177
+ // the words name the empty days (the day after the work before to the day before the work after), split at today as on the Board
178
+ const len = (u, w) => { const n = w - u + 1; return n < 7 ? n + (n === 1 ? ' day' : ' days') : Math.round(n / 7) + ' wk'; };
179
+ const say = (t0, u, w) => t0 + ', ' + md(u) + ' to ' + md(w) + ' · ' + len(u, w);
180
+ if (b - p[1] < 14) return `<span class="ivt-sk" role="img" data-tlx="${X(Math.max(a, b))}" aria-label="${esc(why)}" title="${esc(why)}">${SVG(P.skip, 12, 2)}</span>`;
181
+ const words = (z < today ? [say('No activity', a, z)] : a >= today ? [say('Nothing planned', a, z)] : [say('No activity', a, today - 1), say('Nothing planned', today, z)]).concat(why);
182
+ return `<span class="ivt-ng" role="img" data-tlx="${X(a)}" data-tlw="${X(b) - X(a)}" aria-label="${esc(words.join('. '))}" title="${esc(words.join('\n'))}"><span class="ivt-sk">${SVG(P.skip, 12, 2)}</span></span>`;
183
+ };
133
184
  let h = '';
134
- for (const sec of S) {
185
+ for (const [si, sec] of S.entries()) {
135
186
  const key = 'sec:' + (sec.key || 'none'), op = isOpen(key, sec.open), rs = flat(sec), dn_ = flatDone(sec), jr = jiraOf(sec);
136
187
  const has = rs.length || dn_.length || jr.length;
137
- const head = `<button type="button" class="ivt-gh${sec.kind !== 'stage' && sec.kind !== 'none' ? ' mut' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'}>${o.mark(sec)}<b>${esc(sec.label || sec.name)}</b>${sec.count ? `<span class="n${sec.warn ? ' w' : ''}">${esc(sec.count)}</span>` : ''}${has ? `<span class="iv-cv" aria-hidden="true">${SVG(op ? P.down : P.right, 15, 2)}</span>` : ''}</button>`;
138
- h += row(head, band(rs.concat(dn_)), ' g');
188
+ const head = `<button type="button" class="ivt-gh${sec.kind !== 'stage' && sec.kind !== 'none' || sec.status === 'skip' ? ' mut' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'}>${o.mark(sec)}<b>${esc(sec.label || sec.name)}</b>${sec.count ? `<span class="n${sec.warn ? ' w' : ''}">${esc(sec.count)}</span>` : ''}${has ? `<span class="iv-cv" aria-hidden="true">${SVG(op ? P.down : P.right, 15, 2)}</span>` : ''}</button>`;
189
+ h += row(head, sec.status === 'skip' && !has ? skipLine(si) : band(rs.concat(dn_)), ' g');
139
190
  if (!op || !has) continue;
140
191
  for (const k of jr) h += row(`${jmark(k)}${ttitle(k)}`, jbar(k), ' k');
141
192
  for (const x of rs) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k');
@@ -145,10 +196,13 @@ export function timelineHtml(v, o, isOpen) {
145
196
  if (dop) for (const x of dn_) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k x' + (x.wont ? ' wo' : ''));
146
197
  }
147
198
  }
148
- const grid = ticks.map((t) => `<i data-tlx="${t.x}"></i>`).join('');
199
+ const grid = ticks.map((t) => `<i data-tlx="${t.x}"></i>`).join('') + guides;
149
200
  const axis = `<div class="ivt-r ax"><div class="ivt-n"></div><div class="ivt-c">${ticks.map((t) => `<span class="${t.b ? 'b' : ''}" data-tlx="${t.x}">${esc(t.t)}</span>`).join('')}</div></div>`;
150
- const legend = `<div class="ivt-lg"><span><i class="to"></i>To do</span><span><i class="pr"></i>In progress</span><span><i class="lt"></i>Late</span><span><i class="dd"></i>Due only</span>`
151
- + `<span>${SVG(P.jira, 12, 2)}Jira, read only</span>${o.quick ? '<span class="h">Drag a bar to move it; drag an end to change start or due</span>' : ''}</div>`;
201
+ // Plan and Draft join the legend only when they are in view (batch 11 item 8)
202
+ const vk = v.vs ? (v.vs.lines && v.vs.cmp ? `<span><i class="pl"></i>${esc((v.vs.cmp.kind === 'plan' ? 'Plan · ' : 'Draft · ') + v.vs.cmp.name)}</span>` : '') + (v.vs.draft ? '<span><i class="dr"></i>Draft</span>' : '') : '';
203
+ const legend = `<div class="ivt-lg">${v.vs && v.vs.draft ? '' : '<span><i class="to"></i>To do</span><span><i class="pr"></i>In progress</span><span><i class="lt"></i>Late</span>'}<span><i class="dd"></i>Due only</span>${vk}`
204
+ + (/class="ivt-ng"/.test(h) ? '<span><i class="ng"></i>No activity</span>' : '') + (/class="ivt-sk"/.test(h) ? `<span>${SVG(P.skip, 12, 2)}Skipped</span>` : '')
205
+ + `${guides ? `<span>${SVG(P.dia, 11, 2.4)}Milestone</span>` : ''}<span>${SVG(P.jira, 12, 2)}Jira, read only</span>${o.quick ? '<span class="h">Drag a bar to move it; drag an end to change start or due</span>' : ''}</div>`;
152
206
  // it opens on today, moved left as far as the earliest open task's start, so a late bar is in view
153
207
  const firstOpen = S.flatMap(flat).flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null);
154
208
  const first = firstOpen.length ? X(Math.min(...firstOpen)) : X(today);
@@ -183,7 +237,7 @@ export function kanbanHtml(v, o, isOpen) {
183
237
  return `<div class="ivk-d jr">${jmark(t)}<div class="w">${ttitle(t)}<div class="ivk-m">${d != null ? `<span>${esc(md(d))}</span>` : ''}${t.av ? `<span class="ivt-av" aria-hidden="true">${esc(t.av)}</span>` : ''}</div></div></div>`;
184
238
  }
185
239
  const x = c.x;
186
- return `<div class="ivk-d${x.closed ? ' x' : ''}${x.wont ? ' wo' : ''}"${o.quick && x.uid ? ` draggable="true" data-ivk-card="${esc(x.uid)}" data-st="${esc(x.status)}"` : ''}>${box(x, o)}<div class="w">${title(x, o)}`
240
+ return `<div class="ivk-d${x.closed ? ' x' : ''}${x.wont ? ' wo' : ''}${x.dr ? ' dr' : ''}"${o.quick && x.uid ? ` draggable="true" data-ivk-card="${esc(x.uid)}" data-st="${esc(x.status)}"` : ''}>${box(x, o)}<div class="w">${title(x, o)}`
187
241
  + `<div class="ivk-m">${dateBtn(x, o)}${x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : ''}</div></div></div>`;
188
242
  };
189
243
  const wop = isOpen('kb:wont', false), nW = by["Won't do"].length;
@@ -225,13 +279,24 @@ if (typeof document !== 'undefined' && document.head) {
225
279
  document.addEventListener('scroll', (e) => { if (POP && !POP.el.contains(e.target)) closePop(); }, true);
226
280
  }
227
281
  /** The five icons (To do, In progress, Done, Won't do | Archive), only the current one named: the task card's segment. */
228
- export function statusPopHtml(status) {
282
+ /** ms: the task's ◇ flag, or null where the flag cannot change here: after a second divider, the ◇ toggle (batch 11 item 3). */
283
+ export function statusPopHtml(status, ms = null) {
229
284
  const b = (s) => { const k = stateKey(s), on = s === status;
230
285
  return `<button type="button" class="i-${k}${on ? ' on' : ''}" role="radio" aria-checked="${on}" data-ivq-state="${esc(s)}"${on ? '' : ` aria-label="${esc(s === 'Archived' ? 'Archive' : s)}"`} title="${esc(s === 'Archived' ? 'Archive' : s)}">${stateIcon(s)}${on ? esc(s) : ''}</button>`; };
231
- return `<div class="tkc-pop ivq-st" role="dialog" aria-label="Status"><div class="seg" role="radiogroup" aria-label="Status">${STATES.slice(0, 4).map(b).join('')}<span class="vr" aria-hidden="true"></span>${b('Archived')}</div></div>`;
286
+ return `<div class="tkc-pop ivq-st" role="dialog" aria-label="Status"><div class="seg" role="radiogroup" aria-label="Status">${STATES.slice(0, 4).map(b).join('')}<span class="vr" aria-hidden="true"></span>${b('Archived')}</div>`
287
+ + (ms == null ? '' : `<span class="vr" aria-hidden="true"></span>${msToggleHtml(ms, 'data-ivq-ms')}`) + '</div>';
288
+ }
289
+ /** The ◇ toggle: icon only, "◇ Milestone" while pressed; its tooltip says what it does. attr: the press's data attribute. */
290
+ export function msToggleHtml(on, attr) {
291
+ const tip = on ? 'A milestone. Press to make it a plain task' : 'Make it a milestone: its due date shows as ◇ on the Board and the timeline';
292
+ return `<button type="button" class="ivq-ms${on ? ' on' : ''}" ${attr} aria-pressed="${!!on}" aria-label="${esc(on ? 'Milestone' : 'Make it a milestone')}" title="${esc(tip)}">${SVG(P.dia, 15, 2)}${on ? 'Milestone' : ''}</button>`;
232
293
  }
233
294
  function statusPop(anchor, uid, status, H) {
234
- openPop(anchor, statusPopHtml(status), (b) => { const s = b.dataset.ivqState; if (!s) return; closePop(); if (s !== status && H.status) H.status(uid, s); });
295
+ const ms = H.milestone && anchor.dataset.ms != null ? anchor.dataset.ms === '1' : null;
296
+ openPop(anchor, statusPopHtml(status, ms), (b) => {
297
+ if ('ivqMs' in b.dataset) { closePop(); H.milestone(uid, !ms); return; }
298
+ const s = b.dataset.ivqState; if (!s) return; closePop(); if (s !== status && H.status) H.status(uid, s);
299
+ });
235
300
  }
236
301
  function datePop(anchor, uid, H) {
237
302
  const t = { start: anchor.dataset.s || '', due: anchor.dataset.e || '' }, st = { field: 'due', month: '' };