create-pmos 0.611.0 → 0.613.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 +105 -27
- 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-board-test.js +1 -1
- package/workspace/briefing-premium-calendar-2-test.js +3 -2
- package/workspace/briefing-premium-calendar-3-test.js +1 -1
- package/workspace/briefing-premium-calendar-test.js +1 -1
- package/workspace/briefing-premium-insights-test.js +1 -1
- package/workspace/briefing-premium-test.js +1 -1
- package/workspace/changelog.json +104 -0
- package/workspace/guide/layout.md +52 -18
- package/workspace/guide/programs.md +3 -3
- package/workspace/guide/routine.md +28 -13
- package/workspace/guide/settings-and-switches.md +1 -1
- package/workspace/lib/board-premium.js +12 -4
- package/workspace/lib/cos-chat.js +1 -0
- package/workspace/lib/doc-library.js +43 -12
- package/workspace/lib/doc-path.js +30 -0
- package/workspace/lib/engine/boards.js +4 -2
- package/workspace/lib/events-place.js +190 -38
- package/workspace/lib/events-stated.js +129 -0
- package/workspace/lib/initiative-chat.js +1 -0
- package/workspace/lib/insights-premium.js +13 -1
- package/workspace/lib/library-find.js +162 -0
- package/workspace/lib/library-items.js +196 -24
- package/workspace/lib/notes.js +3 -0
- package/workspace/lib/plan-items.js +17 -3
- package/workspace/lib/routes-artefacts.js +5 -2
- package/workspace/lib/routes-boards.js +6 -2
- package/workspace/lib/routes-doc-sheet.js +1 -0
- package/workspace/lib/routes-events-place.js +47 -10
- package/workspace/lib/routes-library.js +74 -8
- package/workspace/lib/routes-report-setups.js +13 -2
- package/workspace/lib/routine-reports.js +36 -4
- package/workspace/lib/status-when.js +36 -0
- package/workspace/lib/task-items.js +5 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-meet-test.js +2 -1
- package/workspace/premium-vw-notes-test.js +3 -2
- package/workspace/public/pm/artefact-kind.js +87 -0
- package/workspace/public/pm/bd-ini-panel.js +6 -6
- package/workspace/public/pm/bd-span.js +7 -1
- package/workspace/public/pm/bd-work.css +62 -0
- package/workspace/public/pm/bd-work.js +195 -68
- package/workspace/public/pm/cozy-bar.css +11 -0
- package/workspace/public/pm/cozy-bar.js +99 -0
- package/workspace/public/pm/cozy-day-pick.css +27 -0
- package/workspace/public/pm/cozy-day-pick.js +97 -0
- package/workspace/public/pm/cozy-ev.css +0 -4
- package/workspace/public/pm/cozy-events-view.js +165 -33
- package/workspace/public/pm/cozy-events.css +75 -3
- package/workspace/public/pm/cozy-events.js +86 -18
- package/workspace/public/pm/cozy-goals.css +172 -0
- package/workspace/public/pm/cozy-library.css +106 -17
- package/workspace/public/pm/cozy-nav.js +2 -3
- package/workspace/public/pm/cozy-pick.css +3 -0
- package/workspace/public/pm/cozy-pop-work.css +83 -24
- package/workspace/public/pm/cozy-pop-work.js +313 -72
- package/workspace/public/pm/cozy-popup.css +11 -2
- package/workspace/public/pm/cozy-popup.js +67 -9
- package/workspace/public/pm/cozy-routine-job.js +203 -0
- package/workspace/public/pm/cozy-routine-model.js +139 -31
- package/workspace/public/pm/cozy-routine-pop.js +164 -42
- package/workspace/public/pm/cozy-routine.css +61 -8
- package/workspace/public/pm/cozy-routine.js +207 -28
- package/workspace/public/pm/cozy-settings.js +1 -5
- package/workspace/public/pm/cozy-status-when.js +48 -0
- package/workspace/public/pm/cozy-viewer.js +19 -8
- package/workspace/public/pm/cozy-vw-mtg.css +39 -0
- package/workspace/public/pm/goals-model.js +205 -0
- package/workspace/public/pm/goals-open.js +124 -0
- package/workspace/public/pm/home-chat.js +4 -2
- package/workspace/public/pm/home-ini.js +8 -6
- package/workspace/public/pm/ini-edit.js +3 -1
- package/workspace/public/pm/ini-view-model.js +1 -1
- package/workspace/public/pm/library-model.js +170 -42
- package/workspace/public/pm/library-open.js +8 -5
- package/workspace/public/pm/page-chat.js +12 -2
- package/workspace/public/pm/pop-work-model.js +199 -41
- package/workspace/public/pm/premium-board.js +108 -43
- package/workspace/public/pm/premium-goals.js +213 -0
- package/workspace/public/pm/premium-library.js +376 -62
- package/workspace/public/pm/premium-shell.js +1 -1
- package/workspace/public/pm/premium-vw-mtg.js +79 -1
- package/workspace/public/pm/scope-chip.js +207 -0
- package/workspace/public/premium-events.html +3 -1
- package/workspace/public/premium-goals.html +37 -0
- package/workspace/public/premium-library.html +15 -7
- package/workspace/public/premium-routine.html +2 -0
- package/workspace/server.js +2 -1
- package/workspace/test-lists/doc-path.json +9 -0
- package/workspace/test-lists/goals-place.json +9 -0
- package/workspace/test-lists/status-when.json +9 -0
|
@@ -77,7 +77,7 @@ async function readPage(r, force) {
|
|
|
77
77
|
/** Documents, as a drill-in of the view (Home's page opens its Documents view): each core document with its state; a press opens it. */
|
|
78
78
|
function openDocs(r) {
|
|
79
79
|
const L = ((PAGE.get(r.id) || {}).docs) || [];
|
|
80
|
-
const rows = L.map((d) => `<button type="button" class="czs-it"${d.path ? ` data-doc="${esc(d.path)}"` : ' disabled'} aria-label="${d.path ? 'Open ' : ''}${esc(d.title)}"><span class="w">${esc(d.title)}<span>${esc([d.when, d.by, MD.docPill(d)[0]].filter(Boolean).join(' · '))}</span></span>${d.look ? '<span class="czs-amb" role="img" aria-label="Needs a look"></span>' : ''}</button>`).join('');
|
|
80
|
+
const rows = L.map((d) => `<button type="button" class="czs-it"${d.path ? ` data-doc="${esc(d.path)}"${r.ws ? ` data-doc-ws="${esc(r.ws)}"` : ''}` : ' disabled'} aria-label="${d.path ? 'Open ' : ''}${esc(d.title)}"><span class="w">${esc(d.title)}<span>${esc([d.when, d.by, MD.docPill(d)[0]].filter(Boolean).join(' · '))}</span></span>${d.look ? '<span class="czs-amb" role="img" aria-label="Needs a look"></span>' : ''}</button>`).join('');
|
|
81
81
|
VW.drill();
|
|
82
82
|
VW.open({ kind: 'Documents', title: r.title, icon: 'doc', back: true, id: 'docs:' + vidOf(r), html: `<div class="hi-v">${rows || '<p class="hi-small">No document is on record yet.</p>'}</div>` });
|
|
83
83
|
}
|
|
@@ -200,7 +200,7 @@ function iniBody(r, body) {
|
|
|
200
200
|
/** What pm/cozy-pop-work.js reads for the row: the Board's steps and day, the core documents, the product and the program. */
|
|
201
201
|
function popOpts(r) {
|
|
202
202
|
const M = O.M() || {}, B = M.board || {}, p = O.programOf ? O.programOf(r) : null;
|
|
203
|
-
return { steps: M.steps || [], today: M.today, docs: ((r.id && PAGE.get(r.id)) || {}).docs || [], product: r.wsName || (r.ws && r.ws !== B.ws ? r.ws : (M.product && M.product.name) || B.name || B.ws) || '', program: p ? { id: p.id, title: p.title } : null, canProduct: true, ws: r.ws || B.ws || '', id: r.id || '' };
|
|
203
|
+
return { steps: M.steps || [], today: M.today, docs: ((r.id && PAGE.get(r.id)) || {}).docs || [], product: r.wsName || (r.ws && r.ws !== B.ws ? r.ws : (M.product && M.product.name) || B.name || B.ws) || '', program: p ? { id: p.id, title: p.title } : null, canProduct: true, ws: r.ws || B.ws || '', board: r.boardId || B.id || '', id: r.id || '' };
|
|
204
204
|
}
|
|
205
205
|
/** The popup's own presses for the row: every part of the old page as a drill-in (so nothing is lost), and everything PMOS suggests. */
|
|
206
206
|
function popExtra(r) {
|
|
@@ -262,7 +262,7 @@ function wire(body, key) {
|
|
|
262
262
|
toast: (m, undo) => (O.toast ? O.toast(m, undo) : null),
|
|
263
263
|
check: (uid, b) => { const r = O.rowOf(key), k = r && (r.tasks || []).find((x) => x.uid === uid); if (r && O.setTask) O.setTask(r, uid, k && k.status === 'Done' ? 'To do' : 'Done'); },
|
|
264
264
|
// the quick changes (batch 9 item 5b): the status caret, the date press and a Timeline or Kanban drag, each with Undo in the toast
|
|
265
|
-
status: (uid, state) => { const r = O.rowOf(key); if (r && O.setTask) O.setTask(r, uid, state); },
|
|
265
|
+
status: (uid, state, w) => { const r = O.rowOf(key); if (r && O.setTask) O.setTask(r, uid, state, w); },
|
|
266
266
|
dates: (uid, patch) => { const r = O.rowOf(key); if (r && O.setDates) O.setDates(r, uid, patch); },
|
|
267
267
|
// the ◇ in the status picker (batch 11 item 3): a task made a milestone, or made a plain task again, with Undo
|
|
268
268
|
milestone: (uid, on) => { const r = O.rowOf(key); if (r && O.setDates) O.setDates(r, uid, { milestone: !!on }); },
|
|
@@ -281,7 +281,7 @@ function wire(body, key) {
|
|
|
281
281
|
const r = O.rowOf(key); if (!r) return;
|
|
282
282
|
if (act === 'grill') O.grillOpen(r, b);
|
|
283
283
|
else if (act === 'commit') O.send(r); // the Commit of drafted tickets opens the Send sheet (tk-send.js), the one path to Jira
|
|
284
|
-
else if (act.startsWith('doc:')) O.viewDoc(act.slice(4));
|
|
284
|
+
else if (act.startsWith('doc:')) O.viewDoc(act.slice(4), (O.rowOf(key) || {}).ws);
|
|
285
285
|
else if (act === 'page' && r.id) location.assign(O.pageHref(r));
|
|
286
286
|
},
|
|
287
287
|
program: (id, b) => { if (O.openProgram) O.openProgram(id, b); },
|
|
@@ -296,7 +296,7 @@ function wire(body, key) {
|
|
|
296
296
|
// Claude's split or merge card (batch 11 item 14): ✕ Not now, ✎ Change it first, ✓ as suggested; the merged summary's link opens the one that stays
|
|
297
297
|
sm: (act, b) => { const r = O.rowOf(key); if (r && O.smPress) O.smPress(r, act, b); },
|
|
298
298
|
openIni: (id) => { if (O.openIniId) O.openIniId(id); },
|
|
299
|
-
doc: (path) => O.viewDoc(path),
|
|
299
|
+
doc: (path) => O.viewDoc(path, (O.rowOf(key) || {}).ws), // the initiative's own workspace, not the board's (round 3 point 17)
|
|
300
300
|
redraw,
|
|
301
301
|
};
|
|
302
302
|
// in the popup: what the popup shows for work (pm/cozy-pop-work.js), with the same handlers; else the old page
|
|
@@ -311,7 +311,7 @@ function wire(body, key) {
|
|
|
311
311
|
const a = e.target.closest('[data-czs-act], [data-xb]'); if (!a) return;
|
|
312
312
|
const act = a.dataset.czsAct || a.dataset.xb;
|
|
313
313
|
if (act === 'drift') location.assign(O.askHref(r, a.dataset.q || ''));
|
|
314
|
-
else if (act.startsWith('doc:')) O.viewDoc(act.slice(4));
|
|
314
|
+
else if (act.startsWith('doc:')) O.viewDoc(act.slice(4), (O.rowOf(key) || {}).ws);
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
/** The shell's id of an initiative: its record id, so Discuss in chat names it (?about=init:<id>&vid=<id>) and Home reopens it beside the chat. */
|
|
@@ -217,6 +217,11 @@ const slipWords = (r, e) => { const p = r.plan, b = p && day(p.end), n = p && p.
|
|
|
217
217
|
|
|
218
218
|
/** One initiative's marks: the plan cut by its gaps and holds, the forecast past the plan, the shown milestones, the end ◇ and one label after the
|
|
219
219
|
* furthest mark. */
|
|
220
|
+
/** One initiative's bar as the Board draws it, for another page's own timeline: Work's list (pm/bd-work.js) and the popup's Work breakdown
|
|
221
|
+
* (pm/cozy-pop-work.js), so the bar has one design everywhere (Wawan, 2026-11-19). X: a date → its percent of the box; the markup sits in a
|
|
222
|
+
* position:relative box of the row's height. o: { pxPct: px per 1 % of the box, reach: days in which ◇s merge, mode: 'all' | 'pinned',
|
|
223
|
+
* label: false drops the end label, phone } → html */
|
|
224
|
+
export const rowBar = (r, X, now, o = {}) => qBar(r, X, now, !!o.phone, md, o.pxPct || 0, { reach: o.reach || 7, mode: o.mode || 'all', noLabel: o.label === false });
|
|
220
225
|
function qBar(r, X, now, phone, fmt, pxPct, ms = {}) {
|
|
221
226
|
const s = day(r.start), e = day(r.end), fr = fcRange(r), fc = r.forecast ? null : r.track && day(r.track.forecast), tone = toneOf(r);
|
|
222
227
|
const tm = taskMarks(r, X, now, phone, pxPct, ms), et = tm.end, note = markWords(r, now);
|
|
@@ -251,7 +256,8 @@ function qBar(r, X, now, phone, fmt, pxPct, ms = {}) {
|
|
|
251
256
|
out += `<span class="tg-fc solo" style="left:${P(X(fc))};width:12px;margin-left:-12px" title="Jira forecast ${esc(md(fc))}"></span>` + endLabel(X(fc), 'Jira forecast', fc, '', now, pxPct, [], '');
|
|
252
257
|
} else if (r.draft && day(r.draft.start)) {
|
|
253
258
|
out += draftBar(r, X, phone, fmt, now, pxPct);
|
|
254
|
-
} else {
|
|
259
|
+
} else if (s || e) {
|
|
260
|
+
// a row with no start and no end (Work lists undated rows too) draws no ◇ here
|
|
255
261
|
const d = s || e;
|
|
256
262
|
out += `<button type="button" class="tg-end" data-ms-pick="${esc(r.key)}" data-ms-id="" style="left:${P(X(d))}" aria-haspopup="dialog" aria-label="${esc((s ? 'Starts ' : 'Ends ') + md(d) + '. Milestones of ' + r.title)}" title="${s ? 'Starts' : 'Ends'} ${esc(md(d))}"></button>` + (e && !ms.noLabel && landsOf(r, et) ? endLabel(X(d), landsOf(r, et), d, risk, now, pxPct, [], '') : '');
|
|
257
263
|
}
|
|
@@ -128,3 +128,65 @@ body.bd-page.wk-on .bd-hd .bd-tools { margin-left: auto; }
|
|
|
128
128
|
.wk-stm button:hover, .wk-stm button:focus-visible { background: var(--cz-well); }
|
|
129
129
|
.wk-stm button.on { font-weight: var(--fw-strong); background: var(--cz-well); }
|
|
130
130
|
.wk-stm button.on::after { content: '✓'; color: var(--cz-ink2); }
|
|
131
|
+
/* Work's rows in the shell's ⋯ menu (board 5 keeps them out of the view menu): a count or "on" sits at the right, small and grey */
|
|
132
|
+
.crmenu > .wk-xo .k { margin-left: auto; padding-left: 16px; font-size: var(--fs-meta); font-weight: var(--fw-regular); color: var(--cz-ink3); }
|
|
133
|
+
/* round 2 (Wawan, 2026-11-19): the Board's own bar sits in Work's track; the key says what it draws; the closed ones fold into one line */
|
|
134
|
+
.wk-x .tg-bar { cursor: pointer; }
|
|
135
|
+
.wk-key .k { width: 14px; height: 7px; border-radius: 3px; }
|
|
136
|
+
.wk-key .k.dn { background: var(--bd-done); }
|
|
137
|
+
.wk-key .k.nw { background: var(--cz-blue); }
|
|
138
|
+
.wk-key .k.pl { background: var(--bd-plan); }
|
|
139
|
+
.wk-key .k.dlv { width: 8px; height: 8px; transform: rotate(45deg); border-radius: 2px; border: 2px solid var(--bd-done); background: var(--cz-card); }
|
|
140
|
+
.wk-fold { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink2); border-radius: 6px; }
|
|
141
|
+
.wk-fold svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; transform: rotate(-90deg); transition: transform .15s; }
|
|
142
|
+
.wk-fold[aria-expanded="true"] svg { transform: none; }
|
|
143
|
+
.wk-fold:hover { color: var(--cz-ink); }
|
|
144
|
+
.wk-fold:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
145
|
+
/* round 3 (Wawan, 2026-11-19): Filter, Sort, View and Columns in one calm panel of about 360 px; pills with their counts; several at once */
|
|
146
|
+
.wk-menu { width: 352px; padding: 6px 16px 12px; }
|
|
147
|
+
.wk-menu section { padding: 12px 0 4px; box-shadow: inset 0 -1px 0 var(--cz-hair); }
|
|
148
|
+
.wk-menu section:last-of-type { box-shadow: none; }
|
|
149
|
+
.wk-menu h6 { display: flex; align-items: baseline; gap: 6px; margin: 0 0 10px; text-transform: none; }
|
|
150
|
+
.wk-menu h6 small { font-size: var(--fs-meta); font-weight: var(--fw-regular); color: var(--cz-ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
|
|
151
|
+
.wk-menu h6 .wk-lk { margin-left: auto; }
|
|
152
|
+
.wk-fg { margin: 0 0 10px; }
|
|
153
|
+
.wk-fl { display: block; margin: 0 0 6px; font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
154
|
+
.wk-menu .wk-pl { gap: 6px; margin: 0; }
|
|
155
|
+
.wk-menu .wk-pl button { height: 28px; padding: 0 11px; gap: 6px; font-size: var(--fs-label); }
|
|
156
|
+
.wk-menu .wk-pl button small { font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
157
|
+
.wk-menu .wk-pl button.on small { color: inherit; opacity: .7; }
|
|
158
|
+
.wk-menu .wk-pl button:hover:not(.on) { background: var(--cz-well2); color: var(--cz-ink); }
|
|
159
|
+
.wk-menu .wk-pl .wk-mo { background: none; color: var(--cz-blue); padding: 0 6px; }
|
|
160
|
+
.wk-sorts { margin-bottom: 10px; }
|
|
161
|
+
.wk-sk { display: inline-flex; align-items: center; border-radius: 999px; background: var(--cz-ink); }
|
|
162
|
+
.wk-menu .wk-pl .wk-sk button.on { padding-right: 6px; }
|
|
163
|
+
.wk-menu .wk-pl .wk-sk b { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--cz-card); color: var(--cz-ink); font-size: var(--fs-badge); }
|
|
164
|
+
.wk-menu .wk-pl .wk-sk .x { height: 28px; width: 26px; padding: 0; justify-content: center; background: none; color: var(--cz-card); opacity: .7; }
|
|
165
|
+
.wk-menu .wk-pl .wk-sk .x:hover { opacity: 1; background: none; }
|
|
166
|
+
.wk-sk svg, .wk-cx svg, .wk-fold svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
167
|
+
.wk-sar { display: inline-flex; }
|
|
168
|
+
.wk-sar svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; transform: rotate(180deg); }
|
|
169
|
+
.wk-sar.dn svg { transform: none; }
|
|
170
|
+
.wk-hd .wk-sar svg { width: 12px; height: 12px; }
|
|
171
|
+
.wk-sk .x svg { width: 11px; height: 11px; }
|
|
172
|
+
.wk-menu .wk-tlr { margin: 0 0 10px; height: 36px; }
|
|
173
|
+
.wk-cx { all: unset; cursor: pointer; box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; font-size: var(--fs-meta); font-weight: var(--fw-strong); color: var(--cz-ink3); border-radius: 8px; }
|
|
174
|
+
.wk-cx small { font-weight: var(--fw-regular); }
|
|
175
|
+
.wk-cx svg { width: 12px; height: 12px; margin-left: auto; transform: rotate(-90deg); }
|
|
176
|
+
.wk-cx[aria-expanded="true"] svg { transform: none; }
|
|
177
|
+
.wk-cx:hover { color: var(--cz-ink); }
|
|
178
|
+
.wk-cx:focus-visible, .wk-lk:focus-visible, .wk-sa:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
179
|
+
.wk-note { margin: 2px 0 10px; font-size: var(--fs-meta); color: var(--cz-ink3); line-height: var(--lh-meta); }
|
|
180
|
+
.wk-lk, .wk-sa { all: unset; cursor: pointer; font-size: var(--fs-meta); font-weight: var(--fw-strong); color: var(--cz-blue); border-radius: 4px; }
|
|
181
|
+
.wk-ft { min-height: 24px; }
|
|
182
|
+
.wk-showing { display: flex; align-items: baseline; gap: 6px; margin: 0 4px 10px; font-size: var(--fs-label); color: var(--cz-ink2); }
|
|
183
|
+
.wk-showing .q { color: var(--cz-ink3); }
|
|
184
|
+
.wk-showing .wk-sa { font-size: var(--fs-label); }
|
|
185
|
+
.wk-fc { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box; border-radius: 999px; background: var(--cz-blue); color: var(--cz-card); font-size: var(--fs-badge); font-weight: var(--fw-strong); font-style: normal; line-height: 16px; text-align: center; pointer-events: none; }
|
|
186
|
+
body.bd-page.wk-on [id="bdFilter"] { position: relative; }
|
|
187
|
+
.wk-empty { margin: 0; padding: 18px 16px; font-size: var(--fs-row); color: var(--cz-ink3); background: var(--cz-card); }
|
|
188
|
+
.wk-menu { max-height: calc(100vh - 24px); overscroll-behavior: contain; }
|
|
189
|
+
.wk-menu section:first-child h6 { position: sticky; top: -12px; z-index: 2; margin: -12px -16px 10px; padding: 12px 16px 8px; background: var(--cz-card); }
|
|
190
|
+
.wk-menu .wk-pl button.q:not(.on) { color: var(--cz-ink3); background: none; box-shadow: inset 0 0 0 1px var(--cz-hair); }
|
|
191
|
+
.wk-menu .wk-pl button em { font-style: normal; color: var(--cz-ink3); }
|
|
192
|
+
.wk-menu .wk-pl button.on em { color: inherit; opacity: .7; }
|
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
* One list of initiatives with the timeline on its right. No List / By stage / Track / Timeline tabs.
|
|
3
3
|
* · Columns, in one order: Initiative, Product, Stage, Next milestone, Date. Status, Program, Goal and Workflow can be shown. Initiative
|
|
4
4
|
* always shows. One text size, one row height; only the initiative name is bold.
|
|
5
|
-
* · Next milestone is the real milestone name; with none
|
|
5
|
+
* · Next milestone is the real milestone name; with none the cell is empty (never "Plan end", never a stage name), and Date is the plan end.
|
|
6
6
|
* · Only a late or at-risk date has colour: "4 Nov · 14 days late", "27 Nov · at risk". A closed initiative is never late.
|
|
7
|
-
* · The bar
|
|
8
|
-
*
|
|
9
|
-
* with its date
|
|
7
|
+
* · The bar is the Board's own (Wawan, 2026-11-19, round 2; pm/bd-span.js rowBar, given by the page): done, now in blue, planned, every
|
|
8
|
+
* milestone ◇ with its popup, the gap line, the late line to today. A press on the bar opens the stage card (board 4): each stage of the
|
|
9
|
+
* row's own workflow with its date, and nothing where it has none. Nothing shows on a hover but the bar's own tooltip. PMOS does not invent a date.
|
|
10
|
+
* · Closed and completed initiatives fold into one last line, "11 closed", that opens them.
|
|
10
11
|
* · The span chooser sits on the timeline header beside the hide button: Quarter, Half, Year, 2 yr, 5 yr, Full (the default).
|
|
11
12
|
* · The view menu (board 5): Group by pills, the Timeline switch, the Columns with a switch each and drag to order, "PMOS remembers this"
|
|
12
|
-
* and Reset. The view is kept in this browser (localStorage pmos.work.view).
|
|
13
|
+
* and Reset. The view is kept in this browser (localStorage pmos.work.view.2).
|
|
13
14
|
* · More than one product: the groups are the goals of all of them, and the Product column tells the rows apart; with one product the
|
|
14
15
|
* Product column hides by itself.
|
|
15
16
|
* The parts that decide (nextOf, dateOf, colsShown, groupsOf, windowOf, stagesOf) are pure and tested in work-view.test.js. The markup has no
|
|
16
|
-
* handlers: pm/premium-board.js wires the presses (
|
|
17
|
+
* handlers: pm/premium-board.js wires the presses (pressOf and apply say what a press means; wireDrag does the menu's drag). */
|
|
17
18
|
import { stageOfRow, stagesOfRow, wfOf, catOfRow, posOf } from './bd-wf.js';
|
|
18
19
|
import { stageName as oneStageName } from './stage-chip.js';
|
|
19
20
|
|
|
@@ -25,10 +26,10 @@ const DAY = 864e5;
|
|
|
25
26
|
/* ── the columns ─────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
26
27
|
/** Every column but Initiative, in its usual order, with its width in px. on: shown by default. */
|
|
27
28
|
export const COLS = [
|
|
28
|
-
{ k: 'product', n: 'Product', w:
|
|
29
|
-
{ k: 'stage', n: 'Stage', w:
|
|
30
|
-
{ k: 'ms', n: 'Next milestone', w:
|
|
31
|
-
{ k: 'date', n: 'Date', w:
|
|
29
|
+
{ k: 'product', n: 'Product', w: 112, on: true },
|
|
30
|
+
{ k: 'stage', n: 'Stage', w: 160, on: true },
|
|
31
|
+
{ k: 'ms', n: 'Next milestone', w: 160, on: true },
|
|
32
|
+
{ k: 'date', n: 'Date', w: 152, on: true },
|
|
32
33
|
{ k: 'status', n: 'Status', w: 104, on: false },
|
|
33
34
|
{ k: 'program', n: 'Program', w: 150, on: false },
|
|
34
35
|
{ k: 'goal', n: 'Goal', w: 170, on: false },
|
|
@@ -37,10 +38,10 @@ export const COLS = [
|
|
|
37
38
|
const byK = Object.fromEntries(COLS.map((c) => [c.k, c]));
|
|
38
39
|
export const GROUPS = [['goal', 'Goal'], ['product', 'Product'], ['stage', 'Stage'], ['status', 'Status'], ['program', 'Program'], ['none', 'No groups']];
|
|
39
40
|
export const SPANS = [['quarter', 'Quarter', 91], ['half', 'Half', 182], ['year', 'Year', 365], ['y2', '2 yr', 730], ['y5', '5 yr', 1826], ['full', 'Full', 0]];
|
|
40
|
-
export const KEY = 'pmos.work.view';
|
|
41
|
+
export const KEY = 'pmos.work.view.2'; // .2 (round 2, 2026-11-19): every kept view starts again from the usual one, so Date is back
|
|
41
42
|
|
|
42
43
|
/** The usual view: grouped by goal, the timeline on, the default columns in their order, Full. */
|
|
43
|
-
export const usual = () => ({ group: 'goal', tl: true, span: 'full', cols: COLS.map((c) => ({ k: c.k, on: c.on })) });
|
|
44
|
+
export const usual = () => ({ group: 'goal', tl: true, span: 'full', cols: COLS.map((c) => ({ k: c.k, on: c.on })), sorts: [] });
|
|
44
45
|
|
|
45
46
|
/** The view as kept, mended: an unknown key falls back to the usual one, a column missing from a kept list is added off at the end. */
|
|
46
47
|
export function mend(v) {
|
|
@@ -54,6 +55,7 @@ export function mend(v) {
|
|
|
54
55
|
tl: v.tl !== false,
|
|
55
56
|
span: SPANS.some(([k]) => k === v.span) ? v.span : u.span,
|
|
56
57
|
cols: cols.length ? cols : u.cols,
|
|
58
|
+
sorts: (Array.isArray(v.sorts) ? v.sorts : []).filter((x) => x && (x.k === 'title' || byK[x.k])).filter((x, i, a) => a.findIndex((y) => y.k === x.k) === i).slice(0, 3).map((x) => ({ k: x.k, up: x.up !== false })),
|
|
57
59
|
};
|
|
58
60
|
}
|
|
59
61
|
let mem = null;
|
|
@@ -100,7 +102,7 @@ export function nextOf(r) {
|
|
|
100
102
|
const M = (r.milestones || []).filter((m) => m && !m.done && day(m.date)).sort((a, b) => day(a.date) - day(b.date));
|
|
101
103
|
if (M.length) return { name: String(M[0].name || 'Milestone'), d: day(M[0].date), plan: false };
|
|
102
104
|
const e = day(r.end);
|
|
103
|
-
return e ? { name: '
|
|
105
|
+
return e ? { name: '', d: e, plan: true } : null; // the plan's end: its date is the Date cell's, but it is not a milestone the PM named
|
|
104
106
|
}
|
|
105
107
|
/** The Date cell: the date, and its tone only when late or at risk ("14 days late", "at risk"). A closed initiative is never late. */
|
|
106
108
|
export function dateOf(r, now = new Date()) {
|
|
@@ -155,15 +157,36 @@ export function groupsOf(rows, by, o = {}) {
|
|
|
155
157
|
return G.length === 1 && G[0].empty ? null : G;
|
|
156
158
|
}
|
|
157
159
|
|
|
158
|
-
/* ── sort:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
export const
|
|
160
|
+
/* ── sort (round 3, Wawan: "user can do multiple sort and filter right from the same popup"): up to three keys, kept with the view. None is
|
|
161
|
+
* "PMOS order", what needs the PM first (the page's own order). A column title makes its column the one key, then turns it round, then
|
|
162
|
+
* gives PMOS order back. In the menu a pill adds a key after the others; pressed again it turns round; its × takes it out. ── */
|
|
163
|
+
export const MAX_SORTS = 3;
|
|
164
|
+
export const sorted = () => (read().sorts[0] || {}).k || null;
|
|
165
|
+
export const sortsOf = () => read().sorts;
|
|
166
|
+
/** The column title's press: the one key, then the other way, then PMOS order. */
|
|
167
|
+
export function setSort(k) {
|
|
168
|
+
if (k !== 'title' && !byK[k]) return write({ ...read(), sorts: [] });
|
|
169
|
+
const S = read().sorts, one = S.length === 1 && S[0].k === k;
|
|
170
|
+
return write({ ...read(), sorts: one ? (S[0].up ? [{ k, up: false }] : []) : [{ k, up: true }] });
|
|
171
|
+
}
|
|
172
|
+
/** The menu's pill: a new key goes after the others (the third is replaced when there are three); a key in use turns round. */
|
|
173
|
+
export function addSort(k) {
|
|
174
|
+
if (k !== 'title' && !byK[k]) return read();
|
|
175
|
+
const S = read().sorts.slice(), i = S.findIndex((x) => x.k === k);
|
|
176
|
+
if (i >= 0) S[i] = { k, up: !S[i].up }; else { if (S.length >= MAX_SORTS) S.pop(); S.push({ k, up: true }); }
|
|
177
|
+
return write({ ...read(), sorts: S });
|
|
178
|
+
}
|
|
179
|
+
export const dropSort = (k) => write({ ...read(), sorts: read().sorts.filter((x) => x.k !== k) });
|
|
180
|
+
export const SORT_KEYS = [['title', 'Initiative'], ['stage', 'Stage'], ['date', 'Date'], ['ms', 'Next milestone'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program']];
|
|
162
181
|
const str = (v) => String(v || '~');
|
|
182
|
+
/** Stage order: the row's own workflow's place, else (no workflow on record) the lifecycle's order by name, so Discover comes before Build. */
|
|
183
|
+
const LIFE = ['triage', 'discover', 'discovery', 'plan', 'prioritize', 'build', 'deliver', 'monitor', 'evaluate', 'completed', 'closed'];
|
|
184
|
+
const lifeOf = (r) => { const i = LIFE.indexOf(norm(stageText(r))); return i < 0 ? LIFE.length : i; };
|
|
185
|
+
const stageCmp = (a, b) => posOf(a) - posOf(b) || lifeOf(a) - lifeOf(b);
|
|
163
186
|
const SORTS = {
|
|
164
187
|
title: (a, b) => String(a.title).localeCompare(String(b.title)),
|
|
165
188
|
product: (a, b, o) => str(o.product(a)).localeCompare(str(o.product(b))),
|
|
166
|
-
stage: (a, b) =>
|
|
189
|
+
stage: (a, b) => stageCmp(a, b),
|
|
167
190
|
ms: (a, b) => { const x = nextOf(a), y = nextOf(b); return str(x && !x.plan ? x.name : '~').localeCompare(str(y && !y.plan ? y.name : '~')); },
|
|
168
191
|
date: (a, b) => { const x = nextOf(a), y = nextOf(b); return (x ? +x.d : Infinity) - (y ? +y.d : Infinity) || 0; },
|
|
169
192
|
status: (a, b) => str(statusText(a)).localeCompare(str(statusText(b))),
|
|
@@ -171,7 +194,64 @@ const SORTS = {
|
|
|
171
194
|
goal: (a, b, o) => str(o.goalOf && o.goalOf(a)).localeCompare(str(o.goalOf && o.goalOf(b))),
|
|
172
195
|
wf: (a, b) => String(wfOf(a).name).localeCompare(String(wfOf(b).name)),
|
|
173
196
|
};
|
|
174
|
-
const sortRows = (rows, o) =>
|
|
197
|
+
const sortRows = (rows, o) => {
|
|
198
|
+
const S = read().sorts.filter((x) => SORTS[x.k]); if (!S.length) return rows;
|
|
199
|
+
return rows.slice().sort((a, b) => { for (const x of S) { const d = SORTS[x.k](a, b, o); if (d) return x.up ? d : -d; } return String(a.title).localeCompare(String(b.title)); });
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/* ── filter (round 3): every facet takes several values; each value says how many rows it holds, and one that holds none is not shown.
|
|
203
|
+
* The filter lives for this page (the view is what PMOS remembers). ── */
|
|
204
|
+
const FACETS = [['need', 'Needs'], ['stage', 'Stage'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program'], ['owner', 'Owner'], ['sprint', 'Sprint']];
|
|
205
|
+
const NEEDS = [['you', 'Waits on you'], ['late', 'Late'], ['risk', 'At risk'], ['blocked', 'Blocked']];
|
|
206
|
+
const FL = Object.fromEntries(FACETS.map(([k]) => [k, new Set()]));
|
|
207
|
+
/** The values a row holds in a facet (a row can be in several sprints and several needs). */
|
|
208
|
+
function valuesOf(r, k, o) {
|
|
209
|
+
const t = r.track || {};
|
|
210
|
+
if (k === 'need') return NEEDS.map(([x]) => x).filter((x) => (x === 'you' ? !!t.you : x === 'late' ? !!r.late || dateOf(r, o.now).tone === 'late' : x === 'risk' ? r.status === 'at risk' || dateOf(r, o.now).tone === 'risk' : !!t.blocked));
|
|
211
|
+
if (k === 'stage') { const v = stageText(r); return v ? [v] : []; }
|
|
212
|
+
if (k === 'status') { const v = statusText(r); return v ? [v] : []; }
|
|
213
|
+
if (k === 'product') { const v = o.product ? o.product(r) : r.product; return v ? [v] : []; }
|
|
214
|
+
if (k === 'program') return [(o.programOf && o.programOf(r)) || 'No program'];
|
|
215
|
+
if (k === 'owner') return [r.owner || 'No owner'];
|
|
216
|
+
if (k === 'sprint') return [...new Set((t.tickets || []).map((x) => x.sprint).filter(Boolean))];
|
|
217
|
+
return [];
|
|
218
|
+
}
|
|
219
|
+
const needWord = (x) => (NEEDS.find(([k]) => k === x) || [x, x])[1];
|
|
220
|
+
/** Each facet with its values and counts over the rows, in the order the rows give them (stages in stage order); a facet with one value or
|
|
221
|
+
* none says nothing, except Needs and Sprint. → [{ k, n, vals: [{ v, word, n, on }] }] */
|
|
222
|
+
export function facetsOf(rows, o = {}) {
|
|
223
|
+
const oo = { now: new Date(), ...o };
|
|
224
|
+
return FACETS.map(([k, n]) => {
|
|
225
|
+
const m = new Map();
|
|
226
|
+
for (const r of rows) for (const v of valuesOf(r, k, oo)) m.set(v, (m.get(v) || 0) + 1);
|
|
227
|
+
let vals = [...m].map(([v, c]) => ({ v, word: k === 'need' ? needWord(v) : v, n: c, on: FL[k].has(v) }));
|
|
228
|
+
if (k === 'need') vals = NEEDS.map(([x]) => vals.find((y) => y.v === x)).filter(Boolean);
|
|
229
|
+
else if (k === 'stage') { const rep = (v) => rows.find((r) => stageText(r) === v); vals.sort((a, b) => stageCmp(rep(a.v), rep(b.v))); }
|
|
230
|
+
else if (k === 'sprint') vals.sort((a, b) => String(b.v).localeCompare(String(a.v), undefined, { numeric: true }));
|
|
231
|
+
else vals.sort((a, b) => b.n - a.n || String(a.v).localeCompare(String(b.v)));
|
|
232
|
+
// a value that is on but holds no row now stays, so it can be taken off
|
|
233
|
+
for (const v of FL[k]) if (!vals.some((y) => y.v === v)) vals.push({ v, word: k === 'need' ? needWord(v) : v, n: 0, on: true });
|
|
234
|
+
return { k, n, vals };
|
|
235
|
+
}).filter((f) => f.vals.length > (f.k === 'need' || f.k === 'sprint' ? 0 : 1) || f.vals.some((y) => y.on));
|
|
236
|
+
}
|
|
237
|
+
export const filterOn = () => FACETS.some(([k]) => FL[k].size > 0);
|
|
238
|
+
export const filterCount = () => FACETS.reduce((n, [k]) => n + FL[k].size, 0);
|
|
239
|
+
export const setFilter = (k, v) => { if (!FL[k]) return; if (FL[k].has(v)) FL[k].delete(v); else FL[k].add(v); };
|
|
240
|
+
export const clearFilter = () => { for (const [k] of FACETS) FL[k].clear(); };
|
|
241
|
+
/** The rows every facet that is on lets through: a value of the facet, any of them (several stages read "Build or Deliver"). */
|
|
242
|
+
export function filterRows(rows, o = {}) {
|
|
243
|
+
const oo = { now: new Date(), ...o }, on = FACETS.filter(([k]) => FL[k].size);
|
|
244
|
+
if (!on.length) return rows;
|
|
245
|
+
return rows.filter((r) => on.every(([k]) => valuesOf(r, k, oo).some((v) => FL[k].has(v))));
|
|
246
|
+
}
|
|
247
|
+
/** The quiet line above the table while a filter is on (Events' form): "Showing Build and Deliver of IDPF · 14 hidden · Show all". */
|
|
248
|
+
export function showingHtml(hidden) {
|
|
249
|
+
if (!filterOn()) return '';
|
|
250
|
+
const and = (k) => [...FL[k]].map((v) => (k === 'need' ? needWord(v) : v)).join(k === 'need' ? ' or ' : ' and ');
|
|
251
|
+
const what = ['need', 'stage', 'status', 'sprint'].filter((k) => FL[k].size).map(and).join(' · ') || 'the initiatives';
|
|
252
|
+
const of = ['product', 'program'].filter((k) => FL[k].size).map(and).join(' · '), by = FL.owner.size ? and('owner') : '';
|
|
253
|
+
return `<div class="wk-showing" role="status"><span>Showing ${esc(what)}${of ? ' of ' + esc(of) : ''}${by ? ' owned by ' + esc(by) : ''}</span>${hidden ? `<span class="q">· ${hidden} hidden</span>` : ''}<span class="q">·</span><button type="button" class="wk-sa" data-wkclear>Show all</button></div>`;
|
|
254
|
+
}
|
|
175
255
|
|
|
176
256
|
/* ── the timeline's window ───────────────────────────────────────────────────────────────────────────────────── */
|
|
177
257
|
/** The window of a span. Full: from the earliest start to the latest end of the rows (their milestones and today too), so no bar is cut.
|
|
@@ -204,13 +284,12 @@ export function ticksOf(W) {
|
|
|
204
284
|
}
|
|
205
285
|
|
|
206
286
|
/* ── markup ──────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
207
|
-
const I = { hide: 'M13 6l6 6-6 6M6 6l6 6-6 6', show: 'M11 6l-6 6 6 6M18 6l-6 6 6 6', chev: 'M7 10l5 5 5-5', sort: 'M12 5v14M6 13l6 6 6-6' };
|
|
208
|
-
let LAST = null; // what the list was drawn with: the hover redraws one row's bar from it
|
|
287
|
+
const I = { hide: 'M13 6l6 6-6 6M6 6l6 6-6 6', show: 'M11 6l-6 6 6 6M18 6l-6 6 6 6', chev: 'M7 10l5 5 5-5', sort: 'M12 5v14M6 13l6 6 6-6', x: 'M6 6l12 12M18 6L6 18' };
|
|
209
288
|
|
|
210
289
|
function cellHtml(r, k, o) {
|
|
211
290
|
if (k === 'product') return `<span role="cell">${esc(o.product(r))}</span>`;
|
|
212
291
|
if (k === 'stage') { const s = stageText(r); return `<span role="cell" class="wk-stc">${o.canMove && o.canMove(r) ? `<button type="button" class="wk-st" data-wkstage="${esc(r.key)}" aria-haspopup="menu" aria-label="Stage: ${esc(s || 'none')}. Change the stage" title="Change the stage">${esc(s)}</button>` : esc(s)}</span>`; }
|
|
213
|
-
if (k === 'ms') { const n = nextOf(r); return `<span role="cell"
|
|
292
|
+
if (k === 'ms') { const n = nextOf(r); return `<span role="cell">${n ? esc(n.name) : ''}</span>`; }
|
|
214
293
|
if (k === 'date') { const d = dateOf(r, o.now); return `<span role="cell" class="wk-d${d.tone ? ' ' + d.tone : ''}">${esc(d.text)}${d.note ? `<em> · ${esc(d.note)}</em>` : ''}</span>`; }
|
|
215
294
|
if (k === 'status') return `<span role="cell">${esc(statusText(r))}</span>`;
|
|
216
295
|
if (k === 'program') return `<span role="cell">${esc((o.programOf && o.programOf(r)) || '')}</span>`;
|
|
@@ -221,7 +300,7 @@ function cellHtml(r, k, o) {
|
|
|
221
300
|
const words = (r, keys, o) => keys.map((k) => {
|
|
222
301
|
if (k === 'product') return o.product(r);
|
|
223
302
|
if (k === 'stage') return stageText(r);
|
|
224
|
-
if (k === 'ms') { const n = nextOf(r); return n ? 'next ' + n.name : ''; }
|
|
303
|
+
if (k === 'ms') { const n = nextOf(r); return n && n.name ? 'next ' + n.name : ''; }
|
|
225
304
|
if (k === 'date') { const d = dateOf(r, o.now); return d.text + (d.note ? ', ' + d.note : ''); }
|
|
226
305
|
if (k === 'status') return statusText(r);
|
|
227
306
|
if (k === 'program') return (o.programOf && o.programOf(r)) || '';
|
|
@@ -232,7 +311,8 @@ const words = (r, keys, o) => keys.map((k) => {
|
|
|
232
311
|
|
|
233
312
|
/** The grid lines and today's line of the timeline, the same on every row. */
|
|
234
313
|
const gridHtml = (W, T, now) => T.map((t) => (inW(W, t.at) ? `<i class="wk-gl" style="left:${P(X(W, t.at))}"></i>` : '')).join('') + (inW(W, today(now)) ? `<i class="wk-now" style="left:${P(X(W, today(now)))}"></i>` : '');
|
|
235
|
-
/** One row's bar: the plan, the part that has passed, the late line, the next milestone
|
|
314
|
+
/** One row's bar when the page gives none (the unit test): the plan, the part that has passed, the late line, the next milestone. The page
|
|
315
|
+
* draws the Board's own bar instead (o.bar: pm/bd-span.js rowBar). */
|
|
236
316
|
export function barHtml(r, W, o = {}) {
|
|
237
317
|
const now = o.now || new Date(), t = today(now), s = day(r.start), e = day(r.end), n = nextOf(r), dt = dateOf(r, now);
|
|
238
318
|
let h = '';
|
|
@@ -241,24 +321,31 @@ export function barHtml(r, W, o = {}) {
|
|
|
241
321
|
h += `<b class="wk-bar" style="left:${P(a)};width:${P(Math.min(100, b) - Math.max(0, a))}"><em style="width:${Math.max(0, Math.min(100, pass)).toFixed(1)}%"></em></b>`;
|
|
242
322
|
}
|
|
243
323
|
if (n && dt.tone === 'late' && dt.over > 0 && n.d < W.to) h += `<u class="wk-late" style="left:${P(X(W, n.d))};width:${P(X(W, t) - Math.max(0, X(W, n.d)))}" aria-hidden="true"></u>`;
|
|
244
|
-
if (n && inW(W, n.d)) h += `<s class="wk-ms${dt.tone ? ' ' + dt.tone : ''}" style="left:${P(X(W, n.d))}" title="${esc(n.name + ' · ' + dt.text)}"></s>`;
|
|
245
|
-
if (o.hov) {
|
|
246
|
-
const S = stagesOf(r);
|
|
247
|
-
h += S.map((x) => (x.d && inW(W, x.d) ? `<i class="wk-sd ${x.at}${x.at === 'cur' && dt.tone ? ' ' + dt.tone : ''}" style="left:${P(X(W, x.d))}" title="${esc(x.name)}"></i>` : '')).join('');
|
|
248
|
-
if (S.length) h += `<div class="wk-card" role="tooltip" style="--n:${S.length}"><p>${esc(r.title)} · its stages</p><div class="wk-cg" style="--n:${S.length}">${S.map((x) => `<div class="wk-cs ${x.at}${x.at === 'cur' && dt.tone ? ' ' + dt.tone : ''}"><i></i><b>${esc(x.name)}</b><small>${x.d ? esc(dm(x.d, now)) : 'no date'}</small></div>`).join('')}</div></div>`;
|
|
249
|
-
}
|
|
324
|
+
if (n && inW(W, n.d)) h += `<s class="wk-ms${dt.tone ? ' ' + dt.tone : ''}" style="left:${P(X(W, n.d))}" title="${esc((n.name || 'Plan end') + ' · ' + dt.text)}"></s>`;
|
|
250
325
|
return h;
|
|
251
326
|
}
|
|
327
|
+
/** The stage card (board 4), open after a press of the bar: the stages of the row's own workflow, each with the due date of its work, the one in
|
|
328
|
+
* progress marked; and the stage dots on the bar. Esc or a press outside closes it. */
|
|
329
|
+
export function cardHtml(r, W, now = new Date()) {
|
|
330
|
+
const S = stagesOf(r), dt = dateOf(r, now); if (!S.length) return '';
|
|
331
|
+
const tone = (x) => (x.at === 'cur' && dt.tone ? ' ' + dt.tone : '');
|
|
332
|
+
return S.map((x) => (x.d && inW(W, x.d) ? `<i class="wk-sd ${x.at}${tone(x)}" style="left:${P(X(W, x.d))}" aria-hidden="true"></i>` : '')).join('')
|
|
333
|
+
+ `<div class="wk-card" role="dialog" aria-label="${esc(r.title + ', its stages')}" style="--n:${S.length}"><p>${esc(r.title)} · its stages</p><div class="wk-cg" style="--n:${S.length}">${S.map((x) => `<div class="wk-cs ${x.at}${tone(x)}"><i></i><b>${esc(x.name)}</b><small>${x.d ? esc(dm(x.d, now)) : ''}</small></div>`).join('')}</div></div>`;
|
|
334
|
+
}
|
|
335
|
+
/** A closed or completed initiative (its workflow's done, won't do or archived step): they fold into one line at the end of the list. */
|
|
336
|
+
export const isClosed = (r) => !!(r.closed || ['done', 'wontdo', 'archived'].includes(catOfRow(r)));
|
|
337
|
+
let CARD = null, SHUT = true, COLS_OPEN = false, LAST = null; // the row whose stage card is open; the closed ones folded; the menu's Columns open; the rows last drawn
|
|
252
338
|
|
|
253
|
-
/** The whole list. rows: the initiatives on screen. o: { now, many, sel,
|
|
254
|
-
*
|
|
339
|
+
/** The whole list. rows: the initiatives on screen. o: { now, many, sel, canMove(r), product(r), programOf(r), goalOf(r), goalGroups(rows),
|
|
340
|
+
* bar(r, W): the Board's own bar for a row (else the plain one) } → html. The closed ones fold into one line at the end. */
|
|
255
341
|
export function listHtml(rows, o = {}) {
|
|
256
342
|
const v = read(), now = o.now || new Date(), keys = colsShown(v, o), tl = v.tl !== false;
|
|
257
|
-
const W = windowOf(v.span, rows, now), T = ticksOf(W), grid = gridHtml(W, T, now);
|
|
258
343
|
const oo = { ...o, now, product: o.product || ((r) => r.product || '') };
|
|
259
|
-
LAST = { o: oo
|
|
260
|
-
const
|
|
261
|
-
const
|
|
344
|
+
LAST = { rows, o: oo };
|
|
345
|
+
const every = rows; rows = filterRows(rows, oo);
|
|
346
|
+
const W = windowOf(v.span, rows.length ? rows : every, now), T = ticksOf(W), grid = gridHtml(W, T, now);
|
|
347
|
+
const tpl = (tl ? 'minmax(160px,220px) ' : 'minmax(0,1fr) ') + keys.map((k) => byK[k].w + 'px').join(' ') + (tl ? ' minmax(240px,1fr)' : '');
|
|
348
|
+
const sortHd = (k, n) => { const x = v.sorts.find((y) => y.k === k), on = !!x, first = on && v.sorts[0].k === k; return `<span role="columnheader" aria-sort="${first ? (x.up ? 'ascending' : 'descending') : 'none'}"><button type="button" class="wk-hd${on ? ' on' : ''}" data-wksort="${k}" title="Sort by ${esc(n.toLowerCase())}">${esc(n)}${on ? `<span class="wk-sar${x.up ? '' : ' dn'}">${SV(I.sort, 12)}</span>` : ''}</button></span>`; };
|
|
262
349
|
const spanName = (SPANS.find(([k]) => k === v.span) || SPANS[5])[1];
|
|
263
350
|
const tlHead = !tl ? '' : `<span role="columnheader" class="wk-x wk-xh"><span class="wk-tl">${T.filter((t) => t.show && X(W, t.mid) > 14).map((t) => `<span class="wk-tk" style="left:${P(X(W, t.mid))}">${esc(t.label)}</span>`).join('')}`
|
|
264
351
|
+ (inW(W, today(now)) ? `<i class="wk-nowl" style="left:${P(X(W, today(now)))}">Today</i>` : '') + `</span>`
|
|
@@ -266,50 +353,68 @@ export function listHtml(rows, o = {}) {
|
|
|
266
353
|
+ `<span class="wk-spw"><button type="button" class="wk-span" data-wkspan aria-haspopup="menu" aria-expanded="false" aria-label="Span of the timeline: ${esc(spanName)}" title="Span of the timeline">${esc(spanName)}${SV(I.chev, 11)}</button>`
|
|
267
354
|
+ `<span class="wk-spm" role="menu" aria-label="Span of the timeline" hidden><span class="h">Span</span>${SPANS.map(([k, n]) => `<button type="button" role="menuitemradio" aria-checked="${k === v.span}" class="o${k === v.span ? ' on' : ''}" data-wkspick="${k}">${esc(n)}</button>`).join('')}</span></span></span>`;
|
|
268
355
|
const showTl = tl ? '' : `<button type="button" class="wk-show" data-wktl="on" aria-label="Show the timeline" title="Show the timeline">${SV(I.show, 13)}</button>`;
|
|
269
|
-
let h = `<div class="wk${tl ? ' has-x' : ''}" role="table" aria-label="Initiatives" style="--wk-cols:${tpl}">`
|
|
356
|
+
let h = showingHtml(every.length - rows.length) + `<div class="wk${tl ? ' has-x' : ''}" role="table" aria-label="Initiatives" style="--wk-cols:${tpl}">`
|
|
270
357
|
+ `<div class="wk-r wk-h" role="row">${sortHd('title', 'Initiative')}${keys.map((k) => sortHd(k, byK[k].n)).join('')}${tlHead}${showTl}</div>`;
|
|
271
|
-
const row = (r) => `<div class="wk-r wk-i${o.sel === r.key ? ' sel' : ''}${
|
|
358
|
+
const row = (r) => `<div class="wk-r wk-i${o.sel === r.key ? ' sel' : ''}${CARD === r.key ? ' hov' : ''}${isClosed(r) ? ' cl' : ''}" role="row" tabindex="0" data-key="${esc(r.key)}" aria-label="${esc(r.title + (keys.length ? ', ' + words(r, keys, oo) : ''))}">`
|
|
272
359
|
+ `<span role="cell" class="n">${esc(r.title)}</span>${keys.map((k) => cellHtml(r, k, oo)).join('')}`
|
|
273
|
-
+ (tl ? `<span role="cell" class="wk-x" data-wkbar="${esc(r.key)}"><span class="wk-bw">${grid}${barHtml(r, W, { now
|
|
274
|
-
|
|
360
|
+
+ (tl ? `<span role="cell" class="wk-x" data-wkbar="${esc(r.key)}"><span class="wk-bw">${grid}${o.bar ? o.bar(r, W) : barHtml(r, W, { now })}${CARD === r.key ? cardHtml(r, W, now) : ''}</span></span>` : '') + '</div>';
|
|
361
|
+
if (!rows.length && every.length) h += `<p class="wk-empty">No initiative matches these filters. <button type="button" class="wk-sa" data-wkclear>Show all</button></p>`;
|
|
362
|
+
const all = o.order ? o.order(rows) : rows, base = all.filter((r) => !isClosed(r)), shut = all.filter(isClosed), G = groupsOf(base, v.group, oo);
|
|
363
|
+
const gline = (inner) => `<div class="wk-r wk-g" role="row">${inner}${tl ? `<span class="wk-x" aria-hidden="true"><span class="wk-bw">${grid}</span></span>` : ''}</div>`;
|
|
275
364
|
if (!G) h += sortRows(base, oo).map(row).join('');
|
|
276
365
|
else for (const g of G) {
|
|
277
|
-
h += `<
|
|
366
|
+
h += gline(`<span role="rowheader">${esc(g.name)}<small>${g.rows.length}</small></span>`);
|
|
278
367
|
h += sortRows(g.rows, oo).map(row).join('');
|
|
279
368
|
}
|
|
369
|
+
// the closed and completed ones: one last line that opens them, as done tasks fold in the Work breakdown
|
|
370
|
+
if (shut.length) {
|
|
371
|
+
h += gline(`<span role="rowheader"><button type="button" class="wk-fold" data-wkclosed aria-expanded="${!SHUT}">${SV(I.chev, 12)}${shut.length} closed</button></span>`);
|
|
372
|
+
if (!SHUT) h += sortRows(shut, oo).map(row).join('');
|
|
373
|
+
}
|
|
280
374
|
h += '</div>';
|
|
281
|
-
if (tl) h += `<div class="wk-key"><span><i class="k
|
|
375
|
+
if (tl) h += `<div class="wk-key"><span><i class="k dn"></i>Done</span><span><i class="k nw"></i>Now</span><span><i class="k pl"></i>Planned</span><span><i class="k dlv"></i>Milestone</span><span><i class="k-late"></i>Late</span><span>Press a bar to see its stages and their dates</span></div>`;
|
|
282
376
|
return h;
|
|
283
377
|
}
|
|
284
378
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
const cell = [...body.querySelectorAll('[data-wkbar]')].find((x) => x.dataset.wkbar === k), r = LAST.o.rowOf ? LAST.o.rowOf(k) : null;
|
|
291
|
-
if (!cell || !r) return;
|
|
292
|
-
const bw = cell.querySelector('.wk-bw'); if (bw) bw.innerHTML = LAST.grid + barHtml(r, LAST.W, { now: LAST.o.now, hov: on });
|
|
293
|
-
const rw = cell.closest('.wk-r'); if (rw) rw.classList.toggle('hov', on);
|
|
294
|
-
};
|
|
295
|
-
put(was, false); put(key, true);
|
|
296
|
-
return key;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/* ── the view menu (board 5): one narrow panel ───────────────────────────────────────────────────────────────── */
|
|
300
|
-
/** o.more: the menu's last section (what left the toolbar), markup from the page. */
|
|
379
|
+
/* ── the view menu (round 3; the design thread's order, 2026-11-19): Filter, Sort, View, then Columns folded; "PMOS remembers this" at the foot,
|
|
380
|
+
* with Reset only when something differs from the usual. About 360 px wide, small quiet titles, pills (no nested menu). ── */
|
|
381
|
+
const PILLS = 6; // a facet with more values shows its first six and "N more"
|
|
382
|
+
let MORE = new Set();
|
|
383
|
+
/** o: { many, sprint: the page's current sprint { name, passed, over, end } } → html */
|
|
301
384
|
export function menuHtml(o = {}) {
|
|
302
|
-
const v = read();
|
|
385
|
+
const v = read(), u = usual();
|
|
303
386
|
const sw = (on, label, data) => `<button type="button" class="wk-sw${on ? ' on' : ''}" role="switch" aria-checked="${on}" aria-label="${esc(label)}" ${data}></button>`;
|
|
304
387
|
const shown = v.cols.filter((c) => c.on), hid = v.cols.filter((c) => !c.on);
|
|
305
|
-
const rw = (c) => `<div class="wk-mr${c.on ? '' : ' off'}" draggable="true" data-wkcol="${c.k}"><i class="gp" aria-hidden="true"></i><span>${esc(byK[c.k].n)}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
388
|
+
const rw = (c) => `<div class="wk-mr${c.on ? '' : ' off'}" draggable="true" data-wkcol="${c.k}"><i class="gp" aria-hidden="true"></i><span>${esc(byK[c.k].n)}</span>${sw(c.on, byK[c.k].n, `data-wkcolsw="${c.k}"`)}</div>`;
|
|
389
|
+
// Filter
|
|
390
|
+
const F = LAST ? facetsOf(LAST.rows, LAST.o) : [];
|
|
391
|
+
// the sprints: the current one first; one that has ended reads quiet, "MAD Sprint 115 · ended"
|
|
392
|
+
const sp = o.sprint, cmp = (a, b) => String(a).localeCompare(String(b), undefined, { numeric: true });
|
|
393
|
+
const ended = (v) => !!sp && (v === sp.passed || (v === sp.name ? !!sp.over : cmp(v, sp.name) < 0));
|
|
394
|
+
for (const f of F) if (f.k === 'sprint' && sp) f.vals.sort((a, b) => (b.v === sp.name) - (a.v === sp.name) || cmp(b.v, a.v));
|
|
395
|
+
const pill = (f, x) => { const end = f.k === 'sprint' && ended(x.v); return `<button type="button" class="${x.on ? 'on' : ''}${end ? ' q' : ''}" aria-pressed="${x.on}" data-wkf="${f.k}" data-wkv="${esc(x.v)}">${esc(x.word)}${end ? '<em> · ended</em>' : ''}<small>${x.n}</small></button>`; };
|
|
396
|
+
const facet = (f) => {
|
|
397
|
+
const all = MORE.has(f.k) || f.vals.length <= PILLS + 1, vals = all ? f.vals : f.vals.slice(0, PILLS);
|
|
398
|
+
return `<div class="wk-fg" role="group" aria-label="${esc(f.n)}"><span class="wk-fl">${esc(f.n)}</span><div class="wk-pl">${vals.map((x) => pill(f, x)).join('')}${all ? '' : `<button type="button" class="wk-mo" data-wkmore="${f.k}">${f.vals.length - PILLS} more</button>`}</div></div>`;
|
|
399
|
+
};
|
|
400
|
+
const later = sp && F.some((f) => f.k === 'sprint' && f.vals.some((x) => cmp(x.v, sp.name) > 0));
|
|
401
|
+
const spNote = !sp ? '' : sp.passed ? `<p class="wk-note">${esc(sp.passed)} has ended, showing ${esc(sp.name)}.</p>`
|
|
402
|
+
: sp.over && !later ? `<p class="wk-note">${esc(sp.name)} has ended${sp.end ? ' on ' + esc(dm(day(sp.end), new Date())) : ''}. <button type="button" class="wk-lk" data-wkx="jira">Read Jira again</button></p>` : '';
|
|
403
|
+
const filt = F.length ? F.map(facet).join('') + spNote : '<p class="wk-note">Nothing to filter yet.</p>';
|
|
404
|
+
// Sort
|
|
405
|
+
const S = v.sorts, word = (k) => (SORT_KEYS.find(([x]) => x === k) || [k, (byK[k] || {}).n || k])[1];
|
|
406
|
+
const sortPills = `<button type="button" class="${S.length ? '' : 'on'}" aria-pressed="${!S.length}" data-wksortp="">PMOS order</button>`
|
|
407
|
+
+ SORT_KEYS.map(([k, n]) => { const i = S.findIndex((x) => x.k === k); if (i < 0) return `<button type="button" aria-pressed="false" data-wksortp="${k}">${esc(n)}</button>`;
|
|
408
|
+
return `<span class="wk-sk"><button type="button" class="on" aria-pressed="true" data-wksortp="${k}" aria-label="${esc((i + 1) + ': ' + n + ', ' + (S[i].up ? 'first to last' : 'last to first') + '. Turn it round')}"><b>${i + 1}</b>${esc(n)}<span class="wk-sar${S[i].up ? '' : ' dn'}">${SV(I.sort, 11)}</span></button><button type="button" class="x" data-wksortx="${k}" aria-label="Stop sorting by ${esc(n.toLowerCase())}">${SV(I.x, 11)}</button></span>`; }).join('');
|
|
409
|
+
const differs = JSON.stringify(v) !== JSON.stringify(u) || filterOn();
|
|
410
|
+
return `<div class="wk-menu" role="dialog" aria-label="Filter, sort and view">`
|
|
411
|
+
+ `<section><h6>Filter${filterOn() ? ` <button type="button" class="wk-lk" data-wkclear>Clear</button>` : ''}</h6>${filt}</section>`
|
|
412
|
+
+ `<section><h6>Sort${S.length ? ` <small>· ${esc(S.map((x) => word(x.k)).join(', then '))}</small>` : ''}</h6><div class="wk-pl wk-sorts">${sortPills}</div></section>`
|
|
413
|
+
+ `<section><h6>View</h6><div class="wk-fg"><span class="wk-fl">Group by</span><div class="wk-pl" role="radiogroup" aria-label="Group by">${GROUPS.map(([k, n]) => `<button type="button" role="radio" aria-checked="${k === v.group}" class="${k === v.group ? 'on' : ''}" data-wkgroup="${k}">${esc(n)}</button>`).join('')}</div></div>`
|
|
414
|
+
+ `<div class="wk-mr wk-tlr"><span>Timeline</span>${sw(v.tl, 'Timeline', 'data-wktlsw')}</div></section>`
|
|
415
|
+
+ `<section><button type="button" class="wk-cx" data-wkcols aria-expanded="${COLS_OPEN}"><span>Columns</span><small>${shown.length + 1} of ${v.cols.length + 1}</small>${SV(I.chev, 12)}</button>`
|
|
416
|
+
+ (COLS_OPEN ? `<p class="wk-note">Drag to change the order.</p><div class="wk-mr lk"><i></i><span>Initiative</span><small>always</small></div>${shown.map(rw).join('')}${hid.length && shown.length ? '<hr>' : ''}${hid.map(rw).join('')}` : '') + `</section>`
|
|
417
|
+
+ `<div class="wk-ft"><span>PMOS remembers this</span>${differs ? '<button type="button" class="wk-rs" data-wkreset>Reset</button>' : ''}</div></div>`;
|
|
313
418
|
}
|
|
314
419
|
|
|
315
420
|
/** What a press in the list or the menu means, or null when it is not Work's own. → { kind, ... } */
|
|
@@ -317,10 +422,20 @@ export function pressOf(t) {
|
|
|
317
422
|
const q = (s) => t.closest && t.closest(s);
|
|
318
423
|
let b;
|
|
319
424
|
if ((b = q('[data-wksort]'))) return { kind: 'sort', k: b.dataset.wksort };
|
|
425
|
+
if ((b = q('[data-wksortx]'))) return { kind: 'unsort', k: b.dataset.wksortx };
|
|
426
|
+
if ((b = q('[data-wksortp]'))) return { kind: 'addsort', k: b.dataset.wksortp };
|
|
427
|
+
if ((b = q('[data-wkf]'))) return { kind: 'filter', k: b.dataset.wkf, v: b.dataset.wkv };
|
|
428
|
+
if ((b = q('[data-wkmore]'))) return { kind: 'more', k: b.dataset.wkmore };
|
|
429
|
+
if (q('[data-wkclear]')) return { kind: 'clear' };
|
|
430
|
+
if (q('[data-wkcols]')) return { kind: 'cols' };
|
|
320
431
|
if ((b = q('[data-wkspick]'))) return { kind: 'span', span: b.dataset.wkspick };
|
|
321
432
|
if (q('[data-wkspan]')) return { kind: 'spanmenu' };
|
|
322
433
|
if ((b = q('[data-wktl]'))) return { kind: 'timeline', on: b.dataset.wktl === 'on' };
|
|
323
434
|
if ((b = q('[data-wkstage]'))) return { kind: 'stage', key: b.dataset.wkstage, el: b };
|
|
435
|
+
if (q('[data-wkclosed]')) return { kind: 'closed' };
|
|
436
|
+
if (q('.wk-card')) return { kind: 'inside' };
|
|
437
|
+
// a press on the bar itself (not its ◇, its gap or its late line, which open their own popups) opens the stage card
|
|
438
|
+
if ((b = q('[data-wkbar]')) && q('.tg-bar, .wk-bar')) return { kind: 'card', key: b.dataset.wkbar };
|
|
324
439
|
if ((b = q('[data-wkgroup]'))) return { kind: 'group', group: b.dataset.wkgroup };
|
|
325
440
|
if (q('[data-wktlsw]')) return { kind: 'timeline', on: !read().tl };
|
|
326
441
|
if ((b = q('[data-wkcolsw]'))) { const c = read().cols.find((x) => x.k === b.dataset.wkcolsw); return { kind: 'col', k: b.dataset.wkcolsw, on: !(c && c.on) }; }
|
|
@@ -334,7 +449,16 @@ export function apply(p) {
|
|
|
334
449
|
else if (p.kind === 'timeline') setTimeline(p.on);
|
|
335
450
|
else if (p.kind === 'group') setGroup(p.group);
|
|
336
451
|
else if (p.kind === 'col') setCol(p.k, p.on);
|
|
337
|
-
else if (p.kind === 'reset') { reset();
|
|
452
|
+
else if (p.kind === 'reset') { reset(); clearFilter(); }
|
|
453
|
+
else if (p.kind === 'addsort') { if (p.k) addSort(p.k); else write({ ...read(), sorts: [] }); }
|
|
454
|
+
else if (p.kind === 'unsort') dropSort(p.k);
|
|
455
|
+
else if (p.kind === 'filter') setFilter(p.k, p.v);
|
|
456
|
+
else if (p.kind === 'clear') clearFilter();
|
|
457
|
+
else if (p.kind === 'more') MORE.add(p.k);
|
|
458
|
+
else if (p.kind === 'cols') COLS_OPEN = !COLS_OPEN;
|
|
459
|
+
else if (p.kind === 'closed') SHUT = !SHUT;
|
|
460
|
+
else if (p.kind === 'card') CARD = CARD === p.key ? null : p.key;
|
|
461
|
+
else if (p.kind === 'inside') return false;
|
|
338
462
|
else return false;
|
|
339
463
|
return true;
|
|
340
464
|
}
|
|
@@ -354,3 +478,6 @@ export function wireDrag(menu, on) {
|
|
|
354
478
|
moveCol(r.dataset.wkcol, j >= 0 && j < v.cols.length ? v.cols[j].k : null); on(r.dataset.wkcol);
|
|
355
479
|
});
|
|
356
480
|
}
|
|
481
|
+
/** The open stage card, or null; closeCard() shuts it. → true when one was open. */
|
|
482
|
+
export const cardOf = () => CARD;
|
|
483
|
+
export function closeCard() { const was = CARD; CARD = null; return !!was; }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* pm/cozy-bar.css — the gap line and the milestone card of the one bar (pm/cozy-bar.js). The bars themselves keep the original classes of
|
|
2
|
+
* ini-view.css (iva-b, iva-tb, iva-md, iva-late). */
|
|
3
|
+
.cb-gap { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: color-mix(in srgb, var(--cz-ink3) 45%, var(--cz-card)); z-index: 1; }
|
|
4
|
+
button.cb-md { cursor: pointer; }
|
|
5
|
+
button.cb-md:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
6
|
+
.cb-card { display: flex; flex-direction: column; gap: 2px; min-width: 200px; }
|
|
7
|
+
.cb-card p { margin: 0; }
|
|
8
|
+
.cb-k { font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); }
|
|
9
|
+
.cb-t { font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
10
|
+
.cb-w { font-size: var(--fs-meta); color: var(--cz-ink2); }
|
|
11
|
+
.cb-late { color: var(--cz-late); }
|