create-pmos 0.440.0 → 0.442.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 (95) 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/adler-seasons-art-test.js +106 -0
  7. package/workspace/adler-seasons-test.js +111 -0
  8. package/workspace/briefing-premium-adddoc-test.js +16 -13
  9. package/workspace/briefing-premium-board-test.js +19 -17
  10. package/workspace/briefing-premium-initiative-test.js +7 -4
  11. package/workspace/briefing-premium-products-test.js +4 -4
  12. package/workspace/briefing-premium-sources-test.js +2 -2
  13. package/workspace/briefing-premium-test.js +29 -23
  14. package/workspace/changelog.json +24 -0
  15. package/workspace/guide/adler.md +10 -0
  16. package/workspace/guide/core-documents.md +2 -2
  17. package/workspace/guide/data-freshness.md +7 -5
  18. package/workspace/guide/home.md +3 -1
  19. package/workspace/guide/horizon-scan.md +1 -1
  20. package/workspace/ini-workflow-test.js +6 -2
  21. package/workspace/lib/agent-inbox.js +20 -2
  22. package/workspace/lib/briefing-premium-sources.js +3 -0
  23. package/workspace/lib/briefing-premium.js +37 -7
  24. package/workspace/lib/driver-cli.js +1 -1
  25. package/workspace/lib/driver-run.js +15 -1
  26. package/workspace/lib/driver.js +31 -2
  27. package/workspace/lib/news-for-you.js +24 -9
  28. package/workspace/lib/pm-idle.js +12 -0
  29. package/workspace/lib/refresh.js +17 -8
  30. package/workspace/lib/routes-core-docs.js +1 -1
  31. package/workspace/lib/routes-news.js +15 -1
  32. package/workspace/lib/routes-phone-day.js +6 -4
  33. package/workspace/lib/settings-store.js +38 -0
  34. package/workspace/metric-drafts-ui-test.js +2 -2
  35. package/workspace/need-shot.js +57 -0
  36. package/workspace/news-viewers-test.js +183 -0
  37. package/workspace/package-lock.json +2 -2
  38. package/workspace/package.json +1 -1
  39. package/workspace/premium-board-actions-test.js +2 -1
  40. package/workspace/premium-chat-attach-test.js +2 -0
  41. package/workspace/premium-core-doc-issue-test.js +9 -8
  42. package/workspace/program-panel-test.js +1 -1
  43. package/workspace/public/pm/bd-ini-panel.js +6 -13
  44. package/workspace/public/pm/c3-ini-ui.js +1 -1
  45. package/workspace/public/pm/cozy-adler.css +21 -0
  46. package/workspace/public/pm/cozy-adler.js +415 -8
  47. package/workspace/public/pm/cozy-ev.css +44 -0
  48. package/workspace/public/pm/cozy-home.css +8 -0
  49. package/workspace/public/pm/cozy-news.js +186 -22
  50. package/workspace/public/pm/cozy-seasons.js +318 -0
  51. package/workspace/public/pm/cozy-settings.js +88 -5
  52. package/workspace/public/pm/cozy-today.css +5 -0
  53. package/workspace/public/pm/cozy-viewer.js +12 -7
  54. package/workspace/public/pm/cozy-vw-shell.css +49 -0
  55. package/workspace/public/pm/cozy.css +65 -0
  56. package/workspace/public/pm/dash-view.js +4 -2
  57. package/workspace/public/pm/home-adddoc.js +46 -26
  58. package/workspace/public/pm/home-app.js +142 -114
  59. package/workspace/public/pm/home-chat.js +1 -1
  60. package/workspace/public/pm/home-day.js +17 -9
  61. package/workspace/public/pm/home-draft.js +35 -23
  62. package/workspace/public/pm/home-ini.js +4 -4
  63. package/workspace/public/pm/home-mentions.js +1 -1
  64. package/workspace/public/pm/home-need.js +336 -0
  65. package/workspace/public/pm/home-today.js +2 -2
  66. package/workspace/public/pm/home-work.js +51 -4
  67. package/workspace/public/pm/impact.js +1 -1
  68. package/workspace/public/pm/ini-groups.js +15 -10
  69. package/workspace/public/pm/ini-links.js +1 -1
  70. package/workspace/public/pm/ini-tasks.js +208 -44
  71. package/workspace/public/pm/ini-view-model.js +8 -2
  72. package/workspace/public/pm/ini-view.css +305 -1
  73. package/workspace/public/pm/ini-view.js +190 -80
  74. package/workspace/public/pm/mission.js +234 -0
  75. package/workspace/public/pm/premium-board.js +1 -1
  76. package/workspace/public/pm/premium-welcome.js +2 -2
  77. package/workspace/public/pm/small-vw.js +128 -0
  78. package/workspace/public/pm/split-merge.js +1 -1
  79. package/workspace/public/pm/stage-line.js +2 -2
  80. package/workspace/server.js +10 -6
  81. package/workspace/skills/initiative-drive.skill +4 -1
  82. package/workspace/split-merge-ui-test.js +1 -1
  83. package/workspace/stage-card-test.js +48 -11
  84. package/workspace/task-links-test.js +2 -0
  85. package/workspace/task-milestones-test.js +5 -1
  86. package/workspace/task-plans-test.js +3 -3
  87. package/workspace/task-views-test.js +90 -37
  88. package/workspace/test-lists/adler-seasons-art.json +13 -0
  89. package/workspace/test-lists/batch18-adler-seasons.json +13 -0
  90. package/workspace/test-lists/batch18-asks.json +5 -0
  91. package/workspace/test-lists/mission.json +5 -0
  92. package/workspace/test-lists/news-viewers.json +13 -0
  93. package/workspace/test-lists/small-viewers.json +5 -0
  94. package/workspace/test-lists/viewer-tasks.json +5 -0
  95. package/workspace/tk-tasks-test.js +25 -30
@@ -12,7 +12,7 @@
12
12
  * Every press is the PM's and goes to the Work page's own route under /api/pm-items, /api/pm-jobs or /api/my-work (pmPost carries the launch
13
13
  * nonce); this file adds no writer. A refused press shows the route's reason and changes nothing. Text from the list goes through esc(). */
14
14
  import { pmGet, pmPost } from './http.js';
15
- import { open as vwOpen, close as vwClose } from './cozy-viewer.js';
15
+ import { open as vwOpen, close as vwClose, retitle as vwRetitle, setCheck as vwSetCheck, czSummary, czSections } from './cozy-viewer.js';
16
16
  import { mdRender } from './markdown.js';
17
17
  import { tabsHtml } from './home-review.js';
18
18
 
@@ -55,13 +55,16 @@ const freshUi = () => ({ xp: null, ed: null, dd: '', sn: '', ask: null, body: nu
55
55
  /** Open My work in the Viewer on one tab (yours | waiting | review | stale). */
56
56
  export function openMyWork(tab = 'yours', o = {}) {
57
57
  if (tab === 'review' && askReview()) return null;
58
- const W = { solo: !!o.solo, home: o.view || null, r: null, M: null, tab: TABS.some((t) => t[0] === tab) || tab === 'review' ? tab : 'yours', msg: '', view: null, key: null, ui: freshUi(), refocus: null, want: o.item || null };
58
+ const W = { solo: !!o.solo, own: !!(o.solo && o.item), home: o.view || null, r: null, M: null, tab: TABS.some((t) => t[0] === tab) || tab === 'review' ? tab : 'yours', msg: '', view: null, key: null, ui: freshUi(), refocus: null, want: o.item || null };
59
59
  if (W.home) W.view = W.home;
60
60
  let body = null;
61
61
  const rowOf = (key) => ((W.M && W.M.rows) || []).find((r) => r.key === key) || null;
62
62
  const openR = () => (W.view === 'item' ? rowOf(W.key) : null);
63
63
  const focusIds = () => new Set(((W.M && W.M.focus && W.M.focus.suggestions[0]) || {}).item_ids || []);
64
64
  const setTitle = (t) => { const el = document.getElementById('czVwTitle'); if (el) el.textContent = t; };
65
+ // your own task opened alone: the header is the task's (its check, its name); it changes only when the name does
66
+ let ownT = '';
67
+ const ownHead = (r) => { if (ownT === r.title) return; ownT = r.title; vwRetitle('more:work', r.title); vwSetCheck('more:work', { state: 'todo', label: 'Mark ' + r.title + ' done', title: 'Done' }); };
65
68
 
66
69
  /* ── the list ── */
67
70
  function sideOf(r) {
@@ -189,7 +192,7 @@ export function openMyWork(tab = 'yours', o = {}) {
189
192
  + `<label class="mw-f"><span>Due</span><input type="date" id="xeD" class="mw-in" value="${esc(e.due)}"></label>`
190
193
  + `<div class="mw-f"><span>Priority</span><span class="hx-top" role="group" aria-label="Priority">${PRIS.map((p) => `<button type="button" class="hx-b" data-p="xpri" data-v="${p}" aria-pressed="${e.priority === p}">${p || 'None'}</button>`).join('')}</span></div>`
191
194
  + `<label class="mw-f"><span>Waiting on</span><input id="xeW" class="mw-in" maxlength="80" value="${esc(e.wo)}" placeholder="A name moves it to Waiting"></label>`
192
- + `<label class="mw-f"><span>Job</span><select id="xeJ" class="mw-in"><option value="">No job</option>${(W.M.jobs || []).map((j) => `<option value="${esc(j.id)}"${e.job === j.id ? ' selected' : ''}>${esc(j.name)}</option>`).join('')}</select></label>`
195
+ + (W.solo ? '' : `<label class="mw-f"><span>Job</span><select id="xeJ" class="mw-in"><option value="">No job</option>${(W.M.jobs || []).map((j) => `<option value="${esc(j.id)}"${e.job === j.id ? ' selected' : ''}>${esc(j.name)}</option>`).join('')}</select></label>`)
193
196
  + '<div class="hx-top"><button type="button" class="hx-b pri" data-p="xsave">Save</button><button type="button" class="hx-b" data-p="xt" data-k="edit">Cancel</button></div></div>';
194
197
  }
195
198
  if (x === 'steps') {
@@ -250,6 +253,44 @@ export function openMyWork(tab = 'yours', o = {}) {
250
253
  if (r.dialog.source) return h + srcHtml(r.dialog.source) + `<details class="mw-det"><summary>Details</summary>${kv}<p class="hx-n">${esc(p.file)}</p></details>`;
251
254
  return h + `<section class="mw-rec">${kv}<p class="hx-n">The item as your list holds it · ${esc(p.file)}</p></section>`;
252
255
  }
256
+ /* ── your own task, opened alone from Home (batch 18 item 2-C, canvas OvA9Docs): shell A. The header's check is Done, the title is the
257
+ * task's, "Your own task" under it, ⋯ holds Keep for later and Drop it (danger, last). The summary says when it is, with the agent's
258
+ * offer as the one primary ("Draft it") and the Not before icon; Steps, Waiting on, Priority and From are folds. No ids or file names. ── */
259
+ const SPARK = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/></svg>';
260
+ const CLOCK = 'M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18M12 7v5l3 2';
261
+ function ownHtml(r) {
262
+ const ui = W.ui, d = r.dialog, a = d.write.actions, e = d.edit, ag = d.agent, S = d.steps || [];
263
+ const when = whenOf(r), late = !!e.due && e.due < W.M.today;
264
+ const offer = ag && ag.state === 'suggest';
265
+ const words = offer ? (ag.ask ? ag.ask.replace(/\s*\.$/, '') + '. ' : '') + (ag.mine ? 'I can draft it here in PMOS. Nothing leaves PMOS.' : `I can draft it here in PMOS. Nothing goes to ${ag.where || 'anyone'} until you post it.`) : '';
266
+ const sum = czSummary({ line: late ? 'Due ' + dayLabel(e.due) + ', still open' : when[0] + (when[1] && !/^(not placed yet|you added it|off your lists until then)$/.test(when[1]) ? ' · ' + when[1] : ''), tone: late ? 'warn' : 'you',
267
+ text: offer || d.say === 'This is on your list.' ? '' : d.say || '', extra: offer ? `<p class="czf-spark">${SPARK}<span>${esc(words)}</span></p>` : '',
268
+ primary: offer ? { label: 'Draft it', act: 'ag-brief' } : null,
269
+ also: [{ act: 'when', label: d.defer && d.defer > W.M.today ? 'Not before ' + dayLabel(d.defer) + '. Change it' : 'Not before…', icon: CLOCK }] });
270
+ const whenPan = ui.xp === 'when' || ui.xp === 'defer' ? panelHtml(r, ui.xp) : '';
271
+ const mine = S.filter((x) => x.who !== 'you').length;
272
+ const dr = ag && ag.draft && (ag.draft.body || ag.draft.summary) ? ag.draft : null;
273
+ const sc = d.source, from = sc ? [sc.name, sc.where].filter(Boolean).join(' · ') : ((d.facts || []).find((f) => f[0] === 'From') || [0, ''])[1];
274
+ const rec = (d.pane.rows || []).filter(([k]) => k !== 'From');
275
+ const secs = czSections([
276
+ dr ? { id: 'draft', title: ag.state === 'sent' ? 'Posted' : 'The draft', open: true, html: `<div class="mw-md">${mdHtml(dr.body || dr.summary)}</div><div class="hx-top"><button type="button" class="hx-b" data-pp="copy">Copy</button></div>` } : null,
277
+ { id: 'steps', title: 'Steps', count: S.length ? S.length + (mine ? ' · ' + mine + ' for me' : '') : '', html: panelHtml(r, 'steps') },
278
+ a.includes('waiting') || e.waiting_on ? { id: 'wait', title: 'Waiting on', count: e.waiting_on || '', html: panelHtml(r, 'wait') } : null,
279
+ { id: 'pri', title: 'Priority', count: [e.priority || 'None', e.due ? 'due ' + dayLabel(e.due) : ''].filter(Boolean).join(' · '), html: panelHtml(r, 'edit') },
280
+ { id: 'from', title: 'From', count: from, html: sc ? srcHtml(sc) : rec.length ? `<dl class="hv-facts">${rec.map(([k, v]) => `<div><dt>${esc(k)}</dt><dd>${esc(v)}</dd></div>`).join('')}</dl>` : '' },
281
+ ], { key: 'own-task' });
282
+ return `<div class="mw-it mw-own" id="card" data-esc-layer>${sum}${whenPan ? `<div class="mw-ownwhen">${whenPan}</div>` : ''}<div id="agCard">${agCardInner(r)}</div>${secs}<p class="hx-n mw-err" id="cardErr" role="alert" hidden></p></div>`;
283
+ }
284
+ function ownMore() {
285
+ const r = openR(); if (!r) return [];
286
+ const a = r.dialog.write.actions;
287
+ return [
288
+ ...(a.includes('keep') ? [{ label: 'Keep for later', on: () => itemPress({ dataset: { p: 'keep' } }, r) }] : []),
289
+ ...(a.includes('flag') ? [{ label: 'Move to Today', on: () => itemPress({ dataset: { p: 'flag' } }, r) }] : []),
290
+ { sep: true },
291
+ { label: 'Drop it', danger: true, icon: 'M5 7h14M9 7V4h6v3M7 7l1 13h8l1-13', on: () => itemPress({ dataset: { p: 'remove' } }, r) },
292
+ ];
293
+ }
253
294
  function itemHtml(r) {
254
295
  const src = !!r.dialog.source;
255
296
  return `<div class="mw-sub mw-it ut-vc" data-esc-layer><div>${backBtn()}</div>`
@@ -290,6 +331,7 @@ export function openMyWork(tab = 'yours', o = {}) {
290
331
  const keep = body.scrollTop;
291
332
  if (!W.r) body.innerHTML = '<p class="hx-n">Reading My work.</p>';
292
333
  else if (!W.M) body.innerHTML = `<p class="hx-n">My work could not be read${W.r.error ? ': ' + esc(W.r.error) : ''}.</p>`;
334
+ else if (W.view === 'item' && openR() && W.own) { const r = openR(); body.innerHTML = ownHtml(r); ownHead(r); }
293
335
  else if (W.view === 'item' && openR()) { body.innerHTML = itemHtml(openR()); setTitle(openR().title); }
294
336
  else if (W.view === 'fjobs') { body.innerHTML = focusHtml(); setTitle('Focus and jobs'); }
295
337
  else if (W.solo) { vwClose(); return; } // opened alone from Home (an item, or Focus and jobs): there is no list behind it
@@ -449,6 +491,10 @@ export function openMyWork(tab = 'yours', o = {}) {
449
491
  if (t.dataset.pp === 'copy') { try { await navigator.clipboard.writeText(txt); toast('Draft copied.'); } catch { toast('Copy did not work here. Select the text and copy it.'); } return; }
450
492
  const u = URL.createObjectURL(new Blob([txt], { type: 'text/plain;charset=utf-8' })); window.open(u, '_blank', 'noopener'); setTimeout(() => URL.revokeObjectURL(u), 60000); return;
451
493
  }
494
+ if (t.dataset.czsAct && W.own && openR()) { // your own task's summary: Draft it, and the Not before icon opens When in place
495
+ if (t.dataset.czsAct === 'when') { W.ui.xp = W.ui.xp === 'when' || W.ui.xp === 'defer' ? null : 'when'; draw(W.ui.xp ? '.mw-ownwhen button' : '[data-czs-act="when"]'); return; }
496
+ itemPress({ dataset: { p: t.dataset.czsAct } }, openR()); return;
497
+ }
452
498
  if (t.dataset.p && openR()) { itemPress(t, openR()); return; }
453
499
  if (t.dataset.open) { openItem(t.dataset.open); return; }
454
500
  if (t.dataset.done) {
@@ -527,7 +573,8 @@ export function openMyWork(tab = 'yours', o = {}) {
527
573
  back();
528
574
  }
529
575
 
530
- body = vwOpen({ id: 'more:work', kind: W.solo ? (W.home === 'fjobs' ? 'Focus' : 'Task') : 'My work', title: W.solo ? (W.home === 'fjobs' ? 'Focus and jobs' : 'Task') : 'My work', icon: 'list', render: (b) => { b.classList.add('hx'); }, onClose: () => { removeEventListener('keydown', onEsc, true); clearInterval(timer); } });
576
+ body = vwOpen({ id: 'more:work', kind: W.solo ? (W.home === 'fjobs' ? 'Focus' : 'Task') : 'My work', title: W.solo ? (W.home === 'fjobs' ? 'Focus and jobs' : 'Task') : 'My work', icon: 'list',
577
+ ...(W.own ? { sub: 'Your own task', check: { state: 'todo', label: 'Mark done', title: 'Done' }, more: () => ownMore(), onPress: (a) => { if (a === 'check' && openR()) doneP(openR()); } } : {}), render: (b) => { b.classList.add('hx'); }, onClose: () => { removeEventListener('keydown', onEsc, true); clearInterval(timer); } });
531
578
  // delegated, as the other Home cards do: every control in the card is a real <button>; the drag repeats what the arrow keys do
532
579
  body.onclick = onClick;
533
580
  body.oninput = onInput;
@@ -177,7 +177,7 @@ export function madeHtml(x, W = W0) {
177
177
  // AdH2: Adler celebrates once, on the first view of this delivery (and at most once a week), in the small win scene; every later view is calm.
178
178
  // The diamond on the timeline stays plain and nothing is sent.
179
179
  const joy = celebrateOnce('made.' + x.ms.name + '.' + x.ms.date), scene = joy && adPrefs()['adler.amount'] === 'full';
180
- return `<section class="im im-made" aria-label="Who made it happen">${scene ? `<div class="im-win">${adlerScene('win', 'celebrating', { w: 500, h: 200, label: false })}</div>` : ''}<div class="im-mh">${scene ? '' : adler(joy ? 'celebrating' : 'handled', 44, { label: false })}<span class="im-tx"><b class="im-t">${esc(x.ms.name)} delivered on ${esc(x.ms.date)}.</b><span class="im-s">Here’s who made it happen.</span></span></div>`
180
+ return `<section class="im im-made" aria-label="Who made it happen">${scene ? `<div class="im-win">${adlerScene('win', 'celebrating', { w: 500, h: 200, label: false, dress: true })}</div>` : ''}<div class="im-mh">${scene ? '' : adler(joy ? 'celebrating' : 'handled', 44, { label: false })}<span class="im-tx"><b class="im-t">${esc(x.ms.name)} delivered on ${esc(x.ms.date)}.</b><span class="im-s">Here’s who made it happen.</span></span></div>`
181
181
  + `<div class="im-card">${x.people.map((p) => `<div class="im-row"><span class="im-av" aria-hidden="true">${initial(p.who)}</span><span class="im-tx"><b class="im-t">${esc(p.who)}</b><span class="im-s">${esc(p.what)}</span></span>`
182
182
  + `<a class="im-ib" href="${esc(p.url)}"${linkAttrs(p.url)} aria-label="Open ${esc(p.key || p.what)}" title="Open ${esc(p.key || 'the ticket')}">${svg(I.open, 20)}</a></div>`).join('')}</div>${LOCK}</section>`;
183
183
  }
@@ -4,7 +4,8 @@
4
4
  * itself is pure (ini-view-model.js groupBy, groupSections); this file reads what it needs, draws the presses and writes the PM's picks.
5
5
  *
6
6
  * view(v) → v with its Tasks grouped as the PM picked (tasks.by, tasks.sections, tasks.gsum); Stage leaves v as it is
7
- * headHtml(v) the group icon (layers) in the Tasks header, before the view switch; none while Tasks is empty or has no record id
7
+ * headHtml(v) "Showing <stage> only ✕" in the Tasks header while the stage card filters it; nothing else (Group by is in the view sheet)
8
+ * api(root, H) the view sheet's Group by row (pm/ini-tasks.js): the grouping, a press on Stage, Owner or Status, and the full menu
8
9
  * sumHtml(v) By epic's card: "N tickets are drafted, not in Jira" with Send to Jira, or "Sending to Jira" (zero is silence)
9
10
  * toolsHtml(sec) what a group's header carries after its fold: ⋯ on the PM's own group, the send icon on an epic with drafted tickets
10
11
  * tkRowsHtml(sec) an epic's tickets: a drafted one has no box and opens the draft (tk-draft.js); a sent one shows its key and status
@@ -23,8 +24,8 @@ import { readLine } from './tk-model.js';
23
24
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
24
25
  const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
25
26
  const P = {
26
- layers: 'M3 7l9-4 9 4-9 4zM3 12l9 4 9-4M3 17l9 4 9-4', send: 'M4 12l16-8-6 16-3-7zM11 13l9-9', more: 'M5 12h.01M12 12h.01M19 12h.01',
27
- check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', plus: 'M12 5v14M5 12h14', tk: 'M12 3l9 9-9 9-9-9z', draft: 'M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8',
27
+ send: 'M4 12l16-8-6 16-3-7zM11 13l9-9', more: 'M5 12h.01M12 12h.01M19 12h.01',
28
+ check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', plus: 'M12 5v14M5 12h14', tk: 'M4 7h16v3a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4z', draft: 'M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8',
28
29
  };
29
30
  const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
30
31
  const LAY = new Map(); // initiative id → its layout (GET /api/initiative-layout), as the last read or write answered
@@ -67,7 +68,7 @@ async function readT(id, H) {
67
68
  /** Reads what the initiative shown needs, once; a redraw follows each answer. */
68
69
  export function attach(body, H) {
69
70
  const n = body && body.querySelector('[data-iv]'), id = n && n.dataset.iv;
70
- if (!idOk(id) || !H || !body.querySelector('[data-ig-by]')) return; // no group icon: no record id, or nothing to group
71
+ if (!idOk(id) || !H || !body.querySelector('[data-iv-vbtn]')) return; // no view button: nothing to group
71
72
  if (!LAY.has(id)) readL(id, H);
72
73
  if (!TK.has(id)) readT(id, H);
73
74
  }
@@ -92,12 +93,17 @@ export function view(v) {
92
93
  const shown = sections.filter((s) => (s.kind === 'epic' ? withJira : !bare(s)));
93
94
  return { ...v, tasks: { ...v.tasks, by, sections: shown, gsum: withJira ? sum : null, only: f.name } };
94
95
  }
96
+ /** The stage the card showed: its name and a ✕ that shows every stage again (filters earn space: only while one is on). Group by itself
97
+ * lives in the view sheet (batch 18 item 1, XvpA4Sheet; pm/ini-tasks.js sheetHtml), through api() below. */
95
98
  export function headHtml(v) {
96
- if (!v || !idOk(v.id) || !v.tasks || v.tasks.empty) return '';
97
- const by = v.tasks.by || 'stage';
98
- // the stage the card showed: its name and a ✕ that shows every stage again (filters earn space: only while one is on)
99
- const only = v.tasks.only ? `<button type="button" class="ig-only" data-ig-all aria-label="${esc('Showing ' + v.tasks.only + ' only. Show every stage')}" title="Show every stage">${esc(v.tasks.only)}${SVG(P.x, 14, 2)}</button>` : '';
100
- return only + `<button type="button" class="iv-ib ig-by${by !== 'stage' ? ' on' : ''}" data-ig-by aria-haspopup="menu" aria-label="Group tasks by" title="${esc('Group tasks by · ' + GROUP_BY[by])}">${SVG(P.layers, 18)}</button>`;
99
+ if (!v || !idOk(v.id) || !v.tasks || v.tasks.empty || !v.tasks.only) return '';
100
+ return `<button type="button" class="ig-only" data-ig-all aria-label="${esc('Showing ' + v.tasks.only + ' only. Show every stage')}" title="Show every stage">${esc(v.tasks.only)}${SVG(P.x, 14, 2)}</button>`;
101
+ }
102
+ /** What the view sheet needs for its Group by row: ok (the initiative has a record id), by() and label() the grouping, set(k) the press
103
+ * (→ the write's promise), more(anchor) the full menu (Epic, Your groups, the sets, New group) under the view button. */
104
+ export function api(root, H) {
105
+ const id = root && root.dataset.iv;
106
+ return { ok: idOk(id), by: () => byOf(id), label: () => GROUP_BY[byOf(id)] || 'Stage', set: (k) => (byOf(id) === k ? null : lay(id, H, { kind: 'by', by: k })), more: (a) => groupMenu(a, id, H) };
101
107
  }
102
108
  export function sumHtml(v) {
103
109
  const s = v && v.tasks && v.tasks.gsum; if (!s) return '';
@@ -213,7 +219,6 @@ async function openTk(id, H, tid) {
213
219
  }
214
220
  export function press(b, d, root, H) {
215
221
  const id = root && root.dataset.iv; if (!idOk(id)) return false;
216
- if ('igBy' in d) { if (POP && POP.anchor === b) closePop(); else groupMenu(b, id, H); return true; }
217
222
  if (d.igGmore) { groupMore(b, id, H, d.igGmore); return true; }
218
223
  if ('igAll' in d) { ONLY.delete(id); if (H.redraw) H.redraw(); return true; }
219
224
  if (d.igSend != null) { send(id, H, { group: d.igSend }); return true; }
@@ -31,7 +31,7 @@ export const PL = {
31
31
  link: 'M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1',
32
32
  unlink: 'M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1M4 4l16 16',
33
33
  check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', minus: 'M5 12h14', plus: 'M12 5v14M5 12h14',
34
- search: 'M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM20 20l-4-4', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', dia: 'M12 4l8 8-8 8-8-8z', jira: 'M12 3l9 9-9 9-9-9z',
34
+ search: 'M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM20 20l-4-4', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', dia: 'M12 4l8 8-8 8-8-8z', jira: 'M4 7h16v3a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4z',
35
35
  // the four types, the two ends joined: the waited-on end on the left, the waiting end on the right
36
36
  fs: 'M3 7h8v10h10M17 13l4 4-4 4', ss: 'M7 4v6h14M7 10v10M17 6l4 4-4 4', ff: 'M3 7h14v10H7M17 13v8', sf: 'M7 4v13h10M7 17h0M13 13l4 4-4 4',
37
37
  };