create-pmos 0.420.0 → 0.422.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +25 -25
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/anchor-resolve.js +93 -15
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-programs-test.js +59 -3
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/changelog.json +24 -0
- package/workspace/fixtures/report-api/draft.json +2 -1
- package/workspace/guide/briefing-premium.md +2 -1
- package/workspace/guide/home.md +6 -2
- package/workspace/guide/programs.md +4 -3
- package/workspace/home-other-product-test.js +55 -0
- package/workspace/lib/board-premium.js +18 -4
- package/workspace/lib/briefing-premium-agent.js +8 -0
- package/workspace/lib/doc-live-root.js +37 -0
- package/workspace/lib/engine/anchor-resolve.js +93 -15
- package/workspace/lib/engine/boards.js +7 -2
- package/workspace/lib/engine/intake.js +1 -1
- package/workspace/lib/first-input.js +13 -6
- package/workspace/lib/hold-spans.js +24 -10
- package/workspace/lib/kg.js +1 -1
- package/workspace/lib/report-draft.js +3 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-board-premium.js +6 -0
- package/workspace/lib/routes-boards.js +48 -9
- package/workspace/lib/routes-doc-sheet.js +29 -1
- package/workspace/lib/routes-programs.js +44 -5
- package/workspace/lib/routes-task-plans.js +333 -0
- package/workspace/lib/task-cli.js +16 -9
- package/workspace/lib/task-items.js +1 -1
- package/workspace/lib/task-plans.js +232 -0
- package/workspace/lib/transcript-read.js +29 -1
- package/workspace/lib/vendor/scripts/anchor-resolve.js +93 -15
- package/workspace/lib/vendor/scripts/intake.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-viewer-test.js +1 -1
- package/workspace/premium-vw-doc-test.js +26 -3
- package/workspace/program-leave-test.js +203 -0
- package/workspace/public/pm/bd-acts.js +5 -2
- package/workspace/public/pm/bd-ini-panel.js +20 -7
- package/workspace/public/pm/bd-prog-panel.js +22 -7
- package/workspace/public/pm/bd-span.js +177 -24
- package/workspace/public/pm/cozy-board.css +80 -0
- package/workspace/public/pm/cozy-home.css +3 -0
- package/workspace/public/pm/cozy-live-pill.js +1 -1
- package/workspace/public/pm/cozy-nav.js +1 -1
- package/workspace/public/pm/cozy-steps.js +1 -1
- package/workspace/public/pm/cozy-xv.js +1 -1
- package/workspace/public/pm/doc-follow.js +36 -0
- package/workspace/public/pm/home-app.js +38 -7
- package/workspace/public/pm/home-ask.js +7 -0
- package/workspace/public/pm/home-ini.js +13 -4
- package/workspace/public/pm/home-line.js +1 -1
- package/workspace/public/pm/home-list.js +2 -2
- package/workspace/public/pm/home-today.js +3 -1
- package/workspace/public/pm/ini-tasks.js +81 -16
- package/workspace/public/pm/ini-versions.js +343 -0
- package/workspace/public/pm/ini-view-model.js +27 -41
- package/workspace/public/pm/ini-view.css +82 -0
- package/workspace/public/pm/ini-view.js +18 -11
- package/workspace/public/pm/premium-board.js +109 -18
- package/workspace/public/pm/premium-insights.js +1 -1
- package/workspace/public/pm/premium-mtg-present.js +2 -2
- package/workspace/public/pm/premium-report-read.js +21 -2
- package/workspace/public/pm/premium-report-tab.js +1 -1
- package/workspace/public/pm/premium-shell.js +29 -4
- package/workspace/public/pm/premium-viewer.js +3 -3
- package/workspace/public/pm/premium-vw-doc.js +46 -11
- package/workspace/public/pm/premium-vw-mtg.js +1 -1
- package/workspace/public/pm/premium-vw-open.js +1 -1
- package/workspace/public/pm/premium-vw-slides.js +1 -1
- package/workspace/public/pm/prog-move.js +69 -0
- package/workspace/public/pm/prog-order.js +1 -1
- package/workspace/public/pm/task-card.css +3 -0
- package/workspace/public/pm/task-card.js +10 -3
- package/workspace/public/pm/tk-send.js +1 -1
- package/workspace/server.js +26 -2
- package/workspace/task-milestones-test.js +176 -0
- package/workspace/task-plans-test.js +175 -0
- package/workspace/task-views-test.js +2 -2
- package/workspace/test-lists/program-leave.json +6 -0
- package/workspace/test-lists/task-milestones.json +6 -0
- package/workspace/test-lists/task-plans.json +6 -0
- package/workspace/test-lists/viewer-live-file.json +9 -0
- package/workspace/timeline-holds-test.js +70 -5
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* wireView(body, h) the presses, once per body: h.check(uid, btn), h.openTask(uid), h.openTicket(key), h.add(btn) (the + icon: the host
|
|
14
14
|
* redraws with o.adding, an inline field), h.addTask(title, input), h.addCancel(), h.next(btn),
|
|
15
15
|
* h.primary(act, btn), h.program(id), h.docs(), h.doc(path) (a linked document), h.draft(btn), h.wf(btn), h.redraw() (after a fold opens or closes),
|
|
16
|
-
* h.status(uid, state) and h.dates(uid, { start?, due? }) (the quick changes, each saved at once with Undo in the host's toast)
|
|
16
|
+
* h.status(uid, state) and h.dates(uid, { start?, due? }) (the quick changes, each saved at once with Undo in the host's toast);
|
|
17
|
+
* for planned versus actual (pm/ini-versions.js) h.where() → { ws, board }, h.reload() and h.toast(text, undo?)
|
|
17
18
|
*
|
|
18
19
|
* Tasks has three views (batch 9 item 5b; canvas In development, row "Tasks views"): the List (the WBS below), Timeline and Kanban
|
|
19
20
|
* (pm/ini-tasks.js). The icon segment in the Tasks header switches them, and the last one is remembered for the PM.
|
|
@@ -22,8 +23,9 @@
|
|
|
22
23
|
* their words in aria-label and title. Zero is silence: a part with nothing on record draws nothing. */
|
|
23
24
|
import { wfIcon } from './wf-model.js';
|
|
24
25
|
import * as TV from './ini-tasks.js'; // Tasks as List, Timeline or Kanban, and the quick status and dates (batch 9 item 5b)
|
|
26
|
+
import * as VS from './ini-versions.js'; // planned versus actual: the version chip, Make live, a draft's writes (batch 11 item 8)
|
|
25
27
|
|
|
26
|
-
const CSS = '
|
|
28
|
+
const CSS = new URL('./ini-view.css', import.meta.url).href;
|
|
27
29
|
if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
|
|
28
30
|
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
|
|
29
31
|
}
|
|
@@ -32,7 +34,7 @@ const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" heigh
|
|
|
32
34
|
const P = {
|
|
33
35
|
go: 'M5 12h14M13 6l6 6-6 6', check: 'M5 12l5 5 9-10', right: 'M10 7l5 5-5 5', down: 'M7 10l5 5 5-5', plus: 'M12 5v14M5 12h14',
|
|
34
36
|
prog: 'M12 3l9 5-9 5-9-5zM3 13l9 5 9-5', doc: 'M7 3h7l5 5v13H7zM14 3v5h5', draft: 'M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8',
|
|
35
|
-
skip: '
|
|
37
|
+
skip: 'M6 7l5 5-5 5M13 7l5 5-5 5', // » a skipped stage (batch 11 item 13: the same mark as the timelines)
|
|
36
38
|
};
|
|
37
39
|
const FOLD = new Map(); // `${id}|${key}` → true (open) | false (shut): the PM's own fold, for the session
|
|
38
40
|
const isOpen = (v, key, dflt) => { const k = (v.id || v.key) + '|' + key; return FOLD.has(k) ? FOLD.get(k) : !!dflt; };
|
|
@@ -70,17 +72,19 @@ function stageHtml(st, o) {
|
|
|
70
72
|
/* ── the WBS ── */
|
|
71
73
|
function taskHtml(x, o, arch) {
|
|
72
74
|
// the box marks done in one press; its caret opens the status picker right under it (an archived task has only the caret)
|
|
73
|
-
const car = o.quick && x.uid ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" aria-haspopup="dialog" aria-label="${esc('Change the status: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '';
|
|
75
|
+
const car = o.quick && x.uid ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" data-ms="${x.ms ? 1 : 0}" aria-haspopup="dialog" aria-label="${esc('Change the status: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '';
|
|
74
76
|
const cls = ['iv-cb', x.done ? 'on' : '', x.prog ? 'pr' : '', x.wont ? 'wo' : ''].filter(Boolean).join(' ');
|
|
75
|
-
const chk = x.canCheck && !arch ? `<span class="iv-bxw"><button type="button" class="${cls}" data-iv-check="${esc(x.uid)}" aria-pressed="${x.done}" aria-label="${esc((x.done ? 'Reopen: ' : 'Mark done: ') + x.title)}" title="${x.done ? 'Reopen' : 'Mark done'}">${x.done ? SVG(P.check, 12, 3) : ''}</button>${car}</span>`
|
|
77
|
+
const chk = x.dr ? `<span class="iv-bxw"><span class="iv-cb dr" aria-hidden="true"></span>${car}</span>` : x.canCheck && !arch ? `<span class="iv-bxw"><button type="button" class="${cls}" data-iv-check="${esc(x.uid)}" aria-pressed="${x.done}" aria-label="${esc((x.done ? 'Reopen: ' : 'Mark done: ') + x.title)}" title="${x.done ? 'Reopen' : 'Mark done'}">${x.done ? SVG(P.check, 12, 3) : ''}</button>${car}</span>`
|
|
76
78
|
: `<span class="iv-bxw"><span class="iv-cb off${x.done ? ' on' : ''}" aria-hidden="true">${x.done ? SVG(P.check, 12, 3) : ''}</span>${arch ? car : ''}</span>`;
|
|
77
|
-
const t = o.openTask && x.uid ? `<button type="button" class="iv-tt" data-iv-task="${esc(x.uid)}">${esc(x.title)}</button>` : `<b class="iv-tt">${esc(x.title)}</b
|
|
79
|
+
const t = (o.openTask && x.uid && !x.dr ? `<button type="button" class="iv-tt" data-iv-task="${esc(x.uid)}">${esc(x.title)}</button>` : `<b class="iv-tt">${esc(x.title)}</b>`) + TV.msGlyph(x) + TV.addedMark(x);
|
|
78
80
|
// the meta: In progress, the dates (a press: the start and due picker opens under them), the late days, the owner
|
|
79
81
|
let meta = x.sub ? `<span class="${x.late ? 'w' : ''}">${esc(x.sub)}</span>` : '';
|
|
80
82
|
if (o.quick && x.uid) {
|
|
81
83
|
// no dates: the calendar icon sits last and shows on hover, so an undated row reads the same as before
|
|
82
|
-
const parts = [x.prog ? 'In progress' : '', x.days ? TV.dateBtn(x, o) + (x.lateText ? `<span class="iv-late">, ${esc(x.lateText)}</span>` : '') : '', x.owner && x.owner !== 'You' ? esc(x.owner) : ''];
|
|
84
|
+
const parts = [x.prog ? 'In progress' : '', x.days ? TV.dateBtn(x, o) + (x.lateText ? `<span class="iv-late">, ${esc(x.lateText)}</span>` : '') + TV.slipHtml(x) : '', x.owner && x.owner !== 'You' ? esc(x.owner) : ''];
|
|
83
85
|
meta = `<span class="iv-rm">${parts.filter(Boolean).join('<span class="iv-sep" aria-hidden="true"> · </span>')}${x.days ? '' : TV.dateBtn(x, o)}</span>`;
|
|
86
|
+
} else if (TV.msNoDate(x)) {
|
|
87
|
+
meta = `<span class="iv-rm">${x.sub ? `<span>${esc(x.sub)}</span> ` : ''}<span class="iv-dc ms">Set the due date</span></span>`;
|
|
84
88
|
}
|
|
85
89
|
return `<div class="iv-tr${x.closed ? ' done' : ''}${x.wont ? ' wo' : ''}${arch ? ' ar' : ''}">${chk}<span class="w">${t}${meta}</span></div>`;
|
|
86
90
|
}
|
|
@@ -142,8 +146,10 @@ function tasksHtml(v, o) {
|
|
|
142
146
|
const add = o.add ? `<button type="button" class="iv-ib" data-iv-add aria-label="Add a task to ${esc(v.title)}" title="Add a task">${SVG(P.plus, 16, 2.2)}</button>` : '';
|
|
143
147
|
// the view switch shows once there is a task to see another way (zero is silence)
|
|
144
148
|
const mode = T.empty ? 'list' : TV.viewMode();
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
// planned versus actual (batch 11 item 8): the version chip and the end slip after the count; Make live (seal) while a draft is shown
|
|
150
|
+
const cnt = VS.countText(v.vs, T.count, T.open + T.done);
|
|
151
|
+
const head = `<div class="iv-th"><b>Tasks</b>${cnt ? `<span class="n">${esc(cnt)}</span>` : ''}${VS.headHtml(v.vs)}<span class="iv-sp"></span>${T.empty ? '' : TV.headExtraHtml(v, mode) + TV.switchHtml(mode)}${VS.liveHtml(v.vs)}${add}</div>`
|
|
152
|
+
+ (o.adding ? `<form class="iv-addf" data-iv-addform><input id="ivAddTask" type="text" maxlength="160" autocomplete="off" placeholder="A task for ${esc(v.title)}${o.addHint ? esc(', ' + o.addHint) : ''}" aria-label="New task"><button type="submit" class="iv-go" aria-label="Add the task" title="Add (Enter). Esc cancels.">${SVG(P.check, 16, 2.2)}</button></form>` : '');
|
|
147
153
|
if (T.empty) {
|
|
148
154
|
const sk = T.empty.stages.map((s) => `<span class="iv-sk"><span class="iv-no dash${s.ms ? ' ms' : ''}" aria-hidden="true">${s.ms ? '' : s.n}</span>${esc(s.name)}${s.now ? ' <i>· now</i>' : ''}</span>`).join('');
|
|
149
155
|
return head + `<div class="iv-empty">${sk}<p class="iv-q">Claude drafts the breakdown, one section per stage. Nothing is saved until you keep it.</p>`
|
|
@@ -176,7 +182,7 @@ export function viewHtml(v, o = {}) {
|
|
|
176
182
|
/* ── the presses ── */
|
|
177
183
|
export function wireView(body, h) {
|
|
178
184
|
if (!body) return;
|
|
179
|
-
body.__iv = h;
|
|
185
|
+
body.__iv = VS.wrap(h, body, (id) => SHOWN.get(id));
|
|
180
186
|
if (body.__ivWired) return;
|
|
181
187
|
body.__ivWired = true;
|
|
182
188
|
body.addEventListener('click', (e) => {
|
|
@@ -184,6 +190,7 @@ export function wireView(body, h) {
|
|
|
184
190
|
const root = b.closest('[data-iv]'); if (!root) return;
|
|
185
191
|
const id = root.dataset.iv;
|
|
186
192
|
const d = b.dataset;
|
|
193
|
+
if (VS.press(b, d, root, H)) return;
|
|
187
194
|
if (TV.press(b, d, root, { ...H, __v: SHOWN.get(id) }, e)) return;
|
|
188
195
|
if (d.ivFold) { e.preventDefault(); const k = id + '|' + d.ivFold; FOLD.set(k, b.getAttribute('aria-expanded') !== 'true'); if (H.redraw) H.redraw(); return; }
|
|
189
196
|
if (d.ivCheck && H.check) { e.preventDefault(); H.check(d.ivCheck, b); return; }
|
|
@@ -208,4 +215,4 @@ export function wireView(body, h) {
|
|
|
208
215
|
body.addEventListener('keydown', (e) => { if (e.key === 'Escape' && e.target.id === 'ivAddTask') { e.stopPropagation(); const H = body.__iv || {}; if (H.addCancel) H.addCancel(); } });
|
|
209
216
|
}
|
|
210
217
|
/** For the tests: forget every fold the PM opened or shut. */
|
|
211
|
-
export const resetFolds = () => { FOLD.clear(); TV.resetViews(); };
|
|
218
|
+
export const resetFolds = () => { FOLD.clear(); TV.resetViews(); VS.resetVersions(); };
|
|
@@ -18,11 +18,12 @@
|
|
|
18
18
|
* chip row picks one (its own stages become the columns and the track's header) or All (the three categories, each row its own stages).
|
|
19
19
|
* Where no record holds a value for an initiative, the element says so: nothing is invented. */
|
|
20
20
|
import { pmPost } from './http.js';
|
|
21
|
+
import { followDoc } from './doc-follow.js';
|
|
21
22
|
import { $, $$, esc, store, crumbHtml, wireCrumb, chatAbout, setPageGaps } from './premium-shell.js';
|
|
22
23
|
import { mountNav } from './cozy-nav.js';
|
|
23
24
|
import { mountLivePill } from './cozy-live-pill.js';
|
|
24
25
|
import { stepsHelpHtml } from './bd-stages.js';
|
|
25
|
-
import { timelineHtml, legendHtml, hasHold, SPANS, md } from './bd-span.js';
|
|
26
|
+
import { timelineHtml, legendHtml, hasHold, planKeys, gapKeys, plainGaps, skipsOf, skipWords, gapWords, SPANS, md } from './bd-span.js';
|
|
26
27
|
import * as TL from './bd-scroll.js';
|
|
27
28
|
import * as Acts from './bd-acts.js';
|
|
28
29
|
import * as V from './bd-views.js';
|
|
@@ -30,10 +31,12 @@ import * as WF from './bd-wf.js';
|
|
|
30
31
|
import * as Asks from './bd-asks.js';
|
|
31
32
|
import * as PG from './bd-prog.js';
|
|
32
33
|
import { programOf } from './program-model.js';
|
|
33
|
-
import { open as viewerOpen } from './cozy-viewer.js';
|
|
34
|
+
import { open as viewerOpen, current as viewerCur } from './cozy-viewer.js';
|
|
34
35
|
import * as VW from './cozy-viewer.js';
|
|
35
36
|
import * as PP from './bd-prog-panel.js';
|
|
36
|
-
import * as PO from './prog-order.js';
|
|
37
|
+
import * as PO from './prog-order.js';
|
|
38
|
+
import * as PM from './prog-move.js'; // move an initiative out of its program, or to another (canvas LpA1More, LpA2Other)
|
|
39
|
+
import * as Pop from './bd-pop.js'; // the order of a program's initiatives: the grip and Claude's order from the dates (canvas RoADrag, RoASuggest)
|
|
37
40
|
import * as BI from './bd-ini-panel.js';
|
|
38
41
|
import { nextHtml } from './bd-next.js';
|
|
39
42
|
import { statusOf as ivStatus } from './ini-view-model.js';
|
|
@@ -54,7 +57,9 @@ const F = { chips: new Set(), q: '', owners: new Set(), cats: new Set(), sprints
|
|
|
54
57
|
let GR = {}; // the first questions still open per initiative (GET /api/board-grill?ids=): { [id]: { open, total, later } }
|
|
55
58
|
let PGS = []; // the programs (GET /api/programs): every view groups the rows a program holds under it (PgBoard)
|
|
56
59
|
let XR = {}; // the other products' rows a program here holds, read once (GET /api/board-premium?ws=): { [ws]: { name, rows } }
|
|
57
|
-
|
|
60
|
+
// the products picked (batch 11 item 7): ?all=1 every product, ?pick=<ws>|<board> repeated several, else one board
|
|
61
|
+
const PICK = new URLSearchParams(location.search).getAll('pick').filter((x) => /\|/.test(x));
|
|
62
|
+
const ALL = new URLSearchParams(location.search).get('all') === '1' || PICK.length > 1; // All products, or several: their boards on one page (PgBoard)
|
|
58
63
|
let byProduct = store.get(GROUPING_KEY) === 'product'; // the grouping: programs first (default) or By product (PgBoardProduct)
|
|
59
64
|
let DM = {}; // the documents' history (GET /api/board-docs): { [path]: { changed, by, log } }
|
|
60
65
|
let peek = null; // what the Viewer shows for the Board: { kind: 'ini', key } an initiative or its ticket, { kind: 'acts' } an acts panel
|
|
@@ -139,10 +144,21 @@ function drawHead() {
|
|
|
139
144
|
crumbed = true;
|
|
140
145
|
// the picker: All products first when there is more than one product, then each product's board
|
|
141
146
|
const list = M.board.switcher || [], boards = list.length > 1 ? [{ ws: '*', id: '*', name: 'All products' }, ...list] : list;
|
|
147
|
+
// the button says it once: All products, the one product, or the first product and "+N" (several)
|
|
148
|
+
const names = (M.board.products || []).map((p) => p.name), some = ALL && PICK.length > 1;
|
|
149
|
+
const label = some ? esc(names[0] || 'Products') + ' <b>+' + (names.length - 1) + '</b>' : esc(M.board.name || 'Board');
|
|
142
150
|
$('#crumbHost').innerHTML = crumbHtml({ page: '', board: M.board.name || 'Board', boards });
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
$('#crBoard').innerHTML = label;
|
|
152
|
+
// several products can be ticked (batch 11 item 7); the pick goes into the address, so a reload keeps it
|
|
153
|
+
const picked = !ALL ? [M.board.ws + '|' + M.board.id] : (M.board.products || []).map((p) => p.ws + '|' + p.id);
|
|
154
|
+
const goBoard = (ws, id) => location.assign(id === '*' ? '/premium-board.html?all=1' : '/premium-board.html?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(id));
|
|
155
|
+
wireCrumb({ boards, board: ALL ? '*' : M.board.id, goBoard, picked: list.length > 1 ? picked : null, goPicked: (keys) => {
|
|
156
|
+
if (keys.length === list.length) return goBoard('*', '*');
|
|
157
|
+
if (keys.length === 1) { const [ws, id] = keys[0].split('|'); return goBoard(ws, id); }
|
|
158
|
+
location.assign('/premium-board.html?' + keys.map((k) => 'pick=' + encodeURIComponent(k)).join('&'));
|
|
159
|
+
} });
|
|
160
|
+
$('#crBoard').setAttribute('aria-label', 'Product: ' + (some ? names.join(', ') : M.board.name || 'Board'));
|
|
161
|
+
chatAbout('board:this-board', some ? 'the ' + names.join(', ') + ' boards' : ALL ? 'all products' : M.board.name ? 'the ' + M.board.name + ' board' : 'this board');
|
|
146
162
|
}
|
|
147
163
|
$('#snap').textContent = M.header.text;
|
|
148
164
|
// PMOS-self: new work starts at the pmos-router skill. All products: New asks which product the initiative is for
|
|
@@ -171,7 +187,7 @@ function drawChips() {
|
|
|
171
187
|
}
|
|
172
188
|
// the timeline's legend sits at the end of the chip row (PgTimeline), with a program milestone only where a program is drawn and "On hold" only
|
|
173
189
|
// where a hold is drawn (feedback batch 9 item 8: zero is silence)
|
|
174
|
-
const lgd = view === 'time' && span !== 'sprint' ? '<span class="bd-sp"></span>' + legendHtml(!byProduct && !!groups(visible()), hasHold(visible())) : '';
|
|
190
|
+
const lgd = view === 'time' && span !== 'sprint' ? '<span class="bd-sp"></span>' + legendHtml(!byProduct && !!groups(visible()), hasHold(visible()), { ...planKeys(visible()), ...gapKeys(visible()) }) : '';
|
|
175
191
|
$('#bdChipset').innerHTML = jiraChip
|
|
176
192
|
+ (ALL ? '' : `<button type="button" class="bd-chip" id="chSprint" aria-haspopup="dialog">${SV(I.cal)}<span>${esc(sprint)}</span></button>`)
|
|
177
193
|
+ askChip + '<span class="bd-vr"></span>' + flt(['late', 'risk', 'blocked', 'idle'])
|
|
@@ -472,6 +488,12 @@ $('#ibBody').addEventListener('click', (e) => {
|
|
|
472
488
|
const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk, tk); return; }
|
|
473
489
|
if (e.target.closest('[data-act], [data-hold]')) return; // pm/bd-acts.js handles its own presses (a ⏸ on the timeline opens its hold there)
|
|
474
490
|
const pg = e.target.closest('[data-prog]'); if (pg) { PG.openProgram(pg.dataset.prog, pg); return; }
|
|
491
|
+
// a counted milestone ◇ lists its milestones right under it; on a phone the row's bar lane opens them in a sheet (batch 11 item 3)
|
|
492
|
+
const mc = e.target.closest('[data-ms-row]'); if (mc) { msPop(mc, rowOf(mc.dataset.msRow), mc.dataset.msIds.split(' ')); return; }
|
|
493
|
+
// a gap's press (batch 11 item 13): its words, and + New task with its dates while part of it is ahead
|
|
494
|
+
const gp = e.target.closest('[data-gap]'); if (gp) { gapPop(gp, rowOf(gp.dataset.gap)); return; }
|
|
495
|
+
// the phone's row sheet lists the milestones, the gaps and the skipped stages in date order (XmlA5Phone, XgapA3Phone)
|
|
496
|
+
const lane = PHONE.matches && e.target.closest('.tgq-r[data-row] > .tg-p'); if (lane) { const r = rowOf(lane.parentElement.dataset.row); if (r && ((r.milestones || []).length || plainGaps(r).length || skipsOf(r).length)) { msPop(lane, r, null, true); return; } }
|
|
475
497
|
const b = e.target.closest('[data-key]'); if (b) openIni(rowOf(b.dataset.key), b, view === 'time' ? 'time' : 'track');
|
|
476
498
|
});
|
|
477
499
|
$('#ibBody').addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches('[data-steps]')) { e.preventDefault(); togglePop('popSteps', e.target); } });
|
|
@@ -532,6 +554,16 @@ async function turnProgram(r) {
|
|
|
532
554
|
say('Now a program · ' + r.title + '.');
|
|
533
555
|
PG.openProgram(res.program.id);
|
|
534
556
|
}
|
|
557
|
+
/** The ⋯ items of an initiative in a program: Move out of it, Move to another program (pm/prog-move.js). The rows stay; the panel stays on it. */
|
|
558
|
+
function moveItems(r) {
|
|
559
|
+
return PM.moveItems({ programs: () => PGS, ws: r.ws || M.board.ws || '', id: r.id, product: r.product || M.board.product || M.board.name || '', pmPost, say,
|
|
560
|
+
reload: async () => { await loadPrograms(); load(); }, phone: () => PHONE.matches, stateOf: (p) => progState(p), openList: moveList });
|
|
561
|
+
}
|
|
562
|
+
function moveList(b, label, rows) {
|
|
563
|
+
const host = Pop.open(`<p class="bd-mlbl">${esc(label)}</p>${rows.map((x, i) => `<button type="button" class="bd-mi" role="menuitem" data-pm-to="${i}">${x.icon ? `<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${x.icon}"/></svg>` : ''}<span class="tx"><span>${esc(x.label)}</span>${x.sub ? `<small>${esc(x.sub)}</small>` : ''}</span></button>`).join('')}`,
|
|
564
|
+
b, { label: 'Move to another program', role: 'menu', width: 280, align: 'right', cls: 'bd-menu', focus: '.bd-mi' });
|
|
565
|
+
if (host) host.onclick = (e) => { const t = e.target.closest('[data-pm-to]'); if (!t) return; const x = rows[+t.dataset.pmTo]; host.onclick = null; Pop.close(true); if (x) x.go(); };
|
|
566
|
+
}
|
|
535
567
|
async function loadPrograms() {
|
|
536
568
|
let r = null; try { r = await (await fetch('/api/programs', { credentials: 'same-origin' })).json(); } catch { r = null; }
|
|
537
569
|
if (!r || !r.ok) return;
|
|
@@ -578,6 +610,58 @@ function openTicket(iniKey, key, from) {
|
|
|
578
610
|
const r = rowOf(iniKey); if (!r || !r.track) return;
|
|
579
611
|
const k = (r.track.tickets || []).find((x) => x.key === key); if (k) BI.openTicket(r, k, from);
|
|
580
612
|
}
|
|
613
|
+
/** A row's milestones as a list (batch 11 item 3, canvas XmlA4Hover and XmlA5Phone): ◇, name, date. Under a counted ◇ it holds that ◇'s
|
|
614
|
+
* milestones; on a phone a sheet holds every milestone of the row. A row opens the task card (a Jira ticket its ticket Viewer). */
|
|
615
|
+
let msEl = null;
|
|
616
|
+
function msClose() { if (msEl) { const a = msEl.__a; msEl.remove(); msEl = null; if (a && a.isConnected) a.setAttribute('aria-expanded', 'false'); } }
|
|
617
|
+
function msPop(anchor, r, ids, sheet) {
|
|
618
|
+
const was = msEl && msEl.__a === anchor; msClose(); if (was || !r) return;
|
|
619
|
+
const today = M.today ? String(M.today).slice(0, 10) : new Date().toISOString().slice(0, 10);
|
|
620
|
+
const L = (r.milestones || []).filter((m) => !ids || ids.includes(m.id));
|
|
621
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], md = (iso) => MON[+iso.slice(5, 7) - 1] + ' ' + +iso.slice(8, 10);
|
|
622
|
+
const row = (m) => { const late = !m.done && m.date < today;
|
|
623
|
+
return `<button type="button" role="menuitem" class="o" data-ms-open="${esc(m.id)}"><i class="tg-tm-i${m.done ? ' dn' : late ? ' late' : ''}" aria-hidden="true"></i><span>${esc(m.name)}</span><span class="k${late ? ' late' : ''}">${esc(md(m.date))}</span></button>`; };
|
|
624
|
+
// the sheet adds each gap and each skipped stage, in date order with the milestones (batch 11 item 13, XgapA3Phone): words only, no press
|
|
625
|
+
const ymd = (d) => d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0');
|
|
626
|
+
const extra = !sheet ? [] : plainGaps(r).map(([a, b]) => ({ at: ymd(a), html: `<div class="o i" role="menuitem" aria-disabled="true"><i class="tg-ng-i" aria-hidden="true"></i><span>${esc(gapWords(a, b, new Date(today + 'T00:00')).map((w) => w.replace(/, .* · /, ' · ')).join(' · '))}</span><span class="k">${esc(md(ymd(a)) + ' – ' + md(ymd(b)))}</span></div>` }))
|
|
627
|
+
.concat(skipsOf(r).flatMap((k) => k.items.map((x) => ({ at: ymd(k.lo), html: `<div class="o i" role="menuitem" aria-disabled="true"><i class="tg-sk-i" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M6 7l5 5-5 5M13 7l5 5-5 5"/></svg></i><span>${esc(x.name + ' skipped')}${x.why ? `<small>${esc(x.why)}</small>` : ''}</span></div>` }))));
|
|
628
|
+
const items = L.map((m) => ({ at: m.date, html: row(m) })).concat(extra).sort((a, b) => (a.at < b.at ? -1 : a.at > b.at ? 1 : 0));
|
|
629
|
+
const el = document.createElement('div');
|
|
630
|
+
el.className = 'tg-msp' + (sheet ? ' sh' : ''); el.setAttribute('role', 'menu'); el.setAttribute('aria-label', (sheet ? '' : 'Milestones of ') + r.title); el.dataset.escLayer = '';
|
|
631
|
+
el.innerHTML = (sheet ? `<i class="gr" aria-hidden="true"></i><b class="h">${esc(r.title)}</b>` : '') + items.map((x) => x.html).join('');
|
|
632
|
+
document.body.appendChild(el); el.__a = anchor; msEl = el; anchor.setAttribute('aria-expanded', 'true');
|
|
633
|
+
if (!sheet) { const b = anchor.getBoundingClientRect(), w = el.offsetWidth; el.style.left = Math.max(8, Math.min(b.left + b.width / 2 - w / 2, innerWidth - w - 8)) + 'px'; el.style.top = b.bottom + 8 + 'px'; }
|
|
634
|
+
el.onclick = (e) => {
|
|
635
|
+
const o = e.target.closest('[data-ms-open]'); if (!o) return;
|
|
636
|
+
const id = o.dataset.msOpen, m = L.find((x) => x.id === id); msClose();
|
|
637
|
+
if (m && m.jira) { const k = ((r.track && r.track.tickets) || []).find((x) => x.key === id); if (k) BI.openTicket(r, k, anchor); else openIni(r, anchor); return; }
|
|
638
|
+
const k = (r.tasks || []).find((x) => x.uid === id); if (k) openTask(r, k); else openIni(r, anchor);
|
|
639
|
+
};
|
|
640
|
+
const f = el.querySelector('button'); if (f) f.focus({ preventScroll: true });
|
|
641
|
+
}
|
|
642
|
+
document.addEventListener('pointerdown', (e) => { if (msEl && !msEl.contains(e.target) && !(msEl.__a && msEl.__a.contains(e.target))) msClose(); }, true);
|
|
643
|
+
document.addEventListener('keydown', (e) => { if (msEl && e.key === 'Escape') { e.stopPropagation(); const a = msEl.__a; msClose(); if (a && a.focus) a.focus(); } }, true);
|
|
644
|
+
addEventListener('resize', () => msClose());
|
|
645
|
+
/** A gap's card (batch 11 item 13; XgapAHard 2): its words under it; while part of it is ahead, + opens New task with those dates filled in. */
|
|
646
|
+
function gapPop(anchor, r) {
|
|
647
|
+
const was = msEl && msEl.__a === anchor; msClose(); if (was || !r) return;
|
|
648
|
+
const today = M.today ? String(M.today).slice(0, 10) : new Date().toISOString().slice(0, 10);
|
|
649
|
+
const a = anchor.dataset.from, b = anchor.dataset.to, d = (v) => new Date(v + 'T00:00');
|
|
650
|
+
const lines = gapWords(d(a), d(b), d(today)), sk = skipsOf(r).filter((k) => { const lo = k.lo < k.hi ? k.lo : k.hi, hi = k.lo < k.hi ? k.hi : k.lo; return d(a) <= hi && d(b) >= lo; });
|
|
651
|
+
// the gap's empty days ahead: from the day after the work before it (or today) to the day before the work after it
|
|
652
|
+
const ymd = (x) => x.getFullYear() + '-' + String(x.getMonth() + 1).padStart(2, '0') + '-' + String(x.getDate()).padStart(2, '0');
|
|
653
|
+
const plus = (v, n) => { const x = d(v); x.setDate(x.getDate() + n); return ymd(x); };
|
|
654
|
+
const first = plus(a, 1), start = first > today ? first : today, due = plus(b, -1);
|
|
655
|
+
const el = document.createElement('div');
|
|
656
|
+
el.className = 'tg-msp tg-gpc'; el.setAttribute('role', 'dialog'); el.setAttribute('aria-label', lines[0]); el.dataset.escLayer = '';
|
|
657
|
+
el.innerHTML = `<div class="w">${lines.map((t, i) => `<p class="${i ? 's' : ''}">${esc(t)}</p>`).join('')}${sk.map((k) => `<p class="s">${esc(skipWords(k.items))}</p>`).join('')}</div>`
|
|
658
|
+
+ (anchor.dataset.ahead ? `<button type="button" class="gp-add" aria-label="${esc('New task, ' + md(d(start)) + ' to ' + md(d(due)))}" title="New task">${'<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>'}</button>` : '');
|
|
659
|
+
document.body.appendChild(el); el.__a = anchor; msEl = el; anchor.setAttribute('aria-expanded', 'true');
|
|
660
|
+
const bx = anchor.getBoundingClientRect(), w = el.offsetWidth; el.style.left = Math.max(8, Math.min(bx.left + bx.width / 2 - w / 2, innerWidth - w - 8)) + 'px'; el.style.top = bx.bottom + 6 + 'px';
|
|
661
|
+
const add = el.querySelector('.gp-add');
|
|
662
|
+
if (add) { add.onclick = () => { msClose(); BI.openIni(r, anchor, { addTo: '', addDates: { start, due } }); }; add.focus({ preventScroll: true }); }
|
|
663
|
+
}
|
|
664
|
+
|
|
581
665
|
/** The Viewer shows an initiative of this board: its row is marked. */
|
|
582
666
|
function iniShown(key) {
|
|
583
667
|
peek = { kind: 'ini', key };
|
|
@@ -588,14 +672,14 @@ function iniHidden() {
|
|
|
588
672
|
if (!peek || peek.kind !== 'ini') return;
|
|
589
673
|
peek = null; $$('#ibBody .sel').forEach((x) => x.classList.remove('sel'));
|
|
590
674
|
}
|
|
591
|
-
/** A linked document opens in the Viewer: GET /api/doc, shown as its text. */
|
|
675
|
+
/** A linked document opens in the Viewer: GET /api/doc, shown as its text, and drawn again when the file changes (pm/doc-follow.js). */
|
|
592
676
|
document.addEventListener('click', (e) => {
|
|
593
677
|
const d = e.target.closest('[data-doc]'); if (!d || !M) return;
|
|
594
678
|
const path = d.dataset.doc, ws = M.board.ws || '', inVw = !!d.closest('#czViewer');
|
|
595
679
|
viewerOpen({ kind: 'Document', title: path.split('/').pop(), icon: 'doc', id: 'doc:' + path, back: inVw, render: async (body) => {
|
|
596
680
|
body.innerHTML = '<p class="bd-amut">Reading the document…</p>';
|
|
597
|
-
|
|
598
|
-
|
|
681
|
+
await followDoc({ ws, path, alive: () => body.isConnected && !!viewerCur() && viewerCur().id === 'doc:' + path,
|
|
682
|
+
onText: (text) => { body.innerHTML = text == null ? `<p class="bd-amut">${esc(path)} could not be read.</p>` : `<p class="bd-amut">${esc(path)}</p><pre class="bd-doc">${esc(text)}</pre>`; } });
|
|
599
683
|
} });
|
|
600
684
|
});
|
|
601
685
|
/* ── the tools the Agreed design draws but has no frame for: plain versions with a "Waiting for design" tag (pm/bd-acts.js) ─────────── */
|
|
@@ -745,18 +829,20 @@ async function readBoard(q) {
|
|
|
745
829
|
async function readAll(q) {
|
|
746
830
|
const h = await readBoard(q);
|
|
747
831
|
if (!h.r || !h.r.ok || h.r.state === 'reading') return h;
|
|
748
|
-
|
|
832
|
+
// several picked (?pick=): only those boards, the first one read first
|
|
833
|
+
const home = h.r.model, list = (home.board.switcher || []).filter((b) => !(b.ws === home.board.ws && b.id === home.board.id) && (PICK.length < 2 || PICK.includes(b.ws + '|' + b.id)));
|
|
749
834
|
const got = await Promise.all(list.map((b) => readBoard('ws=' + encodeURIComponent(b.ws) + '&board=' + encodeURIComponent(b.id))));
|
|
750
835
|
if (got.some((g) => g.r && g.r.state === 'reading')) return { r: { state: 'reading' }, status: 200 };
|
|
751
836
|
const B = [{ ws: home.board.ws || '', id: home.board.id, name: home.board.name, model: home }];
|
|
752
837
|
const lost = [];
|
|
753
838
|
got.forEach((g, i) => { if (g.r && g.r.ok && g.r.model) B.push({ ...list[i], model: g.r.model }); else lost.push(list[i].name + ' board'); });
|
|
754
839
|
const model = PG.mergeBoards(B);
|
|
840
|
+
if (PICK.length > 1 && B.length < (home.board.switcher || []).length) model.board.name = B.map((b) => model.board.products.find((p) => p.ws === b.ws && p.id === b.id)).filter(Boolean).map((p) => p.name).join(', ');
|
|
755
841
|
if (lost.length) { model.header.missing = [...model.header.missing, ...lost]; model.header.text += (/not read: /.test(model.header.text) ? ', ' : ' · not read: ') + lost.join(', '); }
|
|
756
842
|
return { r: { ok: true, model, stale: got.some((g) => g.r && g.r.stale) || h.r.stale }, status: 200 };
|
|
757
843
|
}
|
|
758
844
|
async function load() {
|
|
759
|
-
const p = new URLSearchParams(location.search),
|
|
845
|
+
const p = new URLSearchParams(location.search), [pw, pb] = PICK.length > 1 ? PICK[0].split('|') : [p.get('ws'), p.get('board')], q = [pw ? 'ws=' + encodeURIComponent(pw) : '', pb ? 'board=' + encodeURIComponent(pb) : ''].filter(Boolean).join('&');
|
|
760
846
|
const { r, status } = ALL ? await readAll(q) : await readBoard(q);
|
|
761
847
|
clearInterval(readTimer);
|
|
762
848
|
if (r && r.state === 'reading') {
|
|
@@ -795,13 +881,16 @@ async function setTask(r, uid, state) {
|
|
|
795
881
|
say(state + ': ' + (k ? k.title : uid) + '.', undo ? async () => { const u = await pmPost('/api/boards/tasks/state', { ...body, state: k.status }).catch(() => null); say(u && u.ok ? 'Back to ' + k.status + '.' : (u && u.error) || 'The undo did not land.'); load(); } : undefined);
|
|
796
882
|
load();
|
|
797
883
|
}
|
|
798
|
-
/** A task's start and due from the panel's Tasks (the date press, a Timeline drag)
|
|
884
|
+
/** A task's start and due from the panel's Tasks (the date press, a Timeline drag), or its ◇ milestone flag (batch 11 item 3): POST
|
|
885
|
+
* /api/boards/tasks/edit; Undo puts the old days or the old flag back. */
|
|
799
886
|
async function setDates(r, uid, patch) {
|
|
800
887
|
const k = (r.tasks || []).find((x) => x.uid === uid), body = { ws: r.ws || M.board.ws, board: r.boardId || M.board.id, task: uid };
|
|
801
888
|
const res = await pmPost('/api/boards/tasks/edit', { ...body, ...patch }).catch(() => null);
|
|
802
889
|
if (!res || res.ok === false) { say((res && res.error) || 'Nothing was changed.'); return; }
|
|
803
|
-
const
|
|
804
|
-
|
|
890
|
+
const ms = 'milestone' in patch;
|
|
891
|
+
const back = {}; for (const f of Object.keys(patch)) back[f] = f === 'milestone' ? (res.from && 'milestone' in res.from ? !!res.from.milestone : !patch.milestone) : k ? (f === 'due' ? k.end : k[f]) || '' : '';
|
|
892
|
+
const words = ms ? (patch.milestone ? 'Milestone' : 'Not a milestone') : 'Dates saved';
|
|
893
|
+
say(words + (k ? ': ' + k.title : '') + '.', k || ms ? async () => { const u = await pmPost('/api/boards/tasks/edit', { ...body, ...back }).catch(() => null); say(u && u.ok !== false ? (ms ? 'Put back.' : 'Dates put back.') : (u && u.error) || 'The undo did not land.'); load(); } : undefined);
|
|
805
894
|
load();
|
|
806
895
|
}
|
|
807
896
|
/** A task's title on the initiative view: the one task editor (task-card.js through home-task.js), as Home opens it; ← is the initiative. */
|
|
@@ -820,11 +909,13 @@ function openTask(r, k) {
|
|
|
820
909
|
}
|
|
821
910
|
/** A new task from the initiative view's + (the same box Home's page draws): POST /api/boards/tasks/add. → true when it was added.
|
|
822
911
|
* section: the stage it finishes (the Next cell's +, "Add what finishes <stage>"): the task is placed under it (POST /api/boards/tasks/edit). */
|
|
823
|
-
async function addTask(r, title, section) {
|
|
912
|
+
async function addTask(r, title, section, dates) {
|
|
824
913
|
const body = { ws: r.ws || M.board.ws, board: r.boardId || M.board.id };
|
|
825
914
|
const res = await pmPost('/api/boards/tasks/add', { ...body, initiative: r.id, title }).catch(() => null);
|
|
826
915
|
if (!res || res.ok === false) { say((res && res.error) || 'The task was not added.'); return false; }
|
|
827
916
|
const uid = res.item && res.item.uid;
|
|
917
|
+
// dates: a gap's + (batch 11 item 13) fills the task's start and due with the gap's days ahead
|
|
918
|
+
if (dates && uid) { const s1 = await pmPost('/api/boards/tasks/edit', { ...body, task: uid, start: dates.start, due: dates.due }).catch(() => null); if (!s1 || s1.ok === false) { say('Task added, but not its dates: ' + ((s1 && s1.error) || 'the server did not say why') + '.'); load(); return true; } }
|
|
828
919
|
if (section && uid) { const s2 = await pmPost('/api/boards/tasks/edit', { ...body, task: uid, section }).catch(() => null); if (!s2 || s2.ok === false) { say('Task added, but not under its stage: ' + ((s2 && s2.error) || 'the server did not say why') + '.'); load(); return true; } }
|
|
829
920
|
say('Task added.'); load();
|
|
830
921
|
return true;
|
|
@@ -853,7 +944,7 @@ Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePa
|
|
|
853
944
|
BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
|
|
854
945
|
send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
|
|
855
946
|
acts: (r, b) => Acts.open.row(r, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
|
|
856
|
-
programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), rename: renameIni, setTask, setDates, addTask, openTask, turnProgram });
|
|
947
|
+
programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, toast: say, rename: renameIni, setTask, setDates, addTask, openTask, turnProgram, moveItems });
|
|
857
948
|
/** Tap the title to rename (canvas RnAIni): the list, the Timeline and the panel show the new name at once; Undo is the same press.
|
|
858
949
|
* The Jira box opens Home's chat about it with the request typed, for the PM to send (PMOS holds no Jira credential, D53). */
|
|
859
950
|
// a name the PM just saved holds over a read that predates it (the board derives off the request path) until a read says it too
|
|
@@ -569,7 +569,7 @@ function copyText(text, said) { try { navigator.clipboard.writeText(text).then((
|
|
|
569
569
|
let ovCss = false;
|
|
570
570
|
function openGoalDetail(id, open0) {
|
|
571
571
|
let g = goalById(id); if (!g) return;
|
|
572
|
-
if (!ovCss) { ovCss = true; const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '
|
|
572
|
+
if (!ovCss) { ovCss = true; const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./ov-view.css', import.meta.url).href; document.head.append(l); } // the where row Moved by shares
|
|
573
573
|
const own = goalWs(g) === M.board.ws, st = { open: open0 || '', more: false, adding: false, own };
|
|
574
574
|
const kr = krId(g);
|
|
575
575
|
const more = [], stepsGoal = g.type === 'Done or not' && g.steps && g.steps.length;
|
|
@@ -176,7 +176,7 @@ export function presentHtml(V, slideHtml = () => '', deck = null) {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/* ── the page half ── */
|
|
179
|
-
const CSS = ['
|
|
179
|
+
const CSS = [new URL('./premium-vw-slides.css', import.meta.url).href, new URL('./cozy-mtg-present.css', import.meta.url).href];
|
|
180
180
|
function sheets(doc, abs, again) {
|
|
181
181
|
if (abs) return copySheets(doc, again);
|
|
182
182
|
for (const h of CSS) if (!doc.querySelector(`link[href="${h}"]`)) { const l = doc.createElement('link'); l.rel = 'stylesheet'; l.href = h; doc.head.append(l); }
|
|
@@ -186,7 +186,7 @@ function sheets(doc, abs, again) {
|
|
|
186
186
|
function copySheets(doc, again) {
|
|
187
187
|
let st = doc.getElementById('vzxAudCss');
|
|
188
188
|
if (st && st.dataset.full === '1') return;
|
|
189
|
-
const want = CSS.concat(['
|
|
189
|
+
const want = CSS.concat([new URL('./cozy.css', import.meta.url).href]);
|
|
190
190
|
const text = [], got = new Set();
|
|
191
191
|
for (const sh of document.styleSheets) {
|
|
192
192
|
const w = sh.href && want.find((x) => sh.href.split('?')[0].endsWith(x)); if (!w) continue;
|
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
* wordsOf(md, fallback) the document as { title, sections: [{ h, lines }] } (pure)
|
|
37
37
|
* slideHtml(lines) a section's lines as html (pure) · splitRender(html) · slideCard(s, mini) · fit(root) · schedLabel(setup) (pure)
|
|
38
38
|
*
|
|
39
|
-
*
|
|
39
|
+
* The open report follows its file (PM, 2026-10-26: "When chat make update on the file that being shown on the current viewer, I should not need to
|
|
40
|
+
* refresh page"): every few seconds GET /api/doc-sheet/stamp gives the text's hash, and a change is read and drawn again. Not while editing or while a
|
|
41
|
+
* popover is open; the next check after that catches it.
|
|
42
|
+
* READS: GET /api/doc, /api/doc-sheet/stamp, /api/report-design/cycle and cycle-html (a cycle drawn to its saved design), /api/report-setups (schedule and audience),
|
|
40
43
|
* /api/viewer-report/checks, /api/report-structure and /api/report-design (the Brief), /api/report-confirm, /api/insights-premium (Live page),
|
|
41
44
|
* /api/shares, /api/shares/password, /api/report-export (the files). Every render is HTML the server sanitized, shown in a frame with an empty
|
|
42
45
|
* sandbox: nothing in it runs.
|
|
@@ -76,7 +79,7 @@ const WAIT = (f) => `<span class="vz-wait" data-cz-placeholder="${esc(f)}">Waiti
|
|
|
76
79
|
/** The reader's own sheet (cozy-vw-rp.css), added to the page once. */
|
|
77
80
|
function rpStyle() {
|
|
78
81
|
if (typeof document === 'undefined' || document.querySelector('link[data-rp-css]')) return;
|
|
79
|
-
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '
|
|
82
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./cozy-vw-rp.css', import.meta.url).href; l.setAttribute('data-rp-css', ''); document.head.appendChild(l);
|
|
80
83
|
}
|
|
81
84
|
/** "Oct 21", from a cycle's YYYY-MM-DD slot. */
|
|
82
85
|
export const shortSlot = (s) => { const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(String(s || '')); return m ? MONS[+m[2] - 1] + ' ' + +m[3] : String(s || ''); };
|
|
@@ -870,8 +873,24 @@ export async function openReport(row, hand = {}) {
|
|
|
870
873
|
readBrief(); // the Brief tab's count shows at once
|
|
871
874
|
if (vCur() && vCur().id === me.vid && (vCur().title !== me.name || me.audience)) { me.reopen = true; vOpen(head()); me.reopen = false; } // the name and audience are known now
|
|
872
875
|
draw();
|
|
876
|
+
watchFile(me);
|
|
873
877
|
return me;
|
|
874
878
|
}
|
|
879
|
+
const CHECK_MS = 2500;
|
|
880
|
+
/** Read the report again when its file changed on disk (a chat or a draft run wrote it). Stops when another report opens or the panel closes. */
|
|
881
|
+
async function watchFile(me) {
|
|
882
|
+
const stamp = async () => { const j = await Promise.resolve(pmGet('/api/doc-sheet/stamp?' + q({ ws: me.ws, path: me.row.path }))).catch(() => null); return j && j.ok ? j.hash : null; };
|
|
883
|
+
let seen = await stamp();
|
|
884
|
+
while (R === me) {
|
|
885
|
+
await new Promise((ok) => setTimeout(ok, CHECK_MS));
|
|
886
|
+
if (R !== me) return;
|
|
887
|
+
if (document.hidden || me.edit || me.busy || me.pop) continue;
|
|
888
|
+
const h = await stamp();
|
|
889
|
+
if (R !== me || !h) continue;
|
|
890
|
+
if (seen && h !== seen) { await reread(); if (R === me && !me.edit && !me.pop) draw(); }
|
|
891
|
+
seen = h;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
875
894
|
|
|
876
895
|
/** The window.czViews entry: a report path (reports/<cadence>/<date>.md) or a Reports row. o = { ws, name, cycles, onIssue, onChange } */
|
|
877
896
|
export async function openReportView(ref, o = {}) {
|
|
@@ -51,7 +51,7 @@ const T = new Map(); // view id → its state
|
|
|
51
51
|
/** The report parts' sheet (cozy-vw-rp.css), added to the page once (premium-report-read.js adds the same one). */
|
|
52
52
|
function rpStyle() {
|
|
53
53
|
if (typeof document === 'undefined' || document.querySelector('link[data-rp-css]')) return;
|
|
54
|
-
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '
|
|
54
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./cozy-vw-rp.css', import.meta.url).href; l.setAttribute('data-rp-css', ''); document.head.appendChild(l);
|
|
55
55
|
}
|
|
56
56
|
const SV = (d, n = 16) => `<svg viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
57
57
|
/** Open (or refresh) the view of a checked report block (report-chat.js cleanBlock). */
|
|
@@ -826,15 +826,30 @@ export function crumbHtml(o) {
|
|
|
826
826
|
: `<nav class="crumb" aria-label="Where you are">${o.page ? `<span class="crpg">${esc(o.page)}</span>` : ''}<button id="crBoard" aria-current="page" disabled>${esc(o.board)}</button>${chev('crSw', 'Switch board', o.boards && o.boards.length > 1)}${menu}</nav>`;
|
|
827
827
|
return `<div class="where">${left}</div>`;
|
|
828
828
|
}
|
|
829
|
-
/** o: { boards: [{ws,id,name}], board: id, siblings: [{id,title}], ini: id, goBoard(ws, id), goIni(id) }. Escape and a click outside close the menu; the arrows move in it.
|
|
829
|
+
/** o: { boards: [{ws,id,name}], board: id, siblings: [{id,title}], ini: id, goBoard(ws, id), goIni(id) }. Escape and a click outside close the menu; the arrows move in it.
|
|
830
|
+
* With o.picked (['ws|id', …]) and o.goPicked(keys) the board menu ticks several (the Board's products, batch 11 item 7): a press ticks or unticks
|
|
831
|
+
* and the menu stays open; the board with id '*' (All products) ticks every one; the last tick stays; the pick goes when the menu closes. */
|
|
830
832
|
export function wireCrumb(o) {
|
|
831
833
|
const menu = $('#crMenu'); if (!menu) return;
|
|
832
|
-
const
|
|
834
|
+
const multi = !!(o.picked && o.goPicked), one = (o.boards || []).filter((b) => b.id !== '*'), kOf = (b) => b.ws + '|' + b.id;
|
|
835
|
+
let tick = null; // the ticks while the menu is open (multi): a Set of 'ws|id'
|
|
836
|
+
const close = () => {
|
|
837
|
+
const was = !menu.hidden && menu.dataset.k === 'b' && tick;
|
|
838
|
+
menu.hidden = true; $$('#crSw,#crSw2').forEach((b) => b.setAttribute('aria-expanded', 'false'));
|
|
839
|
+
if (was) { const k = one.map(kOf).filter((x) => tick.has(x)); tick = null; if (k.join(',') !== one.map(kOf).filter((x) => o.picked.includes(x)).join(',')) o.goPicked(k); }
|
|
840
|
+
};
|
|
841
|
+
const TK = '<i class="crtk" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></i>', PART = '<i class="crtk part" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M7 12h10"/></svg></i>';
|
|
842
|
+
const ticks = () => (o.boards || []).map((b) => {
|
|
843
|
+
if (b.id === '*') { const n = one.filter((x) => tick.has(kOf(x))).length, st = n === one.length ? 'true' : 'mixed'; return `<button role="menuitemcheckbox" data-sw="*|*" aria-checked="${st}">${esc(b.name)}${st === 'true' ? TK : PART}</button><span class="crsep" role="separator"></span>`; }
|
|
844
|
+
const on = tick.has(kOf(b));
|
|
845
|
+
return `<button role="menuitemcheckbox" data-sw="${esc(kOf(b))}" aria-checked="${on}">${esc(b.name)}${on ? TK : '<i class="crtk"></i>'}</button>`;
|
|
846
|
+
}).join('');
|
|
833
847
|
const open = (kind, btn) => {
|
|
834
848
|
if (!menu.hidden && menu.dataset.k === kind) { close(); return; }
|
|
835
849
|
close(); menu.dataset.k = kind;
|
|
850
|
+
if (kind === 'b' && multi) tick = new Set(o.picked);
|
|
836
851
|
menu.innerHTML = kind === 'b'
|
|
837
|
-
? (o.boards || []).map((b) => `<button role="menuitem" data-sw="${esc(b.ws + '|' + b.id)}"${b.id === o.board ? ' aria-current="true"' : ''}>${esc(b.name)}</button>`).join('')
|
|
852
|
+
? multi ? ticks() : (o.boards || []).map((b) => `<button role="menuitem" data-sw="${esc(b.ws + '|' + b.id)}"${b.id === o.board ? ' aria-current="true"' : ''}>${esc(b.name)}</button>`).join('')
|
|
838
853
|
: (o.siblings || []).map((s) => `<button role="menuitem" data-swi="${esc(s.id)}"${s.id === o.ini ? ' aria-current="true"' : ''}>${esc(s.title)}</button>`).join('');
|
|
839
854
|
menu.hidden = false; btn.setAttribute('aria-expanded', 'true'); const f = $('button', menu); if (f) f.focus();
|
|
840
855
|
};
|
|
@@ -843,7 +858,17 @@ export function wireCrumb(o) {
|
|
|
843
858
|
if (b2) b2.onclick = (e) => { e.stopPropagation(); open('i', b2); };
|
|
844
859
|
$('#crBoard').onclick = () => { if (o.ini && o.goBoard) { const b = (o.boards || []).find((x) => x.id === o.board); o.goBoard(b ? b.ws : null, o.board); } };
|
|
845
860
|
menu.onclick = (e) => {
|
|
846
|
-
const k = e.target.closest('[data-sw]');
|
|
861
|
+
const k = e.target.closest('[data-sw]');
|
|
862
|
+
if (k && tick) {
|
|
863
|
+
// a tick: All products ticks every product; a product ticks or unticks, the last one stays ticked; the menu stays open
|
|
864
|
+
e.stopPropagation();
|
|
865
|
+
if (k.dataset.sw === '*|*') one.forEach((b) => tick.add(kOf(b)));
|
|
866
|
+
else if (!tick.has(k.dataset.sw)) tick.add(k.dataset.sw);
|
|
867
|
+
else if (tick.size > 1) tick.delete(k.dataset.sw);
|
|
868
|
+
const at = k.dataset.sw; menu.innerHTML = ticks(); const f = menu.querySelector(`[data-sw="${CSS.escape(at)}"]`); if (f) f.focus();
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
if (k && o.goBoard) { const [ws, id] = k.dataset.sw.split('|'); close(); o.goBoard(ws, id); return; }
|
|
847
872
|
const q = e.target.closest('[data-swi]'); if (q && o.goIni) { close(); o.goIni(q.dataset.swi); }
|
|
848
873
|
};
|
|
849
874
|
document.addEventListener('click', (e) => { if (!e.target.closest('#crSw,#crSw2,#crMenu')) close(); });
|
|
@@ -155,7 +155,7 @@ function onKey(e) {
|
|
|
155
155
|
}
|
|
156
156
|
export function vwStyle(name) {
|
|
157
157
|
if (!/^[a-z0-9-]+$/.test(name || '') || document.querySelector(`link[data-vw-css="${name}"]`)) return;
|
|
158
|
-
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href =
|
|
158
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL(`./premium-vw-${name}.css`, import.meta.url).href; l.dataset.vwCss = name; document.head.append(l);
|
|
159
159
|
}
|
|
160
160
|
export function vwConfirm(el, o) {
|
|
161
161
|
return new Promise((done) => {
|
|
@@ -170,7 +170,7 @@ export function vwConfirm(el, o) {
|
|
|
170
170
|
}
|
|
171
171
|
/* The Agreed design (initiative premium-agreed-design): the dialog and the Viewer take the cozy look on a page whose body has class cz.
|
|
172
172
|
* The sheet is inert elsewhere, so it is loaded on every page that imports the viewer. */
|
|
173
|
-
if (typeof document !== 'undefined' && document.head && !document.querySelector('link[href
|
|
174
|
-
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = '
|
|
173
|
+
if (typeof document !== 'undefined' && document.head && !document.querySelector('link[href$="/cozy-viewer.css"]')) {
|
|
174
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./cozy-viewer.css', import.meta.url).href; document.head.append(l);
|
|
175
175
|
}
|
|
176
176
|
if (typeof window !== 'undefined') window.__premiumViewer = { vwOpen, vwClose, vwShow, vwReset, vwState, vwStyle, vwConfirm, vwCount };
|