create-pmos 0.792.0 → 0.794.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 +43 -28
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +42 -0
- package/workspace/guide/breakdown.md +10 -6
- package/workspace/guide/cli.md +9 -0
- package/workspace/guide/initiatives-and-next-steps.md +2 -2
- package/workspace/guide/layout.md +15 -0
- package/workspace/lib/decision-journal-needs.js +27 -4
- package/workspace/lib/decision-journal.js +274 -8
- package/workspace/lib/decisions-cli.js +72 -8
- package/workspace/lib/prefs-sync.js +1 -0
- package/workspace/lib/routes-boards.js +8 -3
- package/workspace/lib/routes-use-log.js +6 -1
- package/workspace/lib/settings-store.js +3 -0
- package/workspace/lib/use-log.js +18 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-pop-ds.css +5 -0
- package/workspace/public/pm/bd-pop-ds.js +13 -6
- package/workspace/public/pm/cozy-pop-work.js +126 -19
- package/workspace/public/pm/pop-cap.js +103 -0
- package/workspace/test-lists/decisions-come-back.json +5 -0
- package/workspace/test-lists/popup-cap.json +9 -0
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
.pwd-blk { gap: var(--space-12); }
|
|
9
9
|
.pwd-bh { justify-content: space-between; gap: var(--space-8); }
|
|
10
10
|
.pwd-bh .pm-h-sm { margin: 0; }
|
|
11
|
+
/* the popup cap (PopupCapDS): the toolbar of four sits at the head's end; rows picked put "n selected" and × beside it */
|
|
12
|
+
.pwd-bh .pwd-tb { margin-left: auto; gap: var(--space-4); }
|
|
13
|
+
.pwd-bh.ws-bar .ws-n { margin-left: auto; }
|
|
14
|
+
.pwd-bh.ws-bar .pwd-tb { margin-left: 0; }
|
|
15
|
+
.pwd-pick { margin: var(--space-4) 0 0; }
|
|
11
16
|
|
|
12
17
|
/* ── Where it stands ── */
|
|
13
18
|
.pwd-say { margin: 0; font-size: var(--fs-body); line-height: 24px; }
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* artMenu(arts, o) → the ⋯ menu's Artefacts section (the desk popup has no side card)
|
|
15
15
|
* stageKeyOf(text, st) → { key, name, title } the stage a captured line names ("… in Plan"), else the stage in progress
|
|
16
16
|
*
|
|
17
|
-
* The UI says PMOS, never Claude. Buttons are icons with aria-label. */
|
|
17
|
+
* The UI says PMOS, never Claude. Buttons are icons with aria-label. A row's hover shows at most three: Who, Date, More (PopupCapDS). */
|
|
18
18
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
19
19
|
const SV = (d, w = 16) => `<svg class="pm-ic" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
20
20
|
export const I = {
|
|
@@ -127,6 +127,14 @@ export function stagesHtml(st, W) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/* ── the Work breakdown ── */
|
|
130
|
+
/** The head under the popup cap (PopupCapDS): the title, the epic, and the toolbar of four (pm/pop-cap.js). Rows picked: "n selected" and ×
|
|
131
|
+
* join it. List or Gantt, Source, Columns and the rest are under ⋯ (cozy-pop-work moreItems). */
|
|
132
|
+
export function capHead(o = {}) {
|
|
133
|
+
const n = o.n || 0;
|
|
134
|
+
const sel = n ? `<b class="ws-n">${esc(n)} selected</b>` : '';
|
|
135
|
+
const x = n ? `<button type="button" class="pm-btn ws-x" data-ws-op="clear" aria-label="Clear the selection" title="Clear (Esc)">${SV(I.x, 16)}</button>` : '';
|
|
136
|
+
return `<div class="pm-row pwd-bh${n ? ' ws-bar' : ''}"><h2 class="pm-h-sm">Work breakdown</h2>${o.epic ? `<span class="pm-meta pwd-ep">epic</span>${keyChip({ ckey: o.epic, jurl: o.epicUrl || '' })}` : ''}${sel}${o.toolbar || ''}${x}</div>${o.line || ''}`;
|
|
137
|
+
}
|
|
130
138
|
export function wbsHead(view, epic = '', epicUrl = '') {
|
|
131
139
|
const t = (k, l) => `<button type="button" class="pm-tab" role="tab" aria-selected="${view === k}" data-pwv="${k}">${l}</button>`;
|
|
132
140
|
return `<div class="pm-row pwd-bh"><h2 class="pm-h-sm">Work breakdown</h2>${epic ? `<span class="pm-meta pwd-ep">epic</span>${keyChip({ ckey: epic, jurl: epicUrl || '' })}` : ''}<div class="pm-tabs" role="tablist" aria-label="View of the work breakdown">${t('list', 'List')}${t('gantt', 'Gantt')}</div></div>`;
|
|
@@ -189,14 +197,12 @@ export function listHtml(rows, W, o = {}) {
|
|
|
189
197
|
: o.ro || x.jira ? `<span class="pwd-ck" aria-hidden="true">${SV(x.ms ? I.dia : I.box, 14)}</span>`
|
|
190
198
|
: `<button type="button" class="pwd-ck" data-pw-tick="${esc(x.uid)}" aria-label="${esc('Mark ' + x.title + ' done')}" title="Mark it done">${SV(x.ms ? I.dia : I.box, 14)}</button>`;
|
|
191
199
|
const title = !E.name || x.done ? `<span class="t">${esc(x.title)}</span>` : `<button type="button" class="t pwd-tt" data-pw-name="${esc(x.uid)}" aria-label="${esc('Rename ' + x.title)}">${esc(x.title)}</button>`;
|
|
192
|
-
// on hover (WorkStatesDS 1): Who,
|
|
200
|
+
// on hover (WorkStatesDS 1, capped by PopupCapDS): Who, Date and More, at most three. Stage, Sprint and Priority are in More (rowMenu);
|
|
201
|
+
// a Jira ticket keeps Jira's owner
|
|
193
202
|
const ab = (attr, label, d) => `<button type="button" class="pm-btn" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SV(d)}</button>`;
|
|
194
203
|
const acts = o.ro ? '' : '<span class="acts">'
|
|
195
204
|
+ (x.jira || x.done ? '' : ab(`data-pw-who="${esc(x.uid)}" aria-haspopup="menu"`, 'Who: ' + (x.who || 'no one'), I.who))
|
|
196
205
|
+ (x.done || !E.dates ? '' : ab(`data-pw-date="${esc(x.uid)}" aria-haspopup="dialog"`, x.date ? (x.ms ? 'Date: ' : 'Due: ') + x.date : 'Set a date', I.cal))
|
|
197
|
-
+ (x.jira ? '' : ab(`data-pw-stage="${esc(x.uid)}" aria-haspopup="menu"`, 'Stage', I.stage))
|
|
198
|
-
// Sprint and Priority (inline-sprint-priority): an open PMOS task only; Jira keeps its tickets' own
|
|
199
|
-
+ (x.jira || x.done ? '' : ab(`data-pw-sprint="${esc(x.uid)}" aria-haspopup="menu"`, 'Sprint', I.sprint) + ab(`data-pw-prio="${esc(x.uid)}" aria-haspopup="menu"`, 'Priority: ' + (x.priority || 'none'), I.flag))
|
|
200
206
|
+ ab(`data-pw-row-more="${esc(x.uid)}" aria-haspopup="menu"`, 'More for ' + x.title, I.more) + '</span>';
|
|
201
207
|
// a parent (WorkSubtasksDS): the fold chevron, "n of m done" with its bar; children indent one step per level, up to three
|
|
202
208
|
const chev = x.kids ? `<button type="button" class="pwd-chev" data-pw-sub="${esc(x.uid)}" aria-expanded="${!!x.open}" aria-label="${esc((x.open ? 'Fold ' : 'Open ') + x.title)}">${SV(x.open ? I.down : I.right, 14)}</button>` : (x.depth || (o.nested && !x.depth) ? '<span class="pwd-chev sp" aria-hidden="true"></span>' : '');
|
|
@@ -219,7 +225,8 @@ export function listHtml(rows, W, o = {}) {
|
|
|
219
225
|
return head + (open ? G.tasks.map(li).join('') : '');
|
|
220
226
|
}).join('');
|
|
221
227
|
const fold = empty.length ? `<div class="pm-fold pwd-fold">${esc(empty.length === 1 ? empty[0] + ' has no tasks yet' : empty.slice(0, -1).join(', ') + ' and ' + empty[empty.length - 1] + ' have no tasks yet')}</div>` : '';
|
|
222
|
-
|
|
228
|
+
// the popup cap (PopupCapDS): with o.capped the picked rows' actions are in the head's toolbar, so the list adds no bar of its own
|
|
229
|
+
const cap = o.ro ? '' : sel.size ? (o.capped ? '' : selBar(sel.size, { epic: !!o.epicSel })) : `<input class="pm-input pwd-cap" data-pw-cap placeholder="Add a task; say its stage, or type "under Batch 2:" to add a subtask" aria-label="Add a task. Say its stage, or type under, a parent's name and a colon to add a subtask" maxlength="200" autocomplete="off">`;
|
|
223
230
|
const top = o.ro ? '' : (o.ask ? tickAskHtml(o.ask.x, o.ask.n) : '') + (o.fix && !sel.size ? epicSugHtml(o.fix) : '') + (o.group && !sel.size ? groupSugHtml(o.group) : '');
|
|
224
231
|
const loose = o.looseN && !o.ro ? `<p class="pwd-loose"><button type="button" class="pw-lk" data-pw-backlog>${esc(o.looseN === 1 ? '1 task with no stage is in the Backlog' : o.looseN + ' tasks with no stage are in the Backlog')}${SV(I.right, 13)}</button></p>` : '';
|
|
225
232
|
return cap + top + `<div class="pwd-list${sel.size ? ' picking' : ''}" role="list" aria-label="Work breakdown">${body || (fold ? '' : '<p class="pm-meta pwd-none">No task yet.</p>')}${fold}</div>` + loose;
|
|
@@ -34,6 +34,8 @@ import * as WT from './work-tree.js'; // subtasks, the epic check and its fix
|
|
|
34
34
|
import * as SEL from './work-select.js'; // select several rows and move them together (WorkBulkDS)
|
|
35
35
|
import * as IF from './inline-fields.js'; // a task's sprint and priority, set in the row (initiative inline-sprint-priority)
|
|
36
36
|
import * as SD from './star-draft.js'; // a ✦ draft runs as a PMOS background job and lands on its line (star-buttons-act-directly A7)
|
|
37
|
+
import * as CAP from './pop-cap.js'; // five actions at most: Ask PMOS and the toolbar's four, the rest under ⋯ (popup-cap, idea A498)
|
|
38
|
+
import { noteUse } from './use-log.js';
|
|
37
39
|
import * as PD from './bd-pop-ds.js'; // the popup on a computer, built from the design system's blocks (initiative work-ds-popup) // the Kind of a file and one row per kind (round 3 point 16), shared with the Library // the rename and its Undo, the same write as the old List (batch 18 item 16)
|
|
38
40
|
|
|
39
41
|
const CSS = new URL('./cozy-pop-work.css', import.meta.url).href, DSCSS = new URL('./bd-pop-ds.css', import.meta.url).href;
|
|
@@ -138,6 +140,24 @@ function critSugHtml(cr) {
|
|
|
138
140
|
/* the goal's name, not its id (board 25: "De-risk Okta dependency", not KR-C4): GET /api/boards/anchors once per product */
|
|
139
141
|
const GOALS = new Map(); // ws|board → [{ value, kind, label }] | null while reading | false
|
|
140
142
|
let goalsRedraw = null;
|
|
143
|
+
let capRedraw = null; // the popup drawn last: the four came back from the use log
|
|
144
|
+
// the popup cap (idea A498, PopupCapDS): the toolbar's four are the actions used most in the last 30 days, worked out again once a week and
|
|
145
|
+
// kept under a key that follows the person (lib/prefs-sync.js 'pmos.pop.five'); before 30 days of use, Add, Who, Set the date and Stage
|
|
146
|
+
const FIVE = 'pmos.pop.five';
|
|
147
|
+
let FOUR_ASKED = false;
|
|
148
|
+
function fourIds() {
|
|
149
|
+
const saved = store.get(FIVE, null);
|
|
150
|
+
if (!RO && !FOUR_ASKED && CAP.due(saved)) {
|
|
151
|
+
FOUR_ASKED = true;
|
|
152
|
+
Promise.resolve().then(() => pmGet('/api/use-log/pop')).then((r) => {
|
|
153
|
+
if (!r || r.ok === false) return;
|
|
154
|
+
const ids = CAP.four(r.counts, r.span), was = saved && Array.isArray(saved.ids) ? saved.ids.join() : '';
|
|
155
|
+
store.set(FIVE, { ids, at: new Date().toISOString() });
|
|
156
|
+
if (was !== ids.join() && capRedraw) capRedraw();
|
|
157
|
+
}).catch(() => {});
|
|
158
|
+
}
|
|
159
|
+
return saved && !CAP.due({ ids: saved.ids, at: new Date().toISOString() }) ? saved.ids.slice() : [...CAP.DEFAULT];
|
|
160
|
+
}
|
|
141
161
|
function goalOf(ws, board, anchor) {
|
|
142
162
|
const a = String(anchor || '').trim(); if (!a || !board) return '';
|
|
143
163
|
const k = (ws || '') + '|' + board;
|
|
@@ -335,7 +355,7 @@ function rowHtml(x, W, C, sugRows) {
|
|
|
335
355
|
return `<div class="pw-tr pw-kr${x.done ? ' done' : ''}${x.lit ? ' lit' : ''}${x.kids ? ' par' : ''}${RSEL.has(String(x.uid)) ? ' sel' : ''}" role="row" data-pw-row="${esc(x.uid)}" data-pw-sec="${esc(x.sec)}"${x.depth ? ` style="--pw-d:${x.depth}"` : ''}><span class="pw-it"${!x.jsub && canDrag() ? ' draggable="true"' : ''}>${chev}<i class="pw-bul${x.ms ? ' ms' : ''}" aria-hidden="true"></i>${title}${more2}${RO ? '' : ib(`data-pw-open="${esc(x.uid)}"`, 'Open the task', P.open, 'xs hov') + ib(`data-pw-row-more="${esc(x.uid)}" aria-haspopup="menu"`, 'More for ' + x.title, P.more, 'xs hov')}</span>${jc}${stc}${dtc}${tl}</div>`
|
|
336
356
|
+ (s ? `<div class="pw-tr pw-sugrow" role="row"><span class="pw-it">${sugLine(s, true)}</span></div>` : '');
|
|
337
357
|
}
|
|
338
|
-
function breakdownHtml(W, C, mode, full, S) {
|
|
358
|
+
function breakdownHtml(W, C, mode, full, S, capped) {
|
|
339
359
|
const sugRows = W.rowSuggests, ms = !!(S && S.msAdd);
|
|
340
360
|
// the add row (round 3 point 2): "◇" beside it makes the next one a milestone; typing "◇ " first does the same
|
|
341
361
|
const add = (key, name) => `<div class="pw-tr pw-add" role="row"><span class="pw-it"><label class="pw-addf">${SVG(P.plus, 14)}<input data-pw-add="${esc(key)}" data-pw-add-name="${esc(name)}" placeholder="${ms ? 'Add a milestone' : 'Add a task'}" aria-label="${esc((ms ? 'Add a milestone to ' : 'Add a task to ') + name)}" maxlength="200" autocomplete="off"></label>`
|
|
@@ -349,8 +369,9 @@ function breakdownHtml(W, C, mode, full, S) {
|
|
|
349
369
|
if (curSec && (!nx || nx.kind === 'stage' || nx.kind === 'far')) { if (curSec.key !== '' && !RO) out += add(curSec.key, curSec.name); curSec = null; }
|
|
350
370
|
}
|
|
351
371
|
const spanB = C.tl ? `<button type="button" class="pw-span" data-pw-span aria-haspopup="menu" aria-label="${esc('Span of the timeline: ' + (M.MODES.find((m) => m[0] === mode) || M.MODES[5])[1])}">${esc((M.MODES.find((m) => m[0] === mode) || M.MODES[5])[1])}${SVG(P.down, 12)}</button>` : '';
|
|
352
|
-
|
|
353
|
-
const
|
|
372
|
+
// under the popup cap (PopupCapDS) the head's tools are in ⋯: Span, The whole popup and Columns (the timeline is a column there)
|
|
373
|
+
const tools = capped ? '' : RO ? (spanB ? `<span class="pw-tools">${spanB}</span>` : '') : `<span class="pw-tools">${spanB}${ib(`data-pw-big aria-pressed="${!!full}"`, full ? 'Back to the initiative' : 'Give the work breakdown the whole popup', full ? P.in : P.full)}${ib('data-pw-tune="wbs" aria-haspopup="menu"', 'Show or hide columns', P.tune)}</span>`;
|
|
374
|
+
const show = !C.tl && !RO && !capped ? ib('data-pw-tl', 'Show the timeline', P.show, 'xs') : '';
|
|
354
375
|
// the tasks in no stage are not in the breakdown (Wawan, 2026-11-19): they live in Work › Backlog; one quiet line says so and goes there
|
|
355
376
|
const loose = W.looseN && !RO ? `<p class="pw-loose"><button type="button" class="pw-lk" data-pw-backlog>${esc(W.looseN === 1 ? '1 task with no stage is in the Backlog' : W.looseN + ' tasks with no stage are in the Backlog')}${SVG(P.right, 13)}</button></p>` : '';
|
|
356
377
|
return `<section class="pw-sec" aria-label="Work breakdown">${full ? `<div class="pw-sech">${tools}</div>` : `<div class="pw-sech"><h3>Work breakdown</h3>${show}${tools}</div>`}`
|
|
@@ -443,12 +464,14 @@ function dsHtml(r, v, o, W, S, C, mode) {
|
|
|
443
464
|
const cnt = WT.sourceCounts(st, epics), src = cnt.all && S.src ? S.src : 'all', stF = WT.sourceKeep(st, src, epics);
|
|
444
465
|
const group = src === 'all' ? WT.groupPlan(st, { dropped: groupDropped(id) })[0] || null : null;
|
|
445
466
|
const epicSel = S.sel.size > 0 && WT.allJira(stagesOf(r, v, { ...o, today: W.today, subAll: true }), S.sel);
|
|
446
|
-
const srcB = PD.sourceHtml(cnt, src);
|
|
447
467
|
const askRow = S.tickAsk ? st.find((x) => x.uid === S.tickAsk) : null, ask = askRow ? { x: askRow, n: openUnder(stagesOf(r, v, { ...o, today: W.today, subAll: true }), askRow.uid).length } : null;
|
|
448
|
-
|
|
468
|
+
// the popup cap (PopupCapDS): the head holds the title, the epic and the toolbar of four; rows picked add "n selected" and ×. While an
|
|
469
|
+
// action waits for rows, one line says what to do; List or Gantt, Source, Columns, Span and The whole popup are under ⋯ (moreItems)
|
|
470
|
+
const head = PD.capHead({ n: S.sel.size, epic: epics[0] || '', epicUrl: epics[0] ? jiraUrlOf(st, epics[0]) : '',
|
|
471
|
+
toolbar: CAP.toolbarHtml(fourIds(), { picked: S.sel.size > 0, jiraPicked: epicSel }), line: S.act ? CAP.pickLineHtml(S.act, S.sel.size) : '' });
|
|
449
472
|
const wbs = view === 'gantt'
|
|
450
|
-
? breakdownHtml(W, C, mode, false, S).replace('<h3>Work breakdown</h3>', head
|
|
451
|
-
: `<section class="pm-block pwd-blk pwd-wbs" aria-label="Work breakdown">${
|
|
473
|
+
? breakdownHtml(W, C, mode, false, S, true).replace('<h3>Work breakdown</h3>', head).replace('class="pw-sec"', 'class="pw-sec pm-block pwd-blk pwd-wbs"')
|
|
474
|
+
: `<section class="pm-block pwd-blk pwd-wbs" aria-label="Work breakdown">${head}${PD.listHtml(stF, W, { looseN: W.looseN, epics, fix, ask, sel: S.sel, nested: st.some((x) => x.kids), drag: canDrag(), group, epicSel, capped: true })}</section>`;
|
|
452
475
|
// the done test's acceptance criteria on the initiative's Jira tickets (jira-criteria-write): its ✦ above the breakdown, unless the PM said no
|
|
453
476
|
const crit = S.sel.size || dropped().has('crit:' + id) ? '' : critSugHtml(CRIT.get(id));
|
|
454
477
|
// Overview (Wawan, 2026-11-23): Where it stands, The case and its facts in one block across the top; folded or open is the person's choice
|
|
@@ -559,7 +582,8 @@ function phoneHtml(W, S, oid, v) {
|
|
|
559
582
|
const others = PT.others.length ? `<button type="button" class="pw-pfold" data-pw-phall aria-expanded="${all}"><b>${esc(PT.others.map((x) => x.name).join(', '))}</b><span>${esc(all ? 'tap to fold' : 'tap to open')}</span>${SVG(all ? P.down : P.right, 13)}</button>${all ? `<ul class="pw-pwbs2">${rest}</ul>` : ''}` : '';
|
|
560
583
|
const loose = W.looseN ? `<p class="pw-loose"><button type="button" class="pw-lk" data-pw-backlog>${esc(W.looseN === 1 ? '1 task with no stage is in the Backlog' : W.looseN + ' tasks with no stage are in the Backlog')}${SVG(P.right, 13)}</button></p>` : '';
|
|
561
584
|
// press and hold a row to select it, then tap more (WorkBulkDS); the bar takes the heading's place while rows are picked
|
|
562
|
-
|
|
585
|
+
// under the popup cap (PopupCapDS) the bar is "n selected", the toolbar's four and ×; Under a parent and Mark them done are in ⋯
|
|
586
|
+
const pbar = S.sel.size ? PD.capHead({ n: S.sel.size, toolbar: CAP.toolbarHtml(fourIds(), { picked: true, jiraPicked: WT.allJira(W.rows, S.sel) }), line: S.act ? CAP.pickLineHtml(S.act, S.sel.size) : '' }).replace('<h2 class="pm-h-sm">Work breakdown</h2>', '') : '';
|
|
563
587
|
const wbs = `<section class="pw-psec" aria-label="Work breakdown">${pbar || `<h4>Work breakdown${PT.now ? ' · ' + esc(PT.now.name) : ''}</h4>`}${nowList}${others}${loose}</section>`;
|
|
564
588
|
// the case: the lines that are written (Problem, Solution, Expected, Check …), each changeable where the popup lets it be
|
|
565
589
|
const lines = ov.lines.filter((L) => L.text);
|
|
@@ -685,7 +709,9 @@ async function draftDocs(s, x, h) {
|
|
|
685
709
|
async function direct(d, ask, x, h) {
|
|
686
710
|
const w = h.where ? h.where() : {}, id = x.o().id;
|
|
687
711
|
const res = await pmPost('/api/boards/ini-' + d.act, { ws: w.ws, board: w.board, id, ...(d.to ? { to: d.to } : {}) }).catch(() => null);
|
|
688
|
-
|
|
712
|
+
// the words go to Ask PMOS when the plain reading does not hold (ask), or when the route cannot be reached: pmPost answers
|
|
713
|
+
// { ok: false } with no status when the server is not there, and an older server answers 404 for a route it does not have (C4)
|
|
714
|
+
if (!res || res.ask || (res.ok === false && (!res.status || res.status === 404))) { toAsk(ask, h); return; }
|
|
689
715
|
if (res.ok === false) { if (h.toast) h.toast(res.error || 'Nothing was changed.'); return; }
|
|
690
716
|
if (h.reload) await h.reload();
|
|
691
717
|
if (res.same) { if (h.toast) h.toast(res.said || 'Nothing to change.'); return; }
|
|
@@ -818,7 +844,8 @@ export function wire(body, h0, x0) {
|
|
|
818
844
|
function cur() { const x = body.__pwx, r = x && x.r(), v = x && x.v(); return r && v ? { r, v, ...model(r, v, x.o()) } : null; }
|
|
819
845
|
function redraw() { if (body.__pwh && body.__pwh.redraw) body.__pwh.redraw(); }
|
|
820
846
|
LE.view(body, () => { if (body.querySelector('.pw')) redraw(); });
|
|
821
|
-
goalsRedraw = artRedraw = wsnRedraw = () => { if (body.isConnected && body.querySelector('.pw')) redraw(); };
|
|
847
|
+
goalsRedraw = artRedraw = wsnRedraw = capRedraw = () => { if (body.isConnected && body.querySelector('.pw')) redraw(); };
|
|
848
|
+
body.__pwcur = cur; body.__pwredraw = redraw; // ⋯ acts on the popup drawn now (capItems)
|
|
822
849
|
wireGrip(body);
|
|
823
850
|
// a phone: a proposal swiped right says yes, left says no (its own hidden Yes and No presses, so the popup's writes and Undo stay theirs)
|
|
824
851
|
wireSwipe(body, { on: phone, act: (row, way) => { const b = row.querySelector(way === 'right' ? '[data-sw-yes]' : '[data-sw-no]'); if (b) b.click(); } });
|
|
@@ -835,9 +862,10 @@ export function wire(body, h0, x0) {
|
|
|
835
862
|
if (body.__pwQuiet && Date.now() - body.__pwQuiet < 700) { e.preventDefault(); e.stopPropagation(); body.__pwQuiet = 0; return; }
|
|
836
863
|
// select several rows (WorkBulkDS): Cmd or Ctrl-click adds one, Shift-click a range; with rows picked, a click adds or takes out one
|
|
837
864
|
{ const rw = e.target.closest('[data-pw-row]'), c0 = rw && !e.target.closest('a, input, textarea, [data-pw-tick], [data-pw-sub], [data-pw-row-more], .acts') ? cur() : null;
|
|
838
|
-
|
|
865
|
+
// while an action of the toolbar waits for rows (popup cap), a plain click picks one
|
|
866
|
+
if (rw && c0 && !RO && (e.shiftKey || e.metaKey || e.ctrlKey || c0.S.sel.size || c0.S.act)) {
|
|
839
867
|
const order = [...body.querySelectorAll('[data-pw-row]')].map((el) => el.dataset.pwRow);
|
|
840
|
-
const pk = SEL.pick(c0.S.sel, order, rw.dataset.pwRow, { shift: e.shiftKey, meta: e.metaKey || e.ctrlKey, anchor: c0.S.anchor });
|
|
868
|
+
const pk = SEL.pick(c0.S.sel, order, rw.dataset.pwRow, { shift: e.shiftKey, meta: e.metaKey || e.ctrlKey, touch: !!c0.S.act, anchor: c0.S.anchor });
|
|
841
869
|
if (pk) { e.preventDefault(); c0.S.sel = pk.sel; c0.S.anchor = pk.anchor; redraw(); return; }
|
|
842
870
|
} }
|
|
843
871
|
const b = e.target.closest('button, [data-pw-line]');
|
|
@@ -892,6 +920,9 @@ export function wire(body, h0, x0) {
|
|
|
892
920
|
if ('pwCritDrop' in d) { const dd = dropped(); dd.add('crit:' + c.id); store.set(DROP, [...dd].slice(-200)); redraw(); return; }
|
|
893
921
|
if ('pwEpicDrop' in d) { const dd = dropped(); dd.add('epic:' + c.id); store.set(DROP, [...dd].slice(-200)); redraw(); return; }
|
|
894
922
|
if (d.wsOp) { await bulkPress(b, d.wsOp, c, h, x); return; }
|
|
923
|
+
// the popup cap (PopupCapDS): the toolbar's four, and the picker a waiting action opens once rows are picked
|
|
924
|
+
if (d.pwAct) { noteUse('pop-' + d.pwAct); await capPress(b, d.pwAct, c, h, x, redraw); return; }
|
|
925
|
+
if (d.pwActGo) { await capGo(b, d.pwActGo, c, h, x); return; }
|
|
895
926
|
// the follow-ups (work-subtasks-followups): the Source filter, the ✦ grouping (✓ makes the parents, ✕ hides it)
|
|
896
927
|
if ('pwSrcMenu' in d) { srcMenu(b, c, x, h); return; }
|
|
897
928
|
if (d.pwGroup) { b.disabled = true; await applyGroup(b, c, h, x); return; }
|
|
@@ -917,7 +948,7 @@ export function wire(body, h0, x0) {
|
|
|
917
948
|
body.addEventListener('keydown', async (e) => {
|
|
918
949
|
if (!live(e)) return;
|
|
919
950
|
const t = e.target, h = body.__pwh;
|
|
920
|
-
if (e.key === 'Escape') { const c0 = cur(); if (c0 && (c0.S.sel.size || c0.S.tickAsk)) { e.preventDefault(); c0.S.sel.clear(); c0.S.tickAsk = ''; redraw(); return; } }
|
|
951
|
+
if (e.key === 'Escape') { const c0 = cur(); if (c0 && (c0.S.sel.size || c0.S.tickAsk || c0.S.act)) { e.preventDefault(); c0.S.sel.clear(); c0.S.tickAsk = ''; c0.S.act = ''; redraw(); return; } }
|
|
921
952
|
if (t.matches && t.matches('[data-pw-line]') && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); t.click(); return; }
|
|
922
953
|
// the List's one capture Input (work-ds-popup): the task goes to the stage it names ("… in Plan"), else the stage in progress
|
|
923
954
|
if (t.matches && t.matches('[data-pw-cap]') && e.key === 'Enter') {
|
|
@@ -1132,12 +1163,19 @@ function rowMenu(btn, uid, c, h, body) {
|
|
|
1132
1163
|
openPop(btn, 'pw-rowm', `<button type="button" class="hi-mi" role="menuitem" data-k="status">${SVG(P.box, 14, 2)} Status: ${esc(row.status || 'To do')}</button>`
|
|
1133
1164
|
+ `<button type="button" class="hi-mi" role="menuitem" data-k="kind">${SVG(row.ms ? P.box : P.dia, 14, 2)} ${row.ms ? 'Make it a task' : 'Make it a milestone'}</button>`
|
|
1134
1165
|
+ `<button type="button" class="hi-mi" role="menuitem" data-k="open">${SVG(P.open, 14)} Open the task</button>`
|
|
1166
|
+
// the row's hover shows Who, Date and More only (PopupCapDS): Stage, Sprint and Priority are here; Jira keeps its tickets' own
|
|
1167
|
+
+ (row.jira ? '' : `<button type="button" class="hi-mi" role="menuitem" data-k="stage" aria-haspopup="menu">${SVG(PD.I.stage, 14)} Stage</button>`)
|
|
1168
|
+
+ (row.jira || row.done ? '' : `<button type="button" class="hi-mi" role="menuitem" data-k="sprint" aria-haspopup="menu">${SVG(PD.I.sprint, 14)} Sprint${row.sprint ? ': ' + esc(row.sprint) : ''}</button>`
|
|
1169
|
+
+ `<button type="button" class="hi-mi" role="menuitem" data-k="prio" aria-haspopup="menu">${SVG(PD.I.flag, 14)} Priority: ${esc(row.priority || 'none')}</button>`)
|
|
1135
1170
|
// subtasks (WorkSubtasksDS): make it a subtask of another task, or move it out of its parent
|
|
1136
1171
|
+ (row.jsub ? '' : `<button type="button" class="hi-mi" role="menuitem" data-k="under" aria-haspopup="menu">${SVG(P.right, 14)} Make subtask of…</button>`)
|
|
1137
1172
|
+ (row.up && !row.jsub ? `<button type="button" class="hi-mi" role="menuitem" data-k="out">${SVG(P.show, 14)} Move out of ${esc(((c.W.rows.find((q) => q.uid === row.up) || {}).title) || 'its parent')}</button>` : '')
|
|
1138
1173
|
+ (row.jira ? '<p class="hi-small pw-jn">Status moves in Jira. Dates and kind are PMOS only.</p>' : ''), (b) => {
|
|
1139
1174
|
const k = b.dataset.k;
|
|
1140
1175
|
if (k === 'under') { parentMenu(btn, [uid], c, h, body.__pwx); return; }
|
|
1176
|
+
if (k === 'stage') { stageMenu(btn, uid, c, h, body.__pwx); return; }
|
|
1177
|
+
if (k === 'sprint') { sprintMenu(btn, uid, c, h, body.__pwx); return; }
|
|
1178
|
+
if (k === 'prio') { prioMenu(btn, uid, c, h, body.__pwx); return; }
|
|
1141
1179
|
if (k === 'out') { closePop(); runBulk([uid], 'parent', '', c, h, body.__pwx); return; }
|
|
1142
1180
|
// Status opens its own list (and its "when did this happen" line) in place of this menu
|
|
1143
1181
|
if (k === 'status') { if (row.jira) jiraStatusMenu(btn, uid, h, c); else statusMenu(btn, uid, h, c); return; }
|
|
@@ -1151,7 +1189,7 @@ const atOf = (h, x) => { const o = (x && x.o && x.o()) || {}, w = h.where ? h.wh
|
|
|
1151
1189
|
/** One bulk write (POST /api/boards/tasks/bulk) with one Undo; the picked rows clear. */
|
|
1152
1190
|
async function runBulk(ids, op, value, c, h, x, label) {
|
|
1153
1191
|
const at = atOf(h, x);
|
|
1154
|
-
if (c && c.S) { c.S.sel.clear(); c.S.anchor = ''; }
|
|
1192
|
+
if (c && c.S) { c.S.sel.clear(); c.S.anchor = ''; c.S.act = ''; }
|
|
1155
1193
|
await SEL.bulk(pmPost, { ws: at.ws, board: at.board }, ids, op, value, { say: (m, u) => (u ? undoToast(m, u) : h.toast ? h.toast(m) : undoToast(m)), reload: async () => { if (h.reload) await h.reload(); else if (h.redraw) h.redraw(); } }, label);
|
|
1156
1194
|
}
|
|
1157
1195
|
/** The parents a task can go under: the other tasks of this work, not the picked ones and not under them. "A new parent…" and the top level. */
|
|
@@ -1208,10 +1246,78 @@ async function addUnder(un, all, c, h, x) {
|
|
|
1208
1246
|
undoToast(`Added under ${un.parentTitle}: ${un.title}.`, async () => { await pmPost('/api/boards/tasks/undo-add', { ws: at.ws, board: at.board, task: r.item.uid }).catch(() => null); if (h.reload) await h.reload(); });
|
|
1209
1247
|
if (h.reload) await h.reload();
|
|
1210
1248
|
}
|
|
1249
|
+
/* ── the popup cap (idea A498, PopupCapDS; pure parts in pm/pop-cap.js) ── */
|
|
1250
|
+
/** A toolbar press. Add goes to the List's capture field. Move the dates moves the picked rows, or every open task when none is picked. Who,
|
|
1251
|
+
* Set the date, Stage and Set the epic open their picker on the picked rows; with none picked they start picking ("Pick the tasks to change
|
|
1252
|
+
* · Esc to stop"), and the same press again stops. */
|
|
1253
|
+
async function capPress(btn, act, c, h, x, redraw) {
|
|
1254
|
+
const S = c.S;
|
|
1255
|
+
if (act === 'add') {
|
|
1256
|
+
S.act = ''; S.sel.clear(); S.anchor = '';
|
|
1257
|
+
if (store.get(VIEW, 'list') === 'gantt') store.set(VIEW, 'list');
|
|
1258
|
+
const doc = btn.ownerDocument || document;
|
|
1259
|
+
redraw(); setTimeout(() => { const f = doc.querySelector('.pw [data-pw-cap]'); if (f) f.focus(); }, 0);
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
if (act === 'shift') {
|
|
1263
|
+
if (S.sel.size) { await bulkPress(btn, 'shift', c, h, x); return; }
|
|
1264
|
+
const ids = stagesOf(c.r, c.v, { ...((x && x.o && x.o()) || {}), today: c.W.today, subAll: true }).filter((q) => q.kind === 'task' && !q.done && !q.jira).map((q) => String(q.uid));
|
|
1265
|
+
if (!ids.length) { (h.toast || undoToast)('No open task has dates to move.'); return; }
|
|
1266
|
+
await bulkPress(btn, 'shift', c, h, x, ids);
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
if (S.sel.size) { await capGo(btn, act, c, h, x); return; }
|
|
1270
|
+
S.act = S.act === act ? '' : act;
|
|
1271
|
+
redraw();
|
|
1272
|
+
}
|
|
1273
|
+
/** The picker for the picked rows: Who, Stage and Set the epic as the bar had them; Set the date is the day form for one task, Move the dates
|
|
1274
|
+
* for several. */
|
|
1275
|
+
async function capGo(btn, act, c, h, x) {
|
|
1276
|
+
const ids = [...c.S.sel];
|
|
1277
|
+
if (!ids.length) return;
|
|
1278
|
+
if (act === 'who') return bulkPress(btn, 'owner', c, h, x);
|
|
1279
|
+
if (act === 'stage') return bulkPress(btn, 'section', c, h, x);
|
|
1280
|
+
if (act === 'epic') return bulkPress(btn, 'epic', c, h, x);
|
|
1281
|
+
if (act === 'date') {
|
|
1282
|
+
if (ids.length > 1) return bulkPress(btn, 'shift', c, h, x);
|
|
1283
|
+
c.S.act = ''; c.S.sel.clear(); c.S.anchor = '';
|
|
1284
|
+
return dateMenu(btn, ids[0], c, h, x);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
/** ⋯ under the cap (PopupCapDS): Plan, View and Jira, with a head line each; an action that does not apply is not there (CAP.moreGroups). A
|
|
1288
|
+
* phone has no View group: it has no Gantt. */
|
|
1289
|
+
function capItems(body, hh) {
|
|
1290
|
+
if (RO || !body || !body.__pwcur || !body.querySelector || !body.querySelector('.pw') || body.querySelector('[data-pw-level]')) return [];
|
|
1291
|
+
const c = body.__pwcur(); if (!c) return [];
|
|
1292
|
+
const x = body.__pwx, h = body.__pwh || {}, redraw = body.__pwredraw || (() => {}), S = c.S, desk = !!body.querySelector('.pw.pwd');
|
|
1293
|
+
const o = (x && x.o && x.o()) || {}, all = stagesOf(c.r, c.v, { ...o, today: c.W.today, subAll: true });
|
|
1294
|
+
const picked = all.filter((q) => q.kind === 'task' && S.sel.has(String(q.uid))), one = picked.length === 1 ? picked[0] : null;
|
|
1295
|
+
const epics = (c.r.epics || []).filter(Boolean), cnt = WT.sourceCounts(stagesOf(c.r, c.v, { ...o, today: c.W.today }, S), epics);
|
|
1296
|
+
const gantt = store.get(VIEW, 'list') === 'gantt';
|
|
1297
|
+
const G = CAP.moreGroups({ picked: picked.length > 0, one: !!one, oneJira: !!(one && one.jira && !one.jsub), allJira: picked.length > 0 && WT.allJira(all, S.sel),
|
|
1298
|
+
oneOpen: !!(one && !one.done && !one.jira), view: gantt ? 'gantt' : 'list', src: !!PD.sourceHtml(cnt, S.src || 'all'), tl: cols().tl }).filter((g) => desk || g.group !== 'View');
|
|
1299
|
+
const run = async (act, a) => {
|
|
1300
|
+
noteUse('pop-' + act);
|
|
1301
|
+
if (act === 'shift') return capPress(a, 'shift', c, h, x, redraw);
|
|
1302
|
+
if (act === 'epic' || act === 'parent' || act === 'done') return bulkPress(a, act, c, h, x);
|
|
1303
|
+
if (act === 'sprint' && one) return sprintMenu(a, String(one.uid), c, h, x);
|
|
1304
|
+
if (act === 'prio' && one) return prioMenu(a, String(one.uid), c, h, x);
|
|
1305
|
+
if (act === 'jira' && one) return jiraStatusMenu(a, String(one.uid), h, c);
|
|
1306
|
+
if (act === 'view') { store.set(VIEW, gantt ? 'list' : 'gantt'); return redraw(); }
|
|
1307
|
+
if (act === 'cols') return tuneMenu(a, 'wbs', redraw);
|
|
1308
|
+
if (act === 'span') return spanMenu(a, redraw);
|
|
1309
|
+
if (act === 'big') return big(c, x, h);
|
|
1310
|
+
if (act === 'src') return srcMenu(a, c, x, h);
|
|
1311
|
+
if (act === 'parts') { if (hh && hh.allParts) hh.allParts(); }
|
|
1312
|
+
};
|
|
1313
|
+
const out = [];
|
|
1314
|
+
for (const g of G) { out.push({ head: g.group }); for (const it of g.items) out.push({ label: it.label, icon: it.icon, on: (a) => { run(it.act, a); } }); }
|
|
1315
|
+
return out.length ? out.concat({ sep: true }) : out;
|
|
1316
|
+
}
|
|
1211
1317
|
/** The bar's presses (WorkBulkDS): under a parent, stage, who, move dates, done, clear. */
|
|
1212
|
-
async function bulkPress(btn, op, c, h, x) {
|
|
1213
|
-
const S = c.S, ids = [...S.sel];
|
|
1214
|
-
if (op === 'clear') { S.sel.clear(); S.anchor = ''; if (h.redraw) h.redraw(); return; }
|
|
1318
|
+
async function bulkPress(btn, op, c, h, x, ids0) {
|
|
1319
|
+
const S = c.S, ids = ids0 || [...S.sel];
|
|
1320
|
+
if (op === 'clear') { S.sel.clear(); S.anchor = ''; S.act = ''; if (h.redraw) h.redraw(); return; }
|
|
1215
1321
|
if (!ids.length) return;
|
|
1216
1322
|
if (op === 'done') { await runBulk(ids, 'done', null, c, h, x); return; }
|
|
1217
1323
|
if (op === 'parent') { parentMenu(btn, ids, c, h, x); return; }
|
|
@@ -1585,8 +1691,9 @@ async function addArt(x, h) {
|
|
|
1585
1691
|
/** The ⋯ entries the popup adds before the host's own: the initiative's Artefacts first (desk layout only; a phone lists them in the page),
|
|
1586
1692
|
* every part of the old page, as a drill-in, and every suggestion. body: the popup body the host drew into (it carries the wired handlers). */
|
|
1587
1693
|
export function moreItems(x, h, body) {
|
|
1588
|
-
|
|
1589
|
-
|
|
1694
|
+
// under the popup cap (PopupCapDS) Plan, View and Jira come first; View holds Every part
|
|
1695
|
+
const cap = capItems(body, h), out = cap.concat(artItems(body));
|
|
1696
|
+
if (h.allParts && !cap.some((it) => it.label === 'Every part')) out.push({ label: 'Every part', on: () => h.allParts() });
|
|
1590
1697
|
if (h.props) out.push({ label: 'Everything PMOS suggests', on: () => h.props() });
|
|
1591
1698
|
return out.length ? out.concat({ sep: true }) : out;
|
|
1592
1699
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* pm/pop-cap.js — the work popup shows five actions at most (popup-cap, idea A498; boards PopupCapDS and PopupStatusPhone, agreed
|
|
2
|
+
* 2026-11-24; brief design-system/popup-cap/brief.md). PURE: strings and lists, no DOM and no reads. pm/cozy-pop-work.js draws it and wires
|
|
3
|
+
* its presses; pm/use-log.js notes each press as `pop-<action>`.
|
|
4
|
+
*
|
|
5
|
+
* THE CAP Ask PMOS (in the popup's header) and the four actions of the toolbar: five. Back and Close move you; they are not actions.
|
|
6
|
+
* The ⋯ (More actions) holds the rest, grouped Plan, View and Jira. Keys (Ctrl K, the action keys) still reach every action.
|
|
7
|
+
* ACTIONS the toolbar's candidates: add, who, date, stage, shift, epic. DEFAULT: add, who, date, stage.
|
|
8
|
+
* four(counts, span) → the four ids: the ones used most in the last 30 days; while there are fewer than 30 days of use, DEFAULT
|
|
9
|
+
* due(saved, now) → true when the four are worked out again: none saved, or saved a week or more ago
|
|
10
|
+
* toolbarHtml(ids, o) → the toolbar: the four icon buttons (data-pw-act). o: { picked, jiraPicked }
|
|
11
|
+
* pickLineHtml(act, n) → the line while picking: "Pick the tasks to change · Esc to stop", then "Who for 2 tasks" with its button
|
|
12
|
+
* moreGroups(o) → [{ group, items: [{ act, label, icon }] }] for ⋯. Plan and Jira only while rows are picked (Move the
|
|
13
|
+
* dates always: with nothing picked it moves every open task); View always. o: { picked, one, oneJira,
|
|
14
|
+
* allJira, oneOpen, view, src, tl }. An action that does not apply is not there.
|
|
15
|
+
* countActions(html) → the visible actions a block's markup holds (data-pw-act and the old head tools); the guard test fails above
|
|
16
|
+
* five with the header's Ask PMOS
|
|
17
|
+
* ROW_MAX → a row's hover shows at most three: Who, Date, More
|
|
18
|
+
* The UI says PMOS, never Claude. Icon buttons carry aria-label. */
|
|
19
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
20
|
+
const SV = (d, w = 16) => `<svg class="pm-ic" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
21
|
+
|
|
22
|
+
export const MAX = 5; // Ask PMOS plus the four
|
|
23
|
+
export const ROW_MAX = 3; // Who, Date, More
|
|
24
|
+
export const SPAN_DAYS = 30; // the use that picks the four
|
|
25
|
+
export const WEEK = 7 * 864e5;
|
|
26
|
+
export const IC = {
|
|
27
|
+
plus: 'M12 5v14M5 12h14', who: 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM5 20a7 7 0 0 1 14 0', cal: 'M5 6h14v14H5zM5 10h14M9 4v4M15 4v4',
|
|
28
|
+
stage: 'M5 7h14M5 12h10M5 17h6', shift: 'M4 12h14M14 8l4 4-4 4', epic: 'M13 3L5 14h6l-1 7 8-11h-6z',
|
|
29
|
+
sprint: 'M4 12h11M11 8l4 4-4 4M19 6v12', flag: 'M6 21V4M6 4h11l-2 4 2 4H6', gantt: 'M4 6h9M8 12h10M6 18h7', cols: 'M4 5h16v14H4zM9 5v14M15 5v14',
|
|
30
|
+
span: 'M4 12h16M4 8v8M20 8v8', parts: 'M5 7h14M5 12h14M5 17h14', jira: 'M12 3l9 9-9 9-9-9zM12 8l4 4-4 4-4-4z', full: 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5',
|
|
31
|
+
tree: 'M6 5v14M6 12h8M6 19h8', done: 'M5 12.5l4.5 4.5L19 7.5', src: 'M4 6h16l-6 7v5l-4 2v-7z',
|
|
32
|
+
};
|
|
33
|
+
/** The toolbar's candidates, in the order the default and a tie keep. `pick: true` acts on picked rows (with none picked it starts picking). */
|
|
34
|
+
export const ACTIONS = Object.freeze({
|
|
35
|
+
add: { label: 'Add a task or milestone', icon: IC.plus },
|
|
36
|
+
who: { label: 'Who', icon: IC.who, pick: true, say: 'Who' },
|
|
37
|
+
date: { label: 'Set the date', icon: IC.cal, pick: true, say: 'Dates' },
|
|
38
|
+
stage: { label: 'Stage', icon: IC.stage, pick: true, say: 'Stage' },
|
|
39
|
+
shift: { label: 'Move the dates', icon: IC.shift, say: 'Move the dates' },
|
|
40
|
+
epic: { label: 'Set the epic', icon: IC.epic, pick: true, say: 'Epic', jira: true },
|
|
41
|
+
});
|
|
42
|
+
export const DEFAULT = Object.freeze(['add', 'who', 'date', 'stage']);
|
|
43
|
+
const ORDER = Object.keys(ACTIONS);
|
|
44
|
+
|
|
45
|
+
/** The four toolbar ids. counts: { 'pop-who': 12, … } (or { who: 12 }); span: days of use the log holds. */
|
|
46
|
+
export function four(counts, span) {
|
|
47
|
+
if (!(Number(span) >= SPAN_DAYS) || !counts) return [...DEFAULT];
|
|
48
|
+
const n = (k) => Number(counts['pop-' + k] != null ? counts['pop-' + k] : counts[k]) || 0;
|
|
49
|
+
const used = ORDER.filter((k) => n(k) > 0).sort((a, b) => n(b) - n(a) || ORDER.indexOf(a) - ORDER.indexOf(b));
|
|
50
|
+
const out = used.slice(0, 4);
|
|
51
|
+
for (const k of DEFAULT) if (out.length < 4 && !out.includes(k)) out.push(k);
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/** Work the four out again? None saved, a saved list that is not four known ids, or saved a week or more ago. */
|
|
55
|
+
export function due(saved, now = Date.now()) {
|
|
56
|
+
if (!saved || !Array.isArray(saved.ids) || saved.ids.length !== 4 || !saved.ids.every((k) => ACTIONS[k])) return true;
|
|
57
|
+
const at = Date.parse(saved.at || '');
|
|
58
|
+
return !(at > 0) || now - at >= WEEK;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The toolbar. An action that cannot apply here is left out (Set the epic with no Jira row picked), so it can hold fewer than four. */
|
|
62
|
+
export function toolbarHtml(ids, o = {}) {
|
|
63
|
+
const L = (ids || []).filter((k) => ACTIONS[k] && !(ACTIONS[k].jira && !o.jiraPicked)).slice(0, 4);
|
|
64
|
+
if (!L.length) return '';
|
|
65
|
+
return `<div class="pm-row pwd-tb" role="toolbar" aria-label="Actions">${L.map((k) => {
|
|
66
|
+
const A = ACTIONS[k], lab = o.picked && A.pick ? A.label + ' for the picked tasks' : A.label;
|
|
67
|
+
return `<button type="button" class="pm-btn pwd-act" data-pw-act="${k}" aria-label="${esc(lab)}" title="${esc(lab)}">${SV(A.icon)}</button>`;
|
|
68
|
+
}).join('')}</div>`;
|
|
69
|
+
}
|
|
70
|
+
/** The line while picking. No row yet: what to do and how to stop. Rows picked: "Who for 2 tasks" and the button that opens the picker. */
|
|
71
|
+
export function pickLineHtml(act, n) {
|
|
72
|
+
const A = ACTIONS[act];
|
|
73
|
+
if (!A) return '';
|
|
74
|
+
if (!n) return `<p class="pm-meta pwd-pick" role="status">Pick the tasks to change · Esc to stop</p>`;
|
|
75
|
+
const what = `${A.say} for ${n} ${n === 1 ? 'task' : 'tasks'}`;
|
|
76
|
+
return `<p class="pwd-pick" role="status"><button type="button" class="pm-btn primary" data-pw-act-go="${act}" aria-haspopup="menu">${esc(what)}</button></p>`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** The ⋯ groups. Zero is silence: an action that does not apply is left out, and so is a group with nothing in it. */
|
|
80
|
+
export function moreGroups(o = {}) {
|
|
81
|
+
const it = (act, label, icon) => ({ act, label, icon });
|
|
82
|
+
const plan = [it('shift', o.picked ? 'Move the dates' : 'Move the dates of every open task', IC.shift)];
|
|
83
|
+
if (o.picked) {
|
|
84
|
+
if (o.allJira) plan.push(it('epic', 'Set the epic', IC.epic));
|
|
85
|
+
if (o.one && o.oneOpen) plan.push(it('sprint', 'Sprint', IC.sprint), it('prio', 'Priority', IC.flag));
|
|
86
|
+
plan.push(it('parent', 'Under a parent', IC.tree), it('done', 'Mark them done', IC.done));
|
|
87
|
+
}
|
|
88
|
+
const view = [it('view', o.view === 'gantt' ? 'List' : 'Gantt', IC.gantt)];
|
|
89
|
+
if (o.view === 'gantt') view.push(it('cols', 'Columns', IC.cols), ...(o.tl ? [it('span', 'Span of the timeline', IC.span)] : []), it('big', 'The whole popup', IC.full));
|
|
90
|
+
if (o.src) view.push(it('src', 'Source', IC.src));
|
|
91
|
+
view.push(it('parts', 'Every part', IC.parts));
|
|
92
|
+
const jira = o.picked && o.one && o.oneJira ? [it('jira', 'Status in Jira', IC.jira)] : [];
|
|
93
|
+
return [{ group: 'Plan', items: plan }, { group: 'View', items: view }, { group: 'Jira', items: jira }].filter((g) => g.items.length);
|
|
94
|
+
}
|
|
95
|
+
export const iconOf = (d, w = 14) => SV(d, w);
|
|
96
|
+
|
|
97
|
+
/** The visible actions a block's markup holds: the toolbar's buttons and any head tool the cap moved under ⋯ (List or Gantt, Span,
|
|
98
|
+
* The whole popup, Columns, Show the timeline, Source). The header's Ask PMOS is the fifth. A row's own buttons are not counted here. */
|
|
99
|
+
export function countActions(html) {
|
|
100
|
+
const s = String(html || '');
|
|
101
|
+
const re = /<button\b[^>]*\b(data-pw-act|data-pwv|data-pw-span|data-pw-big|data-pw-tune|data-pw-tl|data-pw-src-menu|data-ws-op="(?!clear)[^"]*")[^>]*>/g;
|
|
102
|
+
return (s.match(re) || []).length;
|
|
103
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "decisions-come-back (bet A509): each journal decision gets a threshold and a review trigger (date or goal number), drafted from its evidence, and comes back on Today with Keep, Change and Undo (lib/decision-journal.js comeBack, lib/decision-journal-needs.js decision-back).",
|
|
3
|
+
"modules": ["decisions-come-back.test.js"],
|
|
4
|
+
"seconds": { "decisions-come-back.test.js": 2 }
|
|
5
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "The work popup shows five actions at most (popup-cap, idea A498, done test planning/done-tests/popup-cap.md C1-C6): the count guard on the popup drawn as a string, the four from 30 days of use, picking, the grouped ⋯, the row's three, the use-log fold and the preference key. No server, network or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"pop-cap.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"pop-cap.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|