create-pmos 0.406.0 → 0.407.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.
- package/package.json +13 -18
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +4 -3
- package/workspace/briefing-premium-doc-edit-test.js +3 -5
- package/workspace/briefing-premium-initiative-test.js +46 -27
- package/workspace/changelog.json +12 -0
- package/workspace/guide/home.md +10 -4
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +2 -2
- package/workspace/premium-core-doc-issue-test.js +4 -1
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-doc-test.js +4 -6
- package/workspace/premium-vw-item-test.js +1 -1
- package/workspace/premium-vw-jira-test.js +2 -2
- package/workspace/public/pm/bd-prog-panel.js +4 -3
- package/workspace/public/pm/cozy-home.css +5 -0
- package/workspace/public/pm/cozy-nav.js +4 -0
- package/workspace/public/pm/cozy-today.css +2 -0
- package/workspace/public/pm/cozy-viewer.js +24 -8
- package/workspace/public/pm/home-app.js +103 -59
- package/workspace/public/pm/home-ini.css +14 -0
- package/workspace/public/pm/home-ini.js +93 -81
- package/workspace/public/pm/home-today.js +7 -5
- package/workspace/public/premium.html +1 -1
- 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
|
|
6
|
-
*
|
|
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
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
|
|
194
|
-
|
|
195
|
-
+ (
|
|
196
|
-
|
|
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
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
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
|
-
|
|
419
|
-
|
|
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
|
-
|
|
579
|
-
function
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
if (
|
|
583
|
-
if ('
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
}
|
|
589
|
-
if (
|
|
590
|
-
if (
|
|
591
|
-
if (d.
|
|
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))
|
|
599
|
-
|
|
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
|
-
|
|
97
|
-
|
|
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
|
|
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>
|
|
@@ -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
|
-
|
|
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('.
|
|
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
|
}
|