create-pmos 0.590.0 → 0.592.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.
@@ -211,6 +211,21 @@ export function programGroups(D, groups, products, o, now) {
211
211
  return out;
212
212
  }
213
213
 
214
+ /** Which initiative rows a group draws (home-nav-rows-with-a-call, board HmMany C): only the ones with a call (the blue dot, row.turn),
215
+ * the open one always, every row once the PM pressed "N more" (open). The rest fold into one line. rows: in the group's order.
216
+ * { shown, more, running, fewer }: running counts the working sessions in the folded rows; fewer: the open group has rows to fold back. */
217
+ export function foldRows(rows, o = {}) {
218
+ const sel = o.sel;
219
+ const isSel = (r) => !!sel && (r.id === sel || (r.kids || []).some((k) => k.id === sel));
220
+ const call = (r) => !!r.turn || isSel(r);
221
+ const shown = o.open ? rows.slice() : rows.filter(call);
222
+ const hid = o.open ? [] : rows.filter((r) => !call(r));
223
+ const running = hid.reduce((n, r) => n + (r.kids || []).filter((k) => k.kind === 'session' && k.state === 'working').length, 0);
224
+ return { shown, more: hid.length, running, fewer: !!o.open && rows.some((r) => !call(r)) };
225
+ }
226
+ /** The fold line: "3 more", or "3 more · 1 running" when a folded row has a running session. */
227
+ export const foldLabel = (more, running) => more + ' more' + (running ? ' · ' + running + ' running' : '');
228
+
214
229
  /* ── the list ── */
215
230
  /** The next steps Home shows: one on a cancelled, done or archived initiative is moot, so it neither brings that initiative back to Home
216
231
  * nor falls to "Not in an initiative" (batch 14 item 3). A session that waits on the PM stays. */
@@ -259,7 +274,8 @@ export function homeList(D, o = {}) {
259
274
  // the product's own next steps (its weekly update, a decision with no initiative) sit under its header, before the initiatives
260
275
  const flat = mineNeeds.filter((x) => !x.ini || !ids.has(x.ini)).filter((x) => !x.needSession).map((x) => ({ ...x, flat: true, hint: bareHint(x) }));
261
276
  const turnN = inis.filter((x) => x.turn).length + flat.length;
262
- const shown = inis.filter((x) => x.turn || x.busy);
277
+ // only the rows with a call show (home-nav-rows-with-a-call, board HmMany C): a running session, a meeting or a late task alone folds
278
+ const shown = inis.filter((x) => x.turn);
263
279
  // the product's own chats (its heading's chat and its new sessions) sit in the header's pill, as an initiative's sit in its row's
264
280
  const kids = (D.sessions || []).filter((s) => listed(s) && isProductChat(keyOfSession(s), p)).map((s) => sessionRow(s, D.desk && D.desk.roles)).sort((a, b) => (RANK[b.state] || 0) - (RANK[a.state] || 0));
265
281
  groups.push({ key: 'p:' + p.key, kind: 'product', product: p, name: p.name, kids, initials: p.initials, tone: p.tone, primary: !!p.primary, goals: p.goals, flat, inis: shown, rest: inis.filter((x) => !shown.includes(x)),
@@ -11,7 +11,7 @@
11
11
  * press that home-app.js handles. Text from the records goes through esc(). */
12
12
 
13
13
  import { STEPS } from './premium-initiative-head.js';
14
- import { whenOf } from './home-list.js';
14
+ import { whenOf, foldRows, foldLabel } from './home-list.js';
15
15
  import { chipHtml } from './cozy-pick.js'; // the one product picker Home, Board and Insights share (batch 12 item 5)
16
16
  import { ringHtml } from './home-line.js';
17
17
  import { gripHtml, sugHtml } from './prog-order.js'; // a program's order: the grip and ✦ (canvas RoADrag, RoAPhone)
@@ -178,24 +178,24 @@ function productHtml(g, o) {
178
178
  if (!open) return `${sec}${head}</section>`;
179
179
  return `${sec}${head}<div class="hv-card">${productBody(g, o, true)}</div></section>`;
180
180
  }
181
- /** A product's rows: its tasks, its initiatives with the quiet ones folded to "N more", the open one always shown. po: the grip arranges
182
- * them (the list); the folded rail's card shows the same rows without it. */
181
+ /** A fold line under a group (home-nav-rows-with-a-call): "N more" (· N running) opens the folded rows in place, "Fewer" folds them back. */
182
+ function foldHtml(key, F) {
183
+ return F.more > 0 ? `<button type="button" class="hv-fold" data-hm-rest="${esc(key)}" aria-expanded="false" aria-label="${F.more} more ${F.more === 1 ? 'initiative' : 'initiatives'} with nothing for you${F.running ? ', ' + F.running + ' running' : ''}. Show"><span class="hv-mk"></span>${foldLabel(F.more, F.running)}${svg(P.chevD, 16)}</button>`
184
+ : F.fewer ? `<button type="button" class="hv-fold" data-hm-rest="${esc(key)}" aria-expanded="true"><span class="hv-mk"></span>Fewer${svg(P.chevU, 16)}</button>` : '';
185
+ }
186
+ /** A product's rows: its own next steps, then only the initiatives with a call, the open one always shown; the rest fold to "N more".
187
+ * po: the grip arranges them (the list); the folded rail's card shows the same rows without it. */
183
188
  function productBody(g, o, po) {
184
189
  const pinned = (x) => (o.pin.has(x.key) ? 0 : 1);
185
190
  // say it once (home-your-move-waiting): the weekly update leaves the list while Your move at the top of Home holds it
186
191
  const held = o.held && o.held.update ? (r) => r.kind === 'update' : () => false;
187
192
  const flat = g.flat.filter((r) => !held(r)).slice().sort((a, b) => pinned(a) - pinned(b)).map((r) => rowHtml(r, o)).join('');
188
- const QUIET = 3;
189
- const restAll = o.restOpen(g.key);
190
193
  // the open initiative always shows, wherever the PM's order puts it (batch 14 item 8)
191
- const rest = restAll ? g.rest : g.rest.filter((r, i) => i < Math.max(0, QUIET - g.inis.length) || r.id === o.sel);
192
- const more = g.rest.length - rest.length;
194
+ const F = foldRows(g.inis.concat(g.rest), { open: o.restOpen(g.key), sel: o.sel });
193
195
  // the product's initiatives are one list the grip arranges, shared with the Board (batch 14 item 8)
194
- const inis = g.inis.concat(rest).map((r) => iniHtml(r, { ...o, gk: g.key }, po)).join('');
195
- const body = flat + (po ? `<div class="po-list" data-po-list="@${esc(prodKey(g.name))}">${inis}</div>` : inis)
196
- + (more > 0 ? `<button type="button" class="hv-fold" data-hm-rest="${esc(g.key)}" aria-expanded="false" aria-label="${more} more ${more === 1 ? 'initiative' : 'initiatives'} with nothing today. Show"><span class="hv-mk"></span>${more} more${svg(P.chevD, 16)}</button>`
197
- : restAll && g.rest.length > QUIET ? `<button type="button" class="hv-fold" data-hm-rest="${esc(g.key)}" aria-expanded="true"><span class="hv-mk"></span>Fewer${svg(P.chevU, 16)}</button>` : '');
198
- return g.inis.length + rest.length + g.flat.length ? body : `<p class="hm-none">${g.primary ? 'No initiative is open on this board.' : 'Nothing is open here.'}</p>`;
196
+ const inis = F.shown.map((r) => iniHtml(r, { ...o, gk: g.key }, po)).join('');
197
+ const body = flat + (po ? `<div class="po-list" data-po-list="@${esc(prodKey(g.name))}">${inis}</div>` : inis) + foldHtml(g.key, F);
198
+ return F.shown.length + F.more + g.flat.length ? body : `<p class="hm-none">${g.primary ? 'No initiative is open on this board.' : 'Nothing is open here.'}</p>`;
199
199
  }
200
200
  /** A program's group (canvas PgHomePhone, PgHomeDesk): above the products. Its header: the program tile, the name, the next milestone's
201
201
  * diamond with its date and one small diamond per initiative it waits on (filled when that initiative is past the Deliver milestone), a chevron.
@@ -225,11 +225,17 @@ function msHtml(g) {
225
225
  /** A program's rows: its milestone row first, then its initiatives, under a product sub-heading when they come from two or more products. */
226
226
  function programBody(g, o, po) {
227
227
  const many = g.subs.length > 1;
228
- const body = g.subs.map((x) => { const inis = x.inis.map((r) => iniHtml(r, { ...o, gk: g.key }, po)).join(''); return `${many ? `<div class="hv-psub" role="heading" aria-level="3"><span class="hv-st2 t${x.tone}" aria-hidden="true">${esc(x.initials)}</span>${esc(x.name)}</div>` : ''}${po ? `<div class="po-list" data-po-list="${esc(g.program.id)}">${inis}</div>` : inis}`; }).join('');
228
+ // the same rule as a product's (home-nav-rows-with-a-call): only the rows with a call, the rest fold into one line under the program
229
+ const open = o.restOpen(g.key), F = { more: 0, running: 0, fewer: false };
230
+ const body = g.subs.map((x) => {
231
+ const f = foldRows(x.inis, { open, sel: o.sel });
232
+ F.more += f.more; F.running += f.running; F.fewer = F.fewer || f.fewer;
233
+ if (!f.shown.length) return '';
234
+ const inis = f.shown.map((r) => iniHtml(r, { ...o, gk: g.key }, po)).join(''); return `${many ? `<div class="hv-psub" role="heading" aria-level="3"><span class="hv-st2 t${x.tone}" aria-hidden="true">${esc(x.initials)}</span>${esc(x.name)}</div>` : ''}${po ? `<div class="po-list" data-po-list="${esc(g.program.id)}">${inis}</div>` : inis}`; }).join('');
229
235
  // the program's milestone changes that wait on the PM lead its card (batch 14 item 4: they were only in Your day, which a desktop no longer has)
230
236
  // say it once (home-your-move-waiting): the milestone changes leave the card while Your move at the top of Home holds them
231
237
  const msr = g.msRow && !(o.held && o.held.programs && o.held.programs.has(g.program.id)) ? `<div class="hm-r hv-r${o.sel === g.msRow.id ? ' sel' : ''}" data-id="${esc(g.msRow.id)}"><button type="button" class="hm-rm" data-hm-sel="${esc(g.msRow.id)}" aria-label="${esc(g.msRow.hint)}. Waits on you. Open the program"><span class="hv-mk"><span class="hv-d" aria-hidden="true"></span></span><span class="hm-rt"><b>${esc(g.msRow.hint)}</b></span></button></div>` : '';
232
- return msr + (body || `<p class="hm-none">${(g.program.members || []).length ? 'No open initiatives' : 'No initiatives yet'}. Open the program to move some in.</p>`);
238
+ return msr + (body || F.more ? body + foldHtml(g.key, F) : `<p class="hm-none">${(g.program.members || []).length ? 'No open initiatives' : 'No initiatives yet'}. Open the program to move some in.</p>`);
233
239
  }
234
240
  /** Which group holds what is open (o.sel: a row id, or 'i:<initiative>'): the folded rail marks that group's tile (batch 18 item 14, FlA4After).
235
241
  * Nothing in a group is open: null. */
@@ -3460,6 +3460,8 @@ const liveRound = require('./lib/live-round.js').install({
3460
3460
  writePaths: spec.writePaths, addDirs: spec.addDirs, autoDelete: undefined, onDone: spec.onDone }),
3461
3461
  stop: (s) => { if (s && s.child) stopHeadless(s); },
3462
3462
  artefact: (dir, line, by) => { const AF = require('./lib/artefacts.js'); return AF.set(AF.file(dir), line, { by }); },
3463
+ // the chat explains the change (initiative live-round-iterative): a line typed into the initiative's chat session, when one is open
3464
+ tell: (ws, ini, text) => { const id = require('./lib/briefing-premium-agent.js').chatSessionOf(STATE, 'init:' + ini); return id ? sendToSession(id, text) : false; },
3463
3465
  warn: (what, e) => warnWriteFail(what, e),
3464
3466
  });
3465
3467
  // live round before a meeting (lib/live-round-meeting.js, initiative live-round-meeting): step 2 of the queue. A meeting in the next hour