create-pmos 0.712.0 → 0.713.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 +80 -38
- package/payload/KIT-VERSION +1 -1
- package/payload/design-system/ui/README.md +1 -1
- package/payload/design-system/ui/components/State/README.md +21 -0
- package/payload/design-system/ui/components/State/preview.html +8 -0
- package/payload/design-system/ui/components/bundle.css +12 -0
- package/payload/design-system/ui/interactions.md +2 -0
- 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/bin/back-place-health.js +70 -0
- package/workspace/changelog.json +79 -0
- package/workspace/design-system/ui/README.md +1 -1
- package/workspace/design-system/ui/components/State/README.md +21 -0
- package/workspace/design-system/ui/components/State/preview.html +8 -0
- package/workspace/design-system/ui/components/bundle.css +12 -0
- package/workspace/design-system/ui/interactions.md +2 -0
- package/workspace/guide/breakdown.md +20 -1
- package/workspace/guide/claude-proposes.md +5 -1
- package/workspace/guide/cli.md +10 -1
- package/workspace/guide/home.md +1 -0
- package/workspace/guide/initiatives-and-next-steps.md +13 -0
- package/workspace/guide/layout.md +8 -1
- package/workspace/guide/routine.md +10 -2
- package/workspace/guide/settings-and-switches.md +4 -0
- package/workspace/lib/briefing-premium-products.js +16 -2
- package/workspace/lib/changed-mark.js +34 -0
- package/workspace/lib/launch-cli.js +43 -5
- package/workspace/lib/launch-tiers.js +143 -0
- package/workspace/lib/needs-providers.js +1 -0
- package/workspace/lib/parked-cli.js +105 -0
- package/workspace/lib/parked-reasons.js +245 -0
- package/workspace/lib/pmos-verbs.js +4 -1
- package/workspace/lib/prefs-sync.js +138 -0
- package/workspace/lib/product-dots.js +60 -0
- package/workspace/lib/route-modules.js +2 -0
- package/workspace/lib/routes-briefing-premium.js +11 -1
- package/workspace/lib/routes-prefs.js +56 -0
- package/workspace/lib/routes-strategy-card.js +53 -0
- package/workspace/lib/routes-use-log.js +24 -3
- package/workspace/lib/routine-sentence.js +250 -0
- package/workspace/lib/strategy-card.js +133 -0
- package/workspace/lib/unused-controls.js +178 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/back-place.js +87 -0
- package/workspace/public/pm/bd-pop-ds.css +10 -0
- package/workspace/public/pm/bd-pop-ds.js +27 -3
- package/workspace/public/pm/bd-strategy.js +85 -0
- package/workspace/public/pm/bd-views.js +2 -1
- package/workspace/public/pm/changed-mark.css +7 -0
- package/workspace/public/pm/changed-mark.js +117 -0
- package/workspace/public/pm/cozy-pick.css +12 -0
- package/workspace/public/pm/cozy-pop-work.css +10 -1
- package/workspace/public/pm/cozy-pop-work.js +201 -17
- package/workspace/public/pm/cozy-routine-job.js +50 -7
- package/workspace/public/pm/cozy-routine.css +2 -0
- package/workspace/public/pm/cozy-settings.js +21 -3
- package/workspace/public/pm/cozy-today-page.css +1 -0
- package/workspace/public/pm/cozy-viewer.css +1 -1
- package/workspace/public/pm/cozy-viewer.js +14 -2
- package/workspace/public/pm/cozy-vw-mtg.css +0 -2
- package/workspace/public/pm/cozy-vw.css +0 -1
- package/workspace/public/pm/home-app.js +21 -1
- package/workspace/public/pm/home-today.js +2 -0
- package/workspace/public/pm/ini-tasks.js +4 -1
- package/workspace/public/pm/komorebi.css +11 -0
- package/workspace/public/pm/prefs-sync.js +111 -0
- package/workspace/public/pm/premium-board.js +20 -2
- package/workspace/public/pm/premium-chart-tab.js +2 -1
- package/workspace/public/pm/premium-mtg-replay.js +4 -3
- package/workspace/public/pm/premium-report-read.js +5 -4
- package/workspace/public/pm/premium-report-tab.js +4 -3
- package/workspace/public/pm/premium-vw-backlog.css +2 -1
- package/workspace/public/pm/premium-vw-backlog.js +4 -3
- package/workspace/public/pm/premium-vw-cal.css +1 -2
- package/workspace/public/pm/premium-vw-cal.js +14 -13
- package/workspace/public/pm/premium-vw-copies.js +3 -2
- package/workspace/public/pm/premium-vw-copy.css +0 -3
- package/workspace/public/pm/premium-vw-mtg.js +12 -11
- package/workspace/public/pm/product-switcher.js +41 -0
- package/workspace/public/pm/report-orders-ui.js +2 -1
- package/workspace/public/pm/rp-parts.js +3 -2
- package/workspace/public/pm/state-blocks.js +36 -0
- package/workspace/public/pm/use-log.js +118 -1
- package/workspace/public/pm/work-select.js +92 -2
- package/workspace/public/pm/work-tree.js +70 -0
- package/workspace/public/premium-aud.html +1 -0
- package/workspace/public/premium-board.html +5 -0
- package/workspace/public/premium-buddy.html +1 -0
- package/workspace/public/premium-events.html +1 -0
- package/workspace/public/premium-goals.html +1 -0
- package/workspace/public/premium-intelligence.html +1 -0
- package/workspace/public/premium-library.html +1 -0
- package/workspace/public/premium-present.html +1 -0
- package/workspace/public/premium-rec.html +1 -0
- package/workspace/public/premium-routine.html +1 -0
- package/workspace/public/premium-viewer.html +1 -0
- package/workspace/public/premium-workflows.html +1 -0
- package/workspace/public/today.html +1 -0
- package/workspace/server.js +20 -0
- package/workspace/test-lists/back-place.json +9 -0
- package/workspace/test-lists/changed-mark.json +9 -0
- package/workspace/test-lists/launch-tiers.json +9 -0
- package/workspace/test-lists/parked-reasons.json +9 -0
- package/workspace/test-lists/prefs-follow-person.json +9 -0
- package/workspace/test-lists/product-switcher-dots.json +9 -0
- package/workspace/test-lists/routine-sentence.json +9 -0
- package/workspace/test-lists/shared-empty-states.json +9 -0
- package/workspace/test-lists/strategy-card.json +9 -0
- package/workspace/test-lists/unused-controls.json +9 -0
- package/workspace/test-lists/work-subtasks-followups.json +9 -0
|
@@ -14,9 +14,6 @@
|
|
|
14
14
|
.cpv-why code{font-size:var(--fs-meta);line-height:var(--lh-meta);}
|
|
15
15
|
.cpv-acts{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-8)}
|
|
16
16
|
.cpv-acts .dmcta{border-radius:var(--radius-sm);text-decoration:none}
|
|
17
|
-
.cpv-empty{display:grid;gap:var(--space-8);padding:18px 20px;border:1px dashed var(--ink-3);border-radius:8px;color:var(--ink-2)}
|
|
18
|
-
.cpv-empty b{font-size:var(--fs-row);font-weight:var(--fw-strong);color:var(--ink);line-height:var(--lh-row);}
|
|
19
|
-
.cpv-empty p{margin:0;font-size:var(--fs-body);line-height:var(--lh-body);}
|
|
20
17
|
.cpv-page{padding:18px 22px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid)}
|
|
21
18
|
.cpv-page.dim{opacity:.62}
|
|
22
19
|
@media (max-width:700px){
|
|
@@ -45,6 +45,7 @@ import { replayView, phoneHtml, editHtml, mentions, phraseOf as phraseOfPage, de
|
|
|
45
45
|
import { announce } from './rec-state.js';
|
|
46
46
|
import { presentInRecording } from './cozy-rec-bridge.js'; // while a meeting records, Present goes to the recording tab (batch 12 item 1, rule 10)
|
|
47
47
|
import { factsOf } from './meeting-share.js'; // the facts mentioned: one list for the note and a shared copy (shareable-meeting-notes)
|
|
48
|
+
import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
|
|
48
49
|
export { factsOf };
|
|
49
50
|
|
|
50
51
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
@@ -356,7 +357,7 @@ export function summaryHtml(m, ui = {}) {
|
|
|
356
357
|
|
|
357
358
|
function agendaHtml(P) {
|
|
358
359
|
return P.agenda.length ? `<div class="vzm-agl">${P.agenda.map((a, i) => `<div class="vz-ag"><i class="vz-num" aria-hidden="true">${a.n}</i><span>${esc(a.text)}</span><button type="button" class="vz-min vz-hv" data-a="min" data-i="${i}" title="Change the minutes for this topic" aria-label="${esc(a.text)}: ${a.min} minutes. Change">${a.min} min</button></div>`).join('')}</div>`
|
|
359
|
-
: '
|
|
360
|
+
: SB.empty('The invite lists no topics yet.');
|
|
360
361
|
}
|
|
361
362
|
/** Tagged rows (What matters, Since the last one, Facts). W: the word fixes, shown in the words (Facts, batch 27 item 12). */
|
|
362
363
|
const tagRows = (rows, W) => rows.map((x) => `<div class="vz-tagrow"><span class="vz-tag" data-k="${x.k}">${esc(x.tag)}</span><span><span class="vz-said">${W ? wx(W, x.text) : esc(x.text)}</span> <small>${esc(x.meta || x.owner || x.src || '')}</small></span></div>`).join('');
|
|
@@ -379,19 +380,19 @@ const hlHtml = (L) => L.hl.map((x) => `<div class="vz-hl"><time>${esc(x.t)}</tim
|
|
|
379
380
|
function caughtHtml(m) {
|
|
380
381
|
const L = m.live, Fo = m.focus, h = [];
|
|
381
382
|
if (Fo.gist) h.push(`<p class="vz-p">${esc('So far: ' + Fo.gist)}</p>`);
|
|
382
|
-
else if (Fo.error) h.push(
|
|
383
|
+
else if (Fo.error) h.push(SB.error(Fo.error));
|
|
383
384
|
if (L.topics.length) h.push(weightBar('vz-stretch', L.topics.map((t) => ({ w: +t.flex || 1, attrs: ` data-k="${t.k}"` }))));
|
|
384
|
-
return h.join('') || '
|
|
385
|
+
return h.join('') || SB.empty('What was said shows here while the note records.');
|
|
385
386
|
}
|
|
386
387
|
/** The live Agenda: the 3 to 5 topics (pm/agenda-live.js) when the read has them. No Change topic: PMOS follows the talk, the PM says Not this one. */
|
|
387
388
|
function liveAgendaHtml(m) {
|
|
388
389
|
const Fo = m.focus;
|
|
389
390
|
if (Fo.model) return mergedAgendaHtml(Fo.model);
|
|
390
|
-
return (Fo.agenda.length ? Fo.agenda.map((a) => `<div class="vzm-ag" data-k="${a.k}"><span>${a.k === 'now' || a.k === 'late' ? `<b>${a.n} ${esc(a.text)}</b>` : esc(a.n + ' ' + a.text)}</span>${fillBar(a.fill, a.k)}<small>${esc(a.say)}</small></div>`).join('') : '
|
|
391
|
+
return (Fo.agenda.length ? Fo.agenda.map((a) => `<div class="vzm-ag" data-k="${a.k}"><span>${a.k === 'now' || a.k === 'late' ? `<b>${a.n} ${esc(a.text)}</b>` : esc(a.n + ' ' + a.text)}</span>${fillBar(a.fill, a.k)}<small>${esc(a.say)}</small></div>`).join('') : SB.empty('The invite lists no topics yet.'));
|
|
391
392
|
}
|
|
392
393
|
function transcriptHtml(m, ui, lines, seek) {
|
|
393
394
|
const W = m.notes && m.notes.replay ? m.notes.replay.W : null; // the word fixes (MvF) show in the transcript too
|
|
394
|
-
return (lines.length ? lines.map((l, i) => lineHtml(l, i, ui, seek, W)).join('') :
|
|
395
|
+
return (lines.length ? lines.map((l, i) => lineHtml(l, i, ui, seek, W)).join('') : SB.empty(m.private ? 'This note is private: only what you type is kept.' : m.mk === 'live' ? 'Nothing has been said yet.' : 'Nothing was transcribed.'))
|
|
395
396
|
+ `<p class="vz-note vz-fine">${esc(LIVE_FOOT)}</p>`;
|
|
396
397
|
}
|
|
397
398
|
function stepHtml(a, ui, W) {
|
|
@@ -532,7 +533,7 @@ export function heldHtml(m, ui = {}, ctx = {}) {
|
|
|
532
533
|
+ `<button type="button" class="y" data-a="h-add" aria-label="Yes, add ${n === 1 ? 'it' : 'them'}" title="Yes, add ${n === 1 ? 'it' : 'them'}">${svg('check', 14)}</button><button type="button" data-a="h-no" aria-label="No" title="No">${svg('x', 14)}</button></div></div>`);
|
|
533
534
|
}
|
|
534
535
|
if (H.notes.length) h.push('<h6>Notes</h6><ul>' + H.notes.map((t) => `<li>${esc(t)}</li>`).join('') + '</ul>');
|
|
535
|
-
if (!H.lead && !H.decisions.length && !H.tasks.length && !H.notes.length) h.push(
|
|
536
|
+
if (!H.lead && !H.decisions.length && !H.tasks.length && !H.notes.length) h.push(SB.empty(NO_NOTES));
|
|
536
537
|
const about = H.about ? `<button type="button" class="vzh-sel" data-a="${H.ini ? 'h-ini' : 'm-about'}" title="${esc(m.about)}"><span>${esc(H.about)}</span>${svg('next', 14)}</button>` : `<button type="button" class="vzh-sel" data-a="m-about">Link it</button>`;
|
|
537
538
|
const side = ['<h6>The meeting</h6>',
|
|
538
539
|
H.held ? `<div class="r"><span>Held</span><em>${esc(H.held)}</em></div>` : '',
|
|
@@ -559,8 +560,8 @@ export function matPopHtml(P) {
|
|
|
559
560
|
}
|
|
560
561
|
export function matListHtml(P) {
|
|
561
562
|
const items = P.q ? P.found : P.sug;
|
|
562
|
-
if (!items) return P.q ? '
|
|
563
|
-
if (!items.length) return P.q ? '
|
|
563
|
+
if (!items) return P.q ? SB.loading('Looking in PMOS.', { rows: 2 }) : '';
|
|
564
|
+
if (!items.length) return P.q ? SB.empty('Nothing in PMOS matches. Paste a link instead.') : '';
|
|
564
565
|
return `<p class="vzm-mlbl">${P.q ? 'Found in PMOS' : 'Suggested for this meeting'}</p>` + items.map((it, i) => `<button type="button" class="vzm-mi2 vz-hv" data-a="matadd" data-i="${i}">${svg(it.kind === 'pmos-deck' ? 'deck' : it.kind === 'board' ? 'board' : 'doc', 16)}<span class="vzm-grow">${esc(clip(it.title, 80))}${it.meta ? `<br><span class="vzm-sm vzm-mut">${esc(clip(it.meta, 80))}</span>` : ''}</span><span class="vzm-k">Add</span></button>`).join('');
|
|
565
566
|
}
|
|
566
567
|
/** What it is about's popover (MtAfter). O = aboutOptions(), q = the find text */
|
|
@@ -571,7 +572,7 @@ export function aboutListHtml(O, q = '') {
|
|
|
571
572
|
const words = norm(q).split(' ').filter(Boolean), hit = (x) => words.every((w) => norm(x.label).includes(w));
|
|
572
573
|
const item = (x, ic, hl) => `<button type="button" class="vzm-mi2 vz-hv${hl ? ' hl' : ''}" data-a="aboutpick" data-v="${esc(x.v)}"${x.v === O.cur ? ' aria-current="true"' : ''}>${svg(ic, 16)}<span class="vzm-grow">${esc(x.label)}${x.sub ? `<br><span class="vzm-sm vzm-mut">${esc(x.sub)}</span>` : ''}</span>${x.v === O.cur ? svg('check', 14) : ''}</button>`;
|
|
573
574
|
const h = [];
|
|
574
|
-
if (words.length) { const f = O.initiatives.filter(hit).slice(0, 8); h.push(`<p class="vzm-mlbl">Initiatives</p>${f.length ? f.map((x) => item(x, 'flag')).join('') : '
|
|
575
|
+
if (words.length) { const f = O.initiatives.filter(hit).slice(0, 8); h.push(`<p class="vzm-mlbl">Initiatives</p>${f.length ? f.map((x) => item(x, 'flag')).join('') : SB.empty('No initiative has that name.')}`); }
|
|
575
576
|
else if (O.suggested.length) h.push(`<p class="vzm-mlbl">Suggested from the notes</p>${O.suggested.map((x) => item(x, 'flag', true)).join('')}`);
|
|
576
577
|
else if (O.initiatives.length) h.push(`<p class="vzm-mlbl">Initiatives</p>${O.initiatives.slice(0, 5).map((x) => item(x, 'flag')).join('')}`);
|
|
577
578
|
h.push(`<p class="vzm-mlbl">Or</p>${O.boards.filter((x) => !words.length || hit(x)).map((x) => item(x, 'prod')).join('')}${item(O.portfolio, 'board')}${item(O.none, 'x')}`);
|
|
@@ -620,7 +621,7 @@ export async function openMeeting(ref, o = {}) {
|
|
|
620
621
|
if (MT) { MT.alive = false; MT.timers.forEach(clearInterval); stopPlay(MT); }
|
|
621
622
|
MT = me;
|
|
622
623
|
const id = 'meeting:' + (R.note || R.event || R.title || 'new');
|
|
623
|
-
const draw0 = (body) => { body.innerHTML = '<div class="vz"
|
|
624
|
+
const draw0 = (body) => { body.innerHTML = '<div class="vz">' + SB.loading('Reading the meeting.') + '</div>'; };
|
|
624
625
|
me.vid = id;
|
|
625
626
|
vOpen({ id, kind: 'Meeting', title: R.title || 'Meeting', icon: CLOCK_ICON, url: meetingUrl({ ...R, ws: me.ws }), render: draw0, onClose: () => closed(me) });
|
|
626
627
|
widen('mtg');
|
|
@@ -834,7 +835,7 @@ function placePop(me, body) {
|
|
|
834
835
|
const P = me.ui.pop; if (P !== 'mat' && P !== 'about') return;
|
|
835
836
|
const anc = P === 'mat' ? shown(body, '[data-pop="mat"]') : body.querySelector('[data-pop="head"]'); if (!anc) return;
|
|
836
837
|
if (P === 'mat') { anc.innerHTML = matPopHtml(me.mat || { row: me.row }); if (!me.matShown && anc.scrollIntoView) { me.matShown = true; anc.scrollIntoView({ block: 'nearest' }); } }
|
|
837
|
-
else anc.innerHTML = me.about ? aboutPopHtml(me.about, me.aboutQ || '', me.row ? 'Applies to every meeting of “' + me.row.title + '”. The calendar itself is never written.' : 'Applies to this note.') : '<div class="vzm-pop"
|
|
838
|
+
else anc.innerHTML = me.about ? aboutPopHtml(me.about, me.aboutQ || '', me.row ? 'Applies to every meeting of “' + me.row.title + '”. The calendar itself is never written.' : 'Applies to this note.') : '<div class="vzm-pop">' + SB.loading('Reading what it can be about.', { rows: 2 }) + '</div>';
|
|
838
839
|
}
|
|
839
840
|
function keydown(me, e, body) {
|
|
840
841
|
const a = e.target.dataset && e.target.dataset.a;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* pm/product-switcher.js — the product switcher row (bet A381, initiative product-switcher-dots). One quiet row of product tiles on Today
|
|
2
|
+
* and Work. A tile carries one blue dot when its product has rows that need the PM (GET /api/briefing-premium/products?needs=1, from
|
|
3
|
+
* lib/product-dots.js): no count, and no dot at zero or before the product is read (zero is silence, honest state).
|
|
4
|
+
*
|
|
5
|
+
* readDots() → the pick with `needs` on each product, or null
|
|
6
|
+
* switcherHtml(P, o) PURE. The row: '' for fewer than two products. o.tones: the page's tints (cozy-pick.js tonesOf), o.cls: an extra class
|
|
7
|
+
* pressOf(P, ws) PURE. The pick a press saves: that product alone, or every product when it is already shown alone
|
|
8
|
+
* press(P, ws) saves pressOf with savePick, so every page follows (pp:changed) → savePick's answer
|
|
9
|
+
*
|
|
10
|
+
* Each tile is a button with data-psw, so the local use log (pm/use-log.js, A466) counts the presses: the outcome check reads them with
|
|
11
|
+
* node workspace/lib/product-dots.js count. Tiles, letters and tints are the product chip's own (cozy-pick.js). */
|
|
12
|
+
import { pmGet } from './http.js';
|
|
13
|
+
import { codeOf, tonesOf, savePick } from './cozy-pick.js';
|
|
14
|
+
import { productName } from './scope-chip.js';
|
|
15
|
+
|
|
16
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
17
|
+
const nameOf = (p) => productName(p && p.ws, (p && p.name) || '');
|
|
18
|
+
|
|
19
|
+
export async function readDots() { const r = await pmGet('/api/briefing-premium/products?needs=1'); return r && r.ok && Array.isArray(r.products) ? r : null; }
|
|
20
|
+
|
|
21
|
+
/** The one product shown alone, or null when two or more are shown. */
|
|
22
|
+
const aloneOf = (P) => { const on = P.products.filter((p) => p.on); return on.length === 1 ? on[0].ws : null; };
|
|
23
|
+
|
|
24
|
+
export function switcherHtml(P, o = {}) {
|
|
25
|
+
if (!P || !Array.isArray(P.products) || P.products.length < 2) return '';
|
|
26
|
+
const T = o.tones || tonesOf(P.products), alone = aloneOf(P);
|
|
27
|
+
const tiles = P.products.map((p) => {
|
|
28
|
+
const n = Number.isInteger(p.needs) ? p.needs : 0, nm = nameOf(p);
|
|
29
|
+
const words = n > 0 ? nm + ', ' + n + ' need' + (n === 1 ? 's' : '') + ' you' : nm;
|
|
30
|
+
return `<button type="button" class="psw-b" data-psw="${esc(p.ws)}" aria-pressed="${p.ws === alone}" aria-label="${esc(words)}" title="${esc(words)}">`
|
|
31
|
+
+ `<i class="ppk-t t${T[p.ws] || 0}" aria-hidden="true">${esc(codeOf(p))}</i>${n > 0 ? '<i class="psw-dot" aria-hidden="true"></i>' : ''}</button>`;
|
|
32
|
+
}).join('');
|
|
33
|
+
return `<div class="psw${o.cls ? ' ' + esc(o.cls) : ''}" role="group" aria-label="Switch product">${tiles}</div>`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function pressOf(P, ws) {
|
|
37
|
+
const all = P.products.map((p) => p.ws);
|
|
38
|
+
return aloneOf(P) === ws ? all : [ws];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const press = (P, ws) => savePick(pressOf(P, ws));
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Use from the next cycle on an agreed outline). Rename and Delete on Mine only.
|
|
12
12
|
* S = the GET answer · G = { sel, i, ren } · o = { esc, ic, slideCard, pics(id) → [slide] | null, now: [slide], busy, hidden: Set, issued }
|
|
13
13
|
*/
|
|
14
|
+
import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
|
|
14
15
|
|
|
15
16
|
const keyOf = (S, k) => k + ':' + (S && S.slot) + ':' + ((S && S.pick && S.pick.id) || (S && S.now && S.now.id) || '');
|
|
16
17
|
export const hideKey = keyOf;
|
|
@@ -79,7 +80,7 @@ function cardHtml(S, o, c) {
|
|
|
79
80
|
}
|
|
80
81
|
/** The gallery (TpD), or one order pressed open. */
|
|
81
82
|
export function galHtml(S, G, o) {
|
|
82
|
-
if (!S || !S.ok) return '
|
|
83
|
+
if (!S || !S.ok) return SB.loading('Reading the orders.');
|
|
83
84
|
const e = o.esc;
|
|
84
85
|
const close = `<button type="button" class="rp-tl vz-hv ro-ib" data-r="ord|close" aria-label="Close the orders" title="Close">${o.ic('x', 16)}</button>`;
|
|
85
86
|
if (G.sel) return detailHtml(S, G, o);
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* THE RULE (as the premium models): every number, date and chip comes from a field of a record. Where a record is silent the part says so or
|
|
19
19
|
* is left out; nothing is filled with a guess. */
|
|
20
20
|
import { tableStarts, readTable, tableHtml } from './md-table.js';
|
|
21
|
+
import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
|
|
21
22
|
|
|
22
23
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
23
24
|
const inline = (s) => esc(s).replace(/\*\*([^*]+)\*\*/g, '<b>$1</b>').replace(/`([^`]+)`/g, '<code>$1</code>');
|
|
@@ -127,7 +128,7 @@ export function briefLooksHtml(B, o = {}) {
|
|
|
127
128
|
}
|
|
128
129
|
/** The whole Brief as html, its four groups in order. o = { issued, busy, msg } */
|
|
129
130
|
export function briefHtml(B, o = {}) {
|
|
130
|
-
if (!B) return '
|
|
131
|
+
if (!B) return SB.loading('Reading how this report is made.');
|
|
131
132
|
return `<div class="rp-brief"><p class="rp-lbl">At a glance</p>${briefGlanceHtml(B)}<p class="rp-lbl">Please confirm</p>${briefConfirmHtml(B, o)}<p class="rp-lbl">Why it looks like this</p>${briefWhyHtml(B)}${briefLooksHtml(B, o)}`
|
|
132
133
|
+ (o.msg ? `<p class="vz-msg" role="status">${esc(o.msg)}</p>` : '') + '</div>';
|
|
133
134
|
}
|
|
@@ -329,7 +330,7 @@ function chartSvg(c, hover) {
|
|
|
329
330
|
}
|
|
330
331
|
/** The live page as html. s = { name, audience, period, issued, readAgo, hover, products } */
|
|
331
332
|
export function liveHtml(L, s = {}) {
|
|
332
|
-
if (!L) return '
|
|
333
|
+
if (!L) return SB.loading('Reading the numbers.');
|
|
333
334
|
const head = `<div class="rp-lvh"><div class="rp-grow"><p class="rp-lbl">${esc((s.audience ? s.audience + ' · ' : '') + 'live')}</p><h2 class="rp-h2">${esc(s.name || 'Report')}</h2></div>`
|
|
334
335
|
+ `<span class="rp-per" title="${s.issued ? 'An issued cycle shows its numbers as they were on its day' : 'The numbers as they are now'}">${esc(s.period || 'Now')}</span>`
|
|
335
336
|
+ `<button type="button" class="cz-pick" data-r="lv|prod" aria-haspopup="menu" aria-expanded="${!!s.prodOpen}">${esc((L.board && L.board.name) || 'This product')}${SV('M7 10l5 5 5-5', 14)}</button>`
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* state-blocks.js — the three states every block has, drawn once (Komorebi part State; initiative shared-empty-states).
|
|
2
|
+
*
|
|
3
|
+
* empty(line, { step }) one quiet line, and the one next step when there is one. Never "0 items".
|
|
4
|
+
* loading(what, { rows }) soft placeholder rows in the block's own place (3 by default). No text on screen, no spinner;
|
|
5
|
+
* a screen reader hears `what` ("Reading the report.").
|
|
6
|
+
* error(line, { retry }) one line in words that says what failed, and Retry when the page can try again.
|
|
7
|
+
* `retry` is the data attribute the page listens for, e.g. 'data-vc-retry'.
|
|
8
|
+
*
|
|
9
|
+
* `line` and `what` are plain text and are escaped here. `step` is trusted HTML the page built (a button or a link).
|
|
10
|
+
* The look lives in ui/components/bundle.css (.pm-state), so a Komorebi token change reaches every state on every page.
|
|
11
|
+
* An error writes one [state-block] line per distinct failure, so a responder can find it in the console. */
|
|
12
|
+
|
|
13
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
14
|
+
const ATTR = /^data-[a-z0-9-]+(="[^"<>]*")?$/; // a page's own press mark, nothing else
|
|
15
|
+
const RETRY = '<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>';
|
|
16
|
+
const said = new Set();
|
|
17
|
+
|
|
18
|
+
export function empty(line, { step = '' } = {}) {
|
|
19
|
+
return `<p class="pm-state empty">${esc(line)}${step ? ' ' + step : ''}</p>`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function loading(what, { rows = 3 } = {}) {
|
|
23
|
+
const n = Math.max(1, Math.min(8, Math.round(Number(rows)) || 3));
|
|
24
|
+
return `<div class="pm-state loading" role="status" aria-label="${esc(what)}">${'<span class="ph"><i></i></span>'.repeat(n)}</div>`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function error(line, { retry = '' } = {}) {
|
|
28
|
+
const text = String(line == null ? '' : line);
|
|
29
|
+
if (!said.has(text)) {
|
|
30
|
+
said.add(text);
|
|
31
|
+
try { console.info('[state-block] error:', text); } catch { /* no console */ }
|
|
32
|
+
}
|
|
33
|
+
const mark = retry && ATTR.test(retry) ? retry : '';
|
|
34
|
+
const btn = mark ? `<button type="button" class="pm-btn" aria-label="Try again" title="Try again" ${mark}>${RETRY}</button>` : '';
|
|
35
|
+
return `<p class="pm-state error" role="alert"><span>${esc(text)}</span>${btn}</p>`;
|
|
36
|
+
}
|
|
@@ -6,14 +6,27 @@
|
|
|
6
6
|
* controlOf(el) PURE: the name a pressed element is logged under, or '' to log nothing
|
|
7
7
|
* deviceOf(width) PURE: phone (≤ 760 px), tablet (≤ 1100 px) or desk
|
|
8
8
|
*
|
|
9
|
+
* HIDE THE BUTTONS NOBODY PRESSES (idea A454; the rule and the store are lib/unused-controls.js). startUseLog also:
|
|
10
|
+
* at load hides this page's hidden buttons (GET /api/use-log/hidden, one style rule per id, so a button drawn later is hidden too);
|
|
11
|
+
* after UNUSED_MS tells the server which buttons the page shows (POST /api/use-log/unused, ids only) and, when it proposes some, shows
|
|
12
|
+
* the Komorebi Suggestion: "Hide N buttons…", icon-only Yes and No, the buttons outlined while it shows. Yes hides them and the
|
|
13
|
+
* Komorebi Toast offers Undo; No folds it and PMOS does not suggest them again. Settings › General › Use log lists them with Show.
|
|
14
|
+
* presentControls(doc) the ids a page shows that may be proposed (PURE over the doc it is given)
|
|
15
|
+
* hideCss(ids) PURE: the style rule that hides them · sugHtml(n) · hidToastHtml(n) PURE: the parts' markup
|
|
16
|
+
*
|
|
9
17
|
* ON THIS COMPUTER ONLY. Events go to this workspace's own server (POST /api/use-log, a relative URL) in batches: every 15 s while there
|
|
10
18
|
* are some, and once more when the page hides (keepalive). Nothing goes anywhere else. NOTHING PERSONAL: a control is named by its id or
|
|
11
19
|
* by the NAME of its first data- attribute (data-ev-sub), never by a value, its text or its label; an element with neither is not logged. */
|
|
12
|
-
import { pmPost } from './http.js';
|
|
20
|
+
import { pmPost, pmGet } from './http.js';
|
|
13
21
|
|
|
14
22
|
const FLUSH_MS = 15000;
|
|
15
23
|
const MAX_QUEUE = 200;
|
|
16
24
|
const ID_RE = /^[A-Za-z][A-Za-z0-9_-]{0,79}$/;
|
|
25
|
+
const UNUSED_MS = 4000;
|
|
26
|
+
const TOAST_MS = 6000;
|
|
27
|
+
const PROPOSABLE = 'button[id], a[href][id], [role="button"][id], [role="tab"][id], [role="switch"][id], [role="menuitem"][id]';
|
|
28
|
+
// a button inside the menu, a dialog, a list, a table or a form is about one item or one task: never proposed
|
|
29
|
+
const NOT_IN = '#czNav, nav, dialog, [role="dialog"], [aria-modal="true"], ul, ol, table, [role="list"], [role="listbox"], [role="grid"], [role="table"], [role="tree"], form, [data-pm-unused-host]';
|
|
17
30
|
const PRESSABLE = 'button, a[href], [role="button"], [role="tab"], [role="switch"], [role="menuitem"], input[type="checkbox"], input[type="radio"], select, summary';
|
|
18
31
|
let started = false;
|
|
19
32
|
const Q = [];
|
|
@@ -58,5 +71,109 @@ export function startUseLog(doc = typeof document !== 'undefined' ? document : n
|
|
|
58
71
|
const hide = () => flush(true);
|
|
59
72
|
try { window.addEventListener('pagehide', hide); doc.addEventListener('visibilitychange', () => { if (doc.visibilityState === 'hidden') hide(); }); } catch { /* no window */ }
|
|
60
73
|
setTimeout(() => flush(false), 2000); // the open goes soon after load, so a page closed quickly still counts
|
|
74
|
+
try { startUnused(doc); } catch { /* the page still works without it */ }
|
|
61
75
|
return true;
|
|
62
76
|
}
|
|
77
|
+
|
|
78
|
+
/* ── hide the buttons nobody presses (idea A454) ── */
|
|
79
|
+
|
|
80
|
+
/** The ids this page shows that may be proposed: a pressable element with a plain id, visible, outside the menu, a dialog, a list, a
|
|
81
|
+
* table or a form. Never its text. */
|
|
82
|
+
export function presentControls(doc) {
|
|
83
|
+
if (!doc || !doc.querySelectorAll) return [];
|
|
84
|
+
const out = new Set();
|
|
85
|
+
for (const el of doc.querySelectorAll(PROPOSABLE)) {
|
|
86
|
+
const id = el.getAttribute('id') || '';
|
|
87
|
+
if (!ID_RE.test(id) || /^data-/i.test(id)) continue;
|
|
88
|
+
if (el.closest && el.closest(NOT_IN)) continue;
|
|
89
|
+
if (el.getClientRects && !el.getClientRects().length) continue; // not on screen: display none, or inside something closed
|
|
90
|
+
out.add(id);
|
|
91
|
+
if (out.size >= 300) break;
|
|
92
|
+
}
|
|
93
|
+
return [...out];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** One style rule that hides these ids, so a button the page draws later is hidden too. Ids match ID_RE, so they need no escaping. */
|
|
97
|
+
export const hideCss = (ids) => (ids || []).filter((id) => ID_RE.test(id)).map((id) => `#${id}`).join(',') + ((ids || []).some((id) => ID_RE.test(id)) ? '{display:none!important}' : '');
|
|
98
|
+
|
|
99
|
+
const STAR = '<svg class="pm-ic pm-star" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z"/></svg>';
|
|
100
|
+
const icon = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
101
|
+
const YES = 'M5 12.5l4.5 4.5L19 7.5', NO = 'M6 6l12 12M18 6L6 18', UNDO = 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3';
|
|
102
|
+
const buttons = (n) => `${n} ${n === 1 ? 'button' : 'buttons'}`;
|
|
103
|
+
|
|
104
|
+
/** The Komorebi Suggestion for n buttons: the ✦, one line, icon-only Yes and No. */
|
|
105
|
+
export function sugHtml(n) {
|
|
106
|
+
return `<div class="pm-sug" role="group" aria-label="PMOS suggests"><span title="PMOS saw these on this page on many days, and you have not pressed them in 14 days. Outlined while this shows.">${STAR}</span>`
|
|
107
|
+
+ `<span class="say">Hide ${buttons(n)} on this page you have not pressed in 14 days? They stay in Settings › Use log.</span>`
|
|
108
|
+
+ `<button type="button" class="pm-btn primary" data-uc-yes aria-label="Yes, hide them" title="Yes, hide them">${icon(YES)}</button>`
|
|
109
|
+
+ `<button type="button" class="pm-btn outline" data-uc-no aria-label="No, keep them" title="No, keep them">${icon(NO)}</button></div>`;
|
|
110
|
+
}
|
|
111
|
+
/** The Komorebi Toast after Yes, Undo as an icon button. */
|
|
112
|
+
export function hidToastHtml(n) {
|
|
113
|
+
return `<div class="pm-toast" role="status" aria-live="polite"><span class="in"><span>${buttons(n)} hidden. Show them again in Settings › Use log.</span>`
|
|
114
|
+
+ `<button type="button" class="pm-btn" data-uc-undo aria-label="Undo: show them again" title="Undo">${icon(UNDO)}</button></span><span class="timer" data-uc-timer></span></div>`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const UC = { css: null, host: null, ids: [], timer: 0 };
|
|
118
|
+
// the suggestion's place: a desk, bottom centre as the Toast part says; a phone (the menu's 760 px edge), under the top bar, so it never
|
|
119
|
+
// covers the chat box at the foot (as draft-keep). The outline marks the proposed buttons while the suggestion shows.
|
|
120
|
+
const HOST_CSS = '[data-pm-unused-host]{position:fixed;left:50%;bottom:var(--space-24);transform:translateX(-50%);z-index:2147482990;background:none;max-width:min(560px,calc(100vw - 32px))}'
|
|
121
|
+
+ '@media (max-width:760px){[data-pm-unused-host]{bottom:auto;top:var(--space-64)}}'
|
|
122
|
+
+ '[data-pm-unused]{outline:2px dashed var(--blue, currentColor);outline-offset:2px}';
|
|
123
|
+
function applyHidden(doc, ids) {
|
|
124
|
+
UC.ids = ids;
|
|
125
|
+
if (!UC.css) { UC.css = doc.createElement('style'); UC.css.id = 'pmUnusedCss'; doc.head.appendChild(UC.css); }
|
|
126
|
+
UC.css.innerHTML = hideCss(ids) + HOST_CSS;
|
|
127
|
+
}
|
|
128
|
+
function host(doc) {
|
|
129
|
+
if (UC.host && UC.host.isConnected) return UC.host;
|
|
130
|
+
if (!UC.css) applyHidden(doc, UC.ids); // the host's place is in the same style element (HOST_CSS)
|
|
131
|
+
const h = doc.createElement('div');
|
|
132
|
+
h.className = 'pm-ds'; h.setAttribute('data-pm-unused-host', '');
|
|
133
|
+
doc.body.appendChild(h);
|
|
134
|
+
return (UC.host = h);
|
|
135
|
+
}
|
|
136
|
+
const mark = (doc, ids, on) => { for (const id of ids) { const el = doc.getElementById(id); if (el) { if (on) el.setAttribute('data-pm-unused', ''); else el.removeAttribute('data-pm-unused'); } } };
|
|
137
|
+
|
|
138
|
+
function propose(doc, page, ids) {
|
|
139
|
+
const h = host(doc);
|
|
140
|
+
h.innerHTML = sugHtml(ids.length);
|
|
141
|
+
mark(doc, ids, true);
|
|
142
|
+
h.onclick = async (e) => {
|
|
143
|
+
const b = e.target.closest && e.target.closest('button'); if (!b) return;
|
|
144
|
+
if (b.hasAttribute('data-uc-yes')) {
|
|
145
|
+
mark(doc, ids, false);
|
|
146
|
+
const r = await pmPost('/api/use-log/hide', { page, controls: ids });
|
|
147
|
+
if (r && r.ok) { applyHidden(doc, [...new Set(UC.ids.concat(ids))]); hidToast(doc, page, ids); } else h.innerHTML = '';
|
|
148
|
+
} else if (b.hasAttribute('data-uc-no')) {
|
|
149
|
+
mark(doc, ids, false); h.innerHTML = '';
|
|
150
|
+
pmPost('/api/use-log/decline', { page, controls: ids });
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function hidToast(doc, page, ids) {
|
|
155
|
+
const h = host(doc);
|
|
156
|
+
h.innerHTML = hidToastHtml(ids.length);
|
|
157
|
+
const done = () => { clearTimeout(UC.timer); h.innerHTML = ''; };
|
|
158
|
+
h.onclick = async (e) => {
|
|
159
|
+
if (!(e.target.closest && e.target.closest('[data-uc-undo]'))) return;
|
|
160
|
+
done();
|
|
161
|
+
const r = await pmPost('/api/use-log/show', { page, controls: ids });
|
|
162
|
+
if (r && r.ok) applyHidden(doc, UC.ids.filter((id) => !ids.includes(id)));
|
|
163
|
+
};
|
|
164
|
+
h.onmouseenter = () => clearTimeout(UC.timer);
|
|
165
|
+
h.onmouseleave = () => { UC.timer = setTimeout(done, TOAST_MS); };
|
|
166
|
+
clearTimeout(UC.timer); UC.timer = setTimeout(done, TOAST_MS);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function startUnused(doc) {
|
|
170
|
+
const page = pageNow();
|
|
171
|
+
Promise.resolve(pmGet('/api/use-log/hidden?page=' + encodeURIComponent(page))).then((r) => {
|
|
172
|
+
if (r && r.ok && Array.isArray(r.hidden) && r.hidden.length) applyHidden(doc, r.hidden.map((x) => x.control));
|
|
173
|
+
}).catch(() => null);
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
Promise.resolve(pmPost('/api/use-log/unused', { page, present: presentControls(doc) })).then((r) => {
|
|
176
|
+
if (r && r.ok && Array.isArray(r.propose) && r.propose.length) propose(doc, page, r.propose);
|
|
177
|
+
}).catch(() => null);
|
|
178
|
+
}, UNUSED_MS);
|
|
179
|
+
}
|
|
@@ -10,6 +10,15 @@
|
|
|
10
10
|
* shiftOf(text) → a whole number of days from "+3", "-7", "1w", "2 weeks", or null
|
|
11
11
|
* bulk(post, at, ids, op, value, h) → runs POST /api/boards/tasks/bulk for each board and offers one Undo (POST …/bulk-undo) for all of it.
|
|
12
12
|
* at: { ws, board } or a function uid → { ws, board, id }. h: { say(text, undo), reload() }
|
|
13
|
+
* dropPlan(rows, ids, to) → { steps: [{ op, value, ids }], label } | null PURE (initiative work-subtasks-followups). What a drag does:
|
|
14
|
+
* to: { zone: 'on', uid } nests under that task; { zone: 'between', uid } makes them that row's siblings (its
|
|
15
|
+
* parent, its stage); { zone: 'stage', key, name } moves them to that stage at the top level; { zone: 'left' } takes
|
|
16
|
+
* each one level up. A drop onto a dragged row or a row under one, or a drop that changes nothing: null.
|
|
17
|
+
* dragIds(sel, uid) → the rows a drag carries: every picked row when the dragged one is picked, else that row alone
|
|
18
|
+
* daysOf(dx, width, days) → the whole days a Gantt bar dragged dx pixels moves, on a timeline width px wide spanning `days` days
|
|
19
|
+
* shiftIds(sel, uid, rows) → the tasks a bar drag shifts: every picked row when the bar's row is picked; a parent's bar shifts the tasks
|
|
20
|
+
* under it; else the row itself
|
|
21
|
+
* bulkSteps(post, at, steps, h, label) → several bulk writes (a drop that changes parent and stage), one message and one Undo for all
|
|
13
22
|
*
|
|
14
23
|
* The UI says PMOS, never Claude. Buttons are icons with aria-label where the design shows an icon. */
|
|
15
24
|
export const OPS = Object.freeze([['parent', 'Under a parent'], ['section', 'Stage'], ['owner', 'Who'], ['shift', 'Move dates'], ['done', 'Done']]);
|
|
@@ -28,7 +37,8 @@ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&':
|
|
|
28
37
|
const X = '<svg class="pm-ic" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>';
|
|
29
38
|
export function barHtml(n, o = {}) {
|
|
30
39
|
if (!n) return '';
|
|
31
|
-
|
|
40
|
+
// "Set epic…" joins the bar when every picked row is a Jira ticket (WorkJiraDS; o.epic)
|
|
41
|
+
const ops = OPS.filter(([k]) => o[k] !== false).concat(o.epic ? [['epic', 'Set epic…']] : []);
|
|
32
42
|
return `<div class="pm-row ws-bar" role="toolbar" aria-label="${esc(n + ' selected')}"><b class="ws-n">${esc(n)} selected</b>`
|
|
33
43
|
+ ops.map(([k, l]) => `<button type="button" class="pm-btn${k === 'done' ? '' : ' outline'}" data-ws-op="${k}"${k === 'done' ? '' : ' aria-haspopup="menu"'}>${esc(l)}</button>`).join('')
|
|
34
44
|
+ `<button type="button" class="pm-btn ws-x" data-ws-op="clear" aria-label="Clear the selection" title="Clear (Esc)">${X}</button></div>`;
|
|
@@ -41,7 +51,7 @@ export function shiftOf(text) {
|
|
|
41
51
|
return n && Math.abs(n) <= 730 ? n : null;
|
|
42
52
|
}
|
|
43
53
|
|
|
44
|
-
const WORDS = { parent: 'moved under', section: 'moved to', owner: 'given to', shift: 'moved by', done: 'marked done' };
|
|
54
|
+
const WORDS = { epic: 'set under', parent: 'moved under', section: 'moved to', owner: 'given to', shift: 'moved by', done: 'marked done' };
|
|
45
55
|
/** One write per board, one Undo for all. → { moved, skipped } */
|
|
46
56
|
export async function bulk(post, at, ids, op, value, h = {}, label = '') {
|
|
47
57
|
const groups = new Map();
|
|
@@ -69,5 +79,85 @@ export async function bulk(post, at, ids, op, value, h = {}, label = '') {
|
|
|
69
79
|
} : null;
|
|
70
80
|
if (h.say) h.say(text, undo);
|
|
71
81
|
if (h.reload) await h.reload();
|
|
82
|
+
return { moved: n, skipped, runs: done };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* ── drag (initiative work-subtasks-followups; WorkSubtasksDS "Drag a task onto another to nest it; drag it left to take it out", WorkBulkDS) ── */
|
|
86
|
+
export function dragIds(sel, uid) {
|
|
87
|
+
const S = new Set([...(sel || [])].map(String)), u = String(uid);
|
|
88
|
+
return S.has(u) ? [...S] : [u];
|
|
89
|
+
}
|
|
90
|
+
export function dropPlan(rows, ids, to) {
|
|
91
|
+
if (!to || !ids || !ids.length) return null;
|
|
92
|
+
const T = (rows || []).filter((x) => x && x.kind === 'task'), by = new Map(T.map((x) => [String(x.uid), x]));
|
|
93
|
+
const I = ids.map(String).filter((u) => by.has(u) && !by.get(u).jsub);
|
|
94
|
+
if (!I.length) return null;
|
|
95
|
+
const upOf = (u) => { const x = by.get(u); return x && x.up ? String(x.up) : ''; };
|
|
96
|
+
// a row under a dragged one cannot take it (a loop)
|
|
97
|
+
const under = new Set(I);
|
|
98
|
+
let grew = true;
|
|
99
|
+
while (grew) { grew = false; for (const x of T) if (x.up && under.has(String(x.up)) && !under.has(String(x.uid))) { under.add(String(x.uid)); grew = true; } }
|
|
100
|
+
const steps = [], add = (op, value, list) => { const L = list.filter(Boolean); if (L.length) steps.push({ op, value, ids: L }); };
|
|
101
|
+
let label = '';
|
|
102
|
+
if (to.zone === 'on' || to.zone === 'between') {
|
|
103
|
+
const tg = by.get(String(to.uid)); if (!tg || under.has(String(tg.uid))) return null;
|
|
104
|
+
if (to.zone === 'on') {
|
|
105
|
+
if (tg.jsub) return null;
|
|
106
|
+
add('parent', String(tg.uid), I.filter((u) => upOf(u) !== String(tg.uid)));
|
|
107
|
+
label = tg.title || '';
|
|
108
|
+
} else {
|
|
109
|
+
const p = tg.up ? String(tg.up) : '';
|
|
110
|
+
if (p && under.has(p)) return null;
|
|
111
|
+
add('parent', p, I.filter((u) => upOf(u) !== p));
|
|
112
|
+
if (!p && tg.sec != null) add('section', String(tg.sec), I.filter((u) => String((by.get(u) || {}).sec || '') !== String(tg.sec) && !(by.get(u) || {}).jira));
|
|
113
|
+
label = p ? ((by.get(p) || {}).title || '') : 'the top level';
|
|
114
|
+
}
|
|
115
|
+
} else if (to.zone === 'stage') {
|
|
116
|
+
if (to.key == null || to.key === '') return null;
|
|
117
|
+
add('parent', '', I.filter((u) => upOf(u)));
|
|
118
|
+
add('section', String(to.key), I.filter((u) => String((by.get(u) || {}).sec || '') !== String(to.key) && !(by.get(u) || {}).jira));
|
|
119
|
+
label = to.name || '';
|
|
120
|
+
} else if (to.zone === 'left') {
|
|
121
|
+
const g = new Map();
|
|
122
|
+
for (const u of I) { const p = upOf(u); if (!p) continue; const gp = upOf(p); if (!g.has(gp)) g.set(gp, []); g.get(gp).push(u); }
|
|
123
|
+
for (const [gp, L] of g) add('parent', gp, L);
|
|
124
|
+
label = g.size === 1 && [...g.keys()][0] ? ((by.get([...g.keys()][0]) || {}).title || '') : 'the top level';
|
|
125
|
+
} else return null;
|
|
126
|
+
return steps.length ? { steps, label } : null;
|
|
127
|
+
}
|
|
128
|
+
export function daysOf(dx, width, days) {
|
|
129
|
+
if (!(width > 0) || !(days > 0)) return 0;
|
|
130
|
+
const n = Math.round((Number(dx) || 0) / width * days);
|
|
131
|
+
return Math.abs(n) > 730 ? Math.sign(n) * 730 : n || 0;
|
|
132
|
+
}
|
|
133
|
+
export function shiftIds(sel, uid, rows) {
|
|
134
|
+
const S = new Set([...(sel || [])].map(String)), u = String(uid);
|
|
135
|
+
if (S.has(u)) return [...S];
|
|
136
|
+
const T = (rows || []).filter((x) => x && x.kind === 'task'), me = T.find((x) => String(x.uid) === u);
|
|
137
|
+
if (me && me.kids) {
|
|
138
|
+
const out = [], walk = (p) => { for (const x of T) if (String(x.up || '') === p) { if (x.kids) walk(String(x.uid)); else if (!x.jsub) out.push(String(x.uid)); } };
|
|
139
|
+
walk(u); return out;
|
|
140
|
+
}
|
|
141
|
+
return [u];
|
|
142
|
+
}
|
|
143
|
+
/** A drop that changes parent and stage: each step is a bulk write; one message and one Undo put every step back, the last first. */
|
|
144
|
+
export async function bulkSteps(post, at, steps, h = {}, label = '') {
|
|
145
|
+
const done = [], skipped = [];
|
|
146
|
+
for (const s of steps || []) {
|
|
147
|
+
const r = await bulk(post, at, s.ids, s.op, s.value, {}, label).catch(() => null);
|
|
148
|
+
if (r && r.runs) done.push(...r.runs);
|
|
149
|
+
if (r) skipped.push(...(r.skipped || []));
|
|
150
|
+
}
|
|
151
|
+
const ids = new Set(done.flatMap((d) => d.undo.map((x) => x.task)));
|
|
152
|
+
const n = ids.size;
|
|
153
|
+
const text = n ? `${n === 1 ? '1 task' : n + ' tasks'} moved${label ? (label === 'the top level' ? ' to the top level' : ' to ' + label) : ''}.${skipped.length ? ' ' + skipped.length + ' not moved: ' + skipped[0].why + '.' : ''}`
|
|
154
|
+
: (skipped[0] && skipped[0].why ? 'Nothing moved: ' + skipped[0].why + '.' : 'Nothing moved.');
|
|
155
|
+
const undo = n ? async () => {
|
|
156
|
+
for (const d of done.slice().reverse()) await post('/api/boards/tasks/bulk-undo', { ws: d.ws, board: d.board, undo: d.undo }).catch(() => null);
|
|
157
|
+
if (h.say) h.say('Put back.');
|
|
158
|
+
if (h.reload) await h.reload();
|
|
159
|
+
} : null;
|
|
160
|
+
if (h.say) h.say(text, undo);
|
|
161
|
+
if (h.reload) await h.reload();
|
|
72
162
|
return { moved: n, skipped };
|
|
73
163
|
}
|
|
@@ -109,3 +109,73 @@ export function parseUnder(text, rows) {
|
|
|
109
109
|
const hit = T.find((x) => norm(x.title) === want) || T.find((x) => norm(x.title).startsWith(want));
|
|
110
110
|
return hit ? { parent: hit.uid, parentTitle: hit.title, title: m[2].trim() } : null;
|
|
111
111
|
}
|
|
112
|
+
|
|
113
|
+
/* ── the follow-ups (initiative work-subtasks-followups; WorkSubtasksDS, WorkJiraDS) ──
|
|
114
|
+
* groupPlan(rows, o) → [{ stage, say, why, will, groups: [{ name, date, uids }] }] the ✦ grouping proposal: a stage with GROUP_MIN or more
|
|
115
|
+
* top-level tasks where at least two go-live dates are each shared by two or more tasks. PMOS only proposes;
|
|
116
|
+
* o.dropped (Set of 'group:<stage>') hides one. A task that is a parent, a child, a Jira sub-task or done stays out.
|
|
117
|
+
* sourceOf(row) → 'jira' | 'pmos'
|
|
118
|
+
* sourceCounts(rows, epics) → { all, jira, pmos, epic } the Source filter's counts (top-level and nested tasks, not Jira sub-tasks)
|
|
119
|
+
* sourceKeep(rows, f, epics) → the rows the filter keeps: every stage row, each matching task and the parents above it. f: all|jira|pmos|epic
|
|
120
|
+
* allJira(rows, uids) → true when every picked row is a Jira ticket that is not a sub-task ("Set epic…" in the bulk bar) */
|
|
121
|
+
export const GROUP_MIN = 8;
|
|
122
|
+
const MONS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
123
|
+
const dm = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? +m[3] + ' ' + MONS[+m[2] - 1] : ''; };
|
|
124
|
+
export function groupPlan(rows, o = {}) {
|
|
125
|
+
const dr = o.dropped || new Set(), out = [];
|
|
126
|
+
const stages = [];
|
|
127
|
+
let cur = null;
|
|
128
|
+
for (const x of rows || []) {
|
|
129
|
+
if (x && x.kind === 'stage') { cur = x.key ? { s: x, tasks: [] } : null; if (cur) stages.push(cur); continue; }
|
|
130
|
+
if (cur && x && x.kind === 'task') cur.tasks.push(x);
|
|
131
|
+
}
|
|
132
|
+
for (const G of stages) {
|
|
133
|
+
if (dr.has('group:' + G.s.key)) continue;
|
|
134
|
+
const top = G.tasks.filter((x) => !x.up && !x.depth);
|
|
135
|
+
if (top.length < GROUP_MIN || top.some((x) => x.kids)) continue;
|
|
136
|
+
const by = new Map();
|
|
137
|
+
for (const x of top) {
|
|
138
|
+
if (x.kids || x.jsub || x.done || x.ms) continue;
|
|
139
|
+
const d = String(x.end || '').slice(0, 10); if (!d) continue;
|
|
140
|
+
if (!by.has(d)) by.set(d, []); by.get(d).push(x);
|
|
141
|
+
}
|
|
142
|
+
const groups = [...by.entries()].filter(([, L]) => L.length >= 2).sort((a, b) => a[0].localeCompare(b[0]))
|
|
143
|
+
.map(([d, L], i) => ({ name: 'Batch ' + (i + 1) + ' (' + dm(d) + ')', date: d, uids: L.map((x) => String(x.uid)), titles: L.map((x) => x.title) }));
|
|
144
|
+
if (groups.length < 2) continue;
|
|
145
|
+
const n = groups.reduce((k, g) => k + g.uids.length, 0), after = top.length - n + groups.length;
|
|
146
|
+
out.push({
|
|
147
|
+
stage: G.s.key, stageName: G.s.name,
|
|
148
|
+
say: 'Group the ' + n + ' tasks of ' + G.s.name + ' into ' + groups.length + ' batches?',
|
|
149
|
+
why: 'They share ' + groups.length + ' go-live dates (' + groups.map((g) => dm(g.date)).join(', ') + '). The stage is ' + top.length + ' rows long; grouped it is ' + after + '.',
|
|
150
|
+
will: ['Make ' + groups.length + ' parent tasks: ' + groups.map((g) => g.name).join(', '), 'Put each task under the batch with its go-live date; nothing else changes (owners, dates, Jira keys stay)'],
|
|
151
|
+
groups,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return out;
|
|
155
|
+
}
|
|
156
|
+
export const sourceOf = (row) => (row && (row.jira || keyOf(row)) ? 'jira' : 'pmos');
|
|
157
|
+
const isTask = (x) => x && x.kind === 'task' && !x.jsub;
|
|
158
|
+
export function sourceCounts(rows, epics) {
|
|
159
|
+
const T = (rows || []).filter(isTask);
|
|
160
|
+
const jira = T.filter((x) => sourceOf(x) === 'jira').length;
|
|
161
|
+
return { all: T.length, jira, pmos: T.length - jira, epic: T.filter((x) => epicFlag(x, epics)).length };
|
|
162
|
+
}
|
|
163
|
+
export function sourceKeep(rows, f, epics) {
|
|
164
|
+
if (!f || f === 'all') return rows || [];
|
|
165
|
+
const L = rows || [], by = new Map(L.filter((x) => x && x.kind === 'task').map((x) => [String(x.uid), x]));
|
|
166
|
+
const hit = (x) => (f === 'jira' ? sourceOf(x) === 'jira' : f === 'pmos' ? sourceOf(x) === 'pmos' : f === 'epic' ? !!epicFlag(x, epics) : true);
|
|
167
|
+
const keep = new Set();
|
|
168
|
+
for (const x of L) {
|
|
169
|
+
if (!isTask(x) || !hit(x)) continue;
|
|
170
|
+
let u = String(x.uid), seen = 0;
|
|
171
|
+
while (u && !keep.has(u) && seen++ < 50) { keep.add(u); const p = by.get(u); u = p && p.up ? String(p.up) : ''; }
|
|
172
|
+
}
|
|
173
|
+
// a kept ticket keeps its Jira sub-tasks
|
|
174
|
+
for (const x of L) if (x && x.kind === 'task' && x.jsub && x.up && keep.has(String(x.up))) keep.add(String(x.uid));
|
|
175
|
+
return L.filter((x) => !x || x.kind !== 'task' || keep.has(String(x.uid)));
|
|
176
|
+
}
|
|
177
|
+
export function allJira(rows, uids) {
|
|
178
|
+
const by = new Map((rows || []).filter((x) => x && x.kind === 'task').map((x) => [String(x.uid), x]));
|
|
179
|
+
const L = [...(uids || [])];
|
|
180
|
+
return L.length > 0 && L.every((u) => { const x = by.get(String(u)); return !!(x && keyOf(x) && !x.jsub); });
|
|
181
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="pmos-nonce" content="" />
|
|
6
|
+
<script src="/api/view-prefs/boot.js"></script>
|
|
6
7
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
8
|
<title>Audience · PMOS</title>
|
|
8
9
|
<!-- The audience tab (batch 12 item 1, S3; canvas XrtA9Present): what the call sees while the PM presents from the recording tab. It shows
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="pmos-nonce" content="" />
|
|
6
|
+
<!-- view preferences (bet A461): a published board (?pack=) is read from its pack alone, so it asks the workspace for nothing (board-readonly Part B h) -->
|
|
7
|
+
<script>if (!/[?&]pack=/.test(location.search)) document.write('<script src="/api/view-prefs/boot.js"><\/script>');</script>
|
|
6
8
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
7
9
|
<title>PMOS · Board</title>
|
|
8
10
|
<!-- The premium Board in the Agreed design (initiative premium-agreed-design, B1 B2 B3 N1 N2). One toolbar and no page header; each initiative is a row
|
|
@@ -19,6 +21,7 @@
|
|
|
19
21
|
<link rel="stylesheet" href="/pm/ds-bridge.css" />
|
|
20
22
|
<link rel="stylesheet" href="/pm/cozy-pick.css" />
|
|
21
23
|
<link rel="stylesheet" href="/pm/cozy-board.css" />
|
|
24
|
+
<link rel="stylesheet" href="/pm/changed-mark.css" />
|
|
22
25
|
<link rel="stylesheet" href="/pm/load-shapes.css" />
|
|
23
26
|
<link rel="stylesheet" href="/pm/bd-pin-card.css" />
|
|
24
27
|
<link rel="stylesheet" href="/pm/cozy-panel.css" />
|
|
@@ -54,6 +57,8 @@
|
|
|
54
57
|
</div>
|
|
55
58
|
</div>
|
|
56
59
|
|
|
60
|
+
<!-- the product's strategy in five lines (pm/bd-strategy.js, bet A458): above the initiatives on a Board that shows one product -->
|
|
61
|
+
<section class="bd-sec" id="cStrat" aria-label="Strategy" hidden></section>
|
|
57
62
|
<section class="bd-sec" id="cIni" aria-labelledby="hIni">
|
|
58
63
|
<h2 class="vh" id="hIni">Initiatives</h2>
|
|
59
64
|
<div id="bdShowing" hidden></div>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="pmos-nonce" content="" />
|
|
6
|
+
<script src="/api/view-prefs/boot.js"></script>
|
|
6
7
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
8
|
<title>PMOS · Meeting buddy</title>
|
|
8
9
|
<!-- The meeting buddy (initiative meeting-buddy; Exploring 2, "Meeting buddy and one-press start", boards 1, 2 and 4). The PMOS extension frames
|