create-pmos 0.739.0 → 0.741.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 +33 -39
- package/payload/AGENTS.md +1 -0
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +32 -0
- package/workspace/guide/breakdown.md +8 -0
- package/workspace/guide/cli.md +10 -0
- package/workspace/guide/layout.md +2 -4
- package/workspace/lib/glossary-cli.js +94 -0
- package/workspace/lib/glossary.js +112 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-glossary.js +29 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-ini-panel.js +1 -1
- package/workspace/public/pm/bd-pop-ds.css +3 -5
- package/workspace/public/pm/bd-pop-ds.js +26 -4
- package/workspace/public/pm/cozy-ev.css +6 -0
- package/workspace/public/pm/cozy-nav.js +2 -0
- package/workspace/public/pm/cozy-pop-work.css +1 -0
- package/workspace/public/pm/cozy-pop-work.js +51 -14
- package/workspace/public/pm/cozy-viewer.js +6 -1
- package/workspace/public/pm/cozy-vw-shell.css +6 -0
- package/workspace/public/pm/glossary.js +250 -0
- package/workspace/public/pm/home-ini.js +1 -1
- package/workspace/public/pm/live-edit.js +9 -1
- package/workspace/public/pm/pop-work-model.js +2 -0
- package/workspace/public/pm/work-tree.js +19 -1
- package/workspace/test-lists/artefacts-menu.json +9 -0
- package/workspace/test-lists/jira-row-edit.json +9 -0
- package/workspace/test-lists/product-glossary.json +9 -0
|
@@ -46,6 +46,7 @@ import './draft-keep.js'; // forms-keep-drafts: every text box on every page k
|
|
|
46
46
|
import { pmPost } from './http.js'; // Adler (batch 16 item 2): every toast carries his S face; Settings > Adler is read once
|
|
47
47
|
import { startUseLog } from './use-log.js'; // bet A466: every page mounts the menu, so the menu starts the local use log (this computer only)
|
|
48
48
|
import { startActionKeys } from './action-keys.js'; // bet A477: y o s p z act on the item under the pointer, ? lists the keys
|
|
49
|
+
import { startGlossary } from './glossary.js'; // bet A386: a product's own words show their meaning on hover (a long press on a phone)
|
|
49
50
|
import { startFocusMode } from './focus-mode.js'; // bet A335: f shows only the item under the pointer and its chat; f again puts the page back
|
|
50
51
|
|
|
51
52
|
/* The six places (slice 1). A place shows once it has an href: Events, Library and Routine get theirs when their slice ships. Until then
|
|
@@ -206,6 +207,7 @@ export function mountNav(here, doc = document, opts = {}) {
|
|
|
206
207
|
startUseLog(doc);
|
|
207
208
|
startActionKeys(doc);
|
|
208
209
|
startFocusMode(doc);
|
|
210
|
+
startGlossary(doc);
|
|
209
211
|
const fab = w.querySelector('#czFab'), menu = w.querySelector('#czMenu'), scrim = w.querySelector('#czScrim');
|
|
210
212
|
const draw = () => {
|
|
211
213
|
N.rail = railOn();
|
|
@@ -218,6 +218,7 @@ button.pw-osrc:hover { color: var(--cz-ink2); }
|
|
|
218
218
|
.hi-pop .pw-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: var(--fs-meta); color: var(--cz-ink2); padding: 5px 10px; cursor: pointer; }
|
|
219
219
|
.hi-pop .pw-seg button[aria-checked="true"] { background: var(--cz-card); color: var(--cz-ink); font-weight: var(--fw-strong); box-shadow: 0 0 0 1px var(--cz-hair); }
|
|
220
220
|
.hi-pop .pw-jn { margin: 6px 0 0; color: var(--cz-ink3); }
|
|
221
|
+
.pw-st .pw-jmv { color: var(--cz-ink3); font-size: inherit; }
|
|
221
222
|
.pw-addty { flex: none; display: inline-flex; align-items: center; gap: var(--space-4); border: 0; border-radius: var(--radius-pill); background: none; font: inherit; font-size: var(--fs-meta); color: var(--cz-ink3); padding: 2px var(--space-8); cursor: pointer; margin-right: 10px; }
|
|
222
223
|
.pw-addty:hover, .pw-addty.on { background: var(--cz-well); color: var(--cz-ink); }
|
|
223
224
|
/* a Details value that opens something reads in the link colour; a value read from the work stays plain (round 3 design check) */
|
|
@@ -24,6 +24,7 @@ import { pmGet, pmPost } from './http.js';
|
|
|
24
24
|
import * as LE from './live-edit.js'; // an edit shows at once: this popup is drawn again the moment a task write is sent, and after each read
|
|
25
25
|
import * as VW from './cozy-viewer.js';
|
|
26
26
|
import * as ED from './ini-edit.js';
|
|
27
|
+
import * as JM from './jira-move.js'; // a Jira ticket's status, moved in Jira (jira-row-edit)
|
|
27
28
|
import * as SW from './cozy-status-when.js'; // When did this happen? after a status pick (round 3 point 18)
|
|
28
29
|
import * as DP from './cozy-day-pick.js'; // the app's own day form, "15 Oct 2026"
|
|
29
30
|
import { mountRange, rangeHtml } from './range-pick.js'; // start and due on one calendar, like a flight's depart and return
|
|
@@ -259,11 +260,17 @@ function barHtml(x, W) {
|
|
|
259
260
|
return CB.taskBar(x, X, W.today);
|
|
260
261
|
}
|
|
261
262
|
function rowHtml(x, W, C, sugRows) {
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
// a Jira row's key chip opens the ticket: its own link, else the same site's link with its key (jira-row-edit)
|
|
264
|
+
const chip = (q) => PD.keyChip({ ...q, jurl: WT.chipUrl(q, W.rows) }) + PD.epicDot(q, W.epics || []);
|
|
265
|
+
const jc = W.jc ? (x.kind === 'task' ? `<span class="pw-jc">${PD.keyChip({ ...x, jurl: WT.chipUrl(x, W.rows) })}${PD.epicDot(x, W.epics || [])}</span>` : '<span class="pw-jc"></span>') : '';
|
|
266
|
+
// what the row lets the PM change, the same for every Jira row (jira-row-edit): a published copy changes nothing and shows no ✦
|
|
267
|
+
const E = WT.editOf(x, RO);
|
|
268
|
+
if (RO) sugRows = new Map();
|
|
264
269
|
const tl = C.tl ? `<div class="pw-tl">${(x.kind === 'stage' || x.kind === 'task') ? barHtml(x, W) : ''}${W.tx != null ? `<i class="pw-now" style="left:${W.tx.toFixed(2)}%"></i>` : ''}</div>` : '';
|
|
265
|
-
|
|
266
|
-
const
|
|
270
|
+
// the status: a PMOS task's opens its list; a Jira ticket's moves it in Jira, and says "Moving in Jira" until Jira answers
|
|
271
|
+
const jst = E.status === 'jira' ? `<button type="button" class="pw-cell" data-pw-jstat="${esc(x.uid)}" aria-haspopup="menu" aria-label="${esc('Status in Jira: ' + (x.jst || x.status) + '. Move it in Jira')}" title="Status, moved in Jira">${esc(x.status)}${x.jmv ? ' <small class="pw-jmv">Moving in Jira</small>' : ''}</button>` : '';
|
|
272
|
+
const stc = C.status ? `<span class="pw-st">${jst || (E.status === 'pmos' ? `<button type="button" class="pw-cell" data-pw-status="${esc(x.uid)}" aria-haspopup="menu" aria-label="${esc('Status: ' + x.status + '. Change it')}">${esc(x.status)}</button>` : esc(x.status || ''))}</span>` : '';
|
|
273
|
+
const dtc = C.date ? `<span class="pw-dt${x.late ? ' warn' : ''}">${E.dates ? `<button type="button" class="pw-cell${x.date ? '' : ' empty'}" data-pw-date="${esc(x.uid)}" aria-label="${esc((x.date ? (x.ms ? 'Milestone ' : 'Due ') + x.date : 'No date') + '. Set the date, or make it a ' + (x.ms ? 'task' : 'milestone'))}">${esc(x.date || 'Set a date')}</button>` : esc(x.date || '')}</span>` : '';
|
|
267
274
|
if (x.kind === 'stage') {
|
|
268
275
|
const lead = `<button type="button" class="pw-stg" data-pw-fold="${esc(x.key)}" aria-expanded="${x.open}"${x.can ? '' : ' disabled'}><span class="pw-n">${esc(x.n)}</span><b>${esc(x.name)}</b>${x.can ? SVG(x.open ? P.down : P.right, 14) : ''}<small>${esc(x.count)}</small></button>`;
|
|
269
276
|
const ls = x.loose ? sugRows.get('stage:') : null; // the one ✦ of the Not in a stage row (round 3 point 21)
|
|
@@ -273,10 +280,10 @@ function rowHtml(x, W, C, sugRows) {
|
|
|
273
280
|
if (x.kind === 'far') return `<div class="pw-tr pw-sr" role="row"><span class="pw-it"><button type="button" class="pw-stg" data-pw-far aria-expanded="false"><span class="pw-n">${esc(x.n)}</span><b>${esc(x.name)}</b>${SVG(P.right, 14)}<small>${esc(x.count)}</small></button></span>${jc}${stc}${C.date ? '<span></span>' : ''}${tl}</div>`;
|
|
274
281
|
if (x.kind === 'more') return `<div class="pw-tr pw-dr" role="row"><span class="pw-it"><button type="button" class="pw-dn" data-pw-more="${esc(x.key)}" aria-expanded="false">${esc(x.label)}${SVG(P.right, 14)}</button></span>${jc}${C.status ? '<span></span>' : ''}${C.date ? '<span></span>' : ''}${C.tl ? '<div class="pw-tl"></div>' : ''}</div>`;
|
|
275
282
|
const s = sugRows.get(x.uid);
|
|
276
|
-
const title =
|
|
283
|
+
const title = !E.name ? `<span class="pw-tt">${esc(x.title)}</span>` : `<button type="button" class="pw-tt" data-pw-name="${esc(x.uid)}" aria-label="${esc('Rename ' + x.title)}">${esc(x.title)}</button>`;
|
|
277
284
|
// subtasks (WorkSubtasksDS): indent one step per level, a parent's fold and count; a Jira row's key chip and the epic check's dot (WorkJiraDS)
|
|
278
285
|
const chev = x.kids ? `<button type="button" class="pw-chev" data-pw-sub="${esc(x.uid)}" aria-expanded="${!!x.open}" aria-label="${esc((x.open ? 'Fold ' : 'Open ') + x.title)}">${SVG(x.open ? P.down : P.right, 13)}</button>` : '';
|
|
279
|
-
const more2 = (x.kids ? `<small class="pw-cnt">${esc(x.count)}</small>` : '') + (W.jc ? '' :
|
|
286
|
+
const more2 = (x.kids ? `<small class="pw-cnt">${esc(x.count)}</small>` : '') + (W.jc ? '' : chip(x));
|
|
280
287
|
return `<div class="pw-tr pw-kr${x.done ? ' done' : ''}${x.lit ? ' lit' : ''}${x.kids ? ' par' : ''}${RSEL.has(String(x.uid)) ? ' sel' : ''}" role="row" data-pw-row="${esc(x.uid)}" data-pw-sec="${esc(x.sec)}"${x.depth ? ` style="--pw-d:${x.depth}"` : ''}><span class="pw-it">${chev}<i class="pw-bul${x.ms ? ' ms' : ''}" aria-hidden="true"></i>${title}${more2}${RO ? '' : ib(`data-pw-open="${esc(x.uid)}"`, 'Open the task', P.open, 'xs hov') + ib(`data-pw-row-more="${esc(x.uid)}" aria-haspopup="menu"`, 'More for ' + x.title, P.more, 'xs hov')}</span>${jc}${stc}${dtc}${tl}</div>`
|
|
281
288
|
+ (s ? `<div class="pw-tr pw-sugrow" role="row"><span class="pw-it">${sugLine(s, true)}</span></div>` : '');
|
|
282
289
|
}
|
|
@@ -393,12 +400,11 @@ function dsHtml(r, v, o, W, S, C, mode) {
|
|
|
393
400
|
const wbs = view === 'gantt'
|
|
394
401
|
? breakdownHtml(W, C, mode, false, S).replace('<h3>Work breakdown</h3>', head('gantt') + (S.sel.size ? SEL.barHtml(S.sel.size, { epic: epicSel }) : '')).replace('class="pw-sec"', 'class="pw-sec pm-block pwd-blk pwd-wbs"')
|
|
395
402
|
: `<section class="pm-block pwd-blk pwd-wbs" aria-label="Work breakdown">${S.sel.size ? '' : head('list')}${PD.listHtml(stF, W, { looseN: W.looseN, epics, fix, ask, sel: S.sel, nested: st.some((x) => x.kids), drag: canDrag(), group, epicSel })}</section>`;
|
|
396
|
-
const mg = mergeOf(W.artefacts), merge = mg ? `<div class="pw-sugs pw-amg" role="list" aria-label="PMOS suggests">${sugLine({ id: mg.id, say: mg.say, merge: mg })}</div>` : '';
|
|
397
403
|
// the done test's acceptance criteria on the initiative's Jira tickets (jira-criteria-write): its ✦ above the breakdown, unless the PM said no
|
|
398
404
|
const crit = S.sel.size || dropped().has('crit:' + id) ? '' : critSugHtml(CRIT.get(id));
|
|
399
405
|
// Overview (Wawan, 2026-11-23): Where it stands, The case and its facts in one block across the top; folded or open is the person's choice
|
|
400
|
-
|
|
401
|
-
|
|
406
|
+
// one column (artefacts-in-more-menu, Wawan 2026-11-23): the Stages and the breakdown take the full width; the artefacts are in ⋯ (moreItems)
|
|
407
|
+
return `<div class="pw pwd">${PD.overviewHtml(W, r, { oid: id, dropped: dropped(), open: ovOpen() })}<div class="pwd-main">${PD.stagesHtml(st, W)}${crit}${wbs}</div></div>`;
|
|
402
408
|
}
|
|
403
409
|
|
|
404
410
|
/** The grouping ✦ the PM said no to, for this initiative: 'group:<stage>'. */
|
|
@@ -720,6 +726,7 @@ export function wire(body, h0, x0) {
|
|
|
720
726
|
if ('pwAddty' in d) { S.msAdd = !S.msAdd; const f = b.closest('.pw-add'), k = f && f.querySelector('[data-pw-add]') && f.querySelector('[data-pw-add]').dataset.pwAdd; redraw(); if (k != null) setTimeout(() => { const i = body.querySelector(`[data-pw-add="${window.CSS.escape(k)}"]`); if (i) i.focus(); }, 0); return; }
|
|
721
727
|
if (d.pwFact) { fact(d.pwFact, b, c, h); return; }
|
|
722
728
|
if (d.pwStatus) { statusMenu(b, d.pwStatus, h, c); return; }
|
|
729
|
+
if (d.pwJstat) { jiraStatusMenu(b, d.pwJstat, h, c); return; }
|
|
723
730
|
if (d.pwDate) { dateMenu(b, d.pwDate, c, h); return; }
|
|
724
731
|
if (d.pwName) { rename(b, d.pwName, h); return; }
|
|
725
732
|
if ('pwPhall' in d) { if (PH_ALL.has(c.id)) PH_ALL.delete(c.id); else PH_ALL.add(c.id); redraw(); return; } // a phone: the other stages unfold (PhoneWorkDS)
|
|
@@ -908,6 +915,22 @@ function statusMenu(btn, uid, h, c) {
|
|
|
908
915
|
w.querySelector('[data-sw]')?.focus();
|
|
909
916
|
}, { label: 'Status', focus: '[aria-checked="true"]' });
|
|
910
917
|
}
|
|
918
|
+
/* A Jira ticket's status (jira-row-edit, Wawan 2026-11-23 "why some Jira can edit but some cannot?"): To do, In progress or Done, asked of
|
|
919
|
+
* Jira through the jira-move agent with the PM's own connection (pm/jira-move.js). The row shows the pick at once (pm/live-edit.js), says
|
|
920
|
+
* "Moving in Jira" until Jira answers, and the toast says what Jira did: moved (with Undo), refused (Jira's reason), or not reached. */
|
|
921
|
+
function jiraStatusMenu(btn, uid, h, c) {
|
|
922
|
+
const row = (c && c.W.rows.find((x) => x.uid === uid)) || {}, key = WT.keyOf(row) || row.jkey || '';
|
|
923
|
+
if (!key) return;
|
|
924
|
+
const from = JM.TO.includes(row.status) ? row.status : /progress|review/i.test(row.status || '') ? 'In progress' : row.done ? 'Done' : 'To do';
|
|
925
|
+
openPop(btn, 'pw-status', JM.TO.map((s) => `<button type="button" class="hi-mi" role="menuitemradio" aria-checked="${s === from}" data-st="${esc(s)}">${esc(s)}</button>`).join('')
|
|
926
|
+
+ `<p class="hi-small pw-jn">${esc('Moves ' + key + ' in Jira' + (row.jst ? '. Jira says ' + row.jst + ' now' : '') + '.')}</p>`, (b) => {
|
|
927
|
+
const to = b.dataset.st; if (!to) return;
|
|
928
|
+
closePop();
|
|
929
|
+
if (to === from) return;
|
|
930
|
+
const at = h.where ? h.where() : {};
|
|
931
|
+
JM.move({ ...h, where: () => at, __id: () => String((c && c.id) || '') }, { key, to, from, fromRaw: row.jst || '' });
|
|
932
|
+
}, { label: 'Status in Jira', focus: '[aria-checked="true"]' });
|
|
933
|
+
}
|
|
911
934
|
/* Task or Milestone (round 3 point 2), in three places that do the same write (pm/ini-edit.js milestone, the host's Undo): the choice on top
|
|
912
935
|
* of the date popup, the row's ⋯, and the add row. A task has Start and Due; a milestone one Date. A Jira task's change is PMOS-only. */
|
|
913
936
|
const jiraNote = (row) => (row.jira ? '<p class="hi-small pw-jn">PMOS only. Jira is not changed.</p>' : '');
|
|
@@ -930,12 +953,13 @@ function rowMenu(btn, uid, c, h, body) {
|
|
|
930
953
|
+ `<button type="button" class="hi-mi" role="menuitem" data-k="open">${SVG(P.open, 14)} Open the task</button>`
|
|
931
954
|
// subtasks (WorkSubtasksDS): make it a subtask of another task, or move it out of its parent
|
|
932
955
|
+ (row.jsub ? '' : `<button type="button" class="hi-mi" role="menuitem" data-k="under" aria-haspopup="menu">${SVG(P.right, 14)} Make subtask of…</button>`)
|
|
933
|
-
+ (row.up && !row.jsub ? `<button type="button" class="hi-mi" role="menuitem" data-k="out">${SVG(P.show, 14)} Move out of ${esc(((c.W.rows.find((q) => q.uid === row.up) || {}).title) || 'its parent')}</button>` : '')
|
|
956
|
+
+ (row.up && !row.jsub ? `<button type="button" class="hi-mi" role="menuitem" data-k="out">${SVG(P.show, 14)} Move out of ${esc(((c.W.rows.find((q) => q.uid === row.up) || {}).title) || 'its parent')}</button>` : '')
|
|
957
|
+
+ (row.jira ? '<p class="hi-small pw-jn">Status moves in Jira. Dates and kind are PMOS only.</p>' : ''), (b) => {
|
|
934
958
|
const k = b.dataset.k;
|
|
935
959
|
if (k === 'under') { parentMenu(btn, [uid], c, h, body.__pwx); return; }
|
|
936
960
|
if (k === 'out') { closePop(); runBulk([uid], 'parent', '', c, h, body.__pwx); return; }
|
|
937
961
|
// Status opens its own list (and its "when did this happen" line) in place of this menu
|
|
938
|
-
if (k === 'status') { statusMenu(btn, uid, h, c); return; }
|
|
962
|
+
if (k === 'status') { if (row.jira) jiraStatusMenu(btn, uid, h, c); else statusMenu(btn, uid, h, c); return; }
|
|
939
963
|
closePop();
|
|
940
964
|
if (k === 'kind') setKind(row, !row.ms, h);
|
|
941
965
|
else if (k === 'open') openSmall(uid, c, h, body.__pwx, body);
|
|
@@ -1356,14 +1380,27 @@ async function addArt(x, h) {
|
|
|
1356
1380
|
onAdded: async () => { ITEMS.delete(o.id); if (h.reload) await h.reload(); VW.back(); } });
|
|
1357
1381
|
}
|
|
1358
1382
|
|
|
1359
|
-
/** The ⋯ entries the popup adds before the host's own:
|
|
1360
|
-
|
|
1361
|
-
|
|
1383
|
+
/** The ⋯ entries the popup adds before the host's own: the initiative's Artefacts first (desk layout only; a phone lists them in the page),
|
|
1384
|
+
* every part of the old page, as a drill-in, and every suggestion. body: the popup body the host drew into (it carries the wired handlers). */
|
|
1385
|
+
export function moreItems(x, h, body) {
|
|
1386
|
+
const out = artItems(body);
|
|
1362
1387
|
if (h.allParts) out.push({ label: 'Every part', on: () => h.allParts() });
|
|
1363
1388
|
if (h.props) out.push({ label: 'Everything PMOS suggests', on: () => h.props() });
|
|
1364
1389
|
return out.length ? out.concat({ sep: true }) : out;
|
|
1365
1390
|
}
|
|
1366
1391
|
|
|
1392
|
+
/** The Artefacts section of ⋯ (artefacts-in-more-menu): read when ⋯ opens, so an artefact just added is there. The presses are the ones the
|
|
1393
|
+
* side card had: open full screen with Back, add, and the ✦ merge goes to the chat. */
|
|
1394
|
+
function artItems(body) {
|
|
1395
|
+
if (!body || !body.__pwx || !body.querySelector || !body.querySelector('.pw.pwd')) return [];
|
|
1396
|
+
const x = body.__pwx, h = body.__pwh || {}, r = x.r(), v = x.v();
|
|
1397
|
+
if (!r || !v) return [];
|
|
1398
|
+
const W = model(r, v, x.o()).W, mg = mergeOf(W.artefacts);
|
|
1399
|
+
return PD.artMenu(W.artefacts, { ro: RO, merge: mg }).map((it) => ({ ...it, top: true })).map((it) => (it.art != null ? { ...it, on: () => openArt(W.artefacts[it.art], h, x) }
|
|
1400
|
+
: it.add ? { ...it, on: () => addArt(x, h) }
|
|
1401
|
+
: it.merge ? { ...it, on: () => { if (!sendToChat(mg.ask) && h.toast) h.toast('Open Ask PMOS to send this.'); } } : it));
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1367
1404
|
/* ── one level up: a program or a product (boards 26, 27) ── */
|
|
1368
1405
|
export function levelHtml(L, o = {}) {
|
|
1369
1406
|
const W = M.levelOf(L, { today: o.today, mode: store.get(SPAN, 'full') }), C = cols(), mode = store.get(SPAN, 'full');
|
|
@@ -419,6 +419,9 @@ function itemsOf(X, b) {
|
|
|
419
419
|
const items = ((typeof X.cur.more === 'function' ? X.cur.more() : X.cur.more) || []).filter(Boolean).slice(); // a function is asked each time ⋯ opens, so its notes are current
|
|
420
420
|
// on a phone the presses marked menu lead the menu (they left the header)
|
|
421
421
|
if (X.ph || X.pop) { const mp = (X.cur.presses || []).filter((x) => x && x.act && x.label && (X.ph ? x.menu : !x.solid)); if (mp.length) items.unshift(...mp.map((x) => ({ label: x.label, icon: x.icon, on: () => { if (typeof X.cur.onPress === 'function') X.cur.onPress(x.act, b); } })), { sep: true }); }
|
|
422
|
+
// a section marked top (an initiative's Artefacts, artefacts-in-more-menu) leads the menu, before the presses that left the header
|
|
423
|
+
const top = items.filter((x) => x && x.top);
|
|
424
|
+
if (top.length) { const rest = items.filter((x) => !(x && x.top)); items.length = 0; items.push(...top, ...rest); }
|
|
422
425
|
if (X.cur.url) { // the item's own address looks back, so it goes before the red stop-or-remove group, which stays last
|
|
423
426
|
const at = items.findIndex((x) => x && x.danger), tab = { label: X.cur.full ? 'Open in full' : 'Open in a new tab', on: () => window.open(X.cur.url, '_blank', 'noopener') };
|
|
424
427
|
if (at < 0) items.push({ sep: true }, tab); else items.splice(at > 0 && items[at - 1].sep ? at - 1 : at, 0, { sep: true }, tab);
|
|
@@ -448,7 +451,9 @@ function moreMenu(b) {
|
|
|
448
451
|
const items = lead.concat(itemsOf(V, b), places.length ? [{ sep: true }, ...places] : []);
|
|
449
452
|
const m = document.createElement('div');
|
|
450
453
|
m.className = 'cz-vw-menu'; m.setAttribute('role', 'menu'); m.setAttribute('aria-label', 'More'); m.dataset.escLayer = '1';
|
|
451
|
-
|
|
454
|
+
// a head names a section (an initiative's Artefacts, artefacts-in-more-menu); a sub is an item's second line (its kind and day)
|
|
455
|
+
if (items.some((it) => it && it.sub)) m.classList.add('cz-vw-menu2');
|
|
456
|
+
m.innerHTML = items.map((it, i) => (it.sep ? '<hr>' : it.head ? `<p class="cz-vw-mh" role="presentation">${esc(it.head)}</p>` : `<button type="button" role="menuitem" data-cz-vw-mi="${i}"${it.danger ? ' class="bad"' : ''}${it.disabled ? ' disabled' : ''}${it.sub ? ` title="${esc(it.label)}"` : ''}>${it.icon ? svg(path(it.icon), 16) : ''}${it.sub ? `<span class="cz-vw-m2"><span>${esc(it.label)}</span><small>${esc(it.sub)}</small></span>` : `<span>${esc(it.label)}</span>`}${it.note || it.hint ? `<span class="k">${esc(it.note || it.hint)}</span>` : ''}</button>`)).join('');
|
|
452
457
|
m.addEventListener('click', (e) => {
|
|
453
458
|
const x = e.target.closest('[data-cz-vw-mi]'); if (!x) return;
|
|
454
459
|
const it = items[+x.dataset.czVwMi]; m.remove(); b.setAttribute('aria-expanded', 'false');
|
|
@@ -55,6 +55,12 @@ body.cz-vw-drag, body.cz-vw-drag * { cursor: col-resize !important; user-select:
|
|
|
55
55
|
.cz-vw-menu hr { border: 0; border-top: 1px solid var(--cz-hair); margin: var(--space-4) 6px; }
|
|
56
56
|
.cz-vw-menu .k { margin-left: auto; color: var(--cz-ink3); font-size: var(--fs-meta); line-height: var(--lh-meta); }
|
|
57
57
|
.cz-vw-menu .bad { color: var(--cz-red); }
|
|
58
|
+
.cz-vw-menu.cz-vw-menu2 { width: 300px; max-height: min(70vh, 560px); overflow-y: auto; }
|
|
59
|
+
.cz-vw-menu .cz-vw-mh { margin: 0; padding: var(--space-8) 10px var(--space-4); color: var(--cz-ink3); font: var(--fw-strong) var(--fs-meta)/var(--lh-meta) var(--cz-sans); }
|
|
60
|
+
.cz-vw-menu .cz-vw-m2 { display: flex; flex-direction: column; min-width: 0; padding: 6px 0; }
|
|
61
|
+
.cz-vw-menu .cz-vw-m2 > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
62
|
+
.cz-vw-menu .cz-vw-m2 > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--cz-ink3); font-weight: var(--fw-regular); font-size: var(--fs-meta); line-height: var(--lh-meta); }
|
|
63
|
+
.cz-vw-menu button:disabled .cz-vw-m2 > small { color: var(--cz-red); }
|
|
58
64
|
/* the trail list (batch 14 item 7, canvas NvADesk, NvAPhoneTrail): hover ← → on a desk, hold it on a phone; newest first, then the page */
|
|
59
65
|
.cz-vw-hd [data-cz-vw="fwd"] { margin-left: -6px; }
|
|
60
66
|
.cz-vw-trail { position: absolute; width: 280px; max-height: 60vh; overflow: auto; background: var(--cz-card); border-radius: var(--radius-card); box-shadow: var(--cz-sheet), 0 0 0 1px var(--cz-hair); padding: 6px; z-index: 7; display: flex; flex-direction: column; gap: 2px; }
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/* pm/glossary.js — a product's own words explain themselves on every page (bet A386, initiative glossary-hover; the store is
|
|
2
|
+
* lib/glossary.js, written by `pmos glossary`, read through GET /api/glossary).
|
|
3
|
+
*
|
|
4
|
+
* The words of the products the page shows (the product pick, pm/cozy-pick.js) get a faint dotted underline. A hover over one, or a long
|
|
5
|
+
* press on a phone, shows a small card: the word, what it means and, when more than one product is shown, whose word it is.
|
|
6
|
+
* The underline is the browser's CSS highlight (::highlight(pm-term) in cozy-ev.css), so the page's own markup is never changed; a browser
|
|
7
|
+
* without CSS highlights shows no underline and the hover still works. Text in inputs, editable text, code, terminals, the menu and the
|
|
8
|
+
* card itself is left alone. Each meaning shown is noted once on this computer (pm/use-log.js noteUse `glossary-show`, no text).
|
|
9
|
+
*
|
|
10
|
+
* startGlossary(doc) called once by the menu (pm/cozy-nav.js mountNav), which every page mounts; a second call does nothing,
|
|
11
|
+
* and so does a call in a browser a script drives (navigator.webdriver)
|
|
12
|
+
* matcherOf(terms) PURE: the matcher for [{ term, meaning, ws }] → { find(text), entries(key) } or null when there are none
|
|
13
|
+
* findTerms(text, terms) PURE: [{ start, end, text, key }] whole words; a term with a capital letter matches that case only,
|
|
14
|
+
* an all-lowercase term any case; the longer term wins where two overlap
|
|
15
|
+
* tipHtml(entries, o) PURE: the card's markup; o.names: show each product's name, o.nameOf(ws) the name
|
|
16
|
+
* skipped(el) true when the text under `el` is left alone (SKIP) */
|
|
17
|
+
import { pmGet } from './http.js';
|
|
18
|
+
import { readPick } from './cozy-pick.js';
|
|
19
|
+
import { productName } from './scope-chip.js';
|
|
20
|
+
import { noteUse } from './use-log.js';
|
|
21
|
+
|
|
22
|
+
export const SKIP = 'input, textarea, select, code, pre, script, style, noscript, svg, [contenteditable=""], [contenteditable="true"], [role="textbox"], .xterm, #czNav, .gl-tip';
|
|
23
|
+
export const HL = 'pm-term';
|
|
24
|
+
export const SHOW = 'glossary-show';
|
|
25
|
+
const MAX_NODES = 5000;
|
|
26
|
+
const MAX_HITS = 800;
|
|
27
|
+
const HOVER_MS = 250;
|
|
28
|
+
const PRESS_MS = 450;
|
|
29
|
+
const AGAIN_MS = 10000; // the same word shown again within this time is not counted again
|
|
30
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
31
|
+
const reEsc = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
32
|
+
const keyOf = (t) => String(t || '').replace(/\s+/g, ' ').trim().toLowerCase();
|
|
33
|
+
const say = (s) => { try { console.info('[glossary] ' + s); } catch { /* no console */ } };
|
|
34
|
+
|
|
35
|
+
/** PURE. The matcher for a list of words, or null when there are none. */
|
|
36
|
+
export function matcherOf(terms) {
|
|
37
|
+
const by = new Map();
|
|
38
|
+
for (const t of terms || []) {
|
|
39
|
+
const k = keyOf(t && t.term);
|
|
40
|
+
if (!k || !String((t && t.meaning) || '').trim()) continue;
|
|
41
|
+
if (!by.has(k)) by.set(k, []);
|
|
42
|
+
by.get(k).push(t);
|
|
43
|
+
}
|
|
44
|
+
if (!by.size) return null;
|
|
45
|
+
const cs = new Set(), ci = new Set();
|
|
46
|
+
for (const list of by.values()) for (const t of list) {
|
|
47
|
+
const w = String(t.term).replace(/\s+/g, ' ').trim();
|
|
48
|
+
(/\p{Lu}/u.test(w) ? cs : ci).add(w);
|
|
49
|
+
}
|
|
50
|
+
const alt = (set) => [...set].sort((a, b) => b.length - a.length).map((w) => reEsc(w).replace(/ /g, '\\s+')).join('|');
|
|
51
|
+
const wrap = (set, flags) => (set.size ? new RegExp('(?<![\\p{L}\\p{N}])(?:' + alt(set) + ')(?![\\p{L}\\p{N}])', flags) : null);
|
|
52
|
+
const res = [wrap(cs, 'gu'), wrap(ci, 'giu')].filter(Boolean);
|
|
53
|
+
const find = (text) => {
|
|
54
|
+
const s = String(text || '');
|
|
55
|
+
if (!s.trim()) return [];
|
|
56
|
+
const hits = [];
|
|
57
|
+
for (const re of res) { re.lastIndex = 0; let m; while ((m = re.exec(s))) { hits.push({ start: m.index, end: m.index + m[0].length, text: m[0], key: keyOf(m[0]) }); if (!m[0].length) re.lastIndex++; } }
|
|
58
|
+
hits.sort((a, b) => a.start - b.start || (b.end - b.start) - (a.end - a.start));
|
|
59
|
+
const out = [];
|
|
60
|
+
for (const h of hits) {
|
|
61
|
+
const last = out[out.length - 1];
|
|
62
|
+
if (last && h.start < last.end) { if (h.end - h.start > last.end - last.start) out[out.length - 1] = h; continue; }
|
|
63
|
+
out.push(h);
|
|
64
|
+
}
|
|
65
|
+
return out.filter((h) => by.has(h.key));
|
|
66
|
+
};
|
|
67
|
+
return { find, entries: (k) => by.get(keyOf(k)) || [], size: by.size };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** PURE. The words found in `text`. */
|
|
71
|
+
export function findTerms(text, terms) { const m = matcherOf(terms); return m ? m.find(text) : []; }
|
|
72
|
+
|
|
73
|
+
/** PURE. The card for one word: its meaning per product (one line each when two products use the same word). */
|
|
74
|
+
export function tipHtml(entries, o = {}) {
|
|
75
|
+
const list = (entries || []).filter((e) => e && e.term && e.meaning);
|
|
76
|
+
if (!list.length) return '';
|
|
77
|
+
const nameOf = o.nameOf || ((ws) => ws);
|
|
78
|
+
const rows = list.map((e) => `<p class="gl-m">${o.names && e.ws ? `<span class="pm-meta">${esc(nameOf(e.ws))}</span> ` : ''}${esc(e.meaning)}</p>`).join('');
|
|
79
|
+
return `<div class="pm-ds gl-tip" role="tooltip" id="glTip"><b class="pm-h-sm">${esc(list[0].term)}</b>${rows}</div>`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const skipped = (el) => !!(el && el.closest && el.closest(SKIP));
|
|
83
|
+
|
|
84
|
+
let started = false;
|
|
85
|
+
const S = { doc: null, M: null, names: false, nodes: new Map(), ranges: [], tip: null, at: null, hoverT: 0, hideT: 0, pressT: 0, press: null, eat: false, shown: new Map(), scanT: 0, mo: null };
|
|
86
|
+
|
|
87
|
+
function botNow() { try { return !!(typeof navigator !== 'undefined' && navigator.webdriver); } catch { return false; } }
|
|
88
|
+
|
|
89
|
+
/** Find the words in the page's text and underline them. */
|
|
90
|
+
function scan() {
|
|
91
|
+
const doc = S.doc;
|
|
92
|
+
S.nodes = new Map(); S.ranges = [];
|
|
93
|
+
if (!S.M || !doc.body) { paint(); return; }
|
|
94
|
+
const win = doc.defaultView;
|
|
95
|
+
const walker = doc.createTreeWalker(doc.body, 4 /* SHOW_TEXT */, { acceptNode: (n) => (n.nodeValue && n.nodeValue.trim() && n.parentElement && !skipped(n.parentElement) ? 1 : 2) });
|
|
96
|
+
let n, seen = 0, hits = 0;
|
|
97
|
+
while ((n = walker.nextNode()) && seen++ < MAX_NODES && hits < MAX_HITS) {
|
|
98
|
+
const found = S.M.find(n.nodeValue);
|
|
99
|
+
if (!found.length) continue;
|
|
100
|
+
S.nodes.set(n, found);
|
|
101
|
+
for (const h of found) {
|
|
102
|
+
if (hits++ >= MAX_HITS) break;
|
|
103
|
+
try { const r = doc.createRange(); r.setStart(n, h.start); r.setEnd(n, h.end); S.ranges.push({ r, key: h.key }); } catch { /* the node changed */ }
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
paint(win);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function paint(win = S.doc && S.doc.defaultView) {
|
|
110
|
+
try {
|
|
111
|
+
if (!win || !win.CSS || !win.CSS.highlights || typeof win.Highlight !== 'function') return;
|
|
112
|
+
if (S.ranges.length) win.CSS.highlights.set(HL, new win.Highlight(...S.ranges.map((x) => x.r)));
|
|
113
|
+
else win.CSS.highlights.delete(HL);
|
|
114
|
+
} catch { /* no highlights: the hover still works */ }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const inRect = (x, y, b) => x >= b.left - 1 && x <= b.right + 1 && y >= b.top - 1 && y <= b.bottom + 1;
|
|
118
|
+
|
|
119
|
+
/** The word under a point, or null. */
|
|
120
|
+
function hitAt(x, y) {
|
|
121
|
+
const doc = S.doc;
|
|
122
|
+
let node = null, off = -1;
|
|
123
|
+
try {
|
|
124
|
+
if (doc.caretPositionFromPoint) { const p = doc.caretPositionFromPoint(x, y); if (p) { node = p.offsetNode; off = p.offset; } }
|
|
125
|
+
else if (doc.caretRangeFromPoint) { const r = doc.caretRangeFromPoint(x, y); if (r) { node = r.startContainer; off = r.startOffset; } }
|
|
126
|
+
} catch { node = null; }
|
|
127
|
+
const tryRange = (r, key) => { for (const b of r.getClientRects()) if (inRect(x, y, b)) return { r, key, box: r.getBoundingClientRect() }; return null; };
|
|
128
|
+
if (node && S.nodes.has(node)) {
|
|
129
|
+
for (const h of S.nodes.get(node)) {
|
|
130
|
+
if (off < h.start || off > h.end) continue;
|
|
131
|
+
const x2 = S.ranges.find((q) => q.r.startContainer === node && q.r.startOffset === h.start);
|
|
132
|
+
const got = x2 && tryRange(x2.r, x2.key);
|
|
133
|
+
if (got) return got;
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
if (node) return null;
|
|
138
|
+
for (const q of S.ranges) { const got = tryRange(q.r, q.key); if (got) return got; } // no caret API: look through the words
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function show(hit) {
|
|
143
|
+
const doc = S.doc;
|
|
144
|
+
const html = tipHtml(S.M.entries(hit.key), { names: S.names, nameOf: (ws) => productName(ws, ws) });
|
|
145
|
+
if (!html) return;
|
|
146
|
+
hide();
|
|
147
|
+
const wrap = doc.createElement('div');
|
|
148
|
+
wrap.innerHTML = html;
|
|
149
|
+
const tip = wrap.firstElementChild;
|
|
150
|
+
doc.body.appendChild(tip);
|
|
151
|
+
const win = doc.defaultView, vw = win.innerWidth || 1280, vh = win.innerHeight || 800;
|
|
152
|
+
const tb = tip.getBoundingClientRect(), b = hit.box;
|
|
153
|
+
const left = Math.max(8, Math.min(b.left, vw - tb.width - 8));
|
|
154
|
+
const below = b.bottom + 6 + tb.height <= vh;
|
|
155
|
+
tip.style.setProperty('--fr-gl-x', left + 'px'); // run-time geometry only; the card's look is in cozy-ev.css
|
|
156
|
+
tip.style.setProperty('--fr-gl-y', (below ? b.bottom + 6 : Math.max(8, b.top - tb.height - 6)) + 'px');
|
|
157
|
+
S.tip = tip; S.at = hit.key;
|
|
158
|
+
const last = S.shown.get(hit.key) || 0, now = Date.now();
|
|
159
|
+
if (now - last > AGAIN_MS) { S.shown.set(hit.key, now); noteUse(SHOW); say('shown'); }
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function hide() { if (S.tip) { S.tip.remove(); S.tip = null; S.at = null; } }
|
|
163
|
+
|
|
164
|
+
let moveQ = null, moveF = 0;
|
|
165
|
+
function onMove(e) {
|
|
166
|
+
if (e.pointerType && e.pointerType !== 'mouse') return;
|
|
167
|
+
moveQ = { clientX: e.clientX, clientY: e.clientY, target: e.target };
|
|
168
|
+
if (moveF) return;
|
|
169
|
+
const w = S.doc.defaultView, raf = w && w.requestAnimationFrame ? (f) => w.requestAnimationFrame(f) : (f) => setTimeout(f, 16);
|
|
170
|
+
moveF = raf(() => { moveF = 0; const q = moveQ; moveQ = null; if (q) onPoint(q); });
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function onPoint(e) {
|
|
174
|
+
if (S.tip && e.target && e.target.closest && e.target.closest('.gl-tip')) { clearTimeout(S.hideT); return; }
|
|
175
|
+
const hit = S.M ? hitAt(e.clientX, e.clientY) : null;
|
|
176
|
+
clearTimeout(S.hoverT);
|
|
177
|
+
if (hit) {
|
|
178
|
+
clearTimeout(S.hideT);
|
|
179
|
+
if (S.at === hit.key && S.tip) return;
|
|
180
|
+
S.hoverT = setTimeout(() => show(hit), HOVER_MS);
|
|
181
|
+
} else if (S.tip) {
|
|
182
|
+
clearTimeout(S.hideT);
|
|
183
|
+
S.hideT = setTimeout(hide, 150);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function onTouchStart(e) {
|
|
188
|
+
if (S.tip && !(e.target && e.target.closest && e.target.closest('.gl-tip'))) hide();
|
|
189
|
+
clearTimeout(S.pressT);
|
|
190
|
+
if (!S.M || !e.touches || e.touches.length !== 1) return;
|
|
191
|
+
const t = e.touches[0];
|
|
192
|
+
S.press = { x: t.clientX, y: t.clientY };
|
|
193
|
+
S.pressT = setTimeout(() => {
|
|
194
|
+
const hit = hitAt(S.press.x, S.press.y);
|
|
195
|
+
if (hit) { S.eat = true; show(hit); }
|
|
196
|
+
}, PRESS_MS);
|
|
197
|
+
}
|
|
198
|
+
function onTouchMove(e) {
|
|
199
|
+
const t = e.touches && e.touches[0];
|
|
200
|
+
if (S.press && t && Math.hypot(t.clientX - S.press.x, t.clientY - S.press.y) > 10) clearTimeout(S.pressT);
|
|
201
|
+
}
|
|
202
|
+
function onTouchEnd() { clearTimeout(S.pressT); }
|
|
203
|
+
// the press that showed a meaning does not also open the row under it, nor the phone's own menu
|
|
204
|
+
function eatClick(e) { if (S.eat) { S.eat = false; e.preventDefault(); e.stopPropagation(); } }
|
|
205
|
+
function eatMenu(e) { if (S.eat) e.preventDefault(); }
|
|
206
|
+
|
|
207
|
+
async function load() {
|
|
208
|
+
let ws = [];
|
|
209
|
+
try { const P = await readPick(); ws = P ? P.products.filter((p) => p.on).map((p) => p.ws) : []; } catch { ws = []; }
|
|
210
|
+
const r = await Promise.resolve(pmGet('/api/glossary' + (ws.length ? '?ws=' + encodeURIComponent(ws.join(',')) : ''))).catch(() => null);
|
|
211
|
+
const terms = r && r.ok && Array.isArray(r.terms) ? r.terms : [];
|
|
212
|
+
S.M = matcherOf(terms);
|
|
213
|
+
S.names = new Set(terms.map((t) => t.ws)).size > 1;
|
|
214
|
+
scan();
|
|
215
|
+
watch();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function watch() {
|
|
219
|
+
const doc = S.doc, win = doc.defaultView;
|
|
220
|
+
if (S.mo || !S.M || !win || typeof win.MutationObserver !== 'function') return;
|
|
221
|
+
S.mo = new win.MutationObserver((list) => {
|
|
222
|
+
const ours = (n) => !!(n && n.nodeType === 1 && n.classList && n.classList.contains('gl-tip'));
|
|
223
|
+
// the card coming and going, or a change inside it, is not a change of the page's text
|
|
224
|
+
if (list.every((m) => (m.target && m.target.closest && m.target.closest('.gl-tip')) || (m.type === 'childList' && [...m.addedNodes, ...m.removedNodes].every(ours)))) return;
|
|
225
|
+
clearTimeout(S.scanT);
|
|
226
|
+
S.scanT = setTimeout(scan, 500);
|
|
227
|
+
});
|
|
228
|
+
S.mo.observe(doc.body, { childList: true, subtree: true, characterData: true });
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export function startGlossary(doc = typeof document !== 'undefined' ? document : null) {
|
|
232
|
+
if (started || !doc || !doc.body) return false;
|
|
233
|
+
if (botNow()) return false; // a browser a script drives: no underline, no meanings, nothing noted
|
|
234
|
+
started = true;
|
|
235
|
+
S.doc = doc;
|
|
236
|
+
const win = doc.defaultView;
|
|
237
|
+
doc.addEventListener('pointermove', onMove, { passive: true });
|
|
238
|
+
doc.addEventListener('touchstart', onTouchStart, { passive: true });
|
|
239
|
+
doc.addEventListener('touchmove', onTouchMove, { passive: true });
|
|
240
|
+
doc.addEventListener('touchend', onTouchEnd, { passive: true });
|
|
241
|
+
doc.defaultView.addEventListener('click', eatClick, true); // capture on the window: runs before the row's own press
|
|
242
|
+
doc.addEventListener('contextmenu', eatMenu, true);
|
|
243
|
+
doc.addEventListener('keydown', (e) => { if (e.key === 'Escape') hide(); });
|
|
244
|
+
if (win) {
|
|
245
|
+
win.addEventListener('scroll', hide, { passive: true, capture: true });
|
|
246
|
+
win.addEventListener('pp:changed', () => { load(); });
|
|
247
|
+
}
|
|
248
|
+
load();
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
@@ -498,7 +498,7 @@ export function iniPage(o = {}) {
|
|
|
498
498
|
let rename = X.ctx.renameIni ? X.ctx.renameIni(id, '') : null;
|
|
499
499
|
if (rename) rename = { ...rename, value: X.ctx.iniTitle(id) };
|
|
500
500
|
const dh = dashFor(id);
|
|
501
|
-
BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', wrap: true, more: () => (PW.on(BODY) ? PW.moreItems(null, popExtra(id)) : []).concat(pageMore(id), PW.on(BODY) && !PW.inPop(BODY) ? moreOf(id, 'page').filter((x) => x.sep || /full record|Sprint/.test(x.label)) : []), rename, // a phone's page (Ph2_init) keeps the record and the sprint pop: o.pop || undefined,
|
|
501
|
+
BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', wrap: true, more: () => (PW.on(BODY) ? PW.moreItems(null, popExtra(id), BODY) : []).concat(pageMore(id), PW.on(BODY) && !PW.inPop(BODY) ? moreOf(id, 'page').filter((x) => x.sep || /full record|Sprint/.test(x.label)) : []), rename, // a phone's page (Ph2_init) keeps the record and the sprint pop: o.pop || undefined,
|
|
502
502
|
discuss: () => X.ctx.newIn(id), discussHome: true, // the one view (OvViewers): Discuss starts a new session about it, where + New session was
|
|
503
503
|
// the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds
|
|
504
504
|
presses: [WK.pressOf(kindNow(id))].concat(dh ? dh.presses() : []), onPress: (a, btn) => {
|
|
@@ -35,6 +35,10 @@ export const FIELDS = {
|
|
|
35
35
|
parent: ['parent'],
|
|
36
36
|
};
|
|
37
37
|
const TASK_WRITE = /^\/api\/boards\/tasks\/(state|edit|rename|add|delete|bulk)(?:\?|$)/;
|
|
38
|
+
// a Jira ticket's status asked from PMOS (pm/jira-move.js): the ticket shows its new status at once; a refused ask puts it back. Jira's own
|
|
39
|
+
// answer comes later, by the read and the move's toast (jira-row-edit)
|
|
40
|
+
const JIRA_MOVE = /^\/api\/jira\/move(?:\?|$)/;
|
|
41
|
+
const JIRA_TO = ['To do', 'In progress', 'Done'];
|
|
38
42
|
const JIRA_KEY = /^[A-Z][A-Z0-9]+-\d+$/i;
|
|
39
43
|
const isJira = (id) => JIRA_KEY.test(id) && !/^task-/i.test(id); // a PMOS task id is task-<hex>, which can be all digits
|
|
40
44
|
const DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -58,6 +62,10 @@ function pick(body, rename) {
|
|
|
58
62
|
* { kind: 'remove', id } tasks/delete
|
|
59
63
|
* { kind: 'add', ini, row } tasks/add: a row drawn under its initiative until the read brings the real one */
|
|
60
64
|
export function opsOf(path, body) {
|
|
65
|
+
if (JIRA_MOVE.test(String(path || ''))) {
|
|
66
|
+
const key = body && typeof body.key === 'string' ? body.key.trim().toUpperCase() : '';
|
|
67
|
+
return JIRA_KEY.test(key) && JIRA_TO.includes(body.to) && body.to !== body.from ? [{ kind: 'patch', id: key, fields: { state: body.to } }] : null;
|
|
68
|
+
}
|
|
61
69
|
const m = TASK_WRITE.exec(String(path || ''));
|
|
62
70
|
if (!m || !body || typeof body !== 'object') return null;
|
|
63
71
|
const w = m[1];
|
|
@@ -252,7 +260,7 @@ export function install(g = globalThis) {
|
|
|
252
260
|
const method = String((init && init.method) || (input && typeof input === 'object' && input.method) || 'GET').toUpperCase();
|
|
253
261
|
if (method === 'POST' && url && init && typeof init.body === 'string') {
|
|
254
262
|
const p = new URL(url, 'http://x').pathname;
|
|
255
|
-
if (TASK_WRITE.test(p)) le = begin(p, JSON.parse(init.body));
|
|
263
|
+
if (TASK_WRITE.test(p) || JIRA_MOVE.test(p)) le = begin(p, JSON.parse(init.body));
|
|
256
264
|
}
|
|
257
265
|
} catch { le = null; }
|
|
258
266
|
if (!le) return real.call(this, input, init);
|
|
@@ -305,6 +305,8 @@ function taskRow(x, t) {
|
|
|
305
305
|
const dl = x.end ? dateLate(x.end, t, !x.closed) : { text: x.start ? 'from ' + dayText(x.start, t) : '', late: false };
|
|
306
306
|
const st = taskStatus(x);
|
|
307
307
|
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,
|
|
308
|
+
// 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
|
|
309
|
+
...(x.jkey ? { jkey: x.jkey, jst: x.jst || '', ...(x.jmove && x.jmove.state === 'moving' ? { jmv: true } : {}) } : {}),
|
|
308
310
|
prog: /progress|review/i.test(st), wont: !!x.wont || st === "Won't do",
|
|
309
311
|
// subtasks and Jira (initiative work-subtasks): the parent, the chip's key and link, the epic as read, the assignee, a Jira sub-task
|
|
310
312
|
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 || '',
|
|
@@ -62,11 +62,29 @@ const doneCat = (s) => s && (s.category === 'done' || /^(done|closed|resolved|re
|
|
|
62
62
|
export function subRows(row) {
|
|
63
63
|
return ((row && row.jsubs) || []).filter((s) => s && s.key).map((s) => ({ kind: 'task', uid: s.key, title: s.summary || s.key, parent: row.uid, jira: true, jkey: s.key, ckey: s.key, jsub: true,
|
|
64
64
|
jurl: row.jurl ? String(row.jurl).replace(/\/browse\/[^/?#]+/, '/browse/' + s.key) : '', closed: !!doneCat(s), done: !!doneCat(s), status: doneCat(s) ? 'Done' : /progress|review|doing/i.test(String(s.status || '')) ? 'In progress' : 'To do',
|
|
65
|
-
start: '', end: '', owner: '' }));
|
|
65
|
+
start: '', end: '', owner: '', jst: String(s.status || '') }));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/** The Jira key a row's chip shows: the linked ticket's, else the one the task names that PMOS read. */
|
|
69
69
|
export const keyOf = (row) => (row && (row.ckey || row.jkey)) || '';
|
|
70
|
+
/** The link a row's key chip opens (jira-row-edit): its own, else the same site's link of any other row with the key swapped in. A ticket
|
|
71
|
+
* PMOS pushed, or read before its link was, then still opens in Jira, so no chip is grey for want of a link. '' when no row has one. */
|
|
72
|
+
export function chipUrl(row, rows) {
|
|
73
|
+
const k = keyOf(row);
|
|
74
|
+
if (!k) return '';
|
|
75
|
+
if (row.jurl && /^https:\/\//.test(row.jurl)) return row.jurl;
|
|
76
|
+
const r = (rows || []).find((x) => x && x.jurl && /^https:\/\/[^/]+\/browse\//.test(x.jurl));
|
|
77
|
+
return r ? r.jurl.replace(/\/browse\/[^/?#]+/, '/browse/' + k) : '';
|
|
78
|
+
}
|
|
79
|
+
/** What a breakdown row lets the PM change (jira-row-edit, Wawan 2026-11-23 "why some Jira can edit but some cannot?"). The same for every
|
|
80
|
+
* Jira row: status moves the ticket in Jira (pm/jira-move.js); start, due and name are PMOS's own (the date popup says "PMOS only").
|
|
81
|
+
* A Jira sub-task PMOS only read has no PMOS task under it: its status moves in Jira, its dates and name stay Jira's.
|
|
82
|
+
* → { status: 'jira' | 'pmos', dates, name } ro: a published read-only copy, where nothing changes. */
|
|
83
|
+
export function editOf(row, ro = false) {
|
|
84
|
+
if (ro || !row || row.kind !== 'task') return { status: '', dates: false, name: false };
|
|
85
|
+
if (row.jsub) return { status: 'jira', dates: false, name: false };
|
|
86
|
+
return { status: row.jira ? 'jira' : 'pmos', dates: true, name: true };
|
|
87
|
+
}
|
|
70
88
|
export function epicFlag(row, epics) {
|
|
71
89
|
if (!row || !keyOf(row) || row.jsub || row.jsubOf || isSubType(row.jtype)) return '';
|
|
72
90
|
if (row.jepic == null) return ''; // not read: PMOS says nothing it has not read
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "artefacts-in-more-menu (done test AM1-AM5): the initiative popup's artefacts move into its ⋯ menu so the Stages and Work breakdown use the full width. Pure menu items plus a read of the page code. No browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"artefacts-menu.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"artefacts-menu.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "jira-row-edit: every Jira task in a work breakdown offers the same changes (pure, node): pm/work-tree.js editOf and chipUrl, pm/live-edit.js Jira moves, pm/pop-work-model.js Jira fields, and a read of pm/cozy-pop-work.js and pm/bd-pop-ds.js.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"jira-row-edit.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"jira-row-edit.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "initiative glossary-hover (bet A386): a product's own words explain themselves on hover; the store, matcher, pmos glossary, GET /api/glossary and the page's parts on scratch folders (no server, network or browser).",
|
|
3
|
+
"modules": [
|
|
4
|
+
"product-glossary.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"product-glossary.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|