create-pmos 0.421.0 → 0.423.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 (112) hide show
  1. package/package.json +25 -25
  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 +87 -3
  8. package/workspace/briefing-premium-adddoc-test.js +1 -1
  9. package/workspace/briefing-premium-board-test.js +13 -11
  10. package/workspace/briefing-premium-initiative-test.js +30 -38
  11. package/workspace/changelog.json +24 -0
  12. package/workspace/fixtures/report-api/draft.json +2 -1
  13. package/workspace/guide/briefing-premium.md +2 -1
  14. package/workspace/guide/home.md +14 -4
  15. package/workspace/guide/programs.md +5 -3
  16. package/workspace/guide/workflows.md +5 -1
  17. package/workspace/home-other-product-test.js +55 -0
  18. package/workspace/ini-workflow-test.js +4 -4
  19. package/workspace/lib/board-premium.js +21 -6
  20. package/workspace/lib/custom-docs.js +65 -3
  21. package/workspace/lib/doc-live-root.js +37 -0
  22. package/workspace/lib/engine/anchor-resolve.js +93 -15
  23. package/workspace/lib/engine/boards.js +30 -2
  24. package/workspace/lib/engine/intake.js +1 -1
  25. package/workspace/lib/hold-spans.js +24 -10
  26. package/workspace/lib/initiative-writer.js +63 -1
  27. package/workspace/lib/kg.js +1 -1
  28. package/workspace/lib/plan-items.js +36 -5
  29. package/workspace/lib/programs.js +11 -3
  30. package/workspace/lib/report-draft.js +3 -0
  31. package/workspace/lib/route-modules.js +2 -0
  32. package/workspace/lib/routes-board-premium.js +28 -0
  33. package/workspace/lib/routes-boards.js +92 -13
  34. package/workspace/lib/routes-doc-sheet.js +29 -1
  35. package/workspace/lib/routes-initiatives.js +12 -0
  36. package/workspace/lib/routes-programs.js +44 -5
  37. package/workspace/lib/routes-task-links.js +329 -0
  38. package/workspace/lib/routes-task-plans.js +333 -0
  39. package/workspace/lib/split-merge-suggest.js +162 -0
  40. package/workspace/lib/split-merge.js +379 -0
  41. package/workspace/lib/task-cli.js +73 -13
  42. package/workspace/lib/task-items.js +15 -3
  43. package/workspace/lib/task-links.js +422 -0
  44. package/workspace/lib/task-plans.js +232 -0
  45. package/workspace/lib/vendor/scripts/anchor-resolve.js +93 -15
  46. package/workspace/lib/vendor/scripts/intake.js +1 -1
  47. package/workspace/package-lock.json +2 -2
  48. package/workspace/package.json +1 -1
  49. package/workspace/premium-board-actions-test.js +2 -2
  50. package/workspace/premium-core-doc-issue-test.js +2 -2
  51. package/workspace/premium-vw-backlog-test.js +3 -3
  52. package/workspace/premium-vw-doc-test.js +26 -3
  53. package/workspace/premium-vw-item-test.js +3 -3
  54. package/workspace/premium-vw-jira-test.js +6 -6
  55. package/workspace/product-lane-test.js +165 -0
  56. package/workspace/program-leave-test.js +203 -0
  57. package/workspace/program-panel-test.js +1 -1
  58. package/workspace/public/pm/bd-acts.js +5 -2
  59. package/workspace/public/pm/bd-ini-panel.js +32 -9
  60. package/workspace/public/pm/bd-prog-panel.js +22 -7
  61. package/workspace/public/pm/bd-prog.js +6 -1
  62. package/workspace/public/pm/bd-span.js +234 -30
  63. package/workspace/public/pm/bd-views.js +3 -2
  64. package/workspace/public/pm/cozy-board.css +90 -0
  65. package/workspace/public/pm/cozy-home.css +3 -0
  66. package/workspace/public/pm/doc-follow.js +36 -0
  67. package/workspace/public/pm/home-app.js +62 -14
  68. package/workspace/public/pm/home-ini-model.js +0 -34
  69. package/workspace/public/pm/home-ini.js +81 -204
  70. package/workspace/public/pm/home-list.js +2 -2
  71. package/workspace/public/pm/home-today.js +3 -1
  72. package/workspace/public/pm/ini-groups.js +228 -0
  73. package/workspace/public/pm/ini-links.js +561 -0
  74. package/workspace/public/pm/ini-tasks.js +131 -30
  75. package/workspace/public/pm/ini-versions.js +348 -0
  76. package/workspace/public/pm/ini-view-model.js +113 -43
  77. package/workspace/public/pm/ini-view.css +341 -18
  78. package/workspace/public/pm/ini-view.js +153 -38
  79. package/workspace/public/pm/premium-board.js +160 -21
  80. package/workspace/public/pm/premium-report-read.js +20 -1
  81. package/workspace/public/pm/premium-shell.js +29 -4
  82. package/workspace/public/pm/premium-vw-doc.js +46 -11
  83. package/workspace/public/pm/prog-move.js +69 -0
  84. package/workspace/public/pm/split-merge.css +77 -0
  85. package/workspace/public/pm/split-merge.js +265 -0
  86. package/workspace/public/pm/stage-line.js +414 -0
  87. package/workspace/public/pm/task-card.css +3 -0
  88. package/workspace/public/pm/task-card.js +15 -6
  89. package/workspace/public/pm/wf-page.css +2 -0
  90. package/workspace/public/pm/wf-page.js +2 -0
  91. package/workspace/public/pm/wf-stage.js +2 -1
  92. package/workspace/server.js +15 -1
  93. package/workspace/split-merge-ui-test.js +175 -0
  94. package/workspace/stage-card-test.js +12 -11
  95. package/workspace/task-card-test.js +3 -2
  96. package/workspace/task-delete-test.js +126 -0
  97. package/workspace/task-links-test.js +227 -0
  98. package/workspace/task-milestones-test.js +176 -0
  99. package/workspace/task-plans-test.js +181 -0
  100. package/workspace/task-views-test.js +3 -3
  101. package/workspace/test-lists/bd-ini-panel.json +8 -2
  102. package/workspace/test-lists/product-lane.json +6 -0
  103. package/workspace/test-lists/program-leave.json +6 -0
  104. package/workspace/test-lists/split-merge.json +15 -0
  105. package/workspace/test-lists/task-delete.json +5 -0
  106. package/workspace/test-lists/task-links.json +6 -0
  107. package/workspace/test-lists/task-milestones.json +6 -0
  108. package/workspace/test-lists/task-plans.json +6 -0
  109. package/workspace/test-lists/viewer-live-file.json +9 -0
  110. package/workspace/timeline-holds-test.js +61 -4
  111. package/workspace/tk-tasks-test.js +173 -57
  112. package/workspace/workflows-setup-test.js +4 -3
@@ -13,16 +13,23 @@
13
13
  * wireDrag(body) once per body: drag a bar (move, or an end), drag a card between columns, long-press a box on a phone
14
14
  *
15
15
  * The host's handlers (wireView's h): h.check(uid) the box's one-press Done (Undo in the host's toast), h.status(uid, state) and
16
- * h.dates(uid, { start?, due? }) the quick changes (each with Undo), h.redraw(). A Jira ticket is read-only: the Jira mark, a plain date, no
16
+ * h.dates(uid, { start?, due? }) the quick changes (each with Undo), h.remove(uid) the picker's trash (batch 11 item 16: Delete, Undo in the toast), h.redraw(). A Jira ticket is read-only: the Jira mark, a plain date, no
17
17
  * picker and no drag. Archived tasks show in no view here (the List folds them after Done). */
18
18
  import { STATES, stateIcon, stateKey, datePickerHtml, cardStyle } from './task-card.js';
19
+ import * as LK from './ini-links.js'; // the links' marks on bars and cards (batch 11 item 15)
19
20
 
20
21
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
21
22
  const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
22
23
  export const P = {
23
24
  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
25
  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',
26
+ dia: 'M12 4l8 8-8 8-8-8z', skip: 'M6 7l5 5-5 5M13 7l5 5-5 5', bin: 'M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13',
25
27
  };
28
+ /** 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
29
+ * shape (blue, nested) and stays as it is. */
30
+ 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>` : '');
31
+ /** A milestone with no due date is not drawn anywhere; its List row asks for the date instead (every gap has its next action). */
32
+ export const msNoDate = (x) => !!(x && x.ms && !x.end && !x.closed);
26
33
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
27
34
  const VIEWS = [['list', 'List', P.list], ['timeline', 'Timeline', P.time], ['kanban', 'Kanban', P.kanban]];
28
35
  const ZOOMS = [['week', 'Weeks', 14], ['month', 'Months', 4], ['quarter', 'Quarters', 1.6]];
@@ -38,6 +45,8 @@ export function setViewMode(m) { VIEW = m === 'timeline' || m === 'kanban' ? m :
38
45
  const zoomOf = () => { if (!ZOOM) { const z = store.get('pmos.tasks.zoom'); ZOOM = ZOOMS.some((x) => x[0] === z) ? z : 'week'; } return ZOOM; };
39
46
  /** For the tests: forget the PM's picks. */
40
47
  export const resetViews = () => { VIEW = null; ZOOM = null; STAGE.clear(); SCROLL.clear(); };
48
+ /** The stage card's press on a stage (batch 11 item 21): the Kanban turns to that stage. */
49
+ export const setKanbanStage = (id, key) => { if (id && key != null) STAGE.set(id, key); };
41
50
 
42
51
  /* ── days, as whole numbers (UTC, so a summer-time night never moves a bar) ── */
43
52
  const DAY = /^(\d{4})-(\d{2})-(\d{2})/;
@@ -56,9 +65,15 @@ export function spanText(s, e) {
56
65
  export function switchHtml(m) {
57
66
  return `<div class="ivx-seg" role="group" aria-label="Tasks view">${VIEWS.map(([k, l, d]) => `<button type="button" class="ivx-sb" data-iv-view="${k}" aria-pressed="${m === k}" aria-label="${l}" title="${l}">${SVG(d, 17)}</button>`).join('')}</div>`;
58
67
  }
59
- /** The Kanban's stage choices: the current stage first, All stages, then the rest of the List's groups in their order, each with its count. */
68
+ /** The Kanban's stage choices: the current stage first, All stages, then the rest of the List's groups in their order, each with its count.
69
+ * Grouped another way (batch 11 item 20) it is the group picker: All, then each group; By status has only All (its groups are the columns). */
60
70
  export function stagesOf(v) {
61
- const S = v.tasks.sections, now = S.find((s) => s.kind === 'stage' && s.status === 'now');
71
+ const S = v.tasks.sections;
72
+ if (v.tasks.by && v.tasks.by !== 'stage') {
73
+ const all = { key: 'all', label: 'All', count: v.tasks.open ? v.tasks.open + ' open' : v.tasks.count };
74
+ return v.tasks.by === 'status' ? [all] : [all, ...S.map((s) => ({ key: s.key || '-', label: s.label || s.name, count: s.count }))];
75
+ }
76
+ const now = S.find((s) => s.kind === 'stage' && s.status === 'now');
62
77
  const name = (s) => (s.kind === 'later' ? 'Later stages' : s.kind === 'none' ? 'Not in a stage' : s.label || s.name);
63
78
  const all = { key: 'all', label: 'All stages', count: v.tasks.open ? v.tasks.open + ' open' : v.tasks.count };
64
79
  const rest = S.filter((s) => s !== now).map((s) => ({ key: s.key || '-', label: name(s), count: s.count }));
@@ -72,7 +87,8 @@ export function headExtraHtml(v, m) {
72
87
  }
73
88
  if (m === 'kanban') {
74
89
  const L = stagesOf(v), k = stageKeyOf(v), x = L.find((y) => y.key === k);
75
- return `<button type="button" class="ivx-pick on" data-iv-kstage aria-haspopup="menu" aria-label="Stage: ${esc(x.label)}. Change">${esc(x.label)}${SVG(P.down, 14, 2)}</button>`;
90
+ const what = v.tasks.by && v.tasks.by !== 'stage' ? 'Group' : 'Stage';
91
+ return `<button type="button" class="ivx-pick on" data-iv-kstage aria-haspopup="menu" aria-label="${what}: ${esc(x.label)}. Change">${esc(x.label)}${SVG(P.down, 14, 2)}</button>`;
76
92
  }
77
93
  return '';
78
94
  }
@@ -81,18 +97,39 @@ export function headExtraHtml(v, m) {
81
97
  const flat = (sec) => (sec.stages ? sec.stages.flatMap((s) => flat(s)) : [...sec.top, ...sec.groups.flatMap((g) => g.rows)]);
82
98
  const flatDone = (sec) => (sec.stages ? sec.stages.flatMap((s) => flatDone(s)) : sec.done);
83
99
  const jiraOf = (sec) => (sec.stages ? sec.stages.flatMap((s) => jiraOf(s)) : sec.jira ? sec.jira.open : []);
100
+ const tkOf = (sec) => (sec.stages ? sec.stages.flatMap((s) => tkOf(s)) : sec.tk || []); // By epic's tickets (batch 11 item 20)
101
+ /** A drafted or sent ticket of By epic: no box; a press opens the draft, or the ticket once it is in Jira (pm/ini-groups.js). */
102
+ const tkMark = (t) => (t.inJira ? `<span class="ig-sq ${esc(t.cat || 'todo')}" role="img" aria-label="${esc('In Jira: ' + (t.status || 'To do'))}"></span>`
103
+ : `<span class="ig-tkd" role="img" aria-label="Jira ticket drafted, not sent" title="Drafted, not in Jira">${SVG(P.jira, 14, 2)}</span>`);
104
+ const tkTitle = (t) => `<button type="button" class="iv-tt" data-ig-tk="${esc(t.id)}">${t.inJira && t.key ? `<em>${esc(t.key)}</em> ` : ''}${esc(t.title)}</button>`;
84
105
  const box = (x, o) => {
106
+ // 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
107
+ 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
108
  const cls = ['iv-cb', x.done ? 'on' : '', x.prog ? 'pr' : '', x.wont ? 'wo' : ''].filter(Boolean).join(' ');
86
109
  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>';
110
+ + (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
111
  };
89
112
  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>`);
113
+ 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);
114
+ /* ── planned versus actual (batch 11 item 8; canvas PvaAC1Live): ⊕ after a title added after the compared version, the slip after a date ── */
115
+ const ADDED = 'M12 8v8M8 12h8M12 3a9 9 0 1 0 0 18 9 9 0 1 0 0-18';
116
+ 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>` : '');
117
+ /** The days a task's end moved against the compared version: +4d late, −3d early; nothing on the same day (zero is silence). */
118
+ 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; };
119
+ export function slipHtml(x) {
120
+ const n = slipOf(x); if (!n) return '';
121
+ 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>`;
122
+ }
123
+ /** A Jira ticket as a row the date press and the bar drag know (batch 11 item 23): its key is the uid; the start and due are kept in PMOS,
124
+ * never sent to Jira. Status and title stay Jira's. */
125
+ export const jiraRow = (k) => ({ uid: k.key, start: k.start || '', end: k.due || '', title: k.key + ' ' + k.title, days: k.days || '', jira: true });
91
126
  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
127
  /** The date press: the task card's start and due picker opens right under it. No dates: a calendar icon, shown on hover. */
93
128
  export function dateBtn(x, o) {
94
129
  if (!o.quick || !x.uid) return x.days ? `<span class="${x.late ? 'w' : ''}">${esc(x.days)}</span>` : '';
95
- const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" title="Start and due"`;
130
+ const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" title="${x.jira ? 'Start and due, kept in PMOS. Jira is not changed' : 'Start and due'}"`;
131
+ // a milestone with no due date: a dashed chip asks for it, shown always (canvas XmlA6Suggest)
132
+ 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
133
  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
134
  : `<button type="button" class="iv-dc none" ${a} aria-label="${esc('Add dates: ' + x.title)}">${SVG(P.cal, 14)}</button>`;
98
135
  }
@@ -104,7 +141,7 @@ export function timelineHtml(v, o, isOpen) {
104
141
  const S = v.tasks.sections;
105
142
  // the range: the open tasks around today, a little air each side; never more than a few years
106
143
  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); } }
144
+ 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
145
  const lo = Math.max(today - 730, Math.min(today - 14, ...ns) - 4), hi = Math.min(today + 1095, Math.max(today + 42, ...ns) + 10);
109
146
  const O = lo - ((new Date(lo * 864e5).getUTCDay() + 6) % 7); // start on a Monday
110
147
  const W = Math.ceil((hi - O + 1) * px), X = (n) => Math.round((n - O) * px);
@@ -117,26 +154,62 @@ export function timelineHtml(v, o, isOpen) {
117
154
  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
155
  }
119
156
  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(', ');
157
+ // 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
158
+ const planLine = (x) => {
159
+ if (!x.cmp) return '';
160
+ const a = dn(x.cmp.start || x.cmp.due), b = dn(x.cmp.due || x.cmp.start); if (a == null) return '';
161
+ const vs = v.vs && v.vs.cmp ? v.vs.cmp.name : 'the plan';
162
+ 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>`;
163
+ };
164
+ 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>` : ''; };
165
+ const barOf = (x) => (x.wont && x.cmp ? planLine(x) : barOf0(x) + planLine(x) + slipLab(x));
166
+ const barOf0 = (x) => {
167
+ 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
168
  const av = x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : '';
123
- 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')}"`;
169
+ const lw = LK.barWords(x, o.lk);
170
+ 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 + (lw ? ', ' + lw : '') + '. Change the dates')}"`;
124
171
  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
172
  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
173
  const e = b == null ? a : Math.max(a, b);
127
174
  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>';
175
+ + (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 + LK.barExtra(x, o.lk, o.quick) + '</button>' + msEnd(x);
129
176
  };
130
- 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>`; };
177
+ // a milestone task's bar ends in its ◇ with the date beside it (canvas XmlA3Viewer); a faint dashed guide drops through the grid there.
178
+ // 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.
179
+ const msEnd = (x) => { const b = dn(x.end); if (!x.ms || b == null || x.wont || x.status === 'Archived') return '';
180
+ 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>`; };
181
+ 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)))]
182
+ .map((gx) => `<i class="ms" data-tlx="${gx}"></i>`).join('');
183
+ // a Jira ticket's bar drags and its ends change the dates kept in PMOS, as a task's do (batch 11 item 23); read-only views draw the due dot
184
+ const jbar = (k) => { if (o.quick) return barOf0(jiraRow(k)).replace(/class="ivt-(b|d|g) /, 'class="ivt-$1 jr ').replace('class="ivt-g"', 'class="ivt-g jr"');
185
+ const b = dn(k.due); return b == null ? '' : `<span class="ivt-d jr" role="img" data-ivt-jr="${esc(k.key)}" data-tlx="${X(b) + Math.round(px / 2)}" aria-label="${esc('Due ' + md(b) + ' in Jira')}" title="${esc('Jira · ' + md(b))}"></span>`; };
131
186
  const row = (n, c, cls = '') => `<div class="ivt-r${cls}"><div class="ivt-n">${n}</div><div class="ivt-c">${c}</div></div>`;
132
187
  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>`; };
188
+ // 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);
189
+ // a skip before the first dated stage or after the last draws nothing
190
+ 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; };
191
+ const SP = S.map((sec) => (sec.kind === 'stage' ? spanOf(sec) : null));
192
+ const skipLine = (i) => {
193
+ const sec = S[i]; let p = null, q = null;
194
+ for (let j = i - 1; j >= 0 && !p; j--) p = SP[j];
195
+ for (let j = i + 1; j < S.length && !q; j++) q = SP[j];
196
+ if (!p || !q) return '';
197
+ const a = p[1] + 1, b = q[0], z = b - 1, why = sec.name + ' skipped' + (sec.skipWhy ? ': ' + sec.skipWhy.replace(/\.$/, '').replace(/^./, (c) => c.toLowerCase()) : '');
198
+ // 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
199
+ const len = (u, w) => { const n = w - u + 1; return n < 7 ? n + (n === 1 ? ' day' : ' days') : Math.round(n / 7) + ' wk'; };
200
+ const say = (t0, u, w) => t0 + ', ' + md(u) + ' to ' + md(w) + ' · ' + len(u, w);
201
+ 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>`;
202
+ 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);
203
+ 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>`;
204
+ };
133
205
  let h = '';
134
- for (const sec of S) {
135
- const key = 'sec:' + (sec.key || 'none'), op = isOpen(key, sec.open), rs = flat(sec), dn_ = flatDone(sec), jr = jiraOf(sec);
136
- 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');
206
+ for (const [si, sec] of S.entries()) {
207
+ const key = 'sec:' + (sec.key || 'none'), op = isOpen(key, sec.open), rs = flat(sec), dn_ = flatDone(sec), jr = jiraOf(sec), tk = tkOf(sec);
208
+ const has = rs.length || dn_.length || jr.length || tk.length;
209
+ const head = `<button type="button" class="ivt-gh${sec.kind === 'past' || sec.kind === 'later' || 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>`;
210
+ h += row(head, sec.status === 'skip' && !has ? skipLine(si) : band(rs.concat(dn_)), ' g');
139
211
  if (!op || !has) continue;
212
+ for (const t of tk) h += row(`${tkMark(t)}${tkTitle(t)}`, '', ' k');
140
213
  for (const k of jr) h += row(`${jmark(k)}${ttitle(k)}`, jbar(k), ' k');
141
214
  for (const x of rs) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k');
142
215
  if (dn_.length) {
@@ -145,14 +218,17 @@ export function timelineHtml(v, o, isOpen) {
145
218
  if (dop) for (const x of dn_) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k x' + (x.wont ? ' wo' : ''));
146
219
  }
147
220
  }
148
- const grid = ticks.map((t) => `<i data-tlx="${t.x}"></i>`).join('');
221
+ const grid = ticks.map((t) => `<i data-tlx="${t.x}"></i>`).join('') + guides;
149
222
  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>`;
223
+ // Plan and Draft join the legend only when they are in view (batch 11 item 8)
224
+ 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>' : '') : '';
225
+ 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}`
226
+ + (/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>` : '')
227
+ + `${guides ? `<span>${SVG(P.dia, 11, 2.4)}Milestone</span>` : ''}<span>${SVG(P.jira, 12, 2)}Jira</span>${LK.legendHtml(o.lk)}${o.quick ? `<span class="h">${o.lk && o.lk.links.length ? 'Drag a bar to move it, an end to change dates, a dot to link it' : 'Drag a bar to move it; drag an end to change start or due'}</span>` : ''}</div>`;
152
228
  // it opens on today, moved left as far as the earliest open task's start, so a late bar is in view
153
229
  const firstOpen = S.flatMap(flat).flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null);
154
230
  const first = firstOpen.length ? X(Math.min(...firstOpen)) : X(today);
155
- return `<div class="ivt" data-ivt="${esc((v.id || v.key) + '|' + z[0])}" data-px="${px}" data-today="${X(today)}" data-first="${first}"><div class="ivt-sc"><div class="ivt-in" data-tlw="${W}">`
231
+ return `<div class="ivt"${LK.dataOf(o.lk)} data-ivt="${esc((v.id || v.key) + '|' + z[0])}" data-px="${px}" data-today="${X(today)}" data-first="${first}"><div class="ivt-sc"><div class="ivt-in" data-tlw="${W}">`
156
232
  + `<div class="ivt-grid" aria-hidden="true">${grid}</div>${axis}${h}<span class="ivt-today" data-tlx="${X(today) + Math.round(px / 2)}" aria-hidden="true"><i>Today</i></span></div></div></div>${legend}`;
157
233
  }
158
234
 
@@ -173,18 +249,20 @@ const colOf = (status) => (status === 'Done' ? 'Done' : status === "Won't do" ?
173
249
  export function kanbanHtml(v, o, isOpen) {
174
250
  const S = v.tasks.sections, k = stageKeyOf(v);
175
251
  const secs = k === 'all' ? S : S.filter((s) => (s.key || '-') === k);
176
- const rs = secs.flatMap((s) => flat(s).concat(flatDone(s))), jr = secs.flatMap(jiraOf);
252
+ const rs = secs.flatMap((s) => flat(s).concat(flatDone(s))), jr = secs.flatMap(jiraOf), tk = secs.flatMap(tkOf);
177
253
  const by = { 'To do': [], 'In progress': [], Done: [], "Won't do": [] };
178
254
  for (const x of rs) by[colOf(x.status)].push({ x });
179
255
  for (const t of jr) by[colOf(t.status)].push({ t });
256
+ for (const d of tk) by[d.cat === 'done' ? 'Done' : d.cat === 'doing' ? 'In progress' : 'To do'].push({ d });
180
257
  const card = (c) => {
258
+ if (c.d) return `<div class="ivk-d jr">${tkMark(c.d)}<div class="w">${tkTitle(c.d)}${c.d.av ? `<div class="ivk-m"><span class="ivt-av" aria-hidden="true">${esc(c.d.av)}</span></div>` : ''}</div></div>`;
181
259
  if (c.t) {
182
260
  const t = c.t, d = dn(t.due);
183
261
  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
262
  }
185
263
  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)}`
187
- + `<div class="ivk-m">${dateBtn(x, o)}${x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : ''}</div></div></div>`;
264
+ 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)}`
265
+ + `<div class="ivk-m">${dateBtn(x, o)}${LK.metaHtml(x, o.lk, o.quick)}${x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : ''}</div></div></div>`;
188
266
  };
189
267
  const wop = isOpen('kb:wont', false), nW = by["Won't do"].length;
190
268
  const col = ([st, lbl]) => `<section class="ivk-c" data-ivk-col="${esc(st)}" aria-label="${esc(lbl + ', ' + by[st].length)}"><h4>${esc(lbl)}${by[st].length ? `<span class="n">${by[st].length}</span>` : ''}</h4>${by[st].map(card).join('')}</section>`;
@@ -225,13 +303,29 @@ if (typeof document !== 'undefined' && document.head) {
225
303
  document.addEventListener('scroll', (e) => { if (POP && !POP.el.contains(e.target)) closePop(); }, true);
226
304
  }
227
305
  /** 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) {
306
+ /** ms: the task's ◇ flag, or null where the flag cannot change here: after a second divider, the ◇ toggle (batch 11 item 3).
307
+ * del: the task can be deleted here: last, after its own divider, the trash (batch 11 item 16; never on a Jira ticket, which has no picker). */
308
+ export function statusPopHtml(status, ms = null, del = false) {
229
309
  const b = (s) => { const k = stateKey(s), on = s === status;
230
310
  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>`;
311
+ 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>`
312
+ + (ms == null ? '' : `<span class="vr" aria-hidden="true"></span>${msToggleHtml(ms, 'data-ivq-ms')}`)
313
+ + (del ? `<span class="vr" aria-hidden="true"></span><button type="button" class="ivq-del" data-ivq-del aria-label="Delete task" title="Delete task">${SVG(P.bin, 15, 2)}</button>` : '') + '</div>';
314
+ }
315
+ /** A task this picker can delete: a Board task, a breakdown item or a draft's task. A Jira ticket draws no picker at all. */
316
+ export const deletable = (uid) => /^(?:task-|dt:)/.test(String(uid || '')) || /^[a-z0-9][a-z0-9-]*\.[0-9a-z]{10}$/.test(String(uid || ''));
317
+ /** The ◇ toggle: icon only, "◇ Milestone" while pressed; its tooltip says what it does. attr: the press's data attribute. */
318
+ export function msToggleHtml(on, attr) {
319
+ 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';
320
+ 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
321
  }
233
322
  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); });
323
+ const ms = H.milestone && anchor.dataset.ms != null ? anchor.dataset.ms === '1' : null;
324
+ openPop(anchor, statusPopHtml(status, ms, !!H.remove && deletable(uid)), (b) => {
325
+ if ('ivqMs' in b.dataset) { closePop(); H.milestone(uid, !ms); return; }
326
+ if ('ivqDel' in b.dataset) { closePop(); H.remove(uid); return; }
327
+ const s = b.dataset.ivqState; if (!s) return; closePop(); if (s !== status && H.status) H.status(uid, s);
328
+ });
235
329
  }
236
330
  function datePop(anchor, uid, H) {
237
331
  const t = { start: anchor.dataset.s || '', due: anchor.dataset.e || '' }, st = { field: 'due', month: '' };
@@ -260,7 +354,13 @@ let LONG = 0; // a long press opened the status picker: the click that follows
260
354
  /** A press inside the Tasks section that this file owns. → true when handled. */
261
355
  export function press(b, d, root, H, e) {
262
356
  const id = root.dataset.iv;
263
- if (d.ivView) { setViewMode(d.ivView); closePop(); if (H.redraw) H.redraw(); return true; }
357
+ if (d.ivView) {
358
+ // a narrow header shows only the view in use (batch 11 item 20, XtaA5Phone: the group icon, the view, + and Make live fit at 390 px);
359
+ // its press opens the three as a menu
360
+ const hidden = [...b.parentElement.querySelectorAll('[data-iv-view]')].some((x) => x !== b && !x.offsetParent);
361
+ if (hidden && d.ivView === viewMode()) { menuPop(b, 'Tasks view', VIEWS.map(([k, l]) => ({ k, label: l, on: k === viewMode() })), (x) => { setViewMode(x.k); if (H.redraw) H.redraw(); }); return true; }
362
+ setViewMode(d.ivView); closePop(); if (H.redraw) H.redraw(); return true;
363
+ }
264
364
  if ('ivZoom' in d) { menuPop(b, 'Zoom', ZOOMS.map(([k, l]) => ({ k, label: l, on: k === zoomOf() })), (x) => { ZOOM = x.k; store.set('pmos.tasks.zoom', x.k); if (H.redraw) H.redraw(); }); return true; }
265
365
  if ('ivKstage' in d) {
266
366
  const v = H.__v; if (!v) return true;
@@ -279,7 +379,7 @@ export function press(b, d, root, H, e) {
279
379
  /* ── the drags, and the long press ── */
280
380
  let DRAGGED = false;
281
381
  const coarse = () => typeof matchMedia === 'function' && matchMedia('(pointer: coarse)').matches;
282
- export function wireDrag(body) {
382
+ export function wireDrag(body, after) {
283
383
  if (!body || body.__ivtDrag) return;
284
384
  body.__ivtDrag = true;
285
385
  body.addEventListener('contextmenu', (e) => { if (e.target.closest && e.target.closest('[data-iv-check]') && coarse()) e.preventDefault(); });
@@ -304,6 +404,7 @@ export function wireDrag(body) {
304
404
  sc.scrollLeft = SCROLL.has(k) ? SCROLL.get(k) : Math.max(0, Math.min((+T.dataset.today || 0) - Math.max(0, sc.clientWidth - nw) * 0.25, (+T.dataset.first || 0) - 16));
305
405
  sc.addEventListener('scroll', () => SCROLL.set(k, sc.scrollLeft), { passive: true });
306
406
  }
407
+ if (after) after();
307
408
  };
308
409
  if (typeof MutationObserver === 'function') new MutationObserver(settle).observe(body, { childList: true, subtree: true });
309
410
  settle();