create-pmos 0.415.0 → 0.416.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 -13
- 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/briefing-premium-adddoc-test.js +3 -3
- package/workspace/briefing-premium-board-test.js +72 -43
- package/workspace/briefing-premium-doc-edit-test.js +2 -2
- package/workspace/briefing-premium-initiative-test.js +19 -22
- package/workspace/briefing-premium-insights-test.js +28 -17
- package/workspace/changelog.json +12 -0
- package/workspace/core-docs-workflow-test.js +1 -1
- package/workspace/guide/workflows.md +2 -1
- package/workspace/ini-workflow-test.js +11 -11
- package/workspace/lib/board-premium.js +7 -2
- package/workspace/lib/board-trail.js +6 -1
- package/workspace/lib/engine/boards.js +8 -2
- package/workspace/lib/initiative-chat.js +4 -3
- package/workspace/lib/insights-premium.js +9 -1
- package/workspace/lib/pmos-verbs.js +1 -1
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-boards.js +32 -4
- package/workspace/lib/routes-live.js +53 -0
- package/workspace/lib/task-cli.js +88 -24
- package/workspace/lib/task-items.js +3 -1
- package/workspace/lib/workflow-cli.js +1 -1
- package/workspace/milestone-suggest-test.js +2 -1
- 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-chat-report-tab-test.js +13 -5
- package/workspace/premium-core-doc-issue-test.js +1 -1
- package/workspace/premium-report-read-test.js +66 -51
- package/workspace/premium-vw-backlog-test.js +3 -3
- package/workspace/premium-vw-doc-test.js +3 -3
- package/workspace/premium-vw-item-test.js +4 -4
- package/workspace/premium-vw-jira-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +7 -5
- package/workspace/program-panel-test.js +1 -1
- package/workspace/public/pm/bd-ini-panel.js +68 -230
- package/workspace/public/pm/cozy-insights.css +15 -0
- package/workspace/public/pm/cozy-live-pill.css +48 -0
- package/workspace/public/pm/cozy-live-pill.js +141 -0
- package/workspace/public/pm/cozy-viewer.js +4 -3
- package/workspace/public/pm/cozy-vw-rp.css +48 -0
- package/workspace/public/pm/home-app.js +45 -8
- package/workspace/public/pm/home-chat.js +5 -2
- package/workspace/public/pm/home-ini.js +57 -22
- package/workspace/public/pm/home-task.js +16 -5
- package/workspace/public/pm/ini-view-model.js +277 -0
- package/workspace/public/pm/ini-view.css +122 -0
- package/workspace/public/pm/ini-view.js +180 -0
- package/workspace/public/pm/live-model.js +104 -0
- package/workspace/public/pm/ov-view.css +44 -0
- package/workspace/public/pm/premium-board.js +14 -15
- package/workspace/public/pm/premium-insights.js +61 -35
- package/workspace/public/pm/premium-report-read.js +74 -50
- package/workspace/public/pm/premium-report-tab.js +36 -15
- package/workspace/public/pm/premium-shell.js +1 -1
- package/workspace/public/pm/premium-vw-item-model.js +6 -3
- package/workspace/public/pm/premium-vw-item.js +25 -6
- package/workspace/public/pm/premium-vw-jira.js +17 -15
- package/workspace/public/pm/rp-parts.js +75 -12
- package/workspace/public/pm/task-card.css +24 -49
- package/workspace/public/pm/task-card.js +90 -64
- package/workspace/public/pm/tk-view.css +21 -0
- package/workspace/public/pm/tk-view.js +216 -0
- package/workspace/public/pm/wf-page.js +2 -0
- package/workspace/server.js +24 -1
- package/workspace/stage-card-test.js +49 -41
- package/workspace/task-card-test.js +83 -38
- package/workspace/test-files.json +3 -1
- package/workspace/test-lists/bd-ini-panel.json +3 -3
- package/workspace/tk-tasks-test.js +3 -3
- package/workspace/public/pm/bd-ini-model.js +0 -81
- package/workspace/public/pm/cozy-rec-pill.css +0 -12
- package/workspace/public/pm/cozy-rec-pill.js +0 -46
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/* pm/ini-view-model.js — ONE initiative view, the same on Board, Home and the phone (feedback batch 6 items 1 and 3; canvas In development:
|
|
2
|
+
* OvGrill, the rules; OvIniA, the view; OvAEdges, the hard cases). Pure: no DOM, no reads. pm/ini-view.js draws it; ini-view-model.test.js
|
|
3
|
+
* checks it. The Board's panel (bd-ini-panel.js) and Home's initiative page (home-ini.js) both draw from iniView(row, ctx): the row is the
|
|
4
|
+
* initiative as GET /api/board-premium sends it (both pages read it), with its trail (GET /api/board-trail), so the two can no longer count
|
|
5
|
+
* different things. Only the host's chrome differs.
|
|
6
|
+
*
|
|
7
|
+
* iniView(r, ctx) → { summary, stage, tasks } the whole view, as data
|
|
8
|
+
* ctx: { steps (Product feature's eight, the model's), today (YYYY-MM-DD, the model's day), usual ({ days } | null, the usual days in the
|
|
9
|
+
* current stage), grill ({ open, later } | null), program ({ id, title } | null), jiraAt ('Jira · 2h ago' | ''), ask ({ title } | null: a
|
|
10
|
+
* session that waits on the PM, Home's), docs (count | null), linked (count | null) }
|
|
11
|
+
* stagesOf(r, steps) → { list: [{ key, name, ms, status: done | now | next | skip, why }], cur } the initiative's OWN workflow (D99)
|
|
12
|
+
* sectionOf(task, list) → the stage key the task sits under in the breakdown, or '' (a WBS section is a task's place, never its state)
|
|
13
|
+
* wbsOf(title) → { code, top } | null "10.5 TC to review" → { code: '10.5', top: '10' }; "WP-03 Token exchange" → { code: 'WP-03', top: 'WP' }
|
|
14
|
+
* statusOf(r, grill, fmt) → { tone, text } the status the row and the view both say
|
|
15
|
+
* linkedOf(r) → [{ kind: doc | dep | epic, label, path?, title? }] the Linked fold, from the trail
|
|
16
|
+
*
|
|
17
|
+
* THE RULES (OvGrill):
|
|
18
|
+
* 1 the ladder says where the stage is ("5 of 7"); the card says how much of its section is done ("0 of 3 done"). Never one number for both.
|
|
19
|
+
* 2 Tasks are the WBS: one section per stage, in workflow order; "Not in a stage" last. A section is a task's place, never its state.
|
|
20
|
+
* 4 the stage card keeps where it is, its dates and the next stage; the tasks are said once, in Tasks.
|
|
21
|
+
* 5 a stage is finished when its section is: every task Done or Won't do.
|
|
22
|
+
* 6 only what is live shows: past stages fold into one line, later ones with nothing late into "Later"; the current section and any section
|
|
23
|
+
* with a late task stay open.
|
|
24
|
+
* 9 what waits on you leads, with the one primary; the status then moves to the meta line.
|
|
25
|
+
* 10 a new initiative with no breakdown draws its workflow's sections dashed, with Draft it.
|
|
26
|
+
* 11 Build with Jira tickets: the open tickets are Build's section, by epic, with "N of M done in Jira" and how fresh.
|
|
27
|
+
* 12 over the plan: the dates line turns amber with the days over; a skipped stage keeps its place, with its reason.
|
|
28
|
+
* 18 each section carries its dates: done stages when they ran, now from when to the plan end, later ones "Plan <date>", amber when missed.
|
|
29
|
+
* 19 a big section shows the 3 most urgent first, then folds the rest by the next WBS level, each with its count; done folds last. */
|
|
30
|
+
|
|
31
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
32
|
+
const CLOSED = new Set(['Done', "Won't do", 'Archived']);
|
|
33
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
34
|
+
const dayOf = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
35
|
+
const todayOf = (ctx) => dayOf(ctx && ctx.today) || (() => { const d = new Date(ctx && ctx.now != null ? ctx.now : Date.now()); return new Date(d.getFullYear(), d.getMonth(), d.getDate()); })();
|
|
36
|
+
const between = (a, b) => Math.round((b - a) / 864e5);
|
|
37
|
+
const norm = (s) => String(s || '').trim().toLowerCase().replace(/^◆\s*/, '').replace(/\s+/g, ' ');
|
|
38
|
+
const PF_ID = 'product-feature';
|
|
39
|
+
/** "Aug 11" this year, "Feb 3, 2027" in any other: a date never reads as this year's when it is not. */
|
|
40
|
+
export function dateY(iso, today) {
|
|
41
|
+
const d = dayOf(iso); if (!d) return '';
|
|
42
|
+
return MON[d.getMonth()] + ' ' + d.getDate() + (d.getFullYear() !== today.getFullYear() ? ', ' + d.getFullYear() : '');
|
|
43
|
+
}
|
|
44
|
+
const span = (a, b, today) => (a && b ? (a === b ? dateY(a, today) : dateY(a, today) + ' – ' + dateY(b, today)) : a ? dateY(a, today) : b ? dateY(b, today) : '');
|
|
45
|
+
const initials = (name) => { const w = String(name || '').replace(/^pm:/, '').trim().split(/\s+/).filter(Boolean); return !w.length ? '' : w.length > 1 ? (w[0][0] + w[1][0]).toUpperCase() : w[0].charAt(0).toUpperCase(); };
|
|
46
|
+
const ownerName = (o) => (/^pm:/.test(String(o || '')) ? 'You' : String(o || ''));
|
|
47
|
+
|
|
48
|
+
/* ── the stages of its own workflow ── */
|
|
49
|
+
const ownWf = (r) => !!(r && r.wf && r.wf.id && r.wf.id !== PF_ID && Array.isArray(r.wfStages) && r.wfStages.length && r.wfStage);
|
|
50
|
+
export function stagesOf(r, steps) {
|
|
51
|
+
if (ownWf(r)) {
|
|
52
|
+
const cur = r.wfStages.findIndex((s) => s.key === r.wfStage.key);
|
|
53
|
+
const list = r.wfStages.map((s, i) => ({ key: s.key, name: s.name, ms: !!s.milestone,
|
|
54
|
+
status: i === cur ? 'now' : s.status === 'skipped' ? 'skip' : cur >= 0 && i < cur ? 'done' : 'next', why: (s.reading && s.reading.why) || (s.skipped && s.skipped.why) || '' }));
|
|
55
|
+
return { list, cur };
|
|
56
|
+
}
|
|
57
|
+
const t = r.track || {}, k = t.k == null ? -1 : t.k, sk = new Set(t.skipped || []);
|
|
58
|
+
const why = (key) => { const w = (t.skipWhy || []).find((x) => x.stage === key) || (((r.trail || {}).skipped) || []).find((x) => x.stage === key); return (w && w.why) || ''; };
|
|
59
|
+
// a Product feature row's own skipped steps come from the trail too (the Board merges them; Home does not): read both
|
|
60
|
+
for (const x of ((r.trail || {}).skipped) || []) { const j = (steps || []).findIndex((s) => s.key === x.stage); if (j >= 0 && (k < 0 || j < k)) sk.add(j); }
|
|
61
|
+
const list = (steps || []).map((s, i) => ({ key: s.key, name: s.label, ms: !!s.ms, status: i === k ? 'now' : sk.has(i) ? 'skip' : k >= 0 && i < k ? 'done' : 'next', why: sk.has(i) ? why(s.key) : '' }));
|
|
62
|
+
return { list, cur: k };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* ── where a task sits ── */
|
|
66
|
+
/** The stage key a task sits under: the PM's own placement (section, '' = none), the stage whose To finish entry made it, a breakdown item's
|
|
67
|
+
* own stage when a stage of this workflow has that key or name; else '' (Not in a stage). */
|
|
68
|
+
export function sectionOf(task, list) {
|
|
69
|
+
const L = list || [];
|
|
70
|
+
const has = (k) => L.some((s) => s.key === k);
|
|
71
|
+
if (typeof task.section === 'string') return has(task.section) ? task.section : '';
|
|
72
|
+
if (task.from && task.from.stage && has(task.from.stage)) return task.from.stage;
|
|
73
|
+
if (task.itemStage) { const n = norm(task.itemStage), hit = L.find((s) => s.key === task.itemStage || norm(s.name) === n || norm(s.key) === n); if (hit) return hit.key; }
|
|
74
|
+
return '';
|
|
75
|
+
}
|
|
76
|
+
/** The WBS code a title starts with, and its top level: "10.5 TC to review" → 10.5 under 10; "WP-03 Token exchange" → WP-03 under WP. */
|
|
77
|
+
export function wbsOf(title) {
|
|
78
|
+
const t = String(title || '').trim();
|
|
79
|
+
let m = /^(\d+(?:\.\d+)+)\s+\S/.exec(t);
|
|
80
|
+
if (m) return { code: m[1], top: m[1].split('.')[0] };
|
|
81
|
+
m = /^([A-Z][A-Z0-9]{0,5})-(\d+)\b/.exec(t);
|
|
82
|
+
if (m) return { code: m[1] + '-' + m[2], top: m[1], n: +m[2] };
|
|
83
|
+
m = /^(\d+)(?:\.0)?\s+\S/.exec(t);
|
|
84
|
+
if (m) return { code: m[1], top: m[1], head: true };
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* ── the status ── */
|
|
89
|
+
export function statusOf(r, grill, fmt) {
|
|
90
|
+
const t = r.track || {};
|
|
91
|
+
if (r.acts && r.acts.life === 'hold') return { tone: 'q', text: 'On hold' + (r.acts.back ? ' · back ' + r.acts.back : '') };
|
|
92
|
+
if (t.you) return { tone: 'you', text: t.you };
|
|
93
|
+
const g = grill; if (g && g.open && !g.later) return { tone: 'you', text: plural(g.open, 'question', 'questions') + ' before the BRD' };
|
|
94
|
+
if (r.late) return { tone: 'late', text: r.overDays > 0 ? plural(r.overDays, 'day', 'days') + ' over' : 'Late' };
|
|
95
|
+
if (r.status === 'at risk') return { tone: 'risk', text: 'At risk' + (r.owner ? '' : ' · no owner') };
|
|
96
|
+
if (t.idle != null) return { tone: 'q', text: 'Idle ' + t.idle + ' days' };
|
|
97
|
+
if (r.status === 'on track' && r.release && r.release.days != null && r.release.days >= 0 && t.key === 'deliver') {
|
|
98
|
+
const d = r.release.days; return { tone: 'ok', text: d === 0 ? 'Ships today' : d === 1 ? 'Ships tomorrow' : 'Ships ' + (fmt ? fmt(r.release.iso) : r.release.at) };
|
|
99
|
+
}
|
|
100
|
+
if (r.status === 'on track') return { tone: 'ok', text: 'On track' };
|
|
101
|
+
if (r.status === 'done') return { tone: 'ok', text: 'Done' };
|
|
102
|
+
return { tone: 'q', text: r.statusLabel || '' };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* ── one task row ── */
|
|
106
|
+
function rowOf(k, today) {
|
|
107
|
+
const closed = CLOSED.has(k.status), d = dayOf(k.end), late = !closed && !!d && d < today;
|
|
108
|
+
const due = d ? dateY(k.end, today) + (late ? ', ' + plural(between(d, today), 'day', 'days') + ' late' : '') : '';
|
|
109
|
+
const who = ownerName(k.owner);
|
|
110
|
+
return { uid: k.uid, title: k.title, status: k.status || 'To do', closed, done: k.status === 'Done', late, due, end: k.end || '', owner: who, av: initials(k.owner),
|
|
111
|
+
sub: [k.status === 'In progress' ? 'In progress' : '', due, who && who !== 'You' ? who : ''].filter(Boolean).join(' · '), wbs: wbsOf(k.title), canCheck: !!k.uid, order: k.order };
|
|
112
|
+
}
|
|
113
|
+
const urgent = (a, b) => (b.late - a.late) || (a.end || '9999').localeCompare(b.end || '9999') || (a.order != null && b.order != null ? a.order - b.order : 0);
|
|
114
|
+
/** A section's rows: open ones first by urgency; past 5 open, the 3 most urgent then the rest folded by the next WBS level; done fold last. */
|
|
115
|
+
function bodyOf(rows) {
|
|
116
|
+
const open = rows.filter((x) => !x.closed).sort(urgent), done = rows.filter((x) => x.closed);
|
|
117
|
+
if (open.length <= 5) return { top: open, groups: [], done };
|
|
118
|
+
const top = open.slice(0, 3), rest = open.slice(3), by = new Map();
|
|
119
|
+
for (const x of rest) { const k = x.wbs ? x.wbs.top : ''; if (!by.has(k)) by.set(k, []); by.get(k).push(x); }
|
|
120
|
+
const heads = new Map(rows.filter((x) => x.wbs && x.wbs.head).map((x) => [x.wbs.top, x.title.replace(/^\d+(?:\.0)?\s+/, '')]));
|
|
121
|
+
const groups = [...by.entries()].map(([k, xs]) => {
|
|
122
|
+
const codes = xs.map((x) => x.wbs && x.wbs.code).filter(Boolean).sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
|
|
123
|
+
const label = !k ? 'Other open tasks' : heads.get(k) ? k + ' ' + heads.get(k) : codes.length > 1 ? codes[0] + ' to ' + codes[codes.length - 1] : codes[0] || k;
|
|
124
|
+
return { key: k || '-', label, rows: xs.sort(urgent), n: xs.length };
|
|
125
|
+
});
|
|
126
|
+
// one group only says nothing the count does not: then it is "N more open"
|
|
127
|
+
if (groups.length === 1) groups[0].label = plural(rest.length, 'more open', 'more open');
|
|
128
|
+
return { top, groups, done };
|
|
129
|
+
}
|
|
130
|
+
const countOf = (open, late, done) => (late && late === open ? late + ' late' : late ? late + ' late · ' + open + ' open' : open ? open + ' open' : done ? done + ' done' : '');
|
|
131
|
+
|
|
132
|
+
/* ── the view ── */
|
|
133
|
+
export function iniView(r, ctx = {}) {
|
|
134
|
+
const today = todayOf(ctx), t = r.track || {}, tr = r.trail || {};
|
|
135
|
+
const { list, cur } = stagesOf(r, ctx.steps);
|
|
136
|
+
const T = (r.tasks || []).filter((k) => k.status !== 'Archived');
|
|
137
|
+
const rows = T.map((k) => ({ ...rowOf(k, today), sec: sectionOf(k, list) }));
|
|
138
|
+
const open = rows.filter((x) => !x.closed), late = open.filter((x) => x.late);
|
|
139
|
+
const jira = !ownWf(r) && (t.key === 'build' || t.key === 'deliver') && (t.tickets || []).length > 0;
|
|
140
|
+
|
|
141
|
+
// the dates each stage ran: its board moves, oldest first; the first stage starts with the plan
|
|
142
|
+
const moves = Array.isArray(tr.moves) ? tr.moves : [];
|
|
143
|
+
const idx = (to) => list.findIndex((s) => s.key === to || norm(s.name) === norm(to) || norm(s.key) === norm(to));
|
|
144
|
+
const ran = list.map(() => ({ from: null, to: null }));
|
|
145
|
+
moves.forEach((m, i) => { const j = idx(m.to); if (j < 0) return; ran[j].from = m.at; const nx = moves[i + 1]; ran[j].to = nx ? nx.at : null; });
|
|
146
|
+
if (cur >= 0 && tr.since) ran[cur].from = tr.since;
|
|
147
|
+
if (list.length && !ran[0].from && r.start) ran[0].from = String(r.start).slice(0, 10);
|
|
148
|
+
|
|
149
|
+
/* the stage card */
|
|
150
|
+
const st = cur >= 0 ? list[cur] : null;
|
|
151
|
+
const curRows = st ? rows.filter((x) => x.sec === st.key) : [];
|
|
152
|
+
const tk = t.tickets || [];
|
|
153
|
+
const doneOf = jira ? tk.filter((k) => k.status === 'Done').length + ' of ' + tk.length + ' done in Jira'
|
|
154
|
+
: curRows.length ? curRows.filter((x) => x.closed).length + ' of ' + curRows.length + ' done' : '';
|
|
155
|
+
// days in the stage: the trail's (when it entered the stage) first, then the track's
|
|
156
|
+
const days = tr.days != null ? tr.days : tr.since && dayOf(tr.since) ? Math.max(0, between(dayOf(tr.since), today)) : t.days != null ? t.days : null, usual = ctx.usual && ctx.usual.days != null ? ctx.usual.days : null;
|
|
157
|
+
const end = dayOf(r.end), fc = dayOf(t.forecast), finished = r.status === 'done' || r.status === 'cancelled';
|
|
158
|
+
const dates = (r.start || r.end) ? {
|
|
159
|
+
start: r.start ? dateY(r.start, today) : '',
|
|
160
|
+
end: r.end ? dateY(r.end, today) : '',
|
|
161
|
+
left: end && !finished ? (end < today ? plural(between(end, today), 'day', 'days') + ' over' : end > today ? plural(between(today, end), 'day', 'days') + ' left' : 'ends today') : '',
|
|
162
|
+
over: !!(end && end < today && !finished),
|
|
163
|
+
jira: fc && (!end || fc > end) && !finished ? dateY(t.forecast, today) : '',
|
|
164
|
+
} : null;
|
|
165
|
+
let nx = null;
|
|
166
|
+
// Won't do and Archived hold their stage (D99 wfRules): no next stage to move to
|
|
167
|
+
if (cur >= 0 && !r.ended) { const n = list.slice(cur + 1).find((s) => s.status !== 'skip'); if (n) nx = { key: n.key, name: n.name, ms: n.ms, moves: n.ms && r.kr ? r.kr : '' }; }
|
|
168
|
+
const stage = {
|
|
169
|
+
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),
|
|
170
|
+
doneOf, day: days != null ? 'day ' + days + (usual != null ? ' of ~' + usual : '') : '', dayOver: days != null && usual != null && days > usual,
|
|
171
|
+
ladder: list.map((s) => ({ name: s.name, ms: s.ms, cls: s.status })), dates, next: nx,
|
|
172
|
+
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.',
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/* the tasks, as the WBS */
|
|
176
|
+
const sections = [];
|
|
177
|
+
const secOf = (s, i) => rows.filter((x) => x.sec === s.key);
|
|
178
|
+
const planOf = (rs) => { const ds = rs.map((x) => x.end).filter(Boolean).sort(); return ds.length ? ds[ds.length - 1] : ''; };
|
|
179
|
+
const headOf = (rs) => { const tops = [...new Set(rs.map((x) => x.wbs && x.wbs.top).filter(Boolean))]; if (tops.length !== 1) return ''; const h = rs.find((x) => x.wbs && x.wbs.head && x.wbs.top === tops[0]); return h ? h.title : ''; };
|
|
180
|
+
const one = (s, i, why) => {
|
|
181
|
+
const rs = secOf(s, i), op = rs.filter((x) => !x.closed), lt = op.filter((x) => x.late), dn = rs.length - op.length;
|
|
182
|
+
let sub = '', subWarn = false;
|
|
183
|
+
if (s.status === 'now') sub = 'Now' + (ran[i].from || r.end ? ' · ' + (ran[i].from && r.end ? span(ran[i].from, String(r.end).slice(0, 10), today) : ran[i].from ? 'since ' + dateY(ran[i].from, today) : 'to ' + dateY(r.end, today)) : '');
|
|
184
|
+
else if (s.status === 'done' || s.status === 'skip') sub = s.status === 'skip' ? 'Skipped' + (s.why ? ': ' + s.why : '') : span(ran[i].from, ran[i].to, today);
|
|
185
|
+
else { const p = planOf(rs); if (p) { sub = 'Plan ' + dateY(p, today); if (dayOf(p) < today && op.length) { sub += ', missed'; subWarn = true; } } }
|
|
186
|
+
const h = headOf(rs); if (h) sub = [sub, h].filter(Boolean).join(' · ');
|
|
187
|
+
return { kind: 'stage', key: s.key, n: i + 1, name: s.name, ms: s.ms, status: s.status, sub, subWarn, count: countOf(op.length, lt.length, dn), warn: lt.length > 0,
|
|
188
|
+
open: s.status === 'now' || lt.length > 0, ...bodyOf(rs), jira: null, why };
|
|
189
|
+
};
|
|
190
|
+
const anyTasks = rows.length > 0 || jira;
|
|
191
|
+
// past: a done or skipped stage folds into one line unless it holds a late task
|
|
192
|
+
const past = [], keep = new Set();
|
|
193
|
+
list.forEach((s, i) => { if (cur >= 0 && i < cur) { const rs = secOf(s, i); if (rs.some((x) => !x.closed && x.late)) keep.add(i); else past.push(i); } });
|
|
194
|
+
if (past.length) {
|
|
195
|
+
const rs = past.flatMap((i) => secOf(list[i], i)), skips = past.filter((i) => list[i].status === 'skip');
|
|
196
|
+
const a = past[0] + 1, b = past[past.length - 1] + 1;
|
|
197
|
+
const from = past.map((i) => ran[i].from).filter(Boolean).sort()[0] || '', to = past.map((i) => ran[i].to).filter(Boolean).sort().pop() || (cur >= 0 ? ran[cur].from : '') || '';
|
|
198
|
+
const sk = skips.map((i) => list[i].name + ' skipped' + (list[i].why ? ': ' + list[i].why.replace(/\.$/, '').replace(/^./, (c) => c.toLowerCase()) : '')).join(' · ');
|
|
199
|
+
sections.push({ kind: 'past', key: 'past', label: a === b ? list[a - 1].name : 'Stages ' + a + '–' + b, sub: [span(from, to, today), sk].filter(Boolean).join(' · '),
|
|
200
|
+
count: rs.length ? rs.filter((x) => x.closed).length + ' done' : '', open: false, ...bodyOf(rs), stages: past.map((i) => one(list[i], i)) });
|
|
201
|
+
}
|
|
202
|
+
// now and any past stage with a late task, in workflow order; later stages with a late task stay open, the rest fold into Later
|
|
203
|
+
const later = [];
|
|
204
|
+
list.forEach((s, i) => {
|
|
205
|
+
if (cur >= 0 && i < cur) { if (keep.has(i)) sections.push(one(s, i)); return; }
|
|
206
|
+
if (i === cur) {
|
|
207
|
+
const x = one(s, i);
|
|
208
|
+
if (jira) {
|
|
209
|
+
const opn = tk.filter((k) => k.status !== 'Done').sort((a, b) => (b.blocked ? 1 : 0) - (a.blocked ? 1 : 0));
|
|
210
|
+
x.jira = { open: opn.map((k) => ({ key: k.key, title: k.title, epic: k.epic || '', sub: [k.blocked ? 'Blocked' + (k.reason ? ' by ' + String(k.reason).replace(/^Waiting on /i, '') : '') : k.status || 'To do', k.assignee || ''].filter(Boolean).join(' · '), warn: !!k.blocked })),
|
|
211
|
+
done: tk.length - opn.length, total: tk.length, at: ctx.jiraAt || '' };
|
|
212
|
+
x.count = countOf(opn.length + x.top.length + x.groups.reduce((n, g) => n + g.n, 0), x.top.filter((y) => y.late).length, 0);
|
|
213
|
+
x.sub = x.sub + (x.sub ? ' · ' : '') + 'Jira tickets, by epic';
|
|
214
|
+
}
|
|
215
|
+
sections.push(x); return;
|
|
216
|
+
}
|
|
217
|
+
const rs = secOf(s, i);
|
|
218
|
+
if (rs.some((x) => !x.closed && x.late)) sections.push(one(s, i));
|
|
219
|
+
else later.push(i);
|
|
220
|
+
});
|
|
221
|
+
if (later.length) {
|
|
222
|
+
const rs = later.flatMap((i) => secOf(list[i], i)), op = rs.filter((x) => !x.closed);
|
|
223
|
+
const ds = rs.map((x) => x.end).filter(Boolean).sort();
|
|
224
|
+
sections.push({ kind: 'later', key: 'later', label: 'Later: ' + later.map((i) => list[i].name).join(', '), sub: ds.length ? 'Plan ' + span(ds[0], ds[ds.length - 1], today) : '',
|
|
225
|
+
count: op.length ? op.length + ' to do' : '', open: false, ...bodyOf(rs), stages: later.map((i) => one(list[i], i)) });
|
|
226
|
+
}
|
|
227
|
+
const loose = rows.filter((x) => !x.sec);
|
|
228
|
+
if (loose.length) {
|
|
229
|
+
const op = loose.filter((x) => !x.closed), lt = op.filter((x) => x.late);
|
|
230
|
+
sections.push({ kind: 'none', key: '', label: 'Not in a stage', sub: '', count: countOf(op.length, lt.length, loose.length - op.length), warn: lt.length > 0, open: op.length > 0, ...bodyOf(loose) });
|
|
231
|
+
}
|
|
232
|
+
const nOpen = open.length + (jira ? tk.filter((k) => k.status !== 'Done').length : 0), nDone = rows.length - open.length + (jira ? tk.filter((k) => k.status === 'Done').length : 0);
|
|
233
|
+
const tasks = { open: nOpen, done: nDone, late: late.length, count: [nOpen ? nOpen + ' open' : '', nDone ? nDone + ' done' : ''].filter(Boolean).join(' · '), sections,
|
|
234
|
+
empty: !anyTasks ? { stages: list.map((s, i) => ({ n: i + 1, name: s.name, ms: s.ms, now: i === cur })) } : null };
|
|
235
|
+
|
|
236
|
+
/* the summary: what waits on you leads; else the status and why */
|
|
237
|
+
const s = statusOf(r, ctx.grill, (iso) => dateY(iso, today));
|
|
238
|
+
const lateSay = late.length ? plural(late.length, 'task is', 'tasks are') + ' late' + (late.length > 1 ? ', the oldest since ' + dateY(late.map((x) => x.end).sort()[0], today) : ', since ' + dateY(late[0].end, today)) + '.' : '';
|
|
239
|
+
const why = whyText(r, list, cur, today, finished);
|
|
240
|
+
const it = tr || {};
|
|
241
|
+
const progress = jira ? (ctx.jiraAt || '') : r.progress != null && Number.isFinite(Number(r.progress)) ? Math.round(Number(r.progress)) + '% done · typed in by hand' : '';
|
|
242
|
+
// what waits on the PM: the track's, else the trail's (the Board merges the trail into the track; Home reads the row as sent)
|
|
243
|
+
const you = t.you || (it.you && it.you.text) || null, youKind = t.youKind || (it.you && it.you.kind) || null, youWhy = t.youWhy || (it.you && it.you.why) || '';
|
|
244
|
+
let wait = null;
|
|
245
|
+
if (ctx.ask && ctx.ask.title) wait = { text: '“' + ctx.ask.title + '” needs your answer.', primary: { act: 'ask', label: 'Answer: ' + ctx.ask.title } };
|
|
246
|
+
else if (you && youKind) wait = { text: youWhy, primary: youKind === 'drift' && it.links && it.links.prd ? { act: 'doc:' + it.links.prd, label: 'Open the PRD' } : youKind === 'commit' ? { act: 'commit', label: 'Send to Jira' } : { act: 'page', label: you } };
|
|
247
|
+
else if (you) { const opn = tk.filter((k) => k.status !== 'Done').length; wait = { text: opn ? plural(opn, 'ticket is', 'tickets are') + ' still open, so the sign-off can wait until they close.' : 'Every release ticket is done.', primary: { act: 'page', label: you } }; }
|
|
248
|
+
else if (ctx.grill && ctx.grill.open && !ctx.grill.later) wait = { text: 'PMOS asks what the BRD needs that the Why does not say yet.', primary: { act: 'grill', label: 'Answer the questions' } };
|
|
249
|
+
const summary = wait
|
|
250
|
+
? { line: 'Waits on you', tone: 'you', right: progress, text: [wait.text, lateSay].filter(Boolean).join(' '), primary: wait.primary,
|
|
251
|
+
status: s.tone === 'you' ? null : { tone: s.tone, text: s.tone === 'late' ? 'Late' : s.text } }
|
|
252
|
+
: { line: s.tone === 'late' && /^The plan ended /.test(why) ? 'Late' : s.text, tone: s.tone === 'late' || s.tone === 'risk' ? 'warn' : s.tone === 'ok' ? 'ok' : '', right: progress,
|
|
253
|
+
text: [why, lateSay].filter(Boolean).join(' '), primary: null, status: null };
|
|
254
|
+
summary.owner = r.owner ? { name: r.owner, av: initials(r.owner) } : null;
|
|
255
|
+
summary.wf = r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' };
|
|
256
|
+
summary.program = ctx.program || null;
|
|
257
|
+
return { id: r.id || null, key: r.key, title: r.title, summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r) };
|
|
258
|
+
}
|
|
259
|
+
/** What it links to, from its trail: the PRD (with its version), the rubric, the evaluation, the release notes, what it waits on, its epic. */
|
|
260
|
+
export function linkedOf(r) {
|
|
261
|
+
const it = r.trail || {}, L = it.links || {}, epic = L.epic || (r.epics || [])[0], D = it.deps || [], out = [];
|
|
262
|
+
const doc = (label, path) => { if (path) out.push({ kind: 'doc', label, path }); };
|
|
263
|
+
doc(L.prdVersion ? 'PRD v' + String(L.prdVersion).replace(/^v/i, '') : 'PRD', L.prd); doc('Rubric', L.rubric); doc('Evaluation', L.evaluation); doc('Release notes', L.notes);
|
|
264
|
+
for (const d of D) out.push({ kind: 'dep', label: 'Waits on ' + (d.title || d.id), title: (d.title || d.id) + ': ' + (!d.known ? 'not on this repository' : d.done ? 'done' : d.stage || 'open') });
|
|
265
|
+
if (epic) out.push({ kind: 'epic', label: 'Epic ' + epic });
|
|
266
|
+
return out;
|
|
267
|
+
}
|
|
268
|
+
/** The one sentence that says why the status is what it is: the plan end passed, or Jira's pace runs past it, then the first blocked ticket. */
|
|
269
|
+
function whyText(r, list, cur, today, finished) {
|
|
270
|
+
const t = r.track || {}, end = dayOf(r.end), fc = dayOf(t.forecast), said = [];
|
|
271
|
+
const name = cur >= 0 ? list[cur].name : t.label || r.stage || '';
|
|
272
|
+
if (end && end < today && !finished) said.push('The plan ended ' + dateY(r.end, today) + ', ' + plural(between(end, today), 'day', 'days') + ' ago, and ' + r.title + ' is in ' + (name || 'a stage not on record') + '.');
|
|
273
|
+
else if (end && fc && fc > end && !finished) said.push('Jira’s pace ends it ' + dateY(t.forecast, today) + ', ' + plural(between(end, fc), 'day', 'days') + ' after your plan.');
|
|
274
|
+
const k = (t.tickets || []).find((x) => x.blocked && x.status !== 'Done');
|
|
275
|
+
if (k) { const on = /\b([A-Z][A-Z0-9]+-\d+)\b/.exec(k.reason || ''); said.push(k.key + ' is blocked' + (on && on[1] !== k.key ? ' by ' + on[1] : '') + '.'); }
|
|
276
|
+
return said.join(' ');
|
|
277
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* pm/ini-view.css — the ONE initiative view (feedback batch 6 item 1; canvas OvIniA, OvAEdges), drawn by pm/ini-view.js on the Board's
|
|
2
|
+
* panel, Home's initiative page and the phone. Token vars from cozy.css only, so dark mode follows the page. No motion. */
|
|
3
|
+
.iv { display: flex; flex-direction: column; gap: 12px; color: var(--cz-ink); font-family: var(--cz-sans); }
|
|
4
|
+
.iv button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: left; }
|
|
5
|
+
.iv button:disabled { cursor: default; }
|
|
6
|
+
.iv button:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; border-radius: 10px; }
|
|
7
|
+
.iv .w { color: var(--cz-risk); font-weight: 700; }
|
|
8
|
+
.iv-q { margin: 0; font-size: 12.5px; color: var(--cz-ink3); line-height: 1.45; }
|
|
9
|
+
.iv-ib { width: 32px; height: 32px; border-radius: 999px; display: inline-flex !important; align-items: center; justify-content: center; color: var(--cz-ink2); flex: none; }
|
|
10
|
+
.iv-ib:hover { background: var(--cz-well); }
|
|
11
|
+
|
|
12
|
+
/* the summary card */
|
|
13
|
+
.iv-sum { background: var(--cz-well); border-radius: 20px; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
|
|
14
|
+
.iv-s1 { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 32px; }
|
|
15
|
+
.iv-s1 b { font-weight: 800; }
|
|
16
|
+
.iv-s1.you { color: var(--cz-blueink); }
|
|
17
|
+
.iv-s1.warn { color: var(--cz-risk); }
|
|
18
|
+
.iv-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--cz-blue); }
|
|
19
|
+
.iv-s1.warn .iv-dot { background: var(--cz-risk); }
|
|
20
|
+
.iv-r { margin-left: auto; font-size: 12.5px; color: var(--cz-ink3); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
|
|
21
|
+
.iv-go { width: 32px; height: 32px; border-radius: 50% !important; background: var(--cz-solid) !important; color: var(--cz-onsolid) !important; display: inline-flex !important; align-items: center; justify-content: center; flex: none; }
|
|
22
|
+
.iv-s1 .iv-r + .iv-go { margin-left: 6px; }
|
|
23
|
+
.iv-s1 b + .iv-go { margin-left: auto; }
|
|
24
|
+
.iv-why { margin: 0; font-size: 14px; line-height: 1.5; color: var(--cz-ink); }
|
|
25
|
+
.iv-meta { margin: 0; font-size: 12.5px; color: var(--cz-ink3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
|
|
26
|
+
.iv-meta > span, .iv-meta > button { display: inline-flex; align-items: center; gap: 5px; }
|
|
27
|
+
.iv-meta .wfi { color: var(--cz-ink3); display: inline-flex; }
|
|
28
|
+
.iv-meta .wfi svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
|
29
|
+
.iv-st i { width: 7px; height: 7px; border-radius: 50%; background: var(--cz-ink3); }
|
|
30
|
+
.iv-st.late i, .iv-st.risk i { background: var(--cz-risk); }
|
|
31
|
+
.iv-st.ok i { background: var(--cz-ok); }
|
|
32
|
+
.iv-av { width: 22px; height: 22px; border-radius: 50%; background: var(--cz-bluebg); color: var(--cz-blueink); font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
|
|
33
|
+
button.iv-wf, .iv-prog { color: var(--cz-ink3) !important; border-radius: 999px; padding: 2px 6px !important; margin-left: -6px !important; }
|
|
34
|
+
button.iv-wf:hover, .iv-prog:hover { background: var(--cz-well2) !important; color: var(--cz-ink) !important; }
|
|
35
|
+
|
|
36
|
+
/* the stage card: where it is, its dates, the next stage */
|
|
37
|
+
.iv-sc { border: 1px solid var(--cz-hair); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
|
|
38
|
+
.iv-sch { display: flex; align-items: center; gap: 8px; }
|
|
39
|
+
.iv-sch b { font-size: 15px; font-weight: 800; min-width: 0; }
|
|
40
|
+
.iv-sch .iv-r { font-weight: 700; }
|
|
41
|
+
.iv-no { width: 22px; height: 22px; border-radius: 7px; background: var(--cz-well); color: var(--cz-ink3); font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
|
|
42
|
+
.iv-sch .iv-no { background: var(--cz-bluebg); color: var(--cz-blueink); }
|
|
43
|
+
.iv-no.ms { width: 14px; height: 14px; border-radius: 3px; margin: 0 4px; transform: rotate(45deg); background: var(--cz-card); border: 1.6px solid var(--cz-ink3); }
|
|
44
|
+
.iv-sch .iv-no.ms { background: var(--cz-blueink); border-color: var(--cz-blueink); }
|
|
45
|
+
.iv-no.ok { background: color-mix(in srgb, var(--cz-ink3) 60%, var(--cz-card)); color: var(--cz-card); }
|
|
46
|
+
.iv-no.now { background: var(--cz-bluebg); color: var(--cz-blueink); }
|
|
47
|
+
.iv-no.dash { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--cz-ink3) 60%, var(--cz-card)); }
|
|
48
|
+
.iv-no.dash.ms { border-style: dashed; }
|
|
49
|
+
.iv-no.skip { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--cz-ink3) 60%, var(--cz-card)); color: var(--cz-ink3); }
|
|
50
|
+
.iv-lad { display: flex; gap: 3px; align-items: center; min-height: 10px; }
|
|
51
|
+
.iv-lad i { flex: 1; height: 6px; border-radius: 3px; background: var(--cz-well2); display: block; }
|
|
52
|
+
.iv-lad i.done { background: color-mix(in srgb, var(--cz-ink3) 55%, var(--cz-card)); }
|
|
53
|
+
.iv-lad i.now { background: var(--cz-blue); height: 8px; }
|
|
54
|
+
.iv-lad i.skip { background: repeating-linear-gradient(135deg, var(--cz-well2) 0 3px, transparent 3px 6px); }
|
|
55
|
+
.iv-lad i.ms { flex: 0 0 9px; height: 9px; border-radius: 2px; transform: rotate(45deg); }
|
|
56
|
+
.iv-dl { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--cz-ink3); margin-top: -2px; }
|
|
57
|
+
.iv-dl b { color: var(--cz-ink); font-weight: 800; }
|
|
58
|
+
.iv-dl .e.w, .iv-dl .e.w b { color: var(--cz-risk); }
|
|
59
|
+
.iv-dl .j { color: var(--cz-blueink); font-weight: 700; }
|
|
60
|
+
.iv-nx { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0 2px; width: 100%; }
|
|
61
|
+
.iv-nx .w { color: inherit; font-weight: 400; display: flex; flex-direction: column; min-width: 0; }
|
|
62
|
+
.iv-nx .w b { font-size: 13.5px; font-weight: 600; color: var(--cz-ink2); }
|
|
63
|
+
.iv-nx .w > span { font-size: 12.5px; color: var(--cz-ink3); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
|
|
64
|
+
.iv-nd { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--cz-ink3) 60%, var(--cz-card)); flex: none; }
|
|
65
|
+
.iv-nd.ms { width: 14px; height: 14px; border-radius: 3px; margin: 3px; transform: rotate(45deg); border-color: var(--cz-ink3); }
|
|
66
|
+
.iv-kr { font-style: normal; font-weight: 800; font-size: 11.5px; color: var(--cz-ink2); border: 1px solid var(--cz-hair); border-radius: 999px; padding: 1px 8px; }
|
|
67
|
+
button.iv-nx:hover .w b { color: var(--cz-ink); }
|
|
68
|
+
|
|
69
|
+
/* Tasks: the WBS, one section per stage */
|
|
70
|
+
.iv-th { display: flex; align-items: center; gap: 8px; padding: 4px 2px 0; }
|
|
71
|
+
.iv-th b { font-size: 15px; font-weight: 800; }
|
|
72
|
+
.iv-th .n { font-size: 13px; color: var(--cz-ink3); font-weight: 700; }
|
|
73
|
+
.iv-th .iv-ib { margin-left: auto; }
|
|
74
|
+
.iv-wbs { display: flex; flex-direction: column; border-radius: 18px; border: 1px solid var(--cz-hair); overflow: hidden; }
|
|
75
|
+
.iv-ws { display: flex !important; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 4px 12px 4px 14px !important; position: relative; }
|
|
76
|
+
.iv-wbs > .iv-ws + .iv-ws::before, .iv-wbs > .iv-wl + .iv-ws::before, .iv-wl > .iv-ws + .iv-ws::before, .iv-wl > .iv-wl + .iv-ws::before { content: ""; position: absolute; left: 14px; right: 12px; top: 0; height: 1px; background: var(--cz-hair); }
|
|
77
|
+
.iv-ws .w { flex: 1; min-width: 0; color: inherit; font-weight: 400; display: flex; flex-direction: column; }
|
|
78
|
+
.iv-ws .w b { font-size: 14px; font-weight: 800; }
|
|
79
|
+
.iv-ws .w small { font-size: 12px; font-weight: 600; color: var(--cz-ink3); }
|
|
80
|
+
.iv-ws .w small.w { color: var(--cz-risk); font-weight: 700; }
|
|
81
|
+
.iv-ws.mut .w b { color: var(--cz-ink3); font-weight: 700; }
|
|
82
|
+
.iv-ws.in { padding-left: 24px !important; }
|
|
83
|
+
.iv-ws .n, .iv-grp .n, .iv-fr .n { font-size: 12.5px; color: var(--cz-ink3); font-weight: 700; white-space: nowrap; }
|
|
84
|
+
.iv-ws .n.w { color: var(--cz-risk); }
|
|
85
|
+
.iv-cv { color: var(--cz-ink3); display: inline-flex; flex: none; }
|
|
86
|
+
.iv-wl { padding: 0 14px 6px 46px; display: flex; flex-direction: column; }
|
|
87
|
+
.iv-wl > .iv-ws.in { margin-left: -46px; width: calc(100% + 60px); }
|
|
88
|
+
.iv-tr { display: flex !important; align-items: flex-start; gap: 12px; min-height: 44px; padding: 7px 0 !important; width: 100%; }
|
|
89
|
+
.iv-tr + .iv-tr, .iv-sub > .iv-tr + .iv-tr { border-top: 1px solid var(--cz-hair); }
|
|
90
|
+
.iv-tr .w { flex: 1; min-width: 0; color: inherit; font-weight: 400; display: flex; flex-direction: column; }
|
|
91
|
+
.iv-tt { display: block; font-size: 13.5px; font-weight: 700; color: var(--cz-ink); }
|
|
92
|
+
button.iv-tt:hover { text-decoration: underline; text-decoration-color: var(--cz-hair); }
|
|
93
|
+
.iv-tr .w > span { font-size: 12.5px; color: var(--cz-ink3); }
|
|
94
|
+
.iv-tr .w > span.w { color: var(--cz-risk); font-weight: 700; }
|
|
95
|
+
.iv-tr.done .iv-tt { color: var(--cz-ink3); font-weight: 600; }
|
|
96
|
+
.iv-tt em { font-style: normal; color: var(--cz-blueink); font-weight: 800; }
|
|
97
|
+
.iv-cb { width: 18px; height: 18px; border-radius: 5px; border: 1.6px solid color-mix(in srgb, var(--cz-ink3) 60%, var(--cz-card)) !important; flex: none; margin-top: 1px !important; display: inline-flex !important; align-items: center; justify-content: center; background: var(--cz-card) !important; color: var(--cz-card) !important; }
|
|
98
|
+
.iv-cb.on { background: color-mix(in srgb, var(--cz-ink3) 60%, var(--cz-card)) !important; }
|
|
99
|
+
.iv-cb.off { opacity: .6; }
|
|
100
|
+
.iv-jq { width: 12px; height: 12px; border-radius: 3px; background: var(--cz-blue); flex: none; margin: 4px 3px 0; }
|
|
101
|
+
.iv-more, .iv-grp { display: flex !important; align-items: center; gap: 8px; width: 100%; min-height: 40px; font-size: 13px; font-weight: 700; color: var(--cz-ink2); border-top: 1px solid var(--cz-hair) !important; }
|
|
102
|
+
.iv-grp b { flex: 1; font-size: 13.5px; font-weight: 700; color: var(--cz-ink); }
|
|
103
|
+
.iv-sub { padding-left: 12px; }
|
|
104
|
+
.iv-wl > .iv-q { padding: 8px 0 2px; }
|
|
105
|
+
.iv-empty { border: 1.5px dashed var(--cz-well2); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
|
|
106
|
+
.iv-sk { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--cz-ink3); font-weight: 700; }
|
|
107
|
+
.iv-sk i { font-style: normal; font-weight: 600; }
|
|
108
|
+
.iv-pbtn { display: inline-flex !important; align-items: center; gap: 6px; height: 40px; padding: 0 16px !important; border-radius: 999px !important; background: var(--cz-solid) !important; color: var(--cz-onsolid) !important; font-weight: 800; font-size: 13.5px; align-self: flex-start; }
|
|
109
|
+
|
|
110
|
+
.iv-addf { display: flex; align-items: center; gap: 8px; }
|
|
111
|
+
.iv-addf input { flex: 1; min-width: 0; height: 40px; border-radius: 12px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); padding: 0 12px; font: inherit; font-size: 14px; }
|
|
112
|
+
.iv-addf input:focus { outline: 2px solid var(--cz-blue); outline-offset: 0; }
|
|
113
|
+
|
|
114
|
+
/* Documents and Linked: the folds under the WBS */
|
|
115
|
+
.iv-folds { border-radius: 18px; border: 1px solid var(--cz-hair); overflow: hidden; }
|
|
116
|
+
.iv-fr { display: flex !important; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 12px 0 14px !important; position: relative; }
|
|
117
|
+
.iv-fr b { flex: 1; font-size: 14px; font-weight: 800; }
|
|
118
|
+
.iv-folds > * + .iv-fr::before { content: ""; position: absolute; left: 14px; right: 12px; top: 0; height: 1px; background: var(--cz-hair); }
|
|
119
|
+
.iv-fb { padding: 0 14px 12px; font-size: 13.5px; }
|
|
120
|
+
.iv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
121
|
+
.iv-chip { display: inline-flex !important; align-items: center; height: 30px; padding: 0 10px !important; border-radius: 999px !important; border: 1px solid var(--cz-hair) !important; font-size: 12.5px; font-weight: 700; color: var(--cz-ink2); }
|
|
122
|
+
button.iv-chip:hover { background: var(--cz-well) !important; }
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/* pm/ini-view.js — draws the ONE initiative view (feedback batch 6 items 1 and 3; canvas In development: OvIniA, OvAEdges) from the pure
|
|
2
|
+
* model pm/ini-view-model.js. The Board's panel (bd-ini-panel.js openIni) and Home's initiative page (home-ini.js iniPage) put the same
|
|
3
|
+
* markup in the Viewer's shell; only the host's chrome differs (the Board floats it with its grip, Home sets it beside the chat, the phone
|
|
4
|
+
* shows it full screen). The look is pm/ini-view.css, loaded here once.
|
|
5
|
+
*
|
|
6
|
+
* viewHtml(v, o) the body, top to bottom: the summary card (what waits on you leads, with the one primary; else the status and why;
|
|
7
|
+
* the meta line: the status when something waits, the owner, the workflow, the program), the stage card (the stage's
|
|
8
|
+
* number and name, how much of its section is done, the day clock, the ladder, the dates line that replaced the Plan
|
|
9
|
+
* card, the next stage), Tasks as the WBS (sections in workflow order), then Documents and Linked as folds.
|
|
10
|
+
* o: { add (the Tasks + icon), adding (the inline field is open), next (the next stage is a press: Home's move sheet), openTask, docs: { n, html? } | null,
|
|
11
|
+
* draft (the empty breakdown's Draft it), program (the chip opens the program), wf (the workflow on the meta line opens the Change picker) }
|
|
12
|
+
* wireView(body, h) the presses, once per body: h.check(uid, btn), h.openTask(uid), h.openTicket(key), h.add(btn) (the + icon: the host
|
|
13
|
+
* redraws with o.adding, an inline field), h.addTask(title, input), h.addCancel(), h.next(btn),
|
|
14
|
+
* h.primary(act, btn), h.program(id), h.docs(), h.doc(path) (a linked document), h.draft(btn), h.wf(btn), h.redraw() (after a fold opens or closes)
|
|
15
|
+
*
|
|
16
|
+
* Folds keep their state per initiative for the session (a section, the Later line, a WBS group, the done tasks). Icon-only presses carry
|
|
17
|
+
* their words in aria-label and title. Zero is silence: a part with nothing on record draws nothing. */
|
|
18
|
+
import { wfIcon } from './wf-model.js';
|
|
19
|
+
|
|
20
|
+
const CSS = '/pm/ini-view.css';
|
|
21
|
+
if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
|
|
22
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
|
|
23
|
+
}
|
|
24
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
25
|
+
const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
26
|
+
const P = {
|
|
27
|
+
go: 'M5 12h14M13 6l6 6-6 6', check: 'M5 12l5 5 9-10', right: 'M10 7l5 5-5 5', down: 'M7 10l5 5 5-5', plus: 'M12 5v14M5 12h14',
|
|
28
|
+
prog: 'M12 3l9 5-9 5-9-5zM3 13l9 5 9-5', doc: 'M7 3h7l5 5v13H7zM14 3v5h5', draft: 'M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8',
|
|
29
|
+
skip: 'M7 17L17 7',
|
|
30
|
+
};
|
|
31
|
+
const FOLD = new Map(); // `${id}|${key}` → true (open) | false (shut): the PM's own fold, for the session
|
|
32
|
+
const isOpen = (v, key, dflt) => { const k = (v.id || v.key) + '|' + key; return FOLD.has(k) ? FOLD.get(k) : !!dflt; };
|
|
33
|
+
|
|
34
|
+
/* ── the summary card ── */
|
|
35
|
+
function summaryHtml(s, o = {}) {
|
|
36
|
+
const dot = s.tone === 'you' ? 'you' : s.tone === 'warn' ? 'warn' : s.tone === 'ok' ? 'ok' : '';
|
|
37
|
+
const go = s.primary ? `<button type="button" class="iv-go" data-iv-primary="${esc(s.primary.act)}" aria-label="${esc(s.primary.label)}" title="${esc(s.primary.label)}">${SVG(P.go, 16, 2.2)}</button>` : '';
|
|
38
|
+
const meta = [];
|
|
39
|
+
if (s.status) meta.push(`<span class="iv-st ${esc(s.status.tone)}"><i aria-hidden="true"></i>${esc(s.status.text)}</span>`);
|
|
40
|
+
meta.push(s.owner ? `<span class="iv-who"><span class="iv-av" aria-hidden="true">${esc(s.owner.av)}</span>${esc(s.owner.name)}</span>` : '<span class="iv-who q">No owner</span>');
|
|
41
|
+
if (s.wf) meta.push(o.wf ? `<button type="button" class="iv-wf" data-iv-wf aria-haspopup="listbox" aria-label="${esc('Workflow: ' + (s.wf.name || 'Product feature') + '. Change')}" title="Change the workflow">${wfIcon(s.wf, 15)}${esc(s.wf.name || 'Product feature')}</button>`
|
|
42
|
+
: `<span class="iv-wf">${wfIcon(s.wf, 15)}${esc(s.wf.name || 'Product feature')}</span>`);
|
|
43
|
+
if (s.program) meta.push(`<button type="button" class="iv-prog" data-iv-program="${esc(s.program.id)}" title="Open the program ${esc(s.program.title)}">${SVG(P.prog, 15)}${esc(s.program.title)}</button>`);
|
|
44
|
+
if (!s.line && !s.text && !go) return '';
|
|
45
|
+
return `<section class="iv-sum" aria-label="Summary"><div class="iv-s1 ${dot}">${dot && dot !== 'ok' ? '<span class="iv-dot" aria-hidden="true"></span>' : ''}<b>${esc(s.line)}</b>`
|
|
46
|
+
+ `${s.right ? `<span class="iv-r">${esc(s.right)}</span>` : ''}${go}</div>${s.text ? `<p class="iv-why">${esc(s.text)}</p>` : ''}`
|
|
47
|
+
+ `<p class="iv-meta">${meta.join('<span class="iv-sep" aria-hidden="true">·</span>')}</p></section>`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ── the stage card, with the dates line (the old Plan card, item 3) ── */
|
|
51
|
+
function stageHtml(st, o) {
|
|
52
|
+
const right = [st.doneOf, st.day].filter(Boolean);
|
|
53
|
+
const head = `<div class="iv-sch">${st.n ? `<span class="iv-no${st.ms ? ' ms' : ''}" aria-hidden="true">${st.ms ? '' : st.n}</span>` : ''}<b>${esc(st.name)}</b>`
|
|
54
|
+
+ (right.length ? `<span class="iv-r">${st.doneOf ? esc(st.doneOf) : ''}${st.doneOf && st.day ? ' · ' : ''}${st.day ? `<span class="${st.dayOver ? 'w' : ''}">${esc(st.day)}</span>` : ''}</span>` : '') + '</div>';
|
|
55
|
+
const lad = st.ladder.length ? `<div class="iv-lad" role="img" aria-label="${esc(st.aria)}">${st.ladder.map((x) => `<i class="${[x.cls, x.ms ? 'ms' : ''].filter(Boolean).join(' ')}" title="${esc(x.name + (x.cls === 'skip' ? ' · skipped' : x.cls === 'done' ? ' · done' : x.cls === 'now' ? ' · now' : ''))}"></i>`).join('')}</div>` : '';
|
|
56
|
+
const d = st.dates;
|
|
57
|
+
const dates = d ? `<div class="iv-dl"><span>${esc(d.start)}</span><span class="e${d.over ? ' w' : ''}">${d.end ? `<b>${esc(d.end)}</b> end` : ''}${d.left ? ' · ' + esc(d.left) : ''}${d.jira ? ` · <span class="j">Jira: ${esc(d.jira)}</span>` : ''}</span></div>` : '';
|
|
58
|
+
const n = st.next;
|
|
59
|
+
const nx = n ? `<${o.next ? 'button type="button" data-iv-next' : 'div'} class="iv-nx"${o.next ? ` aria-label="${esc('Move to ' + n.name)}"` : ''}><span class="iv-nd${n.ms ? ' ms' : ''}" aria-hidden="true"></span><span class="w"><b>${esc(n.name)}</b><span>Next stage${n.moves ? ' · moves' : ''}${n.moves ? ` <i class="iv-kr">${esc(n.moves)}</i>` : ''}</span></span></${o.next ? 'button' : 'div'}>` : '';
|
|
60
|
+
return `<section class="iv-sc" aria-label="${esc('Stage · ' + st.name)}">${head}${lad}${dates}${nx}</section>`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* ── the WBS ── */
|
|
64
|
+
function taskHtml(x, o) {
|
|
65
|
+
const chk = x.canCheck ? `<button type="button" class="iv-cb${x.done ? ' on' : ''}" data-iv-check="${esc(x.uid)}" aria-pressed="${x.done}" aria-label="${esc((x.done ? 'Reopen: ' : 'Mark done: ') + x.title)}" title="${x.done ? 'Reopen' : 'Mark done'}">${x.done ? SVG(P.check, 12, 3) : ''}</button>`
|
|
66
|
+
: `<span class="iv-cb off${x.done ? ' on' : ''}" aria-hidden="true">${x.done ? SVG(P.check, 12, 3) : ''}</span>`;
|
|
67
|
+
const t = o.openTask && x.uid ? `<button type="button" class="iv-tt" data-iv-task="${esc(x.uid)}">${esc(x.title)}</button>` : `<b class="iv-tt">${esc(x.title)}</b>`;
|
|
68
|
+
return `<div class="iv-tr${x.closed ? ' done' : ''}">${chk}<span class="w">${t}${x.sub ? `<span class="${x.late ? 'w' : ''}">${esc(x.sub)}</span>` : ''}</span></div>`;
|
|
69
|
+
}
|
|
70
|
+
const chev = (open) => `<span class="iv-cv" aria-hidden="true">${SVG(open ? P.down : P.right, 15, 2)}</span>`;
|
|
71
|
+
function bodyHtml(v, sec, o) {
|
|
72
|
+
let h = sec.top.map((x) => taskHtml(x, o)).join('');
|
|
73
|
+
if (sec.jira) {
|
|
74
|
+
const byEp = new Map(); for (const k of sec.jira.open) { const e = k.epic || ''; if (!byEp.has(e)) byEp.set(e, []); byEp.get(e).push(k); }
|
|
75
|
+
const all = isOpen(v, sec.key + ':tk', false), shown = all ? sec.jira.open : sec.jira.open.slice(0, 3);
|
|
76
|
+
h += shown.map((k) => `<button type="button" class="iv-tr iv-tk" data-iv-ticket="${esc(k.key)}"><span class="iv-jq" aria-hidden="true"></span><span class="w"><b class="iv-tt"><em>${esc(k.key)}</em> ${esc(k.title)}</b><span class="${k.warn ? 'w' : ''}">${esc(k.sub)}</span></span></button>`).join('');
|
|
77
|
+
if (sec.jira.open.length > shown.length) h += `<button type="button" class="iv-more" data-iv-fold="${esc(sec.key + ':tk')}" aria-expanded="false">${esc((sec.jira.open.length - shown.length) + ' more open' + (byEp.size > 1 ? ' · by epic' : ''))}${SVG(P.right, 14, 2)}</button>`;
|
|
78
|
+
h += `<p class="iv-q">${esc(sec.jira.done + ' of ' + sec.jira.total + ' done in Jira' + (sec.jira.at ? ' · ' + sec.jira.at : ''))}</p>`;
|
|
79
|
+
}
|
|
80
|
+
if (sec.groups.length) {
|
|
81
|
+
if (sec.groups.length > 1) h += '<p class="iv-q">The rest, by work package</p>';
|
|
82
|
+
for (const g of sec.groups) {
|
|
83
|
+
const k = sec.key + ':g:' + g.key, op = isOpen(v, k, false);
|
|
84
|
+
h += `<button type="button" class="iv-grp" data-iv-fold="${esc(k)}" aria-expanded="${op}"><b>${esc(g.label)}</b><span class="n">${esc(g.n + ' open')}</span>${chev(op)}</button>`;
|
|
85
|
+
if (op) h += `<div class="iv-sub">${g.rows.map((x) => taskHtml(x, o)).join('')}</div>`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (sec.done.length) {
|
|
89
|
+
if (!sec.top.length && !sec.groups.length && !sec.jira) h += sec.done.map((x) => taskHtml(x, o)).join('');
|
|
90
|
+
else {
|
|
91
|
+
const k = sec.key + ':done', op = isOpen(v, k, false);
|
|
92
|
+
h += `<button type="button" class="iv-grp" data-iv-fold="${esc(k)}" aria-expanded="${op}"><b>Done</b><span class="n">${sec.done.length}</span>${chev(op)}</button>`;
|
|
93
|
+
if (op) h += `<div class="iv-sub">${sec.done.map((x) => taskHtml(x, o)).join('')}</div>`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return h;
|
|
97
|
+
}
|
|
98
|
+
function markOf(sec) {
|
|
99
|
+
if (sec.kind === 'past') return `<span class="iv-no ok" aria-hidden="true">${SVG(P.check, 12, 3)}</span>`;
|
|
100
|
+
if (sec.kind === 'later' || sec.kind === 'none') return '<span class="iv-no dash" aria-hidden="true"></span>';
|
|
101
|
+
if (sec.status === 'skip') return `<span class="iv-no skip" aria-hidden="true">${SVG(P.skip, 12, 2)}</span>`;
|
|
102
|
+
if (sec.status === 'done') return `<span class="iv-no ok" aria-hidden="true">${SVG(P.check, 12, 3)}</span>`;
|
|
103
|
+
if (sec.ms) return '<span class="iv-no ms" aria-hidden="true"></span>';
|
|
104
|
+
return `<span class="iv-no${sec.status === 'now' ? ' now' : ''}" aria-hidden="true">${esc(sec.n)}</span>`;
|
|
105
|
+
}
|
|
106
|
+
function sectionHtml(v, sec, o, inner) {
|
|
107
|
+
const key = 'sec:' + (sec.key || 'none'), op = isOpen(v, key, sec.open);
|
|
108
|
+
const has = sec.top.length || sec.groups.length || sec.done.length || sec.jira || (sec.stages && sec.stages.length);
|
|
109
|
+
const name = sec.label || sec.name;
|
|
110
|
+
const row = `<button type="button" class="iv-ws${sec.kind !== 'stage' && sec.kind !== 'none' ? ' mut' : ''}${inner ? ' in' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'}>${markOf(sec)}`
|
|
111
|
+
+ `<span class="w"><b>${esc(name)}</b>${sec.sub ? `<small class="${sec.subWarn ? 'w' : ''}">${esc(sec.sub)}</small>` : ''}</span>${sec.count ? `<span class="n${sec.warn ? ' w' : ''}">${esc(sec.count)}</span>` : ''}${has ? chev(op) : ''}</button>`;
|
|
112
|
+
if (!op || !has) return row;
|
|
113
|
+
// the folded lines (past stages, Later) open into their own stages, each a section of its own
|
|
114
|
+
const body = sec.stages ? sec.stages.map((s) => sectionHtml(v, s, o, true)).join('') : bodyHtml(v, sec, o);
|
|
115
|
+
return row + `<div class="iv-wl">${body}</div>`;
|
|
116
|
+
}
|
|
117
|
+
function tasksHtml(v, o) {
|
|
118
|
+
const T = v.tasks;
|
|
119
|
+
const add = o.add ? `<button type="button" class="iv-ib" data-iv-add aria-label="Add a task to ${esc(v.title)}" title="Add a task">${SVG(P.plus, 16, 2.2)}</button>` : '';
|
|
120
|
+
const head = `<div class="iv-th"><b>Tasks</b>${T.count ? `<span class="n">${esc(T.count)}</span>` : ''}${add}</div>`
|
|
121
|
+
+ (o.adding ? `<form class="iv-addf" data-iv-addform><input id="ivAddTask" type="text" maxlength="160" autocomplete="off" placeholder="A task for ${esc(v.title)}" aria-label="New task"><button type="submit" class="iv-go" aria-label="Add the task" title="Add (Enter). Esc cancels.">${SVG(P.check, 16, 2.2)}</button></form>` : '');
|
|
122
|
+
if (T.empty) {
|
|
123
|
+
const sk = T.empty.stages.map((s) => `<span class="iv-sk"><span class="iv-no dash${s.ms ? ' ms' : ''}" aria-hidden="true">${s.ms ? '' : s.n}</span>${esc(s.name)}${s.now ? ' <i>· now</i>' : ''}</span>`).join('');
|
|
124
|
+
return head + `<div class="iv-empty">${sk}<p class="iv-q">Claude drafts the breakdown, one section per stage. Nothing is saved until you keep it.</p>`
|
|
125
|
+
+ (o.draft ? `<button type="button" class="iv-pbtn" data-iv-draft>${SVG(P.draft, 16, 2)}Draft it</button>` : '') + '</div>';
|
|
126
|
+
}
|
|
127
|
+
return head + `<div class="iv-wbs">${T.sections.map((s) => sectionHtml(v, s, o)).join('')}</div>`;
|
|
128
|
+
}
|
|
129
|
+
function foldsHtml(v, o) {
|
|
130
|
+
const rows = [];
|
|
131
|
+
if (o.docs && o.docs.n) {
|
|
132
|
+
const op = o.docs.html ? isOpen(v, 'docs', false) : false;
|
|
133
|
+
rows.push(`<button type="button" class="iv-fr" ${o.docs.html ? `data-iv-fold="docs" aria-expanded="${op}"` : 'data-iv-docs'}><b>Documents</b><span class="n">${o.docs.n}</span>${chev(op)}</button>` + (op ? `<div class="iv-fb">${o.docs.html}</div>` : ''));
|
|
134
|
+
}
|
|
135
|
+
const L = v.linked || [];
|
|
136
|
+
if (L.length) {
|
|
137
|
+
const op = isOpen(v, 'linked', false);
|
|
138
|
+
const chip = (x) => (x.kind === 'doc' ? `<button type="button" class="iv-chip" data-iv-doc="${esc(x.path)}" title="${esc(x.path)}">${esc(x.label)}</button>` : `<span class="iv-chip"${x.title ? ` title="${esc(x.title)}"` : ''}>${esc(x.label)}</span>`);
|
|
139
|
+
rows.push(`<button type="button" class="iv-fr" data-iv-fold="linked" aria-expanded="${op}"><b>Linked</b><span class="n">${L.length}</span>${chev(op)}</button>` + (op ? `<div class="iv-fb iv-chips">${L.map(chip).join('')}</div>` : ''));
|
|
140
|
+
}
|
|
141
|
+
return rows.length ? `<div class="iv-folds">${rows.join('')}</div>` : '';
|
|
142
|
+
}
|
|
143
|
+
export function viewHtml(v, o = {}) {
|
|
144
|
+
return `<div class="iv" data-iv="${esc(v.id || v.key || '')}">${summaryHtml(v.summary, o)}${stageHtml(v.stage, o)}${tasksHtml(v, o)}${foldsHtml(v, o)}${o.tail || ''}</div>`;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* ── the presses ── */
|
|
148
|
+
export function wireView(body, h) {
|
|
149
|
+
if (!body) return;
|
|
150
|
+
body.__iv = h;
|
|
151
|
+
if (body.__ivWired) return;
|
|
152
|
+
body.__ivWired = true;
|
|
153
|
+
body.addEventListener('click', (e) => {
|
|
154
|
+
const H = body.__iv || {}, b = e.target.closest('button, a'); if (!b || !body.contains(b)) return;
|
|
155
|
+
const root = b.closest('[data-iv]'); if (!root) return;
|
|
156
|
+
const id = root.dataset.iv;
|
|
157
|
+
const d = b.dataset;
|
|
158
|
+
if (d.ivFold) { e.preventDefault(); const k = id + '|' + d.ivFold; FOLD.set(k, b.getAttribute('aria-expanded') !== 'true'); if (H.redraw) H.redraw(); return; }
|
|
159
|
+
if (d.ivCheck && H.check) { e.preventDefault(); H.check(d.ivCheck, b); return; }
|
|
160
|
+
if (d.ivTask && H.openTask) { e.preventDefault(); H.openTask(d.ivTask, b); return; }
|
|
161
|
+
if (d.ivTicket && H.openTicket) { e.preventDefault(); H.openTicket(d.ivTicket, b); return; }
|
|
162
|
+
if ('ivAdd' in d && H.add) { e.preventDefault(); H.add(b); return; }
|
|
163
|
+
if ('ivNext' in d && H.next) { e.preventDefault(); H.next(b); return; }
|
|
164
|
+
if (d.ivPrimary && H.primary) { e.preventDefault(); H.primary(d.ivPrimary, b); return; }
|
|
165
|
+
if ('ivWf' in d && H.wf) { e.preventDefault(); H.wf(b); return; }
|
|
166
|
+
if (d.ivProgram && H.program) { e.preventDefault(); H.program(d.ivProgram, b); return; }
|
|
167
|
+
if (d.ivDoc && H.doc) { e.preventDefault(); H.doc(d.ivDoc, b); return; }
|
|
168
|
+
if ('ivDocs' in d && H.docs) { e.preventDefault(); H.docs(b); return; }
|
|
169
|
+
if ('ivDraft' in d && H.draft) { e.preventDefault(); H.draft(b); }
|
|
170
|
+
});
|
|
171
|
+
// the inline add (the Tasks + icon): Enter adds, Esc puts the + back
|
|
172
|
+
body.addEventListener('submit', (e) => {
|
|
173
|
+
const f = e.target.closest('[data-iv-addform]'); if (!f) return;
|
|
174
|
+
e.preventDefault(); const H = body.__iv || {}, inp = f.querySelector('input'), t = inp ? inp.value.trim() : '';
|
|
175
|
+
if (t && H.addTask) H.addTask(t, inp);
|
|
176
|
+
});
|
|
177
|
+
body.addEventListener('keydown', (e) => { if (e.key === 'Escape' && e.target.id === 'ivAddTask') { e.stopPropagation(); const H = body.__iv || {}; if (H.addCancel) H.addCancel(); } });
|
|
178
|
+
}
|
|
179
|
+
/** For the tests: forget every fold the PM opened or shut. */
|
|
180
|
+
export const resetFolds = () => FOLD.clear();
|