create-pmos 0.397.0 → 0.398.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 (145) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +101 -52
  8. package/workspace/briefing-premium-board-test.js +252 -128
  9. package/workspace/briefing-premium-calendar-2-test.js +135 -198
  10. package/workspace/briefing-premium-calendar-3-test.js +143 -418
  11. package/workspace/briefing-premium-calendar-test.js +86 -196
  12. package/workspace/briefing-premium-doc-edit-test.js +95 -83
  13. package/workspace/briefing-premium-initiative-test.js +159 -296
  14. package/workspace/briefing-premium-insights-test.js +337 -219
  15. package/workspace/briefing-premium-metrics-test.js +53 -97
  16. package/workspace/briefing-premium-products-test.js +40 -27
  17. package/workspace/briefing-premium-sources-test.js +66 -48
  18. package/workspace/briefing-premium-test.js +150 -647
  19. package/workspace/briefing-premium-work-test.js +88 -283
  20. package/workspace/changelog.json +12 -0
  21. package/workspace/fixtures/board-premium-trail.js +32 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
  23. package/workspace/guide/briefing-premium.md +3 -1
  24. package/workspace/guide/home.md +47 -0
  25. package/workspace/guide/index.md +1 -0
  26. package/workspace/lib/agent-roles.js +71 -0
  27. package/workspace/lib/board-premium.js +85 -19
  28. package/workspace/lib/board-trail.js +223 -0
  29. package/workspace/lib/home-work-item.js +58 -0
  30. package/workspace/lib/insights-goals.js +196 -0
  31. package/workspace/lib/insights-premium.js +62 -14
  32. package/workspace/lib/insights-records.js +101 -0
  33. package/workspace/lib/jira-tickets.js +1 -1
  34. package/workspace/lib/route-modules.js +4 -0
  35. package/workspace/lib/routes-board-trail.js +33 -0
  36. package/workspace/lib/routes-home-desk.js +176 -0
  37. package/workspace/lib/routes-insights-premium.js +12 -3
  38. package/workspace/lib/routes-insights-records.js +129 -0
  39. package/workspace/lib/routes-notes.js +1 -0
  40. package/workspace/lib/routes-viewer.js +108 -0
  41. package/workspace/lib/transcript-steps.js +123 -0
  42. package/workspace/lib/viewer-meeting.js +205 -0
  43. package/workspace/lib/viewer-report.js +89 -0
  44. package/workspace/package-lock.json +2 -2
  45. package/workspace/package.json +1 -1
  46. package/workspace/premium-board-actions-test.js +85 -75
  47. package/workspace/premium-briefing-depth-test.js +66 -53
  48. package/workspace/premium-chat-attach-test.js +54 -63
  49. package/workspace/premium-chat-chart-tab-test.js +35 -37
  50. package/workspace/premium-chat-context-test.js +19 -18
  51. package/workspace/premium-chat-goal-view-test.js +23 -23
  52. package/workspace/premium-chat-notes-test.js +26 -31
  53. package/workspace/premium-chat-report-tab-test.js +32 -28
  54. package/workspace/premium-chat-term-test.js +16 -16
  55. package/workspace/premium-chat-viewer-test.js +60 -59
  56. package/workspace/premium-core-doc-issue-test.js +50 -43
  57. package/workspace/premium-html-viewer-test.js +14 -17
  58. package/workspace/premium-phone-card-test.js +7 -2
  59. package/workspace/premium-phone-room-test.js +41 -35
  60. package/workspace/premium-report-read-test.js +115 -197
  61. package/workspace/premium-viewer-download-test.js +19 -22
  62. package/workspace/premium-viewer-flicker-test.js +11 -16
  63. package/workspace/premium-viewer-share-test.js +6 -9
  64. package/workspace/premium-viewer-test.js +41 -60
  65. package/workspace/premium-vw-backlog-test.js +53 -33
  66. package/workspace/premium-vw-cal-test.js +82 -128
  67. package/workspace/premium-vw-copy-test.js +17 -33
  68. package/workspace/premium-vw-doc-test.js +11 -10
  69. package/workspace/premium-vw-item-test.js +50 -49
  70. package/workspace/premium-vw-jira-test.js +53 -27
  71. package/workspace/premium-vw-meet-test.js +118 -187
  72. package/workspace/premium-vw-notes-test.js +85 -108
  73. package/workspace/premium-vw-rec-test.js +72 -194
  74. package/workspace/premium-vw-slides-test.js +46 -50
  75. package/workspace/premium-welcome-test.js +3 -2
  76. package/workspace/premium-work-depth-test.js +61 -53
  77. package/workspace/public/pm/bd-acts.js +305 -0
  78. package/workspace/public/pm/bd-span.js +186 -82
  79. package/workspace/public/pm/bd-stages.js +25 -11
  80. package/workspace/public/pm/c3-doc-sheet.js +1 -1
  81. package/workspace/public/pm/c3-md.js +3 -395
  82. package/workspace/public/pm/c3-phone-detail.js +1 -1
  83. package/workspace/public/pm/c3-phone-model.js +3 -68
  84. package/workspace/public/pm/chat-term.js +3 -3
  85. package/workspace/public/pm/cozy-board.css +497 -230
  86. package/workspace/public/pm/cozy-home.css +570 -142
  87. package/workspace/public/pm/cozy-home.js +5 -3
  88. package/workspace/public/pm/cozy-insights.css +296 -167
  89. package/workspace/public/pm/cozy-md.js +396 -0
  90. package/workspace/public/pm/cozy-nav.js +17 -6
  91. package/workspace/public/pm/cozy-placeholder.js +26 -0
  92. package/workspace/public/pm/cozy-viewer.css +3 -3
  93. package/workspace/public/pm/cozy-viewer.js +144 -0
  94. package/workspace/public/pm/cozy-vw.css +485 -0
  95. package/workspace/public/pm/cozy.css +83 -1
  96. package/workspace/public/pm/home-adddoc.js +48 -0
  97. package/workspace/public/pm/home-app.js +905 -0
  98. package/workspace/public/pm/home-around.js +515 -0
  99. package/workspace/public/pm/home-chat.js +459 -0
  100. package/workspace/public/pm/home-data.js +312 -0
  101. package/workspace/public/pm/home-draft.js +68 -0
  102. package/workspace/public/pm/home-more.js +249 -0
  103. package/workspace/public/pm/home-phone-card.js +109 -0
  104. package/workspace/public/pm/home-work.js +519 -0
  105. package/workspace/public/pm/phone-moment.js +69 -0
  106. package/workspace/public/pm/pm-work-view.js +1 -1
  107. package/workspace/public/pm/premium-attach.js +4 -0
  108. package/workspace/public/pm/premium-board.js +423 -394
  109. package/workspace/public/pm/premium-chart-tab.js +110 -62
  110. package/workspace/public/pm/premium-deck.js +3 -3
  111. package/workspace/public/pm/premium-first.js +25 -21
  112. package/workspace/public/pm/premium-insights.js +792 -568
  113. package/workspace/public/pm/premium-meeting.js +61 -549
  114. package/workspace/public/pm/premium-notes.js +1 -1
  115. package/workspace/public/pm/premium-report-frame.css +20 -0
  116. package/workspace/public/pm/premium-report-read.js +509 -480
  117. package/workspace/public/pm/premium-report-tab.js +87 -63
  118. package/workspace/public/pm/premium-shell.js +72 -119
  119. package/workspace/public/pm/premium-viewer.js +22 -1
  120. package/workspace/public/pm/premium-vw-cal.js +187 -48
  121. package/workspace/public/pm/premium-vw-doc.css +6 -0
  122. package/workspace/public/pm/premium-vw-doc.js +40 -2
  123. package/workspace/public/pm/premium-vw-file.js +2 -2
  124. package/workspace/public/pm/premium-vw-meet.js +6 -83
  125. package/workspace/public/pm/premium-vw-mtg.js +731 -0
  126. package/workspace/public/pm/premium-vw-notes.js +56 -69
  127. package/workspace/public/pm/premium-vw-open.js +35 -0
  128. package/workspace/public/pm/premium-vw-page.js +16 -0
  129. package/workspace/public/pm/premium-vw-rec.js +11 -218
  130. package/workspace/public/pm/premium-vw-slides.css +5 -0
  131. package/workspace/public/pm/premium-vw-slides.js +44 -8
  132. package/workspace/public/pm/term-view.js +22 -0
  133. package/workspace/public/premium-board.html +28 -70
  134. package/workspace/public/premium-initiative.html +8 -48
  135. package/workspace/public/premium-insights.html +22 -60
  136. package/workspace/public/premium-viewer.html +20 -0
  137. package/workspace/public/premium.html +16 -107
  138. package/workspace/server.js +18 -3
  139. package/workspace/test-files.json +1 -0
  140. package/workspace/test-lists/home-libs.json +9 -0
  141. package/workspace/test-lists/premium-report-read.json +1 -1
  142. package/workspace/test-lists/premium-vw-agreed.json +9 -0
  143. package/workspace/test-lists/premium-vw-notes.json +1 -1
  144. package/workspace/public/pm/premium-work.js +0 -729
  145. package/workspace/public/pm/premium.js +0 -1146
@@ -1,120 +1,224 @@
1
- /* pm/bd-span.js — the premium Board's timeline (initiative premium-agreed-design, B2).
2
- * PMOS plan dates against the Jira forecast, over six spans: Sprint (the tickets of the active sprint, by initiative), Quarter (one row per
3
- * initiative), Half and Year (themes, with their initiatives as bars inside), 2 yr and 5 yr (themes only, as phases). A bar is drawn only from
4
- * dates a record holds: the plan from the initiative's start and end, the forecast from the end of the latest sprint holding an open ticket.
5
- * Pure: rows and the model in, markup out. */
1
+ /* pm/bd-span.js — the premium Board's timeline (initiative premium-agreed-design, B2; the AgBoardTimeline, AgBoardTimelinePhone, AgBoardTlYear
2
+ * and AgBoardTl5y frames). PMOS plan dates against the Jira forecast:
3
+ * · Quarter: one row per initiative over seven weeks (three on a phone), the plan bar with its done part, the days over, the Jira forecast,
4
+ * the sprint band, the today line and the release line, with their labels under the axis. Monitor and Evaluate are hidden here.
5
+ * · Year: themes, with their initiatives as bars inside, coloured by theme.
6
+ * · 5 yr: themes only, as one phase each from the dates on record; past 18 months is directional.
7
+ * · Sprint, Half and 2 yr have no Agreed frame: they are plain versions of Quarter (Sprint) and Year (Half, 2 yr), with a "Waiting for design" tag.
8
+ * Themes come from GET /api/board-trail (lib/board-trail.js): one per objective, named by the PRD's theme: key, else the objective's title. The Group
9
+ * control groups the long spans by theme, lane or owner. Milestones: a release's sign-off (◆ with its name), "Push tickets" where drafted tickets
10
+ * wait on the Commit, and "after <initiative>" where a dependency is not done. A bar is drawn only from dates a record holds. Pure: rows and the
11
+ * model in, markup out. */
6
12
  import { esc } from './premium-shell.js';
7
13
 
8
- const DAY = 86400000;
9
14
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
10
15
  const day = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
11
- const short = (d) => d.getDate() + ' ' + MON[d.getMonth()];
16
+ export const md = (d) => MON[d.getMonth()] + ' ' + d.getDate();
12
17
  const addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
13
18
  const addMonths = (d, n) => new Date(d.getFullYear(), d.getMonth() + n, 1);
14
19
  export const SPANS = [['sprint', 'Sprint'], ['quarter', 'Quarter'], ['half', 'Half'], ['year', 'Year'], ['y2', '2 yr'], ['y5', '5 yr']];
20
+ /** The spans the Agreed design draws; the others show the "Waiting for design" card. */
21
+ export const DRAWN = new Set(['quarter', 'year', 'y5']);
22
+ /** The trail's theme tones (lib/board-trail.js TONES), in THEME_TONES order. */
23
+ const TONE_KEYS = ['grey', 'blue', 'green', 'amber', 'violet', 'teal'];
24
+ const WTAG = '<span class="bd-wtag" title="This span has no Agreed design yet. It works as a plain version until it has one.">Waiting for design</span>';
25
+ export const GROUPS = [['theme', 'Theme'], ['lane', 'Lane'], ['owner', 'Owner']];
26
+ /** Theme colours, in the order the Agreed design's themes take them (grey, blue, green, amber, then two more). */
15
27
  export const THEME_TONES = ['var(--cz-c-8c929b)', 'var(--cz-c-4894ea)', 'var(--cz-c-5e9c6a)', 'var(--cz-c-d4a13a)', 'var(--cz-c-b07cc6)', 'var(--cz-c-d9773f)'];
28
+ const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
29
+ const FLAG = 'M5 21V4M5 4h11l-2 4 2 4H5';
30
+ 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';
16
31
 
17
- /** The window and the ticks of a span, around `now`. */
18
- export function windowOf(span, now, sprint) {
32
+ /** The window and the ticks of a span, around `now`. Quarter: from the Monday of last week, seven weeks (a phone: this week's Monday, three). */
33
+ export function windowOf(span, now, phone, sprint) {
19
34
  const t = new Date(now.getFullYear(), now.getMonth(), now.getDate());
35
+ const mon = addDays(t, -((t.getDay() + 6) % 7));
20
36
  if (span === 'sprint') {
37
+ // the sprint the Jira reading holds; with none, two weeks from this Monday
21
38
  const a = sprint && day(sprint.start), b = sprint && day(sprint.end);
22
- const from = a ? addDays(a, -1) : addDays(t, -7), to = b ? addDays(b, 2) : addDays(t, 8);
23
- const ticks = []; for (let d = new Date(from); d <= to; d = addDays(d, 2)) ticks.push({ at: d, label: short(d) });
39
+ const from = a && b && b > a ? a : mon, to = a && b && b > a ? addDays(b, 1) : addDays(mon, 14);
40
+ const n = Math.round((to - from) / 86400000), step = phone ? Math.max(2, Math.ceil(n / 4)) : n > 16 ? 2 : 1;
41
+ const ticks = []; for (let i = 0; i < n; i += step) { const d = addDays(from, i); ticks.push({ at: d, label: md(d) }); }
24
42
  return { from, to, ticks };
25
43
  }
26
- if (span === 'quarter') {
27
- const mon = addDays(t, -((t.getDay() + 6) % 7) - 14), to = addDays(mon, 7 * 13);
28
- const ticks = []; for (let d = new Date(mon); d < to; d = addDays(d, 7)) ticks.push({ at: d, label: MON[d.getMonth()] + ' ' + d.getDate() });
29
- return { from: mon, to, ticks };
30
- }
31
- if (span === 'half' || span === 'year') {
32
- const n = span === 'half' ? 6 : 12, from = addMonths(t, span === 'half' ? -1 : -6), to = addMonths(from, n);
33
- const ticks = []; for (let i = 0; i < n; i++) { const d = addMonths(from, i); ticks.push({ at: d, label: MON[d.getMonth()], sub: d.getMonth() % 3 === 0 ? 'Q' + (d.getMonth() / 3 + 1) + (d.getFullYear() !== t.getFullYear() ? ' ’' + String(d.getFullYear()).slice(2) : '') : '' }); }
44
+ if (span === 'half') {
45
+ const from = addMonths(t, -1), to = addMonths(from, 6);
46
+ const ticks = []; for (let i = 0; i < 6; i++) { const d = addMonths(from, i); ticks.push({ at: d, label: MON[d.getMonth()], sub: d.getMonth() % 3 === 0 ? 'Q' + (d.getMonth() / 3 + 1) : '' }); }
34
47
  return { from, to, ticks };
35
48
  }
36
49
  if (span === 'y2') {
37
- const q0 = new Date(t.getFullYear(), Math.floor(t.getMonth() / 3) * 3 - 6, 1), to = addMonths(q0, 24);
38
- const ticks = []; for (let i = 0; i < 8; i++) { const d = addMonths(q0, i * 3); ticks.push({ at: d, label: 'Q' + (d.getMonth() / 3 + 1), sub: String(d.getFullYear()) }); }
39
- return { from: q0, to, ticks };
50
+ const q0 = new Date(t.getFullYear(), t.getMonth() - (t.getMonth() % 3), 1), from = addMonths(q0, -3), to = addMonths(from, 24);
51
+ const ticks = []; for (let i = 0; i < 24; i += 3) { const d = addMonths(from, i); ticks.push({ at: d, label: 'Q' + (d.getMonth() / 3 + 1), sub: '’' + String(d.getFullYear()).slice(2) }); }
52
+ return { from, to, ticks };
53
+ }
54
+ if (span === 'quarter') {
55
+ const from = phone ? mon : addDays(mon, -7), n = phone ? 3 : 7, to = addDays(from, 7 * n);
56
+ const ticks = []; for (let i = 0; i < n; i++) { const d = addDays(from, 7 * i); ticks.push({ at: d, label: md(d) }); }
57
+ return { from, to, ticks };
58
+ }
59
+ if (span === 'year') {
60
+ const from = addMonths(t, -6), to = addMonths(from, 12);
61
+ const ticks = []; for (let i = 0; i < 12; i++) { const d = addMonths(from, i); ticks.push({ at: d, label: MON[d.getMonth()], sub: d.getMonth() % 3 === 0 ? 'Q' + (d.getMonth() / 3 + 1) + (d.getFullYear() !== t.getFullYear() ? ' ’' + String(d.getFullYear()).slice(2) : '') : '' }); }
62
+ return { from, to, ticks };
40
63
  }
41
- const from = new Date(t.getFullYear() - 1, 0, 1), to = new Date(t.getFullYear() + 4, 0, 1);
64
+ const from = new Date(t.getFullYear() - 1, 0, 1), to = new Date(t.getFullYear() + 5, 0, 1);
42
65
  const ticks = []; for (let y = from.getFullYear(); y < to.getFullYear(); y++) ticks.push({ at: new Date(y, 0, 1), label: String(y), sub: 'H1 · H2' });
43
66
  return { from, to, ticks };
44
67
  }
45
68
 
46
69
  const pctOf = (W) => (d) => Math.max(0, Math.min(100, ((d - W.from) / (W.to - W.from)) * 100));
47
- const overlay = (W, X, now, sprint, rel) => {
48
- const tl = W.ticks.map((k) => `<i class="tg-gl" style="left:${X(k.at).toFixed(2)}%"></i>`).join('');
49
- const sa = sprint && day(sprint.start), sb = sprint && day(sprint.end);
50
- const band = sa && sb && sb > W.from && sa < W.to ? `<i class="tg-sb" style="left:${X(sa).toFixed(2)}%;width:${(X(sb) - X(sa)).toFixed(2)}%"></i>` : '';
51
- const ra = rel && day(rel.iso), rl = ra && ra > W.from && ra < W.to ? `<i class="tg-rl" style="left:${X(ra).toFixed(2)}%"></i>` : '';
52
- const tn = now > W.from && now < W.to ? `<u class="tg-td" style="left:${X(now).toFixed(2)}%"></u>` : '';
53
- return tl + band + rl + tn;
54
- };
55
- const toneOf = (r) => (r.track && r.track.blocked ? 'red' : r.late ? 'late' : r.status === 'at risk' ? 'risk' : r.status === 'on track' ? 'ok' : 'q');
70
+ const P = (x) => x.toFixed(2) + '%';
71
+ 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; };
72
+ const toneOf = (r) => (r.late ? 'late' : r.status === 'at risk' ? 'risk' : r.track && r.track.you ? 'you' : r.status === 'on track' ? 'ok' : 'q');
73
+ const dated = (r) => day(r.start) || day(r.end) || (r.track && day(r.track.forecast));
74
+ const hidden = (r) => r.track && (r.track.key === 'monitor' || r.track.key === 'evaluate');
56
75
 
57
- /** One initiative's bar: the plan (start to end) with its done part, the forecast past the plan, and the days over. */
58
- function barHtml(r, X, now, { label = false, tone = null } = {}) {
59
- const s = day(r.start), e = day(r.end), fc = r.track && day(r.track.forecast);
60
- if (!s && !e && !fc) return '';
61
- let out = '';
76
+ /** One initiative's marks on the quarter: the plan with its done part, the days over, the forecast past the plan, and one label after the furthest mark. */
77
+ function qBar(r, X, now, phone) {
78
+ const s = day(r.start), e = day(r.end), fc = r.track && day(r.track.forecast), tone = toneOf(r);
79
+ let out = marks(r, X, now, phone);
62
80
  if (s && e) {
63
- const l = X(s), w = Math.max(0.8, X(e) - l), pr = r.track && r.track.prog ? Math.max(0, Math.min(100, (r.track.prog.done / Math.max(1, r.track.prog.total)) * 100)) : 0;
64
- out += `<span class="tg-bar${r.track && r.track.ms ? ' ms' : ''}" style="left:${l.toFixed(2)}%;width:${w.toFixed(2)}%${tone ? ';--tone:' + tone : ''}" title="PMOS plan ${esc(short(s))} to ${esc(short(e))}"><b style="width:${pr.toFixed(1)}%"></b>${label ? `<em><i class="cz-dot ${toneOf(r)}"></i><strong>${esc(r.title)}</strong> ${esc(r.track ? r.track.label : '')}</em>` : ''}</span>`;
81
+ const l = X(s), w = Math.max(0.8, X(e) - l);
82
+ out += `<span class="tg-bar t-${tone}${r.track && r.track.ms ? ' ms' : ''}" 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>`;
65
83
  const over = r.over && now > e, late = fc && fc > e, words = [];
66
- if (over) { out += `<span class="tg-over" style="left:${X(e).toFixed(2)}%;width:${Math.max(0.5, X(now) - X(e)).toFixed(2)}%"></span>`; words.push(r.overDays + ' ' + (r.overDays === 1 ? 'day' : 'days') + ' over'); }
67
- if (late) { out += `<span class="tg-fc" style="left:${X(e).toFixed(2)}%;width:${(X(fc) - X(e)).toFixed(2)}%" title="Jira forecast ${esc(short(fc))}"></span>`; words.push('Jira forecast ' + short(fc)); }
68
- // one label after the furthest mark, so the words never sit on each other; the theme spans name the bar inside it instead
69
- if (words.length && !label) out += `<span class="tg-lab ${over ? 'late' : 'fc'}" style="left:${Math.max(over ? X(now) : 0, late ? X(fc) : 0).toFixed(2)}%">${esc(words.join(' · '))}</span>`;
84
+ if (over) { out += `<span class="tg-over" style="left:${P(X(e))};width:${P(Math.max(0.5, X(now) - X(e)))}"></span>`; words.push(r.overDays + ' ' + (r.overDays === 1 ? 'day' : 'days') + ' over'); }
85
+ 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 ' + md(fc)); }
86
+ 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(words.join(' · '))}</span>`;
70
87
  } else if (fc) {
71
- out += `<span class="tg-fc solo" style="left:${Math.max(0, X(fc) - 3).toFixed(2)}%;width:3%" title="Jira forecast ${esc(short(fc))}"></span>${label ? '' : `<span class="tg-lab fc" style="left:${X(fc).toFixed(2)}%">Jira forecast ${esc(short(fc))}</span>`}`;
88
+ out += `<span class="tg-fc solo" style="left:${P(Math.max(0, X(fc) - 3))};width:3%" title="Jira forecast ${esc(md(fc))}"></span>${phone ? '' : `<span class="tg-lab fc" style="left:${P(X(fc))}">Jira forecast ${esc(md(fc))}</span>`}`;
72
89
  } else {
73
- const d = s || e; out += `<i class="tg-dm" style="left:${X(d).toFixed(2)}%" title="${s ? 'Starts' : 'Ends'} ${esc(short(d))}"></i>`;
90
+ const d = s || e; out += `<i class="tg-dm" style="left:${P(X(d))}" title="${s ? 'Starts' : 'Ends'} ${esc(md(d))}"></i>`;
74
91
  }
75
92
  return out;
76
93
  }
77
94
 
78
- /** The timeline's markup for the rows on screen. → { html, none: [titles of rows with no dates] } */
79
- export function timelineHtml(rows, M, span, now = new Date()) {
80
- const sprint = M.jira && M.jira.sprint, rel = M.jira && M.jira.release;
81
- const W = windowOf(span, now, sprint), X = pctOf(W);
82
- const dated = (r) => day(r.start) || day(r.end) || (r.track && day(r.track.forecast));
83
- const none = rows.filter((r) => !dated(r));
84
- const head = (first, sub) => `<div class="tg-r tg-h"><div class="tg-n">${first}${sub ? `<small>${sub}</small>` : ''}</div><div class="tg-p">${W.ticks.map((k) => `<span style="left:${X(k.at).toFixed(2)}%"><b>${esc(k.label)}</b>${k.sub ? `<small>${esc(k.sub)}</small>` : ''}</span>`).join('')}</div></div>`;
95
+ /** A row's milestones: its release's sign-off (◆ at the release date), "Push tickets" where drafted tickets wait on your Commit (today), and
96
+ * "after <initiative>" at the plan start where a dependency is not done. Each one only from a record. */
97
+ function marks(r, X, now, phone) {
98
+ const T = r.trail || {}, out = [], rd = r.release && day(r.release.iso);
99
+ const at = (d) => d && X(d) > 0 && X(d) < 100;
100
+ if (rd && at(rd) && r.track && (r.track.key === 'deliver' || r.track.you)) out.push(`<i class="tg-msd" style="left:${P(X(rd))}" title="${esc(r.release.name)} sign-off"></i>${phone ? '' : `<span class="tg-msl" style="left:${P(X(rd))}">${esc(r.release.name)} sign-off</span>`}`);
101
+ if (T.you && T.you.kind === 'commit' && at(now)) out.push(`<i class="tg-msd you" style="left:${P(X(now))}" title="${esc(T.you.text)}"></i>${phone ? '' : `<span class="tg-msl you" style="left:${P(X(now))}">Push tickets · now</span>`}`);
102
+ const dep = (T.deps || []).find((d) => d.known && !d.done), s = day(r.start);
103
+ if (dep && !phone) out.push(`<span class="tg-dep" style="left:${P(s && at(s) ? X(s) : 0)}" title="Waits on ${esc(dep.title || dep.id)}">${SV(LINK)}after ${esc(dep.title || dep.id)}</span>`);
104
+ return out.join('');
105
+ }
106
+
107
+ /** The overlay of a quarter row: week lines, the sprint band, the release line and the today line. */
108
+ function overlay(W, X, now, sprint, rel) {
109
+ const tl = W.ticks.slice(1).map((k) => `<i class="tg-gl" style="left:${P(X(k.at))}"></i>`).join('');
110
+ const sa = sprint && day(sprint.start), sb = sprint && day(sprint.end);
111
+ const band = sa && sb && sb > W.from && sa < W.to ? `<i class="tg-sb" style="left:${P(X(sa))};width:${P(X(sb) - X(sa))}"></i>` : '';
112
+ const ra = rel && day(rel.iso), rl = ra && ra > W.from && ra < W.to ? `<i class="tg-rl" style="left:${P(X(ra))}"></i>` : '';
113
+ const tn = now > W.from && now < W.to ? `<u class="tg-td" style="left:${P(X(now))}"></u>` : '';
114
+ return tl + band + rl + tn;
115
+ }
116
+
117
+ /** The quarter's markup. o: { now, phone, sel, status(r) → { tone, text }, hiddenCount, askHref } */
118
+ function quarter(rows, M, o) {
119
+ const now = o.now, sprint = M.jira && M.jira.sprint, rel = M.jira && M.jira.release;
120
+ const W = windowOf(o.span === 'sprint' ? 'sprint' : 'quarter', now, o.phone, sprint), X = pctOf(W);
121
+ const shown = rows.filter((r) => !hidden(r)), list = shown.filter(dated), none = shown.filter((r) => !dated(r));
85
122
  const ov = overlay(W, X, now, sprint, rel);
86
- let body = '';
87
- if (span === 'sprint') {
88
- const by = rows.map((r) => ({ r, tk: ((r.track && r.track.tickets) || []).filter((t) => sprint && t.sprint === sprint.name) })).filter((x) => x.tk.length);
89
- const sa = sprint && day(sprint.start), sb = sprint && day(sprint.end);
90
- if (!sprint) body = '<p class="tg-empty">No sprint is on record. A sprint appears when an agent session has read Jira for this board.</p>';
91
- else if (!by.length) body = `<p class="tg-empty">No ticket of the initiatives on screen is in ${esc(sprint.name)}.</p>`;
92
- else body = by.map(({ r, tk }) => `<div class="tg-sec"><button type="button" class="tg-st" data-key="${esc(r.key)}"><b>${esc(r.title)}</b><span>${tk.length} ${tk.length === 1 ? 'ticket' : 'tickets'} in ${esc(sprint.name)}</span></button></div>`
93
- + tk.map((t) => `<div class="tg-r"><button type="button" class="tg-n tg-tk" data-tk="${esc(t.key)}" data-ini="${esc(r.key)}"><b>${esc(t.key)}</b><small>${esc(t.title)}</small></button><div class="tg-p">${ov}${sa && sb ? `<span class="tg-bar tk ${esc(t.cls || 'td')}" style="left:${X(sa).toFixed(2)}%;width:${(X(sb) - X(sa)).toFixed(2)}%"><em><strong>${esc(t.status)}</strong>${t.blocked ? ' · blocked' : ''}</em></span>` : ''}</div></div>`).join('')).join('');
94
- return { html: `<div class="tg" data-span="sprint">${head('Ticket', sprint ? esc(sprint.name) : '')}${body}</div>`, none: [] };
123
+ const ra = rel && day(rel.iso), sa = sprint && day(sprint.start), sb = sprint && day(sprint.end);
124
+ 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>` : '';
125
+ if (o.phone) {
126
+ const head = `<div class="tgp-h">${W.ticks.map((k) => `<span>${esc(k.label)}</span>`).join('')}</div>`;
127
+ const body = list.map((r) => { const s = o.status(r); return `<button type="button" class="tgp-r${o.sel === r.key ? ' sel' : ''}" data-key="${esc(r.key)}"><span class="tgp-t"><b>${esc(r.title)}</b><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span></span><span class="tgp-p">${ov}${qBar(r, X, now, true)}</span></button>`; }).join('');
128
+ const foot = `<div class="tgp-f"><span>Today ${esc(md(now))}</span>${ra ? `<span class="tg-rel">${SV(FLAG)}${esc(rel.name)} · ${esc(md(ra))}</span>` : ''}</div>`;
129
+ const below = `${none.length ? `<div class="tg-none"><span>${none.length} ${none.length === 1 ? 'has' : 'have'} no dates</span>${askBtn}</div>` : ''}<p class="tg-note">Grey bars are PMOS plan dates. The dark part is points done in Jira.</p>`;
130
+ return { html: `<div class="tgp" data-span="${o.span === 'sprint' ? 'sprint' : 'quarter'}">${head}<div class="tgp-b">${body || '<p class="tg-empty">No initiative on screen has a date on record.</p>'}</div>${foot}</div>${below}`, none };
95
131
  }
96
- if (span === 'quarter') {
97
- body = rows.filter(dated).map((r) => `<div class="tg-r"><button type="button" class="tg-n ini2" data-key="${esc(r.key)}"><b>${esc(r.title)}</b><small>${esc([r.owner, r.track ? r.track.label : r.stage].filter(Boolean).join(' · '))}</small></button><div class="tg-p">${ov}${barHtml(r, X, now)}</div></div>`).join('');
98
- return { html: `<div class="tg" data-span="quarter">${head('Initiative', '')}${body || '<p class="tg-empty">No initiative on screen has a date on record.</p>'}<div class="tg-lg"><span><i class="k dn"></i>done (Jira or the record)</span><span><i class="k pl"></i>PMOS plan</span><span><i class="k fc"></i>Jira forecast</span>${sprint ? `<span><i class="k sb"></i>${esc(sprint.name)}</span>` : ''}${rel ? `<span><i class="k rl"></i>${esc(rel.name)} · ${esc(rel.at)}</span>` : ''}</div></div>`, none };
132
+ const head = `<div class="tg-r tg-h"><button type="button" class="tg-n tg-help" data-rules aria-haspopup="dialog" title="How the timeline groups by span"><b>Initiative</b></button><div class="tg-p">${W.ticks.map((k) => `<span style="left:${P(X(k.at))}"><b>${esc(k.label)}</b></span>`).join('')}</div></div>`;
133
+ const lgd = '<div class="tg-lgd" aria-hidden="true"><span><i class="k dn"></i>done in Jira (points)</span><span><i class="k pl"></i>PMOS plan</span><span><i class="k fc"></i>Jira forecast</span></div>';
134
+ const body = list.map((r) => `<div class="tg-r${o.sel === r.key ? ' sel' : ''}" data-row="${esc(r.key)}"><button type="button" class="tg-n ini2" data-key="${esc(r.key)}"><b>${esc(r.title)}</b><small>${esc([r.owner, r.track ? r.track.label : r.stage].filter(Boolean).join(' · '))}</small></button><div class="tg-p">${ov}${qBar(r, X, now, false)}</div></div>`).join('');
135
+ const axis = `<div class="tg-ax"><span></span><div class="tg-p">${now > W.from && now < W.to ? `<span class="tg-axl td" style="left:${P(X(now))}">Today</span>` : ''}${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>` : ''}</div></div>`;
136
+ const foot = `<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>`;
137
+ const tag = o.span === 'sprint' ? `<p class="bd-whead">${WTAG}<span>The Sprint span: the current sprint's days${sprint ? ', ' + esc(sprint.name) : ''}</span></p>` : '';
138
+ return { html: `${tag}<div class="tg tg-q" data-span="${o.span === 'sprint' ? 'sprint' : 'quarter'}">${head}<div class="tg-body">${lgd}${body || '<p class="tg-empty">No initiative on screen has a date on record.</p>'}</div>${axis}${foot}</div>`, none };
139
+ }
140
+
141
+ /** The groups of the long spans. By theme (default): the trail's themes (one per objective; the PRD's theme: names it, theme_note: says what it
142
+ * is for, theme_color: picks its colour), in the trail's order; a row the trail has not reached yet takes its anchor's objective. By lane or by owner. */
143
+ const cap = (x) => x.charAt(0).toUpperCase() + x.slice(1);
144
+ function themesOf(rows, o = {}) {
145
+ const g = o.group || 'theme', T = o.themes || [], byKey = new Map(T.map((t) => [t.key, t]));
146
+ const groups = new Map();
147
+ for (const r of rows) {
148
+ let k, base;
149
+ if (g === 'lane') { k = r.lane || 'none'; base = { key: k, label: r.lane ? cap(r.lane) : 'No lane', what: 'Lane', kind: 'lane' }; }
150
+ else if (g === 'owner') { k = r.owner || 'none'; base = { key: k, label: r.owner || 'No owner', what: 'Owner', kind: 'owner' }; }
151
+ else {
152
+ const th = r.trail && byKey.get(r.trail.theme);
153
+ if (th) { k = th.key; base = { key: k, label: th.name, what: th.note || (th.key === 'health' ? 'Upkeep anchored to a health budget' : [th.period ? th.period + ' objective' : 'Objective', th.from ? '' : 'name it with theme: in the PRD'].filter(Boolean).join(' · ')), kind: th.key === 'health' ? 'health' : 'kr', tone: th.tone }; }
154
+ else { const t = r.theme || { key: 'none', label: 'No anchor', kind: 'none', period: '' }; k = 'a:' + t.key; base = { key: k, label: t.label, what: t.kind === 'kr' ? t.period + ' objective' : t.kind === 'health' ? 'Health budgets' : 'No theme', kind: t.kind }; }
155
+ }
156
+ if (!groups.has(k)) groups.set(k, { ...base, rows: [] });
157
+ groups.get(k).rows.push(r);
99
158
  }
100
- // the longer spans group by theme: the objective of each initiative's KR, or the health budgets
101
- const themes = new Map();
102
- for (const r of rows) { const t = r.theme || { key: 'none', label: 'No anchor' }; if (!themes.has(t.key)) themes.set(t.key, { ...t, rows: [] }); themes.get(t.key).rows.push(r); }
103
- const T = [...themes.values()];
104
- if (span === 'half' || span === 'year') {
105
- body = T.map((t, i) => {
106
- const tone = THEME_TONES[i % THEME_TONES.length], dr = t.rows.filter(dated), late = t.rows.filter((r) => r.late).length, risk = t.rows.filter((r) => r.status === 'at risk').length;
107
- return `<div class="tg-r tg-th"><div class="tg-n"><b><i class="tg-sw" style="background:${tone}"></i>${esc(t.label)}</b><small>${t.rows.length} ${t.rows.length === 1 ? 'initiative' : 'initiatives'}${late ? ' · ' + late + ' late' : ''}${risk ? ' · ' + risk + ' at risk' : ''}</small></div><div class="tg-p tg-stack">${ov}${dr.map((r) => `<button type="button" class="tg-line" data-key="${esc(r.key)}" aria-label="${esc(r.title)}">${barHtml(r, X, now, { label: true, tone })}</button>`).join('') || '<span class="tg-nod">No dates on record</span>'}</div></div>`;
159
+ const list = [...groups.values()];
160
+ if (g === 'theme' && T.length) list.sort((a, b) => { const ia = T.findIndex((t) => t.key === a.key), ib = T.findIndex((t) => t.key === b.key); return (ia < 0 ? 99 : ia) - (ib < 0 ? 99 : ib); });
161
+ return list.map((t, i) => ({ ...t, tone: THEME_TONES[t.tone && TONE_KEYS.includes(t.tone) ? TONE_KEYS.indexOf(t.tone) : i % THEME_TONES.length] }));
162
+ }
163
+ /** A group's left cell: its colour and name, what it is for, and its counts. */
164
+ function themeCell(t, wide) {
165
+ const late = t.rows.filter((r) => r.late).length, risk = t.rows.filter((r) => r.status === 'at risk').length;
166
+ const anchor = t.kind === 'health' ? 'health budget' : t.kind === 'kr' || t.kind === 'other' ? t.rows.map((r) => r.kr).filter(Boolean)[0] || '' : '';
167
+ return `<div class="tg-n tg-tn"><b><i class="tg-sw" style="background:${t.tone}"></i>${esc(t.label)}</b><small>${esc(t.what)}</small><em>${t.rows.length} ${t.rows.length === 1 ? 'initiative' : 'initiatives'}${anchor ? ' · ' + esc(anchor) : ''}${!wide && late ? ' · ' + late + ' late' : ''}${!wide && risk ? ' · ' + risk + ' at risk' : ''}</em></div>`;
168
+ }
169
+ /** The releases the rows ride on, as milestones of the long spans: name and date, once each. */
170
+ function releasesOf(rows) {
171
+ const seen = new Map();
172
+ for (const r of rows) { const d = r.release && day(r.release.iso); if (d && !seen.has(r.release.name)) seen.set(r.release.name, { name: r.release.name, at: d }); }
173
+ return [...seen.values()];
174
+ }
175
+
176
+ /** Year: themes with their initiatives as bars inside. */
177
+ function year(rows, o) {
178
+ const sp = o.span === 'half' || o.span === 'y2' ? o.span : 'year';
179
+ const now = o.now, W = windowOf(sp, now), X = pctOf(W), T = themesOf(rows, o), G = (GROUPS.find((x) => x[0] === (o.group || 'theme')) || GROUPS[0])[1];
180
+ const tn = now > W.from && now < W.to ? X(now) : null;
181
+ const head = `<div class="tg-r tg-h"><button type="button" class="tg-n tg-help" data-rules aria-haspopup="dialog" title="How the timeline groups by span"><b>${G}</b><small>${T.length} ${T.length === 1 ? G.toLowerCase() : G.toLowerCase() + 's'} · ${rows.length} ${rows.length === 1 ? 'initiative' : 'initiatives'}</small></button><div class="tg-p">${W.ticks.map((k) => `<span style="left:${P(X(k.at))}"><b>${esc(k.label)}</b>${k.sub ? `<small>${esc(k.sub)}</small>` : ''}</span>`).join('')}</div></div>`;
182
+ // AgBoardTlYear draws no release line or flag: a release shows as the ◆ at the end of a bar that rides on it
183
+ const grid = W.ticks.slice(1).map((k) => `<i class="tg-gl" style="left:${P(X(k.at))}"></i>`).join('') + (tn != null ? `<u class="tg-td" style="left:${P(tn)}"></u>` : '');
184
+ const body = T.map((t) => {
185
+ const lines = t.rows.filter(dated).map((r) => {
186
+ const s = day(r.start) || day(r.end) || day(r.track && r.track.forecast), e = day(r.end) || s, l = X(s), w = Math.max(1.2, X(e) - l), st = o.status(r);
187
+ return `<button type="button" class="tg-line" data-key="${esc(r.key)}" aria-label="${esc(r.title)}"><span class="tg-yb${r.track && r.track.ms ? ' ms' : ''}" style="left:${P(l)};width:${P(w)};--tone:${t.tone}"><b style="width:${doneOf(r).toFixed(1)}%"></b><em><i class="cz-dot ${toneOf(r)}"></i><strong>${esc(r.title)}</strong> ${esc([r.track ? r.track.label : '', st.tone === 'late' || st.tone === 'risk' ? st.text.toLowerCase() : ''].filter(Boolean).join(' · '))}</em></span></button>`;
108
188
  }).join('');
109
- return { html: `<div class="tg" data-span="${span}">${head('Theme', T.length + ' ' + (T.length === 1 ? 'theme' : 'themes') + ' · ' + rows.length + ' initiatives')}${body}<div class="tg-ft">Bars show initiatives inside their theme. The darker part is done. Switch to Quarter to see one row per initiative.</div></div>`, none };
110
- }
111
- // 2 yr and 5 yr: themes only, as one phase from the earliest start to the latest end on record; past 18 months is directional
112
- const far = addMonths(now, 18), fx = X(far);
113
- body = T.map((t, i) => {
114
- const tone = THEME_TONES[i % THEME_TONES.length], ds = t.rows.flatMap((r) => [day(r.start), day(r.end), r.track && day(r.track.forecast)]).filter(Boolean).sort((a, b) => a - b);
115
- const done = t.rows.filter((r) => r.track && (r.track.key === 'monitor' || r.track.key === 'evaluate')).length;
116
- const ph = ds.length ? `<button type="button" class="tg-phase" data-tgtheme="${esc(t.key)}" style="left:${X(ds[0]).toFixed(2)}%;width:${Math.max(1.5, X(ds[ds.length - 1]) - X(ds[0])).toFixed(2)}%;--tone:${tone}"><b>${esc(t.label)}</b><small>${t.rows.length - done} active · ${done} shipped</small></button>` : '<span class="tg-nod">No dates on record</span>';
117
- return `<div class="tg-r tg-th"><div class="tg-n"><b><i class="tg-sw" style="background:${tone}"></i>${esc(t.label)}</b><small>${t.rows.length} ${t.rows.length === 1 ? 'initiative' : 'initiatives'}</small></div><div class="tg-p">${ov}${fx < 100 ? `<i class="tg-dir" style="left:${fx.toFixed(2)}%"></i>` : ''}${ph}</div></div>`;
189
+ return `<div class="tg-r tg-th">${themeCell(t, false)}<div class="tg-p tg-stack">${grid}${lines || '<span class="tg-nod">No dates on record</span>'}</div></div>`;
118
190
  }).join('');
119
- return { html: `<div class="tg" data-span="${span}">${head('Theme', 'what each theme is for')}${body}<div class="tg-ft">Only themes and their span of dates at this zoom. Hatched means beyond 18 months: directional, not committed. Open a theme to see its initiatives at the Year span.</div></div>`, none };
191
+ const pill = tn != null ? `<span class="tg-today" style="left:calc(230px + (100% - 230px) * ${(tn / 100).toFixed(4)})">Today · ${esc(md(now))}</span>` : '';
192
+ const tag = sp !== 'year' ? `<p class="bd-whead">${WTAG}<span>The ${sp === 'half' ? 'Half' : '2 yr'} span: the Year view over ${sp === 'half' ? 'six months' : 'two years'}</span></p>` : '';
193
+ return { html: `${tag}<div class="tg tg-y" data-span="${sp}">${head}<div class="tg-body">${pill}${body || '<p class="tg-empty">No initiative is on screen.</p>'}</div><div class="tg-ft"><span>Bars show initiatives inside their ${G.toLowerCase()}. The darker part is done. <i class="cz-ms" aria-hidden="true"></i> is a milestone.</span><button type="button" class="tg-go" data-span-go="quarter">Switch to Quarter to see one row per initiative</button></div></div>`, none: [] };
194
+ }
195
+
196
+ /** 5 yr: themes only, as one phase each from the earliest date on record to the latest; past 18 months is directional (dashed). */
197
+ function fiveYear(rows, o) {
198
+ const now = o.now, W = windowOf('y5', now), X = pctOf(W), T = themesOf(rows, o), G = (GROUPS.find((x) => x[0] === (o.group || 'theme')) || GROUPS[0])[1];
199
+ const far = addMonths(now, 18), fx = X(far), tn = now > W.from && now < W.to ? X(now) : null;
200
+ const head = `<div class="tg-r tg-h"><button type="button" class="tg-n tg-help" data-rules aria-haspopup="dialog" title="How the timeline groups by span"><b>${G}</b><small>what each ${G.toLowerCase()} is for</small></button><div class="tg-p">${fx < 100 ? `<i class="tg-dir" style="left:${P(fx)}"></i>` : ''}${W.ticks.map((k) => `<span style="left:${P(X(k.at))}"><b>${esc(k.label)}</b><small>${esc(k.sub)}</small></span>`).join('')}</div></div>`;
201
+ const grid = W.ticks.slice(1).map((k) => `<i class="tg-gl" style="left:${P(X(k.at))}"></i>`).join('') + (fx < 100 ? `<i class="tg-dir" style="left:${P(fx)}"></i>` : '') + (tn != null ? `<u class="tg-td" style="left:${P(tn)}"></u>` : '');
202
+ const body = T.map((t) => {
203
+ const ds = t.rows.flatMap((r) => [day(r.start), day(r.end), r.track && day(r.track.forecast)]).filter(Boolean).sort((a, b) => a - b);
204
+ const shipped = t.rows.filter((r) => r.track && r.track.k >= 6).length, planned = t.rows.filter((r) => !r.track || r.track.k < 4).length, active = t.rows.length - shipped - planned;
205
+ const a = ds[0], b = ds[ds.length - 1];
206
+ const words = [active ? active + ' active' : '', planned ? planned + ' planned' : '', shipped ? shipped + ' shipped' : ''].filter(Boolean).join(' · ');
207
+ // a milestone sits under the phase, in the theme's colour, with its name right of the ◆ (AgBoardTl5y)
208
+ const ms = releasesOf(t.rows).filter((m) => X(m.at) > 0 && X(m.at) < 100).map((m) => `<i class="tg-msd" style="left:${P(X(m.at))};--tone:${t.tone}" title="${esc(m.name)} · ${esc(md(m.at))}"></i><span class="tg-msl" style="left:${P(X(m.at))}">${esc(m.name)}</span>`).join('');
209
+ const ph = ds.length ? `<button type="button" class="tg-phase${a > far ? ' dir' : ''}" data-tgtheme="${esc(t.key)}" style="left:${P(X(a))};width:${P(Math.max(2, X(b) - X(a)))};--tone:${t.tone}"><b>${esc(t.label)}</b><small>${esc(words)}${a > far ? ' · directional' : ''}</small></button>${ms}` : '<span class="tg-nod">No dates on record</span>';
210
+ return `<div class="tg-r tg-th tg-5">${themeCell(t, true)}<div class="tg-p">${grid}${ph}</div></div>`;
211
+ }).join('');
212
+ const lab = (x) => `calc(230px + (100% - 230px) * ${(x / 100).toFixed(4)})`; // the 230 px theme column
213
+ const marks = (tn != null ? `<span class="tg-today" style="left:${lab(tn)}">Today</span>` : '') + (fx < 100 ? `<span class="tg-far" style="left:${lab(fx)}">Beyond 18 months · directional</span>` : '');
214
+ return { html: `<div class="tg tg-5y" data-span="y5">${head}<div class="tg-body">${marks}${body || '<p class="tg-empty">No initiative is on screen.</p>'}</div><div class="tg-ft"><span>Only themes and their phases at this span. Dashed means directional, not committed.</span><span class="tg-go2">Open a phase to see its initiatives</span></div></div>`, none: [] };
215
+ }
216
+
217
+ /** The timeline's markup for the rows on screen. → { html, none: [rows with no dates] } */
218
+ export function timelineHtml(rows, M, span, o = {}) {
219
+ const opt = { now: new Date(), phone: false, sel: null, status: () => ({ tone: 'q', text: '' }), hiddenCount: 0, askHref: () => '#', ...o };
220
+ opt.span = span;
221
+ if (span === 'year' || span === 'half' || span === 'y2') return year(rows, opt);
222
+ if (span === 'y5') return fiveYear(rows, opt);
223
+ return quarter(rows, M, opt);
120
224
  }
@@ -1,6 +1,5 @@
1
- /* pm/bd-stages.js — the Board's help on the lifecycle and the timeline (initiative premium-agreed-design, B1 B2).
2
- * Six stages and two milestones (◆), what finishes each and where its count comes from, as the Agreed design's "What finishes each step"
3
- * frame draws it; and the timeline's spans, as its "The longer the span, the higher the grouping" frame draws it. Pure markup; no reads. */
1
+ /* pm/bd-stages.js — the Board's two help frames (initiative premium-agreed-design, B1 B2): "What finishes each step" (AgBoardStages) and
2
+ * "The longer the span, the higher the grouping" (AgBoardTlRules), as two separate popovers. Pure markup; no reads. */
4
3
  import { esc } from './premium-shell.js';
5
4
 
6
5
  export const STEP_HELP = [
@@ -14,20 +13,35 @@ export const STEP_HELP = [
14
13
  ['Evaluate', true, 'Keep, iterate or stop', 'The report reviewed, the evaluation, your verdict', 'PMOS'],
15
14
  ];
16
15
  export const SPAN_HELP = [
17
- ['Sprint', '2 weeks', 'Jira tickets inside each initiative', 'Tickets, status, blockers'],
16
+ ['Sprint', '2 weeks', 'Jira tickets inside each initiative', 'Tickets, assignees, blockers'],
18
17
  ['Quarter', '3 months', 'One row per initiative', 'Stage, output progress, plan against the Jira forecast'],
19
18
  ['Half · Year', '6–12 months', 'Themes, with their initiatives as bars inside', 'Which initiatives carry each theme, milestones'],
20
- ['2 yr · 5 yr', '2–5 years', 'Themes only, as phases', 'Where each theme is heading, from the dates on record'],
19
+ ['2 yr · 5 yr', '2–5 years', 'Themes only, as phases', 'Where each theme is heading, what is committed and what is directional'],
21
20
  ];
21
+ export const THEME_HELP = [
22
+ ['Foundation', 'var(--cz-c-8c929b)', 'Make PMOS reliable to run', 'Platform, reliability, state, health budgets'],
23
+ ['Closing gaps', 'var(--cz-c-4894ea)', 'Match what PMs already expect', 'Features users expect but miss today'],
24
+ ['Expansion', 'var(--cz-c-5e9c6a)', 'Reach partners and teams', 'New segments, partners, integrations'],
25
+ ['Maturity', 'var(--cz-c-d4a13a)', 'Prove outcomes, then scale', 'Outcome proof, automation, scale'],
26
+ ];
27
+
28
+ const X = '<button type="button" class="bd-x" data-pop-close aria-label="Close"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg></button>';
29
+ const row = (cells, cls = '') => `<div class="bd-tr${cls}" role="row">${cells.map((c) => `<span role="${cls ? 'columnheader' : 'cell'}">${c}</span>`).join('')}</div>`;
22
30
 
23
- /** The help popover: what finishes each step, and how the timeline groups by span. */
31
+ /** AgBoardStages: what finishes each of the eight steps and where its count comes from. */
24
32
  export function stepsHelpHtml() {
25
- const row = (cells, cls = '') => `<div class="bd-tr${cls}" role="row">${cells.map((c) => `<span role="cell">${c}</span>`).join('')}</div>`;
26
- return `<div class="bd-help"><div class="bd-help-h"><h2 id="hSteps">What finishes each step</h2><button type="button" class="cz-ib" data-pop-close aria-label="Close"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg></button></div>`
33
+ return `<div class="bd-help"><div class="bd-help-h"><h2 id="hSteps">What finishes each step</h2>${X}</div>`
27
34
  + '<p class="bd-help-p">Six stages and two milestones. Every initiative on the Board shows progress toward the output of the step it is in. A milestone is a checkpoint: the initiative waits there until its conditions are met.</p>'
28
35
  + `<div class="bd-tbl" role="table" aria-label="What finishes each step">${row(['Step', 'Type', 'Output that finishes it', 'How progress is counted', 'Where the count comes from'], ' th')}`
29
- + STEP_HELP.map(([n, ms, o, how, src]) => row([`<b>${ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(n)}</b>`, ms ? 'Milestone' : 'Stage', esc(o), esc(how), `<em>${esc(src)}</em>`])).join('') + '</div>'
30
- + '<h3 class="bd-help-h3">The longer the span, the higher the grouping</h3><p class="bd-help-p">The timeline changes what a row is as you zoom out. An initiative belongs to the theme of its anchor: the objective of its KR, or the health budgets.</p>'
36
+ + STEP_HELP.map(([n, ms, o, how, src]) => row([`<b>${ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(n)}</b>`, `<em>${ms ? 'Milestone' : 'Stage'}</em>`, esc(o), esc(how), `<em>${esc(src)}</em>`])).join('') + '</div></div>';
37
+ }
38
+
39
+ /** AgBoardTlRules: what a row is at each span, and the themes (an example: themes are not set in PMOS yet). */
40
+ export function rulesHelpHtml() {
41
+ return `<div class="bd-help"><div class="bd-help-h"><h2 id="hRules">The longer the span, the higher the grouping</h2>${X}</div>`
42
+ + '<p class="bd-help-p">The timeline switches what a row is as you zoom out. Each initiative belongs to one theme, set in its panel and on the PRD. Themes are set per product.</p>'
31
43
  + `<div class="bd-tbl bd-tbl4" role="table" aria-label="Timeline spans">${row(['Span', 'Covers', 'Rows are', 'You see'], ' th')}`
32
- + SPAN_HELP.map(([s, c, r, y]) => row([`<b>${esc(s)}</b>`, `<em>${esc(c)}</em>`, esc(r), esc(y)])).join('') + '</div></div>';
44
+ + SPAN_HELP.map(([s, c, r, y]) => row([`<b>${esc(s)}</b>`, `<em>${esc(c)}</em>`, esc(r), esc(y)])).join('') + '</div>'
45
+ + `<div class="bd-tbl bd-tbl3" role="table" aria-label="Themes">${row(['Theme (example)', 'What it is for', 'Typical work'], ' th')}`
46
+ + THEME_HELP.map(([n, c, w, t], i) => row([`<b><i class="tg-sw k${i}"></i>${esc(n)}</b>`, esc(w), esc(t)])).join('') + '</div></div>';
33
47
  }
@@ -46,7 +46,7 @@ import { say } from './c3-init-extras.js';
46
46
  import { c3btn } from './page-agent.js';
47
47
  import { button } from './primitives.js';
48
48
  import { mountSlide } from './slide-confirm.js';
49
- import { parseMd, toMd, canonMd, diffMd, toDom, fromDom, wordCounts, safeHref } from './c3-md.js';
49
+ import { parseMd, toMd, canonMd, diffMd, toDom, fromDom, wordCounts, safeHref } from './cozy-md.js';
50
50
  import { ensureReportCss, formatOf, formatView, outlineLabels, downloadsOf, printPdf, copyKindFor } from './c3-doc-formats.js';
51
51
 
52
52
  /* the sheet's width (initiative c3-doc-sheet-size): Normal (780px), Half, 3/4 or Whole window, as the session, meeting and studio sheets */