create-pmos 0.618.0 → 0.620.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.
@@ -57,7 +57,14 @@ const stOf = (id) => {
57
57
  const looseKeep = (id, on) => { const L = (store.get(LOOSE, []) || []).filter((x) => x !== id); if (on) L.push(id); store.set(LOOSE, L.slice(-200)); };
58
58
  /** The task a Today row opened (round 3 item 11b): its stage opens and its row is lit until another task is focused. '' clears it. */
59
59
  export function focus(id, uid) { stOf(String(id)).focus = uid ? String(uid) : ''; }
60
+ /** A Today task row (popup round 3 point 20g): once the initiative popup draws, the small task popup opens on top at that task. */
61
+ let OPEN_ON_DRAW = null;
62
+ export function openOnDraw(id, uid) { OPEN_ON_DRAW = id && uid ? { id: String(id), uid: String(uid), at: Date.now() } : null; }
60
63
  const ITEMS = new Map(); // initiative id → the Library's rows | null while reading | false when the route is not there
64
+ /* A published read-only copy (pm/readonly.js; shared-copy brief Part A 4): the popup reads, never writes. No ✦ proposals, no ✓ ✕, no
65
+ * status or date menus, no rename, no "Open the task", no row menu, no Add, no column tools, no source of a line; Artefacts by name, kind
66
+ * and version only, never a path, an open or a peek. The folds, the span and Details still open and close. */
67
+ const RO = typeof window !== 'undefined' && !!window.PMOS_READONLY;
61
68
  const ib = (attr, label, d, cls = '') => `<button type="button" class="pw-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(d)}</button>`;
62
69
 
63
70
  /** The body is in the popup, and the PM did not ask for the old page there. */
@@ -143,14 +150,21 @@ function ovLines(ov, oid, edit = true) {
143
150
  const ed = edit && L.edit;
144
151
  const words = L.text ? esc(L.text) : 'Not written yet.'; // the label already names it: said once (round 3 design check)
145
152
  const tx = ed ? `<span class="pw-otx${L.text ? '' : ' grey'}" data-pw-line="${esc(L.id)}" tabindex="0" role="button" aria-label="${esc((L.text ? 'Change the ' : 'Write the ') + L.k.toLowerCase())}">${words}</span>` : `<span class="${L.text ? '' : 'grey'}">${words}</span>`;
146
- const src = L.text && L.src ? (L.path ? ` <button type="button" class="pw-osrc" data-pw-src="${esc(L.path)}">from ${esc(L.src)}</button>` : ` <span class="pw-osrc">from ${esc(L.src)}</span>`) : '';
153
+ const src = !RO && L.text && L.src ? (L.path ? ` <button type="button" class="pw-osrc" data-pw-src="${esc(L.path)}">from ${esc(L.src)}</button>` : ` <span class="pw-osrc">from ${esc(L.src)}</span>`) : '';
147
154
  const sid = 'ov:' + oid + ':' + L.id;
148
- const off = !L.text && L.ask && !dr.has(sid) ? `<span class="pw-ooff"><span class="pw-oq">${SVG(P.spark, 12, 2)}${esc(L.miss.replace(/^.*?\. /, ''))}</span><span class="pw-sugb">${ib(`data-pw-lkeep="${esc(L.id)}"`, 'Yes, draft it', P.check, 'sm')}${ib(`data-pw-ldrop="${esc(sid)}"`, 'No', P.x, 'sm')}</span></span>` : '';
155
+ const off = !RO && !L.text && L.ask && !dr.has(sid) ? `<span class="pw-ooff"><span class="pw-oq">${SVG(P.spark, 12, 2)}${esc(L.miss.replace(/^.*?\. /, ''))}</span><span class="pw-sugb">${ib(`data-pw-lkeep="${esc(L.id)}"`, 'Yes, draft it', P.check, 'sm')}${ib(`data-pw-ldrop="${esc(sid)}"`, 'No', P.x, 'sm')}</span></span>` : '';
149
156
  return `<div class="pw-ol"><span class="pw-ok">${esc(L.k)}</span><p class="pw-ot">${tx}${L.serves ? ' <span>' + esc(L.serves) + '</span>' : ''}${src}${off}</p></div>`;
150
157
  }).join('')}</div>`;
151
158
  }
152
159
  function overviewHtml(W, S, oid) {
153
160
  const ov = W.overview, open = !!S.details;
161
+ if (RO) {
162
+ // a copy: the lines as plain words, with no source and no offer; the status line; the facts as text
163
+ const lines = `<div class="pw-ols">${ov.lines.filter((L) => L.text).map((L) => `<div class="pw-ol"><span class="pw-ok">${esc(L.k)}</span><p class="pw-ot"><span>${esc(L.text)}</span>${L.serves ? ' <span>' + esc(L.serves) + '</span>' : ''}</p></div>`).join('')}</div>`;
164
+ const stl = ov.status ? `<p class="pw-ostat">${esc(ov.status)}</p>` : '';
165
+ const dt = `<button type="button" class="pw-det" data-pw-details aria-expanded="${open}">${open ? 'Less' : 'Details'}${SVG(open ? P.down : P.right, 14)}</button>`;
166
+ return `<section class="pw-ov" aria-label="Overview"><div class="pw-ovh"><h3>Overview</h3>${dt}</div>${lines}${stl}${open ? factsHtml(W.facts.filter((f) => !/^no signal$/i.test(String(f.v || '').trim())).map((f) => ({ ...f, read: true }))) : ''}</section>`;
167
+ }
154
168
  const mark = `<span class="pw-spark" role="img" aria-label="PMOS wrote this from the records" title="PMOS wrote this from the records">${SVG(P.spark, 14, 2)}</span>`;
155
169
  const st = ov.status ? `<p class="pw-ostat">${esc(ov.status)}</p>` : '';
156
170
  const sug = W.suggests.length ? `<div class="pw-sugs" role="list" aria-label="PMOS suggests"><p class="pw-sugh">PMOS suggests</p>${W.suggests.map((s) => sugLine(s)).join('')}${W.more ? `<button type="button" class="pw-lk" data-pw-props>${esc(W.more + ' more')}</button>` : ''}</div>` : '';
@@ -211,6 +225,7 @@ function barHtml(x, W) {
211
225
  return CB.taskBar(x, X, W.today);
212
226
  }
213
227
  function rowHtml(x, W, C, sugRows) {
228
+ if (RO) { x = { ...x, jira: true }; sugRows = new Map(); } // a copy: a task's status, date and name are text, as a Jira task's are; no ✦
214
229
  const tl = C.tl ? `<div class="pw-tl">${(x.kind === 'stage' || x.kind === 'task' || x.kind === 'done') ? barHtml(x, W) : ''}${W.tx != null ? `<i class="pw-now" style="left:${W.tx.toFixed(2)}%"></i>` : ''}</div>` : '';
215
230
  const stc = C.status ? `<span class="pw-st">${x.kind === 'task' && !x.jira ? `<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>` : '';
216
231
  const dtc = C.date ? `<span class="pw-dt${x.late ? ' warn' : ''}">${x.kind === 'task' && !x.jira ? `<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>` : '';
@@ -225,7 +240,7 @@ function rowHtml(x, W, C, sugRows) {
225
240
  if (x.kind === 'done') return `<div class="pw-tr pw-dr" role="row"><span class="pw-it"><button type="button" class="pw-dn" data-pw-done="${esc(x.key)}" aria-expanded="${x.open}">${esc(x.label)}${SVG(x.open ? P.down : P.right, 14)}</button></span>${C.status ? '<span></span>' : ''}${C.date ? '<span></span>' : ''}${tl}</div>`;
226
241
  const s = sugRows.get(x.uid);
227
242
  const title = x.jira ? `<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>`;
228
- return `<div class="pw-tr pw-kr${x.done ? ' done' : ''}${x.lit ? ' lit' : ''}" role="row" data-pw-row="${esc(x.uid)}" data-pw-sec="${esc(x.sec)}"><span class="pw-it"><i class="pw-bul${x.ms ? ' ms' : ''}" aria-hidden="true"></i>${title}${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>${stc}${dtc}${tl}</div>`
243
+ return `<div class="pw-tr pw-kr${x.done ? ' done' : ''}${x.lit ? ' lit' : ''}" role="row" data-pw-row="${esc(x.uid)}" data-pw-sec="${esc(x.sec)}"><span class="pw-it"><i class="pw-bul${x.ms ? ' ms' : ''}" aria-hidden="true"></i>${title}${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>${stc}${dtc}${tl}</div>`
229
244
  + (s ? `<div class="pw-tr pw-sugrow" role="row"><span class="pw-it">${sugLine(s, true)}</span></div>` : '');
230
245
  }
231
246
  /* Work breakdown, round 3 point 22 (Wawan: "Stage not apply to task, it only apply to initiative"): the stages are ONE row of the initiative's
@@ -276,11 +291,11 @@ function breakdownHtml(W, C, mode, full, S, o, r) {
276
291
  out += rowHtml(x, W, C, sugRows);
277
292
  if (x.kind === 'stage' && x.open) curSec = x;
278
293
  const nx = W.rows[i + 1];
279
- if (curSec && (!nx || nx.kind === 'stage' || nx.kind === 'far')) { if (curSec.key !== '' ) out += add(curSec.key, curSec.name); curSec = null; }
294
+ if (curSec && (!nx || nx.kind === 'stage' || nx.kind === 'far')) { if (curSec.key !== '' && !RO) out += add(curSec.key, curSec.name); curSec = null; }
280
295
  }
281
296
  const spanB = C.tl ? `<button type="button" class="pw-span" data-pw-span aria-haspopup="menu" aria-label="${esc('Span of the timeline: ' + (M.MODES.find((m) => m[0] === mode) || M.MODES[5])[1])}">${esc((M.MODES.find((m) => m[0] === mode) || M.MODES[5])[1])}${SVG(P.down, 12)}</button>` : '';
282
- const tools = `<span class="pw-tools">${spanB}${ib(`data-pw-big aria-pressed="${!!full}"`, full ? 'Back to the initiative' : 'Give the work breakdown the whole popup', full ? P.in : P.full)}${ib('data-pw-tune="wbs" aria-haspopup="menu"', 'Show or hide columns', P.tune)}</span>`;
283
- const show = !C.tl ? ib('data-pw-tl', 'Show the timeline', P.show, 'xs') : '';
297
+ const tools = RO ? (spanB ? `<span class="pw-tools">${spanB}</span>` : '') : `<span class="pw-tools">${spanB}${ib(`data-pw-big aria-pressed="${!!full}"`, full ? 'Back to the initiative' : 'Give the work breakdown the whole popup', full ? P.in : P.full)}${ib('data-pw-tune="wbs" aria-haspopup="menu"', 'Show or hide columns', P.tune)}</span>`;
298
+ const show = !C.tl && !RO ? ib('data-pw-tl', 'Show the timeline', P.show, 'xs') : '';
284
299
  return `<section class="pw-sec" aria-label="Work breakdown">${full ? `<div class="pw-sech">${tools}</div>` : `<div class="pw-sech"><h3>Work breakdown</h3>${show}${tools}</div>`}`
285
300
  + `<div class="pw-card pw-wbs${C.tl ? '' : ' notl'}${C.status ? '' : ' nost'}${C.date ? '' : ' nodt'}" role="table" aria-label="Work breakdown"${tlStyle()}>${C.tl ? gripHtml() : ''}${headCells(C, W, mode)}${out || '<div class="pw-tr pw-empty" role="row"><span>No task yet.</span></div>'}</div>`
286
301
  + (C.tl ? '<p class="pw-key"><span><i class="k-tb pr"></i>In progress</span><span><i class="k-tb"></i>To do</span><span><i class="k-tb dn"></i>Done</span><span><i class="k-md"></i>Milestone</span><span><i class="k-late"></i>Late</span><span><i class="k-gap"></i>No activity</span></p>' : '') + '</section>';
@@ -290,6 +305,13 @@ function breakdownHtml(W, C, mode, full, S, o, r) {
290
305
  * them (✓ asks PMOS, ✕ hides it). */
291
306
  const ARTOPEN = new Set(); // kinds unfolded, per page
292
307
  function artefactsHtml(rows, C, add = true, o = {}) {
308
+ if (RO) {
309
+ // a copy (brief Part B c): the kind, the name and the version; no path, no open, no peek, no date, no "By"; none at all says nothing
310
+ const R = rows.filter((a) => !a.missing);
311
+ if (!R.length) return '';
312
+ return `<section class="pw-sec" aria-label="Artefacts"><div class="pw-sech"><h3>Artefacts</h3></div><div class="pw-card pw-arts now" role="table" aria-label="Artefacts"><div class="pw-ar pw-th" role="row"><span role="columnheader">Kind</span><span role="columnheader">Artefact</span><span role="columnheader">Version</span></div>`
313
+ + R.map((a) => `<div class="pw-ar" role="row"><span role="cell" class="pw-ak">${esc(a.kindName || a.kind)}</span><span role="cell">${esc(a.title)}</span><span role="cell" class="pw-av">${esc(a.came || '')}</span></div>`).join('') + '</div></section>';
314
+ }
293
315
  const idx = new Map(rows.map((a, i) => [a, i]));
294
316
  const G = AK.group(rows, { at: (a) => a.at || 0, current: (a) => !!(o.recPath && a.path && a.path.replace(/^pmos\//, '') === String(o.recPath).replace(/^pmos\//, '')), dropped: dropped() });
295
317
  const scope = o.scope || '';
@@ -414,7 +436,9 @@ export function wire(body, h0, x0) {
414
436
  if (!body) return;
415
437
  // the Viewer reuses its body for the next item: the presses read the item shown now from the body, so one set of listeners serves all
416
438
  body.__pwh = ED.writes(h0); body.__pwx = x0;
417
- { const c = cur(); if (c) { readItems(c.id, (x0.o() || {}).ws, () => redraw()); if (c.S.top) body.scrollTop = c.S.top; } }
439
+ { const c = cur(); if (c) { readItems(c.id, (x0.o() || {}).ws, () => redraw()); if (c.S.top) body.scrollTop = c.S.top; }
440
+ const q = OPEN_ON_DRAW;
441
+ if (c && q && q.id === String(c.id) && Date.now() - q.at < 15000) { OPEN_ON_DRAW = null; setTimeout(() => { const c2 = cur(); if (c2) openSmall(q.uid, c2, body.__pwh, body.__pwx, body); }, 0); } }
418
442
  if (body.__pw) return;
419
443
  body.__pw = true;
420
444
  function cur() { const x = body.__pwx, r = x && x.r(), v = x && x.v(); return r && v ? { r, v, ...model(r, v, x.o()) } : null; }
@@ -762,7 +786,7 @@ export function moreItems(x, h) {
762
786
  export function levelHtml(L, o = {}) {
763
787
  const W = M.levelOf(L, { today: o.today, mode: store.get(SPAN, 'full') }), C = cols(), mode = store.get(SPAN, 'full');
764
788
  const mk = M.marksOf(W.span, W.today); W.tx = mk.today;
765
- const sug = W.suggests.length ? `<div class="pw-sugs" role="list" aria-label="PMOS suggests"><p class="pw-sugh">PMOS suggests</p>${W.suggests.map((s) => sugLine(s)).join('')}</div>` : '';
789
+ const sug = !RO && W.suggests.length ? `<div class="pw-sugs" role="list" aria-label="PMOS suggests"><p class="pw-sugh">PMOS suggests</p>${W.suggests.map((s) => sugLine(s)).join('')}</div>` : '';
766
790
  // the same Overview shape as an initiative (round 3 point 10): what it is for, its goal, done when; then the status line and Details ›
767
791
  const lk = 'level:' + W.kind + ':' + (W.title || ''), S = stOf(lk), open = !!S.details;
768
792
  const F = W.facts.filter((f) => f && f.v && !M.idShaped(f.v)).map((f) => ({ ...f, read: true }));
@@ -776,7 +800,7 @@ export function levelHtml(L, o = {}) {
776
800
  const lead = x.group ? `<b class="pw-grp">${esc(x.title)}</b>` : `<button type="button" class="pw-stg lv${x.sub ? ' sub' : ''}" data-pw-go="${esc(x.kind + ':' + x.id)}"><b>${esc(x.title)}</b>${SVG(P.right, 14)}${x.count ? `<small>${esc(x.count)}</small>` : ''}</button>`;
777
801
  return `<div class="pw-tr pw-sr" role="row"><span class="pw-it">${lead}</span>${C.status ? `<span class="pw-st">${esc(x.stage || '')}</span>` : ''}${C.date ? `<span class="pw-dt${x.late ? ' warn' : ''}">${esc(x.date || '')}</span>` : ''}${tl}</div>`;
778
802
  }).join('');
779
- const wbs = `<section class="pw-sec" aria-label="${esc(head)}"><div class="pw-sech"><h3>${esc(head)}</h3>${!C.tl ? ib('data-pw-tl', 'Show the timeline', P.show, 'xs') : ''}<span class="pw-tools">${C.tl ? `<button type="button" class="pw-span" data-pw-span aria-haspopup="menu">${esc((M.MODES.find((m) => m[0] === mode) || M.MODES[5])[1])}${SVG(P.down, 12)}</button>` : ''}${ib('data-pw-tune="wbs" aria-haspopup="menu"', 'Show or hide columns', P.tune)}</span></div>`
803
+ const wbs = `<section class="pw-sec" aria-label="${esc(head)}"><div class="pw-sech"><h3>${esc(head)}</h3>${!C.tl && !RO ? ib('data-pw-tl', 'Show the timeline', P.show, 'xs') : ''}<span class="pw-tools">${C.tl ? `<button type="button" class="pw-span" data-pw-span aria-haspopup="menu">${esc((M.MODES.find((m) => m[0] === mode) || M.MODES[5])[1])}${SVG(P.down, 12)}</button>` : ''}${RO ? '' : ib('data-pw-tune="wbs" aria-haspopup="menu"', 'Show or hide columns', P.tune)}</span></div>`
780
804
  + `<div class="pw-card pw-wbs${C.tl ? '' : ' notl'}${C.status ? '' : ' nost'}${C.date ? '' : ' nodt'}" role="table"${tlStyle()}>${C.tl ? gripHtml() : ''}${headCells(C, W, mode, W.kind === 'product' ? 'Program or initiative' : 'Initiative').replace('<span role="columnheader">Status</span>', '<span role="columnheader">Stage</span>')}${rows || '<div class="pw-tr pw-empty" role="row"><span>Nothing one level down yet.</span></div>'}</div></section>`;
781
805
  return `<div class="pw" data-pw-level>${ov}${wbs}${W.artefacts.length || o.add !== false ? artefactsHtml(W.artefacts, C, o.add !== false, { scope: lk }) : ''}</div>`;
782
806
  }
@@ -46,6 +46,9 @@ const store = {
46
46
  set(k, v) { try { if (v == null) localStorage.removeItem(k); else localStorage.setItem(k, String(v)); } catch { /* a private window */ } },
47
47
  };
48
48
  const isPhone = () => typeof innerWidth === 'number' && innerWidth <= 760;
49
+ /** A published read-only copy (pm/readonly.js; shared-copy brief Part A 4): the popup holds the work alone. No Ask PMOS, no session list, no
50
+ * GET /api/sessions; the close is the one press of its frame. */
51
+ const RO = typeof window !== 'undefined' && !!window.PMOS_READONLY;
49
52
  const S = {
50
53
  el: null, card: null, left: null, right: null, box: null, all: null, menu: null, toast: null, tools: null, title: null, st: null,
51
54
  open: false, about: null, home: null, chat: null, back: null, raw: [], rows: { now: [], earlier: [], all: [] }, view: 'chat', q: '', prev: null,
@@ -73,6 +76,14 @@ function frame() {
73
76
  sheet();
74
77
  const el = document.createElement('div');
75
78
  el.className = 'cz-pop'; el.hidden = true;
79
+ if (RO) {
80
+ el.innerHTML = '<div class="cz-pop-sc" data-pop="close"></div><div class="cz-pop-card chat-off ro" role="dialog" aria-modal="true" aria-label="Work" tabindex="-1"><div class="cz-pop-l"></div>'
81
+ + `<div class="cz-pop-tools">${ib('close', 'Close', I.close)}</div></div>`;
82
+ document.body.appendChild(el);
83
+ Object.assign(S, { el, card: el.querySelector('.cz-pop-card'), left: el.querySelector('.cz-pop-l'), tools: el.querySelector('.cz-pop-tools') });
84
+ el.addEventListener('click', (e) => { if (e.target.closest('[data-pop="close"]')) close(); });
85
+ return;
86
+ }
76
87
  el.innerHTML = '<div class="cz-pop-sc" data-pop="close"></div>'
77
88
  + '<div class="cz-pop-card" role="dialog" aria-modal="true" aria-label="Work and Ask PMOS" tabindex="-1">'
78
89
  + '<div class="cz-pop-l"></div>'
@@ -148,6 +159,12 @@ VW.onChange((d) => { if (d && d.pop && d.shut && S.open) hide(); });
148
159
  function show(pop) {
149
160
  if (S.open) { retarget(pop); return; }
150
161
  frame();
162
+ if (RO) {
163
+ S.open = true; S.back = document.activeElement && document.activeElement !== document.body ? document.activeElement : null;
164
+ S.el.hidden = false; document.body.classList.add('cz-pop-on');
165
+ setTimeout(() => { if (S.open && S.card && !S.card.contains(document.activeElement)) S.card.focus({ preventScroll: true }); }, 0);
166
+ return;
167
+ }
151
168
  S.open = true; S.view = 'chat'; S.q = ''; S.prev = null;
152
169
  S.back = document.activeElement && document.activeElement !== document.body ? document.activeElement : null;
153
170
  S.el.hidden = false; document.body.classList.add('cz-pop-on');
@@ -178,6 +195,7 @@ function retarget(pop) {
178
195
  read();
179
196
  }
180
197
  function hide() {
198
+ if (RO) { S.open = false; S.el.hidden = true; document.body.classList.remove('cz-pop-on'); const b = S.back; S.back = null; if (b && b.isConnected) { try { b.focus({ preventScroll: true }); } catch { /* gone */ } } return; }
181
199
  S.open = false; clearTimeout(S.timer); closeMenu(); hideToast();
182
200
  S.view = 'chat'; S.all.hidden = true; S.all.innerHTML = ''; S.right.classList.remove('all-on');
183
201
  detach();
@@ -254,7 +272,7 @@ async function rowTarget(r) {
254
272
  }
255
273
  /** Change the chat (page-chat.js openTarget while the popup shows, a session picked). The work on the left stays. */
256
274
  export async function chatTo(t) {
257
- if (!S.open) return false;
275
+ if (!S.open || RO) return false;
258
276
  const P = S.chat || await provider();
259
277
  const x = await resolve(t);
260
278
  if (x) P.open(x);
@@ -467,6 +485,7 @@ async function openIni(id, row) {
467
485
  }
468
486
  /** The chat icon: the session that waits for you, else the newest. Left: its work, or the full list of sessions. */
469
487
  export async function openChat() {
488
+ if (RO) return false; // a copy has no chat
470
489
  if (isPhone()) { const M = await pageChat(); return M.openCos({ here: '' }); }
471
490
  const r = await pmGet('/api/sessions').catch(() => null);
472
491
  const R = sessionRows(r && Array.isArray(r.sessions) ? r.sessions : [], { titleOf });
@@ -478,6 +497,7 @@ export async function openChat() {
478
497
  }
479
498
  /** The chief-of-staff chat (search's "Ask PMOS: …", page-chat.js openCos): the popup with that chat and the list of sessions. */
480
499
  export async function openCos(t) {
500
+ if (RO) return false;
481
501
  if (S.open) return chatTo(t);
482
502
  VW.open(sessionsItem({ target: t }));
483
503
  return true;
@@ -628,7 +628,7 @@ export function open(it) {
628
628
  if (pn && pn.pop && typeof pn.pop === 'object' && (pn.pop.from || pn.pop.kindChip) && !o.from && !o.kindChip) o = { ...o, from: pn.pop.from || '', kindChip: pn.pop.kindChip || '' };
629
629
  // a published read-only Board has no chat; 'beside' (the PM's choice, cozy-popup.js) keeps work beside the page, unless the popup shows
630
630
  // already (it takes what opens next) or the open is the chat icon's own (force)
631
- const toPop = !o._inst && !!popArg && !!G.popH && !isPhone() && !window.PMOS_READONLY && (!!popArg.force || popShown() || !popBeside());
631
+ const toPop = !o._inst && !!popArg && !!G.popH && !isPhone() && (window.PMOS_READONLY ? !!popArg.ro : true) && (!!popArg.force || popShown() || !popBeside());
632
632
  let x = o._inst || (toPop && popInst()) || (o.into && byP(o.into)) || pick(o); // into: a panel id ('v1'), the Viewer that shows it (the Board's chat panel)
633
633
  // one item, one Viewer (batch 31 item 10): an item already shown in another Viewer is not opened twice; that Viewer shows it again
634
634
  const twin = !o._inst && !x.pop && o.id != null ? ALL.find((y) => y !== x && !y.pop && shown(y) && y.cur.id === String(o.id)) : null;
@@ -533,6 +533,7 @@ export function iniLight(id, uid) {
533
533
  LIT = id && uid ? { id, uid: String(uid), seen: false } : null;
534
534
  if (id) PW.focus(id, LIT ? LIT.uid : '');
535
535
  if (LIT) ED.openRow(id, LIT.uid);
536
+ if (id) PW.openOnDraw(id, LIT ? LIT.uid : ''); // and the small task popup opens on top at it (popup round 3 point 20g)
536
537
  }
537
538
  function light(b, id) {
538
539
  if (!LIT || LIT.id !== id || !b) return;
@@ -327,7 +327,9 @@ export function breakdownOf(r, v, o = {}) {
327
327
  const live = s.status === 'now' && r.status !== 'done' && !r.ended;
328
328
  const dl = b && (s.status === 'now' || s.status === 'next') ? dateLate(b, t, live || ts.some((x) => !x.closed)) : { text: b && s.status === 'done' ? '' : '', late: false };
329
329
  const isOpen = holds(all, f) ? true : shut.has(s.key) ? false : open.has(s.key) ? true : s.status === 'now';
330
- const count = n ? (s.status === 'next' && !nDone ? plural(n, 'task', 'tasks') : nDone + ' of ' + n + ' done') : '';
330
+ // the count holds every task drawn under the stage: its own and the ones in no stage that sit under it (design check, 2026-11-19)
331
+ const nAll = n + lz.length;
332
+ const count = nAll ? (s.status === 'next' && !nDone ? plural(nAll, 'task', 'tasks') : nDone + ' of ' + nAll + ' done') : '';
331
333
  const has = n + lz.length > 0;
332
334
  // the bar's gap line and its ◇s (pm/cozy-bar.js stageBar): the stage's dated tasks, and its milestone tasks
333
335
  const gaps = a && b ? gapsOf(all.filter((x) => !x.wont).map((x) => [x.start || x.end, x.end || x.start]).filter(([p]) => p), a, b) : [];
@@ -387,7 +389,7 @@ export function artefactsOf(v, o = {}) {
387
389
  for (const it of o.items || []) {
388
390
  if (!it || !it.name || seen.has(key(it.name))) continue;
389
391
  seen.add(key(it.name));
390
- out.push({ id: it.id, title: it.name, kind: it.kindText || KIND_OF_ITEM[it.kind] || 'Document', when: it.updated ? dayText(it.updated, t) || it.updated : '', item: it, link: it.kind === 'link',
392
+ out.push({ id: it.id, title: it.name, kind: it.kindText || KIND_OF_ITEM[it.kind] || 'Document', when: it.updated ? dayText(it.updated, t) || it.updated : '', came: it.came || '', item: it, link: it.kind === 'link',
391
393
  type: it.type || '', path: (it.open && it.open.doc && it.open.doc.path) || '', akind: it.kind, at: Date.parse(it.updated || '') || 0,
392
394
  // the Library's own Kind (lib/library-items.js kindOf, PR #1376) when it is a specific one; the popup's resolver only fills in for older servers
393
395
  kindName: it.kindText && !/^(Document|Meeting notes|Link|File)$/.test(it.kindText) ? (it.kindText === 'Rubric' ? 'Eval rubric' : it.kindText) : '' });
@@ -140,9 +140,10 @@ const NF = narrowForm({ page: $('#stage'), sheets: /\/pm\/(cozy-board|bd-[\w-]+)
140
140
  const narrow = () => !PHONE.matches && NF.narrow();
141
141
  const small = () => PHONE.matches || narrow();
142
142
  /** Work, one view (initiative work-one-view, boards 4, 5 and 24): on a desk the list of initiatives with its timeline replaces the four views.
143
- * A phone, the narrow form and a published read-only copy keep their views. */
144
- const CLASSIC = (() => { try { return localStorage.getItem('pmos.work.classic') === '1'; } catch { return false; } })(); // a test seam (lib/classic-board.js): suites of the four views
145
- const workOn = () => !CLASSIC && !small() && !window.PMOS_READONLY;
143
+ * A phone and the narrow form keep their views. A published read-only copy draws Work too (board RoWork, shared-copy build brief Part A). */
144
+ const CLASSIC = (() => { try { return !!window.__pmosClassic || localStorage.getItem('pmos.work.classic') === '1'; } catch { return false; } })(); // a test seam (lib/classic-board.js): suites of the four views
145
+ const workOn = () => !CLASSIC && !small();
146
+ const ROC = !!window.PMOS_READONLY; // a published read-only copy: Work draws, nothing on it writes (pm/readonly.js)
146
147
  const goneRows = () => { const G = (M && M.initiatives && M.initiatives.gone) || {}; return [...(G.cancelled || []), ...(G.archived || [])]; };
147
148
  const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || goneRows().find((r) => r.key === key) || null;
148
149
  /** The rows on screen grouped (pm/bd-prog.js groupsOf): programs first, then the product; or By product. null when no program holds a row here. */
@@ -618,7 +619,7 @@ function drawWork(L) {
618
619
  return WV.listHtml(L, { many: wkMany(), sel: peek && peek.kind === 'ini' ? peek.key : null, rowOf, bar: wkBar,
619
620
  product: wkProduct, goalOf: wkGoalOf, programOf: wkProgOf, order: (rows) => sortInis(pk, rows, lay, INI_ACC),
620
621
  goalGroups: (rows) => (GOALS ? GL.asGroups(rows, GOALS, (rs) => sortInis(pk, rs, lay, INI_ACC)) : null),
621
- canMove: (r) => !!(r.track && r.acts && (r.acts.stages || []).length > 1) });
622
+ canMove: (r) => !ROC && !!(r.track && r.acts && (r.acts.stages || []).length > 1) });
622
623
  }
623
624
  /** One row's bar on Work: the Board's own (pm/bd-span.js rowBar, Wawan's round 2): done, now, planned, every milestone ◇ with its popup, the
624
625
  * gap line, the late line. W: Work's window { from, to }. The track's width is measured once drawn, so close ◇s merge at about 40 px. */
@@ -634,7 +635,7 @@ function workPress(e) {
634
635
  const p = WV.pressOf(e.target); if (!p) return false;
635
636
  if (p.kind === 'inside') return true; // a press in the open stage card stays there
636
637
  if (p.kind === 'spanmenu') { spanMenu(); return true; }
637
- if (p.kind === 'stage') { stageMenu(rowOf(p.key), p.el); return true; }
638
+ if (p.kind === 'stage') { if (!ROC) stageMenu(rowOf(p.key), p.el); return true; }
638
639
  if (!WV.apply(p)) return false;
639
640
  drawInit(); wkCount(); if (WK_MENU) drawWorkMenu();
640
641
  const f = p.kind === 'sort' ? `[data-wksort="${p.k}"]` : p.kind === 'span' ? '[data-wkspan]' : p.kind === 'timeline' ? (p.on ? '[data-wktl="off"]' : '[data-wktl="on"]') : p.kind === 'closed' ? '[data-wkclosed]' : null;
@@ -722,7 +723,7 @@ function wkCount() {
722
723
  function drawWorkMore() {
723
724
  const menu = $('#moreMenu'); if (!menu) return;
724
725
  for (const x of $$('#moreMenu > .wk-xo')) x.remove();
725
- if (!workOn() || !M) return;
726
+ if (!workOn() || !M || ROC) return;
726
727
  const at = $('#bdPublish') || menu.firstElementChild;
727
728
  at.insertAdjacentHTML('beforebegin', workMore());
728
729
  }
@@ -731,7 +732,7 @@ function drawWorkMenu(focus) {
731
732
  if (!WK_MENU) return;
732
733
  const was = focus || (WK_MENU.contains(document.activeElement) ? wkSel(document.activeElement) : null);
733
734
  const sc = WK_MENU.firstElementChild ? WK_MENU.firstElementChild.scrollTop : 0;
734
- WK_MENU.innerHTML = WV.menuHtml({ many: wkMany(), sprint: (M && M.jira && M.jira.sprint) || null });
735
+ WK_MENU.innerHTML = WV.menuHtml({ many: wkMany(), sprint: ROC ? null : (M && M.jira && M.jira.sprint) || null, ro: ROC });
735
736
  const m = WK_MENU.firstElementChild, b = WK_MENU.__btn.getBoundingClientRect();
736
737
  const top = Math.round(b.bottom + 8);
737
738
  m.style.top = top + 'px'; m.style.left = Math.max(8, Math.round(b.right - m.offsetWidth)) + 'px';
@@ -1129,7 +1130,17 @@ document.addEventListener('click', (e) => {
1129
1130
  } });
1130
1131
  });
1131
1132
  /* ── the tools the Agreed design draws but has no frame for: plain versions with a "Waiting for design" tag (pm/bd-acts.js) ─────────── */
1132
- $('#bdFind').addEventListener('click', (e) => Acts.open.find(e.currentTarget));
1133
+ $('#bdFind').addEventListener('click', (e) => { if (ROC && workOn()) roFind(e.currentTarget); else Acts.open.find(e.currentTarget); });
1134
+ /** A copy's search (shared-copy brief Part A 3): a field beside the find icon that keeps the rows whose name holds the words. The workspace's
1135
+ * Search reads the publisher's computer, which a copy never reaches, so a copy searches only what it holds, in memory. */
1136
+ function roFind(btn) {
1137
+ let f = $('#roFind');
1138
+ if (f) { WV.setQuery(''); f.remove(); btn.setAttribute('aria-expanded', 'false'); drawInit(); wkCount(); btn.focus(); return; }
1139
+ btn.insertAdjacentHTML('beforebegin', '<input type="search" id="roFind" class="wk-q" placeholder="Find an initiative" aria-label="Find an initiative in this copy" autocomplete="off" spellcheck="false" maxlength="80">');
1140
+ f = $('#roFind'); btn.setAttribute('aria-expanded', 'true'); f.focus();
1141
+ f.addEventListener('input', () => { WV.setQuery(f.value); drawInit(); wkCount(); });
1142
+ f.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.stopPropagation(); roFind(btn); } });
1143
+ }
1133
1144
  $('#bdFilter').addEventListener('click', (e) => { if (workOn()) toggleWorkMenu(e.currentTarget); else Acts.open.filter(e.currentTarget); });
1134
1145
  // New (PgBoard: "New program or initiative"): a menu of the two. The program panel's own "New initiative" presses this button from code,
1135
1146
  // and that press opens New initiative at once.
@@ -4,7 +4,10 @@
4
4
  * · the pack is a file of the page's own server (a path that starts with one /), read once, here, before any module runs. It may be the answer of
5
5
  * GET /api/board-pack itself: ?pack=%2Fapi%2Fboard-pack%3Fws%3D…%26select%3Dproduct%3A… previews what a teammate will see;
6
6
  * · every GET /api/… is answered from the pack, and every other call is refused with 403, and none of them reach the network;
7
- * · the pack's board is put in the page address when the address names none, so a share's link needs no ?ws=. */
7
+ * · the pack's board is put in the page address when the address names none, so a share's link needs no ?ws=;
8
+ * · the browser's storage is not read or written: localStorage and sessionStorage are a store in memory for this visit, so a reader's view
9
+ * choices never meet a workspace's keys (pmos.work.view.2, pmos.today.count, the scope picks) and nothing stays after the tab closes;
10
+ * · nothing goes to another host: a fetch or a beacon to any address but the page's own is refused (shared-copy brief Part B g, h). */
8
11
  (function () {
9
12
  var q = new URLSearchParams(location.search); var file = q.get('pack');
10
13
  if (!file || file.charAt(0) !== '/' || file.charAt(1) === '/') return;
@@ -13,6 +16,14 @@
13
16
  if (pack && pack.ok && pack.pack) pack = pack.pack; // the pack as GET /api/board-pack answers it: { ok, pack }
14
17
  if (!pack || pack.schema !== 'board-pack/1' || !pack.responses) return;
15
18
  window.PMOS_READONLY = pack;
19
+ // the page's storage, in memory (Part B g): set before any module reads it
20
+ var memStore = function () {
21
+ var m = Object.create(null);
22
+ return { getItem: function (k) { return Object.prototype.hasOwnProperty.call(m, k) ? m[k] : null; }, setItem: function (k, v) { m[k] = String(v); },
23
+ removeItem: function (k) { delete m[k]; }, clear: function () { m = Object.create(null); }, key: function (i) { return Object.keys(m)[i] || null; },
24
+ get length() { return Object.keys(m).length; } };
25
+ };
26
+ ['localStorage', 'sessionStorage'].forEach(function (n) { var s = memStore(); try { Object.defineProperty(window, n, { configurable: true, get: function () { return s; } }); } catch (e) { /* the browser refused: the modules' own guards still hold */ } });
16
27
  var R = pack.responses;
17
28
  if (!q.get('ws')) {
18
29
  // a pack of several picks (batch 27 item 1) opens on its first tab, a program's on its page; else on the pack's one board
@@ -42,6 +53,8 @@
42
53
  if (hit === undefined) hit = wider(a);
43
54
  return Promise.resolve(hit !== undefined ? json(hit) : json({ ok: false, error: 'Not part of this copy.' }, 404));
44
55
  }
56
+ // another host (the publisher's computer, a connector, anything): never asked from a copy (Part B h)
57
+ if (a.origin !== location.origin) return Promise.resolve(json({ ok: false, error: 'A read-only copy reads nothing from elsewhere.' }, 403));
45
58
  return realFetch(input, init);
46
59
  };
47
60
  // a page that is a copy never posts from the side either
@@ -30,10 +30,18 @@ export const VIEW_CONTROLS = [
30
30
  '#czViewer [data-db="fold"]', '#czViewer [data-pp="period"]', '#czViewer [data-pp="per"]', '#czViewer [data-pp="early"]', '#czViewer [data-pp="ini"]',
31
31
  // the line above the Board: the way back to the hub, a tab per pick (batch 27 item 1), Open in my PMOS and Get PMOS (batch 27 items 2 and 3)
32
32
  '.ro-back', '.ro-tab', '.ro-way',
33
+ // Work, one view (shared-copy brief Part A 3, Part B i): a column's sort, the span and its menu, hide and show the timeline, the closed fold,
34
+ // a row (opens its popup), a bar (its stage card) and the card itself, Show all; the find field and the tune panel's filter and sort
35
+ '.wk-hd', '[data-wkspan]', '[data-wkspick]', '[data-wktl]', '[data-wkclosed]', '.wk-i[data-key]', '[data-wkbar] .tg-bar', '[data-wkbar] .wk-bar', '.wk-card', '[data-wkclear]',
36
+ '#bdFind', '#roFind', '#bdFilter', '.wk-menu [data-wkf]', '.wk-menu [data-wkmore]', '.wk-menu [data-wksortp]', '.wk-menu [data-wksortx]', '.wk-menu [data-wkreset]',
37
+ // the popup of a row, read only (Part A 4): its close and its edge, Details, a stage's fold, the done and far folds
38
+ '.cz-pop [data-pop="close"]', '.pw [data-pw-details]', '.pw [data-pw-fold]', '.pw [data-pw-more]', '.pw [data-pw-grip]', '.pw [data-pw-done]', '.pw [data-pw-far]', '.pw [data-pw-tl]', '.pw [data-pw-span]', '.hi-pop [data-sp]',
33
39
  ].join(',');
34
40
 
35
41
  /** The Board's static toolbar and chips: hidden, so the page's own script keeps the elements it holds. */
36
- const HIDE = ['#crumbHost', '#bdFind', '#bdFilter', '#bdPublish', '#newIni', '.tools-top', '#czFab'];
42
+ const HIDE = ['#crumbHost', '#bdPublish', '#newIni', '.tools-top', '#czFab'];
43
+ /** Find and the tune button: a copy's own search and filter on Work (shared-copy brief Part A 3); the other views have no use for them. */
44
+ const WORK_ONLY = ['#bdFind', '#bdFilter'];
37
45
  /** Controls the code draws that write, or lead to something a share does not hold: removed. */
38
46
  const REMOVE = [
39
47
  '.po-grip', '.bd-nxa',
@@ -70,7 +78,7 @@ export function sanitize(root) {
70
78
  for (const sel of WITH_BODY) for (const e of all(sel)) { const b = e.nextElementSibling; if (b && b.tagName === 'DIV' && !/\biv-fr\b/.test(b.className)) b.remove(); e.remove(); }
71
79
  for (const sel of REMOVE) for (const e of all(sel)) e.remove();
72
80
  for (const sel of PLAIN) for (const e of all(sel)) plain(e);
73
- for (const f of all('input, textarea, select')) f.disabled = true;
81
+ for (const f of all('input, textarea, select')) if (f.id !== 'roFind') f.disabled = true; // the copy's own find field writes nothing
74
82
  for (const e of all('[contenteditable]')) e.removeAttribute('contenteditable');
75
83
  }
76
84
 
@@ -84,7 +92,6 @@ function refuse(e) {
84
92
  }
85
93
 
86
94
  const esc = (t) => String(t == null ? '' : t).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
87
- const KIND = { product: 'Product', program: 'Program', initiative: 'Initiative', multi: 'Selection' };
88
95
 
89
96
  /** Where the workspace runs on a viewer's own computer (its default address): Open in my PMOS goes there with the link, never the password. */
90
97
  export const MY_PMOS = 'http://127.0.0.1:7433/premium-board';
@@ -119,12 +126,43 @@ export function waysHtml(link) {
119
126
  + '<a class="ro-way" href="' + GET_PMOS + '" target="_blank" rel="noopener" aria-label="Get PMOS" title="Get PMOS for yourself">' + GET + '</a>';
120
127
  }
121
128
 
122
- /** The one line that says what this copy is, the way back to the team's hub (R8), and back to PMOS; then the tabs when the link holds several. */
129
+ /** A product's display name: "IDPF", never the folder's "pmos-idpf" (shared-copy brief Part A 2). A short name reads as letters. */
130
+ export function displayName(s) {
131
+ const t = String(s || '').trim().replace(/^pmos[-_ ]/i, '');
132
+ if (!t) return '';
133
+ if (/^[a-z0-9]{2,4}$/.test(t)) return t.toUpperCase();
134
+ return /^[a-z]/.test(t) ? t.charAt(0).toUpperCase() + t.slice(1).replace(/[-_]+/g, ' ') : t;
135
+ }
136
+ /** Who shared it: the first name only, never an email or an account name with no space that looks like one (Part B d). */
137
+ export function firstName(by) {
138
+ const w = String(by || '').trim().split(/\s+/)[0] || '';
139
+ return !w || /@/.test(w) || /^[a-z0-9._-]{12,}$/.test(w) ? '' : w;
140
+ }
141
+ /** A moment in the reader's own time zone: "Thu 19 Nov, 10:09" (with the time) or "Thu 26 Nov"; a text that is not a time stays as it is. */
142
+ export function whenText(v, withTime, tz) {
143
+ const t = Date.parse(String(v || ''));
144
+ if (!/^\d{4}-\d{2}-\d{2}T/.test(String(v || '')) || !Number.isFinite(t)) return String(v || '');
145
+ const d = new Date(t), o = tz ? { timeZone: tz } : {};
146
+ const day = d.toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short', ...o }).replace(',', '');
147
+ return withTime ? day + ', ' + d.toLocaleTimeString('en-GB', { hour: '2-digit', minute: '2-digit', hour12: false, ...o }) : day;
148
+ }
149
+ /** The line's words after the pill: "Shared by Wawan · as of Thu 19 Nov, 10:09 · this link ends Thu 26 Nov". A part with nothing says nothing. */
150
+ export function lineText(pack, tz) {
151
+ const by = firstName(pack && pack.by), at = whenText(pack && pack.at, true, tz), ends = whenText(pack && pack.ends, false, tz);
152
+ return [by ? 'Shared by ' + by : '', at ? 'as of ' + at : '', ends ? 'this link ends ' + ends : ''].filter(Boolean).join(' · ');
153
+ }
154
+ const EYE = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12z"/><circle cx="12" cy="12" r="2.6"/></svg>';
155
+ /** The one line that says what this copy is (board RoWork): the product's name, a "Read-only copy" pill, who shared it and when, when the link
156
+ * ends, and Open in my PMOS; the way back to the team's hub (R8) before the name when there is one. Then the tabs when the link holds several. */
123
157
  function banner() {
124
158
  const main = document.getElementById('stage'); if (!main || !PACK || document.querySelector('.ro-by')) return;
125
- const s = PACK.scope || {}; const d = document.createElement('div'); d.className = 'ro-by';
126
- d.innerHTML = '<span class="ro-txt">' + (PACK.hub ? '<a class="ro-back" href="' + esc(PACK.hub) + '">← Shared boards</a> · ' : '') + '<b>' + esc(s.label) + '</b> · ' + esc(KIND[s.kind] || '') + ' · a read-only copy of ' + esc(PACK.at)
127
- + ' · shared by ' + esc(PACK.by) + ' · the link ends ' + esc(PACK.ends) + '</span><span class="ro-ways">' + waysHtml(linkOf(location)) + '</span>';
159
+ const s = PACK.scope || {}; const d = document.createElement('div'); d.className = 'ro-by ro-line';
160
+ const link = linkOf(location), name = s.kind === 'product' ? displayName(s.label) : String(s.label || '');
161
+ d.innerHTML = (PACK.hub ? '<a class="ro-back" href="' + esc(PACK.hub) + '">← Shared boards</a>' : '')
162
+ + '<b class="ro-name">' + esc(name) + '</b><span class="ro-pill">' + EYE + 'Read-only copy</span><span class="ro-txt">' + esc(lineText(PACK)) + '</span>'
163
+ // find and tune sit on this line on Work (design check, 2026-11-19): start() moves the two buttons in; Get PMOS is a quiet text link
164
+ + '<span class="ro-tools"></span><a class="ro-way ro-get" href="' + GET_PMOS + '" target="_blank" rel="noopener">Get PMOS</a>'
165
+ + (link ? '<a class="ro-way ro-open" href="' + esc(MY_PMOS + '?shared=' + encodeURIComponent(link)) + '" target="_blank" rel="noopener noreferrer">Open in my PMOS</a>' : '');
128
166
  main.insertBefore(d, main.firstChild);
129
167
  const tabs = tabsHtml(PACK, location);
130
168
  if (tabs) d.insertAdjacentHTML('afterend', tabs);
@@ -153,12 +191,18 @@ function start() {
153
191
  for (const sel of HIDE) for (const e of document.querySelectorAll(sel)) e.hidden = true;
154
192
  banner(); sanitize(document.body);
155
193
  const pending = new Set(); let queued = false;
156
- const flush = () => { queued = false; for (const n of pending) if (n.isConnected) sanitize(n); pending.clear(); document.body.classList.toggle('ro-vw', !!document.querySelector('#czViewer:not([hidden]) .iv-ws, #czViewer:not([hidden]) .iv-gx-t, #czViewer:not([hidden]) .iv-ab-h')); };
194
+ const work = () => {
195
+ const on = document.body.classList.contains('wk-on'); for (const e of document.querySelectorAll(WORK_ONLY.join(','))) if (e.hidden === on) e.hidden = !on;
196
+ const dock = document.querySelector('.ro-line .ro-tools'); // the buttons keep their own listeners when they move
197
+ if (on && dock) for (const id of ['bdFind', 'bdFilter']) { const b = document.getElementById(id); if (b && b.parentNode !== dock) dock.appendChild(b); }
198
+ };
199
+ work();
200
+ const flush = () => { queued = false; work(); for (const n of pending) if (n.isConnected) sanitize(n); pending.clear(); document.body.classList.toggle('ro-vw', !!document.querySelector('#czViewer:not([hidden]) .iv-ws, #czViewer:not([hidden]) .iv-gx-t, #czViewer:not([hidden]) .iv-ab-h, #czViewer:not([hidden]) .iv-mc')); /* .iv-mc: the mission card, shut or open */ };
157
201
  new MutationObserver((muts) => {
158
202
  for (const m of muts) for (const n of m.addedNodes) if (n.nodeType === 1) pending.add(n);
159
203
  for (const e of document.querySelectorAll(HIDE.join(','))) if (!e.hidden) e.hidden = true;
160
204
  if (!queued) { queued = true; queueMicrotask(flush); }
161
- }).observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['hidden'] });
205
+ }).observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['hidden', 'class'] });
162
206
  }
163
207
 
164
208
  if (RO) {