create-pmos 0.418.0 → 0.420.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 (64) hide show
  1. package/package.json +25 -30
  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/lane-defs.js +14 -1
  6. package/payload/scripts/workflow-state.js +2 -2
  7. package/payload/state/discoveries.md +1 -1
  8. package/workspace/board-programs-test.js +15 -1
  9. package/workspace/briefing-premium-board-test.js +11 -15
  10. package/workspace/changelog.json +24 -0
  11. package/workspace/fixtures/report-api/draft.json +2 -1
  12. package/workspace/guide/briefing-premium.md +2 -2
  13. package/workspace/guide/home.md +2 -0
  14. package/workspace/home-other-product-test.js +18 -0
  15. package/workspace/home-rows-test.js +14 -0
  16. package/workspace/lib/board-cli.js +1 -1
  17. package/workspace/lib/board-premium.js +13 -3
  18. package/workspace/lib/brief.js +5 -0
  19. package/workspace/lib/coredoc-cli.js +2 -0
  20. package/workspace/lib/engine/lane-defs.js +14 -1
  21. package/workspace/lib/engine/workflow-state.js +2 -2
  22. package/workspace/lib/hold-spans.js +64 -0
  23. package/workspace/lib/initiative-chat.js +2 -0
  24. package/workspace/lib/mention-store.js +49 -13
  25. package/workspace/lib/plan-tree.js +1 -1
  26. package/workspace/lib/report-draft.js +6 -0
  27. package/workspace/lib/routes-boards.js +38 -4
  28. package/workspace/lib/source-reads.js +5 -0
  29. package/workspace/lib/vendor/scripts/lane-defs.js +14 -1
  30. package/workspace/lib/vendor/scripts/workflow-state.js +2 -2
  31. package/workspace/package-lock.json +2 -2
  32. package/workspace/package.json +1 -1
  33. package/workspace/public/pm/bd-acts.js +49 -1
  34. package/workspace/public/pm/bd-ini-panel.js +15 -8
  35. package/workspace/public/pm/bd-next.js +119 -0
  36. package/workspace/public/pm/bd-prog.js +1 -1
  37. package/workspace/public/pm/bd-scroll.js +4 -4
  38. package/workspace/public/pm/bd-span.js +127 -29
  39. package/workspace/public/pm/bd-views.js +7 -5
  40. package/workspace/public/pm/cozy-board.css +55 -10
  41. package/workspace/public/pm/cozy-today.css +9 -0
  42. package/workspace/public/pm/cozy-viewer.js +7 -3
  43. package/workspace/public/pm/cozy.css +10 -0
  44. package/workspace/public/pm/home-app.js +39 -13
  45. package/workspace/public/pm/home-ini.js +42 -11
  46. package/workspace/public/pm/home-list.js +22 -2
  47. package/workspace/public/pm/home-mentions.js +1 -1
  48. package/workspace/public/pm/home-today.js +13 -2
  49. package/workspace/public/pm/ini-tasks.js +363 -0
  50. package/workspace/public/pm/ini-view-model.js +19 -11
  51. package/workspace/public/pm/ini-view.css +160 -0
  52. package/workspace/public/pm/ini-view.js +39 -8
  53. package/workspace/public/pm/premium-board.js +55 -18
  54. package/workspace/public/pm/premium-vw-mtg.js +2 -0
  55. package/workspace/public/pm/task-card.js +6 -0
  56. package/workspace/skills/day-check.skill +2 -2
  57. package/workspace/skills/morning-brief.skill +1 -1
  58. package/workspace/skills/sources-read.skill +8 -4
  59. package/workspace/task-press-test.js +120 -0
  60. package/workspace/task-views-test.js +245 -0
  61. package/workspace/test-lists/task-press.json +6 -0
  62. package/workspace/test-lists/task-views.json +6 -0
  63. package/workspace/test-lists/timeline-holds.json +6 -0
  64. package/workspace/timeline-holds-test.js +191 -0
@@ -0,0 +1,119 @@
1
+ /* pm/bd-next.js — the Board's Next cell (batch 9 item 4; canvas XocA, XocAList, XocAPhone): one line that says what finishes the step next.
2
+ * The stage track, the List and the phone draw the same cell.
3
+ *
4
+ * nextOf(r, ctx) → { you, verb, obj, tail, tone, count, due, act } | null PURE. ctx: { self (a PMOS-self board: the stage moves with the files) }
5
+ * nextHtml(r, o) → the cell's markup. o: { self, icon (false on the phone), due (false in the List: Finish says the date) }
6
+ *
7
+ * The line is `[blue dot when it waits on the PM] <verb> <object in blue ink>`, the count muted on the right, and an icon action only where
8
+ * PMOS can do the step itself (draft with Claude, move the stage, add a stage task, link the epic, read Jira). The icon is a button with
9
+ * data-nx (draft | move | add | epic | jira) and data-nxrow (the row key); the page runs it. Nothing is invented: a step with no record
10
+ * behind it draws nothing (zero is silence), and the initiative's whole progress is never shown as the step's. */
11
+ import { esc } from './premium-shell.js';
12
+ import { sectionOf } from './ini-view-model.js';
13
+
14
+ const PF = 'product-feature';
15
+ const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
16
+ const IC = {
17
+ draft: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', move: 'M5 12h14M13 6l6 6-6 6', add: 'M12 5v14M5 12h14',
18
+ epic: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1', jira: 'M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7',
19
+ };
20
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
21
+ const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MON[+m[2] - 1] : ''; };
22
+ // a part's name as the line says it, and the verb that writes it ("Write the problem statement")
23
+ const PART = {
24
+ problem: ['Write the', 'problem statement'], users: ['Describe the', 'users'], evidence: ['Add the', 'evidence'], scope: ['Write the', 'scope'],
25
+ 'success metric': ['Set the', 'success metric'], 'success measure': ['Set the', 'success measure'], risks: ['List the', 'risks'],
26
+ 'business case': ['Write the', 'business case'], 'who asked': ['Name', 'who asked'], timeline: ['Set the', 'timeline'], tickets: ['Draft the', 'tickets'],
27
+ 'KR or health budget': ['Pick the', 'KR or health budget'], rank: ['Rank it on the', 'roadmap'],
28
+ report: ['Draft the', 'outcome report'], evaluation: ['Write the', 'evaluation'], 'your verdict': ['Give', 'your verdict'],
29
+ };
30
+ // the parts PMOS can draft with Claude (a document's section); the others are the PM's or another tool's
31
+ const DRAFTS = new Set(['problem', 'users', 'evidence', 'scope', 'success metric', 'success measure', 'risks', 'business case', 'report', 'evaluation']);
32
+ const OUT = { triage: 'BRD', discover: 'PRD' };
33
+ const OPEN_TK = ['In review', 'In progress', 'To do'];
34
+ const CLOSED = new Set(['Done', "Won't do", 'Archived']);
35
+
36
+ /** The stage after the current one, by the row's own list of stage names (the ⋯ menu's Move to). */
37
+ function nextStage(r) {
38
+ const a = r.acts || {}, L = a.stages || [], i = L.indexOf(a.stage);
39
+ return i >= 0 && L[i + 1] ? L[i + 1] : null;
40
+ }
41
+ const canMove = (r, ctx) => !(ctx && ctx.self) && !(r.acts && r.acts.life);
42
+ function moveLine(r, ctx, count) {
43
+ const to = nextStage(r);
44
+ return to ? { you: true, verb: 'Move to', obj: to, count, act: canMove(r, ctx) ? { kind: 'move', label: 'Move to ' + to } : null } : null;
45
+ }
46
+ /** A part of the step's output, as the line: Write the <part>, or Review the <part> when the part waits on the PM. */
47
+ function partLine(p, count, draftable) {
48
+ const [verb, obj] = PART[p.name] || ['Finish the', p.name];
49
+ if (/verdict/.test(p.name)) return { you: true, verb: 'Give', obj: 'your verdict', count }; // the verdict is always the PM's
50
+ if (p.you && /^your /.test(p.name)) return { you: true, verb: 'Give', obj: p.name, count }; // "your review": Give your review
51
+ if (p.you) return { you: true, verb: 'Review the', obj, count };
52
+ return { verb, obj, count, act: draftable && DRAFTS.has(p.name) ? { kind: 'draft', label: 'Draft the ' + obj + ' with Claude', q: 'Draft the ' + obj } : null };
53
+ }
54
+ /** The open parts in the order the line reads them: one that waits on the PM first, then the first not done. */
55
+ const firstPart = (parts) => parts.find((p) => !p.done && p.you) || parts.find((p) => !p.done) || null;
56
+ /** A task title split into its verb and the rest: "Score vendor B's POC" → Score + vendor B's POC; a title that does not start with a word is finished. */
57
+ function taskLine(title) {
58
+ const m = /^([A-Z][a-z]+)\s+(\S.*)$/.exec(String(title || '').trim());
59
+ return m ? { verb: m[1], obj: m[2] } : { verb: 'Finish', obj: String(title || '').trim() };
60
+ }
61
+
62
+ export function nextOf(r, ctx = {}) {
63
+ if (!r || (r.acts && (r.acts.life === 'cancelled' || r.acts.archived))) return null;
64
+ const t = r.track || {}, it = r.trail || {};
65
+ // another workflow: the first open task of its stage, by order
66
+ if (r.wf && r.wf.id && r.wf.id !== PF && r.wfStage) {
67
+ const st = r.wfStage, list = r.wfStages || [st];
68
+ const mine = (r.tasks || []).filter((k) => sectionOf(k, list) === st.key && k.status !== 'Archived')
69
+ .map((k, i) => ({ k, i })).sort((a, b) => (Number.isFinite(a.k.order) ? a.k.order : 1e9 + a.i) - (Number.isFinite(b.k.order) ? b.k.order : 1e9 + b.i)).map((x) => x.k);
70
+ const counted = mine.filter((k) => k.status !== "Won't do"), done = counted.filter((k) => k.status === 'Done').length;
71
+ if (!mine.length) return { verb: 'Add what finishes', obj: st.name, act: { kind: 'add', label: 'Add a task to ' + st.name, stage: st.key } };
72
+ const open = mine.find((k) => !CLOSED.has(k.status));
73
+ const count = counted.length ? done + '/' + counted.length + ' tasks' : '';
74
+ return open ? { ...taskLine(open.title), count } : moveLine(r, ctx, count);
75
+ }
76
+ const key = t.key;
77
+ if (!key) return null;
78
+ if (key === 'build' || key === 'deliver') {
79
+ const tk = t.tickets || [];
80
+ if (tk.length) {
81
+ const p = t.prog || {}, count = p.total ? p.done + '/' + p.total + (p.unit === 'pts' ? ' pts' : ' tickets') : '';
82
+ const open = tk.filter((k) => k.status !== 'Done');
83
+ const pick = open.find((k) => k.blocked) || OPEN_TK.map((s) => open.find((k) => !k.blocked && k.status === s)).find(Boolean);
84
+ if (pick) return { verb: 'Finish', obj: pick.key, tail: open.length > 1 ? (open.length - 1) + ' more' : '', tone: pick.blocked ? 'red' : '', count, title: pick.key + ' · ' + pick.title + (pick.blocked ? ' · blocked' : '') };
85
+ if (key === 'deliver') return { you: true, verb: 'Give your', obj: 'sign-off', count };
86
+ return moveLine(r, ctx, count);
87
+ }
88
+ const epic = (it.links && it.links.epic) || (r.epics || [])[0] || null;
89
+ return epic ? { verb: 'Read', obj: 'Jira', act: { kind: 'jira', label: 'Read Jira again for ' + epic } } : { verb: 'Link the', obj: 'Jira epic', act: { kind: 'epic', label: 'Link the Jira epic' } };
90
+ }
91
+ const due = (key === 'monitor' || key === 'evaluate') && r.end ? 'due ' + dm(r.end) : '';
92
+ if (key === 'monitor') return { verb: 'Draft the', obj: 'outcome report', due, act: { kind: 'draft', label: 'Draft the outcome report with Claude', q: 'Draft the outcome report' } };
93
+ // the parts of the step: the trail's (the documents' headings, the tickets drafted), else what the model counts (Prioritize's anchor and rank)
94
+ let parts = Array.isArray(it.parts) && it.parts.length ? it.parts : null;
95
+ if (!parts && (key === 'plan' || key === 'prioritize')) parts = (t.segs || []).filter((s) => s.st === 'done' || s.st === 'to do').map((s) => ({ name: key === 'prioritize' && /^kr/i.test(s.name) ? 'KR or health budget' : s.name.toLowerCase(), done: s.st === 'done' }));
96
+ if (!parts || !parts.length) return key === 'evaluate' ? { verb: 'Draft the', obj: 'outcome report', due, act: { kind: 'draft', label: 'Draft the outcome report with Claude', q: 'Draft the outcome report' } } : null;
97
+ // Plan's ticket part says how many: "3 tickets drafted, waiting on you" is the PM's Commit
98
+ parts = parts.map((p) => (/tickets/.test(p.name) ? { ...p, name: 'tickets', pushed: /pushed/.test(p.name) } : p));
99
+ const d = parts.filter((p) => p.done).length, n = parts.length;
100
+ const count = OUT[key] ? OUT[key] + ' ' + d + '/' + n : key === 'evaluate' ? '' : d + '/' + n + ' parts';
101
+ const p = firstPart(parts);
102
+ if (!p) return moveLine(r, ctx, count);
103
+ const L = partLine(p, count, true);
104
+ if (p.name === 'tickets' && p.you) { L.verb = 'Commit the'; L.obj = 'drafted tickets'; } else if (p.pushed) L.verb = 'Push the';
105
+ return { ...L, due };
106
+ }
107
+
108
+ /** The cell. The icon is ghosted and lights with the row's hover or focus; the phone draws no icon (the row opens the panel). */
109
+ export function nextHtml(r, o = {}) {
110
+ const x = nextOf(r, o);
111
+ if (!x) return '';
112
+ const words = (x.verb ? x.verb + ' ' : '') + x.obj + (x.tail ? ' · ' + x.tail : '');
113
+ const count = [x.count, o.due === false ? '' : x.due].filter(Boolean)[0] || '';
114
+ const act = x.act && o.icon !== false
115
+ ? `<button type="button" class="bd-nxa" data-nx="${esc(x.act.kind)}" data-nxrow="${esc(r.key)}"${x.act.q ? ` data-q="${esc(x.act.q)}"` : ''}${x.act.stage ? ` data-stage="${esc(x.act.stage)}"` : ''} aria-label="${esc(x.act.label)}" title="${esc(x.act.label)}">${SV(IC[x.act.kind])}</button>` : '';
116
+ return `<div class="bd-nx">${x.you ? '<i class="cz-dot you" role="img" aria-label="Waits on you"></i>' : ''}`
117
+ + `<span class="tx" title="${esc(x.title || words)}">${x.verb ? esc(x.verb) + ' ' : ''}<em${x.tone ? ` class="${x.tone}"` : ''}>${esc(x.obj)}</em>${x.tail ? ' · ' + esc(x.tail) : ''}</span>`
118
+ + `${count ? `<span class="mu">${esc(count)}</span>` : ''}${act}</div>`;
119
+ }
@@ -155,7 +155,7 @@ export function bandHtml(g, st, o) {
155
155
  const open2 = (st.milestones || []).filter((m) => !m.done).sort((a, b) => String(a.date || '9999').localeCompare(String(b.date || '9999')));
156
156
  const nx = open2[0], af = open2[1];
157
157
  const late = nx && nx.late;
158
- const ms = nx ? `<div class="bd-pm${late ? ' late' : ''}"${nx.titles && nx.titles.length ? ` title="${esc('Waits on ' + nx.titles.join(' and ') + ' reaching Deliver')}"` : ''}><i class="bd-dm"></i><b>${esc(nx.name)}</b>${esc(nx.day || '')}${readyHtml(nx, whole(st))}</div>` : '<div class="bd-pm q">No milestone on record</div>';
158
+ const ms = nx ? `<div class="bd-pm${late ? ' late' : ''}"${nx.titles && nx.titles.length ? ` title="${esc('Waits on ' + nx.titles.join(' and ') + ' reaching Deliver')}"` : ''}><i class="bd-dm"></i><b>${esc(nx.name)}</b>${esc(nx.day || '')}${readyHtml(nx, whole(st))}</div>` : ''; // no milestone: the Next cell is blank (XocA)
159
159
  const tasks = (st.openTasks || []).length;
160
160
  const t3 = [af ? `<i class="bd-dm o"></i>${esc(af.name + (af.day ? ' ' + af.day : ''))}` : '', tasks ? tasks + ' program ' + plural(tasks, 'task', 'tasks') : ''].filter(Boolean).join(' · ');
161
161
  const meta = n > 1 ? n + ' products' : st.state;
@@ -110,10 +110,10 @@ function update() {
110
110
  }
111
111
 
112
112
  /** Scroll a stretch of the track into view: centred, or its near end in view when it is wider than the screen. */
113
- function bring(a, b, side) {
113
+ function bring(a, b, side, smooth = true) {
114
114
  const v = view();
115
- if (b - a < v.w * 0.9) scrollToX((a + b) / 2 - v.w / 2, true);
116
- else scrollToX(side === 'l' ? b - v.w * 0.85 : a - v.w * 0.15, true);
115
+ if (b - a < v.w * 0.9) scrollToX((a + b) / 2 - v.w / 2, smooth);
116
+ else scrollToX(side === 'l' ? b - v.w * 0.85 : a - v.w * 0.15, smooth);
117
117
  }
118
118
 
119
119
  function onClick(e) {
@@ -156,7 +156,7 @@ export function reveal(key) {
156
156
  const p = row.querySelector('.tg-p[data-a]');
157
157
  if (p && !cur.fixed) {
158
158
  const a = (+p.dataset.a / 100) * cur.tw, b = (+p.dataset.b / 100) * cur.tw, v = view();
159
- if (b < v.l || a > v.l + v.w) bring(a, b, b < v.l ? 'l' : 'r');
159
+ if (b < v.l || a > v.l + v.w) bring(a, b, b < v.l ? 'l' : 'r', false); // at once: Find opens the initiative next, and the redraw keeps the scroll it reads
160
160
  }
161
161
  row.scrollIntoView({ block: 'nearest' });
162
162
  row.classList.remove('tint'); void row.offsetWidth; row.classList.add('tint');
@@ -3,7 +3,7 @@
3
3
  * the Jira forecast.
4
4
  * · Quarter, Half, Year, 2 yr and 5 yr draw the same rows: programs first, then products, one row per initiative, the plan bar with its done
5
5
  * part, the days over, the Jira forecast and the ◇ Deliver or Evaluate date. Only the scale changes: weeks (Quarter), months (Half and
6
- * Year), quarters (2 yr) and years (5 yr). On 2 yr and 5 yr a date reads "Nov ’26". Monitor and Evaluate are hidden, as on Quarter.
6
+ * Year), quarters (2 yr) and years (5 yr). On 2 yr and 5 yr a date reads "Nov ’26". Every stage shows, Monitor and Evaluate too (feedback batch 8 item 2).
7
7
  * · From Quarter on the timeline is wider than the screen and scrolls sideways (pm/bd-scroll.js wires it): it runs from one column before the
8
8
  * first date on record to one column after the last, with the ends shaded. A screen shows seven weeks, six months, twelve months, eight
9
9
  * quarters or five years (a phone three, three, four, four and two).
@@ -14,7 +14,12 @@
14
14
  * A phone draws the sprint's two weeks in the rows of the other spans.
15
15
  * Milestones: a release's sign-off (◆ with its name), "Push tickets" where drafted tickets wait on the Commit, and "after <initiative>" where a
16
16
  * dependency is not done. Program milestones closer than about 120 px merge into one counted diamond. A bar is drawn only from dates a record
17
- * holds. Pure: rows and the model in, markup out. */
17
+ * holds. Pure: rows and the model in, markup out.
18
+ * Idle time (feedback batch 9 item 8; XtiA1Desk, XtiA2Hold, XtiA4Long, XtiA3Phone, XtiAHard, XtiAGrill): a hold breaks the bar into a dotted gap with a
19
+ * ⏸ button where it stopped and the return date where it starts again (a phone keeps the ⏸ only); a stretch of 4 weeks or more with no dated work just
20
+ * breaks it. The done part fills the pieces in order and skips the gaps. No return date: dotted to today, the rest faded. Return date passed: dotted to
21
+ * today in the late colour. Return after Deliver: the ◇ turns amber and says so; no date is moved. A gap narrower than 8 px closes up. The program line
22
+ * is dotted where every member is on hold. */
18
23
  import { esc } from './premium-shell.js';
19
24
  import { mergeClose } from './program-model.js';
20
25
 
@@ -31,7 +36,7 @@ export const DRAWN = new Set(SPANS.map(([k]) => k));
31
36
  const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
32
37
  const FLAG = 'M5 21V4M5 4h11l-2 4 2 4H5';
33
38
  const LINK = 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1';
34
- const CHL = 'M15 6l-6 6 6 6', CHR = 'M9 6l6 6-6 6';
39
+ const CHL = 'M15 6l-6 6 6 6', CHR = 'M9 6l6 6-6 6', PAUSE = 'M9 6v12M15 6v12';
35
40
 
36
41
  /** The scale of each span from Quarter on (TsAllSpans): its column, and how many columns one screen shows on a desktop and on a phone. */
37
42
  export const SCALE = { quarter: { unit: 'w', cols: 7, ph: 3 }, half: { unit: 'm', cols: 6, ph: 3 }, year: { unit: 'm', cols: 12, ph: 4 }, y2: { unit: 'q', cols: 8, ph: 4 }, y5: { unit: 'y', cols: 5, ph: 2 } };
@@ -75,30 +80,49 @@ const P = (x) => x.toFixed(2) + '%';
75
80
  const doneOf = (r) => { const p = r.track && r.track.prog; return p ? Math.max(0, Math.min(100, (p.done / Math.max(1, p.total)) * 100)) : 0; };
76
81
  const toneOf = (r) => (r.late ? 'late' : r.status === 'at risk' ? 'risk' : r.track && r.track.you ? 'you' : r.status === 'on track' ? 'ok' : 'q');
77
82
  const dated = (r) => day(r.start) || day(r.end) || (r.track && day(r.track.forecast));
78
- const hidden = (r) => r.track && (r.track.key === 'monitor' || r.track.key === 'evaluate');
79
83
  /** Done work leaves no edge tab (TsCGrill 5): the initiative is past Deliver, or every part it counts is done. */
80
84
  const isDone = (r) => !!(r.track && (r.track.k >= 6 || (r.track.prog && r.track.prog.total > 0 && r.track.prog.done >= r.track.prog.total)));
81
- /** The first and last mark of a row: the plan, the forecast, and today while it is over. */
85
+ /** A row's holds as spans on the bar: [{ a, b, kind, h, i }]. kind: past (resumed), open (the return date ahead), over (the return date passed:
86
+ * dotted on to today), none (no return date: dotted to today). Only the ones that touch the plan (XtiAHard). */
87
+ export function holdSpans(r, now) {
88
+ const s = day(r.start), e = day(r.end), out = [];
89
+ (Array.isArray(r.holds) ? r.holds : []).forEach((h, i) => {
90
+ const a = day(h.from); if (!a) return;
91
+ const to = day(h.to), back = day(h.back);
92
+ const kind = to ? 'past' : !back ? 'none' : back < now ? 'over' : 'open';
93
+ const b = to || (kind === 'open' ? back : now);
94
+ if (b <= a || (s && b <= s) || (e && a >= e)) return;
95
+ out.push({ a: s && a < s ? s : a, b, kind, h, i });
96
+ });
97
+ return out;
98
+ }
99
+ /** The open hold of a row whose return date is ahead (the edge tab and the clash flag read it), or null. */
100
+ const openBack = (r, now) => { const o = holdSpans(r, now).find((x) => x.kind === 'open'); return o ? o.b : null; };
101
+ /** Whether any of `rows` draws a hold (the legend's "On hold" key shows only then: zero is silence). */
102
+ export const hasHold = (rows, now = new Date()) => (rows || []).some((r) => day(r.start) && day(r.end) && holdSpans(r, now).length);
103
+ /** The first and last mark of a row: the plan, the forecast, a return date ahead, and today while it is over. */
82
104
  function extentOf(r, now) {
83
105
  const s = day(r.start), e = day(r.end), fc = r.track && day(r.track.forecast), ds = [s, e, fc].filter(Boolean);
106
+ const ob = openBack(r, now); if (ob && s) ds.push(ob);
84
107
  if (r.over && e && now > e) ds.push(now);
85
108
  return ds.length ? { a: new Date(Math.min(...ds)), b: new Date(Math.max(...ds)) } : null;
86
109
  }
87
110
 
88
111
  /** One initiative's marks: the plan with its done part, the days over, the forecast past the plan, and one label after the furthest mark. A
89
112
  * date reads by the span's scale (o.fmt). */
90
- function qBar(r, X, now, phone, fmt) {
113
+ function qBar(r, X, now, phone, fmt, pxPct) {
91
114
  const s = day(r.start), e = day(r.end), fc = r.track && day(r.track.forecast), tone = toneOf(r);
92
- let out = marks(r, X, now, phone);
115
+ let out = marks(r, X, now, phone), clash = null;
93
116
  if (s && e) {
94
- const l = X(s), w = Math.max(0.15, X(e) - l);
95
- out += `<span class="tg-bar t-${tone}" data-key="${esc(r.key)}" style="left:${P(l)};width:${P(w)}" title="PMOS plan ${esc(md(s))} to ${esc(md(e))}"><b style="width:${doneOf(r).toFixed(1)}%"></b></span>`;
117
+ const g = gapsHtml(r, X, now, phone, fmt, pxPct || 0, s, e, tone);
118
+ out += g.html; clash = g.clash;
96
119
  const over = r.over && now > e, late = fc && fc > e, words = [];
97
120
  if (over) { out += `<span class="tg-over" style="left:${P(X(e))};width:${P(Math.max(0.1, X(now) - X(e)))}"></span>`; words.push(r.overDays + ' ' + (r.overDays === 1 ? 'day' : 'days') + ' over'); }
98
121
  if (late) { out += `<span class="tg-fc" style="left:${P(X(e))};width:${P(X(fc) - X(e))}" title="Jira forecast ${esc(md(fc))}"></span>`; words.push('Jira forecast ' + fmt(fc)); }
99
122
  // the committed end is the Deliver or Evaluate ◇ (PgTimeline), with its date right of it; filled while the initiative is at that milestone
100
- out += `<i class="tg-end${r.track && r.track.ms ? ' ms' : ''}${over ? ' late' : ''}" style="left:${P(X(e))}" title="${esc((r.track && r.track.k >= 6 ? 'Committed evaluation date ' : 'Committed delivery date ') + md(e))}"></i>`;
101
- if (words.length && !phone) out += `<span class="tg-lab ${over ? 'late' : 'fc'}" style="left:${P(Math.max(over ? X(now) : 0, late ? X(fc) : 0))}">${esc((over ? '' : fmt(e) + ' · ') + words.join(' · '))}</span>`;
123
+ out += `<i class="tg-end${r.track && r.track.ms ? ' ms' : ''}${over || clash ? ' late' : ''}" style="left:${P(X(e))}" title="${esc((r.track && r.track.k >= 6 ? 'Committed evaluation date ' : 'Committed delivery date ') + md(e) + (clash ? '. ' + clash : ''))}"></i>`;
124
+ if (clash && !phone) out += `<span class="tg-lab late tg-clash" style="left:${P(X(e))}">${esc(fmt(e) + ' · ' + clash)}</span>`;
125
+ else if (words.length && !phone) out += `<span class="tg-lab ${over ? 'late' : 'fc'}" style="left:${P(Math.max(over ? X(now) : 0, late ? X(fc) : 0))}">${esc((over ? '' : fmt(e) + ' · ') + words.join(' · '))}</span>`;
102
126
  else if (!phone) out += `<span class="tg-endl" style="left:${P(X(e))}">${esc(fmt(e))}</span>`;
103
127
  } else if (fc) {
104
128
  out += `<span class="tg-fc solo" style="left:${P(X(fc))};width:12px;margin-left:-12px" title="Jira forecast ${esc(md(fc))}"></span>${phone ? '' : `<span class="tg-lab fc" style="left:${P(X(fc))}">Jira forecast ${esc(fmt(fc))}</span>`}`;
@@ -108,6 +132,60 @@ function qBar(r, X, now, phone, fmt) {
108
132
  return out;
109
133
  }
110
134
 
135
+ const MIN_PX = 8; // a hold or a gap narrower than this closes up (XtiA4Long, XtiAGrill 12)
136
+ /** A hold's dates: "Oct 12 to Mar 1, 2027" (the year when it ends in another one). */
137
+ export const holdRange = (h) => { const a = day(h.from), b = day(h.to || h.back); return md(a) + (b ? ' to ' + md(b) + (b.getFullYear() !== a.getFullYear() ? ', ' + b.getFullYear() : '') : ''); };
138
+ /** A hold's words for its ⏸ button and its menu (XtiAGrill 18): "On hold, Oct 12 to Mar 1, 2027, waits on the SMS vendor contract". */
139
+ export function holdWords(x, now) {
140
+ const h = x.h, why = h.reason ? ', ' + h.reason.replace(/\.$/, '').replace(/^./, (c) => c.toLowerCase()) : '';
141
+ if (x.kind === 'past') return 'Was on hold, ' + holdRange(h) + why;
142
+ if (x.kind === 'none') return 'On hold since ' + md(day(h.from)) + ', no return date' + why;
143
+ if (x.kind === 'over') { const n = Math.round((now - day(h.back)) / 86400000); return 'On hold, ' + holdRange(h) + why + '. The return date passed ' + n + ' ' + (n === 1 ? 'day' : 'days') + ' ago'; }
144
+ return 'On hold, ' + holdRange(h) + why;
145
+ }
146
+ /** The plan bar cut by its holds and its plain gaps: the pieces (the done part fills them in order and skips the gaps), each hold's dotted line and ⏸,
147
+ * and the return date where the bar starts again. → { html, clash } — clash: the words when the return date falls after the end ◇. */
148
+ function gapsHtml(r, X, now, phone, fmt, pxPct, s, e, tone) {
149
+ const wide = (a, b) => !pxPct || (X(b) - X(a)) * pxPct >= MIN_PX;
150
+ // a resumed hold narrower than 8 px closes up; a hold still running always shows, so its ⏸ is there to press
151
+ const H = holdSpans(r, now), shown = H.filter((x) => x.kind !== 'past' || wide(x.a, x.b));
152
+ const cut = shown.map((x) => [x.a, x.b, x]);
153
+ for (const g of Array.isArray(r.gaps) ? r.gaps : []) {
154
+ const a = day(g.from), b = day(g.to);
155
+ if (!a || !b || b <= s || a >= e || !wide(a, b) || H.some((x) => x.a < b && x.b > a)) continue;
156
+ cut.push([a < s ? s : a, b > e ? e : b, null]);
157
+ }
158
+ cut.sort((p, q) => p[0] - q[0]);
159
+ // the pieces: the plan minus the cuts; after a hold with no return date the rest of the plan is faded (nobody knows when it starts)
160
+ const pieces = []; let at = s, faded = false;
161
+ for (const [a, b, x] of cut) {
162
+ if (a > at) pieces.push([at, a < e ? a : e, faded]);
163
+ if (b > at) at = b;
164
+ if (x && x.kind === 'none') faded = true;
165
+ }
166
+ if (at < e) pieces.push([at, e, faded]);
167
+ const days = (p) => Math.max(0, (p[1] - p[0]) / 86400000), total = pieces.reduce((n, p) => n + days(p), 0);
168
+ let left = (doneOf(r) / 100) * total;
169
+ const hold = H.length ? '. ' + H.map((x) => holdWords(x, now)).join('. ') : '';
170
+ let html = pieces.map((p, i) => {
171
+ const d = days(p), f = d ? Math.max(0, Math.min(1, left / d)) : 0; left -= d;
172
+ const xl = i > 0 || p[0] > s ? ' xl' : '', xr = i < pieces.length - 1 || p[1] < e ? ' xr' : '';
173
+ return `<span class="tg-bar t-${tone}${xl}${xr}${p[2] ? ' fd' : ''}" data-key="${esc(r.key)}" style="left:${P(X(p[0]))};width:${P(Math.max(0.15, X(p[1]) - X(p[0])))}" title="${esc('PMOS plan ' + md(s) + ' to ' + md(e) + hold)}"><b style="width:${(f * 100).toFixed(1)}%"></b></span>`;
174
+ }).join('');
175
+ for (const x of shown) {
176
+ const late = x.kind === 'over' ? ' late' : '', l = X(x.a), w = X(x.b) - l, narrow = pxPct && w * pxPct < 34;
177
+ html += `<span class="tg-gap${late}" style="left:${P(l)};width:${P(w)}" aria-hidden="true"></span>`;
178
+ html += `<button type="button" class="tg-pz${late}${narrow ? ' sm' : ''}" data-hold="${esc(r.key)}" data-i="${x.i}" style="left:${narrow ? P(l + w / 2) : `calc(${P(l)} + 11px)`}" aria-label="${esc(holdWords(x, now) + (x.kind === 'none' ? '. Set a return date' : '. Open the hold'))}" aria-haspopup="dialog">${SV(PAUSE)}</button>`;
179
+ if (phone) continue;
180
+ if (x.kind === 'open' && x.b < e) html += `<span class="tg-hl" style="left:${P(X(x.b))}">${esc(fmt(x.b))}</span>`;
181
+ else if (x.kind === 'over') { const n = Math.round((now - day(x.h.back)) / 86400000); html += `<span class="tg-hl late" style="left:${P(X(x.b))}">${esc(md(day(x.h.back)) + ' · ' + n + ' ' + (n === 1 ? 'day' : 'days') + ' ago')}</span>`; }
182
+ else if (x.kind === 'none') html += `<span class="tg-hl" style="left:${P(X(x.b))}">no return date</span>`;
183
+ }
184
+ const ob = H.find((x) => x.kind === 'open' && x.b > e);
185
+ const clash = ob ? (r.track && r.track.k >= 6 ? 'Evaluate' : 'Deliver') + ' is before the return, ' + md(ob.b) : null;
186
+ return { html, clash };
187
+ }
188
+
111
189
  /** A row's milestones: its release's sign-off (◆ at the release date), "Push tickets" where drafted tickets wait on your Commit (today), and
112
190
  * "after <initiative>" at the plan start where a dependency is not done. Each one only from a record. */
113
191
  function marks(r, X, now, phone) {
@@ -138,36 +216,39 @@ function overlay(W, X, now, sprint, rel) {
138
216
  function edgeTabs(r, X, now, phone) {
139
217
  const x = extentOf(r, now); if (!x) return '';
140
218
  const a = X(x.a).toFixed(3), b = X(x.b).toFixed(3), e = day(r.end) || x.b, late = r.over && day(r.end) && now > day(r.end);
141
- const lw = late ? r.overDays + ' ' + (r.overDays === 1 ? 'day' : 'days') + ' over' : my(e), rw = my(x.a);
142
- const tab = (side, words, cls) => `<button type="button" class="tg-edge ${side}${cls}" data-edge="${side}" data-a="${a}" data-b="${b}" tabindex="-1" hidden aria-label="${esc(r.title + ': ' + words + '. Scroll to it')}">${side === 'l' ? SV(CHL) : ''}<span>${esc(words)}</span>${side === 'r' ? SV(CHR) : ''}</button>`;
219
+ // ahead, a held row names its return date, not its start (XtiAGrill 11: "⏸ Mar ’27 ›")
220
+ const ob = openBack(r, now), lw = late ? r.overDays + ' ' + (r.overDays === 1 ? 'day' : 'days') + ' over' : my(e), rw = ob ? my(ob) : my(x.a);
221
+ const tab = (side, words, cls) => `<button type="button" class="tg-edge ${side}${cls}" data-edge="${side}" data-a="${a}" data-b="${b}" tabindex="-1" hidden aria-label="${esc(r.title + ': ' + (side === 'r' && ob ? 'back from hold ' : '') + words + '. Scroll to it')}">${side === 'l' ? SV(CHL) : ''}${side === 'r' && ob ? SV(PAUSE) : ''}<span>${esc(words)}</span>${side === 'r' ? SV(CHR) : ''}</button>`;
143
222
  if (phone) return late ? tab('l', lw, ' late') : '';
144
223
  return (isDone(r) ? '' : tab('l', lw, late ? ' late' : '')) + (isDone(r) ? '' : tab('r', rw, ''));
145
224
  }
146
225
 
147
- /** The legend (PgTimeline), in the chip row on every span from Quarter on: done, planned, the Jira forecast, a program milestone where a
148
- * program is drawn, Deliver or Evaluate, today. */
149
- export const legendHtml = (prog) => `<span class="tg-lgd" role="group" aria-label="Legend"><span><i class="k dn"></i>Done in Jira</span><span><i class="k pl"></i>Planned</span><span><i class="k fc"></i>Jira forecast</span>${prog ? '<span><i class="k pdm"></i>Program milestone</span>' : ''}<span><i class="k dlv"></i>Deliver or Evaluate</span><span><i class="k td"></i>Today</span></span>`;
226
+ /** The legend (PgTimeline), in the chip row on every span from Quarter on: done, planned, on hold while a hold is drawn, the Jira forecast, a
227
+ * program milestone where a program is drawn, Deliver or Evaluate, today. */
228
+ export const legendHtml = (prog, hold) => `<span class="tg-lgd" role="group" aria-label="Legend"><span><i class="k dn"></i>Done in Jira</span><span><i class="k pl"></i>Planned</span>${hold ? '<span><i class="k ho"></i>On hold</span>' : ''}<span><i class="k fc"></i>Jira forecast</span>${prog ? '<span><i class="k pdm"></i>Program milestone</span>' : ''}<span><i class="k dlv"></i>Deliver or Evaluate</span><span><i class="k td"></i>Today</span></span>`;
150
229
 
151
230
  /** The dates on record a window must hold: every shown row's plan and forecast, the programs' spans and milestones, the release. */
152
231
  function datesOf(list, M, o) {
153
- const ds = list.flatMap((r) => [day(r.start), day(r.end), r.track && day(r.track.forecast)]);
232
+ const ds = list.flatMap((r) => [day(r.start), day(r.end), r.track && day(r.track.forecast), day(r.start) ? openBack(r, o.now) : null]);
154
233
  for (const { g, st } of progGroups(o)) { const sp = progSpan(g); if (sp) ds.push(sp.lo, sp.hi); for (const m of st.milestones || []) ds.push(day(m.date)); }
155
234
  const rel = M.jira && M.jira.release; if (rel) ds.push(day(rel.iso));
156
235
  return ds.filter(Boolean);
157
236
  }
158
237
 
159
- /** Every span from Quarter on, and Sprint on a phone. o: { now, phone, sel, status(r) → { tone, text }, hiddenCount, askHref, trackPx } */
238
+ /** Every span from Quarter on, and Sprint on a phone. o: { now, phone, sel, status(r) → { tone, text }, askHref, trackPx } */
160
239
  function scaled(rows, M, o) {
161
240
  const now = o.now, sprint = M.jira && M.jira.sprint, rel = M.jira && M.jira.release, sp = o.span === 'sprint' ? 'sprint' : SCALE[o.span] ? o.span : 'quarter';
162
- const shown = rows.filter((r) => !hidden(r)), list = shown.filter(dated), none = shown.filter((r) => !dated(r));
241
+ const list = rows.filter(dated), none = rows.filter((r) => !dated(r));
163
242
  const W = windowOf(sp, now, o.phone, sprint, datesOf(list, M, o)), X = pctOf(W);
164
243
  const long = W.unit === 'q' || W.unit === 'y', fmt = long ? my : md;
165
244
  // one screen shows W.cols columns; the track is as many screens wide as the window holds (pm/bd-scroll.js measures it again on screen)
166
245
  const days = (W.to - W.from) / 86400000, viewDays = W.fixed ? days : W.cols * COL_DAYS[W.unit];
167
246
  const ratio = days / viewDays, tpx = Math.max(200, o.trackPx || (o.phone ? 340 : 1100)), pxDay = tpx / viewDays;
168
247
  const reach = Math.max(W.fixed ? 1 : 2, Math.round(120 / pxDay)); // program milestones closer than ~120 px merge (TsCGrill 9)
169
- const ov = overlay(W, X, now, sprint, rel);
248
+ const ov = overlay(W, X, now, sprint, rel), pxPct = (tpx * (W.fixed ? 1 : ratio)) / 100;
170
249
  const ra = rel && day(rel.iso), sa = sprint && day(sprint.start), sb = sprint && day(sprint.end);
250
+ // an undated program member's track says so beside today, where the view opens
251
+ const ND = `<span class="tg-nd" style="left:${P(Math.min(90, Math.max(0, X(now))))}">No dates</span>`;
171
252
  const askBtn = none.length ? `<a class="bd-chip tg-ask" id="askDates" href="${esc(o.askHref(none))}">${SV('M4 5h16v11h-9l-5 4v-4H4z')}Ask to propose dates</a>` : '';
172
253
  const ticks = W.ticks.map((k) => `<span style="left:${P(X(k.at))}" data-y="${k.y}" data-base="${esc(k.base)}"${k.plain ? ' data-plain' : ''}><b>${esc(k.label)}</b><small>${esc(k.sub)}</small></span>`).join('');
173
254
  const tn = now > W.from && now < W.to ? X(now) : null;
@@ -175,16 +256,18 @@ function scaled(rows, M, o) {
175
256
  const back = `<button type="button" class="tg-tback" data-today hidden aria-label="Back to today">${SV(CHL)}<span>Today</span>${SV(CHR)}</button>`;
176
257
  const attrs = `data-span="${sp}" data-from="${+W.from}" data-to="${+W.to}" data-ratio="${W.fixed ? 1 : ratio.toFixed(5)}" data-now="${+now}"${W.fixed ? ' data-fixed' : ''}`;
177
258
  const style = `--tw:${Math.round(tpx * (W.fixed ? 1 : ratio))}px`;
178
- const G = o.groups ? o.groups.map((g) => (g.kind === 'program' ? { ...g, products: g.products.map((x) => ({ ...x, rows: x.rows.filter((r) => list.includes(r)) })).filter((x) => x.rows.length), rows: g.rows.filter((r) => list.includes(r)) } : { ...g, rows: g.rows.filter((r) => list.includes(r)) })).filter((g) => g.rows.length || g.kind === 'program') : null;
259
+ // a program keeps its undated initiatives as rows that say "No dates" (feedback batch 8 item 4: initiatives just moved into a program
260
+ // were missing under it); a product group keeps only the dated ones, and the foot names the rest
261
+ const G = o.groups ? o.groups.map((g) => (g.kind === 'program' ? { ...g, products: g.products.filter((x) => x.rows.length) } : { ...g, rows: g.rows.filter((r) => list.includes(r)) })).filter((g) => g.rows.length || g.kind === 'program') : null;
179
262
  const empty = '<p class="tg-empty">No initiative on screen has a date on record.</p>';
180
263
  const ext = (r) => { const x = extentOf(r, now); return x ? ` data-a="${X(x.a).toFixed(3)}" data-b="${X(x.b).toFixed(3)}"` : ''; };
181
264
  if (o.phone) {
182
265
  // TsCPhone: each row carries its name above its bar; the name stays at the left while you swipe
183
- const one = (r) => `<div class="tgq-r${o.sel === r.key ? ' sel' : ''}" data-row="${esc(r.key)}"><button type="button" class="tgq-n ini2" data-key="${esc(r.key)}" aria-label="${esc(r.title + ', ' + o.status(r).text)}"><i class="cz-dot ${toneOf(r)}" aria-hidden="true"></i><b>${esc(r.title)}</b></button><div class="tg-p"${ext(r)}>${ov}${qBar(r, X, now, true, fmt)}${edgeTabs(r, X, now, true)}</div></div>`;
266
+ const one = (r) => `<div class="tgq-r${o.sel === r.key ? ' sel' : ''}" data-row="${esc(r.key)}"><button type="button" class="tgq-n ini2" data-key="${esc(r.key)}" aria-label="${esc(r.title + ', ' + o.status(r).text)}"><i class="cz-dot ${toneOf(r)}" aria-hidden="true"></i><b>${esc(r.title)}</b></button><div class="tg-p"${ext(r)}>${ov}${dated(r) ? qBar(r, X, now, true, fmt, pxPct) + edgeTabs(r, X, now, true) : ND}</div></div>`;
184
267
  const body = G ? G.map((g) => {
185
268
  if (g.kind !== 'program') return o.prodHtml(g) + (o.folded(g.key) ? '' : g.rows.map(one).join(''));
186
269
  const st = o.progState(g.program), s2 = progSpan(g);
187
- const br = s2 ? `<span class="tg-span" style="left:${P(X(s2.lo))};width:${P(Math.max(0.3, X(s2.hi) - X(s2.lo)))}"></span>` : '';
270
+ const br = s2 ? progLine(g, s2, X, now) : '';
188
271
  return `<div class="tgq-r tg-pg" data-prow="${esc(g.program.id)}"><div class="tgq-n tg-pgn">${progName(g, st, o)}</div><div class="tg-p">${ov}${br}${progMarks(g, st, X, W, reach, long ? my : null, true)}</div></div>` + (o.folded(g.key) ? '' : g.products.map((x) => x.rows.map(one).join('')).join(''));
189
272
  }).join('') : list.map(one).join('');
190
273
  const head = `<div class="tgq-h"><div class="tg-p">${ticks}${pill}</div></div>`;
@@ -194,27 +277,42 @@ function scaled(rows, M, o) {
194
277
  const head = `<div class="tg-r tg-h"><div class="tg-n"><b>Initiative</b>${back}</div><div class="tg-p">${ticks}${pill}</div></div>`;
195
278
  // one line per initiative (PgTimeline): its status dot and its name; the owner and the step stay in the row's title for a pointer and a reader
196
279
  const one = (r, cls) => { const s = o.status(r), sub = [r.owner, r.track ? r.track.label : r.stage, s.text].filter(Boolean).join(' · ');
197
- return `<div class="tg-r${cls || ''}${o.sel === r.key ? ' sel' : ''}" data-row="${esc(r.key)}"><button type="button" class="tg-n ini2" data-key="${esc(r.key)}" title="${esc(sub)}" aria-label="${esc(r.title + ', ' + sub)}"><i class="cz-dot ${toneOf(r)}${toneOf(r) === 'you' ? ' m-info' : toneOf(r) === 'late' || toneOf(r) === 'risk' ? ' m-warn' : ''}" aria-hidden="true"></i><b>${r.inProgram && o.memberIcon ? o.memberIcon(r.inProgram) : ''}${esc(r.title)}</b></button><div class="tg-p"${ext(r)}>${ov}${qBar(r, X, now, false, fmt)}${edgeTabs(r, X, now, false)}</div></div>`; };
280
+ return `<div class="tg-r${cls || ''}${o.sel === r.key ? ' sel' : ''}" data-row="${esc(r.key)}"><button type="button" class="tg-n ini2" data-key="${esc(r.key)}" title="${esc(sub)}" aria-label="${esc(r.title + ', ' + sub)}"><i class="cz-dot ${toneOf(r)}${toneOf(r) === 'you' ? ' m-info' : toneOf(r) === 'late' || toneOf(r) === 'risk' ? ' m-warn' : ''}" aria-hidden="true"></i><b>${r.inProgram && o.memberIcon ? o.memberIcon(r.inProgram) : ''}${esc(r.title)}</b></button><div class="tg-p"${ext(r)}>${ov}${dated(r) ? qBar(r, X, now, false, fmt, pxPct) + edgeTabs(r, X, now, false) : ND}</div></div>`; };
198
281
  // programs first, then the product (PgTimeline): the program's row brackets its initiatives' bars and draws its milestones as diamonds
199
282
  const body = G ? G.map((g) => {
200
283
  if (g.kind !== 'program') return o.prodHtml(g) + (o.folded(g.key) ? '' : g.rows.map((r) => one(r, ' tg-gr')).join(''));
201
284
  const last = g.rows[g.rows.length - 1];
202
- return progRow(g, o.progState(g.program), X, W, ov, o, reach, long ? my : null, (tpx * (W.fixed ? 1 : ratio)) / 100) + (o.folded(g.key) ? '' : g.products.map((x) => (g.products.length > 1 ? o.subHtml(x.name) : '') + x.rows.map((r) => one(r, ' tg-kid' + (r === last ? ' last' : ''))).join('')).join(''));
285
+ return progRow(g, o.progState(g.program), X, W, ov, o, reach, long ? my : null, pxPct, now) + (o.folded(g.key) ? '' : g.products.map((x) => (g.products.length > 1 ? o.subHtml(x.name) : '') + x.rows.map((r) => one(r, ' tg-kid' + (r === last ? ' last' : ''))).join('')).join(''));
203
286
  }).join('') : list.map((r) => one(r)).join('');
204
287
  // the sprint band and the release keep their labels under the axis on Quarter, where a week is wide enough to read them
205
288
  const axl = sp === 'quarter' ? `${sa && sb && sb > W.from && sa < W.to ? `<span class="tg-axl sb" style="left:${P(X(sa))}">Jira ${esc(sprint.name.toLowerCase())} · ${esc(md(sa))} – ${esc(md(sb))}</span>` : ''}${ra && ra > W.from && ra < W.to ? `<span class="tg-axl rl" style="left:${P(X(ra))}">${SV(FLAG)}${esc(rel.name)} · ${esc(md(ra))}</span>` : ''}` : '';
206
289
  const axis = axl ? `<div class="tg-ax"><span class="tg-n"></span><div class="tg-p">${axl}</div></div>` : '';
207
- const foot = none.length || o.hiddenCount ? `<div class="tg-ft">${none.length ? `<span class="tg-none"><b>${none.length} ${none.length === 1 ? 'has' : 'have'} no dates:</b> <span>${esc(none.slice(0, 4).map((r) => r.title).join(', '))}${none.length > 4 ? ' and ' + (none.length - 4) + ' more' : ''}</span>${askBtn}</span>` : '<span></span>'}${o.hiddenCount ? `<span class="tg-hid">Monitor and Evaluate hidden · ${o.hiddenCount}</span>` : ''}</div>` : '';
290
+ const foot = none.length ? `<div class="tg-ft">${none.length ? `<span class="tg-none"><b>${none.length} ${none.length === 1 ? 'has' : 'have'} no dates:</b> <span>${esc(none.slice(0, 4).map((r) => r.title).join(', '))}${none.length > 4 ? ' and ' + (none.length - 4) + ' more' : ''}</span>${askBtn}</span>` : '<span></span>'}</div>` : '';
208
291
  return { html: `<div class="tg tg-q tg-s" ${attrs}><div class="tg-scw"><div class="tg-sc" tabindex="0" role="group" aria-label="Timeline" style="${style}"><div class="tg-in">${head}<div class="tg-body">${body || empty}</div>${axis}</div></div><i class="tg-fade l" aria-hidden="true"></i><i class="tg-fade r" aria-hidden="true"></i></div>${foot}</div>`, none };
209
292
  }
210
293
 
211
294
  /** A program's row (PgTimeline .r.pg): its tile, title and products; a thin span from the first start to the last end of its initiatives' dates
212
295
  * on record; its milestones as diamonds, the close ones merged into one counted diamond; the next milestone ahead waits at the right edge. */
213
- function progRow(g, st, X, W, ov, o, reach, fmt, pxPct) {
296
+ function progRow(g, st, X, W, ov, o, reach, fmt, pxPct, now) {
214
297
  const p = g.program, sp = progSpan(g);
215
- const br = sp && sp.hi > W.from && sp.lo < W.to ? `<span class="tg-span" style="left:${P(X(sp.lo))};width:${P(Math.max(0.3, X(sp.hi) - X(sp.lo)))}"></span>` : '';
298
+ const br = sp && sp.hi > W.from && sp.lo < W.to ? progLine(g, sp, X, now || new Date()) : '';
216
299
  return `<div class="tg-r tg-pg" data-prow="${esc(p.id)}"><div class="tg-n tg-pgn">${progName(g, st, o)}</div><div class="tg-p">${ov}${br}${progMarks(g, st, X, W, reach, fmt, false, pxPct)}</div></div>`;
217
300
  }
301
+ /** A program's thin line, dotted where every member is on hold (XtiAGrill 14): the holds of the members, intersected. */
302
+ function progLine(g, sp, X, now) {
303
+ const seg = (a, b, cls) => `<span class="tg-span${cls}" style="left:${P(X(a))};width:${P(Math.max(0.3, X(b) - X(a)))}"></span>`;
304
+ let all = null;
305
+ for (const r of g.rows) {
306
+ const mine = holdSpans(r, now).map((x) => [x.a, x.b]);
307
+ all = all === null ? mine : all.flatMap(([a, b]) => mine.map(([c, d]) => [a > c ? a : c, b < d ? b : d]).filter(([x, y]) => y > x));
308
+ if (!all.length) break;
309
+ }
310
+ const cut = (all || []).map(([a, b]) => [a < sp.lo ? sp.lo : a, b > sp.hi ? sp.hi : b]).filter(([a, b]) => b > a).sort((x, y) => x[0] - y[0]);
311
+ if (!cut.length) return seg(sp.lo, sp.hi, '');
312
+ let out = '', at = sp.lo;
313
+ for (const [a, b] of cut) { if (a > at) out += seg(at, a, ''); out += seg(a > at ? a : at, b, ' ho'); if (b > at) at = b; }
314
+ return out + (at < sp.hi ? seg(at, sp.hi, '') : '');
315
+ }
218
316
  /** The first start and the last end of a program's initiatives' dates on record (its own start and target where the charter holds them). */
219
317
  function progSpan(g, own) {
220
318
  const p = g.program, ds = g.rows.flatMap((r) => [day(r.start), day(r.end), r.track && day(r.track.forecast)]).filter(Boolean);
@@ -299,7 +397,7 @@ function sprintSpan(rows, M, o) {
299
397
 
300
398
  /** The timeline's markup for the rows on screen. → { html, none: [rows with no dates] } */
301
399
  export function timelineHtml(rows, M, span, o = {}) {
302
- const opt = { now: new Date(), phone: false, sel: null, status: () => ({ tone: 'q', text: '' }), hiddenCount: 0, askHref: () => '#', prodHtml: () => '', subHtml: () => '', folded: () => false, progState: () => ({ milestones: [], state: '' }), ...o };
400
+ const opt = { now: new Date(), phone: false, sel: null, status: () => ({ tone: 'q', text: '' }), askHref: () => '#', prodHtml: () => '', subHtml: () => '', folded: () => false, progState: () => ({ milestones: [], state: '' }), ...o };
303
401
  opt.span = span;
304
402
  if (span === 'sprint' && !opt.phone) return sprintSpan(rows, M, opt);
305
403
  return scaled(rows, M, opt);
@@ -10,6 +10,7 @@
10
10
  * Nothing here invents a value: what no record holds is shown as "—" or not drawn. */
11
11
  import { esc } from './premium-shell.js';
12
12
  import * as WF from './bd-wf.js';
13
+ import { nextHtml } from './bd-next.js';
13
14
 
14
15
  let A = null; // the page: { M(), statusOf(r), usual(t), trail(r), docMeta(path, ws), sel(), groups(L), folded(key), laneHead(g), subTile(name), memberIcon(id), programOf(r), programs(),
15
16
  // wf() → { list, cur, ended } the workflows on the board, the picked one (null for All) and the rows that ended (pm/bd-wf.js) }
@@ -47,7 +48,7 @@ export function outOf(r) {
47
48
  }
48
49
  /** A progress bar; a count (tickets, parts) is striped so it never reads as points (BdPanel). */
49
50
  export const barHtml = (o, cls = '') => (o ? `<span class="bd-bar${cls ? ' ' + cls : ''}" role="img" aria-label="${esc(o.label || o.pct + '%')}${o.count ? ' (by count)' : ''}"><i class="${o.count ? 'cnt' : ''}" style="width:${Math.max(0, Math.min(100, o.pct))}%"></i></span>` : '<span class="bd-bar" aria-hidden="true"><i style="width:0"></i></span>');
50
- const stepText = (r, days) => { const t = r.track || {}, w = WF.stageOfRow(r); return ((w && w.name) || t.label || r.stage || 'No stage') + (days && t.days != null ? ' · ' + t.days + 'd' : ''); };
51
+ const stepText = (r, days) => { const t = r.track || {}, w = WF.stageOfRow(r); return ((w && w.name) || t.label || r.stage || 'No stage') + (days && t.days ? ' · ' + t.days + 'd' : ''); }; // "· 0d" is silence
51
52
  const CAT_TONE = { todo: '', doing: 'y', done: 'ok', wontdo: '', archived: '' };
52
53
  /** The category pill of the List (WfAElse): To do, In progress, Done, Won't do, Archived. */
53
54
  const catPill = (r) => { const c = WF.catOfRow(r); return c ? `<span class="bd-pill${CAT_TONE[c] ? ' ' + CAT_TONE[c] : ''}">${esc(WF.catLabel(c))}</span>` : '<span class="bd-amut">—</span>'; };
@@ -57,7 +58,8 @@ const nextOf = (r) => { const t = r.track || {}; if (typeof t.next === 'string'
57
58
  /* ── List (BdList) ───────────────────────────────────────────────────────────────────────────────────────────── */
58
59
  let sortBy = null, meOpen = false; // null: by product with All products (PgList), else by need, until a column title is pressed
59
60
  // the Kind column became Workflow, with Stage and Category after it (WfAElse)
60
- const COLS = [['title', 'Initiative'], ['wf', 'Workflow'], ['stage', 'Stage'], ['cat', 'Category'], ['need', 'Status'], ['owner', 'Owner'], ['', 'Next'], ['finish', 'Finish'], ['', 'Output'], ['', '']];
61
+ // the Output bar column is gone (XocAList): Next says what finishes the step, with its count
62
+ const COLS = [['title', 'Initiative'], ['wf', 'Workflow'], ['stage', 'Stage'], ['cat', 'Category'], ['need', 'Status'], ['owner', 'Owner'], ['', 'Next'], ['finish', 'Finish'], ['', '']];
61
63
  // with a program on the board (PgList): Product and Program after the initiative, both sortable; a row with no program leaves the cell empty
62
64
  const PCOLS = [COLS[0], ['product', 'Product'], ['program', 'Program'], ...COLS.slice(1)];
63
65
  const progOf = (r) => (A.programOf ? A.programOf(r) : null);
@@ -75,15 +77,15 @@ const SORTS = {
75
77
  export function setSort(k) { if (SORTS[k]) sortBy = k; }
76
78
  export function toggleME() { meOpen = !meOpen; }
77
79
  function listRow(r, pg) {
78
- const s = statusLine(r), sel = A.sel && A.sel() === r.key, finish = r.end ? r.finish : '—';
80
+ const s = statusLine(r), sel = A.sel && A.sel() === r.key, finish = r.end ? r.finish : '';
79
81
  const p = pg ? progOf(r) : null, prod = pg ? r.product || A.product() : '';
80
82
  const pcells = pg ? `<span role="cell" class="bd-pt">${A.tileHtml(prod, 'bd-ti s')}<span class="bd-ell">${esc(prod)}</span></span><span role="cell" class="bd-pt">${p ? A.progTile('bd-pti s') + `<span class="bd-ell">${esc(p.title)}</span>` : ''}</span>` : '';
81
83
  return `<div class="bd-lt${sel ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}">`
82
84
  + `<button type="button" class="bd-ltn ini2" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${esc(r.title)}</b></button>${pcells}`
83
85
  + `<span role="cell" class="bd-wfn">${WF.wfIcon(WF.wfOf(r), 18)}<span class="bd-ell">${esc(WF.wfOf(r).name)}</span></span><span role="cell">${(r.track || {}).ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(stepText(r, true))}</span><span role="cell">${catPill(r)}</span>`
84
86
  + `<span role="cell" class="cs s-${s.tone}"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i>${esc(s.text)}</span>`
85
- + `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-amut bd-ell">${esc(nextOf(r) || '—')}</span>`
86
- + `<span role="cell"${r.over ? ' class="bd-late"' : ''}>${esc(finish)}</span><span role="cell">${barHtml(outOf(r))}</span>`
87
+ + `<span role="cell">${avatar(r.owner)}</span><span role="cell" class="bd-nxc">${nextHtml(r, { self: M().board.self, due: false })}</span>`
88
+ + `<span role="cell"${r.over ? ' class="bd-late"' : ''}>${esc(finish)}</span>`
87
89
  + `<button type="button" class="bd-ib sm" data-rowmenu="${esc(r.key)}" aria-haspopup="menu" aria-expanded="false" aria-label="More for ${esc(r.title)}" title="Actions">${SV(MORE)}</button></div>`;
88
90
  }
89
91
  export function listHtml(L, filtered) {