create-pmos 0.536.0 → 0.538.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 (103) hide show
  1. package/package.json +81 -33
  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/board-columns-test.js +11 -10
  8. package/workspace/board-programs-test.js +27 -24
  9. package/workspace/board-publish-ui-test.js +19 -15
  10. package/workspace/board-shared-ui-test.js +16 -13
  11. package/workspace/board-workflows-test.js +26 -32
  12. package/workspace/briefing-premium-board-test.js +70 -50
  13. package/workspace/briefing-premium-insights-test.js +24 -31
  14. package/workspace/briefing-premium-metrics-test.js +2 -2
  15. package/workspace/calm-timeline-test.js +1 -1
  16. package/workspace/changelog.json +80 -0
  17. package/workspace/ev-everywhere-test.js +4 -5
  18. package/workspace/fixtures/board-premium-facts.js +1 -1
  19. package/workspace/fixtures/board-workflows-facts.js +7 -1
  20. package/workspace/fixtures/initiative-premium-facts.js +1 -1
  21. package/workspace/fixtures/insights-premium-facts.js +6 -6
  22. package/workspace/fixtures/program-ascent.js +1 -1
  23. package/workspace/guide/adler.md +2 -2
  24. package/workspace/guide/agent-capabilities.md +38 -6
  25. package/workspace/guide/board.md +20 -2
  26. package/workspace/guide/claude-proposes.md +1 -1
  27. package/workspace/guide/home.md +2 -2
  28. package/workspace/guide/index.md +3 -3
  29. package/workspace/guide/intelligence-okr-goals.md +18 -7
  30. package/workspace/guide/lifecycle.md +2 -2
  31. package/workspace/guide/programs.md +2 -2
  32. package/workspace/guide/reports-needs-you.md +5 -5
  33. package/workspace/guide/settings.md +14 -11
  34. package/workspace/guide/workflows.md +3 -3
  35. package/workspace/guide/your-impact.md +1 -1
  36. package/workspace/lib/agent-team.js +262 -0
  37. package/workspace/lib/ai-cli.js +36 -4
  38. package/workspace/lib/bg-queue.js +9 -4
  39. package/workspace/lib/board-premium.js +6 -3
  40. package/workspace/lib/goal-source.js +77 -0
  41. package/workspace/lib/grill-runs.js +6 -3
  42. package/workspace/lib/headless.js +36 -4
  43. package/workspace/lib/idle-lab-engine.js +7 -6
  44. package/workspace/lib/initiative-premium.js +6 -3
  45. package/workspace/lib/insights-premium.js +1 -1
  46. package/workspace/lib/job-graph.js +191 -0
  47. package/workspace/lib/okr-goals.js +3 -0
  48. package/workspace/lib/orchestrator-keeprate.js +108 -7
  49. package/workspace/lib/pmos-verbs.js +3 -0
  50. package/workspace/lib/proposal-runs.js +8 -5
  51. package/workspace/lib/proposals.js +32 -2
  52. package/workspace/lib/report-slots.js +14 -10
  53. package/workspace/lib/routes-boards.js +2 -2
  54. package/workspace/lib/routes-insights-premium.js +11 -4
  55. package/workspace/lib/routes-premium-dashboards.js +20 -6
  56. package/workspace/lib/routes-proposals.js +10 -5
  57. package/workspace/lib/routes-your-move.js +6 -7
  58. package/workspace/lib/status-proof.js +45 -0
  59. package/workspace/lib/status-signal.js +4 -2
  60. package/workspace/lib/task-links.js +3 -1
  61. package/workspace/lib/team-cli.js +164 -0
  62. package/workspace/lib/team-runs.js +244 -0
  63. package/workspace/lib/verify-runs.js +112 -0
  64. package/workspace/okr-goals-ui-test.js +10 -13
  65. package/workspace/package-lock.json +2 -2
  66. package/workspace/package.json +1 -1
  67. package/workspace/premium-vw-backlog-test.js +2 -2
  68. package/workspace/premium-vw-jira-test.js +2 -2
  69. package/workspace/public/pm/bd-acts.js +30 -45
  70. package/workspace/public/pm/bd-ini-panel.js +38 -27
  71. package/workspace/public/pm/bd-publish.js +1 -1
  72. package/workspace/public/pm/bd-span.js +2 -1
  73. package/workspace/public/pm/bd-views.js +7 -5
  74. package/workspace/public/pm/bd-wf.js +5 -28
  75. package/workspace/public/pm/c3-ini-ui.js +9 -7
  76. package/workspace/public/pm/cozy-board.css +75 -31
  77. package/workspace/public/pm/cozy-insights.css +18 -0
  78. package/workspace/public/pm/cozy-nav.js +2 -2
  79. package/workspace/public/pm/cozy-search.js +29 -7
  80. package/workspace/public/pm/cozy-settings.js +39 -20
  81. package/workspace/public/pm/home-data.js +3 -1
  82. package/workspace/public/pm/home-ini-model.js +15 -1
  83. package/workspace/public/pm/home-ini.js +9 -3
  84. package/workspace/public/pm/ini-tail.js +61 -0
  85. package/workspace/public/pm/ini-view-model.js +10 -7
  86. package/workspace/public/pm/premium-board.js +119 -119
  87. package/workspace/public/pm/premium-insights.js +95 -112
  88. package/workspace/public/pm/premium-report-intel.js +3 -2
  89. package/workspace/public/pm/readonly.js +4 -3
  90. package/workspace/public/pm/stage-chip.js +2 -1
  91. package/workspace/public/pm/status-proof.js +43 -0
  92. package/workspace/public/premium-board.html +14 -35
  93. package/workspace/public/premium-intelligence.html +7 -9
  94. package/workspace/server.js +35 -1
  95. package/workspace/sort-order-test.js +10 -8
  96. package/workspace/test-files.json +4 -2
  97. package/workspace/test-lists/agent-team.json +9 -0
  98. package/workspace/test-lists/job-graph.json +11 -0
  99. package/workspace/test-lists/status-proof.json +5 -0
  100. package/workspace/workflows-setup-test.js +3 -2
  101. package/workspace/public/premium-chat.html +0 -14
  102. package/workspace/public/premium-initiative.html +0 -15
  103. package/workspace/public/premium-work.html +0 -14
@@ -44,7 +44,7 @@ import * as PP from './bd-prog-panel.js';
44
44
  import * as PO from './prog-order.js';
45
45
  import * as SO from './sort-order.js';
46
46
  import { faceOr } from './cozy-adler.js'; // Adler on the Jira chip (batch 17 item 4-A, canvas AdM2 Jira freshness) // the sort button and ONE order with Home and the Timeline (batch 14 item 8, canvas SoADesk, SoABoardPhone)
47
- import { sortTop, sortInis, prodKey } from './order-model.js';
47
+ import { sortTop, sortInis, prodKey, MODES as SORT_MODES } from './order-model.js';
48
48
  import * as SM from './split-merge.js'; // split one initiative in two, or merge two: Claude suggests, the PM approves (batch 11 item 14)
49
49
  import * as PM from './prog-move.js'; // move an initiative out of its program, or to another (canvas LpA1More, LpA2Other)
50
50
  import * as Pop from './bd-pop.js'; // the order of a program's initiatives: the grip and Claude's order from the dates (canvas RoADrag, RoASuggest)
@@ -90,7 +90,7 @@ let PKP = null, picked = false; // the saved pick (GET /api/briefing-premium/p
90
90
  let byProduct = store.get(GROUPING_KEY) === 'product'; // the grouping: programs first (default) or By product (PgBoardProduct)
91
91
  let DM = {}; // the documents' history (GET /api/board-docs): { [path]: { changed, by, log } }
92
92
  let peek = null; // what the Viewer shows for the Board: { kind: 'ini', key } an initiative or its ticket, { kind: 'acts' } an acts panel
93
- mountNav('board');
93
+ mountNav('board', document, { scope: () => Acts.findScope() }); // ⌘K and Find open Search scoped to this Board first (UI grill U2)
94
94
  quietPlace('board', document.getElementById('stage'));
95
95
  mountLivePill();
96
96
  /* The page is the first panel (panels on Board and Intelligence, canvas BiB1Split): a Viewer opens beside it, behind the divider. A row's
@@ -111,7 +111,9 @@ const I = {
111
111
  flag: 'M5 21V4M5 4h11l-2 4 2 4H5', note: 'M4 5h16v11h-9l-5 4v-4H4z', spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z',
112
112
  doc: 'M6 3h9l4 4v14H6zM14 3v5h5', 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', chev: 'M7 10l5 5 5-5', chevUp: 'M7 14l5-5 5 5',
113
113
  move: 'M4 12h12M12 6l6 6-6 6M20 5v14', hold: 'M9 5v14M15 5v14', archive: 'M4 5h16v4H4zM6 9v10h12V9M10 13h4',
114
- track: 'M3 5h18v4H3zM3 11h18v4H3zM3 17h12v3H3z', time: 'M4 6h9M8 12h11M6 18h7', info: 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18M12 11v5M12 8h.01',
114
+ track: 'M3 5h18v4H3zM3 11h18v4H3zM3 17h12v3H3z', time: 'M4 6h9M8 12h11M6 18h7', list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01',
115
+ stages: 'M4 4h4v16H4zM10 4h4v10h-4zM16 4h4v13h-4z', ok: 'M5 12.5l4.5 4.5L19 7', group: 'M4 7h16M4 12h10M4 17h5',
116
+ people: 'M9 5a3 3 0 1 0 0 6a3 3 0 1 0 0-6M3 20c0-3.3 2.7-5.5 6-5.5s6 2.2 6 5.5M16 5.2a3 3 0 0 1 0 5.6M18 14.8c1.8.7 3 2.3 3 5.2', info: 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18M12 11v5M12 8h.01',
115
117
  };
116
118
  const plural = (n, a, b) => (n === 1 ? a : b);
117
119
  const ago = (iso, short) => { const t = Date.parse(iso || ''); if (!t) return ''; const m = Math.max(0, Math.round((Date.now() - t) / 60000)); return m < 1 ? 'just now' : m < 60 ? m + ' min' + (short ? '' : ' ago') : m < 60 * 36 ? Math.round(m / 60) + ' h' + (short ? '' : ' ago') : Math.round(m / 1440) + ' days' + (short ? '' : ' ago'); };
@@ -248,7 +250,8 @@ function drawHead() {
248
250
  // PMOS-self: new work starts at the pmos-router skill. All products: New asks which product the initiative is for
249
251
  $('#newIni').hidden = ALL ? (M.board.products || []).every((p) => p.self) : !!M.board.self;
250
252
  if (!window.PMOS_READONLY && !SH_LOADED) { SH_LOADED = true; import('./bd-shared.js').then((S) => S.loadCount(setSharedCount)); }
251
- { const pb = $('#bdPublish'); const was = pb.hidden; pb.hidden = ALL || !M.board.ws || !!window.PMOS_READONLY; if (was && !pb.hidden) import('./bd-publish.js').then((P) => P.refreshCount(pb)); }
253
+ // Publish a read-only copy is a row of ⋯ (UI grill U2); one board at a time, so not on the All products page
254
+ { const pb = $('#bdPublish'); if (pb) { const was = pb.hidden; pb.hidden = ALL || !M.board.ws || !!window.PMOS_READONLY; if (was && !pb.hidden) import('./bd-publish.js').then((P) => P.refreshCount(pb)); } }
252
255
  setPageGaps(((M.header && M.header.missing) || []).length);
253
256
  }
254
257
  let jiraReading = false; // a press is reading Jira again: the chip's Adler wears his glasses until the next read of the Board lands
@@ -260,9 +263,12 @@ const sprintFilterOn = () => curView() !== 'time' || span === 'sprint';
260
263
  /** What needs a look (batch 24 item 7, canvas BbB): new asks, late, at risk, blocked and idle are ONE pill of dots and numbers. A press opens the
261
264
  * rows; a row opens what its chip opened (the asks, a metric's trend, whose "Show only" filters); a filter that is on turns off at once.
262
265
  * A row that is zero is not listed, and the pill is not drawn when every row is zero (zero is silence). */
263
- function needHtml(C, open, phone) {
266
+ function needHtml(C0, open, phone) {
267
+ const C = { ...C0, you: youRows().length };
264
268
  const rows = [];
265
269
  if (C.asks) rows.push({ k: 'asks', dot: 'you m-info', n: C.asks, name: plural(C.asks, 'New ask', 'New asks'), say: C.asks + ' new ' + plural(C.asks, 'ask', 'asks') });
270
+ // what waited behind the Board's bell (UI grill U2 took the bell off): the initiatives whose next step is yours; a press shows only them
271
+ if (C.you) rows.push({ k: 'you', dot: 'you', n: C.you, name: 'Waits on you', say: C.you + ' ' + plural(C.you, 'waits', 'wait') + ' on you' });
266
272
  for (const [k, tone, mo, name] of CHIP_F) if (C[k]) rows.push({ k, dot: tone + (mo ? ' ' + mo : ''), n: C[k], name, say: C[k] + ' ' + name.toLowerCase() });
267
273
  // workspace grill W2: the open initiatives nothing read says anything about. One ✦ reads Jira for them; they are never counted as on track
268
274
  const nosig = C.none ? `<button type="button" class="bd-nr" id="chNoSig"><i class="cz-dot q"></i>✦ Read Jira now for the ${C.none} with no signal</button>` : '';
@@ -277,31 +283,58 @@ function needHtml(C, open, phone) {
277
283
  + parts.join(phone ? '' : '<span class="bd-nsep" aria-hidden="true">·</span>') + SV(I.chev) + '</button>'
278
284
  + `<span class="bd-grpm bd-needm" id="bdNeedMenu" role="group" aria-label="Needs a look"${open ? '' : ' hidden'}><span class="bd-mlbl">Needs a look</span>${rows.map(item).join('')}${nosig}</span></span>`;
279
285
  }
286
+ /** The initiatives whose next step is yours (the trail's "waits on you"): what the Board's bell listed before UI grill U2. */
287
+ const youRows = () => ((M && M.initiatives && M.initiatives.list.rows) || []).filter((r) => !r.ended && r.track && r.track.you);
280
288
  const menuOpen = (id) => !!$('#' + id) && !$('#' + id).hidden;
281
289
  function drawChips() {
282
290
  const J = M.jira || {}, C = M.chips || {}, sp = J.sprint, rel = J.release, phone = small();
283
291
  const jira = J.readAt ? 'Jira · read ' + ago(J.readAt) : 'Jira · not read';
284
292
  const sprint = [sp ? sp.name : null, rel ? rel.name + ' ships ' + rel.at.replace(/^(\d+) (\w+)$/, '$2 $1') : null].filter(Boolean).join(' · ') || ''; // no sprint and no release on record: no chip (workspace grill W4, zero is silence)
285
- const thisSprint = sp && (view === 'track' || view === 'time' || phone) && sprintFilterOn() ? `<button type="button" class="bd-chip${F.chips.has('sprint') ? ' on' : ''}" data-f="sprint" aria-pressed="${F.chips.has('sprint')}" title="${F.chips.has('sprint') ? 'Shows only the initiatives with work in ' + esc(sp.name) + '. Press to show all.' : 'Press to show only the initiatives with work in ' + esc(sp.name) + '.'}">${esc(sp.name)} only</button>` : ''; // it named no sprint and read like a heading (testing fixes)
286
- // All products (PgBoard): one Jira control with the oldest read of any product, and every product's new asks; the sprint stays per product
287
293
  // AdM2: Adler's S face carries the read's mood: calm when Jira was read within a day and a half, honest when it was not, glasses on while
288
- // a press reads it again. Settings > Adler > Off keeps the refresh icon. Batch 24 item 7 (BbB): the face alone, an amber pip when the read is
289
- // old, the words on hover (and for a screen reader).
294
+ // a press reads it again. UI grill U2: the face left the toolbar; the read and its ↻ are a row of the pill's (i) on a desktop and of the
295
+ // tune sheet on a phone, and stay in Settings › Connectors. All products: the oldest read of any product.
290
296
  const jMood = jiraReading ? 'thinking' : J.readAt && Date.now() - Date.parse(J.readAt) < 36 * 3600000 ? 'handled' : 'honest';
291
- const jSay = jira + '. ' + (ALL ? 'Press to read Jira again for every product' : 'Press to read Jira again');
292
- const jiraChip = `<button type="button" class="bd-chip bd-jf" id="chJira" title="${esc(jSay)}" aria-label="${esc(jSay)}">${faceOr(jMood, 's', SV(I.refresh), { label: false })}${jMood === 'honest' ? '<i class="bd-pip" aria-hidden="true"></i>' : ''}<span class="vh">${esc(jira)}</span></button>`;
293
297
  const need = needHtml(C, menuOpen('bdNeedMenu'), phone);
294
- if (phone) {
295
- $('#bdChipset').innerHTML = thisSprint + jiraChip + need + `<button type="button" class="bd-chip" id="chShared">Shared${SH_N ? ' ' + SH_N : ''}</button>`;
296
- return;
297
- }
298
- // the timeline's legend (PgTimeline) goes behind an info icon at the end of the row (BbB), with a program milestone only where a program is drawn
299
- // and "On hold" only where a hold is drawn (feedback batch 9 item 8: zero is silence)
298
+ // the tune button's dot on a phone (BhA): the Jira read is old, or a filter is on (a desktop says the filters in the Showing bar)
299
+ { const fb = $('#bdFilter'), pip = fb.querySelector('.bd-pip'), say = 'Group, sort and filter';
300
+ if (pip) pip.hidden = !(phone && (jMood === 'honest' || filtered())); fb.setAttribute('aria-label', say); fb.title = say; }
301
+ TUNE = { jira, jMood };
302
+ if (phone) { $('#bdChipset').innerHTML = need; return; }
303
+ // the pill's (i) (UI grill U2): the timeline's legend (PgTimeline; a program milestone only where a program is drawn and "On hold" only where a
304
+ // hold is drawn, feedback batch 9 item 8), the sprints and releases the calendar icon opened (BdSprint), and the Jira read with its ↻
300
305
  const lo = menuOpen('bdLgdMenu');
301
- const lgd = view === 'time' && span !== 'sprint' ? `<span class="bd-grpw2 bd-lgdw"><button type="button" class="bd-ib bd-lgdb" id="bdLgdBtn" aria-haspopup="true" aria-expanded="${lo}" aria-controls="bdLgdMenu" aria-label="What the bars mean" title="What the bars mean">${SV(I.info)}</button>`
302
- + `<span class="bd-grpm bd-lgdm" id="bdLgdMenu"${lo ? '' : ' hidden'}><span class="bd-mlbl">What the bars mean</span>${legendHtml(!byProduct && !!groups(visible()), hasHold(visible()), { ...planKeys(visible()), ...gapKeys(visible()), range: visible().some((r) => fcRange(r)) })}</span></span>` : '';
303
- $('#bdChipset').innerHTML = (ALL || !sprint ? '' : `<button type="button" class="bd-chip" id="chSprint" aria-haspopup="dialog">${SV(I.cal)}<span>${esc(sprint)}</span></button>`)
304
- + thisSprint + '<span class="bd-sp"></span>' + need + lgd + jiraChip;
306
+ const lgd = view === 'time' && span !== 'sprint' ? `<span class="bd-mlbl">What the bars mean</span>${legendHtml(!byProduct && !!groups(visible()), hasHold(visible()), { ...planKeys(visible()), ...gapKeys(visible()), range: visible().some((r) => fcRange(r)) })}` : '';
307
+ const RO = !!window.PMOS_READONLY; // a published copy: the legend only (pm/readonly.js); the sprints dialog and the Jira read are the publisher's
308
+ const spr = RO || ALL || !sprint ? '' : `<button type="button" class="bd-lgdrow" id="chSprint" aria-haspopup="dialog" aria-label="${esc(sprint)}. Sprints and releases">${SV(I.cal)}<span>${esc(sprint)}</span>${SV(I.chev)}</button>`;
309
+ const jSay = jira + '. ' + (ALL ? 'Read Jira again for every product' : 'Read Jira again');
310
+ const jr = RO ? '' : `<div class="bd-lgdrow bd-tjr">${faceOr(jMood, 's', '', { label: false })}<span>${esc(jira.replace(/^Jira · /, 'Jira '))}.${jMood === 'honest' ? ' Read it again?' : ''}</span>`
311
+ + `<button type="button" class="bd-ib" id="chJira" aria-label="${esc(jSay)}" title="${esc(jSay)}"${jiraReading ? ' disabled' : ''}>${SV(I.refresh)}</button></div>`;
312
+ const say2 = view === 'time' && span !== 'sprint' ? 'What the bars mean, sprints and the Jira read' : 'Sprints and the Jira read';
313
+ const info = !lgd && !spr && !jr ? '' : `<span class="bd-grpw2 bd-lgdw"><button type="button" class="bd-ib bd-lgdb" id="bdLgdBtn" aria-haspopup="true" aria-expanded="${lo}" aria-controls="bdLgdMenu" aria-label="${say2}" title="${say2}">${SV(I.info)}${jMood === 'honest' ? '<i class="bd-pip" aria-hidden="true"></i>' : ''}</button>`
314
+ + `<span class="bd-grpm bd-lgdm" id="bdLgdMenu"${lo ? '' : ' hidden'}>${lgd}${spr || jr ? '<span class="bd-mlbl">This board</span>' : ''}${spr}${jr}</span></span>`;
315
+ $('#bdChipset').innerHTML = need + info;
316
+ }
317
+ /** What the tune sheet (#bdFilter: BhA on a phone, UI grill U2 on a desktop too) adds to Filter: Group and Sort first; a phone has the Jira read
318
+ * last (a desktop has it in the pill's (i)). */
319
+ let TUNE = { jira: '', jMood: 'honest' };
320
+ function tuneParts() {
321
+ const say = TUNE.jira.replace(/^Jira · /, 'Jira ');
322
+ const now = SO.layout().sort;
323
+ return { top: `<p class="bd-mlbl">Sort</p><div class="bd-fg" role="radiogroup" aria-label="Sort">${SORT_MODES.map(([k, n]) => `<button type="button" class="bd-chip${k === now ? ' on' : ''}" role="radio" aria-checked="${k === now}" data-so-pick="${esc(k)}">${esc(n)}</button>`).join('')}</div>`,
324
+ bottom: !small() ? '' : `<div class="bd-tjr">${faceOr(jiraReading ? 'thinking' : TUNE.jMood, 's', '', { label: false })}<span>${esc(say)}.${TUNE.jMood === 'honest' ? ' Read it again?' : ''}</span>`
325
+ + `<button type="button" class="bd-chip bd-jread" data-jread aria-label="Read Jira again" title="Read Jira again"${jiraReading ? ' disabled' : ''}>${SV(I.refresh)}</button></div>` };
326
+ }
327
+ /** A sort picked in the tune sheet: saved as the sort menu saves it (look.order, shared with Home), then read back (pm/sort-order.js). */
328
+ async function sortPick(k) {
329
+ const L = SO.layout(); if (k === L.sort) return;
330
+ const r = await pmPost('/api/settings', { key: 'look.order', value: { ...L, sort: k } }).catch(() => null);
331
+ if (!r || !r.ok) { say((r && r.error) || 'The order was not saved.'); return; }
332
+ await SO.load(); if (M) drawInit();
333
+ }
334
+ /** "<sprint> only" (on by default when the board has a sprint): Filter's first sprint chip now that the chip row is gone (BhA). */
335
+ function sprintOnly() {
336
+ const sp = M && M.jira && M.jira.sprint;
337
+ return sp && (view === 'track' || view === 'time' || small()) && sprintFilterOn() ? { name: sp.name, on: F.chips.has('sprint') } : null;
305
338
  }
306
339
  const closeMenu = (id, btn) => { const m = $('#' + id); if (m && !m.hidden) { m.hidden = true; const b = $('#' + btn); if (b) b.setAttribute('aria-expanded', 'false'); return true; } return false; };
307
340
  const toggleMenu = (id, btn) => { const m = $('#' + id), o = m.hidden; m.hidden = !o; $('#' + btn).setAttribute('aria-expanded', String(o)); if (o) { const f = m.querySelector('button'); if (f) f.focus(); } };
@@ -313,15 +346,14 @@ $('#bdChipset').addEventListener('click', (e) => {
313
346
  const k = f.dataset.f, inNeed = !!f.closest('#bdNeedMenu');
314
347
  if (inNeed) closeMenu('bdNeedMenu', 'chNeed');
315
348
  // a metric row opens its trend (BdPanel), whose "Show only" filters; a row that is on turns off at once
316
- if (k !== 'sprint' && !F.chips.has(k)) { Acts.open.trend(k, inNeed ? $('#chNeed') : f); return; }
349
+ if (k !== 'sprint' && k !== 'you' && !F.chips.has(k)) { Acts.open.trend(k, inNeed ? $('#chNeed') : f); return; }
317
350
  if (F.chips.has(k)) F.chips.delete(k); else F.chips.add(k); drawChips(); drawInit(); if (inNeed) { const b = $('#chNeed') || $('#bdFilter'); b.focus(); } return;
318
351
  }
319
352
  const b = e.target.closest('button'); if (!b) return;
320
- if (b.id === 'chJira') refreshJira(b);
353
+ if (b.id === 'chSprint') { closeMenu('bdLgdMenu', 'bdLgdBtn'); Acts.open.sprint($('#bdLgdBtn') || b); }
354
+ else if (b.id === 'chJira') refreshJira(b);
321
355
  else if (b.id === 'chNoSig') { closeMenu('bdNeedMenu', 'chNeed'); refreshJira($('#chJira') || b); }
322
- else if (b.id === 'chSprint') Acts.open.sprint(b);
323
356
  else if (b.id === 'chAsks') { closeMenu('bdNeedMenu', 'chNeed'); Acts.open.asks($('#chNeed')); }
324
- else if (b.id === 'chShared') setTab('shared');
325
357
  });
326
358
  $('#bdChipset').addEventListener('keydown', (e) => {
327
359
  if (e.key !== 'Escape') return;
@@ -371,15 +403,14 @@ function inSprint(r, sp) {
371
403
  }
372
404
  function visible() {
373
405
  const sp = M.jira && M.jira.sprint;
374
- const W = wfState(), only = WF.narrowed(W.list) ? W.cur.id : null;
375
406
  return M.initiatives.list.rows.filter((r) => {
376
407
  const t = r.track || {};
377
408
  if (r.ended) return false; // Won't do and Archived are their own strips (pm/bd-wf.js endedRows)
378
- if (only && WF.wfOf(r).id !== only) return false;
379
409
  if (F.chips.has('late') && !r.late) return false;
380
410
  if (F.chips.has('risk') && r.status !== 'at risk') return false;
381
411
  if (F.chips.has('blocked') && !t.blocked) return false;
382
412
  if (F.chips.has('idle') && t.idle == null) return false;
413
+ if (F.chips.has('you') && !t.you) return false;
383
414
  if (F.chips.has('sprint') && sp && (view === 'track' || view === 'time' || small()) && sprintFilterOn() && !inSprint(r, sp)) return false;
384
415
  if (F.q && !String(r.title || '').toLowerCase().includes(F.q.toLowerCase())) return false;
385
416
  if (F.owners.size && !F.owners.has(r.owner || 'No owner')) return false;
@@ -388,19 +419,16 @@ function visible() {
388
419
  return true;
389
420
  });
390
421
  }
391
- const filtered = () => [...F.chips].some((k) => k !== 'sprint') || !!F.q || F.owners.size > 0 || F.cats.size > 0 || F.sprints.size > 0 || WF.narrowed(wfState().list);
392
- const clearFilters = () => { F.chips.forEach((k) => { if (k !== 'sprint') F.chips.delete(k); }); F.q = ''; F.owners.clear(); F.cats.clear(); F.sprints.clear(); WF.setPick(''); };
393
- /** The workflows on the board, the picked one (null for All) and the rows that ended (pm/bd-wf.js). */
422
+ const filtered = () => [...F.chips].some((k) => k !== 'sprint') || !!F.q || F.owners.size > 0 || F.cats.size > 0 || F.sprints.size > 0;
423
+ const clearFilters = () => { F.chips.forEach((k) => { if (k !== 'sprint') F.chips.delete(k); }); F.q = ''; F.owners.clear(); F.cats.clear(); F.sprints.clear(); };
424
+ /** The workflows on the board, the one whose stages are drawn (the only one, else null for All) and the rows that ended (pm/bd-wf.js). */
394
425
  const wfState = () => { const list = WF.workflowsOf(M); return { list, cur: WF.picked(list), ended: WF.endedRows(M) }; };
395
426
  /** The "Showing" bar (BdFilter): what Filter has on, each with its own ×, Clear all, and how many initiatives show. */
396
427
  function showingHtml(n) {
397
428
  const G = [['owners', 'Owner'], ['cats', 'Category'], ['sprints', 'Sprint']].filter(([k]) => F[k].size);
398
- // the picked workflow shows here only where no chip row says it already: the desktop List (WfAElse)
399
- const W = wfState(), wfOn = WF.narrowed(W.list) && view === 'list' && !small();
400
- if (!G.length && !F.q && !wfOn) return '';
429
+ if (!G.length && !F.q) return '';
401
430
  const word = (k, v) => (k === 'cats' ? WF.catLabel(v) : v);
402
- const chips = (wfOn ? `<button type="button" class="bd-chip on" data-unf="wf" aria-label="Remove Workflow: ${esc(W.cur.name)}">Workflow: ${esc(W.cur.name)}${SV(I.x)}</button>` : '')
403
- + G.map(([k, n2]) => `<button type="button" class="bd-chip on" data-unf="${k}" aria-label="Remove ${n2}: ${esc([...F[k]].map((v) => word(k, v)).join(', '))}">${esc(n2)}: ${esc([...F[k]].map((v) => word(k, v)).join(', '))}${SV(I.x)}</button>`).join('')
431
+ const chips = G.map(([k, n2]) => `<button type="button" class="bd-chip on" data-unf="${k}" aria-label="Remove ${n2}: ${esc([...F[k]].map((v) => word(k, v)).join(', '))}">${esc(n2)}: ${esc([...F[k]].map((v) => word(k, v)).join(', '))}${SV(I.x)}</button>`).join('')
404
432
  + (F.q ? `<button type="button" class="bd-chip on" data-unf="q" aria-label="Remove the search">“${esc(F.q)}”${SV(I.x)}</button>` : '');
405
433
  return `<div class="bd-showing" role="status"><span class="bd-mlbl">Showing</span>${chips}<button type="button" class="dlink" id="fClear">Clear all</button><span class="bd-sp"></span><span class="bd-amut">${n} of ${M.initiatives.list.rows.length} initiatives</span></div>`;
406
434
  }
@@ -470,7 +498,7 @@ function trackRow(r, cls = '', po = false) {
470
498
  }).join('');
471
499
  const many = TK.mode === 'cats'; // All: each row names its workflow with its icon (WfATrack)
472
500
  return `<div class="bt-r bt-l${cls}${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}"${po ? ` data-po-id="${esc(r.id)}"` : ''}>${po ? PO.gripHtml(r.title) : ''}`
473
- + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
501
+ + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"${s.from ? ` title="${esc(s.from)}"` : ''}><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
474
502
  + `<div class="${cellsCls()}" role="presentation"${cellsStyle()}>${cells}</div>`
475
503
  + `<div class="bt-dl" role="cell">${nextHtml(r, { self: M.board.self, icon: !small() })}</div></div>`; // the Next cell (XocA): what finishes the step next
476
504
  }
@@ -489,7 +517,7 @@ function drawTrack(L) {
489
517
  const n = M.initiatives.open || M.initiatives.list.rows.length;
490
518
  // the header: the eight steps (their help opens from them), the picked workflow's stages, or with All the three categories (WfATrack)
491
519
  const hcell = (s) => (TK.mode === 'pf' ? `<div role="columnheader" class="${s.ms ? 'msh' : ''}" data-steps title="What finishes each step" aria-haspopup="dialog" tabindex="0">` : `<div role="columnheader" class="${s.ms ? 'msh' : ''}">`)
492
- + `<span class="bt-hl">${s.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(s.label)}</span><span>${s.count}</span></div>`;
520
+ + `<span class="bt-hl">${s.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(s.label)}</span>${s.count ? `<span>${s.count}</span>` : ''}</div>`; // zero is silence (UI grill U2): an empty step names no count
493
521
  const hcells = TK.mode === 'cats' ? WF.CATS.map(([k, label]) => hcell({ label, count: V.catCount(L, k) })) : S.map(hcell);
494
522
  const head = `<div class="bt-r bt-h" role="row"><div class="bt-nmh" role="columnheader">Initiative <span>${n}</span></div><div class="${cellsCls()}" role="presentation"${cellsStyle()}>${hcells.join('')}</div><div class="bt-oh" role="columnheader">Next</div></div>`;
495
523
  const tf = more > 0 && !foldOpen ? `<button type="button" class="dlink" id="fold" aria-expanded="false">${SV(I.chev)}${more} more in Monitor and Evaluate</button>`
@@ -535,66 +563,57 @@ function drawTime(L) {
535
563
  lane: (c) => DL.laneHtml(c, { span, progState }) });
536
564
  return T.html;
537
565
  }
538
- /** A phone's view switch (BdPhone): List, By stage, the stage track and the timeline (TsCPhone: it scrolls sideways like the desktop's). */
539
- const phoneSeg = (v) => `<div class="bd-phseg"><div class="bd-seg" role="group" aria-label="View">${[['list', 'List'], ['stages', 'By stage'], ['track', 'Track'], ['time', 'Timeline']].map(([k, n]) => `<button type="button" data-pv="${k}" aria-pressed="${v === k}">${n}</button>`).join('')}</div></div>`;
566
+ /** The View chip (batch 28 item 3, canvas BhA; on a desktop too since UI grill U2): the four views, the span and (a desktop) the Columns where they
567
+ * apply (the timeline), then Shared with me. */
568
+ const VIEW_ITEMS = [['list', 'List'], ['stages', 'By stage'], ['track', 'Track'], ['time', 'Timeline']];
569
+ function drawViewMenu() {
570
+ const v = curView(), open = menuOpen('bdViewMenu'), name = (VIEW_ITEMS.find(([k]) => k === v) || VIEW_ITEMS[0])[1];
571
+ const b = $('#bdView');
572
+ b.innerHTML = SV(I[v] || I.list) + `<svg class="bd-chv" viewBox="0 0 24 24" aria-hidden="true"><path d="${I.chev}"/></svg>`;
573
+ b.setAttribute('aria-label', 'View: ' + (tab === 'shared' ? 'Shared with me' : name) + '. Change view');
574
+ b.setAttribute('aria-expanded', String(open));
575
+ const cols = v === 'time' && !small() ? `<span class="bd-vcols" id="bdColsMenu" role="group" aria-labelledby="bdColsH">${CO.menuHtml()}</span>` : '';
576
+ const sp = v === 'time' ? `<span class="bd-mlbl">Span</span><span class="bd-fg bd-vsp" role="radiogroup" aria-label="Span">${SPANS.map(([k, n]) => `<button type="button" class="bd-chip${k === span ? ' on' : ''}" role="radio" aria-checked="${k === span}" data-spick="${k}">${esc(n)}</button>`).join('')}</span>` : '';
577
+ // a published copy (pm/readonly.js): the stage track and the Timeline, the two views a publisher shares, and the span; no Columns, no Shared
578
+ const RO = !!window.PMOS_READONLY;
579
+ $('#bdViewMenu').innerHTML = VIEW_ITEMS.filter(([k]) => !RO || k === 'track' || k === 'time').map(([k, n]) => { const on = tab === 'ini' && k === v; return `<button type="button" class="bd-vmi${on ? ' on' : ''}" data-pv="${k}" aria-pressed="${on}">${SV(I[k])}<span>${n}</span>${on ? `<span class="ck">${SV(I.ok)}</span>` : ''}</button>`; }).join('')
580
+ + sp + (RO ? '' : cols + '<span class="bd-vsep" aria-hidden="true"></span>'
581
+ + `<button type="button" class="bd-vmi${tab === 'shared' ? ' on' : ''}" data-vshared aria-pressed="${tab === 'shared'}">${SV(I.people)}<span>Shared with me</span>${SH_N ? `<span class="k">${SH_N}</span>` : ''}</button>`);
582
+ }
583
+ $('#bdVieww').addEventListener('click', (e) => {
584
+ const pv = e.target.closest('[data-pv]'); if (pv && M) { closeMenu('bdViewMenu', 'bdView'); setTab('ini'); setView(pv.dataset.pv); $('#bdView').focus(); return; }
585
+ const sk = e.target.closest('[data-spick]'); if (sk && M) { setSpan(sk.dataset.spick); const n = $(`#bdViewMenu [data-spick="${sk.dataset.spick}"]`); if (n) n.focus(); return; }
586
+ if (e.target.closest('[data-vshared]')) { closeMenu('bdViewMenu', 'bdView'); setTab(tab === 'shared' ? 'ini' : 'shared'); drawViewMenu(); $('#bdView').focus(); return; }
587
+ if (e.target.closest('#bdView')) { const m = $('#bdViewMenu'), o = m.hidden; if (o) { closeMenu('bdNeedMenu', 'chNeed'); drawViewMenu(); } m.hidden = !o; $('#bdView').setAttribute('aria-expanded', String(o)); if (o) (m.querySelector('[aria-pressed="true"]') || m.querySelector('button')).focus(); }
588
+ });
589
+ // a Columns check box in the View menu (StsA8Board): Initiative always on; the choice is remembered (pm/bd-cols.js); the menu stays open
590
+ $('#bdVieww').addEventListener('change', (e) => { const c = e.target.closest('[data-tcol]'); if (!c) return; CO.setOn(c.dataset.tcol, c.checked); if (M) { drawInit(); const n = $(`#bdViewMenu [data-tcol="${c.dataset.tcol}"]`); if (n) n.focus(); } });
591
+ $('#bdVieww').addEventListener('keydown', (e) => { if (e.key === 'Escape' && closeMenu('bdViewMenu', 'bdView')) { e.stopPropagation(); $('#bdView').focus(); } });
592
+ document.addEventListener('click', (e) => { if (!e.target.closest('#bdVieww')) closeMenu('bdViewMenu', 'bdView'); });
540
593
  function drawInit() {
541
- $('#nIni').textContent = String(M.initiatives.open || M.initiatives.list.rows.length);
542
594
  const phone = small(), L = visible(), v = curView();
543
595
  const body = $('#ibBody');
544
596
  body.dataset.view = v; body.dataset.span = v === 'time' ? span : '';
545
597
  const html = v === 'track' ? drawTrack(L) : v === 'time' ? drawTime(L) : v === 'list' ? (phone ? V.phoneListHtml(L) : V.listHtml(L, filtered())) : V.stagesHtml(L, { phone });
546
598
  // a phone has no ⋯ menu: Metrics and Cancelled and archived stay one press away in every view, not only the track
547
599
  const phx = phone && v !== 'track' ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : '';
548
- // the workflow chips (WfABoard, WfATrack, WfAPhone): By stage and the track on a desktop, every view on a phone; the List filters in Filter
549
- const W = wfState(), wfc = phone || v === 'stages' || v === 'track' ? WF.chipsHtml(W.list, W.cur, { phone }) : '';
550
600
  if (v === 'time') TL.hold(); else TL.forget();
551
601
  // a row with the focus keeps it when the rows are drawn again (the page panel changes form as a Viewer opens or closes beside it)
552
602
  const fe = document.activeElement, fk = fe && body.contains(fe) && fe.matches('[data-key]') ? fe.dataset.key : null;
553
- body.innerHTML = (phone ? phoneSeg(v) : '') + wfc + html + phx;
603
+ body.innerHTML = html + phx;
554
604
  if (fk) { const n = $$('#ibBody [data-key]').find((x) => x.dataset.key === fk); if (n) n.focus({ preventScroll: true }); }
555
605
  if (v === 'time') TL.mount(body);
556
606
  $('#bdShowing').innerHTML = showingHtml(L.length); $('#bdShowing').hidden = !$('#bdShowing').innerHTML;
557
- $$('#ibTabs [data-v]').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.v === v)));
558
- { const sb = $('#bdSort'), Ls = SO.labels(); if (sb) { sb.setAttribute('aria-label', Ls.aria); sb.title = Ls.title; sb.classList.toggle('on', Ls.on); } }
559
- $('#bdView').innerHTML = SV(v === 'time' ? I.time : I.track); $('#bdView').setAttribute('aria-label', 'Change view. Now: ' + (v === 'time' ? 'Timeline' : 'Stage track'));
560
- drawSpanPicker('desk', v === 'time' && !phone);
561
- $('#bdColsw').hidden = v !== 'time' || phone; if ($('#bdColsw').hidden) closeCols();
562
- drawSpanPick(phone && v === 'time');
607
+ drawViewMenu();
563
608
  document.body.dataset.bdView = v;
564
609
  $('#stage').dataset.bdDesk = view; // what fit() measures: the desktop's view, so the narrow form never flips it back and forth
565
- drawGrouping();
566
610
  markOpen();
567
611
  }
568
612
  PHONE.addEventListener('change', () => { if (M) { drawChips(); drawInit(); } });
569
- /** The grouping (PgBoard, PgBoardProduct): programs first is the default and draws nothing in the toolbar (PgBoard); the choice is in Filter.
570
- * "By product" shows as an on chip after the views (PgBoardProduct), whose menu switches back. Only when a program holds a row here. */
613
+ /** The grouping (PgBoard, PgBoardProduct): programs first (the default) or By product, in the tune sheet (#bdFilter) since UI grill U2.
614
+ * Only when a program holds a row here (zero is silence). */
571
615
  const groupingOn = () => !!(M && PGS.length && PG.groupsOf(PGS, M.initiatives.list.rows, M, false));
572
- function setGrouping(bp) { byProduct = !!bp; store.set(GROUPING_KEY, byProduct ? 'product' : 'program'); const m = $('#bdGrpMenu'); if (m) m.hidden = true; drawChips(); drawInit(); }
573
- function drawGrouping() {
574
- const w = $('#bdGrpw'), on = groupingOn() && byProduct;
575
- w.hidden = !on; if (!on) { w.innerHTML = ''; return; }
576
- const open = !!$('#bdGrpMenu') && !$('#bdGrpMenu').hidden;
577
- const btn = `<button type="button" class="bd-chip bd-grp on" id="bdGroup" aria-haspopup="menu" aria-expanded="${open}" aria-label="Grouped by product. Change grouping">By product${SV(I.chev)}</button>`;
578
- w.innerHTML = btn + `<span class="bd-grpm" id="bdGrpMenu" role="menu"${open ? '' : ' hidden'}>${[['program', 'Programs first'], ['product', 'By product']].map(([k, n]) => `<button type="button" role="menuitemradio" aria-checked="${(k === 'product') === byProduct}" data-grping="${k}">${n}</button>`).join('')}</span>`;
579
- }
580
- $('#bdGrpw').addEventListener('click', (e) => {
581
- const g = e.target.closest('[data-grping]');
582
- if (g) { setGrouping(g.dataset.grping === 'product'); const b = $('#bdGroup') || $('#bdFilter'); b.focus(); return; }
583
- if (e.target.closest('#bdGroup')) { const m = $('#bdGrpMenu'), o = m.hidden; m.hidden = !o; $('#bdGroup').setAttribute('aria-expanded', String(o)); if (o) m.querySelector('[aria-checked="true"]').focus(); }
584
- });
585
- document.addEventListener('click', (e) => { if (!e.target.closest('#bdGrpw')) { const m = $('#bdGrpMenu'); if (m && !m.hidden) { m.hidden = true; $('#bdGroup').setAttribute('aria-expanded', 'false'); } } });
586
- $('#bdGrpw').addEventListener('keydown', (e) => { if (e.key === 'Escape') { const m = $('#bdGrpMenu'); if (m && !m.hidden) { e.stopPropagation(); m.hidden = true; $('#bdGroup').setAttribute('aria-expanded', 'false'); $('#bdGroup').focus(); } } });
587
- /* the Columns menu (StsA8Board): a check box per column, Initiative always on; the choice is remembered (pm/bd-cols.js) */
588
- function closeCols(back) { const m = $('#bdColsMenu'); if (!m || m.hidden) return false; m.hidden = true; $('#bdCols').setAttribute('aria-expanded', 'false'); if (back) $('#bdCols').focus(); return true; }
589
- $('#bdCols').addEventListener('click', () => {
590
- const m = $('#bdColsMenu'), o = m.hidden;
591
- if (!o) { closeCols(); return; }
592
- m.innerHTML = CO.menuHtml(); m.hidden = false; $('#bdCols').setAttribute('aria-expanded', 'true');
593
- const f = m.querySelector('input:not([disabled])'); if (f) f.focus();
594
- });
595
- $('#bdColsMenu').addEventListener('change', (e) => { const c = e.target.closest('[data-tcol]'); if (!c) return; CO.setOn(c.dataset.tcol, c.checked); if (M) drawInit(); });
596
- $('#bdColsw').addEventListener('keydown', (e) => { if (e.key === 'Escape' && closeCols(true)) e.stopPropagation(); });
597
- document.addEventListener('click', (e) => { if (!e.target.closest('#bdColsw')) closeCols(); });
616
+ function setGrouping(bp) { byProduct = !!bp; store.set(GROUPING_KEY, byProduct ? 'product' : 'program'); drawChips(); drawInit(); }
598
617
  /* a narrower or wider Board fits another number of columns: redraw the timeline then, and only then */
599
618
  new ResizeObserver(() => {
600
619
  if (!M || curView() !== 'time' || small()) return;
@@ -602,39 +621,15 @@ new ResizeObserver(() => {
602
621
  if ((c ? c.keys.length : 1) !== colsFit) drawInit();
603
622
  }).observe($('#ibBody'));
604
623
  function setView(v) { if (PHONE.matches) { pview = v; store.set(PVIEW_KEY, v); } else if (narrow()) nview = v; else { view = v; store.set(VIEW_KEY, view); } if (!narrow()) closePanel(); drawChips(); drawInit(); }
605
- $('#ibTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-v]'); if (!b || !M) return; setTab('ini'); setView(b.dataset.v); });
606
- $('#bdView').addEventListener('click', () => { if (M) { const c = curView(); setView(small() ? (c === 'list' ? 'stages' : c === 'stages' ? 'track' : c === 'track' ? 'time' : 'list') : view === 'time' ? 'track' : 'time'); } });
607
624
  $('#bdShowing').addEventListener('click', (e) => {
608
625
  if (e.target.closest('#fClear')) { clearFilters(); drawChips(); drawInit(); return; }
609
626
  const u = e.target.closest('[data-unf]'); if (!u) return;
610
- if (u.dataset.unf === 'q') F.q = ''; else if (u.dataset.unf === 'wf') WF.setPick(''); else F[u.dataset.unf].clear(); drawChips(); drawInit();
627
+ if (u.dataset.unf === 'q') F.q = ''; else F[u.dataset.unf].clear(); drawChips(); drawInit();
611
628
  });
612
629
  function setSpan(s) { span = s; store.set(SPAN_KEY, span); drawChips(); drawInit(); }
613
- /** The span picker: one chip that opens the six spans (batch 24 item 7, canvas BbB, as a phone's TsCPhone, TsCPhoneSpan). A desktop draws it in the
614
- * chip row after the tabs (#bdSpans, items data-sp); a phone draws it beside the product picker (#bdSpanPick, items data-spick), and the page title
615
- * gives it the room. */
616
- const SPK = { desk: ['bdSpans', 'bdSpansBtn', 'bdSpansMenu', 'sp'], phone: ['bdSpanPick', 'bdSpanBtn', 'bdSpanMenu', 'spick'] };
617
- function drawSpanPicker(which, on) {
618
- const [wid, bid, mid, attr] = SPK[which], w = $('#' + wid);
619
- w.hidden = !on; if (!on) { w.innerHTML = ''; return; }
620
- const open = menuOpen(mid), name = (SPANS.find(([k]) => k === span) || SPANS[1])[1];
621
- w.innerHTML = `<button type="button" class="bd-chip bd-spk" id="${bid}" aria-haspopup="menu" aria-expanded="${open}" aria-label="Span: ${esc(name)}. Change the span">${esc(name)}${SV(I.chev)}</button>`
622
- + `<span class="bd-grpm" id="${mid}" role="menu"${open ? '' : ' hidden'}>${SPANS.map(([k, n]) => `<button type="button" role="menuitemradio" aria-checked="${k === span}" data-${attr}="${k}">${esc(n)}</button>`).join('')}</span>`;
623
- }
624
- function drawSpanPick(on) { document.body.classList.toggle('bd-spick', on); drawSpanPicker('phone', on); }
625
- for (const which of Object.keys(SPK)) {
626
- const [wid, bid, mid, attr] = SPK[which], w = $('#' + wid);
627
- w.addEventListener('click', (e) => {
628
- const k = e.target.closest(`[data-${attr}]`); if (k && M) { closeMenu(mid, bid); setSpan(k.dataset[attr]); const b = $('#' + bid); if (b) b.focus(); return; }
629
- if (e.target.closest('#' + bid)) { const m = $('#' + mid), o = m.hidden; m.hidden = !o; $('#' + bid).setAttribute('aria-expanded', String(o)); if (o) m.querySelector('[aria-checked="true"]').focus(); }
630
- });
631
- w.addEventListener('keydown', (e) => { if (e.key === 'Escape' && closeMenu(mid, bid)) { e.stopPropagation(); $('#' + bid).focus(); } });
632
- document.addEventListener('click', (e) => { if (!e.target.closest('#' + wid)) closeMenu(mid, bid); });
633
- }
634
630
  $('#ibBody').addEventListener('click', (e) => {
635
631
  if (e.target.closest('#fold, [data-mefold]')) { foldOpen = !foldOpen; drawInit(); const f = $('#fold') || $('#ibBody [data-mefold]'); if (f) f.focus(); return; }
636
632
  const gf = e.target.closest('[data-fold]'); if (gf) { const k = gf.dataset.fold; PG.fold(k); drawInit(); const b = $$('#ibBody [data-fold]').find((x) => x.dataset.fold === k); if (b) b.focus(); return; }
637
- const wp = e.target.closest('[data-wfpick]'); if (wp) { const id = wp.dataset.wfpick; WF.setPick(wp.getAttribute('aria-pressed') === 'true' ? '' : id); drawChips(); drawInit(); const b = $$('#ibBody [data-wfpick]').find((x) => x.dataset.wfpick === (WF.picked(wfState().list) || { id: '' }).id) || $('#ibBody [data-wfpick]'); if (b) b.focus(); return; }
638
633
  const pc = e.target.closest('[data-pcat]'); if (pc) { const k = pc.dataset.pcat; V.togglePcat(k); drawInit(); const b = $$('#ibBody [data-pcat]').find((x) => x.dataset.pcat === k); if (b) b.focus(); return; }
639
634
  const pm = e.target.closest('[data-pmore]'); if (pm) { V.morePcat(pm.dataset.pmore); drawInit(); return; }
640
635
  const cf = e.target.closest('[data-colfold]'); if (cf) { const k = cf.dataset.colfold; V.toggleCol(k); drawInit(); const b = $$('#ibBody [data-colfold]').find((x) => x.dataset.colfold === k); if (b) b.focus(); return; }
@@ -902,24 +897,17 @@ $('#bdFilter').addEventListener('click', (e) => Acts.open.filter(e.currentTarget
902
897
  // New (PgBoard: "New program or initiative"): a menu of the two. The program panel's own "New initiative" presses this button from code,
903
898
  // and that press opens New initiative at once.
904
899
  $('#newIni').addEventListener('click', (e) => { if (e.isTrusted) Asks.openNewMenu(e.currentTarget); else Acts.open.new(e.currentTarget); });
905
- $('#bdBell').addEventListener('click', (e) => { if (M) Acts.open.bell(e.currentTarget); });
906
- // Publish a read-only copy (initiative board-publish, slice 2): one board at a time, so it is not drawn on the All products page
907
- $('#bdPublish').addEventListener('click', (e) => { const btn = e.currentTarget; if (M && !ALL && M.board.ws) import('./bd-publish.js').then((P) => P.open(btn, { ws: M.board.ws, board: M.board.id || M.board.ws, view })); });
908
900
 
909
901
  /* ── tabs: Initiatives and Documents (Documents has no frame yet: a plain list) ──────────────────────────────────────────────────────── */
910
902
  let SH_PASTE = ''; // ?shared=<link>: Open in my PMOS on a shared board (batch 27 item 3) lands on Shared with the link in the paste field
911
903
  function setTab(t) {
912
904
  tab = t;
913
- $('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabShared').setAttribute('aria-selected', String(t === 'shared'));
914
905
  $('#cIni').hidden = t !== 'ini'; $('#cShared').hidden = t !== 'shared';
915
- // Shared (initiative board-publish, slice 4): reads each joined team's host now, on opening the tab and on Refresh, and never in between
906
+ // Shared (initiative board-publish, slice 4): reads each joined team's host now, on opening it and on Refresh, and never in between
916
907
  if (t === 'shared') { closePanel(); import('./bd-shared.js').then((S) => { SH_FULL = true; const paste = SH_PASTE; SH_PASTE = ''; S.show($('#cShared'), { onCount: setSharedCount, paste }); }); }
917
908
  }
918
- $('#tabIni').onclick = () => setTab('ini');
919
- $('#tabShared').onclick = () => setTab('shared');
920
- $('.bd-tabs').addEventListener('keydown', (e) => { if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return; const ord = ['ini', 'shared']; const n = ord[(ord.indexOf(tab) + (e.key === 'ArrowRight' ? 1 : ord.length - 1)) % ord.length]; setTab(n); $('#' + { ini: 'tabIni', shared: 'tabShared' }[n]).focus(); });
921
- /** The number on the Shared tab and on the phone's Shared chip: nothing when there is nothing (zero is silence). Your own open links at load, every open copy after a read. */
922
- function setSharedCount(n) { SH_N = n; $('#nShared').textContent = n ? String(n) : ''; const c = $('#chShared'); if (c) c.textContent = 'Shared' + (n ? ' ' + n : ''); }
909
+ /** The number on Shared with me in the View menu: nothing when there is nothing (zero is silence). Your own open links at load, every open copy after a read. */
910
+ function setSharedCount(n) { SH_N = n; if (menuOpen('bdViewMenu')) drawViewMenu(); }
923
911
  document.addEventListener('bd:links', (e) => { if (!SH_FULL && e.detail) setSharedCount(e.detail.n); });
924
912
 
925
913
  /** The history of the documents (GET /api/board-docs) for the document panel of pm/bd-acts.js. Batch 24 item 7 took the Documents tab off the Board,
@@ -941,15 +929,26 @@ async function loadDocMeta(list) {
941
929
  const docMeta = (p, ws) => { const d = DM[(ws || (M && M.board.ws) || '') + ':' + p]; return d && !d.none ? d : null; };
942
930
 
943
931
  /* ── the shell's bell sits before New initiative, as the design orders the tools; Escape closes a popover, then the panel ──────── */
944
- /* the ⋯ menu ("More: sources, archived, export" in AgBoard and BdHead): the Board adds Cancelled and archived (Metrics moved to Intelligence › Delivery trends, batch 22 item 4) */
932
+ /* the ⋯ menu (UI grill U2): Publish a read-only copy and Cancelled and archived, nothing else. The shell's Sources, Theme and Settings rows
933
+ * leave the Board's ⋯: Settings › Connectors holds the sources, Settings › General the theme, and Settings is one press away in the place menu.
934
+ * Settings stays in the menu as a hidden row: the shell still finds it there to say an update is ready. */
945
935
  {
946
936
  const st = $('#settingsBtn'), mb = $('#moreBtn');
947
- if (mb) { mb.setAttribute('aria-label', 'More: sources, archived, export'); mb.title = 'More: sources, archived, export'; }
948
- if (st) st.insertAdjacentHTML('beforebegin', '<button role="menuitem" id="bdGone" aria-haspopup="dialog" data-open="gone">Cancelled and archived</button>');
937
+ if (mb) { mb.setAttribute('aria-label', 'More: publish, cancelled and archived'); mb.title = 'More: publish, cancelled and archived'; }
938
+ for (const x of $$('#moreMenu #srcItem, #moreMenu #tbTheme')) (x.closest('.tbrow') || x).remove();
939
+ if (st) {
940
+ st.hidden = true;
941
+ st.insertAdjacentHTML('beforebegin', '<button role="menuitem" id="bdPublish" aria-haspopup="dialog" aria-expanded="false" aria-label="Publish a read-only copy of the board" hidden>Publish a read-only copy<span class="bpn" hidden></span></button>'
942
+ + '<button role="menuitem" id="bdGone" aria-haspopup="dialog" data-open="gone">Cancelled and archived</button>');
943
+ }
949
944
  $$('#moreMenu [data-open]').forEach((b) => { b.onclick = () => { if (M) Acts.open[b.dataset.open]($('#moreBtn')); }; });
945
+ // Publish a read-only copy (initiative board-publish, slice 2): one board at a time, so it is not drawn on the All products page; its
946
+ // popover opens under ⋯, and its row carries the count of open links
947
+ const pb = $('#bdPublish');
948
+ if (pb) pb.onclick = () => { if (M && !ALL && M.board.ws) import('./bd-publish.js').then((P) => P.open($('#moreBtn'), { ws: M.board.ws, board: M.board.id || M.board.ws, view })); };
950
949
  }
951
950
  window.addEventListener('keydown', (e) => {
952
- if (e.key !== 'Escape' || document.querySelector('.pv-ov:not([hidden]), #moreMenu:not([hidden]), #crMenu:not([hidden]), #czMenu:not([hidden]), #bdPop:not([hidden]), #bdGrpMenu:not([hidden]), #bdColsMenu:not([hidden])')) return;
951
+ if (e.key !== 'Escape' || document.querySelector('.pv-ov:not([hidden]), #moreMenu:not([hidden]), #crMenu:not([hidden]), #czMenu:not([hidden]), #bdPop:not([hidden])')) return;
953
952
  if ($$('.bd-pop').some((p) => !p.hidden)) closePops(true); // the shell closes itself on Escape (cozy-viewer.js)
954
953
  }, true);
955
954
 
@@ -1191,14 +1190,15 @@ function openFindings(r, from) {
1191
1190
  setTimeout(go, 0);
1192
1191
  }
1193
1192
  FCC.init({ rowOf: (k) => rowOf(k), openFindings });
1194
- const openIniAny = (r) => { if (r && curView() === 'time') TL.reveal(r.key); openIni(r, $('#bdBell'), 'track'); };
1193
+ const openIniAny = (r) => { if (r && curView() === 'time') TL.reveal(r.key); openIni(r, $('#chNeed') || $('#bdFind'), 'track'); };
1195
1194
  V.init({ M: () => M, wf: wfState, statusOf, usual: usualOf, trail: TI, docMeta, sel: () => (peek && peek.kind !== 'acts' ? peek.key : null), docSel: () => Acts.docSel(),
1196
1195
  groups: (L) => groups(L), folded: PG.folded, laneHead: (g) => PG.laneHtml(g, g.kind === 'program' ? progState(g.program) : null), subTile: (n) => PG.tileHtml(n, 'bd-ti s'),
1197
1196
  memberIcon: (id) => PG.memberIcon(PGS, id), product: () => (M.board.product || M.board.name || ''), programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), tileHtml: PG.tileHtml, progTile: PG.progTile });
1198
1197
  Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors, programs: () => PGS, reloadPrograms: loadPrograms });
1199
1198
  Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePanel, redraw: () => { drawChips(); drawInit(); }, F, rowOf, statusOf, openIni: openIniAny,
1200
1199
  openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc,
1201
- grouping: () => ({ on: groupingOn(), byProduct }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time' });
1200
+ grouping: () => ({ on: groupingOn(), byProduct }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time',
1201
+ tune: tuneParts, sprintOnly, toggleSprintOnly: () => { if (F.chips.has('sprint')) F.chips.delete('sprint'); else F.chips.add('sprint'); }, sortPick, refreshJira: () => refreshJira() });
1202
1202
  BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
1203
1203
  send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
1204
1204
  moreAct: (r, k, b) => Acts.open.more(r, k, b), hold: (r, i, b) => Acts.open.hold(r, i, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,