create-pmos 0.457.0 → 0.459.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 +27 -27
- 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 +1 -1
- package/workspace/briefing-premium-board-test.js +17 -17
- package/workspace/briefing-premium-initiative-test.js +8 -10
- package/workspace/changelog.json +26 -0
- package/workspace/guide/adler.md +1 -1
- package/workspace/guide/initiatives-screen.md +14 -2
- package/workspace/ini-workflow-test.js +5 -9
- package/workspace/metric-drafts-ui-test.js +11 -9
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +3 -3
- package/workspace/premium-vw-backlog-test.js +1 -1
- package/workspace/premium-vw-item-test.js +1 -1
- package/workspace/premium-vw-jira-test.js +1 -1
- package/workspace/program-panel-test.js +2 -2
- package/workspace/public/pm/ini-about.js +145 -0
- package/workspace/public/pm/ini-tasks.js +6 -34
- package/workspace/public/pm/ini-view-model.js +12 -2
- package/workspace/public/pm/ini-view.css +180 -143
- package/workspace/public/pm/ini-view.js +137 -145
- package/workspace/public/pm/metric-drafts.js +8 -2
- package/workspace/public/pm/mission.js +159 -135
- package/workspace/public/pm/stage-line.js +4 -1
- package/workspace/public/pm/task-card.js +2 -0
- package/workspace/split-merge-ui-test.js +1 -1
- package/workspace/stage-card-tasks-test.js +2 -2
- package/workspace/stage-card-test.js +48 -51
- package/workspace/task-card-test.js +39 -1
- package/workspace/task-links-test.js +8 -9
- package/workspace/task-press-test.js +2 -2
- package/workspace/task-views-test.js +15 -76
- package/workspace/test-lists/initiative-mission-control.json +5 -0
- package/workspace/test-lists/mission.json +7 -3
- package/workspace/tk-tasks-test.js +3 -3
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/* pm/ini-about.js — About, the third part of the initiative's mission-control component (initiative-mission-control, R6): the description and
|
|
2
|
+
* the success measure, folded to one line.
|
|
3
|
+
*
|
|
4
|
+
* descOf(md) → the description a PRD gives: the first paragraph after its Problem or Why heading, else its first paragraph. Pure.
|
|
5
|
+
* want(ws, path, onChange) reads the PRD once per path through GET /api/doc and keeps its description; onChange() runs when it arrives
|
|
6
|
+
* trackOf(r, o) → the pace track of a measure row that carries a start value and a pace, or null. Pure. o: { now (ms), finished }
|
|
7
|
+
* aboutHtml(v, o, open) → the markup: the header press (data-iv-mc="ab") with its one-line summary, then the two columns when open
|
|
8
|
+
* resetAbout() forget the descriptions read (for the tests)
|
|
9
|
+
*
|
|
10
|
+
* The success measure is the one Claude drafts (pm/metric-drafts.js, GET /api/metric-drafts): its proposal keeps its own card and presses; a
|
|
11
|
+
* kept measure is listed here as rows, each with its Now → Target. A row that also carries `base` (where it started) and `pace` (how far it
|
|
12
|
+
* should be by today, 0 to 1) draws as a track with a tick at the pace and a verdict: On pace, Ahead of pace, Behind pace, Short of target,
|
|
13
|
+
* Reached the target. No record holds `base` and `pace` yet, so no row draws the track today; the rows read as text until one does.
|
|
14
|
+
* Zero is silence: a part with nothing on record draws its next action, never an empty box. */
|
|
15
|
+
import * as MD from './metric-drafts.js';
|
|
16
|
+
|
|
17
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
18
|
+
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>`;
|
|
19
|
+
const P = { down: 'M7 10l5 5 5-5', go: 'M5 12h14M13 6l6 6-6 6', undo: 'M9 14L4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3', chat: 'M4 5h16v11H9l-5 4z' };
|
|
20
|
+
const STALE_DAYS = 30;
|
|
21
|
+
const MAX_CHARS = 700;
|
|
22
|
+
|
|
23
|
+
/* ── the description ── */
|
|
24
|
+
const plain = (s) => String(s).replace(/!\[[^\]]*\]\([^)]*\)/g, '').replace(/\[([^\]]+)\]\([^)]*\)/g, '$1').replace(/[*_`]+/g, '').replace(/<[^>]+>/g, '').replace(/\s+/g, ' ').trim();
|
|
25
|
+
/** The description a PRD gives. */
|
|
26
|
+
export function descOf(md) {
|
|
27
|
+
let t = String(md || '').replace(/\r\n?/g, '\n');
|
|
28
|
+
t = t.replace(/^---\n[\s\S]*?\n---\n?/, '');
|
|
29
|
+
const lines = t.split('\n');
|
|
30
|
+
const paraAfter = (from) => {
|
|
31
|
+
let i = from, out = [];
|
|
32
|
+
while (i < lines.length && !lines[i].trim()) i++;
|
|
33
|
+
for (; i < lines.length; i++) {
|
|
34
|
+
const l = lines[i];
|
|
35
|
+
if (!l.trim() || /^#{1,6}\s/.test(l)) break;
|
|
36
|
+
if (/^\s*([-*+]|\d+[.)])\s|^\s*>|^\s*\||^\s*```/.test(l) && !out.length) { out = []; continue; }
|
|
37
|
+
out.push(l.trim());
|
|
38
|
+
}
|
|
39
|
+
return plain(out.join(' '));
|
|
40
|
+
};
|
|
41
|
+
const head = lines.findIndex((l) => /^#{1,3}\s*(problem|why|background|context|summary|overview)\b/i.test(l));
|
|
42
|
+
let d = head >= 0 ? paraAfter(head + 1) : '';
|
|
43
|
+
if (!d) {
|
|
44
|
+
// the first paragraph of prose: not the title, a bold byline, a list or a table
|
|
45
|
+
for (let i = 0; i < lines.length && !d; i++) {
|
|
46
|
+
const l = lines[i]; if (!l.trim() || /^#{1,6}\s|^\s*([-*+]|\d+[.)])\s|^\s*>|^\s*\||^\s*```|^\*\*[^*]+:\*\*/.test(l)) continue;
|
|
47
|
+
d = paraAfter(i);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return d.length > MAX_CHARS ? d.slice(0, MAX_CHARS).replace(/\s+\S*$/, '') + '…' : d;
|
|
51
|
+
}
|
|
52
|
+
const READ = new Map(); // ws|path → { state: loading | ok | none, text }
|
|
53
|
+
/** Reads the PRD's description once per path. */
|
|
54
|
+
let LASTWS = ''; // the workspace the last read named: the markup is drawn before the host says which one it is
|
|
55
|
+
export function want(ws, path, onChange) {
|
|
56
|
+
if (!path || typeof fetch !== 'function') return null;
|
|
57
|
+
LASTWS = ws || '';
|
|
58
|
+
const k = (ws || '') + '|' + path, had = READ.get(k); if (had) return had;
|
|
59
|
+
const one = { state: 'loading', text: '' }; READ.set(k, one);
|
|
60
|
+
const q = new URLSearchParams({ path }); if (ws) q.set('ws', ws);
|
|
61
|
+
fetch('/api/doc?' + q.toString(), { credentials: 'same-origin' }).then((r) => (r.ok ? r.text() : null)).catch(() => null).then((t) => {
|
|
62
|
+
const d = t ? descOf(t) : ''; one.state = d ? 'ok' : 'none'; one.text = d; if (d && onChange) onChange();
|
|
63
|
+
});
|
|
64
|
+
return one;
|
|
65
|
+
}
|
|
66
|
+
const descFor = (ws, path) => READ.get((ws || '') + '|' + path) || null;
|
|
67
|
+
export const resetAbout = () => { READ.clear(); OPEN.clear(); LASTWS = ''; };
|
|
68
|
+
const OPEN = new Set(); // initiative ids whose description is open past three lines, for the session
|
|
69
|
+
|
|
70
|
+
/* ── the pace track ── */
|
|
71
|
+
const num = (x) => (x == null || x === '' || !Number.isFinite(+x) ? null : +x);
|
|
72
|
+
/** { p (0..1 moved), e (0..1 expected), state, words, lo, hi } for a row with now, target, base and pace; null otherwise. */
|
|
73
|
+
export function trackOf(r, o = {}) {
|
|
74
|
+
const base = num(r.base), tgt = num(r.target), now = num(r.now), pace = num(r.pace);
|
|
75
|
+
if (base == null || tgt == null || pace == null || base === tgt) return null;
|
|
76
|
+
const at = r.readAt ? Date.parse(r.readAt) : NaN, age = Number.isFinite(at) ? Math.floor(((o.now == null ? Date.now() : o.now) - at) / 864e5) : null;
|
|
77
|
+
const e = Math.max(0, Math.min(1, pace));
|
|
78
|
+
if (now == null) return { p: 0, e, state: 'unread', words: 'Not read yet', lo: r.baseTxt || String(base), hi: r.targetTxt || String(tgt) };
|
|
79
|
+
const p = Math.max(0, Math.min(1, (now - base) / (tgt - base)));
|
|
80
|
+
let state = p >= e + 0.05 ? 'ahead' : p >= e - 0.05 ? 'on' : 'behind', words = state === 'ahead' ? 'Ahead of pace' : state === 'on' ? 'On pace' : 'Behind pace';
|
|
81
|
+
if (o.finished) { state = p >= 0.999 ? 'hit' : 'short'; words = state === 'hit' ? 'Reached the target' : 'Short of target'; }
|
|
82
|
+
if (age != null && age > STALE_DAYS) { state = 'stale'; words = 'Read ' + age + ' days ago'; }
|
|
83
|
+
return { p, e, state, words, lo: r.baseTxt || String(base), hi: r.targetTxt || String(tgt) };
|
|
84
|
+
}
|
|
85
|
+
const roleOf = (r) => MD.roleOf(r);
|
|
86
|
+
const nowText = (r) => (r.now == null && !r.nowTxt ? '—' : r.nowTxt || String(r.now));
|
|
87
|
+
const rowHtml = (r, o) => {
|
|
88
|
+
const t = trackOf(r, o), off = r.now == null && !!r.ticket;
|
|
89
|
+
const sub = off ? 'Waits on ' + (r.ticket.key || 'a drafted ticket') : /guard/i.test(String(r.group || '')) ? 'Stays at ' + (r.targetTxt || r.target) : r.nowTxt || r.now != null ? nowText(r) + ' → ' + (r.targetTxt || r.target) : r.targetTxt || r.target;
|
|
90
|
+
const pc = (x) => Math.round(x * 100) + '%';
|
|
91
|
+
const tr = t ? `<svg class="ab-trk ${t.state}" role="img" aria-label="${esc(t.words)}" width="100%" height="6"><rect class="bg" x="0" y="0" width="100%" height="6" rx="3"/><rect class="fl" x="0" y="0" width="${pc(t.p)}" height="6" rx="3"/><line class="pc" x1="${pc(t.e)}" x2="${pc(t.e)}" y1="-4" y2="10"><title>Where it should be by today</title></line></svg><span class="ab-lb"><span>${esc(t.lo)}</span><span>${esc(t.hi)}</span></span><span class="ab-pl ${t.state}">${esc(t.words)}</span>` : '';
|
|
92
|
+
return `<div class="ab-mr"><span class="ab-mk">${esc(roleOf(r))}</span><span class="ab-mn"><b>${esc(r.name)}</b><span>${esc(sub)}</span></span>${tr}</div>`;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/* ── the markup ── */
|
|
96
|
+
const homeHref = (ws, id, q) => { const u = new URLSearchParams(); if (ws) u.set('ws', ws); u.set('ask', id); u.set('q', q); return '/premium.html?' + u.toString(); };
|
|
97
|
+
/** The folded line: the first measure's dot and value, or the one next action. */
|
|
98
|
+
function summaryOf(v, M, d, o) {
|
|
99
|
+
const none = !d || d.state !== 'ok';
|
|
100
|
+
if (M && M.mode === 'kept') {
|
|
101
|
+
const r = M.rows[0], t = trackOf(r, o), st = t ? t.state : r.now == null ? 'unread' : '';
|
|
102
|
+
const val = r.now == null && !r.nowTxt ? 'not read yet' : nowText(r) + (r.targetTxt ? ' → ' + r.targetTxt : '');
|
|
103
|
+
return `<span class="ab-sum"><i class="ab-dot ${st}" aria-hidden="true"></i><span class="nm">${esc(r.name)}</span><span class="vv">${esc(val)}</span>${t && t.state === 'stale' ? `<span class="st late">${esc(t.words)}</span>` : ''}</span>`;
|
|
104
|
+
}
|
|
105
|
+
if (M && M.mode === 'open') return '<span class="ab-sum"><span class="nx">A success measure is proposed</span></span>';
|
|
106
|
+
if (none && v.docState === 'none') return '<span class="ab-sum"><span class="nx">No description or success measure yet</span></span>';
|
|
107
|
+
return '<span class="ab-sum"></span>';
|
|
108
|
+
}
|
|
109
|
+
export function aboutHtml(v, o, open) {
|
|
110
|
+
const id = v.id || v.key || '', ws = o.ws || LASTWS;
|
|
111
|
+
const prd = v.links && v.links.prd ? v.links.prd : '';
|
|
112
|
+
const d = prd ? descFor(ws, prd) : null;
|
|
113
|
+
const M = MD.measuresOf(id);
|
|
114
|
+
v = { ...v, docState: !prd ? 'none' : d ? d.state : 'loading' };
|
|
115
|
+
const sum = summaryOf(v, M, d, o);
|
|
116
|
+
let desc;
|
|
117
|
+
if (d && d.state === 'ok') {
|
|
118
|
+
const long = d.text.length > 260, shut = long && !OPEN.has(id);
|
|
119
|
+
desc = `<p class="ab-p${shut ? ' cl' : ''}">${esc(d.text)}</p>${long ? `<button type="button" class="ab-lk" data-ab-more="${esc(id)}" aria-expanded="${!shut}">${shut ? 'Show more' : 'Show less'}</button>` : ''}`
|
|
120
|
+
+ (o.doc ? `<button type="button" class="ab-lk" data-iv-doc="${esc(prd)}">Open the PRD ${SVG(P.go, 14, 2.2)}</button>` : '');
|
|
121
|
+
} else if (prd && (!d || d.state === 'loading')) desc = '<p class="ab-p q">Reading the PRD…</p>';
|
|
122
|
+
else desc = `<p class="ab-p q">No description yet.</p><a class="ab-lk" href="${esc(homeHref(ws, id, 'Draft the description of ' + (v.title || id) + ': '))}">${SVG(P.chat, 14)} Ask Claude to draft it</a>`;
|
|
123
|
+
let met;
|
|
124
|
+
if (M && M.mode === 'open') met = MD.iniHtml(id, ws, v.title);
|
|
125
|
+
else if (M && M.mode === 'kept') met = `<div class="ab-ml">${M.rows.map((r) => rowHtml(r, o)).join('')}</div>`
|
|
126
|
+
+ MD.ib({ act: 'undo', scope: 'initiative', id, icon: P.undo, label: 'Undo: make the success measure a proposal again', title: 'Undo', busy: M.busy });
|
|
127
|
+
else met = `<p class="ab-p q">No success measure yet.</p><a class="ab-lk" href="${esc(homeHref(ws, id, 'Propose a success measure for ' + (v.title || id) + ': '))}">${SVG(P.chat, 14)} Ask Claude to propose one</a>`;
|
|
128
|
+
const anchor = v.anchor ? `<span>Anchored to ${esc(v.anchor)}</span>` : '';
|
|
129
|
+
return `<section class="iv-ab" aria-label="About"><button type="button" class="iv-ab-h" data-iv-mc="ab" aria-expanded="${!!open}"><b>About</b>${sum}<span class="chev" aria-hidden="true">${SVG(P.down, 16, 2)}</span></button>`
|
|
130
|
+
+ (open ? `<div class="iv-ab-b"><div class="ab-d"><h4>Description${d && d.state === 'ok' ? ' <span>From the PRD</span>' : ''}</h4>${desc}</div><div class="ab-m"><h4>Success measure ${anchor}</h4>${met}</div></div>` : '') + '</section>';
|
|
131
|
+
}
|
|
132
|
+
/** The banner's one measure chip (R2): the first kept measure's dot and value, or a proposal's mark; '' when there is none. */
|
|
133
|
+
export function chipHtml(v, o = {}) {
|
|
134
|
+
const M = MD.measuresOf(v.id || v.key || ''); if (!M) return '';
|
|
135
|
+
if (M.mode === 'open') return '<span class="iv-chp2 nx">A success measure is proposed</span>';
|
|
136
|
+
const r = M.rows[0], t = trackOf(r, o), st = t ? t.state : r.now == null ? 'unread' : '';
|
|
137
|
+
const val = r.now == null && !r.nowTxt ? 'not read yet' : nowText(r) + (r.targetTxt ? ' → ' + r.targetTxt : '');
|
|
138
|
+
return `<span class="iv-chp2${st === 'behind' || st === 'stale' || st === 'short' ? ' late' : ''}"><i class="ab-dot ${st}" aria-hidden="true"></i>${esc(r.name)} · ${esc(val)}</span>`;
|
|
139
|
+
}
|
|
140
|
+
/** A press on the description's Show more. → true when it was one */
|
|
141
|
+
export function pressMore(b, redraw) {
|
|
142
|
+
const id = b && b.dataset && b.dataset.abMore; if (!id) return false;
|
|
143
|
+
if (OPEN.has(id)) OPEN.delete(id); else OPEN.add(id);
|
|
144
|
+
if (redraw) redraw(); return true;
|
|
145
|
+
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* viewMode() / setViewMode(m) 'list' | 'timeline' | 'kanban': the last view, remembered for the PM across initiatives; first time List
|
|
7
7
|
* switchHtml(m) the icon-only segment List / Timeline / Kanban (Kanban is the Board's "By stage" icon)
|
|
8
8
|
* viewBtnHtml(m) the Tasks header's one view button (batch 18 item 1, XvpA4Sheet); its press opens the view sheet
|
|
9
|
-
* fullBtnHtml(m) Full width, beside the view button: a desktop's Timeline at Weeks or Months (0.442.0 hotfix)
|
|
10
9
|
* sheetHtml(m, g, z) the sheet: View, Group by (Stage, Owner, Status, ⋯ for Epic and Your groups) and the Timeline's Zoom
|
|
11
10
|
* (Weeks, Months, All); a bottom sheet on a phone, a popover under the button on a desktop
|
|
12
11
|
* kanbanPickHtml(v) Kanban's stage picker, at the top of the Kanban
|
|
@@ -33,7 +32,6 @@ export const P = {
|
|
|
33
32
|
list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01', time: 'M4 6h9M8 12h11M6 18h7', kanban: 'M4 4h4v16H4zM10 4h4v10h-4zM16 4h4v13h-4z',
|
|
34
33
|
down: 'M7 10l5 5 5-5', right: 'M10 7l5 5-5 5', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', jira: 'M4 7h16v3a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4z', check: 'M5 12l5 5 9-10',
|
|
35
34
|
dia: 'M12 4l8 8-8 8-8-8z', skip: 'M6 7l5 5-5 5M13 7l5 5-5 5', bin: 'M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13',
|
|
36
|
-
full: 'M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5', unfull: 'M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5',
|
|
37
35
|
};
|
|
38
36
|
/** The small grey ◇ after a milestone task's title (batch 11 item 3), on every task row: List, Kanban, Timeline. The Jira mark is another
|
|
39
37
|
* shape (blue, nested) and stays as it is. */
|
|
@@ -53,31 +51,13 @@ const store = { get: (k) => { try { return localStorage.getItem(k); } catch { re
|
|
|
53
51
|
let VIEW = null, ZOOM = null;
|
|
54
52
|
const STAGE = new Map(); // initiative → the Kanban's stage key ('all' | a section key)
|
|
55
53
|
const SCROLL = new Map(); // initiative|zoom → the Timeline's scroll, so a redraw keeps the PM's place
|
|
56
|
-
export function viewMode() { if (!VIEW) { const v = store.get('pmos.tasks.view'); VIEW = v === 'timeline' || v === 'kanban' ? v : 'list'; } return VIEW; }
|
|
54
|
+
export function viewMode() { if (!VIEW) { const v = store.get('pmos.tasks.view'); VIEW = v === 'timeline' || v === 'kanban' ? v : 'list'; } return NARROW() ? 'list' : VIEW; }
|
|
57
55
|
export function setViewMode(m) { VIEW = m === 'timeline' || m === 'kanban' ? m : 'list'; store.set('pmos.tasks.view', VIEW); }
|
|
58
|
-
/*
|
|
59
|
-
*
|
|
56
|
+
/* A phone shows the List only (initiative-mission-control R8): the Timeline and the Kanban do not draw well in that width. A Timeline or Kanban
|
|
57
|
+
* the PM picked on a desk is kept; it reads as the List on a phone and comes back on a desk. The full-width button is gone: the split panel
|
|
58
|
+
* replaces it. */
|
|
60
59
|
const PHONE = () => typeof matchMedia === 'function' && matchMedia('(max-width: 720px)').matches;
|
|
61
|
-
const
|
|
62
|
-
let REDRAW = null; // the Viewer's redraw: a Year, 2 years or 5 years axis stretches to the new width
|
|
63
|
-
function setFull(on) {
|
|
64
|
-
document.body.classList.toggle('ivt-full', !!on);
|
|
65
|
-
if (REDRAW && document.querySelector('#czViewer .ivt')) REDRAW();
|
|
66
|
-
const b = document.querySelector('#czViewer [data-iv-full]'), l = on ? 'Back to the panel' : 'Full width';
|
|
67
|
-
if (b) { b.setAttribute('aria-pressed', String(!!on)); b.setAttribute('aria-label', l); b.title = l; b.innerHTML = SVG(on ? P.unfull : P.full, 18); }
|
|
68
|
-
// Escape goes back to the panel first: the Viewer leaves Escape to a [data-esc-layer] (pm/cozy-viewer.js), so the Viewer carries the mark
|
|
69
|
-
// while full; an open zoom menu closes on its own Escape before this one; a Viewer that left the Timeline closes as usual
|
|
70
|
-
const vw = document.getElementById('czViewer'); if (vw) vw.toggleAttribute('data-esc-layer', !!on);
|
|
71
|
-
if (on && !setFull.esc) {
|
|
72
|
-
setFull.esc = true;
|
|
73
|
-
addEventListener('keydown', (e) => {
|
|
74
|
-
if (e.key !== 'Escape' || !fullOn() || POP) return;
|
|
75
|
-
e.preventDefault(); e.stopImmediatePropagation();
|
|
76
|
-
const tl = !!document.querySelector('#czViewer .ivt'); setFull(false);
|
|
77
|
-
if (!tl && window.czViewer && window.czViewer.isOpen()) window.czViewer.close();
|
|
78
|
-
}, true);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
60
|
+
const NARROW = () => typeof matchMedia === 'function' && matchMedia('(max-width: 760px)').matches;
|
|
81
61
|
const zoomOf = () => { if (!ZOOM) { const z0 = store.get('pmos.tasks.zoom'), z = OLD_ZOOM[z0] || z0; ZOOM = ZOOMS.some((x) => x[0] === z) ? z : 'week'; } return ZOOM; };
|
|
82
62
|
/** The Timeline's zoom: 'week' | 'month' | 'all'. A stored zoom from before the three steps reads as All. */
|
|
83
63
|
export const zoomMode = () => zoomOf();
|
|
@@ -130,18 +110,11 @@ export function kanbanPickHtml(v) {
|
|
|
130
110
|
const what = v.tasks.by && v.tasks.by !== 'stage' ? 'Group' : 'Stage';
|
|
131
111
|
return `<button type="button" class="ivx-pick on" data-iv-kstage aria-haspopup="menu" aria-label="${what}: ${esc(x.label)}. Change">${esc(x.label)}${SVG(P.down, 14, 2)}</button>`;
|
|
132
112
|
}
|
|
133
|
-
/** Full width: a desktop's Timeline at Weeks and Months (All fits the panel), in the Tasks header beside the view button (0.442.0 hotfix:
|
|
134
|
-
* at the Timeline's foot it went unseen). Once on it stays there at All too, so the way back is where it was. */
|
|
135
|
-
export function fullBtnHtml(m) {
|
|
136
|
-
if (m !== 'timeline' || PHONE() || (zoomOf() === 'all' && !fullOn())) return '';
|
|
137
|
-
const f = fullOn(), fl = f ? 'Back to the panel' : 'Full width';
|
|
138
|
-
return `<button type="button" class="iv-ib ivt-fl" data-iv-full aria-pressed="${f}" aria-label="${fl}" title="${fl}">${SVG(f ? P.unfull : P.full, 16)}</button>`;
|
|
139
|
-
}
|
|
140
113
|
const MORE = 'M5 12h.01M12 12h.01M19 12h.01';
|
|
141
114
|
/** The sheet's rows. g: the grouping as the host knows it ({ by, label } or null where Tasks cannot be grouped). */
|
|
142
115
|
export function sheetHtml(m, g, z = zoomOf()) {
|
|
143
116
|
const seg = (label, items) => `<div class="ivs-seg" role="group" aria-label="${esc(label)}">${items.map((x) => `<button type="button" class="${[x.cls, x.on ? 'on' : ''].filter(Boolean).join(' ')}" aria-pressed="${!!x.on}" ${x.attr}${x.aria ? ` aria-label="${esc(x.aria)}"` : ''} title="${esc(x.tip || x.aria || x.text)}">${x.html || esc(x.text)}</button>`).join('')}</div>`;
|
|
144
|
-
let h = '<p class="ivs-h">View</p>' + seg('View', VIEWS.map(([k, l, d]) => ({ attr: `data-ivs-view="${k}"`, on: k === m, aria: l, html: SVG(d, 18) })));
|
|
117
|
+
let h = NARROW() ? '' : '<p class="ivs-h">View</p>' + seg('View', VIEWS.map(([k, l, d]) => ({ attr: `data-ivs-view="${k}"`, on: k === m, aria: l, html: SVG(d, 18) })));
|
|
145
118
|
if (g) {
|
|
146
119
|
const other = !['stage', 'owner', 'status'].includes(g.by);
|
|
147
120
|
// Epic and Your groups (batch 11 item 20) stay one press away: the ⋯ opens them, named while one is on
|
|
@@ -705,7 +678,6 @@ export function press(b, d, root, H, e) {
|
|
|
705
678
|
if (hidden && d.ivView === viewMode()) { menuPop(b, 'Tasks view', VIEWS.map(([k, l]) => ({ k, label: l, on: k === viewMode() })), (x) => { setViewMode(x.k); if (H.redraw) H.redraw(); }); return true; }
|
|
706
679
|
setViewMode(d.ivView); closePop(); if (H.redraw) H.redraw(); return true;
|
|
707
680
|
}
|
|
708
|
-
if ('ivFull' in d) { REDRAW = H && H.redraw; setFull(!fullOn()); return true; }
|
|
709
681
|
if ('ivKstage' in d) {
|
|
710
682
|
const v = H.__v; if (!v) return true;
|
|
711
683
|
const cur = stageKeyOf(v);
|
|
@@ -216,6 +216,8 @@ export function iniView(r, ctx = {}) {
|
|
|
216
216
|
left: end && !finished ? (end < today ? plural(between(end, today), 'day', 'days') + ' over' : end > today ? plural(between(today, end), 'day', 'days') + ' left' : 'ends today') : '',
|
|
217
217
|
over: !!(end && end < today && !finished),
|
|
218
218
|
jira: fc && (!end || fc > end) && !finished ? dateY(t.forecast, today) : '',
|
|
219
|
+
// the numbers behind "N days left" (the mission's readouts): the plan's length, the days gone (negative before the start), the days left (negative once over); none once finished or with one date
|
|
220
|
+
n: r.start && end && !finished ? { total: between(dayOf(r.start), end), gone: between(dayOf(r.start), today), left: between(today, end) } : null,
|
|
219
221
|
} : null;
|
|
220
222
|
let nx = null;
|
|
221
223
|
// Won't do and Archived hold their stage (D99 wfRules): no next stage to move to
|
|
@@ -223,9 +225,17 @@ export function iniView(r, ctx = {}) {
|
|
|
223
225
|
// the stage card is one line (batch 11 item 21, agreed A): each stage on its own dates, the milestone tasks as ◇, the Board's states
|
|
224
226
|
const line = lineOf(r, { list, cur, ran, rows, today, deps: tr.deps || [] });
|
|
225
227
|
const ready = !!nx && curRows.length > 0 && curRows.every((x) => x.closed); // every task of the stage done: the → turns blue (state 1)
|
|
228
|
+
// the way to finish the stage (R5): the stage's count, and its milestone tasks, the open ones by date, the done ones counted
|
|
229
|
+
const msRows = curRows.filter((x) => x.ms && !x.wont);
|
|
230
|
+
const gates = {
|
|
231
|
+
open: msRows.filter((x) => !x.closed).sort((a, b2) => (a.end || '9999').localeCompare(b2.end || '9999')).map((x) => ({ id: x.uid, name: x.title, date: x.end ? dateY(x.end, today) : '', late: x.late,
|
|
232
|
+
ago: x.late ? between(dayOf(x.end), today) : 0, left: !x.late && x.end && dayOf(x.end) >= today ? between(today, dayOf(x.end)) : null, owner: x.owner, av: x.av })),
|
|
233
|
+
done: msRows.filter((x) => x.closed).length,
|
|
234
|
+
};
|
|
235
|
+
const sTotal = jira ? tk.length : curRows.length, sDone = jira ? tk.filter((k) => k.status === 'Done').length : curRows.filter((x) => x.closed).length;
|
|
226
236
|
const stage = {
|
|
227
237
|
n: cur >= 0 ? cur + 1 : null, of: list.length, name: st ? st.name : (t.label || r.stage || 'No stage on record'), ms: !!(st && st.ms), key: st ? st.key : '',
|
|
228
|
-
doneOf, day: days != null ? 'day ' + days + (usual != null ? ' of ~' + usual : '') : '', dayOver: days != null && usual != null && days > usual,
|
|
238
|
+
doneOf, nDone: sDone, nTotal: sTotal, nLate: curRows.filter((x) => !x.closed && x.late).length, gates, day: days != null ? 'day ' + days + (usual != null ? ' of ~' + usual : '') : '', dayOver: days != null && usual != null && days > usual,
|
|
229
239
|
clock: days != null && !line.chip ? (usual != null ? days + ' of ~' + usual + ' days' : plural(days, 'day', 'days')) : '', line, ready,
|
|
230
240
|
ladder: list.map((s) => ({ name: s.name, ms: s.ms, cls: s.status })), dates, next: nx,
|
|
231
241
|
aria: cur >= 0 ? 'Stage ' + (cur + 1) + ' of ' + list.length + ' of ' + ((r.wf && r.wf.name) || 'Product feature') + ': ' + st.name + '.' + (nx ? ' Next stage: ' + nx.name + '.' : '') : 'No stage on record.',
|
|
@@ -297,7 +307,7 @@ export function iniView(r, ctx = {}) {
|
|
|
297
307
|
summary.wf = r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' };
|
|
298
308
|
summary.program = ctx.program || null;
|
|
299
309
|
const today2 = (n) => String(n).padStart(2, '0');
|
|
300
|
-
return { vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jira ? ctx.jiraAt || '' : '', jiraRead: ctx.jiraReadAt || '',
|
|
310
|
+
return { anchor: r.kr || '', vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jira ? ctx.jiraAt || '' : '', jiraRead: ctx.jiraReadAt || '',
|
|
301
311
|
// split or merge (batch 11 item 14): Claude's suggestion for it, and where its work went when it was merged
|
|
302
312
|
suggest: r.suggest || null, merged: mergedOf(r),
|
|
303
313
|
// what Claude proposes under the one blue ✦, and what a ✓ kept from elsewhere (batch 12 items 2, 3 and 4; pm/ini-props.js)
|