create-pmos 0.406.0 → 0.408.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 (32) hide show
  1. package/package.json +25 -30
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +4 -3
  8. package/workspace/briefing-premium-doc-edit-test.js +3 -5
  9. package/workspace/briefing-premium-initiative-test.js +46 -27
  10. package/workspace/changelog.json +24 -0
  11. package/workspace/guide/home.md +11 -5
  12. package/workspace/home-other-product-test.js +94 -0
  13. package/workspace/package-lock.json +2 -2
  14. package/workspace/package.json +1 -1
  15. package/workspace/premium-board-actions-test.js +2 -2
  16. package/workspace/premium-core-doc-issue-test.js +4 -1
  17. package/workspace/premium-vw-backlog-test.js +3 -3
  18. package/workspace/premium-vw-doc-test.js +4 -6
  19. package/workspace/premium-vw-item-test.js +1 -1
  20. package/workspace/premium-vw-jira-test.js +2 -2
  21. package/workspace/public/pm/bd-prog-panel.js +4 -3
  22. package/workspace/public/pm/cozy-home.css +5 -0
  23. package/workspace/public/pm/cozy-nav.js +4 -0
  24. package/workspace/public/pm/cozy-today.css +2 -0
  25. package/workspace/public/pm/cozy-viewer.js +24 -8
  26. package/workspace/public/pm/home-app.js +138 -62
  27. package/workspace/public/pm/home-ini.css +14 -0
  28. package/workspace/public/pm/home-ini.js +93 -81
  29. package/workspace/public/pm/home-today.js +7 -5
  30. package/workspace/public/premium.html +1 -1
  31. package/workspace/test-lists/briefing-premium.json +3 -1
  32. package/workspace/tk-tasks-test.js +2 -3
@@ -2,8 +2,11 @@
2
2
  * InTasks, InDocs, InPhone). The pure half is home-ini-model.js.
3
3
  *
4
4
  * mountIni(ctx) once, from home-app.js. ctx: { S, VW, pmGet, pmPost, toast, load, openFile, iniTitle, drawList, wait }
5
- * iniList(sc) after each draw of the list column: the stage move in the initiative's card, the Tasks group and the Core documents group
6
- * iniOverview(v) the initiative in the Viewer: Tasks (the default), Documents or Stage. true when it opened.
5
+ * iniList(sc) after each draw of the list column: reads the layout record and moves the stage by itself when it may. The list column
6
+ * never changes for an initiative (canvas HbC): the initiative is a page of the Viewer.
7
+ * iniPage() the initiative's page in the Viewer (canvas HbCDesk): the stage card with Move to <next>, three tasks and the documents that
8
+ * need a look. "Show N more" and "Show all N" drill into Tasks and Documents, with ← back to the page. true when it opened.
9
+ * iniOverview(v, o) the initiative in the Viewer: Tasks (the default), Documents or Stage; o.back keeps the page behind it. true when it opened.
7
10
  *
8
11
  * The stage move (InStage): the card shows "Moves on by itself when all N are done" (a switch, on by default, kept in file mode) and Move to <next>
9
12
  * with Back beside it. Move with items still open asks first (Move anyway, with a note); Back always asks for a reason. Both go to POST /api/boards/move
@@ -182,55 +185,64 @@ function ask(anchor, label, value, go, o = {}) { // one line of words, inline
182
185
  i.addEventListener('keydown', (e) => { if (e.key === 'Enter') { e.preventDefault(); const v = i.value.trim(); if (v) { closePop(); go(v); } } });
183
186
  }
184
187
 
185
- /* ── the list column (InTasks, InDocs) ── */
186
- function tasksGroupHtml(id, M, L) {
187
- const rows = MD.taskRows(M, L);
188
- const T = MD.listTasks(rows);
189
- const shut = X.shut.has('tasks');
190
- const row = (t) => `<div class="hm-r hi-r" data-id="hi:${esc(t.key)}">`
188
+ export function iniList(sc) {
189
+ if (!X.ctx || !sc) return;
190
+ sc.querySelectorAll('[data-hi-slot]').forEach((n) => n.remove());
191
+ const S = X.ctx.S, M = curM();
192
+ if (!M) return;
193
+ readL(S.ini, M);
194
+ autoCheck(S.ini, M, mvOf(S.ini, M));
195
+ if (X.view === 'page') redrawView(); // a new read of the initiative shows on its page
196
+ }
197
+
198
+ /* ── the initiative's page in the Viewer (canvas HbCDesk, HbCNew, HbCPhone) ── */
199
+ function pageHtml(id, M) {
200
+ const L = Lof(id), mv = mvOf(id, M), rows = MD.taskRows(M, L), T = MD.listTasks(rows);
201
+ let card = X.ctx.cardHtml(id, { page: true });
202
+ if (mv.cur) { const at = card.lastIndexOf('<div class="hm-acts">'); if (at > 0) card = card.slice(0, at) + moveHtml(id, M, mv) + card.slice(at); }
203
+ const trow = (t) => `<div class="hm-r hi-r">`
191
204
  + (t.canCheck ? `<button type="button" class="hi-chk" data-hi-chk="${esc(t.key)}" aria-pressed="false" aria-label="Mark ${esc(t.title)} done"></button>` : '<span class="hi-chk off" aria-hidden="true"></span>')
192
205
  + `<button type="button" class="hm-rm" data-hi-task="${esc(t.key)}"><span class="hm-rt"><b>${esc(t.title)}</b><em class="${t.late ? 'late' : 'q'}">${esc([t.owner || (t.jira ? 'Jira' : ''), t.due].filter(Boolean).join(' · ') || t.state)}</em></span></button></div>`;
193
- return `<section class="hm-g hi-g" data-hi="tasks" aria-label="Tasks"><div class="hm-ghr"><button type="button" class="hm-gh" data-hi-fold="tasks" aria-expanded="${!shut}">${SVG(shut ? I.right : I.down, 12, 2.2)}<span>Tasks</span><span class="hi-n">${T.open ? T.open + ' open' : rows.length ? 'all done' : 'none'}</span></button>`
194
- + `<button type="button" class="hm-gadd" data-hi-addtask aria-label="Add a task to ${esc(X.ctx.iniTitle(id))}" title="Add a task">${SVG(I.plus, 14, 2.2)}</button></div>`
195
- + (shut ? '' : T.top.map(row).join('')
196
- + `<div class="hm-r hi-r"><button type="button" class="hm-rm" data-hi-open="tasks"><span class="hm-tile hi-sq">${SVG(I.list, 14)}</span><span class="hm-rt"><b>All tasks</b><em class="q">${esc(T.sub || 'No task yet')}</em></span></button></div>`)
206
+ const more = T.all - T.top.length;
207
+ const tasks = `<section class="hi-pg" aria-label="Tasks"><div class="hi-pgh"><b>Tasks</b>${T.open ? `<span class="hi-n">${T.open}</span>` : ''}<button type="button" class="hm-gadd" data-hi-addtask aria-label="Add a task to ${esc(X.ctx.iniTitle(id))}" title="Add a task">${SVG(I.plus, 14, 2.2)}</button></div>`
208
+ + (rows.length ? T.top.map(trow).join('') + (more > 0 ? `<button type="button" class="hi-pgm" data-hi-open="tasks">Show ${more} more${SVG(I.right, 14, 2)}</button>` : '')
209
+ : `<div class="hi-pge"><p>No tasks yet</p><button type="button" class="hi-btn sm" data-hi-addtask>${SVG(I.plus, 14)}Add a task</button></div>`)
197
210
  + '</section>';
211
+ const docs = MD.docRows(M), look = docs.filter((d) => d.look);
212
+ const drow = (d) => `<div class="hm-r hi-r"><button type="button" class="hm-rm" data-hi-doc="${esc(d.key)}"><i class="hm-dot hi-risk" aria-hidden="true"></i><span class="hm-tile">${SVG(I.doc, 14)}</span><span class="hm-rt"><b>${esc(d.title)}</b><em class="risk">${esc(MD.docPill(d)[0] + (d.when ? ' · ' + d.when : ''))}</em></span></button></div>`;
213
+ const dsec = docs.length ? `<section class="hi-pg" aria-label="Documents"><div class="hi-pgh"><b>Documents</b><span class="hi-n">${docs.length}</span></div>`
214
+ + look.map(drow).join('') + `<button type="button" class="hi-pgm" data-hi-open="docs">Show all ${docs.length}${SVG(I.right, 14, 2)}</button></section>` : '';
215
+ // a phone: the page is a sheet over the list, and the chat is one press away (HbCPhone)
216
+ const talk = isPhone() ? `<button type="button" class="hi-talk" data-hi-talk>Message Claude about ${esc(X.ctx.iniTitle(id))}</button>` : '';
217
+ return `<div class="hi-v hi-page" data-hi-v="page">${card}${tasks}${dsec}${talk}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
218
+ }
219
+ /** ⋯ of the page (HbCMore): change it, look at it elsewhere, then stop it, red and last. */
220
+ function pageMore(id) {
221
+ const M = curM(); if (!M) return [];
222
+ const mv = mvOf(id, M), out = [];
223
+ if (!mv.why) out.push({ label: 'Moves on by itself', note: mv.auto ? 'On' : 'Off', on: () => press(id, M, { kind: 'auto', on: !mv.auto }) });
224
+ if (mv.canBack) out.push({ label: 'Move back a stage', note: mv.prev, on: (b) => popBack(b || document.querySelector('#czViewer [data-cz-vw="more"]'), id, M, mv) });
225
+ if ((M.acts.stages || []).length && !M.acts.self) out.push({ label: 'Move to a stage', on: () => iniOverview('stage', { back: true }) });
226
+ out.push({ label: 'Add a stakeholder', on: () => X.ctx.addPerson() });
227
+ if (X.ctx.turnProgram) out.push({ label: 'Turn into a program', on: () => X.ctx.turnProgram(id) });
228
+ out.push({ sep: true }, { label: 'Open on the Board', on: () => { location.href = '/premium-board.html?focus=' + encodeURIComponent(id) + (M.board.ws ? '&ws=' + encodeURIComponent(M.board.ws) : '') + (M.board.id ? '&board=' + encodeURIComponent(M.board.id) : ''); } },
229
+ { label: 'The record', on: async () => (X.ctx.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }) });
230
+ if (!M.acts.life) out.push({ sep: true }, { label: 'Put on hold', on: () => { iniOverview('stage', { back: true, ask: 'on-hold' }); } }, { label: 'Cancel the initiative', danger: true, on: () => { iniOverview('stage', { back: true, ask: 'cancelled' }); } });
231
+ return out;
198
232
  }
199
- function docsGroupHtml(M) {
200
- const rows = MD.docRows(M);
201
- if (!rows.length && (!M.docs || M.docs.missing)) return '';
202
- const look = rows.filter((d) => d.look);
203
- const shut = X.shut.has('docs');
204
- const row = (d) => `<div class="hm-r hi-r"><button type="button" class="hm-rm" data-hi-doc="${esc(d.key)}"><i class="hm-dot hi-risk" aria-hidden="true"></i><span class="hm-tile">${SVG(I.doc, 14)}</span><span class="hm-rt"><b>${esc(d.title)}</b><em class="risk">${esc(MD.docPill(d)[0] + (d.when ? ' · ' + d.when : ''))}</em></span></button></div>`;
205
- return `<section class="hm-g hi-g" data-hi="docs" aria-label="Core documents"><div class="hm-ghr"><button type="button" class="hm-gh" data-hi-fold="docs" aria-expanded="${!shut}">${SVG(shut ? I.right : I.down, 12, 2.2)}<span>Core documents</span><span class="hi-n">${rows.length}</span></button></div>`
206
- + (shut ? '' : look.map(row).join('')
207
- + `<div class="hm-r hi-r"><button type="button" class="hm-rm" data-hi-open="docs"><span class="hm-tile hi-sq">${SVG(I.list, 14)}</span><span class="hm-rt"><b>All ${rows.length} ${rows.length === 1 ? 'document' : 'documents'}</b><em class="q">${look.length ? look.length + ' need a look · opens the list in the Viewer' : 'Opens the list in the Viewer'}</em></span></button></div>`)
208
- + '</section>';
209
- }
210
- /** Put html in the list once per change: a node marked data-hi=<key>, placed by where(). Nothing is redrawn when the html is the same. */
211
- function put(sc, key, html, where) {
212
- let n = sc.querySelector(`:scope [data-hi-slot="${key}"]`);
213
- if (!html) { if (n) n.remove(); return; }
214
- if (!n) { n = document.createElement('div'); n.dataset.hiSlot = key; n.className = 'hi-slot'; }
215
- if (n.__h !== html) { n.__h = html; n.innerHTML = html; }
216
- where(n);
217
- }
218
- export function iniList(sc) {
219
- if (!X.ctx || !sc) return;
220
- const S = X.ctx.S, M = curM();
221
- if (!M) { sc.querySelectorAll('[data-hi-slot]').forEach((n) => n.remove()); return; }
222
- const id = S.ini;
223
- readL(id, M);
224
- const L = Lof(id), mv = mvOf(id, M);
225
- const box = sc.querySelector('.hm-card .hm-box');
226
- if (box) put(box, 'mv', mv.cur ? moveHtml(id, M, mv) : '', (n) => { const a = box.querySelector(':scope > .hm-acts'); if (n.nextElementSibling !== a) box.insertBefore(n, a); });
227
- const card = sc.querySelector(':scope > .hm-card');
228
- put(sc, 'tasks', tasksGroupHtml(id, M, L), (n) => { const after = card || null; if (after ? after.nextElementSibling !== n : sc.firstElementChild !== n) { if (after) after.after(n); else sc.prepend(n); } });
229
- // the Files group listed the same documents: Core documents takes its place (InDocs), the documents that need a look and "All N documents"
230
- const files = sc.querySelector(':scope > section.hm-g[aria-label="Files"]');
231
- if (files) files.hidden = true;
232
- put(sc, 'docs', docsGroupHtml(M), (n) => { const gs = [...sc.querySelectorAll(':scope > section.hm-g:not([hidden])')]; const last = gs[gs.length - 1]; if (last && last.nextElementSibling !== n) last.after(n); else if (!last && n.parentNode !== sc) sc.append(n); });
233
- autoCheck(id, M, mv);
233
+ export function iniPage() {
234
+ if (!X.ctx) return false;
235
+ const S = X.ctx.S, id = S.ini;
236
+ if (!id || id === 'product') return false;
237
+ STAGE_ASK = null;
238
+ const VW = X.ctx.VW;
239
+ let rename = X.ctx.renameIni ? X.ctx.renameIni(id, '') : null;
240
+ if (rename) rename = { ...rename, value: X.ctx.iniTitle(id) };
241
+ BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', more: () => pageMore(id), rename,
242
+ add: { label: 'New session', on: () => X.ctx.newIn(id) },
243
+ render: (b) => { X.view = 'page'; BODY = b; draw(b); wire(b, id); } });
244
+ if (!curM()) { X.failed = null; X.ctx.loadIni().then(() => { if (S.ini !== id) return; if (!curM()) X.failed = id; redrawView(); }); }
245
+ return true;
234
246
  }
235
247
 
236
248
  /* ── the Viewer: Tasks, Documents, Stage ── */
@@ -362,8 +374,10 @@ function stageView(id, M, ask) {
362
374
  let STAGE_ASK = null;
363
375
  function draw(b) {
364
376
  const S = X.ctx.S, id = S.ini, M = curM();
365
- if (!M) { b.innerHTML = `<div class="hi-v"><p class="hi-small" role="status">${X.failed === id ? 'The initiative could not be read.' : 'Reading the initiative.'}</p></div>`; return; }
377
+ if (!M) { b.__pg = null; b.innerHTML = `<div class="hi-v"><p class="hi-small" role="status">${X.failed === id ? 'The initiative could not be read.' : 'Reading the initiative.'}</p></div>`; return; }
366
378
  const v = X.view;
379
+ if (v !== 'page') b.__pg = null;
380
+ if (v === 'page') { const h = pageHtml(id, M); if (b.__pg !== h || !b.firstChild) { b.__pg = h; b.innerHTML = h; } return; }
367
381
  // Documents is shell A (XvADocs): no tabs, the summary card and folding groups straight in the body
368
382
  if (v === 'docs') { b.innerHTML = docsView(id, M) + '<p class="hi-small" role="status" id="ovMsg"></p>'; return; }
369
383
  // the phone keeps the Tasks | Stage switch (PgTkList); in shell A on a desktop the other views sit under ⋯ (XvATasks)
@@ -382,8 +396,8 @@ function moreOf(id, view) {
382
396
  const out = [];
383
397
  if (view === 'tasks') out.push({ label: 'Group tasks by', on: (b) => { const M = M0(); if (M) groupMenu(b, id, M); } });
384
398
  for (const [k, l] of Object.entries(KIND)) if (k !== view) out.push({ label: l, on: () => iniOverview(k) });
385
- out.push({ sep: true }, { label: 'Open the full record', on: async () => { const M = M0(); if (M) (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }); } });
386
- if (M0() && M0().board && M0().board.id) out.push({ label: 'Sprint', on: async () => { const M = M0(); if (M) (await import('./premium-vw-jira.js')).openSprint(bw(M)); } });
399
+ out.push({ sep: true }, { label: 'Open the full record', on: async () => { const M = M0(); if (M) (X.ctx.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }); } });
400
+ if (M0() && M0().board && M0().board.id) out.push({ label: 'Sprint', on: async () => { const M = M0(); if (M) (X.ctx.VW.drill(), await import('./premium-vw-jira.js')).openSprint(bw(M)); } });
387
401
  return out;
388
402
  }
389
403
  function groupMenu(t, id, M) {
@@ -411,12 +425,14 @@ async function openTicket(id, M, tid) {
411
425
  D.openDraft({ VW: X.ctx.VW, ws: wsOf(M), initiative: id, id: tid, view: T && T.ok ? T : null, toast: X.ctx.toast, ui: { menu, ask },
412
426
  onChange: () => readT(id, M, true), onSend: (x) => sendSheet(id, M, { ticket: x }) });
413
427
  }
414
- export function iniOverview(view) {
428
+ export function iniOverview(view, o = {}) {
415
429
  if (!X.ctx) return false;
416
430
  const S = X.ctx.S, id = S.ini;
417
431
  if (!id || id === 'product') return false;
418
- X.view = KIND[view] ? view : 'tasks'; // the card's Overview opens on Tasks (InTasks); a list line or the switch names its own view
419
- STAGE_ASK = null;
432
+ const v = KIND[view] ? view : 'tasks'; // the page's "Show N more" opens Tasks (InTasks); "Show all N" and ⋯ name their own view
433
+ const c = X.ctx.VW.current(), keep = !o.back && !!c && c.id === 'ov:' + id && X.view !== 'page'; // a switch between views keeps the page behind them
434
+ X.view = v;
435
+ STAGE_ASK = o.ask || null;
420
436
  const VW = X.ctx.VW;
421
437
  const docs = X.view === 'docs';
422
438
  // render wires the body too, so ← from a drill-in (a drafted ticket) draws the view again with its presses
@@ -424,8 +440,8 @@ export function iniOverview(view) {
424
440
  const pre = KIND[X.view] + ' · ';
425
441
  let rename = X.ctx.renameIni ? X.ctx.renameIni(id, pre) : null;
426
442
  if (rename) { const save = rename.save; rename = { ...rename, value: X.ctx.iniTitle(id), save: async (t, o) => { const r = await save(t, o); if (r.ok) rename.value = r.title; return r.ok ? { ...r, title: pre + r.title } : r; } }; }
427
- BODY = VW.open({ id: 'ov:' + id, kind: KIND[X.view], title: pre + X.ctx.iniTitle(id), icon: ICON[X.view], more: docs ? () => docsMore(id) : moreOf(id, X.view), rename,
428
- render: (b) => { BODY = b; draw(b); wire(b, id); } });
443
+ BODY = VW.open({ id: 'ov:' + id, kind: KIND[X.view], title: pre + X.ctx.iniTitle(id), icon: ICON[X.view], more: docs ? () => docsMore(id) : moreOf(id, X.view), rename, back: !!o.back, keep,
444
+ render: (b) => { X.view = v; BODY = b; draw(b); wire(b, id); } });
429
445
  if (!curM()) { X.failed = null; X.ctx.loadIni().then(() => { if (S.ini !== id) return; if (!curM()) X.failed = id; X.ctx.drawList(); redrawView(); }); } // a slow first read: read it again rather than say it failed
430
446
  return true;
431
447
  }
@@ -441,7 +457,7 @@ function docsMore(id) {
441
457
  { sep: true },
442
458
  { label: 'Tasks', on: () => iniOverview('tasks') },
443
459
  { label: 'Stage', on: () => iniOverview('stage') },
444
- { label: 'Open the full record', on: async () => (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }) },
460
+ { label: 'Open the full record', on: async () => (X.ctx.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }) },
445
461
  ];
446
462
  }
447
463
  async function addDoc(id) {
@@ -473,6 +489,7 @@ function wire(body, id) {
473
489
  body.onclick = async (e) => {
474
490
  const t = e.target.closest('button'); const M = curM(); if (!t || t.disabled || !M) return;
475
491
  const d = t.dataset;
492
+ if (X.view === 'page' && pagePress(t, id, M)) return;
476
493
  if (d.hiView) { iniOverview(d.hiView); return; }
477
494
  if ('hiAuto' in d) { press(id, M, { kind: 'auto', on: t.getAttribute('aria-checked') !== 'true' }); return; }
478
495
  if ('hiBy' in d) { groupMenu(t, id, M); return; }
@@ -521,8 +538,8 @@ function wire(body, id) {
521
538
  if (d.ovTk) { openTask(id, M, d.ovTk); return; }
522
539
  if ('ovRecord' in d || 'ovSprint' in d) {
523
540
  const o = bw(M);
524
- if ('ovSprint' in d) { (await import('./premium-vw-jira.js')).openSprint(o); return; }
525
- (await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...o });
541
+ if ('ovSprint' in d) { (X.ctx.VW.drill(), await import('./premium-vw-jira.js')).openSprint(o); return; }
542
+ (X.ctx.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...o });
526
543
  return;
527
544
  }
528
545
  // documents
@@ -572,32 +589,29 @@ async function openTask(id, M, key) {
572
589
  const o = bw(M);
573
590
  if (!row.pmos && row.ref && /^Jira/.test(row.src || '')) { (await import('./premium-vw-jira.js')).openTicket({ ...o, initiative: id, ref: row.ref }); return; }
574
591
  const rename = row.pmos && row.uid && X.ctx.renameTask ? X.ctx.renameTask({ uid: row.uid, title: row.title, ws: o.ws, board: o.board }) : null;
575
- (await import('./premium-vw-item.js')).openWorkItem({ kind: 'task', ini: id, key: row.key, title: row.title, ...o, rename });
592
+ (X.ctx.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'task', ini: id, key: row.key, title: row.title, ...o, rename });
576
593
  }
577
594
 
578
- /* ── presses on the list column ── */
579
- function onList(e) {
580
- const t = e.target.closest('button'); if (!t || !X.ctx) return;
581
- const d = t.dataset, M = curM(), id = X.ctx.S.ini;
582
- if (!M || !id) return;
583
- if ('hiMove' in d) {
584
- const mv = mvOf(id, M);
585
- if (!mv.canMove) return;
586
- if (mv.open.length) popMove(t, id, M, mv); else doMove(id, M, mv.next, mv.allDone ? 'Moved by hand: every exit item is done.' : 'Moved by hand');
587
- return;
588
- }
589
- if ('hiBack' in d) { const mv = mvOf(id, M); if (mv.canBack) popBack(t, id, M, mv); return; }
590
- if ('hiAuto' in d) { press(id, M, { kind: 'auto', on: t.getAttribute('aria-checked') !== 'true' }); return; }
591
- if (d.hiFold) { if (X.shut.has(d.hiFold)) X.shut.delete(d.hiFold); else X.shut.add(d.hiFold); X.ctx.drawList(); return; }
592
- if ('hiAddtask' in d) { X.view = 'tasks'; iniOverview(); setTimeout(() => { const n = document.querySelector('#czViewer #ovTask'); if (n) n.focus(); }, 0); return; }
593
- if (d.hiOpen) { iniOverview(d.hiOpen); return; }
594
- if (d.hiTask) { openTask(id, M, d.hiTask); return; }
595
- if (d.hiChk) { const row = MD.taskRows(M, Lof(id)).find((x) => x.key === d.hiChk); if (row && row.canCheck) X.ctx.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: 'Done' }).then(async (r) => { if (r && r.ok !== false) { X.ctx.toast('Done: ' + row.title + '.'); await X.ctx.load(); redrawView(); } else X.ctx.toast((r && r.error) || 'Nothing was changed.'); }); return; }
595
+ /** A press on the initiative's page: the card's own presses go to Home; a task or a document drills in, so ← comes back to the page. */
596
+ function pagePress(t, id, M) {
597
+ const d = t.dataset, C = X.ctx, VW = C.VW;
598
+ if ('hmCta' in d) { C.cta(); return true; }
599
+ if ('hmOv' in d) { C.overviewAsk(id); return true; }
600
+ if ('hmCfold' in d) { C.foldCard(); redrawView(); return true; }
601
+ if ('hmDone' in d) { C.S.doneOpen = !C.S.doneOpen; redrawView(); return true; }
602
+ if ('hiTalk' in d) { C.talk(id); return true; }
603
+ if ('hiMove' in d) { const mv = mvOf(id, M); if (!mv.canMove) return true; if (mv.open.length) popMove(t, id, M, mv); else doMove(id, M, mv.next, mv.allDone ? 'Moved by hand: every exit item is done.' : 'Moved by hand'); return true; }
604
+ if ('hiBack' in d) { const mv = mvOf(id, M); if (mv.canBack) popBack(t, id, M, mv); return true; }
605
+ if ('hiAddtask' in d) { iniOverview('tasks', { back: true }); setTimeout(() => { const n = document.querySelector('#czViewer #ovTask'); if (n) n.focus(); }, 0); return true; }
606
+ if (d.hiOpen) { iniOverview(d.hiOpen, { back: true }); return true; }
607
+ if (d.hiTask) { VW.drill(); openTask(id, M, d.hiTask); return true; }
608
+ if (d.hiChk) { const row = MD.taskRows(M, Lof(id)).find((x) => x.key === d.hiChk); if (row && row.canCheck) C.pmPost('/api/boards/tasks/state', { ...bw(M), task: row.uid, state: 'Done' }).then(async (r) => { if (r && r.ok !== false) { C.toast('Done: ' + row.title + '.'); await C.load(); redrawView(); } else C.toast((r && r.error) || 'Nothing was changed.'); }); return true; }
596
609
  if (d.hiDoc) {
597
610
  const doc = MD.docRows(M).find((x) => x.key === d.hiDoc);
598
- if (doc && doc.path && !(doc.st === 'draft' && doc.slot)) X.ctx.openFile({ path: doc.path, name: doc.title });
599
- else iniOverview('docs');
611
+ if (doc && doc.path && !(doc.st === 'draft' && doc.slot)) { VW.drill(); C.openFile({ path: doc.path, name: doc.title }); } else iniOverview('docs', { back: true });
612
+ return true;
600
613
  }
614
+ return false;
601
615
  }
602
616
 
603
617
  export function mountIni(ctx) {
@@ -605,8 +619,6 @@ export function mountIni(ctx) {
605
619
  if (typeof document === 'undefined') return X;
606
620
  if (!document.querySelector('link[data-hi-css]')) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '/pm/home-ini.css'; l.dataset.hiCss = ''; document.head.appendChild(l); }
607
621
  if (!document.querySelector('link[data-tk-css]')) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '/pm/tk-tasks.css'; l.dataset.tkCss = ''; document.head.appendChild(l); }
608
- const list = document.getElementById('hmList');
609
- if (list) list.addEventListener('click', onList);
610
622
  ctx.VW.onChange((v) => { if (!v.open || !/^ov:/.test(v.id || '')) closePop(); });
611
623
  return X;
612
624
  }
@@ -81,7 +81,7 @@ function iniHtml(r, o) {
81
81
  const nest = open ? `<div class="hm-nest" role="group" aria-label="In ${esc(r.name)}">${kids.map((k) => rowHtml(k, { ...o, kid: true })).join('')}${more}</div>` : '';
82
82
  const badge = !open && r.yours ? `<span class="hv-c" role="img" aria-label="${r.yours === 1 ? '1 is yours' : r.yours + ' are yours'}">${r.yours}</span>` : '';
83
83
  const chev = r.kids.length ? `<button type="button" class="hv-xc" data-hm-kids="${esc(r.id)}" aria-expanded="${open}" aria-label="${open ? 'Hide' : 'Show'} what is in ${esc(r.name)}">${svg(open ? P.chevD : P.chevR, 15)}</button>` : '<span class="hv-xc" aria-hidden="true"></span>';
84
- return `<div class="hm-r hv-r ini st-${esc(r.state)}${o.sel === r.id ? ' sel' : ''}" data-id="${esc(r.id)}"><button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}" title="${esc(r.hint)}">${markHtml(r.yours && r.state !== 'blocked' ? { state: 'needs' } : r)}`
84
+ return `<div class="hm-r hv-r ini st-${esc(r.state)}${o.sel === r.id ? ' sel' : ''}" data-id="${esc(r.id)}"><button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"${o.sel === r.id ? ' aria-current="true"' : ''} title="${esc(r.hint)}">${markHtml(r.yours && r.state !== 'blocked' ? { state: 'needs' } : r)}`
85
85
  + `<span class="hm-rt"><b>${esc(r.name)}</b></span>${badge}${track(r.at, r.stage)}</button>${chev}</div>${nest}`;
86
86
  }
87
87
 
@@ -93,8 +93,10 @@ function productHtml(g, o) {
93
93
  const open = o.pOpen(g);
94
94
  // open: the goal dots; folded: the tile's dot says something in it is yours (blue) or late (amber). No counts in words (HvAC)
95
95
  const say = [g.name, open ? (g.goals && g.goals.n ? g.goals.text : '') : [plural(g.count, 'initiative', 'initiatives'), yoursWords(g)].filter(Boolean).join(', ')].filter(Boolean).join(', ');
96
- const head = `<button type="button" class="hv-gh${open ? '' : ' closed'}" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(say)}. ${open ? 'Close' : 'Open'} the group">`
97
- + `<span class="hv-tl t${g.tone}" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}">${esc(g.initials)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b>${open ? dots(g) : ''}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button>`;
96
+ // the name opens the product in the Viewer, with its own chat; the rest of the header folds the group (canvas HbCProduct)
97
+ const head = `<div class="hv-gh hv-prg${open ? '' : ' closed'}${o.selHead === g.key ? ' sel' : ''}"><button type="button" class="hv-pt" data-hm-prodopen="${esc(g.key)}" aria-label="Open ${esc(g.name)}, a product"${o.selHead === g.key ? ' aria-current="true"' : ''}>`
98
+ + `<span class="hv-tl t${g.tone}" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}">${esc(g.initials)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>`
99
+ + `<button type="button" class="hv-pf" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(say)}. ${open ? 'Close' : 'Open'} the group">${open ? dots(g) : ''}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button></div>`;
98
100
  if (!open) return `<section class="hm-pg hv-g" aria-label="${esc(g.name)}">${head}</section>`;
99
101
  const pinned = (x) => (o.pin.has(x.key) ? 0 : 1);
100
102
  const flat = g.flat.slice().sort((a, b) => pinned(a) - pinned(b)).map((r) => rowHtml(r, o)).join('');
@@ -109,14 +111,14 @@ function productHtml(g, o) {
109
111
  }
110
112
  /** A program's group (canvas PgHomePhone, PgHomeDesk): above the products. Its header: the program tile, the name, the next milestone's
111
113
  * diamond with its date and one small diamond per initiative it waits on (filled when that initiative is past the Deliver milestone), a chevron.
112
- * The title opens the program panel on the Board; the chevron folds the group. Inside: the program's own tasks first, then a sub-heading
114
+ * The title opens the program in Home's Viewer with its own chat (canvas HbCProg); the chevron folds the group. Inside: the program's own tasks first, then a sub-heading
113
115
  * per product with that product's initiatives. */
114
116
  function programHtml(g, o) {
115
117
  const open = o.pOpen(g);
116
118
  const nx = g.st && g.st.next;
117
119
  const ms = nx ? `<span class="hv-msd${nx.late ? ' late' : ''}"><span class="hv-dm"></span>${esc(nx.day || nx.name)}${nx.n ? `<span class="hv-rd">${Array.from({ length: nx.n }, (_, i) => `<i${i < nx.ready ? ' class="on"' : ''}></i>`).join('')}</span>` : ''}</span>` : '';
118
120
  const line = nx ? 'Next milestone ' + nx.name + (nx.day ? ', ' + nx.day : '') + (nx.late ? ', late' : '') + (nx.n ? ', ' + nx.ready + ' of ' + nx.n + (nx.n === 1 ? ' initiative' : ' initiatives') + ' ready' : '') : 'No open milestone';
119
- const head = `<div class="hv-gh hv-prg${open ? '' : ' closed'}"><button type="button" class="hv-pt" data-hm-prog="${esc(g.program.id)}" aria-label="Open ${esc(g.name)}, a program">`
121
+ const head = `<div class="hv-gh hv-prg${open ? '' : ' closed'}${o.selHead === g.key ? ' sel' : ''}"><button type="button" class="hv-pt" data-hm-prog="${esc(g.program.id)}" aria-label="Open ${esc(g.name)}, a program"${o.selHead === g.key ? ' aria-current="true"' : ''}>`
120
122
  + `<span class="hv-tl tp" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}">${svg(P.layers, 16)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>`
121
123
  + `<button type="button" class="hv-pf" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(g.name)}. ${esc(line)}${g.yours ? '. ' + yoursWords(g) : ''}. ${open ? 'Close' : 'Open'} the group">${ms}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button></div>`;
122
124
  if (!open) return `<section class="hm-pg hv-g prg" aria-label="${esc(g.name)}">${head}</section>`;
@@ -31,7 +31,7 @@
31
31
  <main class="hm-desk" id="hmDesk">
32
32
  <aside class="hm-list" id="hmList" aria-label="Sessions"></aside>
33
33
  <section class="hm-chat" id="hmChat" aria-label="Conversation"></section>
34
- <div class="hm-vw" data-cz-viewer-host></div>
34
+ <div class="hm-vw" data-cz-viewer-host data-cz-vw-overlay></div>
35
35
  </main>
36
36
  <div class="hm-menu" id="hmMenu" role="menu" aria-label="More" hidden></div>
37
37
  <div class="hm-toast" id="toast" role="status" aria-live="polite"></div>
@@ -12,6 +12,7 @@
12
12
  "briefing-premium-calendar-2-test.js",
13
13
  "briefing-premium-calendar-3-test.js",
14
14
  "briefing-premium-products-test.js",
15
+ "home-other-product-test.js",
15
16
  "briefing-premium-sources-test.js",
16
17
  "briefing-premium-metrics-test.js",
17
18
  "premium-welcome-test.js",
@@ -32,6 +33,7 @@
32
33
  "briefing-premium-sources-test.js": 90,
33
34
  "briefing-premium-metrics-test.js": 120,
34
35
  "premium-welcome-test.js": 120,
35
- "briefing-premium-agent-server.test.js": 40
36
+ "briefing-premium-agent-server.test.js": 40,
37
+ "home-other-product-test.js": 60
36
38
  }
37
39
  }
@@ -87,8 +87,7 @@ const BRIEF = BRP.build(BRF.facts());
87
87
  };
88
88
  const V = '#czViewer:not([hidden])';
89
89
  const tasks = async (p) => {
90
- if (!(await p.evaluate(() => { const b = document.querySelector('.hm-card [data-hm-ov]'); return !!b && !!b.offsetParent; }))) await p.click('#hmNeeds');
91
- await p.click('.hm-card [data-hm-ov]');
90
+ await (async (g) => { const P = '#czViewer:not([hidden]) [data-hi-v="page"]', r = '#hmList [data-hm-sel^="i:"][aria-current="true"]'; for (let i = 0; i < 4 && !(await g.$(P)) && (await g.$('#czViewer:not([hidden]) [data-cz-vw="back"]')); i++) { await g.click('#czViewer [data-cz-vw="back"]'); await g.waitForTimeout(150); } if (await g.$(P)) return; if (await g.$(r)) await g.click(r); else await g.reload(); await g.waitForSelector(P + ' .hi-pgh [data-hi-addtask]', { timeout: 30000 }); })(p); /* ← back to the initiative's page, else its row, else the address again (an initiative the list does not show) */ await p.click('#czViewer .hi-pgh [data-hi-addtask]'); /* the initiative's page (canvas HbC): its + drills into Tasks */
92
91
  return until(() => p.evaluate((v) => !!document.querySelector(v + ' .tk-g .tk-row'), V), 30000);
93
92
  };
94
93
  const shot = async (p, name) => { if (!SHOTS) return; fs.mkdirSync(SHOTS, { recursive: true }); await sleep(250); await p.screenshot({ path: path.join(SHOTS, name) }); };
@@ -191,7 +190,7 @@ const BRIEF = BRP.build(BRF.facts());
191
190
  /* the PM chose another grouping: it stays */
192
191
  {
193
192
  const E = await open({ layout: { by: 'mine', picked: true, names: ['Design'] } }), e = E.page;
194
- await e.click('.hm-card [data-hm-ov]');
193
+ await (async (g) => { const P = '#czViewer:not([hidden]) [data-hi-v="page"]', r = '#hmList [data-hm-sel^="i:"][aria-current="true"]'; for (let i = 0; i < 4 && !(await g.$(P)) && (await g.$('#czViewer:not([hidden]) [data-cz-vw="back"]')); i++) { await g.click('#czViewer [data-cz-vw="back"]'); await g.waitForTimeout(150); } if (await g.$(P)) return; if (await g.$(r)) await g.click(r); else await g.reload(); await g.waitForSelector(P + ' .hi-pgh [data-hi-addtask]', { timeout: 30000 }); })(e); /* ← back to the initiative's page, else its row, else the address again (an initiative the list does not show) */ await e.click('#czViewer .hi-pgh [data-hi-addtask]'); /* the initiative's page (canvas HbC): its + drills into Tasks */
195
194
  ok('T1 a grouping the PM chose wins over the Epic default', await until(() => e.evaluate((v) => !!document.querySelector(v + ' .hi-tg') && !document.querySelector(v + ' .tk-row'), V)));
196
195
  await E.ctx.close();
197
196
  }