create-pmos 0.422.0 → 0.424.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 +25 -25
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/board-programs-test.js +28 -0
- package/workspace/briefing-premium-adddoc-test.js +1 -1
- package/workspace/briefing-premium-board-test.js +12 -10
- package/workspace/briefing-premium-initiative-test.js +30 -38
- package/workspace/briefing-premium-products-test.js +16 -3
- package/workspace/changelog.json +24 -0
- package/workspace/guide/briefing-premium.md +1 -1
- package/workspace/guide/claude-proposes.md +37 -0
- package/workspace/guide/home.md +9 -2
- package/workspace/guide/index.md +1 -0
- package/workspace/guide/programs.md +1 -0
- package/workspace/guide/workflows.md +5 -1
- package/workspace/home-pill-test.js +138 -0
- package/workspace/ini-workflow-test.js +4 -4
- package/workspace/lib/board-premium.js +3 -2
- package/workspace/lib/custom-docs.js +65 -3
- package/workspace/lib/engine/boards.js +25 -2
- package/workspace/lib/headless.js +14 -1
- package/workspace/lib/initiative-writer.js +63 -1
- package/workspace/lib/plan-items.js +36 -5
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/programs.js +11 -3
- package/workspace/lib/proposal-runs.js +148 -0
- package/workspace/lib/proposals.js +370 -0
- package/workspace/lib/propose-cli.js +96 -0
- package/workspace/lib/route-modules.js +2 -0
- package/workspace/lib/routes-board-premium.js +33 -0
- package/workspace/lib/routes-boards.js +50 -10
- package/workspace/lib/routes-initiatives.js +12 -0
- package/workspace/lib/routes-proposals.js +325 -0
- package/workspace/lib/routes-task-links.js +336 -0
- package/workspace/lib/split-merge-suggest.js +162 -0
- package/workspace/lib/split-merge.js +379 -0
- package/workspace/lib/task-cli.js +58 -5
- package/workspace/lib/task-items.js +14 -2
- package/workspace/lib/task-links.js +422 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +4 -4
- package/workspace/premium-core-doc-issue-test.js +2 -2
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-item-test.js +3 -3
- package/workspace/premium-vw-jira-test.js +6 -6
- package/workspace/product-lane-test.js +165 -0
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-asks.js +3 -0
- package/workspace/public/pm/bd-ini-panel.js +16 -6
- package/workspace/public/pm/bd-prog.js +6 -1
- package/workspace/public/pm/bd-span.js +69 -15
- package/workspace/public/pm/bd-views.js +3 -2
- package/workspace/public/pm/cozy-board.css +10 -0
- package/workspace/public/pm/cozy-today.css +23 -0
- package/workspace/public/pm/cozy-viewer.js +14 -3
- package/workspace/public/pm/cozy-vw-shell.css +8 -0
- package/workspace/public/pm/home-app.js +45 -14
- package/workspace/public/pm/home-ini-model.js +0 -34
- package/workspace/public/pm/home-ini.js +72 -204
- package/workspace/public/pm/home-task.js +2 -1
- package/workspace/public/pm/home-today.js +66 -16
- package/workspace/public/pm/ini-groups.js +253 -0
- package/workspace/public/pm/ini-links.js +519 -0
- package/workspace/public/pm/ini-props.js +218 -0
- package/workspace/public/pm/ini-tasks.js +58 -22
- package/workspace/public/pm/ini-versions.js +14 -9
- package/workspace/public/pm/ini-view-model.js +93 -4
- package/workspace/public/pm/ini-view.css +306 -18
- package/workspace/public/pm/ini-view.js +161 -36
- package/workspace/public/pm/premium-board.js +54 -6
- package/workspace/public/pm/premium-vw-item.js +2 -1
- package/workspace/public/pm/split-merge.css +77 -0
- package/workspace/public/pm/split-merge.js +265 -0
- package/workspace/public/pm/stage-line.js +414 -0
- package/workspace/public/pm/task-card.css +13 -0
- package/workspace/public/pm/task-card.js +42 -5
- package/workspace/public/pm/wf-page.css +2 -0
- package/workspace/public/pm/wf-page.js +2 -0
- package/workspace/public/pm/wf-stage.js +2 -1
- package/workspace/server.js +52 -3
- package/workspace/skills/initiative-propose.skill +45 -0
- package/workspace/split-merge-ui-test.js +175 -0
- package/workspace/stage-card-test.js +13 -12
- package/workspace/task-card-test.js +3 -2
- package/workspace/task-delete-test.js +126 -0
- package/workspace/task-links-test.js +239 -0
- package/workspace/task-milestones-test.js +1 -1
- package/workspace/task-plans-test.js +6 -0
- package/workspace/task-views-test.js +1 -1
- package/workspace/test-lists/bd-ini-panel.json +8 -2
- package/workspace/test-lists/claude-proposes.json +5 -0
- package/workspace/test-lists/home-sessions-pill.json +6 -0
- package/workspace/test-lists/product-lane.json +6 -0
- package/workspace/test-lists/split-merge.json +15 -0
- package/workspace/test-lists/task-delete.json +5 -0
- package/workspace/test-lists/task-links.json +6 -0
- package/workspace/tk-tasks-test.js +186 -57
- package/workspace/workflows-setup-test.js +4 -3
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/* pm/ini-props.js — what Claude proposes on one initiative, under its one blue ✦ (feedback batch 12 items 2, 3 and 4; canvas In development,
|
|
2
|
+
* rows "Populate initiative" (PiA0–PiA5, devPiRules) and "Task proposals" (TpA1–TpA6, devTpRules)). The fold, the engines and the routes
|
|
3
|
+
* are lib/proposals.js and lib/routes-proposals.js; the Board's row carries r.props (null: nothing to show) and r.found (what a ✓ kept).
|
|
4
|
+
*
|
|
5
|
+
* chipOf(props) → the Viewer's chip after the title: { n, looking, label } | null (zero is silence)
|
|
6
|
+
* sync(v, H) after each draw of the initiative: the ✦ in the Viewer's header, and a quiet read while Claude is looking
|
|
7
|
+
* open(v, H) the ✦'s press: "Claude proposes N" as a drill-in. Groups in order: Found elsewhere, Dates, Looks done, Names,
|
|
8
|
+
* Links. ✓ in the header keeps every proposal Claude is sure of; Check these and Not placed need their own ✓.
|
|
9
|
+
* Each proposal: ⌄ its items, ✓ keep, ✕ drop for good; ✕ on one item drops that item. One toast with Undo.
|
|
10
|
+
* lookHtml(v) the Tasks' dashed placeholder while Claude looks and nothing is kept yet (PiA1)
|
|
11
|
+
* foundDocs(v) the documents a ✓ kept from elsewhere, for the Documents fold: [{ title, meta, ref }]
|
|
12
|
+
*
|
|
13
|
+
* The host gives H.where() → { ws, board }, H.reload(), H.toast(text, undo?). Nothing is written until the PM's ✓. */
|
|
14
|
+
import { pmGet, pmPost } from './http.js';
|
|
15
|
+
import { taskTitle } from './ini-links.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 I = {
|
|
20
|
+
spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z',
|
|
21
|
+
check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', down: 'M6 9l6 6 6-6', up: 'M6 15l6-6 6 6', stop: 'M7 7h10v10H7z',
|
|
22
|
+
doc: 'M7 3h7l5 5v13H7zM14 3v5h5', tasks: 'M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01', stage: 'M5 21V4M5 4h12l-2 4 2 4H5',
|
|
23
|
+
link: 'M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1',
|
|
24
|
+
cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', done: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M8 12l3 3 5-6', name: 'M4 20h4L19 9l-4-4L4 16zM13 7l4 4',
|
|
25
|
+
ask: 'M4 5h16v11H9l-5 4z', maybe: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6M12 17h.01', keep: 'M5 12l5 5 9-10', ignore: 'M5 12h14',
|
|
26
|
+
};
|
|
27
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
28
|
+
const DAY = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
29
|
+
const md = (iso) => { const m = DAY.exec(String(iso || '')); return m ? MON[+m[2] - 1] + ' ' + +m[3] : ''; };
|
|
30
|
+
const span = (a, b) => (a && b && a !== b ? md(a) + ' – ' + md(b) : md(a || b));
|
|
31
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
32
|
+
const clip = (s, n) => { s = String(s || ''); return s.length > n ? s.slice(0, n - 1) + '…' : s; };
|
|
33
|
+
const GROUP = { found: 'Found elsewhere', dates: 'Dates', status: 'Looks done', names: 'Names', links: 'Links' };
|
|
34
|
+
|
|
35
|
+
/* ── the chip and the live look ── */
|
|
36
|
+
export function chipOf(p) {
|
|
37
|
+
if (!p) return null;
|
|
38
|
+
const looking = !!(p.look && !p.look.ended);
|
|
39
|
+
if (!p.n && !looking) return null;
|
|
40
|
+
return { n: p.n || 0, looking, label: p.n ? 'Claude proposes ' + p.n + (looking ? ', and is still looking' : '') + '. Open' : 'Claude is looking for this initiative. Open' };
|
|
41
|
+
}
|
|
42
|
+
const POLL = new Map(); // initiative id → timer, while Claude looks
|
|
43
|
+
export function sync(v, H) {
|
|
44
|
+
const VW = typeof window !== 'undefined' ? window.czViewer : null;
|
|
45
|
+
if (!v || !v.id || !VW) return;
|
|
46
|
+
const cur = VW.current(), body = VW.body();
|
|
47
|
+
if (!cur || !body || !body.querySelector(`[data-iv="${CSS.escape(v.id)}"]`)) return;
|
|
48
|
+
const c = chipOf(v.props);
|
|
49
|
+
VW.setChip(cur.id, c ? { ...c, on: () => open(v, H) } : null);
|
|
50
|
+
// while Claude looks, a quiet read every few seconds; a change reads the Board again
|
|
51
|
+
if (c && c.looking && !POLL.has(v.id)) {
|
|
52
|
+
const t0 = v.props.t;
|
|
53
|
+
POLL.set(v.id, setTimeout(async () => {
|
|
54
|
+
POLL.delete(v.id);
|
|
55
|
+
const r = await read(H, v.id);
|
|
56
|
+
if (r && r.ok && (!r.props || r.props.t !== t0) && H.reload) await H.reload();
|
|
57
|
+
}, 5000));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function read(H, id) {
|
|
61
|
+
const at = H.where ? H.where() : {};
|
|
62
|
+
return pmGet('/api/proposals?ws=' + encodeURIComponent(at.ws || '') + '&board=' + encodeURIComponent(at.board || '') + '&initiative=' + encodeURIComponent(id)).catch(() => null);
|
|
63
|
+
}
|
|
64
|
+
async function write(H, route, body) {
|
|
65
|
+
const at = H.where ? H.where() : {};
|
|
66
|
+
return pmPost(route, { ws: at.ws, board: at.board, ...body }).catch(() => null);
|
|
67
|
+
}
|
|
68
|
+
export function lookHtml(v) {
|
|
69
|
+
if (!v || !v.props || !v.props.look || v.props.look.ended) return '';
|
|
70
|
+
return `<div class="pp-ph"><p>Documents, tasks and dates show here when Claude has looked everywhere. Nothing is kept until you say so.</p></div>`;
|
|
71
|
+
}
|
|
72
|
+
export function foundDocs(v) {
|
|
73
|
+
const f = v && v.found;
|
|
74
|
+
return f && f.docs ? f.docs.map((d) => ({ title: d.title, meta: [d.source, md(d.at)].filter(Boolean).join(' · '), ref: d.ref || '' })) : [];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* ── the Viewer ── */
|
|
78
|
+
const S = { id: null, props: null, open: new Set(), choices: {}, H: null, title: '', timer: null };
|
|
79
|
+
const titleOf = (p) => {
|
|
80
|
+
if (p.title) return p.title;
|
|
81
|
+
const n = p.items.length;
|
|
82
|
+
if (p.group === 'found') return p.type === 'stage' ? 'Stage: ' + ((p.data && p.data.stage) || '') : p.type === 'docs' ? plural(n, 'document', 'documents') : p.type === 'tasks' ? plural(n, 'task', 'tasks') : p.type === 'link' ? 'Already in another initiative' : p.type === 'maybe' ? 'Maybe this initiative' : plural(n, 'thing', 'things') + ' not placed';
|
|
83
|
+
if (p.group === 'status') return plural(n, 'task looks', 'tasks look') + ' done';
|
|
84
|
+
if (p.group === 'names') return 'Tidy ' + plural(n, 'name', 'names');
|
|
85
|
+
return '';
|
|
86
|
+
};
|
|
87
|
+
const iconOf = (p) => (p.group === 'found' ? (p.type === 'stage' ? I.stage : p.type === 'docs' ? I.doc : p.type === 'tasks' ? I.tasks : p.type === 'link' ? I.link : I.maybe)
|
|
88
|
+
: p.group === 'dates' ? I.cal : p.group === 'status' ? I.done : p.group === 'names' ? I.name : I.link);
|
|
89
|
+
const ib = (attr, label, icon, cls = '') => `<button type="button" class="pp-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(icon, 16, 2.2)}</button>`;
|
|
90
|
+
function itemHtml(p, x) {
|
|
91
|
+
let t = '', m = '';
|
|
92
|
+
if (p.group === 'found') {
|
|
93
|
+
if (p.type === 'stage') { t = x.stage; m = [span(x.start, x.due), x.source].filter(Boolean).join(' · '); }
|
|
94
|
+
else if (p.type === 'docs') { t = x.title; m = [x.source, md(x.at)].filter(Boolean).join(' · '); }
|
|
95
|
+
else if (p.type === 'tasks') { t = (x.wbs && !String(x.title || '').startsWith(x.wbs) ? x.wbs + ' ' : '') + (x.title || x.jira || ''); m = [x.jira ? 'Jira epic ' + x.jira : '', x.stage, span(x.start, x.due), x.owner].filter(Boolean).join(' · '); }
|
|
96
|
+
else { t = x.title; m = x.other ? 'In ' + x.other.title : x.why || ''; }
|
|
97
|
+
} else if (p.group === 'dates') { t = x.title || x.task; m = (x.from && x.from.due ? md(x.from.due) + ' → ' : '') + span(x.to && x.to.start, x.to && x.to.due) + (x.jira ? ' · Jira: a drafted comment' : '') + (x.ms ? ' · ◇ a promise' : ''); }
|
|
98
|
+
else if (p.group === 'status') { t = x.title || taskTitle(p.ini, x.task); m = x.jira ? 'Jira: a drafted comment' : ''; }
|
|
99
|
+
else if (p.group === 'names') { t = x.to; m = 'Was: ' + (x.from || '') + (x.jira ? ' · Jira: a drafted comment' : ''); }
|
|
100
|
+
return `<div class="pp-it"><span class="w"><b>${esc(clip(t, 90))}</b>${m ? `<small>${esc(m)}</small>` : ''}</span>${x.sig ? ib(`data-pp-dropit="${esc(x.sig)}"`, 'Leave this one out', I.x) : ''}</div>`;
|
|
101
|
+
}
|
|
102
|
+
function linkHtml(p, l) {
|
|
103
|
+
const pick = S.choices[l.key] || l.rec;
|
|
104
|
+
const seg = l.clash ? '' : `<span class="pp-seg" role="group" aria-label="This link">`
|
|
105
|
+
+ `<button type="button" data-pp-ch="${esc(l.key)}" data-v="keep" aria-pressed="${pick === 'keep'}" aria-label="Keep the link: move it too" title="Keep the link: move it too">${SVG(I.keep, 14, 2.2)}${l.rec === 'keep' ? `<i>${SVG(I.spark, 9, 2)}</i>` : ''}</button>`
|
|
106
|
+
+ `<button type="button" data-pp-ch="${esc(l.key)}" data-v="ignore" aria-pressed="${pick === 'ignore'}" aria-label="Ignore the link: it stays where it is" title="Ignore the link: it stays where it is">${SVG(I.ignore, 14, 2.2)}${l.rec === 'ignore' ? `<i>${SVG(I.spark, 9, 2)}</i>` : ''}</button></span>`;
|
|
107
|
+
const mv = (l.moves || []).map((m) => m.title + ' to ' + span(m.to.start, m.to.due)).join(', ');
|
|
108
|
+
return `<div class="pp-it pp-lk"><span class="w"><b>${esc(clip(l.toTitle, 70))}</b><small>${esc(l.why)}${mv ? ' · ' + esc(mv) : ''}</small></span>${seg}</div>`;
|
|
109
|
+
}
|
|
110
|
+
function propHtml(p) {
|
|
111
|
+
if (p.group === 'links') {
|
|
112
|
+
const l = p.link || {}, a = taskTitle(p.ini || S.id, l.from), b = taskTitle(p.ini || S.id, l.to);
|
|
113
|
+
const t = l.kind === 'link' ? clip(b, 40) + ' waits on ' + clip(a, 40) : l.kind === 'pull' ? 'Pull ' + plural((l.tasks || []).length, 'task', 'tasks') + ' in' : 'Move ' + plural((l.tasks || []).length, 'task', 'tasks') + ' to keep your links';
|
|
114
|
+
return `<div class="pp-p" data-pp="${esc(p.id)}"><div class="pp-ph1"><span class="pp-ic">${SVG(I.link, 16)}</span><span class="w"><b>${esc(t)}</b><small>${esc(p.why)}</small></span>`
|
|
115
|
+
+ ib(`data-pp-keep="${esc(p.id)}"`, 'Keep it', I.check, 'ok') + ib(`data-pp-droplk="${esc(l.id || '')}"`, 'Drop it', I.x) + '</div></div>';
|
|
116
|
+
}
|
|
117
|
+
const op = S.open.has(p.id), n = p.items.length + (p.links || []).length;
|
|
118
|
+
const src = (p.sources || []).map((s) => s.label).join(', ');
|
|
119
|
+
const tag = p.section === 'check' ? 'Check these' : p.section === 'unplaced' ? 'Not placed' : '';
|
|
120
|
+
const plan = p.plan ? 'Plan ' + md(p.plan.from) + ' → ' + md(p.plan.to) + (p.plan.ms ? ' · the ◇ stays where it is' : '') : '';
|
|
121
|
+
const ask = p.ask && p.ask.owner ? ib(`data-pp-ask="${esc(p.id)}"`, 'Ask ' + p.ask.owner + ' why it slipped', I.ask) : '';
|
|
122
|
+
return `<div class="pp-p${p.section !== 'sure' ? ' chk' : ''}" data-pp="${esc(p.id)}">`
|
|
123
|
+
+ `<div class="pp-ph1"><span class="pp-ic">${SVG(iconOf(p), 16)}</span><span class="w"><b>${esc(titleOf(p))}</b><small>${esc(p.why)}</small>`
|
|
124
|
+
+ (src || tag || plan ? `<small class="pp-src">${[tag ? `<em>${esc(tag)}</em>` : '', esc(plan), esc(src)].filter(Boolean).join(' · ')}</small>` : '') + '</span>'
|
|
125
|
+
+ ask + (n ? ib(`data-pp-more="${esc(p.id)}" aria-expanded="${op}"`, op ? 'Hide what it holds' : 'Show what it holds', op ? I.up : I.down) : '')
|
|
126
|
+
+ ib(`data-pp-keep="${esc(p.id)}"`, 'Keep it', I.check, 'ok') + ib(`data-pp-drop="${esc(p.sig || '')}"`, 'Drop it for good', I.x) + '</div>'
|
|
127
|
+
+ (op ? `<div class="pp-its">${p.items.map((x) => itemHtml(p, x)).join('')}${(p.links || []).map((l) => linkHtml(p, l)).join('')}</div>` : '')
|
|
128
|
+
+ '</div>';
|
|
129
|
+
}
|
|
130
|
+
function lookBlock(L) {
|
|
131
|
+
if (!L || L.ended) return '';
|
|
132
|
+
const rows = L.sources.map((s) => `<li class="${s.state === 'reading' ? 'on' : ''}"><b>${esc(s.name)}</b><span>${s.state === 'reading' ? 'Reading…' : esc(s.what || plural(s.n, 'find', 'finds'))}</span></li>`).join('');
|
|
133
|
+
return `<div class="pp-look"><div class="pp-lh">${SVG(I.spark, 14, 2)}<b>${L.why === 'check' ? 'Claude is checking the late tasks' : 'Claude is looking for this initiative'}</b>${ib('data-pp-stop', 'Stop looking', I.stop)}</div>`
|
|
134
|
+
+ (rows ? `<ul>${rows}</ul>` : '<p>It starts with your connected sources.</p>') + '</div>';
|
|
135
|
+
}
|
|
136
|
+
function bodyHtml(P) {
|
|
137
|
+
const VW = window.czViewer;
|
|
138
|
+
if (!P || (!P.n && !(P.look && !P.look.ended))) return '<p class="pp-none">Nothing waits here now.</p>';
|
|
139
|
+
const secs = (P.groups || []).map((g) => ({ id: g.group, title: GROUP[g.group] || g.group, count: g.props.length, open: true, html: g.props.map(propHtml).join('') }));
|
|
140
|
+
return `<div class="pp">${lookBlock(P.look)}${VW.czSections(secs, { key: 'props' })}</div>`;
|
|
141
|
+
}
|
|
142
|
+
function presses(P) { return P && P.sure ? [{ act: 'all', label: 'Keep all ' + P.sure + ' Claude is sure of', icon: I.check, solid: true }] : []; }
|
|
143
|
+
function draw() {
|
|
144
|
+
const VW = window.czViewer, b = VW.body(), cur = VW.current();
|
|
145
|
+
if (!b || !cur || cur.id !== 'pp:' + S.id) return;
|
|
146
|
+
const top = b.scrollTop;
|
|
147
|
+
b.innerHTML = bodyHtml(S.props);
|
|
148
|
+
b.scrollTop = top;
|
|
149
|
+
VW.setPresses(cur.id, presses(S.props));
|
|
150
|
+
const t = 'Claude proposes' + (S.props && S.props.n ? ' ' + S.props.n : '');
|
|
151
|
+
if (VW.retitle && cur.title !== t) VW.retitle(cur.id, t);
|
|
152
|
+
clearTimeout(S.timer);
|
|
153
|
+
if (S.props && S.props.look && !S.props.look.ended) S.timer = setTimeout(fresh, 4000);
|
|
154
|
+
}
|
|
155
|
+
async function fresh() {
|
|
156
|
+
const id = S.id, r = await read(S.H, id);
|
|
157
|
+
if (S.id !== id || !r || r.ok === false) return;
|
|
158
|
+
S.props = r.props; draw();
|
|
159
|
+
}
|
|
160
|
+
const say = (m, undo) => { if (S.H && S.H.toast) S.H.toast(m, undo); };
|
|
161
|
+
const after = () => { if (S.H && S.H.reload) Promise.resolve(S.H.reload()).catch(() => {}); };
|
|
162
|
+
async function keep(ids, all) {
|
|
163
|
+
const res = await write(S.H, '/api/proposals/keep', { initiative: S.id, ...(all ? { all: true } : { ids }), choices: S.choices });
|
|
164
|
+
if (!res || res.ok === false) { say((res && res.error) || 'Nothing was kept.'); return; }
|
|
165
|
+
S.props = res.props; draw(); after();
|
|
166
|
+
const batch = res.batch, H = S.H, id = S.id;
|
|
167
|
+
say(res.said, async () => {
|
|
168
|
+
const u = await write(H, '/api/proposals/undo', { batch });
|
|
169
|
+
if (!u || u.ok === false) { if (H.toast) H.toast((u && u.error) || 'The undo did not land.'); return; }
|
|
170
|
+
if (u.kept && H.toast) H.toast(plural(u.kept, 'change was', 'changes were') + ' kept: the task changed since.');
|
|
171
|
+
if (S.id === id) await fresh();
|
|
172
|
+
if (H.reload) await H.reload();
|
|
173
|
+
});
|
|
174
|
+
if (!S.props || (!S.props.n && !(S.props.look && !S.props.look.ended))) window.czViewer.back();
|
|
175
|
+
}
|
|
176
|
+
async function drop(sig) {
|
|
177
|
+
const res = await write(S.H, '/api/proposals/drop', { initiative: S.id, sig });
|
|
178
|
+
if (!res || res.ok === false) { say((res && res.error) || 'Nothing was changed.'); return; }
|
|
179
|
+
await fresh(); after();
|
|
180
|
+
}
|
|
181
|
+
async function onPress(e) {
|
|
182
|
+
const b = e.target.closest('button'); if (!b) return;
|
|
183
|
+
const d = b.dataset;
|
|
184
|
+
if (d.ppMore) { if (S.open.has(d.ppMore)) S.open.delete(d.ppMore); else S.open.add(d.ppMore); draw(); return; }
|
|
185
|
+
if (d.ppCh) { S.choices[d.ppCh] = d.v; draw(); return; }
|
|
186
|
+
if (d.ppKeep) { b.disabled = true; await keep([d.ppKeep], false); return; }
|
|
187
|
+
if (d.ppDrop) { b.disabled = true; await drop(d.ppDrop); return; }
|
|
188
|
+
if (d.ppDropit) { b.disabled = true; await drop(d.ppDropit); return; }
|
|
189
|
+
if ('ppDroplk' in d) {
|
|
190
|
+
b.disabled = true;
|
|
191
|
+
const res = await write(S.H, '/api/task-links/drop', { initiative: S.id, id: d.ppDroplk });
|
|
192
|
+
if (!res || res.ok === false) { say((res && res.error) || 'Nothing was changed.'); b.disabled = false; return; }
|
|
193
|
+
await fresh(); after(); return;
|
|
194
|
+
}
|
|
195
|
+
if ('ppStop' in d) {
|
|
196
|
+
b.disabled = true;
|
|
197
|
+
const res = await write(S.H, '/api/proposals/stop', { initiative: S.id });
|
|
198
|
+
if (!res || res.ok === false) say((res && res.error) || 'Claude could not be stopped.');
|
|
199
|
+
else say('Claude stopped looking. What it found so far stays here.');
|
|
200
|
+
await fresh(); after(); return;
|
|
201
|
+
}
|
|
202
|
+
if (d.ppAsk) {
|
|
203
|
+
const p = (S.props.groups || []).flatMap((g) => g.props).find((x) => x.id === d.ppAsk); if (!p) return;
|
|
204
|
+
const q = 'Hi ' + p.ask.owner + ', ' + p.items.map((x) => x.title).slice(0, 3).join(', ') + (p.items.length > 1 ? ' are' : ' is') + ' past ' + (p.items.length > 1 ? 'their' : 'its') + ' date. What is it waiting on, and when do you expect it?';
|
|
205
|
+
try { await navigator.clipboard.writeText(q); say('A question for ' + p.ask.owner + ' is copied. Paste it where you talk.'); } catch { say(q); }
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/** The ✦'s press: the drill-in. v: the initiative's view (id, title, props). */
|
|
209
|
+
export function open(v, H) {
|
|
210
|
+
const VW = window.czViewer; if (!VW || !v || !v.id) return;
|
|
211
|
+
S.id = v.id; S.props = v.props; S.H = H; S.open = new Set(); S.choices = {}; S.title = v.title;
|
|
212
|
+
VW.drill();
|
|
213
|
+
VW.open({ id: 'pp:' + v.id, kind: 'Claude proposes', title: 'Claude proposes' + (v.props && v.props.n ? ' ' + v.props.n : ''), sub: v.title, icon: I.spark,
|
|
214
|
+
presses: presses(v.props),
|
|
215
|
+
onPress: (act) => { if (act === 'all') keep([], true); },
|
|
216
|
+
render: (b) => { b.innerHTML = bodyHtml(S.props); if (!b.__pp) { b.__pp = true; } b.onclick = onPress; draw(); if (!S.props || S.props.look) fresh(); },
|
|
217
|
+
onClose: () => { clearTimeout(S.timer); if (S.id === v.id) S.id = null; } });
|
|
218
|
+
}
|
|
@@ -13,16 +13,17 @@
|
|
|
13
13
|
* wireDrag(body) once per body: drag a bar (move, or an end), drag a card between columns, long-press a box on a phone
|
|
14
14
|
*
|
|
15
15
|
* The host's handlers (wireView's h): h.check(uid) the box's one-press Done (Undo in the host's toast), h.status(uid, state) and
|
|
16
|
-
* h.dates(uid, { start?, due? }) the quick changes (each with Undo), h.redraw(). A Jira ticket is read-only: the Jira mark, a plain date, no
|
|
16
|
+
* h.dates(uid, { start?, due? }) the quick changes (each with Undo), h.remove(uid) the picker's trash (batch 11 item 16: Delete, Undo in the toast), h.redraw(). A Jira ticket is read-only: the Jira mark, a plain date, no
|
|
17
17
|
* picker and no drag. Archived tasks show in no view here (the List folds them after Done). */
|
|
18
18
|
import { STATES, stateIcon, stateKey, datePickerHtml, cardStyle } from './task-card.js';
|
|
19
|
+
import * as LK from './ini-links.js'; // the links' marks on bars and cards (batch 11 item 15)
|
|
19
20
|
|
|
20
21
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
21
22
|
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>`;
|
|
22
23
|
export const P = {
|
|
23
24
|
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',
|
|
24
25
|
down: 'M7 10l5 5 5-5', right: 'M10 7l5 5-5 5', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', jira: 'M12 3l9 9-9 9-9-9z', check: 'M5 12l5 5 9-10',
|
|
25
|
-
dia: 'M12 4l8 8-8 8-8-8z', skip: 'M6 7l5 5-5 5M13 7l5 5-5 5',
|
|
26
|
+
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',
|
|
26
27
|
};
|
|
27
28
|
/** 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
|
|
28
29
|
* shape (blue, nested) and stays as it is. */
|
|
@@ -44,6 +45,8 @@ export function setViewMode(m) { VIEW = m === 'timeline' || m === 'kanban' ? m :
|
|
|
44
45
|
const zoomOf = () => { if (!ZOOM) { const z = store.get('pmos.tasks.zoom'); ZOOM = ZOOMS.some((x) => x[0] === z) ? z : 'week'; } return ZOOM; };
|
|
45
46
|
/** For the tests: forget the PM's picks. */
|
|
46
47
|
export const resetViews = () => { VIEW = null; ZOOM = null; STAGE.clear(); SCROLL.clear(); };
|
|
48
|
+
/** The stage card's press on a stage (batch 11 item 21): the Kanban turns to that stage. */
|
|
49
|
+
export const setKanbanStage = (id, key) => { if (id && key != null) STAGE.set(id, key); };
|
|
47
50
|
|
|
48
51
|
/* ── days, as whole numbers (UTC, so a summer-time night never moves a bar) ── */
|
|
49
52
|
const DAY = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
@@ -62,9 +65,15 @@ export function spanText(s, e) {
|
|
|
62
65
|
export function switchHtml(m) {
|
|
63
66
|
return `<div class="ivx-seg" role="group" aria-label="Tasks view">${VIEWS.map(([k, l, d]) => `<button type="button" class="ivx-sb" data-iv-view="${k}" aria-pressed="${m === k}" aria-label="${l}" title="${l}">${SVG(d, 17)}</button>`).join('')}</div>`;
|
|
64
67
|
}
|
|
65
|
-
/** The Kanban's stage choices: the current stage first, All stages, then the rest of the List's groups in their order, each with its count.
|
|
68
|
+
/** The Kanban's stage choices: the current stage first, All stages, then the rest of the List's groups in their order, each with its count.
|
|
69
|
+
* Grouped another way (batch 11 item 20) it is the group picker: All, then each group; By status has only All (its groups are the columns). */
|
|
66
70
|
export function stagesOf(v) {
|
|
67
|
-
const S = v.tasks.sections
|
|
71
|
+
const S = v.tasks.sections;
|
|
72
|
+
if (v.tasks.by && v.tasks.by !== 'stage') {
|
|
73
|
+
const all = { key: 'all', label: 'All', count: v.tasks.open ? v.tasks.open + ' open' : v.tasks.count };
|
|
74
|
+
return v.tasks.by === 'status' ? [all] : [all, ...S.map((s) => ({ key: s.key || '-', label: s.label || s.name, count: s.count }))];
|
|
75
|
+
}
|
|
76
|
+
const now = S.find((s) => s.kind === 'stage' && s.status === 'now');
|
|
68
77
|
const name = (s) => (s.kind === 'later' ? 'Later stages' : s.kind === 'none' ? 'Not in a stage' : s.label || s.name);
|
|
69
78
|
const all = { key: 'all', label: 'All stages', count: v.tasks.open ? v.tasks.open + ' open' : v.tasks.count };
|
|
70
79
|
const rest = S.filter((s) => s !== now).map((s) => ({ key: s.key || '-', label: name(s), count: s.count }));
|
|
@@ -78,7 +87,8 @@ export function headExtraHtml(v, m) {
|
|
|
78
87
|
}
|
|
79
88
|
if (m === 'kanban') {
|
|
80
89
|
const L = stagesOf(v), k = stageKeyOf(v), x = L.find((y) => y.key === k);
|
|
81
|
-
|
|
90
|
+
const what = v.tasks.by && v.tasks.by !== 'stage' ? 'Group' : 'Stage';
|
|
91
|
+
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>`;
|
|
82
92
|
}
|
|
83
93
|
return '';
|
|
84
94
|
}
|
|
@@ -87,6 +97,11 @@ export function headExtraHtml(v, m) {
|
|
|
87
97
|
const flat = (sec) => (sec.stages ? sec.stages.flatMap((s) => flat(s)) : [...sec.top, ...sec.groups.flatMap((g) => g.rows)]);
|
|
88
98
|
const flatDone = (sec) => (sec.stages ? sec.stages.flatMap((s) => flatDone(s)) : sec.done);
|
|
89
99
|
const jiraOf = (sec) => (sec.stages ? sec.stages.flatMap((s) => jiraOf(s)) : sec.jira ? sec.jira.open : []);
|
|
100
|
+
const tkOf = (sec) => (sec.stages ? sec.stages.flatMap((s) => tkOf(s)) : sec.tk || []); // By epic's tickets (batch 11 item 20)
|
|
101
|
+
/** A drafted or sent ticket of By epic: no box; a press opens the draft, or the ticket once it is in Jira (pm/ini-groups.js). */
|
|
102
|
+
const tkMark = (t) => (t.inJira ? `<span class="ig-sq ${esc(t.cat || 'todo')}" role="img" aria-label="${esc('In Jira: ' + (t.status || 'To do'))}"></span>`
|
|
103
|
+
: `<span class="ig-tkd" role="img" aria-label="Jira ticket drafted, not sent" title="Drafted, not in Jira">${SVG(P.jira, 14, 2)}</span>`);
|
|
104
|
+
const tkTitle = (t) => `<button type="button" class="iv-tt" data-ig-tk="${esc(t.id)}">${t.inJira && t.key ? `<em>${esc(t.key)}</em> ` : ''}${esc(t.title)}</button>`;
|
|
90
105
|
const box = (x, o) => {
|
|
91
106
|
// a draft's task (batch 11 item 8) is an assumption: a dashed box that marks nothing; its caret still changes the status in the draft
|
|
92
107
|
if (x.dr) return `<span class="iv-bxw"><span class="iv-cb dr" aria-hidden="true"></span>` + (o.quick ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" aria-haspopup="dialog" aria-label="${esc('Change the status in the draft: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '') + '</span>';
|
|
@@ -105,11 +120,14 @@ export function slipHtml(x) {
|
|
|
105
120
|
const n = slipOf(x); if (!n) return '';
|
|
106
121
|
return ` <span class="vs-sl${n > 0 ? ' late' : ''}" role="img" aria-label="${esc((n > 0 ? n + ' days late' : -n + ' days early') + ' against the plan')}">${n > 0 ? '+' + n : '\u2212' + -n}d</span>`;
|
|
107
122
|
}
|
|
123
|
+
/** A Jira ticket as a row the date press and the bar drag know (batch 11 item 23): its key is the uid; the start and due are kept in PMOS,
|
|
124
|
+
* never sent to Jira. Status and title stay Jira's. */
|
|
125
|
+
export const jiraRow = (k) => ({ uid: k.key, start: k.start || '', end: k.due || '', title: k.key + ' ' + k.title, days: k.days || '', jira: true });
|
|
108
126
|
const ttitle = (k) => `<button type="button" class="iv-tt" data-iv-ticket="${esc(k.key)}"><em>${esc(k.key)}</em> ${esc(k.title)}</button>`;
|
|
109
127
|
/** The date press: the task card's start and due picker opens right under it. No dates: a calendar icon, shown on hover. */
|
|
110
128
|
export function dateBtn(x, o) {
|
|
111
129
|
if (!o.quick || !x.uid) return x.days ? `<span class="${x.late ? 'w' : ''}">${esc(x.days)}</span>` : '';
|
|
112
|
-
const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" title="Start and due"`;
|
|
130
|
+
const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" title="${x.jira ? 'Start and due, kept in PMOS. Jira is not changed' : 'Start and due'}"`;
|
|
113
131
|
// a milestone with no due date: a dashed chip asks for it, shown always (canvas XmlA6Suggest)
|
|
114
132
|
if (msNoDate(x)) return `<button type="button" class="iv-dc ms" ${a} aria-label="${esc('Set the due date: ' + x.title)}">${SVG(P.cal, 13)}Set the due date</button>`;
|
|
115
133
|
return x.days ? `<button type="button" class="iv-dc${x.late ? ' w' : ''}" ${a} aria-label="${esc('Dates: ' + x.days + '. Change')}">${esc(x.days)}</button>`
|
|
@@ -148,12 +166,13 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
148
166
|
const barOf0 = (x) => {
|
|
149
167
|
const a = dn(x.start), b = dn(x.end), cls = tone(x) + (x.dr ? ' dr' : ''), lbl = [x.days || 'No dates', x.owner && x.owner !== 'You' ? x.owner : '', x.closed ? x.status.toLowerCase() : x.late ? 'late' : x.prog ? 'in progress' : ''].filter(Boolean).join(', ');
|
|
150
168
|
const av = x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : '';
|
|
151
|
-
const
|
|
169
|
+
const lw = LK.barWords(x, o.lk);
|
|
170
|
+
const at = `data-ivt-bar="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}"${o.quick && !x.closed ? drag : ''} aria-label="${esc(lbl + (lw ? ', ' + lw : '') + '. Change the dates')}"`;
|
|
152
171
|
if (a == null && b == null) return x.closed || !o.quick ? '' : `<button type="button" class="ivt-g" data-iv-date="${esc(x.uid)}" data-s="" data-e="" data-tlx="${X(today) - 18}" aria-label="${esc('No dates yet. Set dates: ' + x.title)}" title="Set dates">${SVG(P.cal, 13)}</button>`;
|
|
153
172
|
if (a == null) return `<button type="button" class="ivt-d ${cls}" ${at} data-only="due" data-tlx="${X(b) + Math.round(px / 2)}"></button>`;
|
|
154
173
|
const e = b == null ? a : Math.max(a, b);
|
|
155
174
|
return `<button type="button" class="ivt-b ${cls}" ${at} data-tlx="${X(a)}" data-tlw="${Math.max(10, X(e + 1) - X(a))}">`
|
|
156
|
-
+ (o.quick && !x.closed ? '<span class="ivt-gp l" data-grip="start" aria-hidden="true"></span><span class="ivt-gp r" data-grip="end" aria-hidden="true"></span>' : '') + av + '</button>' + msEnd(x);
|
|
175
|
+
+ (o.quick && !x.closed ? '<span class="ivt-gp l" data-grip="start" aria-hidden="true"></span><span class="ivt-gp r" data-grip="end" aria-hidden="true"></span>' : '') + av + LK.barExtra(x, o.lk, o.quick) + '</button>' + msEnd(x);
|
|
157
176
|
};
|
|
158
177
|
// a milestone task's bar ends in its ◇ with the date beside it (canvas XmlA3Viewer); a faint dashed guide drops through the grid there.
|
|
159
178
|
// Won't do and Archived draw none; no due date draws none (the List asks for it). Dragging the bar's end moves the due date as before.
|
|
@@ -161,7 +180,9 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
161
180
|
return `<span class="ivt-ms${x.done ? ' dn' : x.late ? ' lt' : ''}" data-tlx="${X(b + 1)}" role="img" aria-label="${esc('Milestone ' + x.title + ', ' + md(b) + (x.done ? ', done' : x.late ? ', late' : ''))}" title="${esc(x.title + ' · ' + md(b))}"><i></i><b>${esc(md(b))}</b></span>`; };
|
|
162
181
|
const guides = [...new Set(S.flatMap((s) => flat(s).concat(flatDone(s))).filter((x) => x.ms && !x.wont && x.status !== 'Archived' && dn(x.end) != null).map((x) => X(dn(x.end) + 1)))]
|
|
163
182
|
.map((gx) => `<i class="ms" data-tlx="${gx}"></i>`).join('');
|
|
164
|
-
|
|
183
|
+
// a Jira ticket's bar drags and its ends change the dates kept in PMOS, as a task's do (batch 11 item 23); read-only views draw the due dot
|
|
184
|
+
const jbar = (k) => { if (o.quick) return barOf0(jiraRow(k)).replace(/class="ivt-(b|d|g) /, 'class="ivt-$1 jr ').replace('class="ivt-g"', 'class="ivt-g jr"');
|
|
185
|
+
const b = dn(k.due); return b == null ? '' : `<span class="ivt-d jr" role="img" data-ivt-jr="${esc(k.key)}" data-tlx="${X(b) + Math.round(px / 2)}" aria-label="${esc('Due ' + md(b) + ' in Jira')}" title="${esc('Jira · ' + md(b))}"></span>`; };
|
|
165
186
|
const row = (n, c, cls = '') => `<div class="ivt-r${cls}"><div class="ivt-n">${n}</div><div class="ivt-c">${c}</div></div>`;
|
|
166
187
|
const band = (rs) => { const ds = rs.flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null); if (!ds.length) return ''; const a = Math.min(...ds), b = Math.max(...ds); return `<span class="ivt-band" data-tlx="${X(a)}" data-tlw="${Math.max(8, X(b + 1) - X(a))}"></span>`; };
|
|
167
188
|
// a skipped stage keeps its group row: a hairline from the band before it to the band after it, with » on it (batch 11 item 13, XgapA2Tasks);
|
|
@@ -183,11 +204,12 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
183
204
|
};
|
|
184
205
|
let h = '';
|
|
185
206
|
for (const [si, sec] of S.entries()) {
|
|
186
|
-
const key = 'sec:' + (sec.key || 'none'), op = isOpen(key, sec.open), rs = flat(sec), dn_ = flatDone(sec), jr = jiraOf(sec);
|
|
187
|
-
const has = rs.length || dn_.length || jr.length;
|
|
188
|
-
const head = `<button type="button" class="ivt-gh${sec.kind
|
|
207
|
+
const key = 'sec:' + (sec.key || 'none'), op = isOpen(key, sec.open), rs = flat(sec), dn_ = flatDone(sec), jr = jiraOf(sec), tk = tkOf(sec);
|
|
208
|
+
const has = rs.length || dn_.length || jr.length || tk.length;
|
|
209
|
+
const head = `<button type="button" class="ivt-gh${sec.kind === 'past' || sec.kind === 'later' || sec.status === 'skip' ? ' mut' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'}>${o.mark(sec)}<b>${esc(sec.label || sec.name)}</b>${sec.count ? `<span class="n${sec.warn ? ' w' : ''}">${esc(sec.count)}</span>` : ''}${has ? `<span class="iv-cv" aria-hidden="true">${SVG(op ? P.down : P.right, 15, 2)}</span>` : ''}</button>`;
|
|
189
210
|
h += row(head, sec.status === 'skip' && !has ? skipLine(si) : band(rs.concat(dn_)), ' g');
|
|
190
211
|
if (!op || !has) continue;
|
|
212
|
+
for (const t of tk) h += row(`${tkMark(t)}${tkTitle(t)}`, '', ' k');
|
|
191
213
|
for (const k of jr) h += row(`${jmark(k)}${ttitle(k)}`, jbar(k), ' k');
|
|
192
214
|
for (const x of rs) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k');
|
|
193
215
|
if (dn_.length) {
|
|
@@ -202,11 +224,11 @@ export function timelineHtml(v, o, isOpen) {
|
|
|
202
224
|
const vk = v.vs ? (v.vs.lines && v.vs.cmp ? `<span><i class="pl"></i>${esc((v.vs.cmp.kind === 'plan' ? 'Plan · ' : 'Draft · ') + v.vs.cmp.name)}</span>` : '') + (v.vs.draft ? '<span><i class="dr"></i>Draft</span>' : '') : '';
|
|
203
225
|
const legend = `<div class="ivt-lg">${v.vs && v.vs.draft ? '' : '<span><i class="to"></i>To do</span><span><i class="pr"></i>In progress</span><span><i class="lt"></i>Late</span>'}<span><i class="dd"></i>Due only</span>${vk}`
|
|
204
226
|
+ (/class="ivt-ng"/.test(h) ? '<span><i class="ng"></i>No activity</span>' : '') + (/class="ivt-sk"/.test(h) ? `<span>${SVG(P.skip, 12, 2)}Skipped</span>` : '')
|
|
205
|
-
+ `${guides ? `<span>${SVG(P.dia, 11, 2.4)}Milestone</span>` : ''}<span>${SVG(P.jira, 12, 2)}Jira
|
|
227
|
+
+ `${guides ? `<span>${SVG(P.dia, 11, 2.4)}Milestone</span>` : ''}<span>${SVG(P.jira, 12, 2)}Jira</span>${LK.legendHtml(o.lk)}${o.quick ? `<span class="h">${o.lk && o.lk.links.length ? 'Drag a bar to move it, an end to change dates, a dot to link it' : 'Drag a bar to move it; drag an end to change start or due'}</span>` : ''}</div>`;
|
|
206
228
|
// it opens on today, moved left as far as the earliest open task's start, so a late bar is in view
|
|
207
229
|
const firstOpen = S.flatMap(flat).flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null);
|
|
208
230
|
const first = firstOpen.length ? X(Math.min(...firstOpen)) : X(today);
|
|
209
|
-
return `<div class="ivt" data-ivt="${esc((v.id || v.key) + '|' + z[0])}" data-px="${px}" data-today="${X(today)}" data-first="${first}"><div class="ivt-sc"><div class="ivt-in" data-tlw="${W}">`
|
|
231
|
+
return `<div class="ivt"${LK.dataOf(o.lk)} data-ivt="${esc((v.id || v.key) + '|' + z[0])}" data-px="${px}" data-today="${X(today)}" data-first="${first}"><div class="ivt-sc"><div class="ivt-in" data-tlw="${W}">`
|
|
210
232
|
+ `<div class="ivt-grid" aria-hidden="true">${grid}</div>${axis}${h}<span class="ivt-today" data-tlx="${X(today) + Math.round(px / 2)}" aria-hidden="true"><i>Today</i></span></div></div></div>${legend}`;
|
|
211
233
|
}
|
|
212
234
|
|
|
@@ -227,18 +249,20 @@ const colOf = (status) => (status === 'Done' ? 'Done' : status === "Won't do" ?
|
|
|
227
249
|
export function kanbanHtml(v, o, isOpen) {
|
|
228
250
|
const S = v.tasks.sections, k = stageKeyOf(v);
|
|
229
251
|
const secs = k === 'all' ? S : S.filter((s) => (s.key || '-') === k);
|
|
230
|
-
const rs = secs.flatMap((s) => flat(s).concat(flatDone(s))), jr = secs.flatMap(jiraOf);
|
|
252
|
+
const rs = secs.flatMap((s) => flat(s).concat(flatDone(s))), jr = secs.flatMap(jiraOf), tk = secs.flatMap(tkOf);
|
|
231
253
|
const by = { 'To do': [], 'In progress': [], Done: [], "Won't do": [] };
|
|
232
254
|
for (const x of rs) by[colOf(x.status)].push({ x });
|
|
233
255
|
for (const t of jr) by[colOf(t.status)].push({ t });
|
|
256
|
+
for (const d of tk) by[d.cat === 'done' ? 'Done' : d.cat === 'doing' ? 'In progress' : 'To do'].push({ d });
|
|
234
257
|
const card = (c) => {
|
|
258
|
+
if (c.d) return `<div class="ivk-d jr">${tkMark(c.d)}<div class="w">${tkTitle(c.d)}${c.d.av ? `<div class="ivk-m"><span class="ivt-av" aria-hidden="true">${esc(c.d.av)}</span></div>` : ''}</div></div>`;
|
|
235
259
|
if (c.t) {
|
|
236
260
|
const t = c.t, d = dn(t.due);
|
|
237
261
|
return `<div class="ivk-d jr">${jmark(t)}<div class="w">${ttitle(t)}<div class="ivk-m">${d != null ? `<span>${esc(md(d))}</span>` : ''}${t.av ? `<span class="ivt-av" aria-hidden="true">${esc(t.av)}</span>` : ''}</div></div></div>`;
|
|
238
262
|
}
|
|
239
263
|
const x = c.x;
|
|
240
264
|
return `<div class="ivk-d${x.closed ? ' x' : ''}${x.wont ? ' wo' : ''}${x.dr ? ' dr' : ''}"${o.quick && x.uid ? ` draggable="true" data-ivk-card="${esc(x.uid)}" data-st="${esc(x.status)}"` : ''}>${box(x, o)}<div class="w">${title(x, o)}`
|
|
241
|
-
+ `<div class="ivk-m">${dateBtn(x, o)}${x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : ''}</div></div></div>`;
|
|
265
|
+
+ `<div class="ivk-m">${dateBtn(x, o)}${LK.metaHtml(x, o.lk, o.quick)}${x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : ''}</div></div></div>`;
|
|
242
266
|
};
|
|
243
267
|
const wop = isOpen('kb:wont', false), nW = by["Won't do"].length;
|
|
244
268
|
const col = ([st, lbl]) => `<section class="ivk-c" data-ivk-col="${esc(st)}" aria-label="${esc(lbl + ', ' + by[st].length)}"><h4>${esc(lbl)}${by[st].length ? `<span class="n">${by[st].length}</span>` : ''}</h4>${by[st].map(card).join('')}</section>`;
|
|
@@ -279,13 +303,17 @@ if (typeof document !== 'undefined' && document.head) {
|
|
|
279
303
|
document.addEventListener('scroll', (e) => { if (POP && !POP.el.contains(e.target)) closePop(); }, true);
|
|
280
304
|
}
|
|
281
305
|
/** The five icons (To do, In progress, Done, Won't do | Archive), only the current one named: the task card's segment. */
|
|
282
|
-
/** ms: the task's ◇ flag, or null where the flag cannot change here: after a second divider, the ◇ toggle (batch 11 item 3).
|
|
283
|
-
|
|
306
|
+
/** ms: the task's ◇ flag, or null where the flag cannot change here: after a second divider, the ◇ toggle (batch 11 item 3).
|
|
307
|
+
* del: the task can be deleted here: last, after its own divider, the trash (batch 11 item 16; never on a Jira ticket, which has no picker). */
|
|
308
|
+
export function statusPopHtml(status, ms = null, del = false) {
|
|
284
309
|
const b = (s) => { const k = stateKey(s), on = s === status;
|
|
285
310
|
return `<button type="button" class="i-${k}${on ? ' on' : ''}" role="radio" aria-checked="${on}" data-ivq-state="${esc(s)}"${on ? '' : ` aria-label="${esc(s === 'Archived' ? 'Archive' : s)}"`} title="${esc(s === 'Archived' ? 'Archive' : s)}">${stateIcon(s)}${on ? esc(s) : ''}</button>`; };
|
|
286
311
|
return `<div class="tkc-pop ivq-st" role="dialog" aria-label="Status"><div class="seg" role="radiogroup" aria-label="Status">${STATES.slice(0, 4).map(b).join('')}<span class="vr" aria-hidden="true"></span>${b('Archived')}</div>`
|
|
287
|
-
+ (ms == null ? '' : `<span class="vr" aria-hidden="true"></span>${msToggleHtml(ms, 'data-ivq-ms')}`)
|
|
312
|
+
+ (ms == null ? '' : `<span class="vr" aria-hidden="true"></span>${msToggleHtml(ms, 'data-ivq-ms')}`)
|
|
313
|
+
+ (del ? `<span class="vr" aria-hidden="true"></span><button type="button" class="ivq-del" data-ivq-del aria-label="Delete task" title="Delete task">${SVG(P.bin, 15, 2)}</button>` : '') + '</div>';
|
|
288
314
|
}
|
|
315
|
+
/** A task this picker can delete: a Board task, a breakdown item or a draft's task. A Jira ticket draws no picker at all. */
|
|
316
|
+
export const deletable = (uid) => /^(?:task-|dt:)/.test(String(uid || '')) || /^[a-z0-9][a-z0-9-]*\.[0-9a-z]{10}$/.test(String(uid || ''));
|
|
289
317
|
/** The ◇ toggle: icon only, "◇ Milestone" while pressed; its tooltip says what it does. attr: the press's data attribute. */
|
|
290
318
|
export function msToggleHtml(on, attr) {
|
|
291
319
|
const tip = on ? 'A milestone. Press to make it a plain task' : 'Make it a milestone: its due date shows as ◇ on the Board and the timeline';
|
|
@@ -293,8 +321,9 @@ export function msToggleHtml(on, attr) {
|
|
|
293
321
|
}
|
|
294
322
|
function statusPop(anchor, uid, status, H) {
|
|
295
323
|
const ms = H.milestone && anchor.dataset.ms != null ? anchor.dataset.ms === '1' : null;
|
|
296
|
-
openPop(anchor, statusPopHtml(status, ms), (b) => {
|
|
324
|
+
openPop(anchor, statusPopHtml(status, ms, !!H.remove && deletable(uid)), (b) => {
|
|
297
325
|
if ('ivqMs' in b.dataset) { closePop(); H.milestone(uid, !ms); return; }
|
|
326
|
+
if ('ivqDel' in b.dataset) { closePop(); H.remove(uid); return; }
|
|
298
327
|
const s = b.dataset.ivqState; if (!s) return; closePop(); if (s !== status && H.status) H.status(uid, s);
|
|
299
328
|
});
|
|
300
329
|
}
|
|
@@ -325,7 +354,13 @@ let LONG = 0; // a long press opened the status picker: the click that follows
|
|
|
325
354
|
/** A press inside the Tasks section that this file owns. → true when handled. */
|
|
326
355
|
export function press(b, d, root, H, e) {
|
|
327
356
|
const id = root.dataset.iv;
|
|
328
|
-
if (d.ivView) {
|
|
357
|
+
if (d.ivView) {
|
|
358
|
+
// a narrow header shows only the view in use (batch 11 item 20, XtaA5Phone: the group icon, the view, + and Make live fit at 390 px);
|
|
359
|
+
// its press opens the three as a menu
|
|
360
|
+
const hidden = [...b.parentElement.querySelectorAll('[data-iv-view]')].some((x) => x !== b && !x.offsetParent);
|
|
361
|
+
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; }
|
|
362
|
+
setViewMode(d.ivView); closePop(); if (H.redraw) H.redraw(); return true;
|
|
363
|
+
}
|
|
329
364
|
if ('ivZoom' in d) { menuPop(b, 'Zoom', ZOOMS.map(([k, l]) => ({ k, label: l, on: k === zoomOf() })), (x) => { ZOOM = x.k; store.set('pmos.tasks.zoom', x.k); if (H.redraw) H.redraw(); }); return true; }
|
|
330
365
|
if ('ivKstage' in d) {
|
|
331
366
|
const v = H.__v; if (!v) return true;
|
|
@@ -344,7 +379,7 @@ export function press(b, d, root, H, e) {
|
|
|
344
379
|
/* ── the drags, and the long press ── */
|
|
345
380
|
let DRAGGED = false;
|
|
346
381
|
const coarse = () => typeof matchMedia === 'function' && matchMedia('(pointer: coarse)').matches;
|
|
347
|
-
export function wireDrag(body) {
|
|
382
|
+
export function wireDrag(body, after) {
|
|
348
383
|
if (!body || body.__ivtDrag) return;
|
|
349
384
|
body.__ivtDrag = true;
|
|
350
385
|
body.addEventListener('contextmenu', (e) => { if (e.target.closest && e.target.closest('[data-iv-check]') && coarse()) e.preventDefault(); });
|
|
@@ -369,6 +404,7 @@ export function wireDrag(body) {
|
|
|
369
404
|
sc.scrollLeft = SCROLL.has(k) ? SCROLL.get(k) : Math.max(0, Math.min((+T.dataset.today || 0) - Math.max(0, sc.clientWidth - nw) * 0.25, (+T.dataset.first || 0) - 16));
|
|
370
405
|
sc.addEventListener('scroll', () => SCROLL.set(k, sc.scrollLeft), { passive: true });
|
|
371
406
|
}
|
|
407
|
+
if (after) after();
|
|
372
408
|
};
|
|
373
409
|
if (typeof MutationObserver === 'function') new MutationObserver(settle).observe(body, { childList: true, subtree: true });
|
|
374
410
|
settle();
|
|
@@ -189,21 +189,25 @@ async function draftDates(H, uid, patch) {
|
|
|
189
189
|
async function draftStatus(H, uid, state) {
|
|
190
190
|
const id = iniOfUid(uid), x = id && draftTask(id, uid);
|
|
191
191
|
const R = ROWS.get(id), name = R && R.vs ? R.vs.show.name : 'the draft';
|
|
192
|
-
if (state === "Won't do" || state === 'Archived')
|
|
193
|
-
const res = await write(H, '/task', { task: uid, drop: true });
|
|
194
|
-
if (!res || res.ok === false) return failed(H, res);
|
|
195
|
-
took(id, res); if (H.redraw) H.redraw();
|
|
196
|
-
// a task copied from Live comes back with Undo; a task the draft added is gone, so Undo adds it again
|
|
197
|
-
const back = res.gone ? () => write(H, '/task', { draft: uid.split(':')[1], add: { title: x.title, start: x.start, due: x.end, owner: x.owner, ...(x.section ? { section: x.section } : {}) } }) : () => write(H, '/task', { task: uid, undrop: true });
|
|
198
|
-
say(H, 'Dropped from ' + name + (x ? ': ' + x.title : '') + '.', async () => { const u = await back(); if (u && u.ok) { took(id, u); if (H.redraw) H.redraw(); } else failed(H, u, 'The undo did not land.'); });
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
192
|
+
if (state === "Won't do" || state === 'Archived') return draftDrop(H, uid);
|
|
201
193
|
const res = await write(H, '/task', { task: uid, set: { status: state } });
|
|
202
194
|
if (!res || res.ok === false) return failed(H, res);
|
|
203
195
|
took(id, res); if (H.redraw) H.redraw();
|
|
204
196
|
say(H, state + ' in ' + name + (x ? ': ' + x.title : '') + '.', res.from ? async () => { const u = await write(H, '/task', { task: uid, set: res.from }); if (u && u.ok) { took(id, u); if (H.redraw) H.redraw(); } } : undefined);
|
|
205
197
|
return true;
|
|
206
198
|
}
|
|
199
|
+
/** Won't do, Archive or Delete on a draft's task: a draft change only, the task leaves the draft (batch 11 items 8 and 16). Live is not touched. */
|
|
200
|
+
async function draftDrop(H, uid) {
|
|
201
|
+
const id = iniOfUid(uid), x = id && draftTask(id, uid);
|
|
202
|
+
const R = ROWS.get(id), name = R && R.vs ? R.vs.show.name : 'the draft';
|
|
203
|
+
const res = await write(H, '/task', { task: uid, drop: true });
|
|
204
|
+
if (!res || res.ok === false) return failed(H, res);
|
|
205
|
+
took(id, res); if (H.redraw) H.redraw();
|
|
206
|
+
// a task copied from Live comes back with Undo; a task the draft added is gone, so Undo adds it again
|
|
207
|
+
const back = res.gone ? () => write(H, '/task', { draft: uid.split(':')[1], add: { title: x.title, start: x.start, due: x.end, owner: x.owner, ...(x.section ? { section: x.section } : {}) } }) : () => write(H, '/task', { task: uid, undrop: true });
|
|
208
|
+
say(H, 'Dropped from ' + name + (x ? ': ' + x.title : '') + '.', async () => { const u = await back(); if (u && u.ok) { took(id, u); if (H.redraw) H.redraw(); } else failed(H, u, 'The undo did not land.'); });
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
207
211
|
/** + in the Tasks header: into the draft shown; the first task of an initiative with no Live task and no plan goes to "Proposal". → true when handled here. */
|
|
208
212
|
async function draftAdd(H, id, title, inp, section) {
|
|
209
213
|
const R = ROWS.get(id), vs = R && R.vs, live = R ? (R.r.tasks || []).filter(counts) : [];
|
|
@@ -332,6 +336,7 @@ export function wrap(h, body, shown) {
|
|
|
332
336
|
W.check = (uid, btn) => (isDraft(uid) ? undefined : h.check && h.check(uid, btn));
|
|
333
337
|
W.status = (uid, state) => (isDraft(uid) ? draftStatus(W, uid, state) : h.status && h.status(uid, state));
|
|
334
338
|
W.dates = (uid, patch) => (isDraft(uid) ? draftDates(W, uid, patch) : h.dates && h.dates(uid, patch));
|
|
339
|
+
if (h.remove) W.remove = (uid) => (isDraft(uid) ? draftDrop(W, uid) : h.remove(uid));
|
|
335
340
|
W.openTask = (uid, b) => (isDraft(uid) ? undefined : h.openTask && h.openTask(uid, b));
|
|
336
341
|
W.addTask = async (title, inp) => {
|
|
337
342
|
const id = idOf(), v = id && shown ? shown(id) : null;
|