create-pmos 0.427.0 → 0.429.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 (147) 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-programs-test.js +16 -2
  7. package/workspace/briefing-premium-board-test.js +27 -22
  8. package/workspace/briefing-premium-insights-test.js +81 -60
  9. package/workspace/briefing-premium-metrics-test.js +5 -3
  10. package/workspace/briefing-premium-sources-test.js +5 -5
  11. package/workspace/briefing-premium-test.js +7 -5
  12. package/workspace/changelog.json +24 -0
  13. package/workspace/ev-everywhere-test.js +2 -2
  14. package/workspace/guide/briefing-premium.md +4 -2
  15. package/workspace/guide/home.md +34 -7
  16. package/workspace/guide/index.md +1 -0
  17. package/workspace/guide/metric-drafts.md +48 -0
  18. package/workspace/guide/programs.md +1 -0
  19. package/workspace/home-other-product-test.js +12 -2
  20. package/workspace/intel-report-ui-test.js +189 -0
  21. package/workspace/lib/board-metrics-premium.js +1 -1
  22. package/workspace/lib/headless.js +15 -2
  23. package/workspace/lib/insights-premium.js +5 -1
  24. package/workspace/lib/insights-records.js +14 -5
  25. package/workspace/lib/intel-report.js +419 -0
  26. package/workspace/lib/metric-draft-runs.js +193 -0
  27. package/workspace/lib/metric-drafts.js +231 -0
  28. package/workspace/lib/metrics-cli.js +104 -0
  29. package/workspace/lib/pmos-verbs.js +3 -0
  30. package/workspace/lib/report-setups.js +29 -13
  31. package/workspace/lib/route-modules.js +1 -0
  32. package/workspace/lib/routes-insights-premium.js +2 -2
  33. package/workspace/lib/routes-insights-records.js +13 -5
  34. package/workspace/lib/routes-meeting-material.js +22 -1
  35. package/workspace/lib/routes-metric-drafts.js +141 -0
  36. package/workspace/lib/routes-phone-day.js +13 -2
  37. package/workspace/lib/routes-report-setups.js +92 -3
  38. package/workspace/lib/routes-viewer.js +5 -2
  39. package/workspace/lib/settings-store.js +14 -0
  40. package/workspace/metric-drafts-ui-test.js +209 -0
  41. package/workspace/milestone-pins-test.js +13 -0
  42. package/workspace/milestone-suggest-test.js +10 -4
  43. package/workspace/package-lock.json +2 -2
  44. package/workspace/package.json +1 -1
  45. package/workspace/premium-board-actions-test.js +40 -13
  46. package/workspace/premium-phone-card-test.js +8 -5
  47. package/workspace/premium-rec-tab-test.js +8 -0
  48. package/workspace/premium-vw-item-test.js +7 -3
  49. package/workspace/premium-vw-jira-test.js +2 -1
  50. package/workspace/program-charter-test.js +1 -1
  51. package/workspace/program-leave-test.js +2 -2
  52. package/workspace/program-order-test.js +3 -2
  53. package/workspace/program-panel-test.js +2 -1
  54. package/workspace/public/pm/bd-acts.js +23 -29
  55. package/workspace/public/pm/bd-ini-panel.js +90 -32
  56. package/workspace/public/pm/bd-pin-card.css +4 -4
  57. package/workspace/public/pm/bd-pin-card.js +4 -1
  58. package/workspace/public/pm/bd-prog-panel.js +9 -4
  59. package/workspace/public/pm/bd-span.js +22 -12
  60. package/workspace/public/pm/cozy-aud.css +1 -1
  61. package/workspace/public/pm/cozy-board.css +256 -256
  62. package/workspace/public/pm/cozy-ev.css +45 -45
  63. package/workspace/public/pm/cozy-evmodel.js +1 -1
  64. package/workspace/public/pm/cozy-home-rows.css +23 -23
  65. package/workspace/public/pm/cozy-home.css +207 -207
  66. package/workspace/public/pm/cozy-insights.css +207 -108
  67. package/workspace/public/pm/cozy-live-pill.css +5 -5
  68. package/workspace/public/pm/cozy-mtg-present.css +23 -23
  69. package/workspace/public/pm/cozy-nav.js +1 -1
  70. package/workspace/public/pm/cozy-news.js +2 -2
  71. package/workspace/public/pm/cozy-panel.css +29 -29
  72. package/workspace/public/pm/cozy-pick.css +5 -5
  73. package/workspace/public/pm/cozy-rec-now.css +20 -20
  74. package/workspace/public/pm/cozy-rec-present.css +11 -11
  75. package/workspace/public/pm/cozy-rec-tab.css +13 -13
  76. package/workspace/public/pm/cozy-rec-tab.js +12 -3
  77. package/workspace/public/pm/cozy-settings.js +1 -1
  78. package/workspace/public/pm/cozy-steps.css +9 -9
  79. package/workspace/public/pm/cozy-today.css +107 -71
  80. package/workspace/public/pm/cozy-viewer.css +7 -7
  81. package/workspace/public/pm/cozy-viewer.js +157 -23
  82. package/workspace/public/pm/cozy-vw-mtg.css +81 -81
  83. package/workspace/public/pm/cozy-vw-rp.css +53 -53
  84. package/workspace/public/pm/cozy-vw-shell.css +34 -21
  85. package/workspace/public/pm/cozy-vw.css +117 -117
  86. package/workspace/public/pm/cozy-xv.css +11 -11
  87. package/workspace/public/pm/cozy.css +18 -15
  88. package/workspace/public/pm/hi-pop.css +82 -0
  89. package/workspace/public/pm/hi-pop.js +65 -0
  90. package/workspace/public/pm/home-app.js +83 -28
  91. package/workspace/public/pm/home-day.js +131 -26
  92. package/workspace/public/pm/home-ini.css +38 -108
  93. package/workspace/public/pm/home-ini.js +50 -68
  94. package/workspace/public/pm/home-line.css +7 -7
  95. package/workspace/public/pm/home-list.js +41 -4
  96. package/workspace/public/pm/home-phone-card.js +18 -15
  97. package/workspace/public/pm/home-today.js +18 -7
  98. package/workspace/public/pm/ini-more.js +67 -0
  99. package/workspace/public/pm/ini-view-model.js +3 -2
  100. package/workspace/public/pm/ini-view.css +104 -102
  101. package/workspace/public/pm/ini-view.js +16 -8
  102. package/workspace/public/pm/loose-props.css +13 -13
  103. package/workspace/public/pm/metric-drafts.css +82 -0
  104. package/workspace/public/pm/metric-drafts.js +165 -0
  105. package/workspace/public/pm/ms-suggest.css +8 -8
  106. package/workspace/public/pm/order-model.js +85 -0
  107. package/workspace/public/pm/ov-view.css +12 -12
  108. package/workspace/public/pm/premium-board.js +57 -11
  109. package/workspace/public/pm/premium-chart-tab.js +6 -6
  110. package/workspace/public/pm/premium-insights.js +306 -105
  111. package/workspace/public/pm/premium-report-intel.css +56 -0
  112. package/workspace/public/pm/premium-report-intel.js +232 -0
  113. package/workspace/public/pm/premium-shell.js +2 -2
  114. package/workspace/public/pm/premium-vw-file.js +2 -2
  115. package/workspace/public/pm/premium-vw-item.js +3 -1
  116. package/workspace/public/pm/premium-vw-jira.js +2 -0
  117. package/workspace/public/pm/premium.css +127 -128
  118. package/workspace/public/pm/prog-order.css +6 -6
  119. package/workspace/public/pm/prog-order.js +15 -2
  120. package/workspace/public/pm/program-charter.css +23 -23
  121. package/workspace/public/pm/rp-parts.js +2 -2
  122. package/workspace/public/pm/sort-order.css +17 -0
  123. package/workspace/public/pm/sort-order.js +108 -0
  124. package/workspace/public/pm/split-merge.css +15 -15
  125. package/workspace/public/pm/task-card.css +21 -21
  126. package/workspace/public/pm/tk-tasks.css +37 -37
  127. package/workspace/public/pm/tk-view.css +6 -6
  128. package/workspace/public/pm/tk-view.js +3 -2
  129. package/workspace/public/pm/wf-page.css +28 -28
  130. package/workspace/public/pm/wf-page.js +1 -1
  131. package/workspace/public/premium-board.html +1 -0
  132. package/workspace/public/premium-intelligence.html +82 -0
  133. package/workspace/server.js +38 -3
  134. package/workspace/skills/metric-draft.skill +47 -0
  135. package/workspace/sort-order-test.js +201 -0
  136. package/workspace/stage-card-test.js +1 -0
  137. package/workspace/task-card-test.js +1 -1
  138. package/workspace/test-lists/intel-report-ui.json +5 -0
  139. package/workspace/test-lists/intel-report.json +9 -0
  140. package/workspace/test-lists/metric-drafts-ui.json +5 -0
  141. package/workspace/test-lists/metric-drafts.json +9 -0
  142. package/workspace/test-lists/sort-order.json +6 -0
  143. package/workspace/test-lists/viewer-trail.json +5 -0
  144. package/workspace/test-run.js +3 -0
  145. package/workspace/tk-tasks-test.js +5 -3
  146. package/workspace/viewer-trail-test.js +145 -0
  147. package/workspace/public/premium-insights.html +0 -81
@@ -85,7 +85,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
85
85
  await p.click('#czViewer [data-pp="edit"]');
86
86
  ok('W the pencil opens the charter as a drill-in (← back to the program)', await charterShown(p));
87
87
  const ch = await head(p);
88
- ok('F the header: ←, the program\'s name with "Charter" under it, no Save before a change, no ⋯', ch.tools[0] === 'Back' && /^Project Ascent · CIAM migration/.test(ch.title) && ch.sub === 'Charter' && !ch.save && !ch.tools.includes('More'), JSON.stringify(ch));
88
+ ok('F the header: ←, the program\'s name with "Charter" under it, no Save before a change, no ⋯', /^Back to /.test(ch.tools[0]) && /^Project Ascent · CIAM migration/.test(ch.title) && ch.sub === 'Charter' && !ch.save && !ch.tools.includes('More'), JSON.stringify(ch));
89
89
  const fv = await p.evaluate(() => { const v = (f) => (document.querySelector(`#czViewer [data-f="${f}"]:not(.pc-dt)`) || {}).value; return { goal: v('goal'), owner: v('owner'), jira: v('jira'), why: v('why'), start: document.querySelector('#czViewer [data-pc="date"][data-f="start"] span').textContent, target: document.querySelector('#czViewer [data-pc="date"][data-f="target"] span').textContent, lim: document.querySelector('#czViewer .pc-lim').textContent, done: document.querySelector('#czViewer button.pc-ln.dn').textContent }; });
90
90
  ok('F every field as the record holds it; the span as days; "8 of 12"; the done ones fold into "2 done · …"', fv.goal === 'CIAM migration' && fv.owner === 'Wawan' && fv.jira === '' && /^Move every product/.test(fv.why) && fv.start === 'Sep 1, 2026' && fv.target === 'Jun 30, 2028' && fv.lim === '8 of 12' && fv.done === '2 done · Vendor picked, Charter approved', JSON.stringify(fv));
91
91
  const r0 = await rowsOf(p);
@@ -96,7 +96,7 @@ const waitsOf = (id) => ((R.all(rctx).find((p) => p.id === 'project-ascent') ||
96
96
  return { ctx, page, errors };
97
97
  };
98
98
  const menu = async (p) => { await p.click('#czViewer [data-cz-vw="more"]'); await p.waitForTimeout(80); return p.evaluate(() => [...document.querySelectorAll('.cz-vw-menu [role="menuitem"]')].map((b) => b.textContent.trim())); };
99
- const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list] [data-po-id]')].map((r) => r.dataset.poId));
99
+ const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list]:not([data-po-list^="@"]) > [data-po-id]')].map((r) => r.dataset.poId));
100
100
  const toast = (p) => p.evaluate(() => { const t = document.querySelector('#bdToast'); return t && !t.hidden ? t.textContent : ''; });
101
101
 
102
102
  /* B — the Board's initiative panel */
@@ -116,7 +116,7 @@ const waitsOf = (id) => ((R.all(rctx).find((p) => p.id === 'project-ascent') ||
116
116
  ok('B Move out is one press: one leave, no confirm; the toast says where it went and the milestone it left, with Undo',
117
117
  posts.length === n0 + 1 && posts[n0].body.leave === true && /Moved out of Project Ascent · now under IDPF · off 1 milestone/.test(t) && /Undo/.test(t), JSON.stringify({ t, posts: posts.slice(n0) }));
118
118
  ok('B the program no longer has it, and Legacy IdP off no longer waits on it', !members().includes('legacy-idp-sunset') && !waitsOf('legacy-idp-off').includes('legacy-idp-sunset'), JSON.stringify({ m: members(), w: waitsOf('legacy-idp-off') }));
119
- const after = await until(() => p.evaluate(() => { const r = [...document.querySelectorAll('#ibBody [data-key]')].find((x) => /Legacy IdP sunset/.test(x.textContent) && !x.closest('[data-po-list]')); const v = document.querySelector('#czViewer'); return r ? { sel: r.classList.contains('sel') || !!r.querySelector('.sel'), open: !!v && !v.hidden && /Legacy IdP sunset/.test(v.textContent) } : null; }));
119
+ const after = await until(() => p.evaluate(() => { const r = [...document.querySelectorAll('#ibBody [data-key]')].find((x) => /Legacy IdP sunset/.test(x.textContent) && !x.closest('[data-po-list]:not([data-po-list^="@"])')); const v = document.querySelector('#czViewer'); return r ? { sel: r.classList.contains('sel') || !!r.querySelector('.sel'), open: !!v && !v.hidden && /Legacy IdP sunset/.test(v.textContent) } : null; }));
120
120
  ok('B the row shows under its product, and the panel stays on it', !!after && after.open, JSON.stringify(after));
121
121
  if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/board-done.png' });
122
122
  await p.click('#bdToast .bd-undo');
@@ -5,6 +5,7 @@
5
5
  * (fixtures/program-ascent.js) and POST /api/programs/order is answered here, from the order the page sent, so a reload reads it back.
6
6
  * B Board: the program's rows follow its order; ✦ shows (with its dot) only while the dates disagree; the suggestion lists the date order with a
7
7
  * reason per row; ✓ applies it, Undo puts the order back; ✕ is "not now" until a date changes; drag by the grip; Alt + ↓ moves a row
8
+ * (the programs, products and a product's initiatives are Home's and the Board's own lists, [data-po-list^="@"]: sort-order-test.js)
8
9
  * H Home: the program group lists the same order; the grip moves a row there too; a phone holds the row, then drags it */
9
10
  const path = require('path');
10
11
  const { spawn } = require('child_process');
@@ -69,14 +70,14 @@ const routePrograms = async (page) => {
69
70
  await page.waitForTimeout(700);
70
71
  return { ctx, page, errors };
71
72
  };
72
- const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list] [data-po-id]')].map((r) => r.dataset.poId));
73
+ const kids = (p) => p.evaluate(() => [...document.querySelectorAll('#ibBody [data-po-list]:not([data-po-list^="@"]) > [data-po-id]')].map((r) => r.dataset.poId));
73
74
  const sug = (p) => p.evaluate(() => { const b = document.querySelector('#ibBody .bt-pg [data-po-sug]'); return b ? { dot: !!b.querySelector('.po-nd'), label: b.getAttribute('aria-label') } : null; });
74
75
 
75
76
  /* B — the Board's stage track */
76
77
  {
77
78
  ORDER = ['legacy-idp-sunset', 'descope-parity']; // the PM's order, against the dates (Descope starts Oct 5, Legacy Oct 11)
78
79
  const { ctx, page: p, errors } = await board();
79
- ok('B the program\'s rows follow its order, each with a grip', (await kids(p)).join() === 'legacy-idp-sunset,descope-parity' && (await p.locator('#ibBody [data-po-id] [data-po-grip]').count()) === 2, JSON.stringify(await kids(p)));
80
+ ok('B the program\'s rows follow its order, each with a grip', (await kids(p)).join() === 'legacy-idp-sunset,descope-parity' && (await p.locator('#ibBody [data-po-list]:not([data-po-list^="@"]) > [data-po-id] [data-po-grip]').count()) === 2, JSON.stringify(await kids(p)));
80
81
  const s = await sug(p);
81
82
  ok('B ✦ shows in the program header while the dates disagree, with the blue dot', !!s && s.dot, JSON.stringify(s));
82
83
  await p.click('#ibBody .bt-pg [data-po-sug]');
@@ -107,7 +107,8 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
107
107
  ok('F a row folds', await until(() => p.evaluate(() => document.querySelector('#czViewer [data-czs-fold="tree"]').getAttribute('aria-expanded') === 'false')));
108
108
  await p.click('#czViewer [data-cz-vw="close"]');
109
109
  ok('P Close closes the Viewer', await until(() => p.evaluate(() => document.querySelector('#czViewer').hidden)));
110
- await p.reload();
110
+ ok('P Close takes the program out of the address (batch 14 item 7: the address follows the Viewer)', !new URL(p.url()).searchParams.get('program'), p.url());
111
+ await p.goto(BASE + '/premium-board.html?ws=idpf&program=project-ascent'); // the program's own link again
111
112
  await shown(p);
112
113
  ok('F the folds are kept after a reload', await until(async () => !(await isOpen(p, 'tree')) && await isOpen(p, 'ms')));
113
114
  await fold(p, 'tasks');
@@ -1,8 +1,9 @@
1
1
  /* pm/bd-acts.js — the Board's presses and the panels and popovers around them (initiative premium-uncovered-features, Board: BdActions, BdFilter,
2
2
  * BdSprint, BdPanel, BdDocs; built on premium-agreed-design's plain versions, whose function each designed one keeps). The routes are the ones the
3
3
  * console presses, behind the launch nonce:
4
- * a row's actions (BdActions) the ⋯ menu: Move to <next> with how much of the step is ready, Back to <prev> (asks why), Hold, Cancel (asks why,
5
- * the same chips as Decline), Archive; Resume, Reopen, Restore. POST /api/boards/move { board, id, to, why? } ·
4
+ * a row's actions (BdActions) the stage presses of the initiative's ⋯ (pm/ini-more.js, batch 14 item 5; open.more): Move to a stage (the next
5
+ * with how much of the step is ready), Back to <prev> (asks why), Hold, Resume, Cancel (asks why, the same chips as
6
+ * Decline); Reopen and Restore in Cancelled and archived. POST /api/boards/move { board, id, to, why? } ·
6
7
  * /api/lifecycle { initiative_id, state, reason, back? } · /api/boards/archive { board, id, archived, reason? }.
7
8
  * Each one is done at once, with Undo in the toast, which writes the opposite line through the same route.
8
9
  * Cancelled and archived the side panel: All, On hold, Cancelled, Archived, each with Resume, Reopen or Restore
@@ -73,28 +74,6 @@ const prevOf = (r) => ({ life: r.acts.life, reason: r.acts.reason, backDay: r.ac
73
74
  const lifeBack = (r, p) => (p.life === 'hold' ? life(r.id, 'on-hold', p.reason, p.backDay) : p.life === 'cancelled' ? life(r.id, 'cancelled', p.reason) : life(r.id, 'active', 'undo'));
74
75
  /** How much of the step is ready, for "Move to <next> · 2 of 4 ready": the parts or tickets counted toward its output. */
75
76
  const readyOf = (r) => { const t = r.track || {}; return t.count && /\d+ of \d+/.test(t.count) ? t.count.replace(/ parts?$/, '') + ' ready' : ''; };
76
- function menuItems(r) {
77
- const a = r.acts || { stages: [], stage: '' }, cur = a.stages.indexOf(a.stage), out = [];
78
- if (a.archived) return [['restore', 'Restore', I.back, 'Back in the lists, as it was']];
79
- if (a.life === 'cancelled') return [['reopen', 'Reopen', I.back, 'Back to ' + (a.stage || 'its stage') + ', active again']];
80
- if (!M().board.self && !a.life && cur >= 0) {
81
- if (a.stages[cur + 1]) out.push(['mv:' + (cur + 1), 'Move to ' + a.stages[cur + 1], I.go, readyOf(r)]);
82
- if (cur > 0) out.push(['back:' + (cur - 1), 'Back to ' + a.stages[cur - 1], I.back, '']);
83
- }
84
- out.push(['hr']);
85
- if (a.life === 'hold') out.push(['resume', 'Resume', I.play, '']); else out.push(['hold', 'Hold', I.hold, '']);
86
- out.push(['cancel', 'Cancel', I.x, ''], ['archive', 'Archive', I.arch, '']);
87
- return out;
88
- }
89
- function menuHtml(r) {
90
- const it = menuItems(r), stage = it.some(([k]) => /^(mv|back):/.test(k));
91
- const self = M().board.self ? '<p class="bd-amut bd-mnote">The stage of a PMOS-self initiative comes from the repository. It moves when the files land.</p>' : '';
92
- return `<p class="bd-mlbl" id="mnT">${esc(r.title)}</p>${self}${stage ? '<p class="bd-mlbl">Stage</p>' : ''}`
93
- + it.map(([k, l, ic, s]) => (k === 'hr' ? (stage ? '<div class="bd-hr"></div>' : '') : `<button type="button" class="bd-mi" role="menuitem" data-rowact="${esc(k)}" data-id="${esc(r.key)}">${SV(ic)}<span>${esc(l)}</span>${s && /ready$/.test(s) ? `<span class="k">${esc(s)}</span>` : ''}</button>`)).join('');
94
- }
95
- function openRowMenu(r, btn) {
96
- Pop.open(menuHtml(r), btn, { label: 'Actions for ' + r.title, role: 'menu', width: 270, align: 'right', cls: 'bd-menu', focus: '.bd-mi' });
97
- }
98
77
  function reasonHtml(r, kind, to) {
99
78
  const L = kind === 'cancel' ? WHY_NOT : BACK_WHY;
100
79
  const q = kind === 'cancel' ? 'Why cancel ' + r.title + '?' : 'Why back to ' + to + '?';
@@ -102,9 +81,24 @@ function reasonHtml(r, kind, to) {
102
81
  + `<div class="bd-arow"><button type="button" class="bd-btn sm solid" data-rowact="${kind === 'cancel' ? 'cancel-go' : 'back-go:' + to}" data-id="${esc(r.key)}">${kind === 'cancel' ? 'Cancel initiative' : 'Back to ' + esc(to)}</button><button type="button" class="bd-btn sm ghost" data-rowact="menu" data-id="${esc(r.key)}">Not now</button></div>`
103
82
  + `<p class="bd-amut">${kind === 'cancel' ? 'Keeps its stage, its work and its history. Reopen it any time.' : 'The reason is kept with the move in the board ledger.'}</p></div>`;
104
83
  }
84
+ /** The stages to move to from the initiative's ⋯ (Move to a stage): a later one moves at once with Undo, an earlier one asks why. */
85
+ function stageHtml(r) {
86
+ const a = r.acts, cur = a.stages.indexOf(a.stage);
87
+ return `<p class="bd-mlbl">Move to a stage</p>` + a.stages.map((s, i) => (i === cur ? '' : `<button type="button" class="bd-mi" role="menuitem" data-rowact="${i > cur ? 'mv:' : 'back:'}${i}" data-id="${esc(r.key)}">${SV(i > cur ? I.go : I.back)}<span>${esc(s)}</span>${i === cur + 1 && readyOf(r) ? `<span class="k">${esc(readyOf(r))}</span>` : ''}</button>`)).join('');
88
+ }
89
+ /** One press of the initiative's ⋯ (pm/ini-more.js, feedback batch 14 item 5), by the row menu's own handlers: stage lists the stages,
90
+ * back:<stage> and cancel ask why in a card under the ⋯, hold and resume act at once with Undo. */
91
+ function moreAct(r, k, btn) {
92
+ if (!r || !r.acts) return;
93
+ if (k === 'hold' || k === 'resume') { runRow(r, k, null); return; }
94
+ const card = (html, label, cls) => Pop.open(html, btn, { label, role: cls ? 'menu' : 'dialog', width: cls ? 270 : 300, align: 'right', cls: cls || '', focus: '[data-why], .bd-mi' });
95
+ if (k === 'stage') card(stageHtml(r), 'Move ' + r.title + ' to a stage', 'bd-menu');
96
+ else if (k === 'cancel') card(reasonHtml(r, 'cancel'), 'Cancel ' + r.title);
97
+ else if (k.startsWith('back:')) card(reasonHtml(r, 'back', k.slice(5)), 'Back to ' + k.slice(5));
98
+ }
105
99
  async function runRow(r, k, btn) {
106
100
  const a = r.acts, p = prevOf(r), m = $('#rowM');
107
- if (k === 'menu') { Pop.redraw(menuHtml(r)); return; }
101
+ if (k === 'menu') { Pop.close(true); return; } // Not now
108
102
  if (k.startsWith('mv:') || k.startsWith('back-go:')) {
109
103
  const to = k.startsWith('mv:') ? a.stages[+k.slice(3)] : k.slice(8), fromStage = a.stage, why = k.startsWith('back-go:') ? whyOf(Pop.el()) : '';
110
104
  if (!to) return;
@@ -263,14 +257,14 @@ function lateSeries() {
263
257
  }
264
258
  function trendHtml(k) {
265
259
  const [tone, name, word] = TREND[k], n = (M().chips || {})[k] || 0, on = A.F.chips.has(k);
266
- let chart = `<p class="bd-amut">No weekly count of ${esc(word)} initiatives is kept yet, so no line is drawn. Insights draws it once the records hold it.</p>`;
260
+ let chart = `<p class="bd-amut">No weekly count of ${esc(word)} initiatives is kept yet, so no line is drawn. Intelligence draws it once the records hold it.</p>`;
267
261
  if (k === 'late') {
268
262
  const s = lateSeries(), mx = Math.max(1, ...s), X = (i) => 10 + i * 40, Y = (v) => 62 - (v / mx) * 50;
269
263
  const d = s.map((v, i) => (i ? 'L' : 'M') + X(i) + ' ' + Y(v).toFixed(1)).join('');
270
264
  chart = `<svg class="bd-spark" viewBox="0 0 300 70" role="img" aria-label="Late initiatives per week: ${s.join(', ')}"><path class="ax" d="M0 64H300"/><path class="ln" d="${d}"/><circle cx="${X(7)}" cy="${Y(s[7]).toFixed(1)}" r="3.5"/></svg>`
271
265
  + `<p class="sm">${s[0] === s[7] ? 'The same as eight weeks ago' : (s[7] < s[0] ? 'Down from ' : 'Up from ') + s[0] + ' eight weeks ago'}. ${esc(M().initiatives.list.rows.filter((r) => r.late).map((r) => r.title).slice(0, 2).join(' and ') || 'None')} ${n === 1 ? 'is' : 'are'} late now. Counted from the end dates on record.</p>`;
272
266
  }
273
- return `<div class="bd-trh"><i class="cz-dot ${tone}"></i><b>${esc(name)} · ${n} now</b><span class="bd-amut">${k === 'late' ? '8 weeks' : ''}</span></div>${chart}<div class="bd-arow"><button type="button" class="bd-btn sm${on ? ' on' : ''}" data-trshow="${k}" aria-pressed="${on}">${on ? 'Show all' : 'Show only ' + esc(word)}</button><a class="bd-btn sm ghost" href="/premium-insights.html?ws=${encodeURIComponent(M().board.ws || '')}">See in Insights${SV(I.go)}</a></div>`;
267
+ return `<div class="bd-trh"><i class="cz-dot ${tone}"></i><b>${esc(name)} · ${n} now</b><span class="bd-amut">${k === 'late' ? '8 weeks' : ''}</span></div>${chart}<div class="bd-arow"><button type="button" class="bd-btn sm${on ? ' on' : ''}" data-trshow="${k}" aria-pressed="${on}">${on ? 'Show all' : 'Show only ' + esc(word)}</button><a class="bd-btn sm ghost" href="/premium-intelligence.html?ws=${encodeURIComponent(M().board.ws || '')}">See in Intelligence${SV(I.go)}</a></div>`;
274
268
  }
275
269
  function openTrend(k, from) { if (TREND[k]) Pop.open(trendHtml(k), from, { label: TREND[k][1] + ' trend', width: 330, cls: 'bd-trend' }); }
276
270
 
@@ -339,7 +333,7 @@ async function openMetrics(from, again) {
339
333
  + `${t.change && !t.absent ? `<small>${esc(t.change.txt)}</small>` : ''}${t.chip ? `<em class="bd-mchip${t.ok ? ' ok' : ''}">${esc(t.chip)}${t.targetTxt ? ' · ' + esc(t.targetTxt) : ''}</em>` : t.look ? '<em class="bd-mchip">Needs a look</em>' : ''}</summary>`
340
334
  + `<p class="bd-amut">${esc(t.def || '')}</p>${weeks ? `<div class="bd-kv">${weeks}</div>` : ''}</details>`;
341
335
  };
342
- w.outerHTML = `<div id="metW"><p class="bd-amut">${esc(m.header || '')}${m.lead ? ' · ' + esc(m.lead) : ''}</p><div class="bd-mets">${(m.tiles || []).map(tile).join('')}</div><p class="bd-amut">${esc(m.note || '')} <a class="bd-alink" href="/premium-insights.html?ws=${ws}">Targets and longer ranges are on Insights</a>.</p></div>`;
336
+ w.outerHTML = `<div id="metW"><p class="bd-amut">${esc(m.header || '')}${m.lead ? ' · ' + esc(m.lead) : ''}</p><div class="bd-mets">${(m.tiles || []).map(tile).join('')}</div><p class="bd-amut">${esc(m.note || '')} <a class="bd-alink" href="/premium-intelligence.html?ws=${ws}">Targets and longer ranges are on Intelligence</a>.</p></div>`;
343
337
  if (m.pending) setTimeout(() => { if ($('#metW')) openMetrics(null, true); }, 3000);
344
338
  }
345
339
  function openBell(from) {
@@ -392,7 +386,7 @@ async function setBack(r, input) {
392
386
  await done(res, 'On hold · ' + r.title + ' · back ' + md(day(v)), async () => { const u = await lifeBack(r, p); A.say(u && u.ok ? r.title + ' is back as it was.' : errOf(u)); await A.load(); });
393
387
  }
394
388
 
395
- export const open = { hold: openHold, new: (from) => Asks.openNew(from), asks: (from) => Asks.openAsks(from), row: openRowMenu, sprint: openSprint, metrics: openMetrics, find: openFind, filter: openFilter, gone: (from) => openGone(from, 'all'), bell: openBell, trend: openTrend, release: openRelease, doc: openDocPanel };
389
+ export const open = { more: moreAct, hold: openHold, new: (from) => Asks.openNew(from), asks: (from) => Asks.openAsks(from), sprint: openSprint, metrics: openMetrics, find: openFind, filter: openFilter, gone: (from) => openGone(from, 'all'), bell: openBell, trend: openTrend, release: openRelease, doc: openDocPanel };
396
390
  export const closeDoc = () => { docOpen = null; };
397
391
 
398
392
  /* ── the presses ─────────────────────────────────────────────────────────────────────────────────────────────── */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * mount(o) once, from premium-board.js. o: { M() the model, statusOf(r), fmt(iso), md(date), ago(iso), grill(id) the open first
5
5
  * questions, usual(track) the usual days in the step, rowOf(key), pageHref(r), askHref(r, q), refreshJira(), send(r) the
6
- * Send to Jira sheet, acts(r, btn) the row actions popover, grillOpen(r, btn), onShow(key, from) / onHide() so the page
6
+ * Send to Jira sheet, moreAct(r, k, btn) a stage press of ⋯ (bd-acts.js), grillOpen(r, btn), onShow(key, from) / onHide() so the page
7
7
  * marks the row the item came from, programOf(r) the program it is in or null, openProgram(id, btn), turnProgram(r)
8
8
  * "Turn into a program", moveItems(r) Move out of its program and Move to another (pm/prog-move.js), smItems(r) and
9
9
  * smPress(r, act, btn) Split into a new initiative and Merge into (pm/split-merge.js), openIniId(id) a row by its record id, setTask(r, uid, state) a task's state, setDates(r, uid, { start?, due? }) its days (the Tasks
@@ -16,8 +16,9 @@
16
16
  * openTicket(r, k) the ticket as a drill-in, in the one ticket Viewer (tk-view.js): ← goes back to the initiative; the summary says what blocks it and what that delays
17
17
  * refresh() draws the shown item again after a new read, in place · close() · shown() → the key of the initiative shown, or null
18
18
  *
19
- * What has no place on the view is under ⋯ in the shell's order: change it (move, hold, cancel or archive; the plan dates), look back (read
20
- * Jira again), then link and copy. "Open in full" (the initiative page) is the shell's own ⋯ item. Discuss in chat takes the question to Home. */
19
+ * What has no place on the view is under ⋯: the ONE initiative menu (pm/ini-more.js, feedback batch 14 item 5), the same words and order as
20
+ * Home's initiative page. Its stage presses (Move back a stage, Move to a stage, Put on hold, Cancel) are the row menu's own (moreAct(r, k, btn),
21
+ * bd-acts.js); Change workflow, Won't do and Archive are Home's (ini-wf.js). Discuss in chat takes the question to Home. */
21
22
  import * as VW from './cozy-viewer.js';
22
23
  import { esc } from './premium-shell.js';
23
24
  import { lr, copyText } from './cozy-xv.js';
@@ -25,6 +26,11 @@ import { iniView } from './ini-view-model.js';
25
26
  import { rowFor } from './ini-versions.js'; // planned versus actual (batch 11 item 8): Live or the draft the PM shows, with the plan line
26
27
  import { viewHtml, wireView } from './ini-view.js';
27
28
  import * as TV from './tk-view.js';
29
+ import { pmGet, pmPost } from './http.js';
30
+ import * as MD from './home-ini-model.js'; // the stage move's rules, as Home reads them (Moves on by itself, Move back a stage)
31
+ import * as WF from './ini-wf.js'; // D99: Change workflow, Won't do, Back to Triage, Archive, the same popovers as Home's
32
+ import { openPop, closePop, undoToast, ensureCss as ensurePopCss } from './hi-pop.js';
33
+ import { iniMore as iniMoreOf, iniText } from './ini-more.js'; // the one initiative ⋯ menu (batch 14 item 5)
28
34
 
29
35
  let O = null;
30
36
  let cur = null; // { key, tk } the initiative shown, and its ticket while the drill-in is shown
@@ -32,7 +38,6 @@ let adding = null; // the key of the initiative whose inline Add a task is open
32
38
  let addTo = ''; // the stage a task added there finishes (the Board's Next cell: "Add what finishes <stage>")
33
39
  let addDates = null; // the start and due a task added there takes (a gap's + on the timeline, batch 11 item 13)
34
40
  const TI = (r) => (r && r.trail) || null;
35
- const tkState = (k) => (k.blocked ? 'Blocked' + (k.reason ? ' by ' + k.reason.replace(/^Waiting on /i, '') : '') : k.status || 'To do');
36
41
  const jiraAt = () => { const J = (O.M() && O.M().jira) || {}; return J.readAt ? 'Jira · ' + O.ago(J.readAt) : ''; };
37
42
 
38
43
  /* ── the initiative: the one view ── */
@@ -58,32 +63,83 @@ function boardSections(r) {
58
63
  if (dr.length) S.push({ id: 'drift', title: 'Jira differs from the PRD', count: dr.length, render: () => driftHtml(dr) });
59
64
  return S;
60
65
  }
61
- /** ⋯ in the shell's order: change it, look back, then link and copy. Archive and cancel stay in the row actions, with their Undo. */
62
- function iniMore(r) {
63
- const more = [];
64
- if (r.acts) more.push({ label: 'Move, hold, cancel or archive', on: (b) => O.acts(r, b) });
65
- if (r.id) more.push({ label: 'Change the plan dates', on: () => location.assign(O.askHref(r, 'Propose new start and end dates for ' + r.title)) });
66
- // P7 (program-hierarchy PRD): an initiative in no program can become one; the chat cannot, because every program write is a page press
67
- if (r.id && O.turnProgram && !(O.programOf && O.programOf(r))) more.push({ label: 'Turn into a program', on: () => O.turnProgram(r) });
68
- // an initiative in a program can move out of it, or to another one (feedback batch 11 item 2, canvas LpA1More, LpA2Other; pm/prog-move.js)
69
- const mv = r.id && O.moveItems ? O.moveItems(r) : [];
70
- // split it into a new initiative, or merge it into another, above the program moves (batch 11 item 14, canvas XsmA1Menu; pm/split-merge.js)
71
- const sm = r.id && O.smItems ? O.smItems(r) : [];
72
- if (sm.length || mv.length) more.push({ sep: true }, ...sm, ...mv);
73
- if ((O.M() || {}).jira) more.push({ sep: true }, { label: 'Read Jira again', on: () => O.refreshJira() });
74
- more.push({ sep: true });
75
- if (r.id) more.push({ label: 'Copy link', on: () => copyText(new URL(O.pageHref(r), location.href).href, 'Link copied.') });
76
- more.push({ label: 'Copy as text', on: () => copyText(iniText(r), 'Copied as text.') });
77
- return more;
66
+ /* ── ⋯: the ONE initiative menu (pm/ini-more.js, feedback batch 14 item 5), the same words and order as Home's initiative page ── */
67
+ const LAY = new Map(); // the initiative's layout record (GET /api/initiative-layout): its own Moves on by itself, read when the panel opens
68
+ const ownWf = (r) => !!(r.wf && r.wf.id && r.wf.id !== 'product-feature' && Array.isArray(r.wfStages) && r.wfStage);
69
+ const where = (r) => { const B = (O.M() || {}).board || {}; return { ws: r.ws || B.ws, board: r.boardId || B.id }; };
70
+ async function readLay(r) {
71
+ if (!r.id || ownWf(r) || LAY.has(r.id)) return;
72
+ LAY.set(r.id, null);
73
+ const ws = where(r).ws, x = await pmGet('/api/initiative-layout?initiative=' + encodeURIComponent(r.id) + (ws ? '&ws=' + encodeURIComponent(ws) : '')).catch(() => null);
74
+ LAY.set(r.id, x && x.ok ? x : { auto: true, held: [] });
75
+ }
76
+ /** Where the row's stage can move, as Home reads it (home-ini-model.js moveModel): a workflow of the library moves between ITS stages. */
77
+ function moveOf(r) {
78
+ const a = r.acts || {}, acts = { stages: a.stages || [], stage: a.stage || '', self: !!((O.M() || {}).board || {}).self, life: a.life || null };
79
+ let L = LAY.get(r.id) || { auto: true, held: [] };
80
+ if (ownWf(r)) {
81
+ const st = r.wfStages.filter((s) => s.status !== 'skipped' || s.key === r.wfStage.key), cur = r.wfStages.find((s) => s.key === r.wfStage.key) || {};
82
+ Object.assign(acts, { stages: st.map((s) => s.name), stage: r.wfStage.name, msNames: st.filter((s) => s.milestone).map((s) => s.name), self: false });
83
+ L = { auto: !!cur.auto, held: [] };
84
+ }
85
+ if (r.ended) acts.life = 'ended';
86
+ return MD.moveModel(null, { acts }, L);
87
+ }
88
+ /** Moves on by itself for this one initiative: a library workflow's stage (POST /api/boards/ini-auto), else the layout record. */
89
+ async function setAuto(r, on) {
90
+ const res = ownWf(r) ? await pmPost('/api/boards/ini-auto', { ...where(r), id: r.id, stage: r.wfStage.key, auto: on }).catch(() => null)
91
+ : await pmPost('/api/initiative-layout', { ws: where(r).ws, initiative: r.id, kind: 'auto', on }).catch(() => null);
92
+ if (!res || res.ok === false) { O.toast((res && res.error) || 'Nothing was changed.'); return; }
93
+ if (!ownWf(r)) LAY.set(r.id, res);
94
+ O.toast('Moves on by itself: ' + (on ? 'on' : 'off') + ' · ' + r.title + '.');
95
+ if (O.reload) O.reload();
96
+ }
97
+ /** What ini-wf.js needs from the page (Change workflow, Won't do, Back to Triage, Archive): the popovers of pm/hi-pop.js, the Board's toast. */
98
+ function wfUi() {
99
+ const byId = (id) => ((O.M() || {}).rows || []).find((x) => x.id === id) || {};
100
+ return { openPop, closePop, undoToast: (t, undo) => O.toast(t, undo), toast: (t) => O.toast(t), pmGet, pmPost, load: async () => { if (O.reload) await O.reload(); },
101
+ row: byId, title: (id) => byId(id).title || id, bw: (id) => where(byId(id)) };
78
102
  }
79
- /** The initiative as plain text, for Copy as text: the summary, the stage and the open tasks. */
80
- function iniText(r) {
81
- const v = viewOf(r), s = v.summary, lines = [r.title, s.line + (s.right ? ' · ' + s.right : '')];
82
- if (s.text) lines.push(s.text);
83
- lines.push('', v.stage.name + (v.stage.n ? ' · ' + v.stage.n + ' of ' + v.stage.of : '') + (v.stage.doneOf ? ' · ' + v.stage.doneOf : ''));
84
- for (const sec of v.tasks.sections) for (const x of sec.top || []) lines.push('- ' + x.title + (x.sub ? ' · ' + x.sub : ''));
85
- for (const k of ((r.track && r.track.tickets) || []).filter((x) => x.status !== 'Done')) lines.push('- ' + k.key + ' ' + k.title + ' · ' + tkState(k) + (k.assignee ? ' · ' + k.assignee : ''));
86
- return lines.join('\n');
103
+ /** The stakeholder form, as Home's (POST /api/home-desk/stakeholder), a drill-in of the initiative: ← comes back to it. */
104
+ function addPerson(r) {
105
+ VW.drill();
106
+ const body = VW.open({ id: 'person:new', kind: 'Stakeholder', title: 'Add a stakeholder to ' + r.title, icon: 'info', back: true,
107
+ html: '<div class="hi-form"><label class="hi-field"><span>Name</span><input id="hpN" autocomplete="off"></label><label class="hi-field"><span>Role</span><input id="hpR" placeholder="e.g. Head of Sales"></label><label class="hi-field"><span>Note</span><input id="hpT" placeholder="What they care about"></label><div class="hi-acts"><button type="button" class="hi-btn dark" data-hp-add>Add</button></div></div>' });
108
+ setTimeout(() => { const i = body.querySelector('#hpN'); if (i) i.focus(); }, 0);
109
+ body.onclick = async (e) => {
110
+ if (!e.target.closest('[data-hp-add]')) return;
111
+ const name = body.querySelector('#hpN').value.trim(); if (!name) return;
112
+ const res = await pmPost('/api/home-desk/stakeholder', { ws: where(r).ws, initiative: r.id, name, role: body.querySelector('#hpR').value.trim(), note: body.querySelector('#hpT').value.trim() }).catch(() => null);
113
+ if (res && res.ok) { O.toast('Added ' + name + '.'); openIni(O.rowOf(r.key) || r); } else O.toast((res && res.error) || 'Not added.');
114
+ };
115
+ }
116
+ function iniMore(r) {
117
+ const M = O.M() || {}, a = r.acts || null, self = !!(M.board || {}).self, mv = moveOf(r), id = r.id;
118
+ const live = a && !a.life && !r.ended && !a.archived;
119
+ return iniMoreOf({
120
+ wf: id && !self && !r.ended ? { name: (r.wf || {}).name, on: (b) => WF.openPicker(b, wfUi(), id) } : null,
121
+ rename: O.rename && id ? () => { const t = document.querySelector('#czViewer [data-cz-vw-rn]'); if (t) t.click(); } : null,
122
+ auto: id && !mv.why ? { on: mv.auto, press: () => setAuto(r, !mv.auto) } : null,
123
+ back: id && a && mv.canBack ? { prev: mv.prev, on: (b) => O.moreAct(r, 'back:' + mv.prev, b) } : null,
124
+ toStage: id && live && !self && (a.stages || []).length > 1 ? (b) => O.moreAct(r, 'stage', b) : null,
125
+ dates: id ? () => location.assign(O.askHref(r, 'Propose new start and end dates for ' + r.title)) : null,
126
+ person: id ? () => addPerson(r) : null,
127
+ // split or merge, then the program moves (batch 11 items 2 and 14; pm/split-merge.js, pm/prog-move.js)
128
+ sm: id && O.smItems && !r.ended ? O.smItems(r) : [],
129
+ pm: id && O.moveItems ? O.moveItems(r) : [],
130
+ turnProgram: id && O.turnProgram && !(O.programOf && O.programOf(r)) ? () => O.turnProgram(r) : null,
131
+ jira: M.jira ? () => O.refreshJira() : null,
132
+ record: id ? async () => { VW.drill(); (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: r.title, ...where(r) }); } : null,
133
+ link: id ? () => copyText(new URL(O.pageHref(r), location.href).href, 'Link copied.') : null,
134
+ text: () => copyText(iniText(r.title, viewOf(r), (r.track && r.track.tickets) || []), 'Copied as text.'),
135
+ ended: !!r.ended,
136
+ wontDo: id && !self ? (b) => WF.openWontDo(b, wfUi(), id) : null,
137
+ backToTriage: id && !self ? () => WF.backToTriage(wfUi(), id) : null,
138
+ archive: id && !self && !(a && a.archived) ? () => WF.archive(wfUi(), id) : null,
139
+ hold: id && live && O.moreAct ? (b) => O.moreAct(r, 'hold', b) : null,
140
+ resume: id && a && a.life === 'hold' && !r.ended && O.moreAct ? (b) => O.moreAct(r, 'resume', b) : null,
141
+ cancel: id && live && O.moreAct ? (b) => O.moreAct(r, 'cancel', b) : null,
142
+ });
87
143
  }
88
144
  function iniBody(r) {
89
145
  const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10);
@@ -142,8 +198,10 @@ export function openIni(r, from, o = {}) {
142
198
  if (!O || !r || !r.track) return;
143
199
  adding = o.addTo != null ? r.key : null; addTo = o.addTo || ''; addDates = o.addDates || null;
144
200
  // a row with no record id has no chat of its own: its question goes to the board's chat
145
- VW.open({ kind: 'Initiative', title: r.title, icon: 'flag', id: vidOf(r), url: r.id ? O.pageHref(r) : '', full: true,
146
- discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: iniMore(r), rename: O.rename ? O.rename(r) : null,
201
+ readLay(r); // Moves on by itself shows once the layout record is read
202
+ // the same tile as Home's initiative page; no "Open in full": the header's expand already opens it wide (batch 14 item 5)
203
+ VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', id: vidOf(r),
204
+ discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => iniMore(O.rowOf(r.key) || r), rename: O.rename ? O.rename(r) : null,
147
205
  render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
148
206
  onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
149
207
  }
@@ -182,4 +240,4 @@ export function refresh() {
182
240
  }
183
241
  export function close() { if (cur) { cur = null; VW.close(); } }
184
242
  export const shown = () => (cur ? cur.key : null);
185
- export function mount(o) { O = o; }
243
+ export function mount(o) { O = o; ensurePopCss(); }
@@ -1,13 +1,13 @@
1
1
  /* pm/bd-pin-card.css — the ◇ card on the Board timeline (feedback batch 13 item 4, XcalmA5Milestones): the initiative's milestones with a pin each.
2
2
  * The card is a pm/bd-pop.js popover; the Filter's "Milestones on the timeline" group uses the Filter's own chips. */
3
3
  .bd-pp.bd-pc { padding: 12px 12px 6px; }
4
- .bd-pc-h { margin: 0; font: 800 13.5px/1.3 var(--cz-sans); color: var(--cz-ink); }
5
- .bd-pc-sub { margin: 2px 0 6px; font-size: 12px; font-weight: 600; }
4
+ .bd-pc-h { margin: 0; font: 800 var(--fs-3)/1.3 var(--cz-sans); color: var(--cz-ink); }
5
+ .bd-pc-sub { margin: 2px 0 6px; font-size: var(--fs-2); font-weight: 600; }
6
6
  .bd-pc-r { display: flex; align-items: center; gap: 10px; min-height: 44px; border-top: 1px solid var(--cz-hair); }
7
7
  .bd-pc-r .tg-tm-i { margin-left: 4px; }
8
- .bd-pc-n { flex: 1; min-width: 0; font: 700 13px/1.25 var(--cz-sans); color: var(--cz-ink2); overflow-wrap: anywhere; }
8
+ .bd-pc-n { flex: 1; min-width: 0; font: 700 var(--fs-2)/1.25 var(--cz-sans); color: var(--cz-ink2); overflow-wrap: anywhere; }
9
9
  .bd-pc-r.on .bd-pc-n { color: var(--cz-ink); }
10
- .bd-pc-n small { display: block; font-size: 11.5px; font-weight: 600; color: var(--cz-ink3); }
10
+ .bd-pc-n small { display: block; font-size: var(--fs-1); font-weight: 600; color: var(--cz-ink3); }
11
11
  .bd-pc-n small.late { color: var(--cz-late); }
12
12
  .bd-pc-pin { all: unset; flex: none; width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink3); cursor: pointer; }
13
13
  .bd-pc-pin svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@@ -27,7 +27,10 @@ function cardHtml(r, msId) {
27
27
  if (!L.length) return `<p class="bd-pc-h">${esc(r.title)}</p><p class="bd-amut bd-pc-sub">No milestone yet. Flag a task as a milestone ◇ in the initiative's Tasks.</p>`;
28
28
  const m0 = L.find((m) => m.id === msId) || null, on = shownMs(r).length;
29
29
  const head = m0 ? `<p class="bd-pc-h">${esc(m0.name)}</p><p class="bd-amut bd-pc-sub">${esc(when(m0.date))} · ${on} of ${L.length} ${L.length === 1 ? 'milestone' : 'milestones'} on the timeline</p>`
30
- : `<p class="bd-pc-h">${esc(r.title)}</p><p class="bd-amut bd-pc-sub">${on} of ${L.length} ${L.length === 1 ? 'milestone' : 'milestones'} on the timeline</p>`;
30
+ : r.end && /^\d{4}-\d{2}-\d{2}/.test(String(r.end))
31
+ // the row's plain end ◇ (no milestone task stands for it): the card says what the row's label says, "Deliver Jun 9 ’27" (batch 14 item 1)
32
+ ? `<p class="bd-pc-h">${esc(r.track && r.track.k >= 6 ? 'Evaluate' : 'Deliver')} ${esc(when(String(r.end).slice(0, 10)))}</p><p class="bd-amut bd-pc-sub">The end of ${esc(r.title)} · ${on} of ${L.length} ${L.length === 1 ? 'milestone' : 'milestones'} on the timeline</p>`
33
+ : `<p class="bd-pc-h">${esc(r.title)}</p><p class="bd-amut bd-pc-sub">${on} of ${L.length} ${L.length === 1 ? 'milestone' : 'milestones'} on the timeline</p>`;
31
34
  const row = (m) => {
32
35
  const p = isPinned(r, m), late = !m.done && m.date < today;
33
36
  const say = (p ? 'Shown on the timeline: ' : 'Show on the timeline: ') + m.name;
@@ -22,6 +22,8 @@
22
22
  * · the milestone track: 3 milestones, the earlier done ones in a done cluster and the later ones in "N more"; both open Milestones
23
23
  * · the folding rows (were tabs): Waits on you · On the program (its tasks, Done folded) · On its initiatives and On their epics (every
24
24
  * open task, by level; each opens in Home) · Initiatives (per product, with their first tasks, what waits on you and their epics) · Milestones (Done, Next, Later; a program check's diamond marks it) · Documents (the charter, the PRDs, …)
25
+ * · first, the goal Claude drafted (pm/metric-drafts.js, canvas Iq9Program): the dashed "✦ Proposed goal" card, and once kept its Goal
26
+ * row with Undo; nothing when nothing is drafted (GET /api/metric-drafts, scope program)
25
27
  * An initiative in another product is read from that product's board (GET /api/board-premium?ws=). Per product the panel also reads, once per
26
28
  * page load: its KRs' names (GET /api/boards/anchors, the OKR files), whether each KR is met (GET /api/insights-premium, the goals Insights
27
29
  * shows) and its PMOS tasks (GET /api/boards/items). A part whose read failed is left out, never guessed. Every fold is kept in this browser. */
@@ -35,6 +37,7 @@ import { copyText } from './cozy-xv.js';
35
37
  import { programRename } from './rename-press.js';
36
38
  import { openCharter as charterForm, renamed as charterRenamed } from './program-charter.js';
37
39
  import * as MSG from './ms-suggest.js';
40
+ import * as MD from './metric-drafts.js'; // the goal Claude drafts when the charter has none (batch 15 item 1, canvas Iq9Program)
38
41
 
39
42
  const SV = (d, w) => `<svg viewBox="0 0 24 24" width="${w || 18}" height="${w || 18}" aria-hidden="true"><path d="${d}"/></svg>`;
40
43
  const I = {
@@ -110,6 +113,8 @@ function readMore(p) {
110
113
  });
111
114
  }
112
115
  }
116
+ /** The goal Claude drafted for the program (GET /api/metric-drafts, scope program), once per page load; the panel draws again when it arrives. */
117
+ const readDrafts = (p) => MD.want(p.home || board().ws || '', 'program', p.id, () => { if (cur && cur.id === p.id) draw(true); });
113
118
  const moreAt = (ws) => MORE.get(ws || board().ws || '') || {};
114
119
  /** What waits on you in an initiative: its track's next action that is yours (the Board's trail), or the one its own board's trail says. */
115
120
  const youOf = (i) => (i.row.track && i.row.track.you) || (moreAt(i.ws).you || {})[i.id] || '';
@@ -343,7 +348,7 @@ function bodyHtml(p) {
343
348
  ];
344
349
  // Home on a phone (O.talk gives a function): the program's own chat is not beside the panel, so the panel ends with the way to it
345
350
  const talk = O && O.talk && O.talk() ? `<button type="button" class="hi-talk" data-pp="talk">Message Claude about ${esc(p.title)}</button>` : '';
346
- return VW.czSummary(summaryOf(p, st)) + goalsHtml(st) + trackHtml(st, p) + VW.czSections(rows, { key: 'program' }) + talk;
351
+ return MD.progHtml(p, p.home || board().ws || '') + VW.czSummary(summaryOf(p, st)) + goalsHtml(st) + trackHtml(st, p) + VW.czSections(rows, { key: 'program' }) + talk;
347
352
  }
348
353
  /** The ◆ dates this page reads for the program's initiatives (a Jira slip moves one too). A change from what the server last heard asks Claude
349
354
  * to review once (POST /api/programs/facts); each reading is sent once per page load. */
@@ -360,7 +365,7 @@ const shownHere = () => { const c = VW.current && VW.current(); return !!(cur &&
360
365
  function draw(keepFocus) {
361
366
  if (!cur || !shownHere()) return;
362
367
  const p = progOf(cur.id); if (!p) { VW.close(); return; }
363
- readAway(p); readMore(p);
368
+ readAway(p); readMore(p); readDrafts(p);
364
369
  const b = VW.body(); if (!b) return;
365
370
  const f = keepFocus && document.activeElement && b.contains(document.activeElement) ? document.activeElement : null;
366
371
  const sel = f ? (f.dataset.pp ? `[data-pp="${f.dataset.pp}"]` + (f.dataset.fold ? `[data-fold="${CSS.escape(f.dataset.fold)}"]` : '') + (f.dataset.key ? `[data-key="${CSS.escape(f.dataset.key)}"]` : '') + (f.dataset.ms ? `[data-ms="${CSS.escape(f.dataset.ms)}"]` : '') : f.dataset.czsFold ? `[data-czs-fold="${CSS.escape(f.dataset.czsFold)}"]` : null) : null;
@@ -421,8 +426,8 @@ function openPanel(id, from) {
421
426
  { const q = progOf(id); if (q && VW.current() && VW.current().title !== titleOf(q)) VW.retitle('program:' + id, titleOf(q)); } // a rename in the charter, on ←
422
427
  cur = { id, from: from && !(VW.body() && VW.body().contains(from)) ? from : (cur && cur.id === id && cur.from) || null };
423
428
  body.classList.add('pp-vw');
424
- const q = progOf(id); if (q) { readAway(q); readMore(q); body.innerHTML = bodyHtml(q); }
425
- body.onclick = (e) => { const m = e.target.closest('[data-ms-act]'); if (m && body.contains(m) && !m.disabled) { suggestPress(m); return; } const b = e.target.closest('[data-pp]'); if (b && body.contains(b)) press(b); };
429
+ const q = progOf(id); if (q) { readAway(q); readMore(q); readDrafts(q); body.innerHTML = bodyHtml(q); }
430
+ body.onclick = (e) => { const d = e.target.closest('[data-md]'); if (d && body.contains(d) && !d.disabled) { MD.press(d, { redraw: () => draw(), toast: (t) => O.say(t) }); return; } const m = e.target.closest('[data-ms-act]'); if (m && body.contains(m) && !m.disabled) { suggestPress(m); return; } const b = e.target.closest('[data-pp]'); if (b && body.contains(b)) press(b); };
426
431
  body.onsubmit = submit;
427
432
  document.querySelectorAll('#ibBody [data-prow]').forEach((x) => x.classList.toggle('sel', x.dataset.prow === id));
428
433
  },
@@ -209,9 +209,11 @@ function qBar(r, X, now, phone, fmt, pxPct, ms = {}) {
209
209
  const sw = slipWords(r, e); if (sw) hover.push(sw);
210
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
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));
212
+ // the ◇ and its label carry the milestone's own date; the initiative's end, when it differs, is the hover (batch 14 item 1)
213
+ const ed = et ? day(et.date) : e; if (+ed !== +e) hover.push('Initiative ends ' + dy(e, now));
214
+ const name = landsOf(r, et), eTitle = name + ' · ' + md(ed) + (et && et.stage ? ' · ◆ ' + et.stage : '') + (et && et.done ? ' · done' : isLate ? ' · late' : '');
215
+ 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(ed))}" aria-haspopup="dialog" aria-label="${esc(eTitle + '. Milestones of ' + r.title)}" title="${esc(eTitle + (clash ? '. ' + clash : ''))}"></button>`;
216
+ out += endLabel(Math.max(X(e), X(ed), over ? X(now) : 0, late ? X(fc) : 0), name, ed, isLate ? 'late' : risk, now, pxPct, hover, slipHtml(r));
215
217
  } else if (fc) {
216
218
  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, [], '');
217
219
  } else if (r.draft && day(r.draft.start)) {
@@ -326,12 +328,15 @@ const lastMs = (r) => { const S = (r.wfStages || []).filter((x) => x && x.milest
326
328
  /** The ◆ stage a milestone task sits in, by name, or ''. */
327
329
  const msStage = (r, m) => { if (!m.sec) return ''; const st = (r.wfStages || []).find((x) => x.key === m.sec); return st ? (st.milestone ? st.name : '') : /^(deliver|evaluate)$/i.test(m.sec) ? m.sec.replace(/^./, (c) => c.toUpperCase()) : ''; };
328
330
  /** The milestone task the bar's end ◇ stands for, or null. The end ◇ is the workflow's last ◆ stage (Evaluate on Product feature): the latest
329
- * milestone task in that stage IS it, else one on the end's own day; it takes that task's name and done, and is not drawn twice. A task in an
330
- * earlier ◆ stage keeps its own ◇. M: the row's dated milestones. */
331
+ * milestone task in that stage IS it, else one on the end's own day, else the latest task in any ◆ stage (Deliver: batch 14 item 1, so a
332
+ * "rolled out" task in Deliver names the row's end). It takes that task's name, date and done, and is not drawn twice. A task outside the ◆
333
+ * stages keeps its own ◇. M: the row's dated milestones. */
331
334
  function endTask(r, M) {
332
- const e = day(r.end); if (!e) return null;
333
- const last = lastMs(r), inLast = M.filter((m) => m.sec && m.sec.toLowerCase() === last);
334
- const end = inLast.length ? inLast[inLast.length - 1] : M.find((m) => +day(m.date) === +e) || null;
335
+ const e = day(r.end); if (!e || !M.length) return null;
336
+ const S = M.slice().sort((a, b) => day(a.date) - day(b.date));
337
+ const last = lastMs(r), inLast = S.filter((m) => m.sec && m.sec.toLowerCase() === last);
338
+ const inMs = S.filter((m) => msStage(r, m));
339
+ const end = inLast.length ? inLast[inLast.length - 1] : S.find((m) => +day(m.date) === +e) || inMs[inMs.length - 1];
335
340
  return end ? { ...end, stage: msStage(r, end) } : null;
336
341
  }
337
342
  /** One ◇ per milestone task the Filter shows (batch 13 item 4, XcalmA5Milestones; pm/bd-pins.js shownMs: the pinned ones, by default the last),
@@ -368,7 +373,7 @@ export function laneMilestones(rows, now) {
368
373
  for (const m of M) if (!et || m.id !== et.id) out.push({ id: m.id, name: m.name, date: m.date, done: !!m.done, late: msLate(m, now), row: r });
369
374
  if (!s || !e) continue;
370
375
  const ob = openBack(r, now), late = (r.over && now > e) || (ob && ob > e) || (et && msLate(et, now));
371
- out.push({ id: et ? et.id : '', name: et ? et.name : r.track && r.track.k >= 6 ? 'Evaluate' : 'Deliver', date: iso(e), done: !!(et && et.done), late: !!late, row: r });
376
+ out.push({ id: et ? et.id : '', name: et ? et.name : r.track && r.track.k >= 6 ? 'Evaluate' : 'Deliver', date: et ? String(et.date).slice(0, 10) : iso(e), done: !!(et && et.done), late: !!late, row: r });
372
377
  }
373
378
  return out.sort((a, b) => day(a.date) - day(b.date));
374
379
  }
@@ -492,11 +497,16 @@ function scaled(rows, M, o) {
492
497
  // program's initiatives were missing from their product on the timeline)
493
498
  // By product, a program's undated initiative keeps its "No dates" row under its product too (batch 11 item 19: they disappeared once grouped by product)
494
499
  const onList = new Set(list.map((r) => r.key));
500
+ // a product with no dated initiative keeps its head and its initiatives as "No dates" rows, so the product is not missing from the Board
501
+ // (batch 14 item 2: pmos-microsites, all undated outside its program, had no group at all); those rows leave the foot's names
502
+ const keepOf = (R) => { const k = R.filter((r) => onList.has(r.key) || r.inProgram); return k.length ? k : R.slice(); };
503
+ const shownNd = new Set(o.groups ? o.groups.filter((g) => g.kind !== 'program' && !g.rows.some((r) => onList.has(r.key) || r.inProgram)).flatMap((g) => g.rows.map((r) => r.key)) : []);
504
+ const footNone = none.filter((r) => !shownNd.has(r.key));
495
505
  // a timeline reads in time (batch 11 item 22): each group's rows by start, then end; undated ones last. The health dot still says late or at risk
496
506
  const at = (r) => { const x = extentOf(r, now); return x ? [+x.a, +x.b] : [Infinity, Infinity]; };
497
507
  const byTime = (L) => L.map((r) => [at(r), r]).sort((p, q) => p[0][0] - q[0][0] || p[0][1] - q[0][1]).map((x) => x[1]);
498
508
  list.splice(0, list.length, ...byTime(list));
499
- const G = o.groups ? o.groups.map((g) => (g.kind === 'program' ? { ...g, products: g.products.filter((x) => x.rows.length).map((x) => ({ ...x, rows: byTime(x.rows) })) } : { ...g, rows: byTime(g.rows.filter((r) => onList.has(r.key) || r.inProgram)) })).filter((g) => g.rows.length || g.kind === 'program') : null;
509
+ const G = o.groups ? o.groups.map((g) => (g.kind === 'program' ? { ...g, products: g.products.filter((x) => x.rows.length).map((x) => ({ ...x, rows: byTime(x.rows) })) } : { ...g, rows: byTime(keepOf(g.rows)) })).filter((g) => g.rows.length || g.kind === 'program') : null;
500
510
  const empty = '<p class="tg-empty">No initiative on screen has a date on record.</p>';
501
511
  const ext = (r) => { const x = extentOf(r, now); return x ? ` data-a="${X(x.a).toFixed(3)}" data-b="${X(x.b).toFixed(3)}"` : ''; };
502
512
  // a product's head carries its lane from Quarter on (batch 11 item 17); Sprint on a phone, and a page that gives no head cell, keep the plain head
@@ -510,7 +520,7 @@ function scaled(rows, M, o) {
510
520
  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(''));
511
521
  }).join('') : list.map(one).join('');
512
522
  const top = `<div class="tgq-h"><div class="tg-p">${ticks}${pill}</div></div>`;
513
- const below = none.length ? `<div class="tg-none"><span>${none.length} ${none.length === 1 ? 'has' : 'have'} no dates</span>${askBtn}</div>` : '';
523
+ const below = none.length ? `<div class="tg-none">${footNone.length ? `<span>${footNone.length} ${footNone.length === 1 ? 'has' : 'have'} no dates</span>` : ''}${askBtn}</div>` : '';
514
524
  // the Deliveries lane (batch 13 item 4, XcalmA6Phone): a phone shows the next deliveries above the rows (o.lane draws it; none: nothing)
515
525
  const lanePh = o.lane ? o.lane({ W, X, rows: list, groups: G, now, phone: true, pxPct }) || '' : '';
516
526
  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 };
@@ -529,7 +539,7 @@ function scaled(rows, M, o) {
529
539
  // the sprint band and the release keep their labels under the axis on Quarter, where a week is wide enough to read them
530
540
  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>` : ''}` : '';
531
541
  const axis = axl ? `<div class="tg-ax"><span class="tg-n"></span><div class="tg-p">${axl}</div></div>` : '';
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>` : '';
542
+ const foot = none.length ? `<div class="tg-ft">${footNone.length ? `<span class="tg-none"><b>${footNone.length} ${footNone.length === 1 ? 'has' : 'have'} no dates:</b> <span>${esc(footNone.slice(0, 4).map((r) => r.title).join(', '))}${footNone.length > 4 ? ' and ' + (footNone.length - 4) + ' more' : ''}</span>${askBtn}</span>` : `<span class="tg-none">${askBtn}</span>`}</div>` : '';
533
543
  // the Deliveries lane (batch 13 item 4, XcalmA6Lane): one row under the axis, a list per column (o.lane draws it; none: nothing)
534
544
  const laneH = o.lane ? o.lane({ W, X, rows: list, groups: G, now, phone: false, pxPct }) || '' : '';
535
545
  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 };
@@ -4,6 +4,6 @@
4
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
5
  .vzx-aud .aud-sec .vzx-page { margin: 0 auto; font-size: 24px; }
6
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); }
7
+ .vzx-aud .aud-wait { font-size: var(--fs-3); color: var(--cz-c-9aa1ab); }
8
8
  .vzx-aud .aud-img { max-width: 100%; max-height: 100%; display: block; }
9
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 */