create-pmos 0.424.0 → 0.426.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 (110) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/board-deliveries-test.js +153 -0
  7. package/workspace/board-programs-test.js +60 -36
  8. package/workspace/board-shot.js +4 -3
  9. package/workspace/briefing-premium-board-test.js +9 -6
  10. package/workspace/briefing-premium-insights-test.js +31 -15
  11. package/workspace/briefing-premium-products-test.js +46 -43
  12. package/workspace/calm-timeline-test.js +190 -0
  13. package/workspace/changelog.json +24 -0
  14. package/workspace/ev-everywhere-test.js +3 -1
  15. package/workspace/guide/briefing-premium.md +3 -2
  16. package/workspace/guide/claude-proposes.md +16 -1
  17. package/workspace/guide/home.md +2 -2
  18. package/workspace/guide/index.md +1 -0
  19. package/workspace/guide/notes.md +39 -1
  20. package/workspace/guide/present-in-a-meeting.md +57 -0
  21. package/workspace/guide/programs.md +4 -3
  22. package/workspace/lib/board-premium.js +3 -1
  23. package/workspace/lib/briefing-premium-products.js +18 -4
  24. package/workspace/lib/chat-file-locate.js +40 -2
  25. package/workspace/lib/engine/boards.js +8 -2
  26. package/workspace/lib/idle-close.js +60 -0
  27. package/workspace/lib/loose-proposals.js +302 -0
  28. package/workspace/lib/meeting-focus.js +64 -14
  29. package/workspace/lib/my-work-premium.js +1 -1
  30. package/workspace/lib/proposal-runs.js +77 -2
  31. package/workspace/lib/propose-cli.js +42 -1
  32. package/workspace/lib/route-modules.js +1 -0
  33. package/workspace/lib/routes-boards.js +16 -4
  34. package/workspace/lib/routes-brief-page.js +9 -1
  35. package/workspace/lib/routes-briefing-premium.js +19 -0
  36. package/workspace/lib/routes-loose.js +210 -0
  37. package/workspace/lib/routes-meeting-focus.js +28 -6
  38. package/workspace/lib/routes-pm-items.js +27 -17
  39. package/workspace/lib/settings-store.js +2 -1
  40. package/workspace/lib/task-cli.js +18 -11
  41. package/workspace/milestone-pins-test.js +170 -0
  42. package/workspace/package-lock.json +2 -2
  43. package/workspace/package.json +1 -1
  44. package/workspace/premium-board-actions-test.js +2 -1
  45. package/workspace/premium-briefing-depth-test.js +2 -2
  46. package/workspace/premium-chat-term-test.js +13 -2
  47. package/workspace/premium-core-doc-issue-test.js +1 -1
  48. package/workspace/premium-rec-now-test.js +153 -0
  49. package/workspace/premium-rec-tab-test.js +167 -0
  50. package/workspace/product-lane-test.js +30 -17
  51. package/workspace/public/pm/bd-acts.js +6 -3
  52. package/workspace/public/pm/bd-deliveries.js +218 -0
  53. package/workspace/public/pm/bd-pin-card.css +16 -0
  54. package/workspace/public/pm/bd-pin-card.js +80 -0
  55. package/workspace/public/pm/bd-pins.js +33 -0
  56. package/workspace/public/pm/bd-pop.js +2 -0
  57. package/workspace/public/pm/bd-prog.js +5 -4
  58. package/workspace/public/pm/bd-span.js +140 -102
  59. package/workspace/public/pm/cozy-aud.css +9 -0
  60. package/workspace/public/pm/cozy-aud.js +80 -0
  61. package/workspace/public/pm/cozy-board.css +73 -11
  62. package/workspace/public/pm/cozy-home.css +16 -1
  63. package/workspace/public/pm/cozy-live-pill.js +3 -0
  64. package/workspace/public/pm/cozy-pick.css +41 -0
  65. package/workspace/public/pm/cozy-pick.js +134 -0
  66. package/workspace/public/pm/cozy-rec-bridge.js +32 -0
  67. package/workspace/public/pm/cozy-rec-now.css +104 -0
  68. package/workspace/public/pm/cozy-rec-now.js +330 -0
  69. package/workspace/public/pm/cozy-rec-present.css +69 -0
  70. package/workspace/public/pm/cozy-rec-present.js +467 -0
  71. package/workspace/public/pm/cozy-rec-tab.css +90 -0
  72. package/workspace/public/pm/cozy-rec-tab.js +219 -0
  73. package/workspace/public/pm/cozy-settings.js +8 -2
  74. package/workspace/public/pm/cozy-today.css +4 -0
  75. package/workspace/public/pm/home-app.js +51 -22
  76. package/workspace/public/pm/home-data.js +5 -3
  77. package/workspace/public/pm/home-list.js +63 -15
  78. package/workspace/public/pm/home-more.js +2 -31
  79. package/workspace/public/pm/home-today.js +19 -9
  80. package/workspace/public/pm/ini-tasks.js +4 -1
  81. package/workspace/public/pm/live-model.js +1 -1
  82. package/workspace/public/pm/loose-props.css +54 -0
  83. package/workspace/public/pm/loose-props.js +262 -0
  84. package/workspace/public/pm/premium-board.js +65 -30
  85. package/workspace/public/pm/premium-insights.js +42 -24
  86. package/workspace/public/pm/premium-meeting.js +17 -4
  87. package/workspace/public/pm/premium-mtg-present.js +4 -3
  88. package/workspace/public/pm/premium-report-read.js +2 -0
  89. package/workspace/public/pm/premium-vw-mtg.js +15 -7
  90. package/workspace/public/pm/rec-state.js +13 -5
  91. package/workspace/public/pm/rec-tab-core.js +92 -0
  92. package/workspace/public/pm/term-view.js +81 -10
  93. package/workspace/public/pm/view-notes.js +9 -0
  94. package/workspace/public/premium-aud.html +22 -0
  95. package/workspace/public/premium-board.html +2 -0
  96. package/workspace/public/premium-insights.html +2 -1
  97. package/workspace/public/premium-rec.html +30 -0
  98. package/workspace/public/premium.html +1 -0
  99. package/workspace/rec-present-test.js +229 -0
  100. package/workspace/server.js +116 -7
  101. package/workspace/skills/loose-propose.skill +39 -0
  102. package/workspace/task-milestones-test.js +15 -6
  103. package/workspace/test-lists/board-deliveries.json +13 -0
  104. package/workspace/test-lists/calm-timeline.json +5 -0
  105. package/workspace/test-lists/loose-props.json +9 -0
  106. package/workspace/test-lists/milestone-pins.json +6 -0
  107. package/workspace/test-lists/rec-now.json +6 -0
  108. package/workspace/test-lists/rec-present.json +13 -0
  109. package/workspace/test-lists/recording-tab.json +13 -0
  110. package/workspace/timeline-holds-test.js +44 -42
@@ -25,10 +25,20 @@
25
25
  * today, "Nothing planned, Oct 27 to Nov 29 · 5 wk" after it, both across it. One press per gap: a card with the words, and + (New task with the
26
26
  * gap's dates) while part of it is ahead. A skipped stage between two dated stages is one » on the hairline, or on the bar at the joint when
27
27
  * there is no gap; skips at either end are not drawn; a » with less than 24 px is dropped and its words go to the bar's title. A phone draws
28
- * the hairline and » only; its row sheet lists them. A gap never changes the row's dot or risk. */
28
+ * the hairline and » only; its row sheet lists them. A gap never changes the row's dot or risk.
29
+ * Calmer timeline (feedback batch 13 item 4, A: XcalmA1Desk, A4Dark, A3Phone, A2Folded, A5Milestones): say it once, few marks, quiet rows.
30
+ * · One label per bar end: what lands, then when ("Tender award Nov 3"; the year only when it is not this year). The name is the end milestone's,
31
+ * else Deliver or Evaluate. The date turns amber at risk and orange late; the rest (days over, the forecast, a slip, a clash) is its hover.
32
+ * With no room at the right edge the label sits before the ◇, on a card chip. No date under a ◇ and no second date.
33
+ * · Marks: the bar (done dark, to do light), a 2 px hairline for any gap or hold (a hold's hairline opens the hold card), one ◇ (filled done,
34
+ * orange late), the dashed Jira forecast, Today. The dotted hold, ⏸, the amber tint, the blue ◆ and the hatched out-of-window band are gone.
35
+ * Only the milestones the Filter shows are drawn (pm/bd-pins.js: the pinned ones, by default the last); every ◇ presses (data-ms-pick).
36
+ * · Group rows draw nothing while open; folded, the roll-up line, the counted ◇s, the end date and one dot per initiative off track.
37
+ * · A row's dot shows only off track (late, at risk, on hold). Names wrap to two lines. One tint (programs); quarter grid lines only. */
29
38
  import { esc } from './premium-shell.js';
30
39
  import { mergeClose } from './program-model.js';
31
40
  import { stagesOfRow } from './bd-wf.js';
41
+ import { shownMs } from './bd-pins.js';
32
42
 
33
43
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
34
44
  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; };
@@ -43,7 +53,7 @@ export const DRAWN = new Set(SPANS.map(([k]) => k));
43
53
  const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
44
54
  const FLAG = 'M5 21V4M5 4h11l-2 4 2 4H5';
45
55
  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';
46
- const CHL = 'M15 6l-6 6 6 6', CHR = 'M9 6l6 6-6 6', PAUSE = 'M9 6v12M15 6v12', SKIP = 'M6 7l5 5-5 5M13 7l5 5-5 5';
56
+ const CHL = 'M15 6l-6 6 6 6', CHR = 'M9 6l6 6-6 6', SKIP = 'M6 7l5 5-5 5M13 7l5 5-5 5';
47
57
 
48
58
  /** 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. */
49
59
  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 } };
@@ -89,6 +99,9 @@ const doneOf = (r) => { const p = r.track && r.track.prog; return p ? Math.max(0
89
99
  const msLate = (m, now) => !m.done && day(m.date) && day(m.date) < new Date(now.getFullYear(), now.getMonth(), now.getDate());
90
100
  export const anyMsLate = (r, now) => !!(now && (r.milestones || []).some((m) => msLate(m, now)));
91
101
  const toneOf = (r, now) => (r.late || anyMsLate(r, now) ? 'late' : r.status === 'at risk' ? 'risk' : r.track && r.track.you ? 'you' : r.status === 'on track' ? 'ok' : 'q');
102
+ /** A row's dot (batch 13 item 4): only off track. 'late' | 'risk' | 'q' (on hold) | null. */
103
+ const offTone = (r, now) => { const t = toneOf(r, now); return t === 'late' || t === 'risk' ? t : r.status === 'on hold' ? 'q' : null; };
104
+ const dotHtml = (r, now) => { const t = offTone(r, now); return t ? `<i class="cz-dot ${t}${t === 'q' ? '' : ' m-warn'}" aria-hidden="true"></i>` : ''; };
92
105
  const dated = (r) => day(r.start) || day(r.end) || (r.track && day(r.track.forecast)) || (r.draft && day(r.draft.start));
93
106
  /** Done work leaves no edge tab (TsCGrill 5): the initiative is past Deliver, or every part it counts is done. */
94
107
  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)));
@@ -164,31 +177,48 @@ function extentOf(r, now) {
164
177
  return ds.length ? { a: new Date(Math.min(...ds)), b: new Date(Math.max(...ds)) } : null;
165
178
  }
166
179
 
167
- /** 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
168
- * date reads by the span's scale (o.fmt). */
180
+ /** A date as the calm timeline says it (batch 13 item 4): "Nov 3", and the year only when it is not this year ("Jun 10 ’27"). */
181
+ export const dy = (d, now) => md(d) + (d.getFullYear() !== now.getFullYear() ? ' ’' + String(d.getFullYear()).slice(2) : '');
182
+ /** What lands at a row's end: its end milestone's name, else the stage the end stands for. */
183
+ const landsOf = (r, et) => (et ? et.name : r.track && r.track.k >= 6 ? 'Evaluate' : 'Deliver');
184
+ /** The one label at a bar's end (XcalmA1Desk): what lands, then when; tone '' | 'risk' | 'late' | 'q' colours the date. At the right edge, with
185
+ * no room after the mark, it sits before it on a card chip. hover: the words a pointer reads (days over, the forecast, a slip, a clash). */
186
+ function endLabel(at, name, d, tone, now, pxPct, hover, slip) {
187
+ const date = dy(d, now), est = (name.length + date.length + 1) * 6.6 + 26;
188
+ const flip = pxPct && (100 - at) * pxPct < est;
189
+ const tip = name + ' · ' + md(d) + (d.getFullYear() !== now.getFullYear() ? ', ' + d.getFullYear() : '') + (hover && hover.length ? '. ' + hover.join('. ') : '');
190
+ return `<span class="tg-endl${flip ? ' l' : ''}" style="left:${P(at)}" title="${esc(tip)}"><span class="nm">${esc(name)}</span> <b${tone ? ` class="${tone}"` : ''}>${esc(date)}</b>${slip || ''}</span>`;
191
+ }
192
+ /** A slip's words for the hover (PvaAC4): "Planned May 20 → Jun 10 (+3 wk)". */
193
+ const slipWords = (r, e) => { const p = r.plan, b = p && day(p.end), n = p && p.slip; if (!b || !n) return ''; const w = Math.abs(n) >= 7 ? Math.round(Math.abs(n) / 7) + ' wk' : Math.abs(n) + 'd'; return 'Planned ' + md(b) + ' → ' + md(e) + ' (' + (n > 0 ? '+' : '−') + w + ')'; };
194
+
195
+ /** One initiative's marks: the plan cut by its gaps and holds, the forecast past the plan, the shown milestones, the end ◇ and one label after the
196
+ * furthest mark. */
169
197
  function qBar(r, X, now, phone, fmt, pxPct, ms = {}) {
170
198
  const s = day(r.start), e = day(r.end), fc = r.track && day(r.track.forecast), tone = toneOf(r);
171
- const tm = taskMarks(r, X, now, phone, pxPct, ms), et = tm.end;
172
- let out = marks(r, X, now, phone) + tm.html, clash = null;
199
+ const tm = taskMarks(r, X, now, phone, pxPct, ms), et = tm.end, note = markWords(r, now);
200
+ const risk = r.status === 'at risk' ? 'risk' : r.status === 'on hold' ? 'q' : '';
201
+ let out = tm.html + depHtml(r, X, phone), clash = null;
173
202
  if (s && e) {
174
- const g = gapsHtml(r, X, now, phone, fmt, pxPct || 0, s, e, tone);
203
+ const g = gapsHtml(r, X, now, phone, fmt, pxPct || 0, s, e, tone, note);
175
204
  out += g.html; clash = g.clash;
176
- const over = r.over && now > e, late = fc && fc > e, words = [];
177
- 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'); }
178
- 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)); }
179
- // the committed end is the Deliver or Evaluate ◇ (PgTimeline), with its date right of it; filled while the initiative is at that milestone
180
- // a milestone task in the stage the end ◇ stands for IS that ◇ (say it once, batch 11 item 3): the ◇ takes its name, and its done
181
- const eTitle = et ? et.name + ' · ' + md(day(et.date)) + (et.stage ? ' · ◆ ' + et.stage : '') : (r.track && r.track.k >= 6 ? 'Committed evaluation date ' : 'Committed delivery date ') + md(e);
182
- out += `<i class="tg-end${r.track && r.track.ms ? ' ms' : ''}${et && et.done ? ' dn' : ''}${over || clash || (et && msLate(et, now)) ? ' late' : ''}" style="left:${P(X(e))}" title="${esc(eTitle + (clash ? '. ' + clash : ''))}"></i>`;
183
- if (clash && !phone) out += `<span class="tg-lab late tg-clash" style="left:${P(X(e))}">${esc(fmt(e) + ' · ' + clash)}${slipHtml(r)}</span>`;
184
- 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(' · '))}${slipHtml(r)}</span>`;
185
- else if (!phone) out += `<span class="tg-endl" style="left:${P(X(e))}">${esc(fmt(e))}${slipHtml(r)}</span>`;
205
+ const over = r.over && now > e, late = fc && fc > e, hover = [];
206
+ if (over) hover.push(r.overDays + ' ' + (r.overDays === 1 ? 'day' : 'days') + ' over');
207
+ 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>`; hover.push('Jira forecast ' + md(fc)); }
208
+ if (clash) hover.push(clash);
209
+ const sw = slipWords(r, e); if (sw) hover.push(sw);
210
+ // the committed end is the ◇ (PgTimeline); a milestone task in the stage it stands for IS that ◇ (say it once, batch 11 item 3): its name and its done
211
+ const isLate = !!(over || clash || r.late || (et && msLate(et, now)));
212
+ const name = landsOf(r, et), eTitle = name + ' · ' + md(e) + (et && et.stage ? ' · ◆ ' + et.stage : '') + (et && et.done ? ' · done' : isLate ? ' · late' : '');
213
+ out += `<button type="button" class="tg-end${et && et.done ? ' dn' : ''}${isLate ? ' late' : ''}" data-ms-pick="${esc(r.key)}" data-ms-id="${esc(et ? et.id : '')}" style="left:${P(X(e))}" aria-haspopup="dialog" aria-label="${esc(eTitle + '. Milestones of ' + r.title)}" title="${esc(eTitle + (clash ? '. ' + clash : ''))}"></button>`;
214
+ out += endLabel(Math.max(X(e), over ? X(now) : 0, late ? X(fc) : 0), name, e, isLate ? 'late' : risk, now, pxPct, hover, slipHtml(r));
186
215
  } else if (fc) {
187
- 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>`}`;
216
+ out += `<span class="tg-fc solo" style="left:${P(X(fc))};width:12px;margin-left:-12px" title="Jira forecast ${esc(md(fc))}"></span>` + endLabel(X(fc), 'Jira forecast', fc, '', now, pxPct, [], '');
188
217
  } else if (r.draft && day(r.draft.start)) {
189
- out += draftBar(r, X, phone, fmt);
218
+ out += draftBar(r, X, phone, fmt, now, pxPct);
190
219
  } else {
191
- const d = s || e; out += `<i class="tg-dm" style="left:${P(X(d))}" title="${s ? 'Starts' : 'Ends'} ${esc(md(d))}"></i>`;
220
+ const d = s || e;
221
+ out += `<button type="button" class="tg-end" data-ms-pick="${esc(r.key)}" data-ms-id="" style="left:${P(X(d))}" aria-haspopup="dialog" aria-label="${esc((s ? 'Starts ' : 'Ends ') + md(d) + '. Milestones of ' + r.title)}" title="${s ? 'Starts' : 'Ends'} ${esc(md(d))}"></button>` + (e ? endLabel(X(d), landsOf(r, et), d, risk, now, pxPct, [], '') : '');
192
222
  }
193
223
  return out + planMarks(r, X, phone, fmt);
194
224
  }
@@ -208,11 +238,11 @@ export function slipHtml(r) {
208
238
  const n = r && r.plan && r.plan.slip;
209
239
  return n ? ` <b class="tg-slip${n > 0 ? ' late' : ''}">${n > 0 ? '+' + n : '\u2212' + -n}d</b>` : '';
210
240
  }
211
- function draftBar(r, X, phone, fmt) {
241
+ function draftBar(r, X, phone, fmt, now, pxPct) {
212
242
  const D = r.draft, a = day(D.start), b = day(D.end) || a;
213
243
  const tip = r.title + ' · draft. Newest: ' + D.name + (D.end ? ' · ends ' + md(b) : '') + (D.others && D.others.length ? '. Also: ' + D.others.map((x) => x.name + (x.end ? ' · ends ' + md(day(x.end)) : '')).join(', ') : '');
214
244
  return `<span class="tg-bar tg-dr" data-key="${esc(r.key)}" style="left:${P(X(a))};width:${P(Math.max(0.15, X(b) - X(a)))}" title="${esc(tip)}" role="img" aria-label="${esc(tip)}"></span>`
215
- + (phone ? '' : `<span class="tg-endl" style="left:${P(X(b))}">${esc(fmt(b))}</span>`);
245
+ + endLabel(X(b), 'Draft', b, '', now, pxPct, [tip], '');
216
246
  }
217
247
 
218
248
  const MIN_PX = 8; // a hold or a gap narrower than this closes up (XtiA4Long, XtiAGrill 12)
@@ -228,7 +258,7 @@ export function holdWords(x, now) {
228
258
  }
229
259
  /** 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 ⏸,
230
260
  * and the return date where the bar starts again. → { html, clash } — clash: the words when the return date falls after the end ◇. */
231
- function gapsHtml(r, X, now, phone, fmt, pxPct, s, e, tone) {
261
+ function gapsHtml(r, X, now, phone, fmt, pxPct, s, e, tone, note = '') {
232
262
  const wide = (a, b) => !pxPct || (X(b) - X(a)) * pxPct >= MIN_PX;
233
263
  // a resumed hold narrower than 8 px closes up; a hold still running always shows, so its ⏸ is there to press
234
264
  const H = holdSpans(r, now), shown = H.filter((x) => x.kind !== 'past' || wide(x.a, x.b));
@@ -260,11 +290,11 @@ function gapsHtml(r, X, now, phone, fmt, pxPct, s, e, tone) {
260
290
  if (at < e) pieces.push([at, e, faded]);
261
291
  const days = (p) => Math.max(0, (p[1] - p[0]) / 86400000), total = pieces.reduce((n, p) => n + days(p), 0);
262
292
  let left = (doneOf(r) / 100) * total;
263
- const hold = (H.length ? '. ' + H.map((x) => holdWords(x, now)).join('. ') : '') + (dropped.length ? '. ' + dropped.join('. ') : '');
293
+ const hold = (H.length ? '. ' + H.map((x) => holdWords(x, now)).join('. ') : '') + (dropped.length ? '. ' + dropped.join('. ') : '') + (note ? '. ' + note : '');
264
294
  let html = pieces.map((p, i) => {
265
295
  const d = days(p), f = d ? Math.max(0, Math.min(1, left / d)) : 0; left -= d;
266
296
  const xl = i > 0 || p[0] > s ? ' xl' : '', xr = i < pieces.length - 1 || p[1] < e ? ' xr' : '';
267
- 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>`;
297
+ return `<span class="tg-bar${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>`;
268
298
  }).join('');
269
299
  // each plain gap: the hairline, one press (a 24 px area) with its words; a phone draws the line alone and its row sheet says it
270
300
  plain.forEach(([a, b], gi) => {
@@ -279,14 +309,11 @@ function gapsHtml(r, X, now, phone, fmt, pxPct, s, e, tone) {
279
309
  html += phone ? `<i class="tg-sk on" style="left:${P(m.x)}" aria-hidden="true">${SV(SKIP)}</i>`
280
310
  : `<span class="tg-sk on" style="left:${P(m.x)}" role="img" aria-label="${esc(m.words)}" title="${esc(m.words)}">${SV(SKIP)}</span>`;
281
311
  }
312
+ // a hold is the hairline of a gap (batch 13 item 4): the same 2 px line, and one press opens the hold card (resume, change the date). The return
313
+ // date and how long it waits are the card's and the hover's; a hold still running is never narrower than its press
282
314
  for (const x of shown) {
283
- const late = x.kind === 'over' ? ' late' : '', l = X(x.a), w = X(x.b) - l, narrow = pxPct && w * pxPct < 34;
284
- html += `<span class="tg-gap${late}" style="left:${P(l)};width:${P(w)}" aria-hidden="true"></span>`;
285
- 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>`;
286
- if (phone) continue;
287
- if (x.kind === 'open' && x.b < e) html += `<span class="tg-hl" style="left:${P(X(x.b))}">${esc(fmt(x.b))}</span>`;
288
- 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>`; }
289
- else if (x.kind === 'none') html += `<span class="tg-hl" style="left:${P(X(x.b))}">no return date</span>`;
315
+ const late = x.kind === 'over' ? ' late' : '', l = X(x.a), w = X(x.b) - l, words = holdWords(x, now) + (x.kind === 'none' ? '. Set a return date' : '. Open the hold');
316
+ html += `<button type="button" class="tg-ng ho${late}" data-hold="${esc(r.key)}" data-i="${x.i}" style="left:${P(l)};width:${P(w)}" aria-label="${esc(words)}" title="${esc(holdWords(x, now))}" aria-haspopup="dialog"></button>`;
290
317
  }
291
318
  const ob = H.find((x) => x.kind === 'open' && x.b > e);
292
319
  const clash = ob ? (r.track && r.track.k >= 6 ? 'Evaluate' : 'Deliver') + ' is before the return, ' + md(ob.b) : null;
@@ -307,29 +334,23 @@ function endTask(r, M) {
307
334
  const end = inLast.length ? inLast[inLast.length - 1] : M.find((m) => +day(m.date) === +e) || null;
308
335
  return end ? { ...end, stage: msStage(r, end) } : null;
309
336
  }
310
- /** One ◇ per milestone task on the row (feedback batch 11 item 3; canvas XmlA1Board, XmlA4Hover, XmlA7Spans): at its due date, hollow while open,
311
- * filled grey when done, an orange outline and an orange date when late. Quarter and Half put a short date under each ◇, Year and 2 yr cut the
312
- * date to fit, 5 yr and a phone none. ◇s closer than about 40 px merge into one counted ◇ that lists them under it. The latest milestone task in
313
- * a ◆ stage, or one on the end's own day, is the end ◇ and is not drawn again. Not draggable. → { html, end } */
337
+ /** One ◇ per milestone task the Filter shows (batch 13 item 4, XcalmA5Milestones; pm/bd-pins.js shownMs: the pinned ones, by default the last),
338
+ * at its due date: hollow while open, filled grey when done, orange when late. No date under it: its name and date are its hover. ◇s closer than
339
+ * about 40 px merge into one counted ◇ that lists them. The latest milestone task in a ◆ stage, or one on the end's own day, is the end ◇ and
340
+ * is not drawn again. A ◇ presses (data-ms-pick: the initiative's milestones, to pin). → { html, end } */
314
341
  function taskMarks(r, X, now, phone, pxPct, ms) {
315
342
  const M = (r.milestones || []).filter((m) => day(m.date));
316
343
  if (!M.length) return { html: '', end: null };
317
- const end = endTask(r, M);
318
- const L = M.filter((m) => !end || m.id !== end.id).map((m) => ({ ...m, late: msLate(m, now), stage: msStage(r, m) }))
344
+ const end = endTask(r, M), show = new Set(shownMs(r, ms.mode || 'pinned').map((m) => m.id));
345
+ const L = M.filter((m) => (!end || m.id !== end.id) && show.has(m.id)).map((m) => ({ ...m, late: msLate(m, now), stage: msStage(r, m) }))
319
346
  .filter((m) => { const x = X(day(m.date)); return x > 0 && x < 100; });
320
347
  const C = mergeClose(L, Math.max(1, ms.reach || 7));
321
- const sp = ms.sp || 'quarter', dates = !phone && sp !== 'y5', cut = sp === 'year' || sp === 'y2';
322
- const xs = C.map((c) => X(day(c.date))), room = (i) => (pxPct ? Math.min(i ? xs[i] - xs[i - 1] : 1e3, i < xs.length - 1 ? xs[i + 1] - xs[i] : 1e3) * pxPct - 6 : 0);
323
- const fmtD = (d) => (sp === 'y2' ? my(d) : md(d));
324
- const html = C.map((c, i) => {
325
- const x = P(xs[i]), tone = c.late ? ' late' : c.done ? ' dn' : '';
348
+ const html = C.map((c) => {
349
+ const x = P(X(day(c.date))), tone = c.late ? ' late' : c.done ? ' dn' : '';
326
350
  const one = c.items[0], words = (m) => m.name + ' · ' + md(day(m.date)) + (m.stage ? ' · ◆ ' + m.stage : '') + (m.late ? ' · late' : m.done ? ' · done' : '');
327
- const mark = c.n > 1
351
+ return c.n > 1
328
352
  ? `<button type="button" class="tg-tmc${tone}" data-ms-row="${esc(r.key)}" data-ms-ids="${esc(c.items.map((m) => m.id).join(' '))}" style="left:${x}" aria-haspopup="menu" aria-label="${esc(c.n + ' milestones, ' + c.range + ': ' + c.items.map((m) => m.name).join(', '))}" title="${esc(c.items.map(words).join('\n'))}"><b aria-hidden="true">${c.n}</b></button>`
329
- : `<span class="tg-tm${tone}" style="left:${x}" role="img" aria-label="${esc('Milestone ' + words(one))}" title="${esc(words(one))}"></span>`;
330
- if (!dates) return mark;
331
- const label = c.n > 1 ? c.range : fmtD(day(one.date)), w = cut && room(i) > 0 ? `;max-width:${Math.max(18, Math.round(room(i)))}px` : '';
332
- return mark + `<span class="tg-tml${c.late ? ' late' : ''}" style="left:${x}${w}">${esc(label)}</span>`;
353
+ : `<button type="button" class="tg-tm${tone}" data-ms-pick="${esc(r.key)}" data-ms-id="${esc(one.id)}" style="left:${x}" aria-haspopup="dialog" aria-label="${esc('Milestone ' + words(one) + '. Milestones of ' + r.title)}" title="${esc(words(one))}"></button>`;
333
354
  }).join('');
334
355
  return { html, end };
335
356
  }
@@ -353,50 +374,63 @@ export function laneMilestones(rows, now) {
353
374
  }
354
375
  /** The lines a lane's list or sheet shows, as data on its ◇ or its track: name, initiative, date and tone. */
355
376
  const laneData = (L) => esc(JSON.stringify(L.map((m) => ({ k: m.row.key, n: m.name, t: m.row.title, d: String(m.date).slice(0, 10), s: m.late ? 'late' : m.done ? 'dn' : '' }))));
356
- /** The lane's ◇s: one per milestone, close ones merged into a counted ◇ (a button on a desktop, a mark on a phone, where the lane's tap lists
357
- * them); Quarter and Half put the date under each, Year and 2 yr cut it to fit, 5 yr and a phone none (XmlA7Spans). */
377
+ /** A folded group's ◇s (batch 13 item 4, XcalmA2Folded): one per milestone, close ones merged into a counted ◇ (a button on a desktop, a mark on
378
+ * a phone, where the lane's tap lists them). No date under them: the group's end date is its one label. */
358
379
  function laneMarks(L, X, phone, pxPct, ms) {
359
380
  const C = mergeClose(L.filter((m) => { const x = X(day(m.date)); return x > 0 && x < 100; }), Math.max(1, ms.reach || 7));
360
- const sp = ms.sp || 'quarter', dates = !phone && sp !== 'y5', cut = sp === 'year' || sp === 'y2';
361
- const xs = C.map((c) => X(day(c.date))), room = (i) => (pxPct ? Math.min(i ? xs[i] - xs[i - 1] : 1e3, i < xs.length - 1 ? xs[i + 1] - xs[i] : 1e3) * pxPct - 6 : 0);
362
- const fmtD = (d) => (sp === 'y2' ? my(d) : md(d));
363
381
  const words = (m) => m.name + ' · ' + m.row.title + ' · ' + md(day(m.date)) + (m.late ? ' · late' : m.done ? ' · done' : '');
364
- return C.map((c, i) => {
365
- const x = P(xs[i]), tone = c.late ? ' late' : c.done ? ' dn' : '', one = c.items[0];
366
- const mark = c.n < 2 ? `<span class="tg-tm${tone}" style="left:${x}" role="img" aria-label="${esc('Milestone ' + words(one))}" title="${esc(words(one))}"></span>`
382
+ return C.map((c) => {
383
+ const x = P(X(day(c.date))), tone = c.late ? ' late' : c.done ? ' dn' : '', one = c.items[0];
384
+ return c.n < 2 ? `<span class="tg-tm${tone}" style="left:${x}" role="img" aria-label="${esc('Milestone ' + words(one))}" title="${esc(words(one))}"></span>`
367
385
  : phone ? `<span class="tg-tmc${tone}" style="left:${x}" aria-hidden="true"><b>${c.n}</b></span>`
368
386
  : `<button type="button" class="tg-tmc${tone}" data-ms-lane="${laneData(c.items)}" style="left:${x}" aria-haspopup="menu" aria-label="${esc(c.n + ' milestones, ' + c.range + ': ' + c.items.map((m) => m.name + ', ' + m.row.title).join('; '))}" title="${esc(c.items.map(words).join('\n'))}"><b aria-hidden="true">${c.n}</b></button>`;
369
- if (!dates) return mark;
370
- const label = c.n > 1 ? c.range : fmtD(day(one.date)), w = cut && room(i) > 0 ? `;max-width:${Math.max(18, Math.round(room(i)))}px` : '';
371
- return mark + `<span class="tg-tml${c.late ? ' late' : ''}" style="left:${x}${w}">${esc(label)}</span>`;
372
387
  }).join('');
373
388
  }
389
+ /** One dot per initiative off track (late, at risk, on hold) in a folded group's name cell (XcalmA2Folded); none on track (zero is silence). */
390
+ function offDots(rows, now) {
391
+ const D = (rows || []).map((r) => offTone(r, now)).filter(Boolean);
392
+ if (!D.length) return '';
393
+ const n = (t) => D.filter((x) => x === t).length, words = [['late', 'late'], ['risk', 'at risk'], ['q', 'on hold']].filter(([t]) => n(t)).map(([t, w]) => n(t) + ' ' + w).join(', ');
394
+ return `<span class="tg-offd" role="img" aria-label="${esc(words)}" title="${esc(words)}">${D.slice(0, 5).map((t) => `<i class="cz-dot ${t}"></i>`).join('')}</span>`;
395
+ }
396
+ /** A folded group's track (XcalmA2Folded): the roll-up line, the counted ◇s and the end date. Open, a group draws nothing (its rows say it). */
397
+ function rollUp(rows, sp, X, W, o, ms, pxPct, now) {
398
+ if (!sp || sp.hi <= W.from || sp.lo >= W.to) return '';
399
+ const L = laneMilestones(rows, now);
400
+ const end = o.phone ? '' : `<span class="tg-endl" style="left:${P(X(sp.hi))}" title="${esc('Last end ' + md(sp.hi) + ', ' + sp.hi.getFullYear())}"><b>${esc(my(sp.hi))}</b></span>`;
401
+ return progLine({ rows }, sp, X, now) + laneMarks(L, X, o.phone, pxPct, ms) + end;
402
+ }
374
403
  /** The product's head row on the timeline: the name cell (tile, name, goal dots, count when folded, the fold) and the lane. Open or folded it
375
404
  * looks the same: folded, it is the product's summary. */
376
405
  function laneRow(g, X, W, ov, o, ms, pxPct, now) {
377
- const sp = progSpan(g), br = sp && sp.hi > W.from && sp.lo < W.to ? progLine(g, sp, X, now) : '';
378
- const L = laneMilestones(g.rows, now), marks = laneMarks(L, X, o.phone, pxPct, ms), shut = o.folded(g.key) ? ' closed' : '';
379
- if (o.phone) return `<div class="tgq-r tg-lane${shut}" data-lane="${esc(g.key)}"><div class="tgq-n tg-lnn">${o.prodCell(g)}</div><div class="tg-p"${L.length ? ` data-lane-ms="${laneData(L)}" data-lane-name="${esc(g.name)}"` : ''}>${ov}${br}${marks}</div></div>`;
380
- return `<div class="tg-r tg-lane${shut}" role="row" data-lane="${esc(g.key)}"><div class="tg-n tg-lnn" role="rowheader">${o.prodCell(g)}</div><div class="tg-p" role="cell">${ov}${br}${marks}</div></div>`;
406
+ const shut = o.folded(g.key), sp = progSpan(g), L = shut ? laneMilestones(g.rows, now) : [];
407
+ const tr = shut ? rollUp(g.rows, sp, X, W, o, ms, pxPct, now) : '', cell = o.prodCell(g, shut ? offDots(g.rows, now) : '');
408
+ if (o.phone) return `<div class="tgq-r tg-lane${shut ? ' closed' : ''}" data-lane="${esc(g.key)}"><div class="tgq-n tg-lnn">${cell}</div><div class="tg-p"${L.length ? ` data-lane-ms="${laneData(L)}" data-lane-name="${esc(g.name)}"` : ''}>${ov}${tr}</div></div>`;
409
+ return `<div class="tg-r tg-lane${shut ? ' closed' : ''}" role="row" data-lane="${esc(g.key)}"><div class="tg-n tg-lnn" role="rowheader">${cell}</div><div class="tg-p" role="cell">${ov}${tr}</div></div>`;
381
410
  }
382
411
 
383
- /** A row's milestones: its release's sign-off (◆ at the release date), "Push tickets" where drafted tickets wait on your Commit (today), and
384
- * "after <initiative>" at the plan start where a dependency is not done. Each one only from a record. */
385
- function marks(r, X, now, phone) {
412
+ /** A row's release sign-off and "Push tickets" (a drafted ticket waits on your Commit) as words in its bar's hover: no blue ◆ (batch 13 item 4). */
413
+ function markWords(r, now) {
386
414
  const T = r.trail || {}, out = [], rd = r.release && day(r.release.iso);
387
- const at = (d) => d && X(d) > 0 && X(d) < 100;
388
- 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>`}`);
389
- 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>`}`);
390
- const dep = (T.deps || []).find((d) => d.known && !d.done), s = day(r.start);
391
- 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>`);
392
- return out.join('');
415
+ if (rd && r.track && (r.track.key === 'deliver' || r.track.you)) out.push(r.release.name + ' sign-off ' + md(rd));
416
+ if (T.you && T.you.kind === 'commit') out.push(T.you.text || 'Push tickets now');
417
+ return out.join('. ');
418
+ }
419
+ /** "after <initiative>" at the plan start where a dependency is not done, from a record. */
420
+ function depHtml(r, X, phone) {
421
+ const dep = ((r.trail || {}).deps || []).find((d) => d.known && !d.done), s = day(r.start);
422
+ if (!dep || phone) return '';
423
+ const x = s && X(s) > 0 && X(s) < 100 ? X(s) : 0;
424
+ return `<span class="tg-dep" style="left:${P(x)}" title="Waits on ${esc(dep.title || dep.id)}">${SV(LINK)}after ${esc(dep.title || dep.id)}</span>`;
393
425
  }
394
426
 
395
- /** The overlay of a row: the column lines, the shaded ends (before the first date and after the last), the sprint band, the release line and
396
- * the today line. */
427
+ /** The overlay of a row: the quarter lines, the sprint band, the release line and the today line. */
397
428
  function overlay(W, X, now, sprint, rel) {
398
- const tl = W.ticks.slice(1).map((k) => `<i class="tg-gl" style="left:${P(X(k.at))}"></i>`).join('');
399
- const ends = W.first ? `<i class="tg-out" style="left:0;width:${P(X(W.first))}"></i><i class="tg-out" style="left:${P(X(W.last))};right:0"></i>` : '';
429
+ // quarter lines only (batch 13 item 4): weeks draw month lines, months quarter lines, quarters and years their own; no hatched ends
430
+ const gu = W.unit === 'w' ? 'm' : W.unit === 'm' ? 'q' : W.unit, at = [];
431
+ if (gu) for (let d = colAdd(gu, colStart(gu, W.from), 1); d < W.to; d = colAdd(gu, d, 1)) at.push(d);
432
+ else W.ticks.slice(1).forEach((k) => at.push(k.at));
433
+ const tl = at.map((d) => `<i class="tg-gl" style="left:${P(X(d))}"></i>`).join(''), ends = '';
400
434
  const sa = sprint && day(sprint.start), sb = sprint && day(sprint.end);
401
435
  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>` : '';
402
436
  const ra = rel && day(rel.iso), rl = ra && ra > W.from && ra < W.to ? `<i class="tg-rl" style="left:${P(X(ra))}"></i>` : '';
@@ -412,16 +446,16 @@ function edgeTabs(r, X, now, phone) {
412
446
  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);
413
447
  // ahead, a held row names its return date, not its start (XtiAGrill 11: "⏸ Mar ’27 ›")
414
448
  const ob = openBack(r, now), lw = late ? r.overDays + ' ' + (r.overDays === 1 ? 'day' : 'days') + ' over' : my(e), rw = ob ? my(ob) : my(x.a);
415
- 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>`;
449
+ 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) : ''}<span>${esc(words)}</span>${side === 'r' ? SV(CHR) : ''}</button>`;
416
450
  if (phone) return late ? tab('l', lw, ' late') : '';
417
451
  return (isDone(r) ? '' : tab('l', lw, late ? ' late' : '')) + (isDone(r) ? '' : tab('r', rw, ''));
418
452
  }
419
453
 
420
- /** The legend (PgTimeline), in the chip row on every span from Quarter on: done, to do, a saved plan's line and a draft while one is drawn,
421
- * No activity and Skipped while one is drawn (extra: { gap, skip }; batch 11 item 13)
422
- * (extra: { plan, draft }; batch 11 item 8), on hold while a hold is drawn, the Jira forecast, a program milestone where a program is
423
- * drawn, Milestone (Deliver, Evaluate and every milestone task, batch 11 item 3), today. */
424
- export const legendHtml = (prog, hold, extra = {}) => `<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>To do</span>${extra.plan ? '<span><i class="k pln"></i>Plan</span>' : ''}${extra.draft ? '<span><i class="k drf"></i>Draft</span>' : ''}${hold ? '<span><i class="k ho"></i>On hold</span>' : ''}${extra.gap ? '<span><i class="k ng"></i>No activity</span>' : ''}${extra.skip ? `<span><i class="k sk">${SV(SKIP)}</i>Skipped</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>Milestone</span><span><i class="k td"></i>Today</span></span>`;
454
+ /** The legend (PgTimeline), in the chip row on every span from Quarter on: done, to do, a saved plan's line and a draft while one is drawn
455
+ * (extra: { plan, draft }; batch 11 item 8), one hairline key for a gap or a hold while one is drawn and Skipped while a » is (extra: { gap, skip };
456
+ * batch 13 item 4 folds the hold into the gap's hairline), the Jira forecast, Milestone, today. `prog` is kept for the callers: a program draws
457
+ * no ◇ of its own while open. */
458
+ export const legendHtml = (prog, hold, extra = {}) => `<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>To do</span>${extra.plan ? '<span><i class="k pln"></i>Plan</span>' : ''}${extra.draft ? '<span><i class="k drf"></i>Draft</span>' : ''}${hold || extra.gap ? `<span><i class="k ng"></i>${hold && extra.gap ? 'Gap or hold' : hold ? 'On hold' : 'No activity'}</span>` : ''}${extra.skip ? `<span><i class="k sk">${SV(SKIP)}</i>Skipped</span>` : ''}<span><i class="k fc"></i>Jira forecast</span><span><i class="k dlv"></i>Milestone</span><span><i class="k td"></i>Today</span></span>`;
425
459
 
426
460
  /** The dates on record a window must hold: every shown row's plan and forecast, the programs' spans and milestones, the release. */
427
461
  function datesOf(list, M, o) {
@@ -440,8 +474,7 @@ function scaled(rows, M, o) {
440
474
  // 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)
441
475
  const days = (W.to - W.from) / 86400000, viewDays = W.fixed ? days : W.cols * COL_DAYS[W.unit];
442
476
  const ratio = days / viewDays, tpx = Math.max(200, o.trackPx || (o.phone ? 340 : 1100)), pxDay = tpx / viewDays;
443
- const reach = Math.max(W.fixed ? 1 : 2, Math.round(120 / pxDay)); // program milestones closer than ~120 px merge (TsCGrill 9)
444
- const msO = { sp, reach: Math.max(1, Math.round(40 / pxDay)) }; // a row's milestone ◇s closer than ~40 px merge (batch 11 item 3)
477
+ const msO = { sp, reach: Math.max(1, Math.round(40 / pxDay)), mode: o.msMode || 'pinned' }; // a row's milestone ◇s closer than ~40 px merge (batch 11 item 3); the Filter's milestones (batch 13 item 4)
445
478
  const ov = overlay(W, X, now, sprint, rel), pxPct = (tpx * (W.fixed ? 1 : ratio)) / 100;
446
479
  const ra = rel && day(rel.iso), sa = sprint && day(sprint.start), sb = sprint && day(sprint.end);
447
480
  // an undated program member's track says so beside today, where the view opens
@@ -470,40 +503,44 @@ function scaled(rows, M, o) {
470
503
  const lane = (g) => (o.prodCell && sp !== 'sprint' ? laneRow(g, X, W, ov, o, msO, pxPct, now) : o.prodHtml(g));
471
504
  if (o.phone) {
472
505
  // TsCPhone: each row carries its name above its bar; the name stays at the left while you swipe
473
- 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, now)}" 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, msO) + edgeTabs(r, X, now, true) : ND}</div></div>`;
506
+ 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)}">${dotHtml(r, now)}<b>${esc(r.title)}</b></button><div class="tg-p"${ext(r)}>${ov}${dated(r) ? qBar(r, X, now, true, fmt, pxPct, msO) + edgeTabs(r, X, now, true) : ND}</div></div>`;
474
507
  const body = G ? G.map((g) => {
475
508
  if (g.kind !== 'program') return lane(g) + (o.folded(g.key) ? '' : g.rows.map(one).join(''));
476
- const st = o.progState(g.program), s2 = progSpan(g);
477
- const br = s2 ? progLine(g, s2, X, now) : '';
478
- 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(''));
509
+ const st = o.progState(g.program), shut = o.folded(g.key), tr = shut ? rollUp(g.rows, progSpan(g), X, W, o, msO, pxPct, now) : '';
510
+ return `<div class="tgq-r tg-pg${shut ? ' closed' : ''}" data-prow="${esc(g.program.id)}"><div class="tgq-n tg-pgn">${progName(g, st, o, shut ? offDots(g.rows, now) : '')}</div><div class="tg-p">${ov}${tr}</div></div>` + (shut ? '' : g.products.map((x) => x.rows.map(one).join('')).join(''));
479
511
  }).join('') : list.map(one).join('');
480
512
  const top = `<div class="tgq-h"><div class="tg-p">${ticks}${pill}</div></div>`;
481
513
  const below = none.length ? `<div class="tg-none"><span>${none.length} ${none.length === 1 ? 'has' : 'have'} no dates</span>${askBtn}</div>` : '';
482
- return { html: `<div class="tg tg-s tgq" ${attrs}><div class="tg-scw"><div class="tg-sc" tabindex="0" role="group" aria-label="Timeline" style="${style}"><div class="tg-in">${top}<div class="tg-body">${body || empty}</div></div></div>${back}<i class="tg-fade l" aria-hidden="true"></i><i class="tg-fade r" aria-hidden="true"></i></div></div>${below}`, none };
514
+ // the Deliveries lane (batch 13 item 4, XcalmA6Phone): a phone shows the next deliveries above the rows (o.lane draws it; none: nothing)
515
+ const lanePh = o.lane ? o.lane({ W, X, rows: list, groups: G, now, phone: true, pxPct }) || '' : '';
516
+ return { html: lanePh + `<div class="tg tg-s tgq" ${attrs}><div class="tg-scw"><div class="tg-sc" tabindex="0" role="group" aria-label="Timeline" style="${style}"><div class="tg-in">${top}<div class="tg-body">${body || empty}</div></div></div>${back}<i class="tg-fade l" aria-hidden="true"></i><i class="tg-fade r" aria-hidden="true"></i></div></div>${below}`, none };
483
517
  }
484
518
  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>`;
485
519
  // 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
486
520
  const one = (r, cls) => { const s = o.status(r), sub = [r.owner, r.track ? r.track.label : r.stage, s.text].filter(Boolean).join(' · ');
487
- 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, now)}${toneOf(r, now) === 'you' ? ' m-info' : toneOf(r, now) === 'late' || toneOf(r, now) === '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, msO) + edgeTabs(r, X, now, false) : ND}</div></div>`; };
521
+ // the dot keeps its place while it is silent, so every name starts at the same line (XcalmA1Desk)
522
+ 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)}">${dotHtml(r, now) || '<i class="tg-nodot" 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, msO) + edgeTabs(r, X, now, false) : ND}</div></div>`; };
488
523
  // programs first, then the product (PgTimeline): the program's row brackets its initiatives' bars and draws its milestones as diamonds
489
524
  const body = G ? G.map((g) => {
490
525
  if (g.kind !== 'program') return lane(g) + (o.folded(g.key) ? '' : g.rows.map((r) => one(r, ' tg-gr')).join(''));
491
526
  const lp = g.products[g.products.length - 1], last = lp ? lp.rows[lp.rows.length - 1] : null;
492
- 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(''));
527
+ return progRow(g, o.progState(g.program), X, W, ov, o, msO, 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(''));
493
528
  }).join('') : list.map((r) => one(r)).join('');
494
529
  // the sprint band and the release keep their labels under the axis on Quarter, where a week is wide enough to read them
495
530
  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>` : ''}` : '';
496
531
  const axis = axl ? `<div class="tg-ax"><span class="tg-n"></span><div class="tg-p">${axl}</div></div>` : '';
497
532
  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>` : '';
498
- 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 };
533
+ // the Deliveries lane (batch 13 item 4, XcalmA6Lane): one row under the axis, a list per column (o.lane draws it; none: nothing)
534
+ const laneH = o.lane ? o.lane({ W, X, rows: list, groups: G, now, phone: false, pxPct }) || '' : '';
535
+ 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}${laneH}<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 };
499
536
  }
500
537
 
501
- /** 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
502
- * on record; its milestones as diamonds, the close ones merged into one counted diamond; the next milestone ahead waits at the right edge. */
503
- function progRow(g, st, X, W, ov, o, reach, fmt, pxPct, now) {
504
- const p = g.program, sp = progSpan(g);
505
- const br = sp && sp.hi > W.from && sp.lo < W.to ? progLine(g, sp, X, now || new Date()) : '';
506
- 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>`;
538
+ /** A program's row (PgTimeline .r.pg): its tile and title. Open, its track is empty: its initiatives' rows say it (batch 13 item 4, PlmA1 is
539
+ * replaced). Folded, the roll-up of its initiatives: the line from the first start to the last end, their counted ◇s, the end date, and one dot per
540
+ * initiative off track in the name cell. A program's own milestones are the Deliveries lane's. */
541
+ function progRow(g, st, X, W, ov, o, ms, pxPct, now) {
542
+ const p = g.program, shut = o.folded(g.key), tr = shut ? rollUp(g.rows, progSpan(g), X, W, o, ms, pxPct, now || new Date()) : '';
543
+ return `<div class="tg-r tg-pg${shut ? ' closed' : ''}" data-prow="${esc(p.id)}"><div class="tg-n tg-pgn">${progName(g, st, o, shut ? offDots(g.rows, now) : '')}</div><div class="tg-p">${ov}${tr}</div></div>`;
507
544
  }
508
545
  /** A program's thin line, dotted where every member is on hold (XtiAGrill 14): the holds of the members, intersected. */
509
546
  function progLine(g, sp, X, now) {
@@ -548,10 +585,11 @@ function progMarks(g, st, X, W, days, fmt, phone, pxPct) {
548
585
  const ahead = (st.milestones || []).filter((m) => !m.done && day(m.date)).map((m) => [+X(day(m.date)).toFixed(3), m.name + ' · ' + my(day(m.date))]).sort((a, b) => a[0] - b[0]);
549
586
  return out + (ahead.length ? `<button type="button" class="tg-edge r pg" data-edge="m" data-ms="${esc(JSON.stringify(ahead))}" tabindex="-1" hidden><span></span>${SV(CHR)}</button>` : '');
550
587
  }
551
- /** A program's name cell: the tile, the title and its products (or its state), the fold; the title opens the program (bd:program). */
552
- function progName(g, st, o) {
553
- const p = g.program, n = o.productsOf ? o.productsOf(p) : 0;
554
- return `<button type="button" class="tg-pgo" data-prog="${esc(p.id)}" aria-haspopup="dialog" aria-label="${esc(p.title)}, a program. Open the program">${o.progTile ? o.progTile() : ''}<span class="tt"><b>${esc(p.title)}</b><small>${esc(n > 1 ? n + ' products' : st.state)}</small></span></button>${o.foldBtn ? o.foldBtn(g) : ''}`;
588
+ /** A program's name cell: the tile, the title, the off-track dots while folded, the fold; the title opens the program (bd:program). */
589
+ function progName(g, st, o, dots = '') {
590
+ const p = g.program, n = o.productsOf ? o.productsOf(p) : 0, meta = n > 1 ? n + ' products' : st.state;
591
+ // no "Running" under the name (batch 13 item 4: quiet rows): the state stays in its label for a reader
592
+ return `<button type="button" class="tg-pgo" data-prog="${esc(p.id)}" aria-haspopup="dialog" aria-label="${esc(p.title)}, a program${meta ? ', ' + esc(meta) : ''}. Open the program">${o.progTile ? o.progTile() : ''}<span class="tt"><b>${esc(p.title)}</b></span></button>${dots}${o.foldBtn ? o.foldBtn(g) : ''}`;
555
593
  }
556
594
  /** The program groups among the page's groups (programs first, PgTimeline), with their state; [] in By product or with no program here. */
557
595
  const progGroups = (o) => (o.groups || []).filter((g) => g.kind === 'program').map((g) => ({ g, st: o.progState ? o.progState(g.program) : { milestones: [], state: '' } }));
@@ -0,0 +1,9 @@
1
+ /* pm/cozy-aud.css — the audience tab (premium-aud.html, cozy-aud.js; batch 12 item 1, S3). The stage rules are cozy-mtg-present.css's
2
+ * .vzx-aud; these add what that window did not have: a PDF page, one document section at a time, and the quiet wait line. */
3
+ .vzx-aud .aud-pdf { width: 100%; height: 100%; border: 0; background: var(--cz-c-ffffff); }
4
+ .vzx-aud .aud-sec { width: 100%; height: 100%; overflow: auto; padding: 56px 8vw; background: var(--cz-c-ffffff); color: var(--cz-c-2a2e35); }
5
+ .vzx-aud .aud-sec .vzx-page { margin: 0 auto; font-size: 24px; }
6
+ .vzx-aud .aud-sec .vzx-page h1, .vzx-aud .aud-sec .vzx-page h2, .vzx-aud .aud-sec .vzx-page h3 { font-size: 32px; }
7
+ .vzx-aud .aud-wait { font-size: 15px; color: var(--cz-c-9aa1ab); }
8
+ .vzx-aud .aud-img { max-width: 100%; max-height: 100%; display: block; }
9
+ body.cz.vzx-audw { min-height: 100vh; background: var(--cz-c-17191c); } /* the cozy page ground is light; the audience tab is dark to its edge */
@@ -0,0 +1,80 @@
1
+ /* pm/cozy-aud.js — the audience tab (premium-aud.html; batch 12 item 1, S3, canvas XrtA9Present).
2
+ *
3
+ * The call sees this tab: the PM shares it in Meet, Zoom or Teams (in the room, drags it to the projector). It shows the stage only, with
4
+ * a quiet line under it (the meeting, then "3 / 6"). The recording tab's presenter (cozy-rec-present.js) says what to show over
5
+ * BroadcastChannel('pmos-present'):
6
+ * presenter → here { t: 'show', show: { mat: { id, kind, title, src, ws, url, host }, at, pages, meeting } } draw it
7
+ * { t: 'ping' } say hello again
8
+ * { t: 'off' } presenting ended: close
9
+ * here → presenter { t: 'hello' } on load and on each ping; { t: 'bye' } when the tab goes
10
+ * It reads the material itself (a PMOS deck or document from GET /api/doc, an uploaded file from GET /api/meeting-material/file), so the
11
+ * channel carries only what to show and where. A live page (a Google Doc, Slides or Sheet, a website) is opened in this tab itself, and the
12
+ * presenter then cannot reach it until the PM presents PMOS material again. It has no controls and writes nothing.
13
+ *
14
+ * audFoot(show) → { left, right } (pure) drawShow(doc, show, cache) → draws (used by the suite through the page) */
15
+ import * as D from './premium-deck.js';
16
+ import * as MP from './premium-mtg-present.js';
17
+ import { toDom } from './cozy-md.js';
18
+
19
+ export const CHANNEL = 'pmos-present';
20
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
21
+
22
+ /** The quiet line: the meeting on the left, where it is on the right ("3 / 6", "page 3"). */
23
+ export function audFoot(show) {
24
+ const m = (show && show.mat) || {}, at = (show && show.at) || 0, n = (show && show.pages) || 0;
25
+ const steps = m.kind === 'slides' || m.kind === 'doc' || m.kind === 'pdf';
26
+ return { left: (show && show.meeting) || '', right: !steps ? m.title || '' : n ? (at + 1) + ' / ' + n : 'page ' + (at + 1) };
27
+ }
28
+
29
+ const cache = new Map();
30
+ async function read(m) {
31
+ const k = m.kind + '|' + (m.ws || '') + '|' + m.src;
32
+ if (!cache.has(k)) cache.set(k, MP.readDoc(m.ws, m.src).then((t) => (m.kind === 'slides' ? { deck: D.parseDeck(t, m.title) } : { doc: MP.docSections(t, m.title) })).catch((x) => ({ error: String((x && x.message) || x) })));
33
+ return cache.get(k);
34
+ }
35
+
36
+ let slideHtml = null, cur = null, seq = 0;
37
+ const host = () => document.getElementById('aud');
38
+ async function draw(show) {
39
+ cur = show; const my = ++seq;
40
+ const m = (show && show.mat) || null, el = host(); if (!el) return;
41
+ document.title = m ? m.title + ' · audience' : 'Audience · PMOS';
42
+ const f = audFoot(show), ft = document.getElementById('audFt');
43
+ if (ft) ft.innerHTML = m ? `<span>${esc(f.left)}</span><span>${esc(f.right)}</span>` : '';
44
+ el.dataset.kind = m ? m.kind : '';
45
+ if (!m) { el.innerHTML = '<p class="aud-wait">Waiting for the presenter.</p>'; return; }
46
+ if (m.kind === 'live') { if (m.url && /^https:/.test(m.url)) location.href = m.url; return; }
47
+ if (m.kind === 'image') { el.innerHTML = `<img class="aud-img" alt="${esc(m.title)}" src="${esc(m.url)}">`; return; }
48
+ if (m.kind === 'pdf') { el.innerHTML = `<iframe class="aud-pdf" title="${esc(m.title)}" src="${esc(m.url + '#page=' + (show.at + 1) + '&toolbar=0&navpanes=0&view=Fit')}"></iframe>`; return; }
49
+ if (m.kind !== 'slides' && m.kind !== 'doc') { el.innerHTML = ''; return; }
50
+ const L = await read(m);
51
+ if (my !== seq) return;
52
+ if (L.error) { el.innerHTML = ''; return; }
53
+ if (L.deck) {
54
+ if (!slideHtml) ({ slideHtml } = await import('./premium-vw-slides.js'));
55
+ if (my !== seq) return;
56
+ const s = L.deck.slides[Math.min(show.at, L.deck.slides.length - 1)];
57
+ el.innerHTML = '<div class="vzx-slot"><div class="vzx-box"></div></div>';
58
+ const b = el.querySelector('.vzx-box');
59
+ if (s) { b.innerHTML = slideHtml(s, L.deck.theme, m.ws, false); b.style.setProperty('--bd-k', String(Math.max(0.05, Math.min(innerWidth / D.W, (innerHeight - 48) / D.H)))); MP.place(b); }
60
+ return;
61
+ }
62
+ const sec = L.doc.sections[Math.min(show.at, L.doc.sections.length - 1)];
63
+ el.innerHTML = '<div class="aud-sec"></div>';
64
+ if (sec) { const page = document.createElement('div'); page.className = 'vzx-page'; page.append(...toDom(sec.blocks, document)); el.firstChild.append(page); }
65
+ }
66
+
67
+ if (typeof BroadcastChannel === 'function' && typeof document !== 'undefined' && document.getElementById('aud')) {
68
+ const ch = new BroadcastChannel(CHANNEL);
69
+ ch.onmessage = (e) => {
70
+ const d = e.data || {};
71
+ if (d.t === 'show' && d.show) draw(d.show);
72
+ else if (d.t === 'ping') ch.postMessage({ t: 'hello' });
73
+ else if (d.t === 'off') { draw(null); try { window.close(); } catch { /* a tab the PM opened stays, waiting */ } }
74
+ };
75
+ addEventListener('pagehide', () => { try { ch.postMessage({ t: 'bye' }); } catch { /* closed */ } });
76
+ addEventListener('resize', () => { if (cur) draw(cur); });
77
+ draw(null);
78
+ ch.postMessage({ t: 'hello' });
79
+ window.__pmosAud = { cur: () => cur };
80
+ }