create-pmos 0.832.0 → 0.833.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.
@@ -0,0 +1,77 @@
1
+ 'use strict';
2
+ /* work-kr.js — each initiative on Work names its key result, and the Strategy card names its period (job tb-work-kr; board TbWork on
3
+ * Exploring 3, page balanced, Wawan "build" 2026-11-25). It reads the OKR files only (lib/okr-goals.js); it writes nothing.
4
+ *
5
+ * periodHead(period, now) → { label, months, ends, left, text } | null PURE: "H2 2026 · Jul–Dec · ends 31 Dec · 5 weeks left"
6
+ * servesOf(objectives) → [{ token, title, krs: [{ token, title }] }] PURE: the objectives and key results, in the file's order
7
+ * krOf(anchor, objectives) → { token, title, objective: { token, title } } | null PURE: the key result a parent_kr names, else null
8
+ * forRoot(root, now) → { period, serves, objectives } the OKR files of a workspace, read once (nothing when none)
9
+ * count(rows) → { named, live, pct } PURE: live line rows that name a key result
10
+ *
11
+ * node lib/work-kr.js count [--root <dir>] the health number: the percent of live initiatives on the line that name a key result (last line)
12
+ *
13
+ * NOTHING IS GUESSED. A key result shows only when the anchor names one the OKR file declares (okr-goals matchAnchor); a health budget,
14
+ * a domain, an unknown id or no anchor shows nothing. A period shows only when an OKR file names one. Strategy lines get no per-line tag. */
15
+ const OG = require('./okr-goals.js');
16
+
17
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
18
+ const DAY = 864e5;
19
+
20
+ function periodHead(period, now = Date.now()) {
21
+ if (!period || !period.label || !(period.from > 0) || !(period.to > 0)) return null;
22
+ const a = new Date(period.from), b = new Date(period.to);
23
+ const months = MON[a.getUTCMonth()] + (a.getUTCFullYear() !== b.getUTCFullYear() ? ' ' + a.getUTCFullYear() : '') + '–' + MON[b.getUTCMonth()];
24
+ const endDay = b.getUTCDate() + ' ' + MON[b.getUTCMonth()];
25
+ const toEnd = period.to + DAY - now; // the period ends at the end of its last day
26
+ let ends, left = null;
27
+ if (toEnd <= 0) ends = 'ended ' + endDay;
28
+ else {
29
+ const w = Math.floor(toEnd / (7 * DAY));
30
+ if (w < 1) ends = 'ends this week';
31
+ else { ends = 'ends ' + endDay; left = w + (w === 1 ? ' week left' : ' weeks left'); }
32
+ }
33
+ return { label: period.label, months, ends, left, text: [period.label, months, ends, left].filter(Boolean).join(' · ') };
34
+ }
35
+
36
+ function servesOf(objectives) {
37
+ return (objectives || []).filter((o) => o && (o.krs || []).length).map((o) => ({
38
+ token: String(o.token || ''), title: String(o.title || ''),
39
+ krs: o.krs.map((k) => ({ token: String(k.token || ''), title: String(k.title || '') })),
40
+ }));
41
+ }
42
+
43
+ function krOf(anchor, objectives) {
44
+ const s = String(anchor || '').trim();
45
+ if (!s) return null;
46
+ let hit = null;
47
+ try { hit = OG.matchAnchor(s, objectives || []); } catch { hit = null; }
48
+ if (!hit || !hit.k) return null;
49
+ return { token: String(hit.k.token || ''), title: String(hit.k.title || ''), objective: { token: String(hit.o.token || ''), title: String(hit.o.title || '') } };
50
+ }
51
+
52
+ function forRoot(root, now = Date.now()) {
53
+ let r = null;
54
+ try { r = OG.read(root); } catch { r = null; }
55
+ if (!r || !r.ok) return { period: null, serves: [], objectives: [] };
56
+ return { period: periodHead(r.period, now), serves: servesOf(r.objectives), objectives: r.objectives || [] };
57
+ }
58
+
59
+ function count(rows) {
60
+ const live = (rows || []).filter((r) => r && r.live);
61
+ const named = live.filter((r) => r.kr && r.kr.token).length;
62
+ return { named, live: live.length, pct: live.length ? Math.round((named / live.length) * 100) : 0 };
63
+ }
64
+
65
+ module.exports = { periodHead, servesOf, krOf, forRoot, count };
66
+
67
+ if (require.main === module) {
68
+ const cmd = process.argv[2];
69
+ if (cmd !== 'count') { console.error('usage: node lib/work-kr.js count [--root <dir>] (the percent of live initiatives on the line that name a key result)'); process.exit(2); }
70
+ const i = process.argv.indexOf('--root');
71
+ const root = i > 0 && process.argv[i + 1] ? require('path').resolve(process.argv[i + 1]) : require('path').resolve(__dirname, '..', '..');
72
+ const L = require('./line.js').lineOf(root);
73
+ if (!L.ok) { console.error('[work-kr] the line could not be read: ' + (L.error || 'no reason given')); process.exit(1); }
74
+ const c = count(L.rows);
75
+ console.log(`[work-kr] ${c.named} of ${c.live} live initiatives on the line name a key result`);
76
+ console.log(String(c.pct));
77
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.832.0",
3
+ "version": "0.833.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.832.0",
9
+ "version": "0.833.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.832.0",
3
+ "version": "0.833.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -271,6 +271,9 @@ textarea.bk-rvl-ed, .bk-rvl textarea.bd { resize: vertical; min-height: 180px; }
271
271
  .pm-ds .ln-name { all: unset; cursor: pointer; font-weight: var(--fw-strong); color: var(--ink); line-height: 1.4; overflow-wrap: anywhere; }
272
272
  .pm-ds .ln-name:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
273
273
  .pm-ds .ln-name:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }
274
+ .pm-ds .ln-kr { display: flex; width: fit-content; margin-top: 4px; height: 22px; font-size: var(--fs-meta); color: var(--muted); text-decoration: none; } /* tb-work-kr: the key result under the name */
275
+ .pm-ds .ln-kr:hover { color: var(--blue); }
276
+ .pm-ds .ln-kr:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
274
277
  .pm-ds .ln-c-days .ln-d { display: block; color: var(--ink); white-space: nowrap; }
275
278
  .pm-ds .ln-c-days .ln-sub { display: block; font-size: var(--fs-meta); line-height: 18px; color: var(--muted); }
276
279
  .pm-ds .ln-c-days.ln-over .ln-d, .pm-ds .ln-c-days.ln-over .ln-sub { color: var(--alert); }
@@ -278,6 +281,14 @@ textarea.bk-rvl-ed, .bk-rvl textarea.bd { resize: vertical; min-height: 180px; }
278
281
  .pm-ds .ln-c-fin { color: var(--ink); line-height: 1.4; }
279
282
  .pm-ds .ln-t .pm-badge.ln-ok { background: var(--leaf-tint); color: var(--leaf); }
280
283
  .pm-ds .ln-t .pm-badge.ln-late { background: none; box-shadow: inset 0 0 0 1px var(--alert); color: var(--alert); }
284
+ /* tb-work-kr (board TbWork): the Strategy card's Serves row, each objective with its key results as chips */
285
+ .pm-ds .bd-serves { padding: 0 var(--space-16) var(--space-12); }
286
+ .pm-ds .bd-serves > .pm-meta { margin: 0 0 4px; }
287
+ .pm-ds .bd-serves ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
288
+ .pm-ds .bd-serves-o { display: flex; flex-direction: column; gap: 4px; }
289
+ .pm-ds .bd-serves-o .t { font-weight: var(--fw-strong); overflow-wrap: anywhere; }
290
+ .pm-ds .bd-serves-k { display: flex; flex-wrap: wrap; gap: 4px; }
291
+ .pm-ds .bd-serves-k .pm-chip { height: auto; min-height: 22px; white-space: normal; overflow-wrap: anywhere; }
281
292
 
282
293
  /* ── Work › Factory (factory-page-ui; boards FxFloor and FxStation on the main canvas) ── pm/factory.js draws it. Komorebi tokens only.
283
294
  * Every class starts with ff- (the page) or fx- (the station popup). Zero is silence: a quiet station is grey and has no numbers. */
@@ -44,6 +44,7 @@ import { sigListHtml } from './bd-views.js'; // the customer signals behind th
44
44
  import * as PW from './cozy-pop-work.js'; // what the popup shows for work (slice 3 of the six-place navigation): in the popup, in place of the old page
45
45
  import * as PP from './ini-props.js'; // everything PMOS suggests, as a drill-in (the popup's ⋯)
46
46
  import { stageName } from './stage-chip.js';
47
+ import * as MS from './ms-strip.js'; // Next milestones on the product and initiative pages (job #2020, Wawan 2026-11-25 13:02Z)
47
48
  import { iniMore as iniMoreOf, iniText, stagePick, deleteSaid, DELETE_MS } from './ini-more.js'; // the one initiative ⋯ menu and stage picker (batch 14 item 5, batch 16 item 5c)
48
49
 
49
50
  let O = null;
@@ -191,13 +192,15 @@ function dashFor(r) {
191
192
  function iniBody(r, body) {
192
193
  const h = dashFor(r);
193
194
  if (h && h.shows()) return h.html(() => '');
194
- if (PW.on(body)) return PW.html(r, viewOf(r), popOpts(r)) + sigListHtml(r);
195
+ // Next milestones for this initiative (job #2020), above its Work breakdown
196
+ const strip = MS.stripHtml([r], 'ini:' + r.key, { sub: 'this initiative', one: true, lw: MS.lineWidth(body), ro: !!window.PMOS_READONLY });
197
+ if (PW.on(body)) return MS.insertStrip(PW.html(r, viewOf(r), popOpts(r)) + sigListHtml(r), strip);
195
198
  const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10) + (+v.slice(0, 4) !== new Date().getFullYear() ? ' ’' + v.slice(2, 4) : '');
196
199
  const self = !!((O.M() || {}).board || {}).self, M = O.M() || {};
197
200
  // what left the ⋯ for the thing it changes (batch 16 item 5c): the workflow chip, the dashed +, the stage chip, the dates chip, Jira's ↻
198
201
  // the same parts and presses as Home's page (UI grill U1): the next stage is a press, Core documents a fold, the tail under Linked
199
202
  const v = viewOf(r), docs = ((r.id && PAGE.get(r.id)) || {}).docs || [];
200
- return viewHtml(v, { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold,
203
+ return strip + viewHtml(v, { add: !!(r.id && O.addTask), adding: adding === r.key, addHint: adding === r.key && addDates ? md(addDates.start) + ' to ' + md(addDates.due) : '', openTask: !!O.openTask, quick: !!(O.setTask && O.setDates), hold: !!O.hold,
201
204
  next: !!(r.id && v.stage.next && O.moreAct && !self && !window.PMOS_READONLY), docs: docs.length ? { n: docs.length } : null, tail: TL.tailHtml(r, { VW, today: M.today }) + sigListHtml(r),
202
205
  wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira });
203
206
  }
@@ -224,9 +227,11 @@ function popExtra(r) {
224
227
  }
225
228
  /** The product one level up, in the same popup (board 27): its programs, then the initiatives in no program, with the timeline. A row goes one
226
229
  * level down. Read from the Board's own model, so nothing new is fetched. */
230
+ /** The Board's rows of a product's initiatives. */
231
+ function productRows(ws) { const M = O.M() || {}, B = M.board || {}; return (M.rows || []).filter((x) => x.id && !x.archived && (x.ws || B.ws || '') === ws); }
227
232
  function productOf(ws) {
228
233
  const M = O.M() || {}, B = M.board || {}, today = M.today;
229
- const all = (M.rows || []).filter((x) => x.id && !x.archived && (x.ws || B.ws || '') === ws); // the board's own row (no id) is not work
234
+ const all = productRows(ws); // the board's own row (no id) is not work
230
235
  const progs = new Map(), loose = [];
231
236
  for (const x of all) { const p = O.programOf ? O.programOf(x) : null; if (p) { if (!progs.has(p.id)) progs.set(p.id, { p, rows: [] }); progs.get(p.id).rows.push(x); } else loose.push(x); }
232
237
  const lo = (rs) => rs.map((x) => String(x.start || '').slice(0, 10)).filter(Boolean).sort()[0] || '';
@@ -247,12 +252,16 @@ function openProduct(r) {
247
252
  const M = O.M() || {}, ws = r.ws || (M.board || {}).ws || '';
248
253
  const L0 = productOf(ws);
249
254
  VW.drill();
255
+ // the product's Next milestones (job #2020): its own initiatives, its own window
256
+ const page = (body, L) => MS.insertStrip(PW.levelHtml(L, { today: L.today, add: false }), MS.stripHtml(productRows(ws), 'product:' + ws, { sub: 'this product', lw: MS.lineWidth(body), ro: !!window.PMOS_READONLY }));
250
257
  VW.open({ kind: 'Product', title: L0.title, icon: 'goal', id: 'product:' + ws, back: true,
251
258
  render: (body) => {
252
259
  const L = productOf(ws);
253
- body.innerHTML = PW.levelHtml(L, { today: L.today, add: false });
260
+ body.innerHTML = page(body, L);
261
+ const redraw = () => { const t = body.scrollTop, L2 = productOf(ws); body.innerHTML = page(body, L2); body.scrollTop = t; };
262
+ MS.wireStrip(body, redraw);
254
263
  PW.wireLevel(body, {
255
- redraw: () => { const t = body.scrollTop, L2 = productOf(ws); body.innerHTML = PW.levelHtml(L2, { today: L2.today, add: false }); body.scrollTop = t; },
264
+ redraw,
256
265
  go: (kind, id, b) => { if (kind === 'program' && O.openProgram) { VW.drill(); O.openProgram(id, b); } else if (kind === 'ini' && O.openIniId) { const x = O.rowOf(id); VW.drill(); if (x && x.id) O.openIniId(x.id); } },
257
266
  }, () => productOf(ws));
258
267
  } });
@@ -305,6 +314,7 @@ function wire(body, key) {
305
314
  doc: (path) => O.viewDoc(path, (O.rowOf(key) || {}).ws), // the initiative's own workspace, not the board's (round 3 point 17)
306
315
  redraw,
307
316
  };
317
+ MS.wireStrip(body, redraw); // the Next milestones strip's +N, Fit, wheel and drag (job #2020)
308
318
  // in the popup: what the popup shows for work (pm/cozy-pop-work.js), with the same handlers; else the old page
309
319
  if (PW.on(body)) {
310
320
  PW.wire(body, { ...H, ...popExtra(O.rowOf(key)) }, { r: () => O.rowOf(key), v: () => { const r = O.rowOf(key); return r ? viewOf(r) : null; }, o: () => { const r = O.rowOf(key); return r ? popOpts(r) : {}; } });
@@ -27,14 +27,16 @@ const kindWord = (l) => (l.kind === 'positioning' ? 'Positioning' : 'Message');
27
27
 
28
28
  /** The part's markup. state = { kept, draft, busy, left, open }. Pure, so the test reads it.
29
29
  * Collapsed (the default): the positioning statement only, and a fold "N key messages" (bdPosMore) that opens the rest. Where a line comes
30
- * from sits in its tooltip, not under it, so the part stays short; a line whose strategy changed still says so. */
30
+ * from sits in its tooltip, not under it, so the part stays short; a line whose strategy changed still says so. state.period (the strategy's
31
+ * OKR period, lib/work-kr.js) puts its label beside the title, "Positioning · H2 2026" (tb-work-kr). */
31
32
  export function partHtml(state) {
32
33
  const kept = Array.isArray(state.kept) ? state.kept : [];
33
34
  const d = state.draft && state.draft.state === 'ready' ? state.draft : null;
34
35
  const pending = state.busy || (state.draft && state.draft.state === 'pending');
35
36
  const keptIds = new Set(kept.map((l) => l.id));
36
37
  const fresh = d ? d.lines.filter((l) => !keptIds.has(l.id) && !(state.left || []).includes(l.id)) : [];
37
- const head = `<div class="head"><h4 class="pm-h-sm" style="flex:1">Positioning${kept.length || fresh.length || pending ? '' : ' <span class="pm-meta">· not drafted yet</span>'}${pending ? ' <span class="pm-meta">· drafting…</span>' : ''}</h4>`
38
+ const per = state.period && state.period.label ? ` <span class="pm-meta" data-pos-period>· ${esc(state.period.label)}</span>` : ''; // tb-work-kr: the period it is for
39
+ const head = `<div class="head"><h4 class="pm-h-sm" style="flex:1">Positioning${per}${kept.length || fresh.length || pending ? '' : ' <span class="pm-meta">· not drafted yet</span>'}${pending ? ' <span class="pm-meta">· drafting…</span>' : ''}</h4>`
38
40
  + (pending ? '' : btn('bdPosDraft', kept.length || d ? I.again : I.spark, kept.length || d ? 'Draft again from the strategy' : 'Draft positioning from the strategy')) + '</div>';
39
41
  const tip = (l) => ` title="${esc(kindWord(l) + ' · ' + fromLine(l))}"`;
40
42
  const keptRow = (l) => `<div class="pm-li" role="listitem" data-pos="${esc(l.id)}"${tip(l)}><span class="txt"><span class="t">${esc(l.text)}</span>${l.stale ? '<span class="w">The strategy changed since you kept this</span>' : ''}</span>${btn('bdPosDrop', I.x, 'Drop this line', 'outline', ` data-id="${esc(l.id)}"`)}</div>`;
@@ -52,12 +54,12 @@ export function partHtml(state) {
52
54
  /** Draw the part into `host` and wire its presses. */
53
55
  export async function mount(host, opts = {}) {
54
56
  if (!host) return;
55
- const { ws = null, say = null } = opts;
57
+ const { ws = null, say = null, period = null } = opts;
56
58
  const q = ws ? '?ws=' + encodeURIComponent(ws) : '';
57
59
  const get = async () => { try { return await (await fetch(API + q, { credentials: 'same-origin' })).json(); } catch { return null; } };
58
60
  const r = await get();
59
61
  if (!r || !r.ok || !r.complete) { host.hidden = true; host.innerHTML = ''; return; } // an extra: no strategy, no part
60
- const S = { kept: r.kept, draft: r.draft, busy: false, left: [], open: host.dataset.open === '1' };
62
+ const S = { kept: r.kept, draft: r.draft, busy: false, left: [], open: host.dataset.open === '1', period };
61
63
  const draw = () => { host.hidden = false; host.innerHTML = partHtml(S); };
62
64
  let tries = 0;
63
65
  const poll = async () => {
@@ -41,6 +41,7 @@ import * as MD from './metric-drafts.js'; // the goal Claude drafts when the c
41
41
  import * as DB from './dash-view.js'; // the page model's parts: the reports and the proposals (batch 17 item 1)
42
42
  import { stageName } from './stage-chip.js'; // W1: the one stage
43
43
  import * as PV from './prog-page.js';
44
+ import * as MS from './ms-strip.js'; // Next milestones on the program page (job #2020, Wawan 2026-11-25 13:02Z)
44
45
  import * as PW from './cozy-pop-work.js'; // in the popup: the program one level up, the same three parts as an initiative (slice 3, board 26) // the one program page: the top and four tabs (batch 21 item 2, canvas RdProgL–RdProgP)
45
46
 
46
47
  const SV = (d, w) => `<svg viewBox="0 0 24 24" width="${w || 18}" height="${w || 18}" aria-hidden="true"><path d="${d}"/></svg>`;
@@ -414,11 +415,11 @@ function draw(keepFocus) {
414
415
  const p = progOf(cur.id); if (!p) { VW.close(); return; }
415
416
  readAway(p); readMore(p); readDrafts(p);
416
417
  const b = VW.body(); if (!b) return;
417
- if (PW.inPop(b)) { const t = b.scrollTop, L = levelOf(cur.id); if (L) { b.innerHTML = PW.levelHtml(L, { today: L.today, add: false }); b.scrollTop = t; } return; } // the program in the popup (board 26)
418
+ if (PW.inPop(b)) { const t = b.scrollTop, L = levelOf(cur.id); if (L) { b.innerHTML = levelPage(b, cur.id, L); b.scrollTop = t; } return; } // the program in the popup (board 26)
418
419
  const f = keepFocus && document.activeElement && b.contains(document.activeElement) ? document.activeElement : null;
419
420
  const sel = f ? (f.dataset.pp ? `[data-pp="${f.dataset.pp}"]` + (f.dataset.fold ? `[data-fold="${CSS.escape(f.dataset.fold)}"]` : '') + (f.dataset.key ? `[data-key="${CSS.escape(f.dataset.key)}"]` : '') + (f.dataset.ms ? `[data-ms="${CSS.escape(f.dataset.ms)}"]` : '') : f.dataset.czsFold ? `[data-czs-fold="${CSS.escape(f.dataset.czsFold)}"]` : null) : null;
420
421
  const top = b.scrollTop;
421
- b.innerHTML = viewHtml(p);
422
+ b.innerHTML = progStrip(b, p.id) + viewHtml(p);
422
423
  b.scrollTop = top;
423
424
  const again = sel && b.querySelector(sel); if (again) again.focus();
424
425
  }
@@ -513,12 +514,21 @@ function levelOf(id) {
513
514
  const doneWhen = lastMs ? lastMs.name.replace(/\.$/, '') + (by ? ', by ' + by : '') + '.' : by ? 'Its initiatives are delivered by ' + by + '.' : '';
514
515
  return { kind: 'program', id: p.id, title: p.title, summary: said, why: p.why || '', goal: p.goal || '', done: doneWhen, facts, rows, docs, today };
515
516
  }
517
+ /** The program's Next milestones (job #2020): the Board's rows of its initiatives, its own window. */
518
+ function progStrip(body, id) {
519
+ const p = progOf(id); if (!p) return '';
520
+ const rows = programState(p, rowsOf).inis.map((i) => i.row).filter(Boolean);
521
+ return MS.stripHtml(rows, 'program:' + id, { sub: 'this program', lw: MS.lineWidth(body), ro: !!window.PMOS_READONLY });
522
+ }
523
+ const levelPage = (body, id, L) => MS.insertStrip(PW.levelHtml(L, { today: L.today, add: false }), progStrip(body, id));
516
524
  function levelDraw(body, id, from) {
517
525
  cur = { id, from: from || (cur && cur.id === id && cur.from) || null };
518
526
  const L = levelOf(id); if (!L) { body.innerHTML = ''; return; }
519
- body.innerHTML = PW.levelHtml(L, { today: L.today, add: false });
527
+ body.innerHTML = levelPage(body, id, L);
528
+ const redraw = () => { const t = body.scrollTop; const L2 = levelOf(id); if (L2) { body.innerHTML = levelPage(body, id, L2); body.scrollTop = t; } };
529
+ MS.wireStrip(body, redraw);
520
530
  PW.wireLevel(body, {
521
- redraw: () => { const t = body.scrollTop; const L2 = levelOf(id); if (L2) { body.innerHTML = PW.levelHtml(L2, { today: L2.today, add: false }); body.scrollTop = t; } },
531
+ redraw,
522
532
  go: (kind, iid) => { if (kind === 'ini') { VW.drill(); O.openIni(iid, null); } },
523
533
  doc: (path) => { const a = document.createElement('button'); a.dataset.doc = path; a.hidden = true; document.body.appendChild(a); a.click(); a.remove(); },
524
534
  art: (a) => { if (!a || !a.charter) return false; const q = progOf(id); if (q) openCharter(q); return true; },
@@ -535,7 +545,8 @@ function oldDraw(body, id, from) {
535
545
  {
536
546
  cur = { id, from: from && !(VW.body() && VW.body().contains(from)) ? from : (cur && cur.id === id && cur.from) || null };
537
547
  body.classList.add('pp-vw');
538
- const q = progOf(id); if (q) { readAway(q); readMore(q); readDrafts(q); body.innerHTML = viewHtml(q); }
548
+ const q = progOf(id); if (q) { readAway(q); readMore(q); readDrafts(q); body.innerHTML = progStrip(body, id) + viewHtml(q); }
549
+ MS.wireStrip(body, () => draw(true));
539
550
  PV.wirePage(body, { redraw: () => draw(true) }); // the tabs and the proposals fold (pm/prog-page.js)
540
551
  { // the reports' and the goals' presses (pm/dash-view.js: listeners once per body, this page's h each time)
541
552
  DB.wireDash(body, { d: () => cur && dashOf(cur.id).d, get open() { return cur ? dashOf(cur.id).open : new Set(); }, ws: (progOf(id) || {}).home || board().ws || '', board: board().id || '',
@@ -13,6 +13,8 @@
13
13
  * · The pencil turns the lines into inputs; the tick (or Enter) saves, Esc puts them back. A save offers Undo in the Board's toast.
14
14
  * · Once all five are written, the Positioning part (pm/bd-positioning.js, idea A328) sits under the lines: positioning and key
15
15
  * messages drafted from them, each citing its line, kept or edited by the PM.
16
+ * · The OKR period beside the title and a Serves row under the head: the objectives and key results of the product's OKR file
17
+ * (tb-work-kr, board TbWork). No OKR file, no period and no row. Positioning names the same period.
16
18
  * The controls carry ids (bdStratEdit, bdStratSave, bdStratFits) so the local use log counts their use (the bet's kill line). */
17
19
  import { pmPost } from './http.js';
18
20
  import * as POS from './bd-positioning.js';
@@ -29,6 +31,16 @@ const HINT = { for: 'The people this product serves', problem: 'What they strugg
29
31
  export const fitsLine = (n) => n + (n === 1 ? " doesn't fit" : " don't fit");
30
32
  const isEmpty = (c) => !c || FIELDS.every((k) => !String(c[k] || '').trim());
31
33
 
34
+ /** tb-work-kr (board TbWork): the OKR period the strategy is for, "H2 2026 · Jul–Dec · ends 31 Dec · 5 weeks left", beside the title, and the
35
+ * Serves row: each objective of the OKR file with its key results. Both come from GET /api/strategy-card (lib/work-kr.js); none, nothing. */
36
+ export const periodText = (state) => (state && state.period && state.period.text) || '';
37
+ export function servesHtml(state) {
38
+ const S = (state && Array.isArray(state.serves) ? state.serves : []).filter((o) => o && (o.krs || []).length);
39
+ if (!S.length) return '';
40
+ const obj = (o) => `<li class="bd-serves-o"><span class="t">${esc(o.token)}${o.title ? ' · ' + esc(o.title) : ''}</span><span class="bd-serves-k">${o.krs.map((k) => `<span class="pm-chip" title="${esc(k.token + (k.title ? ' · ' + k.title : ''))}">${esc(k.token)}${k.title ? ' ' + esc(k.title) : ''}</span>`).join('')}</span></li>`;
41
+ return `<div class="bd-serves" aria-label="Serves"><p class="pm-meta">Serves</p><ul role="list">${S.map(obj).join('')}</ul></div>`;
42
+ }
43
+
32
44
  /** The card's markup. state = { card, complete, notes, editing, open }. Pure, so the test reads it. */
33
45
  export function cardHtml(state) {
34
46
  const { card, notes, editing, open } = state;
@@ -51,7 +63,7 @@ export function cardHtml(state) {
51
63
  + (open ? `<div role="list">${notes.map((x) => `<div class="pm-li" role="listitem" data-ini="${esc(x.id)}"><span class="txt"><span class="t">${esc(x.title)}</span><span class="w">Doesn't fit the strategy because it ${esc(x.why)}</span></span></div>`).join('')}</div>` : '')
52
64
  : '';
53
65
  const pos = state.complete ? '<div id="bdPos" hidden></div>' : '';
54
- return `<section class="pm-block" aria-label="Strategy">${head('Strategy', '', undo + btn('bdStratEdit', I.pen, 'Edit the strategy'))}<dl class="pm-field" style="margin:0">${rows}</dl>${fold}${pos}</section>`;
66
+ return `<section class="pm-block" aria-label="Strategy">${head('Strategy', periodText(state), undo + btn('bdStratEdit', I.pen, 'Edit the strategy'))}${servesHtml(state)}<dl class="pm-field" style="margin:0">${rows}</dl>${fold}${pos}</section>`;
55
67
  }
56
68
 
57
69
  /** Draw the card again after a read of the Board, unless the PM is writing in it. */
@@ -70,7 +82,7 @@ export async function mount(host, opts = {}) {
70
82
  const q = (ws ? '?ws=' + encodeURIComponent(ws) : '?') + (board ? (ws ? '&' : '') + 'board=' + encodeURIComponent(board) : '');
71
83
  let r = null; try { r = await (await fetch('/api/strategy-card' + q, { credentials: 'same-origin' })).json(); } catch { r = null; }
72
84
  if (!r || !r.ok) { host.hidden = true; return; } // the card is an extra: a failed read leaves the Board as it was
73
- const S = { card: r.card, complete: r.complete, notes: r.notes, sources: r.sources || {}, drafting: !!r.drafting, editing: false, open: host.dataset.open === '1' };
85
+ const S = { card: r.card, complete: r.complete, notes: r.notes, sources: r.sources || {}, drafting: !!r.drafting, editing: false, open: host.dataset.open === '1', period: r.period || null, serves: r.serves || [] };
74
86
  // while PMOS drafts, read again now and then until the lines land (at most ~5 minutes)
75
87
  clearTimeout(host._stratPoll);
76
88
  const tries = Number(host.dataset.polls || 0);
@@ -79,7 +91,7 @@ export async function mount(host, opts = {}) {
79
91
  const draw = () => {
80
92
  host.hidden = false; host.innerHTML = cardHtml(S);
81
93
  if (S.editing) { const f = host.querySelector('[data-strat]'); if (f) f.focus(); }
82
- else if (S.complete) POS.mount(host.querySelector('#bdPos'), { ws, say });
94
+ else if (S.complete) POS.mount(host.querySelector('#bdPos'), { ws, say, period: S.period });
83
95
  };
84
96
  const save = async () => {
85
97
  const fields = {}; host.querySelectorAll('[data-strat]').forEach((el) => { fields[el.dataset.strat] = el.value; });
@@ -6,6 +6,8 @@
6
6
  * dashModel(lines) → { n, stuck, text } | null Today's dashed line under Your move ("9 more move in the line by themselves · 1 stuck")
7
7
  * dashHtml(D) → the dashed line, a link to /premium-board.html?work=line
8
8
  *
9
+ * krChip(r) → "Serves KR1.1" under a row's name when its parent_kr names a key result of the OKR file (tb-work-kr), else ''
10
+ *
9
11
  * rows: lib/line.js lineOf rows (GET /api/line), each with its product (ws). you: Set of '<ws>|<initiative>' that have a Your move row (a question
10
12
  * to the PM, a check due). A row in Your move is marked "waits on you" here and not repeated on Today. Waiting (capacity, on hold, another initiative) is never
11
13
  * stuck and reads "waiting"; a moving row past its stage's expected days reads "over time". "Can't tell" never moves an item and never raises a row. The UI says PMOS. Text from records goes through esc(). */
@@ -77,6 +79,16 @@ export function lineModel(rows, o = {}) {
77
79
  const groups = workflows.flatMap((w) => w.groups);
78
80
  return { workflows, groups, counts, tab, live: all.length };
79
81
  }
82
+ /** The key result a row serves (tb-work-kr, board TbWork): "Serves KR1.1" under the name, its words in the title; it opens the product's goals
83
+ * on Intelligence. A row with no key result (r.kr from lib/line.js, set only when its parent_kr names one in the OKR file) draws nothing. */
84
+ export const KR_HREF = '/premium-intelligence.html';
85
+ export function krChip(r) {
86
+ const k = r && r.kr;
87
+ if (!k || !k.token) return '';
88
+ const words = [k.token + (k.title ? ' · ' + k.title : ''), k.objective && k.objective.token ? k.objective.token + (k.objective.title ? ' · ' + k.objective.title : '') : ''].filter(Boolean).join(' — ');
89
+ const href = KR_HREF + (r.ws ? '?ws=' + encodeURIComponent(r.ws) : '');
90
+ return `<a class="ln-kr pm-chip" href="${esc(href)}" data-line-kr="${esc(k.token)}" title="${esc(words)}">Serves ${esc(k.token)}</a>`;
91
+ }
80
92
  /** The Line block: one Komorebi table (pm-table). M: lineModel(). o: { name: the product's name, say: a line above the table } */
81
93
  export function lineHtml(M, o = {}) {
82
94
  if (!M || !M.live) return `<section class="pm-block ln" aria-label="The line"><p class="pm-meta">No initiative is on a workflow yet, so the line is empty.</p></section>`;
@@ -85,7 +97,7 @@ export function lineHtml(M, o = {}) {
85
97
  const many = (M.workflows || []).length > 1;
86
98
  const row = (r) => {
87
99
  const d = daysOf(r), [word, cls] = STATE[r.state];
88
- return `<tr class="ln-r ln-${r.state}"><th scope="row" class="ln-c-ini"><button type="button" class="ln-name" data-line-ini="${esc(r.id)}" data-line-ws="${esc(r.ws || '')}">${esc(r.title || r.id)}</button></th>`
100
+ return `<tr class="ln-r ln-${r.state}"><th scope="row" class="ln-c-ini"><button type="button" class="ln-name" data-line-ini="${esc(r.id)}" data-line-ws="${esc(r.ws || '')}">${esc(r.title || r.id)}</button>${krChip(r)}</th>`
89
101
  + `<td class="ln-c-days${d.over && (r.state === 'late' || r.state === 'stuck') ? ' ln-over' : ''}">${d.text ? `<span class="ln-d">${esc(d.text)}</span>` : ''}${d.sub ? `<span class="ln-sub">${esc(d.sub)}</span>` : ''}</td>`
90
102
  + `<td class="ln-c-fin">${esc(toFinish(r))}</td>`
91
103
  + `<td class="ln-c-st"><span class="pm-badge${cls ? ' ' + cls : ''}" title="${esc(r.why || '')}">${esc(word)}</span></td></tr>`;
@@ -0,0 +1,137 @@
1
+ /* pm/ms-strip.js — the Next milestones date strip on the product, program and initiative pages (job #2020 milestone-strip-pages;
2
+ * Wawan 2026-11-25 13:02Z: "apply it to the product, program, and initiative page"). Work draws the same strip for all initiatives
3
+ * (pm/premium-board.js); this file gives it to a page in the popup, for that page's own initiatives, from the same parts in pm/bd-stands.js:
4
+ * nextMilestones, dlineWindow and dlineHtml. A ◇ opens the milestone through pm/bd-pin-card.js (data-ms-pick), as on Work.
5
+ *
6
+ * stripHtml(rows, scope, o) the strip, or '' when no initiative of the page has a milestone ahead (zero is silence). scope: the page's
7
+ * key ('product:<ws>', 'program:<id>', 'ini:<key>'): each page keeps its own window. o: { sub, lw, ro, now }
8
+ * wireStrip(body, redraw) once per body: +N and Fit move this page's strip only; a sideways wheel or a drag scrolls it
9
+ * insertStrip(html, strip) the page with the strip above its Work breakdown, else at its end
10
+ * lineWidth(body) the width the labels are placed for
11
+ * prefs() · setPref(k, v) the person's two choices for every page (Wawan's canvas comments, 25 Nov): folded to one line or open, and
12
+ * Timeline or List. Kept under keys that follow the person (lib/prefs-sync.js prefix 'pmos.board.').
13
+ * Folded: one line, the next milestone, its date and "N more after it". List: a table of date, milestone, initiative (on an initiative's
14
+ * page: its stage) and "in N days" or "N days late". */
15
+ import * as ST from './bd-stands.js';
16
+ import { noteUse } from './use-log.js';
17
+
18
+ const OFF = new Map(); // scope → how far the PM scrolled that page's strip, in ms (0: it fits from today)
19
+ const WIN = new Map(); // scope → the window it was last drawn with
20
+ export const FOLD_KEY = 'pmos.board.msStrip.fold', VIEW_KEY = 'pmos.board.msStrip.view';
21
+ const get = (k) => { try { return localStorage.getItem(k); } catch { return null; } };
22
+ /** The person's choices: { folded, view: 'timeline' | 'list' }. */
23
+ export const prefs = () => ({ folded: get(FOLD_KEY) === '1', view: get(VIEW_KEY) === 'list' ? 'list' : 'timeline' });
24
+ export function setPref(k, v) { try { localStorage.setItem(k, v); } catch { /* a private window keeps the choice for this page only */ } }
25
+ const SV = (d) => `<svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
26
+ const IC = { down: 'M7 10l5 5 5-5', up: 'M7 14l5-5 5 5', list: 'M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01', line: 'M3 12h18M7 8v8M12 6v12M17 9v6' };
27
+ const DAY = 864e5;
28
+ const inDays = (d, t) => { const n = Math.round((d - t) / DAY); return n === 0 ? 'today' : n > 0 ? 'in ' + n + (n === 1 ? ' day' : ' days') : -n + (n === -1 ? ' day' : ' days') + ' late'; };
29
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
30
+
31
+ /** The width the labels are placed for: the body's, less the strip's padding. */
32
+ export const lineWidth = (body) => Math.max(320, ((body && body.clientWidth) || 720) - 90);
33
+
34
+ /** The fold and the Timeline or List press, in the strip's head. */
35
+ function toolsHtml(P) {
36
+ return `<button type="button" class="pm-btn ghost" data-ms-view="${P.view === 'list' ? 'timeline' : 'list'}" aria-label="${P.view === 'list' ? 'Show as a timeline' : 'Show as a list'}" title="${P.view === 'list' ? 'Show as a timeline' : 'Show as a list'}">${SV(P.view === 'list' ? IC.line : IC.list)}</button>`
37
+ + `<button type="button" class="pm-btn ghost" data-ms-fold="${P.folded ? 'open' : 'fold'}" aria-expanded="${P.folded ? 'false' : 'true'}" aria-label="${P.folded ? 'Open the strip' : 'Fold to one line'}" title="${P.folded ? 'Open the strip' : 'Fold to one line'}">${SV(P.folded ? IC.down : IC.up)}</button>`;
38
+ }
39
+ const headHtml = (o, P, extra = '') => `<div class="head"><h2 class="pm-h">Next milestones</h2>${o.sub ? `<span class="pm-meta">${esc(o.sub)}</span>` : ''}<span class="sp"></span>${extra}${toolsHtml(P)}</div>`;
40
+ const dia = (x, o, now) => { const say = (x.m.name || 'Milestone') + ', ' + ST.dm(x.d, now) + ', ' + x.r.title + (x.late ? ', late' : '');
41
+ return o.ro ? `<span class="pm-dia${x.late ? ' late' : ''}" role="img" aria-label="${esc(say)}"></span>`
42
+ : `<button type="button" class="pm-dia${x.late ? ' late' : ''}" data-ms-pick="${esc(x.r.key)}" data-ms-id="${esc(x.m.id || '')}" aria-label="${esc(say)}" title="${esc(say)}"></button>`; };
43
+ /** The stage a milestone sits in, by its section key and the initiative's workflow. */
44
+ const stageOf = (x) => { const s = ((x.r && x.r.wfStages) || []).find((y) => y.key === x.m.sec); return s ? s.name : x.m.sec || ''; };
45
+
46
+ /** The page's strip. rows: the Board's rows of the page's initiatives. o: { sub, lw, ro, now, one: the page is one initiative (List names
47
+ * the stage), folded, view (the person's choices, else prefs()) } */
48
+ export function stripHtml(rows, scope, o = {}) {
49
+ const now = o.now || new Date(), NM = ST.nextMilestones(rows || [], now);
50
+ if (!NM.length) return '';
51
+ const p = prefs(), P = { folded: o.folded != null ? !!o.folded : p.folded, view: o.view || p.view }, t = ST.day(now);
52
+ const wrap = (inner) => `<div class="ms-strip" data-ms-scope="${esc(scope)}">${inner}</div>`;
53
+ if (P.folded) {
54
+ const ahead = NM.filter((x) => !x.late), x = ahead[0] || NM[0], after = NM.length - NM.indexOf(x) - 1;
55
+ const line = `${dia(x, o, now)}<b>${esc(x.m.name || 'Milestone')}</b><span class="code">${esc(ST.dm(x.d, now))}</span>`
56
+ + (x.late ? `<span class="pm-badge alert">${esc(inDays(x.d, t))}</span>` : '') + (after > 0 ? `<span class="pm-meta">${after} more after it</span>` : '');
57
+ return wrap(`<section class="pm-block wk-next ms-folded" aria-label="Next milestones">${headHtml(o, P)}<p class="pm-row ms-one">${line}</p></section>`);
58
+ }
59
+ if (P.view === 'list') {
60
+ const col = o.one ? 'Stage' : 'Initiative';
61
+ const tr = NM.slice(0, 20).map((x) => `<tr><td class="code">${esc(ST.dm(x.d, now))}</td><td>${dia(x, o, now)} ${esc(x.m.name || 'Milestone')}</td><td>${esc(o.one ? stageOf(x) : x.r.title)}</td>`
62
+ + `<td>${x.late ? `<span class="pm-badge alert">${esc(inDays(x.d, t))}</span>` : esc(inDays(x.d, t))}</td></tr>`).join('');
63
+ const more = NM.length > 20 ? `<p class="pm-meta">${NM.length - 20} more after these</p>` : '';
64
+ return wrap(`<section class="pm-block wk-next ms-list" aria-label="Next milestones">${headHtml(o, P)}<table class="pm-table"><thead><tr><th>Date</th><th>Milestone</th><th>${col}</th><th>When</th></tr></thead><tbody>${tr}</tbody></table>${more}</section>`);
65
+ }
66
+ const off = OFF.get(scope) || 0, W = ST.dlineWindow(NM, now, { off });
67
+ WIN.set(scope, W);
68
+ const line = ST.dlineHtml(NM, W, { sub: o.sub || '', ro: !!o.ro, moved: !!off, lw: o.lw || 640, now });
69
+ // the person's two presses go after the strip's own (Fit), at the end of its head
70
+ return wrap(line.replace('</div>', toolsHtml(P) + '</div>'));
71
+ }
72
+
73
+ /** The strip above the Work breakdown (the initiative's popup), else at the end of the page (a product or a program). */
74
+ export function insertStrip(html, strip) {
75
+ if (!strip) return html;
76
+ const m = /<(section|div)\b[^>]*\bpwd-wbs\b[^>]*>/.exec(html);
77
+ return m ? html.slice(0, m.index) + strip + html.slice(m.index) : html + strip;
78
+ }
79
+
80
+ /** Move a page's strip by `ms` (Fit: back to today). */
81
+ export function scrollStrip(scope, ms, fit) { OFF.set(scope, fit ? 0 : (OFF.get(scope) || 0) + ms); }
82
+ export const offOf = (scope) => OFF.get(scope) || 0;
83
+
84
+ /** The presses of the strips in `body`: `redraw` draws the page again. The listeners sit on the document, once, and find the page by the
85
+ * body that holds the strip (the design system's rule R28-15: no click or pointer listener on an element). */
86
+ let wired = false, moved = false, drag = null, raf = 0;
87
+ const hostOf = (el) => { for (let n = el; n; n = n.parentElement) if (n._msStripRedraw) return n; return null; };
88
+ const scopeOf = (el) => { const s = el && el.closest && el.closest('[data-ms-scope]'); return s ? s.dataset.msScope : null; };
89
+ // a day (in ms) per px of the strip's line, so a wheel or a drag moves it under the pointer
90
+ const pxMs = (strip, sc) => { const x = strip && strip.querySelector('.pm-dline .line'), W = WIN.get(sc), w = x ? x.getBoundingClientRect().width : 0; return W && w ? (W.to - W.from) / w : 0; };
91
+ export function wireStrip(body, redraw) {
92
+ if (!body) return;
93
+ body._msStripRedraw = redraw;
94
+ if (wired || typeof document === 'undefined') return;
95
+ wired = true;
96
+ const again = (h) => { if (h && h._msStripRedraw) h._msStripRedraw(); };
97
+ const soon = (h) => { if (raf) return; raf = requestAnimationFrame(() => { raf = 0; again(h); }); };
98
+ document.addEventListener('click', (e) => {
99
+ const t = e.target && e.target.closest ? e.target : null; if (!t || !t.closest('.ms-strip')) return;
100
+ if (moved) { e.stopImmediatePropagation(); e.preventDefault(); return; }
101
+ if (t.closest('[data-ms-pick]')) { noteUse('msStripOpen'); return; } // pm/bd-pin-card.js opens it
102
+ const ch = t.closest('[data-ms-fold], [data-ms-view]');
103
+ if (ch) {
104
+ e.preventDefault(); e.stopPropagation();
105
+ const h0 = hostOf(ch), sc0 = scopeOf(ch), which = ch.dataset.msFold ? 'msFold' : 'msView';
106
+ if (ch.dataset.msFold) setPref(FOLD_KEY, ch.dataset.msFold === 'fold' ? '1' : '0'); else setPref(VIEW_KEY, ch.dataset.msView);
107
+ noteUse(which === 'msFold' ? 'msStripFold' : 'msStripView');
108
+ again(h0);
109
+ const n = h0 && sc0 && h0.querySelector(`[data-ms-scope="${CSS.escape(sc0)}"] [data-${which === 'msFold' ? 'ms-fold' : 'ms-view'}]`); if (n) n.focus();
110
+ return;
111
+ }
112
+ const dl = t.closest('[data-wkdl]'); if (!dl || dl.dataset.wkdl === 'add') return;
113
+ const sc = scopeOf(dl), h = hostOf(dl), W = WIN.get(sc); if (!sc || !h) return;
114
+ e.preventDefault(); e.stopPropagation();
115
+ scrollStrip(sc, W ? +dl.dataset.at - +W.from : 0, dl.dataset.wkdl === 'fit' || !W);
116
+ again(h);
117
+ const q = `[data-ms-scope="${CSS.escape(sc)}"]`, n = h.querySelector(`${q} [data-wkdl="${dl.dataset.wkdl}"]`) || h.querySelector(`${q} .pm-more`);
118
+ if (n) n.focus();
119
+ }, true);
120
+ document.addEventListener('wheel', (e) => {
121
+ const t = e.target && e.target.closest ? e.target : null, strip = t && t.closest('.ms-strip'), sc = strip && t.closest('.pm-dline') && scopeOf(strip);
122
+ if (!sc || Math.abs(e.deltaX) <= Math.abs(e.deltaY)) return;
123
+ const k = pxMs(strip, sc); if (!k) return;
124
+ e.preventDefault(); scrollStrip(sc, e.deltaX * k); soon(hostOf(strip));
125
+ }, { passive: false });
126
+ document.addEventListener('pointerdown', (e) => {
127
+ const t = e.target && e.target.closest ? e.target : null, strip = t && t.closest('.ms-strip');
128
+ if (!strip || e.button !== 0 || !t.closest('.pm-dline') || t.closest('button')) return;
129
+ const sc = scopeOf(strip); drag = { sc, x: e.clientX, k: pxMs(strip, sc), h: hostOf(strip) }; moved = false;
130
+ });
131
+ addEventListener('pointermove', (e) => {
132
+ if (!drag || !drag.k) return;
133
+ const dx = e.clientX - drag.x; if (!moved && Math.abs(dx) < 5) return;
134
+ moved = true; scrollStrip(drag.sc, -dx * drag.k); drag.x = e.clientX; soon(drag.h);
135
+ });
136
+ addEventListener('pointerup', () => { if (!drag) return; drag = null; if (moved) setTimeout(() => { moved = false; }, 0); });
137
+ }
@@ -9,3 +9,22 @@
9
9
  .pc-chat [data-hm-scope] { pointer-events: none; }
10
10
  /* chief-of-staff C5 (CsB): the soft "You are on …" chip is a press: × drops it */
11
11
  .pc-chat [data-hm-scope].soft { pointer-events: auto; background: var(--cz-well); border-color: transparent; }
12
+ /* tb-chat-open-fold (factory job 2017, board TbChatOpen): while the chat shows beside the work, the side column is one-line rows on top, never hidden
13
+ * (side-fold.js). Each part keeps its row: its name, its first line, a chevron; a press opens it. Without the chat the rows are not drawn. */
14
+ .pc-fold-row { display: none; }
15
+ body.pc-side-fold [data-pm-side] { order: -1; }
16
+ body.pc-side-fold .pwd-ovg, body.pc-side-fold [data-pm-side] { display: flex; flex-direction: column; align-items: stretch; gap: 0; grid-column: 1 / -1;
17
+ border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); overflow: hidden; }
18
+ body.pc-side-fold .pwd-ovg > .pwd-ovp, body.pc-side-fold [data-pm-side] > * { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0 var(--space-16) var(--space-12); margin: 0; gap: var(--space-8); box-shadow: none; width: auto; max-width: none; align-self: stretch; }
19
+ body.pc-side-fold .pwd-ovg > .pwd-ovp:last-child, body.pc-side-fold [data-pm-side] > *:last-child { border-bottom: 0; }
20
+ body.pc-side-fold .pwd-ovg > .pwd-ovp > h3, body.pc-side-fold [data-pm-side] > * > h2, body.pc-side-fold [data-pm-side] > * > h3 { display: none; }
21
+ body.pc-side-fold .pc-folded { padding-bottom: 0; }
22
+ body.pc-side-fold .pc-folded > :not(.pc-fold-row) { display: none; }
23
+ body.pc-side-fold .pc-fold-row { display: flex; align-items: center; gap: var(--space-12); width: calc(100% + 2 * var(--space-16)); margin: 0 calc(-1 * var(--space-16));
24
+ min-height: 44px; padding: var(--space-8) var(--space-16); border: 0; background: none; font: inherit; font-size: var(--fs-row); line-height: 20px;
25
+ color: var(--ink); text-align: left; cursor: pointer; box-sizing: border-box; }
26
+ .pc-fold-row .pc-fold-k { flex: none; min-width: 110px; white-space: nowrap; font-weight: var(--fw-strong); }
27
+ .pc-fold-row .pc-fold-v { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
28
+ .pc-fold-row .pc-fold-ch { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
29
+ .pc-fold-row[aria-expanded="true"] .pc-fold-ch { transform: rotate(180deg); }
30
+ .pc-fold-row:focus-visible { outline: none; box-shadow: inset var(--glow); }
@@ -24,6 +24,7 @@
24
24
  * The chat's styles are Home's (cozy-home.css, home-line.css); they load once, the first time the chat opens. */
25
25
  import * as VW from './cozy-viewer.js';
26
26
  import { pmGet, pmPost, pmHeaders } from './http.js';
27
+ import { watch as foldSides } from './side-fold.js'; // tb-chat-open-fold (job #2017): with the chat open, the side column folds into one-line rows
27
28
 
28
29
  export const CHAT_ID = 'page-chat';
29
30
  const CLAUDE = { key: 'claude', name: 'PMOS', initial: 'P' };
@@ -75,6 +76,7 @@ export async function openAbout(t) {
75
76
  const homeHref = (it, key) => '/premium.html?' + new URLSearchParams({ about: key, label: String(it.title || '').slice(0, 80) }).toString();
76
77
 
77
78
  function sheets() {
79
+ foldSides();
78
80
  for (const s of SHEETS) {
79
81
  const href = new URL(s, import.meta.url).href;
80
82
  if (![...document.querySelectorAll('link[rel="stylesheet"]')].some((l) => l.href === href)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.appendChild(l); }