create-pmos 0.828.0 → 0.829.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 +140 -22
- 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/board-deliveries-test.js +2 -2
- package/workspace/changelog.json +139 -8
- package/workspace/guide/cli.md +34 -1
- package/workspace/guide/home.md +1 -0
- package/workspace/guide/settings-and-switches.md +1 -0
- package/workspace/lib/board-premium.js +1 -0
- package/workspace/lib/critical-needs.js +162 -0
- package/workspace/lib/deps-cli.js +102 -0
- package/workspace/lib/engine/boards.js +13 -2
- package/workspace/lib/features.json +3 -0
- package/workspace/lib/needs-providers.js +1 -0
- package/workspace/lib/page-one-answer.js +86 -0
- package/workspace/lib/pages-cli.js +6 -2
- package/workspace/lib/pmos-verbs.js +8 -0
- package/workspace/lib/prototype-cli.js +86 -0
- package/workspace/lib/report-cli.js +12 -2
- package/workspace/lib/report-readers.js +5 -3
- package/workspace/lib/review-pack.js +348 -0
- package/workspace/lib/route-modules.js +4 -0
- package/workspace/lib/routes-boards.js +25 -2
- package/workspace/lib/routes-review-pack.js +42 -0
- package/workspace/lib/routes-roadmap-ops.js +53 -1
- package/workspace/lib/routes-sim-users.js +66 -0
- package/workspace/lib/routes-team-waits.js +24 -0
- package/workspace/lib/sim-users.js +329 -0
- package/workspace/lib/task-store.js +1 -1
- package/workspace/lib/team-waits.js +167 -0
- package/workspace/lib/tradeoff-cards.js +258 -0
- package/workspace/lib/tradeoff-cli.js +83 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-backlog.js +44 -6
- package/workspace/public/pm/cozy-library.css +5 -0
- package/workspace/public/pm/cozy-pop-work.js +2 -1
- package/workspace/public/pm/cozy-proto.css +5 -0
- package/workspace/public/pm/cozy-proto.js +11 -3
- package/workspace/public/pm/cozy-today-app.js +5 -2
- package/workspace/public/pm/day-time.js +8 -0
- package/workspace/public/pm/home-ini.js +3 -2
- package/workspace/public/pm/ini-links.js +2 -1
- package/workspace/public/pm/ini-tasks.js +5 -2
- package/workspace/public/pm/ini-view-model.js +14 -6
- package/workspace/public/pm/ini-view.js +12 -2
- package/workspace/public/pm/library-model.js +1 -1
- package/workspace/public/pm/page-one-answer.css +18 -0
- package/workspace/public/pm/page-one-answer.js +134 -0
- package/workspace/public/pm/pop-work-model.js +8 -6
- package/workspace/public/pm/portfolio.js +1 -1
- package/workspace/public/pm/premium-board.js +19 -6
- package/workspace/public/pm/premium-library.js +27 -3
- package/workspace/public/pm/range-pick.css +12 -0
- package/workspace/public/pm/range-pick.js +30 -6
- package/workspace/public/pm/review-pack.js +47 -0
- package/workspace/public/pm/sim-users.js +34 -0
- package/workspace/public/pm/sort-order.js +3 -0
- package/workspace/public/pm/task-card.js +10 -7
- package/workspace/public/pm/team-waits.js +56 -0
- package/workspace/public/pm/tradeoff-cards.css +27 -0
- package/workspace/public/pm/tradeoff-cards.js +183 -0
- package/workspace/public/premium-board.html +1 -0
- package/workspace/public/today.html +1 -0
- package/workspace/run-tests.js +9 -1
- package/workspace/test-lists/critical-needs.json +9 -0
- package/workspace/test-lists/page-one-answer.json +9 -0
- package/workspace/test-lists/review-pack.json +9 -0
- package/workspace/test-lists/sim-users.json +9 -0
- package/workspace/test-lists/task-time-optional.json +9 -0
- package/workspace/test-lists/team-waits.json +9 -0
- package/workspace/test-lists/tradeoff-cards.json +9 -0
- package/workspace/test-timings.json +25 -0
|
@@ -1227,7 +1227,8 @@ function dateMenu(btn, uid, c, h, x) {
|
|
|
1227
1227
|
// "end of sprint" typed in a field (bet A488): the task's own sprint, else the active one, from the board's open sprints (the Sprint menu's read)
|
|
1228
1228
|
let sprintEnd = '';
|
|
1229
1229
|
sprintsOf(c, h, x).then((L) => { const C = IF.sprintChoices(L, c.W.today), cur = C.find((q) => row.sprint && q.name === String(row.sprint)) || C.find((q) => q.state === 'active'); sprintEnd = cur ? cur.end : ''; }).catch(() => {});
|
|
1230
|
-
|
|
1230
|
+
// the optional time (task-time-optional): offered for a PMOS task, never a Jira ticket's
|
|
1231
|
+
mountRange(el.querySelector('.pw-rp'), { ...R, time: !row.jira, start_time: row.start_time || '', due_time: row.due_time || '', sprintEnd: () => sprintEnd, onPick: (patch, done) => { if (done) closePop(); if (h.dates) h.dates(uid, patch); } }).focus();
|
|
1231
1232
|
}
|
|
1232
1233
|
function rowMenu(btn, uid, c, h, body) {
|
|
1233
1234
|
const row = c.W.rows.find((x) => x.uid === uid) || {};
|
|
@@ -75,6 +75,11 @@
|
|
|
75
75
|
.pc-bar2 { display: block; height: 4px; border-radius: 2px; background: var(--cz-well); overflow: hidden; }
|
|
76
76
|
.pc-bar2 i { display: block; height: 100%; background: var(--cz-blue); transition: width .4s ease; }
|
|
77
77
|
.pc-fixed { margin: 0 0 var(--space-8); font-size: var(--fs-meta); color: var(--cz-ink2); }
|
|
78
|
+
/* Findings (initiative sim-users, pm/sim-users.js): the system's pm-block list; a finding is a press that shows its screen */
|
|
79
|
+
.pc-finds { margin: 0 0 var(--space-8); }
|
|
80
|
+
.pc-finds .pm-li { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
|
|
81
|
+
.pc-finds .pm-li:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
|
|
82
|
+
.pc-finds .pm-li .t { white-space: normal; }
|
|
78
83
|
.pc-lost { display: block; color: var(--cz-ink2); padding: var(--space-8) 10px; border-radius: 8px; background: var(--cz-well); margin-bottom: var(--space-8); }
|
|
79
84
|
@keyframes pcPulse { 50% { opacity: 1; } }
|
|
80
85
|
@media (prefers-reduced-motion: reduce) { .pc-making i { animation: none; opacity: .7; } }
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* on the prototype, a branch plays its scenario); the page copy, in its side panel (copy.json, edited in place: the prototype changes as the PM types and
|
|
17
17
|
* the edit is kept with the version, POST /api/lab/edit); who does what (lanes.json as a swimlane with arrows: a step shows its screen).
|
|
18
18
|
* A card the version changed says Updated (compare.updated).
|
|
19
|
+
* Findings (initiative sim-users): above the design, where the simulated users got stuck (pm/sim-users.js); a finding shows its screen.
|
|
19
20
|
* Three ways (a round with several versions): a tray; a press previews one; ✓ keeps it, ✕ closes the round.
|
|
20
21
|
* Play: the prototype full size through a scenario of flow.json; a tap where the user would tap moves on, a miss shows the hotspots.
|
|
21
22
|
* The chat (pm/home-chat.js) hears 'pmos:point', 'pmos:from' and 'pmos:say' (window events, detail.ini names the initiative); it says
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
* openVersion({ ws, board?, ini, n }) shows version n of the initiative's newest round (the chat's Version n tag)
|
|
28
29
|
* flowLayout(flow) · lanesLayout(lanes) PURE: where the SVG puts each node and arrow (exported for the source check) */
|
|
29
30
|
import { pmGet, pmPost, pmHeaders } from './http.js';
|
|
31
|
+
import { findingsHtml, notePress, loadFindings } from './sim-users.js'; // Findings: simulated users walked it first (initiative sim-users)
|
|
30
32
|
|
|
31
33
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
32
34
|
const SVG = (d, w = 16, sw = 2) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
@@ -163,7 +165,7 @@ export function lanesLayout(lanes) {
|
|
|
163
165
|
* presses, closed by default; one shows at a time, in the inspector's place. The device switch is only for Play. */
|
|
164
166
|
const V = { body: null, box: null, c: null, at: null, H: null, last: null, mode: 'point', pdev: store.get('pmos.pc.pdev') || 'own', zoom: Number(store.get('pmos.pc.zoom')) || 0,
|
|
165
167
|
sel: null, looks: null, screen: '', frameUrl: '', ready: null, edits: { copy: {}, vars: {}, styles: {} }, pend: null, saveT: null, draft: null, drawing: false, strokes: 0,
|
|
166
|
-
play: null, sig: '', side: null, wide: store.get('pmos.pc.wide') === '1', left: store.get('pmos.pc.left') !== '0', insp: store.get('pmos.pc.insp') !== '0', noteT: null };
|
|
168
|
+
play: null, sig: '', finds: {}, side: null, wide: store.get('pmos.pc.wide') === '1', left: store.get('pmos.pc.left') !== '0', insp: store.get('pmos.pc.insp') !== '0', noteT: null };
|
|
167
169
|
const ARROW = '<marker id="pcArr" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="currentColor"/></marker>';
|
|
168
170
|
const frameUrl = (c) => (c && c.url ? c.url + '&rt=1' : '');
|
|
169
171
|
const toFrame = (m, f) => { const fr = f || (V.body && V.body.querySelector('.pc-frame iframe')); if (fr && fr.contentWindow) fr.contentWindow.postMessage({ pmos: 1, ...m }, '*'); };
|
|
@@ -238,7 +240,7 @@ function protoCard(c, v, making) {
|
|
|
238
240
|
const sug = suggestion(c);
|
|
239
241
|
const draw = V.mode === 'draw' ? `<canvas class="pc-ink" aria-label="Sketch over the prototype"></canvas><span class="pc-inkacts">${ib('data-pc-ink="attach"', 'Attach the sketch to your next message', I.attach, 'blue')}${ib('data-pc-ink="clear"', 'Clear the sketch', I.x)}</span>` : '';
|
|
240
242
|
const lost = c.notMade ? `<p class="pc-making pc-lost">Version ${c.round} was not made: ${esc(c.notMade)}.${c.fallbackN ? ` This is version ${c.fallbackN}.` : ''} Ask in the chat for it in smaller steps, one screen or format at a time.</p>` : '';
|
|
241
|
-
return { pre: lost + (making ? progressHtml(c) : checksHtml(c)), dev: `<div class="pc-frame" data-pc-frame>${v.url ? '' : '<p class="pc-none">PMOS is making it.</p>'}</div>${draw}`, post: sel + draft + list + sug };
|
|
243
|
+
return { pre: lost + (making ? progressHtml(c) : checksHtml(c) + findingsHtml(V.finds[v.file])), dev: `<div class="pc-frame" data-pc-frame>${v.url ? '' : '<p class="pc-none">PMOS is making it.</p>'}</div>${draw}`, post: sel + draft + list + sug };
|
|
242
244
|
}
|
|
243
245
|
/** The notes beside the design (notes.json): what the run wants the PM to know, kept off the screens (Wawan 2026-11-18). Only the notes for
|
|
244
246
|
* the screen shown and the ones for the whole prototype; none at all is silence. A note on a layer flashes it on the design. */
|
|
@@ -376,11 +378,16 @@ export function draw(body, c, o = {}) {
|
|
|
376
378
|
// a new version: its own edits, nothing pointed at
|
|
377
379
|
if (prevFile !== v.file) { const e = (v.data && v.data.edits) || {}; V.edits = { copy: { ...(e.copy || {}) }, vars: { ...(e.vars || {}) }, styles: { ...(e.styles || {}) } }; V.sel = null; V.looks = null; V.ready = null; }
|
|
378
380
|
V.c = c; V.v = v;
|
|
381
|
+
// Findings (initiative sim-users): read once per version, then drawn above the design; the canvas never waits on it
|
|
382
|
+
if (v.file && !(v.file in V.finds)) {
|
|
383
|
+
V.finds[v.file] = null;
|
|
384
|
+
loadFindings({ ws: (V.at || {}).ws, ini: c.ini, file: v.file }).then((f) => { if (!f) return; V.finds[v.file] = f; if (V.v && V.v.file === v.file && V.body) { V.sig = ''; draw(V.body, V.c); } });
|
|
385
|
+
}
|
|
379
386
|
let root = body.querySelector(':scope > .pc');
|
|
380
387
|
if (!root) { body.innerHTML = '<div class="pc"></div>'; root = body.querySelector('.pc'); wire(root); }
|
|
381
388
|
V.body = body;
|
|
382
389
|
// keep the frame (and what the PM typed) while the canvas reads again every 2 seconds
|
|
383
|
-
const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.progress, c.notMade, c.updated, c.parts, (c.comments || []).length, V.mode, V.sel && V.sel.el, V.looks, !!V.ready, V.screen, V.left, V.insp, V.side, V.wide, !!V.draft, (c.history || []).length, c.state]);
|
|
390
|
+
const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.progress, c.notMade, c.updated, c.parts, !!V.finds[v.file], (c.comments || []).length, V.mode, V.sel && V.sel.el, V.looks, !!V.ready, V.screen, V.left, V.insp, V.side, V.wide, !!V.draft, (c.history || []).length, c.state]);
|
|
384
391
|
const focus = document.activeElement && root.contains(document.activeElement) && document.activeElement.matches('[data-pc-copy],textarea,input,select');
|
|
385
392
|
if (sig === V.sig && root.firstChild) return;
|
|
386
393
|
if (focus && prevFile === v.file) return; // the PM is typing in this version: draw on a later read
|
|
@@ -492,6 +499,7 @@ function wire(root) {
|
|
|
492
499
|
if ('pcPlay' in d) { const sc = ((V.v.data || {}).flow || {}).scenarios || []; startPlay(sc.length ? sc[0].id : '', 0, true); return; }
|
|
493
500
|
if (d.pcFrom) { fire('pmos:from', { ini: V.c.ini, n: Number(d.pcFrom) }); say('The next change you send continues from version ' + d.pcFrom + '.'); return; }
|
|
494
501
|
if (d.pcNote) { toFrame({ t: 'hint', els: [d.pcNote] }); return; }
|
|
502
|
+
if ('pcFind' in d) notePress();
|
|
495
503
|
if (d.pcScreen) { V.screen = d.pcScreen; toFrame({ t: 'screen', id: d.pcScreen }); V.sig = ''; draw(V.body, V.c); return; }
|
|
496
504
|
if (d.pcScen) { startPlay(d.pcScen, 0, true); return; }
|
|
497
505
|
if ('pcStop' in d) { pmPost('/api/lab/stop', { ws: (V.at || {}).ws, run: d.pcStop }).then((r) => { if (!r || !r.ok) say((r && r.error) || 'It did not stop.'); }).catch(() => say('It did not stop.')); return; }
|
|
@@ -22,6 +22,7 @@ import { wireSwipe } from './cozy-phone-swipe.js';
|
|
|
22
22
|
let DG = null; // quiet-rows-digest: pm/digest-view.js, loaded on a Monday only (on other days Today loads nothing of the digest)
|
|
23
23
|
import { noteUse } from './use-log.js'; // your-move (A468): each press on a Your move row is one ym-act line in the local use log (its health number)
|
|
24
24
|
import * as QB from './quiet-batch.js'; // quiet-rows: Today's batch, the popup (Approve, Skip, Change it first; nothing sent without a press)
|
|
25
|
+
import * as PA from './page-one-answer.js'; // page-one-answer (A308): the one sentence that opens Today; Your move is its list
|
|
25
26
|
import * as CAP from './five-action-cap.js'; // five-action-cap (A529): a row shows two actions and ⋯; which two comes from the use log, once a week
|
|
26
27
|
import * as TO from './today-order.js'; // today-order (A310, board BatchMoreBDS panel 30): the same blocks in the day's order, and the pin
|
|
27
28
|
import * as NL from './cozy-name-links.js'; // name-links (A536): names in a line you typed link to the person, meeting or document, with a small card
|
|
@@ -347,7 +348,7 @@ export function mountToday(ctx) {
|
|
|
347
348
|
if (phone()) {
|
|
348
349
|
// PhoneTodayDS (job #1540): Where it stands, the log with All ⌄, the capture box at the foot, the ✦ proposal's sheet
|
|
349
350
|
if (X.sheet && !(O.suggest || []).some((x) => x.key === X.sheet)) X.sheet = '';
|
|
350
|
-
const html = TP.phonePageHtml(L, A, O, { ...ord, head: TM.headModel(ctx.now()), job: X.job, open: X.open, ymOpen: X.ymOpen, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
|
|
351
|
+
const html = PA.answerHtml(PA.todayAnswer(L), { list: false, page: 'today' }) + TP.phonePageHtml(L, A, O, { ...ord, head: TM.headModel(ctx.now()), job: X.job, open: X.open, ymOpen: X.ymOpen, sopen: [...X.sopen], filed: filedLine(), now: ctx.now(), draft, mic: !!SPEECH(), sheet: X.sheet });
|
|
351
352
|
if (html === X.html && el.firstChild) return;
|
|
352
353
|
X.html = html; el.classList.add('tdp');
|
|
353
354
|
document.body.classList.toggle('tdp-sheeton', !!X.sheet);
|
|
@@ -361,7 +362,9 @@ export function mountToday(ctx) {
|
|
|
361
362
|
if (html === X.html && el.firstChild) return;
|
|
362
363
|
X.html = html;
|
|
363
364
|
const st = el.parentNode ? el.parentNode.scrollTop : 0;
|
|
364
|
-
|
|
365
|
+
// page-one-answer (A308): the head, then the one sentence; Your move under it is what needs you, the rest folds below it
|
|
366
|
+
el.innerHTML = TP.headHtml(TM.headModel(ctx.now())) + PA.answerHtml(PA.todayAnswer(L), { list: false, page: 'today' }) + html;
|
|
367
|
+
if (X.read) PA.reportCalls('today', ctx.pmPost, el);
|
|
365
368
|
if (el.parentNode) el.parentNode.scrollTop = st;
|
|
366
369
|
const c2 = document.getElementById('tdCap'); if (c2 && focus) { c2.focus(); c2.setSelectionRange(c2.value.length, c2.value.length); }
|
|
367
370
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* pm/day-time.js — a task's optional time of day on its start and due (Wawan 2026-11-25: "Optionally can add time"). A time is "HH:MM",
|
|
2
|
+
* 24-hour, kept beside the day (start_time, due_time on the item; a task-time line on the ledger), never inside it: a day stays YYYY-MM-DD,
|
|
3
|
+
* so every page that reads a day reads it as before, and a task with no time looks exactly as it did.
|
|
4
|
+
*
|
|
5
|
+
* isTime(v) true for "00:00" to "23:59"
|
|
6
|
+
* withTime(text, t) a day's words with the time after them ("26 Nov 2026 09:30"), or the words alone with no time or no day */
|
|
7
|
+
export const isTime = (v) => /^([01]\d|2[0-3]):[0-5]\d$/.test(String(v || ''));
|
|
8
|
+
export const withTime = (text, t) => (text && isTime(t) ? text + ' ' + t : text || '');
|
|
@@ -394,9 +394,10 @@ async function setDates(id, uid, patch) {
|
|
|
394
394
|
const r = await C.pmPost('/api/boards/tasks/edit', { ...body, ...patch });
|
|
395
395
|
if (!r || r.ok === false) { undoToast(LE.notSaved(r), () => setDates(id, uid, patch), 12000, 'Try again'); return; }
|
|
396
396
|
await C.load(); redrawView();
|
|
397
|
-
const back = {}; for (const f of Object.keys(patch)) back[f] = f === 'milestone' ? (r.from && 'milestone' in r.from ? !!r.from.milestone : !patch.milestone) : k ? (f === 'due' ? k.end : k[f]) || '' : r.from && f in r.from ? r.from[f] || '' : ''; // a Jira ticket's days come back in from (batch 11 item 23)
|
|
397
|
+
const back = {}; for (const f of Object.keys(patch)) back[f] = /_time$/.test(f) ? (r.from && r.from[f]) || '' : f === 'milestone' ? (r.from && 'milestone' in r.from ? !!r.from.milestone : !patch.milestone) : k ? (f === 'due' ? k.end : k[f]) || '' : r.from && f in r.from ? r.from[f] || '' : ''; // a Jira ticket's days come back in from (batch 11 item 23)
|
|
398
398
|
if ('milestone' in patch) { undoToast((patch.milestone ? 'Milestone: ' : 'Not a milestone: ') + (k ? k.title : uid) + '.', async () => { const u = await C.pmPost('/api/boards/tasks/edit', { ...body, ...back }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); }); return; }
|
|
399
|
-
|
|
399
|
+
const tOnly = Object.keys(patch).every((f) => /_time$/.test(f)); // a time alone (task-time-optional) says so
|
|
400
|
+
if (k || (r.from && ('start' in r.from || 'due' in r.from))) undoToast((tOnly ? 'Time saved: ' : 'Dates saved: ') + (k ? k.title : uid + ', kept in PMOS') + '.', async () => { const u = await C.pmPost('/api/boards/tasks/edit', { ...body, ...back }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
|
|
400
401
|
else C.toast('Dates saved.');
|
|
401
402
|
}
|
|
402
403
|
/** ⋯ of the page: the ONE initiative menu (pm/ini-more.js; batch 16 item 5c: seven entries), the same words and order as the Board's panel.
|
|
@@ -504,7 +504,8 @@ export function wrap(H, idOf) {
|
|
|
504
504
|
const W = { ...H };
|
|
505
505
|
W.dates = (uid, patch) => {
|
|
506
506
|
const id = idOf(), lk = id && VIEWS.get(id);
|
|
507
|
-
|
|
507
|
+
// a time alone (task-time-optional) moves no day, so it is no linked move
|
|
508
|
+
if (lk && !/^dt:/.test(String(uid)) && lk.links.some((l) => l.from === uid || l.to === uid) && !('milestone' in patch) && ('start' in patch || 'due' in patch)) return ownMove(W, id, uid, patch);
|
|
508
509
|
return H.dates && H.dates(uid, patch);
|
|
509
510
|
};
|
|
510
511
|
return W;
|
|
@@ -212,7 +212,9 @@ const ttitle = (k) => `<button type="button" class="iv-tt" data-iv-ticket="${esc
|
|
|
212
212
|
export function dateBtn(x, o) {
|
|
213
213
|
if (!o.quick || !x.uid) return x.days ? `<span class="${x.late ? 'w' : ''}">${daysHtml(x)}</span>` : '';
|
|
214
214
|
const one = x.ms && !x.jira ? ' data-one="1"' : '';
|
|
215
|
-
|
|
215
|
+
// the optional time (task-time-optional): a PMOS task's own, not a Jira ticket's or a draft's
|
|
216
|
+
const tm = !x.jira && !x.jkey && !x.dr ? ` data-tm="1" data-st="${esc(x.start_time || '')}" data-dt="${esc(x.due_time || '')}"` : '';
|
|
217
|
+
const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" data-t="${esc(x.title)}"${one}${tm} title="${one ? 'The milestone\'s date' : x.jira || x.jkey ? 'Start and due, kept in PMOS. Jira is not changed' : 'Start and due'}"`;
|
|
216
218
|
// a milestone with no due date: a dashed chip asks for it, shown always (canvas XmlA6Suggest)
|
|
217
219
|
if (msNoDate(x)) return `<button type="button" class="iv-dc ms" ${a} aria-label="${esc('Set the due date: ' + x.title)}">${SVG(P.cal, 13)}Set the due date</button>`;
|
|
218
220
|
return x.days ? `<button type="button" class="iv-dc${x.late ? ' w' : ''}" ${a} aria-label="${esc((one ? 'Milestone date: ' : 'Dates: ') + x.days + '. Change')}">${daysHtml(x)}</button>`
|
|
@@ -671,7 +673,8 @@ export function datePop(anchor, uid, H) {
|
|
|
671
673
|
if (sheet) st.head = `<div class="ivd-h">${one ? SVG(P.dia, 15, 2.2) : SVG(P.cal, 15, 2)}<b>${one ? 'Date' : 'Dates'}</b><button type="button" class="iv-ib" data-ivd-x aria-label="Close" title="Close">${SVG('M6 6l12 12M18 6L6 18', 16, 2)}</button></div>`
|
|
672
674
|
+ (nm ? `<p class="ivd-s">${esc(nm + (one ? ' · one date: the milestone' : ''))}</p>` : '');
|
|
673
675
|
const el = openPop(anchor, datePickerHtml(t, st), (b) => { if ('ivdX' in b.dataset) closePop(); }, sheet ? { sheet: true } : {});
|
|
674
|
-
mountRange(el.querySelector('.tkc-dp'), { ...t, one, field: st.field, head: st.head,
|
|
676
|
+
mountRange(el.querySelector('.tkc-dp'), { ...t, one, field: st.field, head: st.head,
|
|
677
|
+
time: anchor.dataset.tm === '1', start_time: anchor.dataset.st || '', due_time: anchor.dataset.dt || '', onPick: (p, done) => { Object.assign(t, p); if (done) closePop(); if (H.dates) H.dates(uid, p); } });
|
|
675
678
|
el.querySelector('.rp-g [tabindex="0"]')?.focus({ preventScroll: true });
|
|
676
679
|
}
|
|
677
680
|
function menuPop(anchor, label, items, go) {
|
|
@@ -34,11 +34,13 @@
|
|
|
34
34
|
* 12 over the plan: the dates line turns amber with the days over; a skipped stage keeps its place, with its reason.
|
|
35
35
|
* 18 each section carries its dates: done stages when they ran, now from when to the plan end, later ones "Plan <date>", amber when missed.
|
|
36
36
|
* 19 a big section shows the 3 most urgent first, then folds the rest by the next WBS level, each with its count; done folds last. */
|
|
37
|
-
import { ticketGroups } from './tk-model.js';
|
|
37
|
+
import { ticketGroups } from './tk-model.js';
|
|
38
|
+
import { isTime, withTime } from './day-time.js'; // a task's optional time on its start and due (task-time-optional) // the drafted Jira tickets by epic (kit 2, T1): By epic's groups
|
|
38
39
|
|
|
39
40
|
import { stageSource } from './stage-chip.js'; // W1: what set the one stage, and when it was read
|
|
40
41
|
const endWord = (r) => (r && r.oneStage && ['shipped', 'on-hold', 'cancelled'].includes(r.oneStage.stage) ? r.oneStage.label : '');
|
|
41
|
-
import { lineOf } from './stage-line.js';
|
|
42
|
+
import { lineOf } from './stage-line.js';
|
|
43
|
+
import { iniAnswer } from './page-one-answer.js'; // page-one-answer (A308): the initiative opens with one sentence, what needs you, the rest folded // the stage card's one line (batch 11 item 21)
|
|
42
44
|
import { provenStatus, fromLine, NO_SIGNAL } from './status-proof.js'; // T3: a status renders only with its source and read time
|
|
43
45
|
|
|
44
46
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
@@ -126,11 +128,15 @@ const jDays = (k, today) => { const e = k.due || k.sprintEnd || ''; return k.sta
|
|
|
126
128
|
const jiraBucket = (st) => (/^(done|closed|resolved|released)$/i.test(String(st || '')) ? 'Done' : /progress|review|test|\bqa\b|doing|started|block/i.test(String(st || '')) ? 'In progress' : 'To do');
|
|
127
129
|
/** k: the task as stored; J: the Jira ticket its title names, when PMOS read that ticket (0.442.0 hotfix, Wawan 13:02 and 13:03). A linked task's
|
|
128
130
|
* status is the ticket's; its start and due stay the PM's, kept in PMOS: Jira's start and due show only while the task has none of its own. */
|
|
129
|
-
function rowOf(k0, today, J = null) {
|
|
131
|
+
export function rowOf(k0, today, J = null) {
|
|
130
132
|
const k = J ? { ...k0, status: jiraBucket(J.status), start: k0.start || J.start || '', end: k0.end || J.due || '' } : k0; // never the sprint's end: a task with no date shows none, and is not late (Wawan, 2026-11-19)
|
|
131
133
|
const closed = CLOSED.has(k.status), d = dayOf(k.end), late = !closed && !!d && d < today;
|
|
132
134
|
// start and end both (batch 7 item 6): "Oct 15 – Oct 28", one day once, "from Oct 15" with no end
|
|
133
|
-
|
|
135
|
+
// a time shows after its day only when one is set (task-time-optional); a PMOS task's own, never a Jira ticket's
|
|
136
|
+
const st = !J && isTime(k0.start_time) ? k0.start_time : '', dt = !J && isTime(k0.due_time) ? k0.due_time : '';
|
|
137
|
+
const sDay = withTime(dateY(k.start, today), st), dDay = withTime(dateY(k.end, today), dt);
|
|
138
|
+
const days = !st && !dt ? (k.start && k.end ? span(k.start, k.end, today) : k.start ? 'from ' + dateY(k.start, today) : d ? dateY(k.end, today) : '')
|
|
139
|
+
: k.start && k.end ? (k.start === k.end && !st ? dDay : sDay + ' – ' + dDay) : k.start ? 'from ' + sDay : d ? dDay : '';
|
|
134
140
|
const due = days ? days + (late ? ', ' + plural(between(d, today), 'day', 'days') + ' late' : '') : '';
|
|
135
141
|
const who = ownerName(k.owner);
|
|
136
142
|
// the List's meta draws the dates as their own press (batch 9 item 5b): days is the dates alone, lateText what follows them
|
|
@@ -138,7 +144,7 @@ function rowOf(k0, today, J = null) {
|
|
|
138
144
|
days, lateText: late ? plural(between(d, today), 'day', 'days') + ' late' : '', item: !!k.item, ms: !!k.milestone, // ms: the ◇ flag (batch 11 item 3)
|
|
139
145
|
start: k.start || '', end: k.end || '', since: k.since || '', owner: who, av: initials(k.owner),
|
|
140
146
|
// the open row's date chips (batch 18 item 16): each day alone; rank: the PM's order inside its stage (a task-order line)
|
|
141
|
-
startText: k.start ?
|
|
147
|
+
startText: k.start ? sDay : '', dueText: d ? dDay : '', ...(st && k.start ? { start_time: st } : {}), ...(dt && d ? { due_time: dt } : {}), rank: Number.isFinite(k.rank) ? k.rank : null,
|
|
142
148
|
sub: [k.status === 'In progress' ? 'In progress' : '', due, who && who !== 'You' ? who : ''].filter(Boolean).join(' · '), wbs: wbsOf(k.title), canCheck: !!k.uid && !k.draft && !J, order: k.order,
|
|
143
149
|
// planned versus actual (batch 11 item 8, pm/ini-versions.js): the compared version's days where they differ, ⊕ added after it, a draft's task
|
|
144
150
|
cmp: k.cmp || null, added: !!k.added, dr: !!k.draft,
|
|
@@ -362,7 +368,9 @@ export function iniView(r, ctx = {}) {
|
|
|
362
368
|
// split or merge (batch 11 item 14): Claude's suggestion for it, and where its work went when it was merged
|
|
363
369
|
suggest: r.suggest || null, merged: mergedOf(r),
|
|
364
370
|
// what Claude proposes under the one blue ✦, and what a ✓ kept from elsewhere (batch 12 items 2, 3 and 4; pm/ini-props.js)
|
|
365
|
-
props: r.props || null, found: r.found || null
|
|
371
|
+
props: r.props || null, found: r.found || null,
|
|
372
|
+
// page-one-answer (A308): what waits on you here, then your own open tasks that are late or due today; others' late tasks wait on others
|
|
373
|
+
answer: iniAnswer(rows, { wait: wait ? { title: wait.primary && wait.primary.label ? String(wait.primary.label).replace(/^✦\s*/, '') : 'Waits on you', sub: wait.text || '' } : null, today }) };
|
|
366
374
|
}
|
|
367
375
|
/** A merged initiative's closing line (XsmA7Closed): the one that stays and the day. null for every other row. */
|
|
368
376
|
export function mergedOf(r) {
|
|
@@ -47,6 +47,8 @@ import * as AB from './ini-about.js'; // About: the description and the succes
|
|
|
47
47
|
import { headerFlags } from './grill-words.js'; // the grill findings on the header (workspace grill W3)
|
|
48
48
|
import * as ED from './ini-edit.js'; // a task changed where it sits in the List: open in place, ⋯, + per stage, drag (batch 18 item 16)
|
|
49
49
|
import { ticks } from './ini-view-model.js'; // W1: a task group ticks only when every task in it is done
|
|
50
|
+
import * as PA from './page-one-answer.js';
|
|
51
|
+
import { pmPost } from './http.js'; // page-one-answer (A308): the answer block that opens the initiative
|
|
50
52
|
import * as IA from './ini-agent.js'; // agent-run (board AwB): the Experiment, Claude's work with Undo, Coming up; the D107 gate
|
|
51
53
|
|
|
52
54
|
const CSS = new URL('./ini-view.css', import.meta.url).href;
|
|
@@ -426,7 +428,9 @@ export function viewHtml(v, o = {}) {
|
|
|
426
428
|
// a merged initiative leads with where its work went, and draws no stage or tasks (they moved; its folds stay); an open one shows Claude's split or merge card under the summary (batch 11 item 14)
|
|
427
429
|
if (v.merged) return `<div class="iv" data-iv="${esc(v.id || v.key || '')}"><div class="iv-cols"><div class="iv-cl">${smMerged(v.merged)}</div><div class="iv-cr">${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
|
|
428
430
|
// One reading column: summary, milestones and proposals, then content-sized Tasks and document folds.
|
|
429
|
-
|
|
431
|
+
// page-one-answer (A308): one sentence first, then only what needs you, the rest in one fold (closed until you open it)
|
|
432
|
+
const pk = (v.id || v.key || '') + '|', poa = v.answer && !(typeof window !== 'undefined' && window.PMOS_READONLY) ? PA.answerHtml(v.answer, { open: FOLD.get(pk + 'poa') === true, more: FOLD.get(pk + 'poamore') === true, page: 'initiative' }) : '';
|
|
433
|
+
return `<div class="iv" data-iv="${esc(v.id || v.key || '')}">${poa}<div class="iv-cols"><div class="iv-cl">${ctrlHtml(v, o)}${o.sm !== false ? smCard(v.suggest, v.title) : ''}</div>`
|
|
430
434
|
+ `<div class="iv-cr">${v.id ? IA.sectionsHtml(AM, v, v.id, { all: IA.allOpen(v.id), cuAll: IA.cuOpen(v.id) }) : ''}<section class="iv-tasks" aria-label="Tasks">${tasksHtml(v, o)}</section>${foldsHtml(v, o)}${o.tail || ''}</div></div></div>`;
|
|
431
435
|
}
|
|
432
436
|
|
|
@@ -447,7 +451,7 @@ export function wireView(body, h) {
|
|
|
447
451
|
window.addEventListener('pmos:lab-version', onLab);
|
|
448
452
|
}
|
|
449
453
|
// the one blue ✦ after the title (pm/ini-props.js), drawn again with each draw of the initiative
|
|
450
|
-
const chip = () => { const id = idOf(); if (id && VIEWED.has(id)) PP.sync(VIEWED.get(id), body.__iv || {}); drafts(id); about(id); agent(id); fitMission(body); };
|
|
454
|
+
const chip = () => { const id = idOf(); if (id && VIEWED.has(id)) PP.sync(VIEWED.get(id), body.__iv || {}); drafts(id); about(id); agent(id); fitMission(body); if (id) PA.reportCalls('initiative', pmPost, body); };
|
|
451
455
|
// agent-run (AwB): the experiment and Claude's work, read every 30 s at most; they draw alone (and the gate with them) when they change
|
|
452
456
|
const wsOf = () => { const H = body.__iv || {}; return ((H.where && H.where()) || {}).ws || ''; };
|
|
453
457
|
const agent = (id) => { if (id && VIEWED.has(id)) IA.want(wsOf(), id, () => paintAgent(id), (VIEWED.get(id) || {}).title); };
|
|
@@ -501,6 +505,12 @@ export function wireView(body, h) {
|
|
|
501
505
|
const root = b.closest('[data-iv]'); if (!root) return;
|
|
502
506
|
const id = root.dataset.iv;
|
|
503
507
|
const d = b.dataset;
|
|
508
|
+
// page-one-answer: a Needs you row opens its task (or brings the summary's ask into sight); the fold and "N more" open in place
|
|
509
|
+
if (d.poa) {
|
|
510
|
+
e.preventDefault();
|
|
511
|
+
if (d.poa === 'open') { if (d.poaAct === 'task' && d.poaKey && H.openTask) H.openTask(d.poaKey, b); else { const c = root.querySelector('.iv-cl'); if (c) c.scrollIntoView({ block: 'start' }); } return; }
|
|
512
|
+
FOLD.set(id + '|' + (d.poa === 'fold' ? 'poa' : 'poamore'), d.poa === 'fold' ? b.getAttribute('aria-expanded') !== 'true' : true); if (H.redraw) H.redraw(); return;
|
|
513
|
+
}
|
|
504
514
|
// agent-run (AwB): edit a line of the experiment, Undo a change of Claude's, the rest of Claude's work
|
|
505
515
|
if (d.iaEdit) { e.preventDefault(); IA.edit(b); return; }
|
|
506
516
|
// the Specimens line opens the newest round's compare view, kept or not (2026-11-17: a round kept too early had no way back)
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
export const COLUMNS = ['Name', 'Kind', 'Product', 'About', 'By', 'State', 'Updated'];
|
|
26
|
-
export const FAMILIES = [['plans', 'Plans and specs'], ['briefs', 'Briefs'], ['meetings', 'Meeting notes'], ['protos', 'Prototypes and designs'], ['checks', 'Checks'], ['links', 'Links']];
|
|
26
|
+
export const FAMILIES = [['plans', 'Plans and specs'], ['briefs', 'Briefs'], ['meetings', 'Meeting notes'], ['protos', 'Prototypes and designs'], ['checks', 'Checks'], ['links', 'Links'], ['reports', 'Reports']];
|
|
27
27
|
export const GROUPS = [['new', 'New'], ['work', 'Work'], ['kind', 'Kind'], ['product', 'Product']];
|
|
28
28
|
export const STATES = ['Draft', 'Final', 'Issued'];
|
|
29
29
|
const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* page-one-answer.css — every page opens with one answer (pm/page-one-answer.js, idea A308; board BatchPagesDS panel 1). Komorebi tokens only.
|
|
2
|
+
* The sentence, then only what needs you (pm-li rows with a blue dot), then one dashed fold line with the rest. No primary button. */
|
|
3
|
+
.poa { display: flex; flex-direction: column; gap: var(--space-8); margin: 0 0 var(--space-16); }
|
|
4
|
+
.poa-said { display: flex; flex-direction: column; gap: var(--space-4); }
|
|
5
|
+
.poa-line { margin: 0; font-size: var(--fs-panel); color: var(--ink); }
|
|
6
|
+
.poa-needs h2 { margin: 0 0 var(--space-4); font-size: var(--fs-label); }
|
|
7
|
+
.poa .pm-li.poa-r { display: flex; align-items: flex-start; gap: var(--space-12); }
|
|
8
|
+
.poa-dot { flex: none; width: var(--space-8); height: var(--space-8); margin-top: var(--space-8); border-radius: var(--radius-pill); background: var(--blue); }
|
|
9
|
+
.poa-rest .poa-dot { background: var(--line); }
|
|
10
|
+
.poa .txt { display: flex; flex-direction: column; min-width: 0; }
|
|
11
|
+
.poa-t { all: unset; cursor: pointer; font-size: var(--fs-row); color: var(--ink); }
|
|
12
|
+
@media (hover: hover) {
|
|
13
|
+
.poa-t:hover { text-decoration: underline; }
|
|
14
|
+
}
|
|
15
|
+
.poa-t:focus-visible, .poa-fold:focus-visible, .poa-more:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
|
|
16
|
+
.poa .w { font-size: var(--fs-meta); color: var(--muted); }
|
|
17
|
+
.poa-fold { display: flex; align-items: center; gap: var(--space-8); border-top: 1px dashed var(--line); padding-top: var(--space-8); color: var(--muted); font-size: var(--fs-meta); }
|
|
18
|
+
.poa-fold[aria-expanded="true"] svg { transform: rotate(180deg); }
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/* pm/page-one-answer.js — every page opens with one answer (initiative page-one-answer, job #1889, idea A308; board BatchPagesDS panel 1,
|
|
2
|
+
* agreed 2026-11-25). The top of Today, Work, Board and each initiative:
|
|
3
|
+
* 1. one sentence answers the page's question: it counts what needs you, then the rest ("2 things need you; the other 9 are moving.");
|
|
4
|
+
* 2. under it, only what needs you (pm-li rows, a press opens the item);
|
|
5
|
+
* 3. the rest folds into one line, closed by default ("9 moving · 2 waiting on others");
|
|
6
|
+
* 4. zero is silence: nothing needs you → "All moving." and no list.
|
|
7
|
+
* The block holds no primary button: it never adds a call to act to a first view (firstViewCalls counts them for `pmos pages calls`).
|
|
8
|
+
* Pure but firstViewCalls and reportCalls: Node imports it (page-one-answer.test.js).
|
|
9
|
+
*
|
|
10
|
+
* answerOf({ needs, moving, waiting, scope, day }) → { said, needs, moving, waiting, rest, scope, day }
|
|
11
|
+
* boardAnswer(rows, { stateOf, grill, scope, day }) → the Work and Board answer, from the initiative rows on screen
|
|
12
|
+
* iniAnswer(rows, { wait, scope, day }) → an initiative's answer, from its task rows (ini-view-model rowOf) and what waits on you
|
|
13
|
+
* todayAnswer(L, { day }) → Today's answer, from the log's model (Your move is its list)
|
|
14
|
+
* answerHtml(A, { open, list, page }) → the block; '' with no answer
|
|
15
|
+
* firstViewCalls(root, win) → { n, labels } the calls to act above the fold
|
|
16
|
+
* reportCalls(page, post) → logs [page-one-answer] once per page load; posts only a count over one (or the fix of one) */
|
|
17
|
+
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
18
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
19
|
+
export const ALL_MOVING = 'All moving.';
|
|
20
|
+
export const SHOW = 5; // the Needs you rows shown before "N more"
|
|
21
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
22
|
+
const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
23
|
+
/** "Wed 25 Nov" */
|
|
24
|
+
export function dayWord(now = Date.now()) { const d = new Date(now); return `${WD[d.getDay()]} ${d.getDate()} ${MON[d.getMonth()]}`; }
|
|
25
|
+
const dayKey = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
|
26
|
+
|
|
27
|
+
/** The sentence and its parts. needs: [{ key, title, sub }]; moving and waiting: counts. */
|
|
28
|
+
export function answerOf({ needs = [], moving = 0, waiting = 0, scope = '', day = '' } = {}) {
|
|
29
|
+
const N = (needs || []).filter((x) => x && x.title), m = Math.max(0, moving | 0), w = Math.max(0, waiting | 0), rest = m + w;
|
|
30
|
+
const said = !N.length ? ALL_MOVING
|
|
31
|
+
: `${plural(N.length, 'thing needs', 'things need')} you` + (rest ? `; the other ${rest} ${rest === 1 ? 'is' : 'are'} moving.` : '.');
|
|
32
|
+
return { said, needs: N, moving: m, waiting: w, rest, scope: String(scope || ''), day: String(day || '') };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Work and Board. rows: the initiative rows on screen. stateOf(r) → { state: 'done'|'late'|'risk'|'wait'|'none'|'on', why } (bd-work.js
|
|
36
|
+
* rowState). grill(id) → { open, later } the first questions still open. A closed row is not counted. */
|
|
37
|
+
export function boardAnswer(rows, { stateOf, grill = () => null, scope = '', day = '' } = {}) {
|
|
38
|
+
const needs = [], restRows = [];
|
|
39
|
+
let moving = 0, waiting = 0;
|
|
40
|
+
for (const r of rows || []) {
|
|
41
|
+
if (!r) continue;
|
|
42
|
+
const s = (stateOf && stateOf(r)) || { state: 'on', why: '' };
|
|
43
|
+
if (s.state === 'done') continue;
|
|
44
|
+
const g = grill(r.id || r.key) || null, q = g && g.open > 0 && !g.later ? g.open : 0;
|
|
45
|
+
if (s.state === 'late' || s.state === 'risk' || q) {
|
|
46
|
+
const why = s.state === 'late' ? (s.why || 'Late') : s.state === 'risk' ? (s.why || 'Due soon') : plural(q, 'first question open', 'first questions open');
|
|
47
|
+
needs.push({ key: r.key || r.id, title: r.title || r.name || r.id, sub: why, rank: s.state === 'late' ? 0 : s.state === 'risk' ? 1 : 2 });
|
|
48
|
+
} else if (s.state === 'wait') { waiting += 1; restRows.push({ key: r.key || r.id, title: r.title || r.name || r.id, sub: 'Waiting on others' }); }
|
|
49
|
+
else { moving += 1; restRows.push({ key: r.key || r.id, title: r.title || r.name || r.id, sub: '' }); }
|
|
50
|
+
}
|
|
51
|
+
needs.sort((a, b) => a.rank - b.rank);
|
|
52
|
+
return { ...answerOf({ needs, moving, waiting, scope, day }), restRows };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** An initiative. rows: its task rows (ini-view-model rowOf: { uid, title, closed, late, owner: 'You' | name, end, due }). wait: what waits on
|
|
56
|
+
* you there ({ title, sub }) or null. Yours, open, and late or due today need you; another's late task waits on others; the rest moves. */
|
|
57
|
+
export function iniAnswer(rows, { wait = null, scope = '', day = '', today = new Date() } = {}) {
|
|
58
|
+
const t = dayKey(today), needs = [], restRows = [];
|
|
59
|
+
let moving = 0, waiting = 0;
|
|
60
|
+
if (wait && wait.title) needs.push({ key: '', title: wait.title, sub: wait.sub || '', act: 'summary' });
|
|
61
|
+
for (const x of rows || []) {
|
|
62
|
+
if (!x || x.closed) continue;
|
|
63
|
+
const mine = x.owner === 'You', dueNow = !!x.end && String(x.end).slice(0, 10) <= t;
|
|
64
|
+
if (mine && (x.late || dueNow)) needs.push({ key: x.uid || '', title: x.title, sub: x.late ? x.lateText || 'Late' : 'Due today', act: 'task' });
|
|
65
|
+
else if (!mine && x.owner && x.late) { waiting += 1; restRows.push({ key: x.uid || '', title: x.title, sub: x.owner + ' · ' + (x.lateText || 'late'), act: 'task' }); }
|
|
66
|
+
else { moving += 1; restRows.push({ key: x.uid || '', title: x.title, sub: x.owner && x.owner !== 'You' ? x.owner : '', act: 'task' }); }
|
|
67
|
+
}
|
|
68
|
+
return { ...answerOf({ needs, moving, waiting, scope, day }), restRows };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Today: Your move is its Needs you list (cozy-today-model.js yourMove); the day's other rows and Later are the rest. */
|
|
72
|
+
export function todayAnswer(L, { day = '' } = {}) {
|
|
73
|
+
const needs = ((L && (L.move || L.first)) || []).map((r) => ({ key: r.key, title: r.title, sub: r.why || '' }));
|
|
74
|
+
const moving = ((L && L.todayRows) || []).length + ((L && L.wait) || []).length;
|
|
75
|
+
return answerOf({ needs, moving, waiting: 0, scope: '', day }); // the page's own head says the day: said once
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const CHEV = '<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M7 10l5 5 5-5"/></svg>';
|
|
79
|
+
const row = (x, page) => `<div class="pm-li poa-r" data-poa-key="${esc(x.key)}"><span class="poa-dot" aria-hidden="true"></span><span class="txt">`
|
|
80
|
+
+ `<button type="button" class="t poa-t" data-poa="open" data-poa-key="${esc(x.key)}"${x.act ? ` data-poa-act="${esc(x.act)}"` : ''} aria-label="${esc('Open ' + x.title)}">${esc(x.title)}</button>`
|
|
81
|
+
+ `${x.sub ? `<span class="w pm-meta">${esc(x.sub)}</span>` : ''}</span></div>`;
|
|
82
|
+
|
|
83
|
+
/** The block. o.list === false: the page draws its own Needs you list under the sentence (Today's Your move). o.open: the fold is open. */
|
|
84
|
+
export function answerHtml(A, o = {}) {
|
|
85
|
+
if (!A || !A.said) return '';
|
|
86
|
+
const page = o.page || '';
|
|
87
|
+
const meta = [A.scope, A.day].filter(Boolean).join(' · ');
|
|
88
|
+
let h = `<section class="poa pm-block" aria-label="What needs you" data-poa-page="${esc(page)}"><div class="poa-said"><p class="poa-line">${esc(A.said)}</p>${meta ? `<span class="pm-meta">${esc(meta)}</span>` : ''}</div>`;
|
|
89
|
+
// zero is silence: no Needs you list, no count of zero
|
|
90
|
+
if (A.needs.length && o.list !== false) {
|
|
91
|
+
const shown = o.more ? A.needs : A.needs.slice(0, SHOW), more = A.needs.length - shown.length;
|
|
92
|
+
h += `<div class="poa-needs"><h2 class="pm-h-sm">Needs you</h2><div class="rows">${shown.map((x) => row(x, page)).join('')}</div>`
|
|
93
|
+
+ (more > 0 ? `<button type="button" class="pm-fold poa-more" data-poa="more" aria-expanded="false">${esc(more + ' more')}${CHEV}</button>` : '') + '</div>';
|
|
94
|
+
}
|
|
95
|
+
const parts = [A.moving ? A.moving + ' moving' : '', A.waiting ? A.waiting + ' waiting on others' : ''].filter(Boolean);
|
|
96
|
+
if (parts.length && o.list !== false) {
|
|
97
|
+
h += `<button type="button" class="pm-fold poa-fold" data-poa="fold" aria-expanded="${!!o.open}">${CHEV}<span>${esc(parts.join(' · '))}</span></button>`;
|
|
98
|
+
if (o.open && (A.restRows || []).length) h += `<div class="rows poa-rest">${A.restRows.map((x) => row(x, page)).join('')}</div>`;
|
|
99
|
+
}
|
|
100
|
+
return h + '</section>';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* ── the one-call check ── */
|
|
104
|
+
export const CALL_SEL = '.pm-btn.primary, [data-call]';
|
|
105
|
+
/** The calls to act that show in the first view: a primary button or a [data-call] whose box starts above the fold and is drawn. */
|
|
106
|
+
export function firstViewCalls(root, win) {
|
|
107
|
+
const W = win || (typeof window !== 'undefined' ? window : null);
|
|
108
|
+
if (!root || !W) return { n: 0, labels: [] };
|
|
109
|
+
const fold = W.innerHeight || 0, labels = [];
|
|
110
|
+
for (const el of root.querySelectorAll(CALL_SEL)) {
|
|
111
|
+
const b = el.getBoundingClientRect ? el.getBoundingClientRect() : null;
|
|
112
|
+
if (!b || b.width === 0 || b.height === 0 || b.top >= fold || b.bottom <= 0) continue;
|
|
113
|
+
labels.push(String(el.getAttribute('aria-label') || el.textContent || '').trim().slice(0, 60));
|
|
114
|
+
}
|
|
115
|
+
return { n: labels.length, labels };
|
|
116
|
+
}
|
|
117
|
+
const REPORTED = new Set();
|
|
118
|
+
/** Once per page load: counts the first view's calls and says it in the console. It posts to the local record (lib/page-one-answer.js) only a count over one, or the next count of a page it flagged. */
|
|
119
|
+
export function reportCalls(page, post, root) {
|
|
120
|
+
if (!page || REPORTED.has(page) || typeof document === 'undefined') return null;
|
|
121
|
+
REPORTED.add(page);
|
|
122
|
+
const C = firstViewCalls(root || document.body);
|
|
123
|
+
console.info(`[page-one-answer] page=${page} calls=${C.n}`);
|
|
124
|
+
if (C.n > 1) console.warn(`[page-one-answer] ${page}: the first view has ${C.n} calls to act (${C.labels.join(', ')}); one is the most it should have`);
|
|
125
|
+
// Nothing is written on a plain load: post only a page with more than one call, or one that this browser posted as flagged before
|
|
126
|
+
// (so `pmos pages calls` clears it once it is fixed).
|
|
127
|
+
const key = 'pmos.poa.flagged.' + page;
|
|
128
|
+
let was = false; try { was = localStorage.getItem(key) === '1'; } catch { /* no storage */ }
|
|
129
|
+
if (typeof post === 'function' && (C.n > 1 || was)) {
|
|
130
|
+
try { if (C.n > 1) localStorage.setItem(key, '1'); else localStorage.removeItem(key); } catch { /* no storage */ }
|
|
131
|
+
Promise.resolve().then(() => post('/api/page-calls', { page, calls: C.n, labels: C.labels })).catch(() => {});
|
|
132
|
+
}
|
|
133
|
+
return C;
|
|
134
|
+
}
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
* 5 Artefacts: one table: Artefact, Kind, Updated. A core document a gate needs that is not written is a grey row that says which gate. */
|
|
30
30
|
|
|
31
31
|
import { gapsOf } from './cozy-bar.js';
|
|
32
|
+
import { withTime } from './day-time.js'; // a task's optional time on its start and due (task-time-optional)
|
|
32
33
|
import { provenStatus, NO_SIGNAL } from './status-proof.js';
|
|
33
34
|
import * as WT from './work-tree.js'; // subtasks: nesting and the roll-up (initiative work-subtasks)
|
|
34
35
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
@@ -51,10 +52,10 @@ export function dayText(v, today) {
|
|
|
51
52
|
return d.getDate() + ' ' + MON[d.getMonth()] + (d.getFullYear() !== t.getFullYear() ? ' ' + d.getFullYear() : '');
|
|
52
53
|
}
|
|
53
54
|
/** A date and, when it has passed and the thing is open, how late: "4 Nov · 14 days late". */
|
|
54
|
-
export function dateLate(v, today, open = true) {
|
|
55
|
-
const d = day(v), t = today instanceof Date ? today : day(today); if (!d || !t) return { text: dayText(v, t), late: false };
|
|
55
|
+
export function dateLate(v, today, open = true, time = '') {
|
|
56
|
+
const d = day(v), t = today instanceof Date ? today : day(today); if (!d || !t) return { text: withTime(dayText(v, t), time), late: false };
|
|
56
57
|
const late = open && d < t;
|
|
57
|
-
return { text: dayText(v, t) + (late ? ' · ' + plural(between(d, t), 'day', 'days') + ' late' : ''), late };
|
|
58
|
+
return { text: withTime(dayText(v, t), time) + (late ? ' · ' + plural(between(d, t), 'day', 'days') + ' late' : ''), late };
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
/* ── the timeline ── */
|
|
@@ -324,8 +325,8 @@ export function goalName(list, anchor) {
|
|
|
324
325
|
}
|
|
325
326
|
|
|
326
327
|
/* ── the work breakdown ── */
|
|
327
|
-
function taskRow(x, t) {
|
|
328
|
-
const dl = x.end ? dateLate(x.end, t, !x.closed) : { text: x.start ? 'from ' + dayText(x.start, t) : '', late: false };
|
|
328
|
+
export function taskRow(x, t) {
|
|
329
|
+
const dl = x.end ? dateLate(x.end, t, !x.closed, x.due_time) : { text: x.start ? 'from ' + withTime(dayText(x.start, t), x.start_time) : '', late: false };
|
|
329
330
|
const st = taskStatus(x);
|
|
330
331
|
return { kind: 'task', uid: x.uid, title: x.title, who: x.owner || '', status: st, date: dl.text, late: dl.late, start: x.start || '', end: x.end || '', since: x.since || '', done: !!x.closed, ms: !!x.ms, jira: !!x.jkey, canCheck: !!x.canCheck,
|
|
331
332
|
// a Jira ticket's own status name and a move PMOS asked that Jira has not answered (jira-row-edit): the status press moves it in Jira
|
|
@@ -333,7 +334,8 @@ function taskRow(x, t) {
|
|
|
333
334
|
prog: /progress|review/i.test(st), wont: !!x.wont || st === "Won't do",
|
|
334
335
|
// subtasks and Jira (initiative work-subtasks): the parent, the chip's key and link, the epic as read, the assignee, a Jira sub-task
|
|
335
336
|
parent: x.parent || '', ckey: x.ckey || x.jkey || '', jurl: x.jurl || '', ...(x.jepic !== undefined ? { jepic: x.jepic, jepicName: x.jepicName || '' } : {}), jassignee: x.jassignee || '', jtype: x.jtype || '',
|
|
336
|
-
...(x.jsub ? { jsub: true } : {}), ...(x.jsubOf ? { jsubOf: x.jsubOf } : {}), ...(x.priority ? { priority: x.priority } : {})
|
|
337
|
+
...(x.jsub ? { jsub: true } : {}), ...(x.jsubOf ? { jsubOf: x.jsubOf } : {}), ...(x.priority ? { priority: x.priority } : {}),
|
|
338
|
+
...(x.start_time ? { start_time: x.start_time } : {}), ...(x.due_time ? { due_time: x.due_time } : {}) }; // the optional times (task-time-optional)
|
|
337
339
|
}
|
|
338
340
|
/** The tasks of every stage, nested (initiative work-subtasks): the read Jira sub-tasks join as rows under their ticket, and a task that names
|
|
339
341
|
* a sub-task's key with no parent of its own sits under its ticket's row. → { T: Map uid → node, isChild(x), rx(x) (a parent with its roll-up) } */
|
|
@@ -13,7 +13,7 @@ import { productName, whenNames } from './scope-chip.js';
|
|
|
13
13
|
|
|
14
14
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
15
15
|
const svg = (d, n = 18) => `<svg class="pm-ic" viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
16
|
-
const I = { keep: 'M5 12.5l4.5 4.5L19 7.5', later: '
|
|
16
|
+
const I = { keep: 'M5 12.5l4.5 4.5L19 7.5', later: 'M6 6l12 12M18 6L6 18', undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z' };
|
|
17
17
|
const money = (n) => (n == null ? '' : '$' + (n >= 1000 ? (Math.round(n / 100) / 10) + 'k' : n >= 10 ? Math.round(n) : n.toFixed(2)));
|
|
18
18
|
|
|
19
19
|
export function pageHtml(v, o = {}) {
|