create-pmos 0.431.0 → 0.433.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.
Files changed (63) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/board-programs-test.js +10 -4
  7. package/workspace/briefing-premium-board-test.js +24 -22
  8. package/workspace/briefing-premium-initiative-test.js +10 -5
  9. package/workspace/briefing-premium-products-test.js +2 -0
  10. package/workspace/briefing-premium-sources-test.js +15 -8
  11. package/workspace/briefing-premium-work-test.js +6 -3
  12. package/workspace/changelog.json +24 -0
  13. package/workspace/ev-everywhere-test.js +40 -33
  14. package/workspace/guide/briefing-premium.md +1 -1
  15. package/workspace/guide/data-freshness.md +3 -1
  16. package/workspace/guide/home.md +26 -17
  17. package/workspace/guide/initiative-boards.md +6 -6
  18. package/workspace/guide/programs.md +3 -3
  19. package/workspace/ini-workflow-test.js +13 -8
  20. package/workspace/lib/briefing-premium.js +6 -3
  21. package/workspace/lib/engine/boards.js +13 -2
  22. package/workspace/lib/ini-deleted.js +58 -0
  23. package/workspace/lib/initiative-rows.js +4 -1
  24. package/workspace/lib/routes-boards.js +48 -0
  25. package/workspace/lib/search-index.js +3 -1
  26. package/workspace/milestone-pins-test.js +8 -3
  27. package/workspace/package-lock.json +2 -2
  28. package/workspace/package.json +1 -1
  29. package/workspace/premium-board-actions-test.js +50 -32
  30. package/workspace/premium-briefing-depth-test.js +33 -34
  31. package/workspace/premium-core-doc-issue-test.js +1 -1
  32. package/workspace/premium-vw-backlog-test.js +1 -1
  33. package/workspace/premium-vw-item-test.js +1 -1
  34. package/workspace/premium-vw-jira-test.js +1 -1
  35. package/workspace/product-lane-test.js +5 -5
  36. package/workspace/program-leave-test.js +20 -19
  37. package/workspace/public/pm/bd-acts.js +7 -5
  38. package/workspace/public/pm/bd-ini-panel.js +57 -25
  39. package/workspace/public/pm/bd-span.js +5 -4
  40. package/workspace/public/pm/cozy-ev.css +22 -7
  41. package/workspace/public/pm/cozy-evmodel.js +3 -3
  42. package/workspace/public/pm/cozy-nav.js +29 -32
  43. package/workspace/public/pm/cozy-news.js +11 -27
  44. package/workspace/public/pm/cozy-settings.js +68 -11
  45. package/workspace/public/pm/cozy-sources.js +5 -89
  46. package/workspace/public/pm/cozy-today.css +19 -1
  47. package/workspace/public/pm/hi-pop.css +21 -0
  48. package/workspace/public/pm/hi-pop.js +5 -5
  49. package/workspace/public/pm/home-app.js +62 -25
  50. package/workspace/public/pm/home-day.js +60 -2
  51. package/workspace/public/pm/home-ini.js +66 -27
  52. package/workspace/public/pm/home-more.js +9 -50
  53. package/workspace/public/pm/home-today.js +4 -2
  54. package/workspace/public/pm/ini-more.js +78 -42
  55. package/workspace/public/pm/ini-view-model.js +1 -1
  56. package/workspace/public/pm/ini-view.css +17 -0
  57. package/workspace/public/pm/ini-view.js +25 -7
  58. package/workspace/public/pm/premium-board.js +4 -3
  59. package/workspace/public/pm/prog-move.js +26 -0
  60. package/workspace/public/pm/stage-line.js +4 -3
  61. package/workspace/public/premium.html +0 -1
  62. package/workspace/stage-card-test.js +10 -1
  63. package/workspace/task-milestones-test.js +4 -3
@@ -4,10 +4,17 @@
4
4
  * YdE2AllClear, YdE3Evening, YdE6BigDay, YdE7Rough): the opening card is Claude's small mood face and one first-person line, with chips for
5
5
  * the work Claude really did; Your move holds only the calls that need the PM; the rest folds:
6
6
  * Your move the calls only the PM can make (homeList's move rows with call: true), open by default
7
+ * New for you (feedback batch 16 item 5b, canvas FmA2Day) the FYI items of GET /api/news-for-you: mentions, tasks given to the PM and work
8
+ * finished while away. The 3 newest, then "N more" (the whole list in the Viewer, cozy-news.js); ✓✓ in the fold's header
9
+ * marks all seen; today's digests of the morning brief are one row. No item and no digest, no fold. It replaces the New
10
+ * for you page of the place menu.
7
11
  * Drafted for you the drafts of today's morning prep run (GET /api/phone-day finished) and the weekly update
8
12
  * Can wait every other row that was "Your move" (tasks, brief items, Jira)
9
13
  * Now the phone's moment card (home-phone-card.js), open by default
14
+ * Tomorrow after 17:00 only (canvas FmA5Evening, was More › End of the day): tomorrow's meetings (GET /api/phone-day tomorrow);
15
+ * not on a phone, whose Now card shows tomorrow then
10
16
  * This week the Weekly review
17
+ * The calendar is an icon in Your day's header (home-app.js), no longer a ⋯ with one entry.
11
18
  * Every claim comes from what PMOS holds: a meeting is "prepped" only when it has the agent's prep note, "drafted" only from today's run,
12
19
  * a thank-you only from a real mention, a miss only from a failed task. No data, no line (zero is silence). The mood is never happier than
13
20
  * the data: concerned when something failed or is blocked, delighted at most once a week, calm on a packed or ordinary day.
@@ -20,6 +27,7 @@
20
27
 
21
28
  import { todayOf, hm } from './home-data.js';
22
29
  import { adler, adlerScene, asleep, firstOpenToday } from './cozy-adler.js'; // Adler, Claude's face (batch 16 item 2): AdB1-3, AdP1, AdP4
30
+ import { initials, ago } from './cozy-evmodel.js';
23
31
 
24
32
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
25
33
  const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
@@ -51,9 +59,22 @@ export function thanksOf(D, now) {
51
59
  return m ? { quote: clip(m.text, 160), who: m.who || '', where: m.source ? m.source.charAt(0).toUpperCase() + m.source.slice(1) : '', at: m.at ? hm(m.at) : '' } : null;
52
60
  }
53
61
 
62
+ /** New for you, newest first: the items of one GET /api/news-for-you answer (its groups), or [] when it did not answer. */
63
+ export function newsOf(r) {
64
+ if (!r || !r.ok || !Array.isArray(r.groups)) return [];
65
+ return r.groups.flatMap((g) => (g && Array.isArray(g.items) ? g.items : [])).filter((x) => x && x.id).sort((a, b) => (b.at || 0) - (a.at || 0));
66
+ }
67
+ /** Tomorrow's meetings, after 17:00 only (FmA5Evening): { label, meetings } or null when it is earlier or tomorrow has none (zero is silence). */
68
+ export function tomorrowOf(D, now) {
69
+ const T = D && D.phoneDay && D.phoneDay.tomorrow;
70
+ if (new Date(now).getHours() < 17 || !T || !Array.isArray(T.meetings)) return null;
71
+ const L = T.meetings.filter((m) => m && m.start && !Number.isNaN(Date.parse(m.start))).sort((x, y) => Date.parse(x.start) - Date.parse(y.start));
72
+ return L.length ? { label: T.label || 'Tomorrow', meetings: L } : null;
73
+ }
74
+
54
75
  /** Your day's words. M: homeList's model (move); D: Home's data (today's meetings, phoneDay, the brief page's me and mentions);
55
- * R: reviewModel. o: { delightOk: false when the delighted face showed on another day this week }.
56
- * → { mood, line, sub, chips, misses, offer, calls, drafts, wait, done, next, week, thanks } */
76
+ * R: reviewModel. o: { delightOk: false when the delighted face showed on another day this week, news: the GET /api/news-for-you answer }.
77
+ * → { mood, line, sub, chips, misses, offer, calls, drafts, wait, done, next, week, thanks, news, tomorrow } */
57
78
  export function dayModel(M, D, R, now = Date.now(), o = {}) {
58
79
  D = D || {};
59
80
  const move = (M && M.move) || [];
@@ -110,6 +131,7 @@ export function dayModel(M, D, R, now = Date.now(), o = {}) {
110
131
  if (!run && h < 17) offer = { kind: 'prep', text: 'I haven’t prepared today yet.', sub: 'Shall I prep your meetings and draft what I can?' };
111
132
  return {
112
133
  mood, face: run && run.working && mood === 'calm' ? 'working' : mood, line, sub, chips, misses, offer, calls, drafts, wait, done, thanks,
134
+ news: newsOf(o.news), digests: digestsOf(D), tomorrow: tomorrowOf(D, now),
113
135
  next: next ? { meeting: next, now: next.state === 'now', time: hm(next.start), title: next.title || 'A meeting' } : null,
114
136
  week: { sub: un || 'Weekly review' },
115
137
  };
@@ -158,6 +180,40 @@ export function nightHtml(Y) {
158
180
  return `<div class="yd-night">${adlerScene('night', 'resting')}<b>It’ll keep till morning.</b><em>${esc(sub)}</em><button type="button" class="yd-awake" data-yd="awake">Open anyway</button></div>`;
159
181
  }
160
182
 
183
+ /* one New for you item (FmA2Day): the blue dot, who, the words and where it came from; a press opens it in the Viewer (cozy-news.js) */
184
+ const SRC = { slack: 'Slack', jira: 'Jira', confluence: 'Confluence', mail: 'Mail' };
185
+ const MARK2 = 'M2 12.5l4.5 4.5L15 8M9 15l2 2L22 7';
186
+ export const NEWS_SHOWN = 3;
187
+ function newsRow(it, now) {
188
+ const who = it.kind === 'mention' ? it.who : it.kind === 'task' ? (it.from || 'Someone') : (it.product || 'Claude');
189
+ const when = it.at ? ago(new Date(it.at).toISOString(), now) : '';
190
+ const head = it.kind === 'mention' ? '“' + clip(it.text || it.title, 120) + '”' : it.title;
191
+ const sub = it.kind === 'mention' ? [it.who, [SRC[it.source] || it.source, it.where].filter(Boolean).join(' '), when].filter(Boolean).join(' · ')
192
+ : it.kind === 'task' ? ['Given to you' + (it.from ? ' by ' + it.from : ''), it.due ? 'due ' + it.due : '', it.initiative ? 'filed under ' + it.initiative : ''].filter(Boolean).join(' · ')
193
+ : ['Finished while you were away', it.target, when].filter(Boolean).join(' · ');
194
+ return `<button type="button" class="yd-nw" data-yd="news" data-id="${esc(it.id)}"><i class="yd-nd" aria-hidden="true"></i><span class="yd-av${it.kind === 'finished' ? ' b' : ''}" aria-hidden="true">${esc(initials(who))}</span><span class="yd-mt"><b>${esc(head)}</b><em>${esc(sub)}</em></span></button>`;
195
+ }
196
+ /** The New for you fold's parts: the 3 newest rows, "N more", the morning brief's digests as one row, and the ✓✓ that marks all seen.
197
+ * → a czSections row, or null when nothing is new and there is no digest (zero is silence). */
198
+ export function newsSection(items, now = Date.now(), digests = 0) {
199
+ items = items || [];
200
+ if (!items.length && !(digests > 0)) return null;
201
+ const more = items.length - NEWS_SHOWN;
202
+ const dig = digests > 0 ? `<button type="button" class="yd-more" data-yd="news-all">${digests === 1 ? 'Today’s digest' : 'Today’s ' + digests + ' digests'}</button>` : '';
203
+ return { id: 'news', title: 'New for you', count: items.length + (digests > 0 ? digests : 0), open: true,
204
+ tail: items.length ? `<button type="button" class="yd-all" data-yd="seen" aria-label="Mark all ${items.length} seen" title="Mark all seen">${svg(MARK2, 20, 1.9)}</button>` : '',
205
+ html: `<div class="yd-news">${items.slice(0, NEWS_SHOWN).map((x) => newsRow(x, now)).join('')}${more > 0 ? `<button type="button" class="yd-more" data-yd="news-all">${more} more</button>` : ''}${dig}</div>` };
206
+ }
207
+ /** The morning brief's digests of today (GET /api/briefing-premium model.today), which New for you's list shows. */
208
+ export function digestsOf(D) {
209
+ const T = D && D.brief && D.brief.today; if (!T) return 0;
210
+ return [].concat(T.earlier || [], T.ahead || []).filter((e) => e && e.kind === 'digest').length;
211
+ }
212
+ function tomorrowSection(T) {
213
+ return { id: 'tomorrow', title: 'Tomorrow', count: T.meetings.length, open: true,
214
+ html: `<div class="yd-tm">${T.meetings.map((m) => `<div class="yd-tmr"><span class="yd-tt">${esc(hm(m.start))}</span><span class="yd-tn">${esc(m.title || 'A meeting')}</span></div>`).join('')}</div>` };
215
+ }
216
+
161
217
  /** The shell's parts for Your day (czSections takes them). o: { moment: true on a phone with the moment card, now, first: the day's first
162
218
  * open (the morning scene) } → { open, sections, night } */
163
219
  export function dayParts(Y, o = {}) {
@@ -167,12 +223,14 @@ export function dayParts(Y, o = {}) {
167
223
  const big = Y.calls.length || Y.mood === 'concerned' ? null : Y.mood === 'delighted' ? 'win' : real ? 'tea' : null;
168
224
  if (Y.calls.length) sections.push({ id: 'move', title: 'Your move', count: Y.calls.length, open: true, html: Y.calls.map(callHtml).join('') });
169
225
  else if (big) sections.push({ id: 'move', title: 'Your move', open: true, html: bigHtml(big) });
226
+ { const nw = newsSection(Y.news || [], o.now, Y.digests || 0); if (nw) sections.push(nw); }
170
227
  if (Y.drafts.length) sections.push({ id: 'drafts', title: 'Drafted for you', count: Y.drafts.length, html: `<div class="hv-card">${Y.drafts.map(draftRow).join('')}</div>` });
171
228
  if (Y.wait.length) sections.push({ id: 'wait', title: 'Can wait', count: Y.wait.length, html: `<div class="hv-card hd-move">${Y.wait.map(waitRow).join('')}</div>` });
172
229
  if (o.moment) sections.push({ id: 'now', title: 'Now', open: true, html: '<div class="hd-now"></div>' }); // drawDay puts the moment card in
173
230
  else if (Y.next) {
174
231
  sections.push({ id: 'next', title: Y.next.now ? 'On now' : 'Next meeting', count: Y.next.now ? '' : Y.next.time, html: `<div class="hv-card"><div class="hm-r hv-r two"><button type="button" class="hm-rm" data-hd-meet><span class="hv-mk">${svg(CLOCK, 15)}</span><span class="hm-rt"><b>${esc(Y.next.title)}</b><em>${esc(Y.next.now ? 'On now' : Y.next.time)}</em></span><span class="hv-cv">${svg(CHEV, 16)}</span></button></div></div>` });
175
232
  }
233
+ if (Y.tomorrow && !o.moment) sections.push(tomorrowSection(Y.tomorrow)); // a phone's moment card already shows tomorrow at the end of the day (say it once)
176
234
  sections.push({ id: 'week', title: 'This week', count: Y.week.sub, html: `<div class="hv-card"><div class="hm-r hv-r two" data-id="review"><button type="button" class="hm-rm" data-hm-review aria-label="Weekly review: ${esc(Y.week.sub)}. Open"><span class="hv-mk">${svg(CAL, 16)}</span><span class="hm-rt"><b>Weekly review</b><em>${esc(Y.week.sub)}</em></span><span class="hv-cv">${svg(CHEV, 16)}</span></button></div></div>` });
177
235
  const scene = !big && o.first && Y.mood !== 'concerned' && new Date(now).getHours() < 12;
178
236
  const night = Y.mood !== 'concerned' && asleep(now) ? nightHtml(Y) : '';
@@ -28,7 +28,7 @@
28
28
  import * as MD from './home-ini-model.js';
29
29
  import * as WF from './ini-wf.js';
30
30
  import { openPop, closePop, undoToast, popEl, ensureCss as ensurePopCss } from './hi-pop.js';
31
- import { iniMore, iniText, pageHref } from './ini-more.js'; // the one initiative ⋯ menu, the same on the Board (batch 14 item 5) // the popovers and the toast with Undo, shared with the Board
31
+ import { iniMore, iniText, pageHref, stagePick, deleteSaid, DELETE_MS } from './ini-more.js'; // the one initiative ⋯ menu and stage picker, the same on the Board (batch 14 item 5, batch 16 item 5c)
32
32
  import * as SC from './home-stage-card.js';
33
33
  import { viewHtml, wireView } from './ini-view.js'; // the one initiative view, the Board's panel's own renderer
34
34
  import { ensureCss as ensureStepsCss } from './cozy-steps.js'; // stage card D: the card's last node and the move sheet's words // D99: the initiative's own workflow (Change picker, switch, Won't do, Archive)
@@ -212,7 +212,8 @@ function pageHtml(id, M) {
212
212
  // a phone: the page is a sheet over the list, and the chat is one press away (HbCPhone)
213
213
  const talk = isPhone() ? `<button type="button" class="hi-talk" data-hi-talk>Message Claude about ${esc(X.ctx.iniTitle(id))}</button>` : '';
214
214
  return `<div class="hi-v hi-page" data-hi-v="page">${WF.endedHtml(rowOf(id))}`
215
- + viewHtml(v, { add: true, adding: ADDING === id, addHint: ADDING === id && ADD_DATES ? ADD_DATES.start + ' to ' + ADD_DATES.due : '', hold: true, next: !!v.stage.next, openTask: true, quick: true, docs: docs.length ? { n: docs.length } : null, wf: !(M.acts && M.acts.self) && !rowOf(id).ended })
215
+ + viewHtml(v, { add: true, adding: ADDING === id, addHint: ADDING === id && ADD_DATES ? ADD_DATES.start + ' to ' + ADD_DATES.due : '', hold: true, next: !!v.stage.next, openTask: true, quick: true, docs: docs.length ? { n: docs.length } : null, wf: !(M.acts && M.acts.self) && !rowOf(id).ended,
216
+ person: !!X.ctx.addPerson, stagePick: true, planDates: !!X.ctx.askIn, jira: !!((X.ctx.S.D && X.ctx.S.D.board) || {}).jira })
216
217
  + `${talk}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
217
218
  }
218
219
  /** A hold's card from the stage card (batch 11 item 21): its words and the return date, which writes an on-hold line with the new date
@@ -283,6 +284,11 @@ function wirePage(b, id) {
283
284
  doc: (path) => { C.VW.drill(); C.openFile({ path, name: path.split('/').pop() }); },
284
285
  docs: () => iniOverview('docs', { back: true }),
285
286
  wf: (btn) => WF.openPicker(btn, wfUi(), id),
287
+ // what left the ⋯ for the thing it changes (batch 16 item 5c): the dashed + after the people, the stage chip, the dates chip, Jira's ↻
288
+ person: () => C.addPerson(),
289
+ stagePick: (btn) => stageChip(btn, id),
290
+ planDates: () => { if (C.askIn) C.askIn(id, 'Propose new start and end dates for ' + C.iniTitle(id)); },
291
+ jira: () => { const M = curM(); if (M) readJira(M); },
286
292
  });
287
293
  }
288
294
  /** A task of the initiative as the one view reads it: the board row's (status, start, end), else the page's own read (state, start, end). */
@@ -324,39 +330,72 @@ async function setDates(id, uid, patch) {
324
330
  if (k || (r.from && ('start' in r.from || 'due' in r.from))) undoToast('Dates saved: ' + (k ? k.title : uid + ', kept in PMOS') + '.', async () => { const u = await C.pmPost('/api/boards/tasks/edit', { ...body, ...back }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
325
331
  else C.toast('Dates saved.');
326
332
  }
327
- /** ⋯ of the page: the ONE initiative menu (pm/ini-more.js, feedback batch 14 item 5), the same words and order as the Board's panel.
328
- * This page says which items apply and what each press does; the menu decides the order. */
333
+ /** ⋯ of the page: the ONE initiative menu (pm/ini-more.js; batch 16 item 5c: seven entries), the same words and order as the Board's panel.
334
+ * This page says which items apply and what each press does; the menu decides the order. The rest sits on the thing it changes (wirePage). */
329
335
  function pageMore(id) {
330
336
  const M = curM(); if (!M) return [];
331
- const C = X.ctx, mv = mvOf(id, M), row = rowOf(id), self = !!(M.acts && M.acts.self), B = (C.S.D && C.S.D.board) || {};
337
+ const C = X.ctx, row = rowOf(id);
332
338
  const openList = (b, label, rows) => menu(b || moreBtn(), [{ head: label }, ...rows], label);
333
339
  const copy = (t, said) => navigator.clipboard.writeText(t).then(() => C.toast(said), () => C.toast('This browser did not allow the copy.'));
334
- const ask = (q) => { if (C.askIn) C.askIn(id, q); };
335
340
  return iniMore({
336
- // D99 (WfAWontDo): the PMOS-self board keeps its derived ladder, so it has no workflow to change
337
- wf: !self && !row.ended ? { name: (row.wf || {}).name, on: (b) => WF.openPicker(b || moreBtn(), wfUi(), id) } : null,
338
- rename: C.renameIni ? () => { const t = document.querySelector('#czViewer [data-cz-vw-rn]'); if (t) t.click(); } : null,
339
- auto: !mv.why ? { on: mv.auto, press: () => (ownWf(row) ? autoPress(id, M, !mv.auto) : press(id, M, { kind: 'auto', on: !mv.auto })) } : null,
340
- back: mv.canBack ? { prev: mv.prev, on: (b) => popBack(b || moreBtn(), id, M, mv) } : null,
341
- toStage: (M.acts.stages || []).length && !self ? () => iniOverview('stage', { back: true }) : null,
342
- dates: C.askIn ? () => ask('Propose new start and end dates for ' + C.iniTitle(id)) : null,
343
- person: () => C.addPerson(),
344
- // split or merge, then the program moves (batch 11 items 2 and 14)
341
+ // split or merge, then the one Program picker (batch 11 items 2 and 14; batch 16 item 5c)
345
342
  sm: C.smItems && !row.ended ? C.smItems(id, openList) : [],
346
- pm: C.moveItems ? C.moveItems(id, (b, label, rows) => menu(b || moreBtn(), [{ head: label }, ...rows], 'Move to another program')) : [],
347
- turnProgram: C.turnProgram ? () => C.turnProgram(id) : null,
348
- jira: B.jira ? () => readJira(M) : null,
343
+ pm: C.moveItems ? C.moveItems(id, openList) : [],
349
344
  board: () => { location.href = '/premium-board.html?focus=' + encodeURIComponent(id) + (M.board.ws ? '&ws=' + encodeURIComponent(M.board.ws) : '') + (M.board.id ? '&board=' + encodeURIComponent(M.board.id) : ''); },
350
- record: async () => (C.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }),
351
345
  link: () => copy(new URL(pageHref(id, M.board.ws, M.board.id), location.href).href, 'Link copied.'),
352
346
  text: () => copy(iniText(C.iniTitle(id), C.view ? C.view(id) : null, (row.track && row.track.tickets) || []), 'Copied as text.'),
353
- ended: !!row.ended,
354
- wontDo: !self ? (b) => WF.openWontDo(b || moreBtn(), wfUi(), id) : null,
355
- backToTriage: !self ? () => WF.backToTriage(wfUi(), id) : null,
347
+ record: async () => (C.VW.drill(), await import('./premium-vw-item.js')).openWorkItem({ kind: 'initiative', id, title: M.title, ...bw(M) }),
348
+ del: M.board && M.board.id ? () => deleteIni(id, M) : null,
349
+ });
350
+ }
351
+ /** Delete (batch 16 item 5d, FmI3Deleted): no confirm; the initiative and its tasks leave every list at once, and Undo in the toast for 8 s
352
+ * brings them back (POST /api/boards/ini-delete, ini-restore). Jira is never written. */
353
+ async function deleteIni(id, M) {
354
+ const C = X.ctx, at = bw(M);
355
+ const r = await C.pmPost('/api/boards/ini-delete', { ...at, id });
356
+ if (!r || r.ok === false) { C.toast((r && r.error) || 'It was not deleted.'); return; }
357
+ if (C.goHome) C.goHome();
358
+ await C.load();
359
+ undoToast(deleteSaid(r.title || C.iniTitle(id), r.tasks || 0), async () => {
360
+ const u = await C.pmPost('/api/boards/ini-restore', { ...at, id });
361
+ if (!u || u.ok === false) { C.toast((u && u.error) || 'The undo did not land.'); return; }
362
+ await C.load();
363
+ if (C.goIni) C.goIni(id);
364
+ }, DELETE_MS);
365
+ }
366
+ /** The stage chip (batch 16 item 5c, FmI2Stage): every stage of its workflow, Moves on by itself, then hold, Won't do and Archive. A move
367
+ * forward with items still open asks first (the move sheet), a move back asks why (Back); either has Undo. */
368
+ function stageChip(btn, id) {
369
+ const M = curM(); if (!M) return;
370
+ const C = X.ctx, mv = mvOf(id, M), row = rowOf(id), A = wfM(id, M).acts || {}, self = !!A.self, ms = A.msNames || null;
371
+ const stages = (A.stages || []).map((name) => ({ name, ms: ms ? ms.includes(name) : MD.isMilestone(name) }));
372
+ const at = stages.findIndex((x) => x.name === mv.cur);
373
+ stagePick(btn, {
374
+ title: C.iniTitle(id), stages, cur: mv.cur,
375
+ go: !self && !A.life ? (name, a) => {
376
+ const i = stages.findIndex((x) => x.name === name);
377
+ if (i < at) popBack(a, id, M, { ...mv, prev: name });
378
+ else if (mv.open.length) popMove(a, id, M, { ...mv, next: name });
379
+ else doMove(id, M, name, MD.whyOf('move'));
380
+ } : null,
381
+ auto: !mv.why ? { on: mv.auto, press: (on) => (ownWf(row) ? autoPress(id, M, on) : press(id, M, { kind: 'auto', on })) } : null,
382
+ hold: !self && !M.acts.life && !row.ended ? () => holdNow(id, M) : null,
383
+ resume: M.acts.life && !row.ended ? () => resume(id, M) : null,
384
+ wontDo: !self && !row.ended ? (a) => WF.openWontDo(a, wfUi(), id) : null,
385
+ backToTriage: !self && row.ended ? () => WF.backToTriage(wfUi(), id) : null,
356
386
  archive: !self ? () => WF.archive(wfUi(), id) : null,
357
- hold: !M.acts.life && !row.ended ? () => iniOverview('stage', { back: true, ask: 'on-hold' }) : null,
358
- resume: M.acts.life === 'hold' && !row.ended ? () => resume(id, M) : null,
359
- cancel: !M.acts.life && !row.ended ? () => iniOverview('stage', { back: true, ask: 'cancelled' }) : null,
387
+ });
388
+ }
389
+ /** Put on hold from the stage chip, at once, as the Board does (bd-acts.js): back in 30 days, Undo in the toast (POST /api/lifecycle). */
390
+ async function holdNow(id, M) {
391
+ const C = X.ctx, d = new Date(Date.now() + 30 * 864e5), back = d.toISOString().slice(0, 10);
392
+ const r = await C.pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: 'on-hold', reason: 'Held from the stage chip', back });
393
+ if (!r || r.ok === false) { C.toast((r && r.error) || 'Nothing was changed.'); return; }
394
+ await C.load(); redrawView();
395
+ undoToast('On hold · ' + C.iniTitle(id) + ' · check back ' + d.toLocaleDateString(undefined, { month: 'short', day: 'numeric' }) + '.', async () => {
396
+ const u = await C.pmPost('/api/lifecycle', { ws: M.board.ws, initiative_id: id, state: 'active', reason: 'undo' });
397
+ if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.');
398
+ await C.load(); redrawView();
360
399
  });
361
400
  }
362
401
  /** Resume an initiative on hold (POST /api/lifecycle, the Stage view's Resume and the Board's). */
@@ -441,8 +480,8 @@ function stageView(id, M, ask) {
441
480
  const mv = mvOf(id, M), stages = (M.acts && M.acts.stages) || [];
442
481
  const move = stages.length && !M.acts.self ? `<div class="hi-stages" role="group" aria-label="Move to a stage">${stages.map((s) => `<button type="button" class="cz-chip${s === M.acts.stage ? ' on' : ''}" aria-pressed="${s === M.acts.stage}" data-ov-move="${esc(s)}">${MD.isMilestone(s) ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(s)}</button>`).join('')}</div>` : '<p class="hi-small">The stage of this board comes from the workflow engine.</p>';
443
482
  const life = M.acts && M.acts.life ? `<button type="button" class="hi-btn sm" data-ov-life="active">Resume</button>${M.acts.reason ? `<p class="hi-small">${esc(M.acts.reason)}</p>` : ''}`
444
- : ask ? `<label class="hi-field"><span>${ask === 'on-hold' ? 'Put on hold' : 'Cancel'}: why? It goes on the record.</span><input id="ovWhy" autocomplete="off" maxlength="300"></label><div class="hi-acts"><button type="button" class="hi-btn dark sm" data-ov-life-go>Record</button><button type="button" class="hi-btn sm ghost" data-ov-life-no>Not now</button></div>`
445
- : `<button type="button" class="hi-btn sm" data-ov-life="on-hold">Put on hold</button><button type="button" class="hi-btn sm ghost" data-ov-life="cancelled">Cancel</button>`;
483
+ : ask ? `<label class="hi-field"><span>Put on hold: why? It goes on the record.</span><input id="ovWhy" autocomplete="off" maxlength="300"></label><div class="hi-acts"><button type="button" class="hi-btn dark sm" data-ov-life-go>Record</button><button type="button" class="hi-btn sm ghost" data-ov-life-no>Not now</button></div>`
484
+ : `<button type="button" class="hi-btn sm" data-ov-life="on-hold">Put on hold</button>`; // Cancel merged into Won't do (batch 16 item 5c)
446
485
  const ck = mv.items.map((x) => `<span class="hi-ck${x.done ? ' on' : ''}"><i aria-hidden="true">${x.done ? SVG(I.check, 10, 3.5) : ''}</i>${esc(x.label)}</span>`).join('') || '<p class="hi-small">No exit item is on record for this stage.</p>';
447
486
  return `<div class="hi-vh2"><h2>${esc(mv.cur || 'No stage')}</h2></div>`
448
487
  + (X.ctx.S.H && X.ctx.S.H.steps ? `<div class="cz-ladder hi-lad" role="img" aria-label="${esc(X.ctx.S.H.ladderAria || '')}">${X.ctx.S.H.steps.map((s) => `<i class="${[s.cls, s.ms ? 'ms' : ''].filter(Boolean).join(' ')}" title="${esc(s.label)}"></i>`).join('')}</div>` : '')
@@ -3,44 +3,20 @@
3
3
  *
4
4
  * Each opens in the Viewer card (cozy-viewer.js), never the old dialog, and reads and writes through the routes the old pages used:
5
5
  * openSettings() the designed Settings (pm/cozy-settings.js, premium-uncovered-features E3)
6
- * openSources() the designed Sources (pm/cozy-sources.js, E3); readLine below gives its read lines
6
+ * openSources() Settings › Connectors, where each source's last read now lives (feedback batch 16 item 5); readLine below gives read lines
7
7
  * openMyWork(tab) home-work.js: the old My work page. Home no longer opens it (Home's list is the list); an item and Focus open alone;
8
8
  * keys and swipe on the rows (GET /api/my-work-premium; the /api/pm-items, /api/pm-jobs and /api/my-work presses)
9
9
  * openAround(key?) home-around.js: Around you is gone (premium-uncovered-features, HmAround); its views stay, opened from New for you
10
- * openEndOfDay() GET /api/phone-day: what finished today, the recap and tomorrow's meetings
11
10
  * openSearch(go) the designed Search (pm/cozy-search.js, E1): the repository and every worktree
12
- * openInbox(go) New for you (pm/cozy-news.js, E2), which replaces the agents' results
13
- * openRecorder() a note recorded now with no calendar event (the Viewer's newNote, else POST /api/notes/new)
14
- * moreItems the ⋯ menu's rows, [key, label, icon]: the features the place menu does not hold (Search, New for you, Sources and
15
- * Settings are in the place menu, cozy-nav.js)
11
+ * openInbox(go, view?) New for you's whole list (pm/cozy-news.js, E2), from the New for you fold of Your day; view opens one item
12
+ * openRecorder() a note recorded now with no calendar event (the Viewer's newNote, else POST /api/notes/new); + New › Recording
13
+ * More (the ⋯ of End of the day, Calendar and Record a note) is gone (feedback batch 16 item 5, FmAudit): End of the day is Your day after
14
+ * 17:00, the calendar is an icon in Your day's header, and a note is + New › Recording.
16
15
  * Every write is the PM's press (pmPost carries the launch nonce). Nothing here sends anything outside PMOS. */
17
- import { pmGet, pmPost } from './http.js';
18
- import { open as vwOpen } from './cozy-viewer.js';
19
16
 
20
- const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
21
- const wsQ = (pre = '?') => { const w = new URLSearchParams(location.search).get('ws'); return w ? pre + 'ws=' + encodeURIComponent(w) : ''; };
22
17
  export const WAIT = '<p class="hx-wait"><i aria-hidden="true"></i>Waiting for design</p>';
23
18
  const toast = (t) => { const el = document.getElementById('toast'); if (!el) return; el.textContent = t; el.classList.add('on'); clearTimeout(toast.t); toast.t = setTimeout(() => el.classList.remove('on'), 4200); };
24
19
  const when = (iso) => { const d = new Date(iso); if (Number.isNaN(d.getTime())) return ''; const p = (n) => String(n).padStart(2, '0'); return (d.toDateString() === new Date().toDateString() ? '' : d.getDate() + ' ' + d.toLocaleString('en-GB', { month: 'short' }) + ' ') + p(d.getHours()) + ':' + p(d.getMinutes()); };
25
- const row = (title, sub, right = '') => `<div class="hx-row"><span class="hx-t"><b>${esc(title)}</b>${sub ? `<em>${esc(sub)}</em>` : ''}</span>${right}</div>`;
26
- const btn = (label, attrs, pri) => `<button type="button" class="hx-b${pri ? ' pri' : ''}" ${attrs}>${esc(label)}</button>`;
27
- const sec = (h, inner) => `<section class="hx-sec"><h4>${esc(h)}</h4>${inner}</section>`;
28
- /** Open one feature in the Viewer: draw(body) is called again after each press. */
29
- function card(o, draw) {
30
- return vwOpen({ id: 'more:' + o.id, kind: o.kind, title: o.title, icon: o.icon, render: (body) => { body.classList.add('hx'); draw(body); } });
31
- }
32
-
33
- export const moreItems = [
34
- ['eod', 'End of the day', 'cal'], ['cal', 'Calendar', 'cal'], ['rec', 'Record a note', 'mic'],
35
- ];
36
-
37
- /** The ⋯ list itself in the Viewer, for a page with no menu of its own: items are [label, open]. */
38
- export function listCard(items) {
39
- return card({ id: 'more', kind: 'More', title: 'Waiting for design', icon: 'list' }, (b) => {
40
- b.innerHTML = WAIT + items.map(([l], i) => `<button type="button" class="hx-hit" data-i="${i}"><b>${esc(l)}</b></button>`).join('');
41
- b.onclick = (e) => { const t = e.target.closest('[data-i]'); if (t && items[+t.dataset.i][1]) items[+t.dataset.i][1](); };
42
- });
43
- }
44
20
 
45
21
  /* ── Settings ── the designed dialog (pm/cozy-settings.js) */
46
22
  export function openSettings(section) { return import('./cozy-settings.js').then((M) => M.openSettings(section)); }
@@ -58,8 +34,8 @@ export function readLine(s, ids) {
58
34
  return (der ? ({ brief: 'Brief' })[x.id] || x.label : x.label) + ' ' + w;
59
35
  }).filter(Boolean).join(' · ');
60
36
  }
61
- /** Sources: the designed card in the Viewer (pm/cozy-sources.js). */
62
- export function openSources() { return import('./cozy-sources.js').then((M) => M.openSources()); }
37
+ /** Sources: Settings › Connectors (feedback batch 16 item 5). */
38
+ export function openSources() { return openSettings('connectors'); }
63
39
 
64
40
  /* ── My work ── */
65
41
  /* ── My work ── the four tabs, the item with its fields and its agent, Focus and jobs, and the keys and swipe on the rows, in home-work.js */
@@ -68,30 +44,13 @@ export function openMyWork(tab = 'yours') { return import('./home-work.js').then
68
44
  /* ── Around you ── gone (HmAround): its parts have one home each, and New for you names them. key opens one of its views (home-around.js). */
69
45
  export function openAround(key) { return import('./home-around.js').then((M) => M.openAround(key)); }
70
46
 
71
- /* ── End of the day ── */
72
- export function openEndOfDay() {
73
- const M = { r: null };
74
- const draw = (b) => {
75
- const r = M.r;
76
- if (!r) { b.innerHTML = WAIT + '<p class="hx-n">Reading the day.</p>'; return; }
77
- if (!r.ok) { b.innerHTML = WAIT + `<p class="hx-n">The day could not be read${r.error ? ': ' + esc(r.error) : ''}.</p>`; return; }
78
- const fin = (r.finished || []).map((f) => row(f.title, f.status === 'review' ? 'Waits for your review' : f.status)).join('') || '<p class="hx-n">Nothing finished for you today.</p>';
79
- const rec = r.recap ? (r.recap.moved || []).map((m) => row(m.text, m.sub)).join('') || '<p class="hx-n">No decision, done item or draft today.</p>' : '';
80
- const tom = r.tomorrow ? (r.tomorrow.meetings || []).map((m) => row(m.title, new Date(m.start).toTimeString().slice(0, 5))).join('') || '<p class="hx-n">No meeting.</p>' : '';
81
- b.innerHTML = WAIT + sec('Finished for you', fin) + sec('How the day went', rec) + sec(r.tomorrow ? 'Tomorrow · ' + r.tomorrow.label : 'Tomorrow', tom);
82
- };
83
- const body = card({ id: 'eod', kind: 'End of the day', title: 'Today and tomorrow', icon: 'cal' }, draw);
84
- pmGet('/api/phone-day').then((r) => { M.r = r || { ok: false }; if (body.isConnected) draw(body); });
85
- return body;
86
- }
87
-
88
47
  /* ── Products ── gone (batch 12 item 5): the product chip on Home, Board and Insights is the one picker (pm/cozy-pick.js) */
89
48
 
90
49
  /* ── Search ── the designed palette (pm/cozy-search.js); go is the page's own opener for an initiative ({ ini }), a session ({ ses }) or a file ({ doc }) */
91
50
  export function openSearch(go) { return import('./cozy-search.js').then((M) => M.openSearch({ go })); }
92
51
 
93
- /* ── New for you ── it replaces the agents' results (the bell) and Around you (pm/cozy-news.js) */
94
- export function openInbox(go) { return import('./cozy-news.js').then((M) => M.openNews({ go })); }
52
+ /* ── New for you ── it replaces the agents' results (the bell) and Around you (pm/cozy-news.js); it opens from Your day's fold */
53
+ export function openInbox(go, view) { return import('./cozy-news.js').then((M) => M.openNews({ go, view: view || '' })); }
95
54
 
96
55
  /* ── record a note now ── */
97
56
  export async function openRecorder() {
@@ -267,10 +267,12 @@ export function todayHtml(T, o) {
267
267
  const MONTH = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
268
268
  const WEEKDAY = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
269
269
  const MOMENT = new Set(['rec', 'soon', 'live', 'eod', 'review']);
270
- /** M is homeList(); T todayCard(); o: { sel, ses (the initiative row whose pill is open), pOpen, restOpen, pin, avHtml, ready, err, pick (GET /api/briefing-premium/products), tones, review, phone, day (Your day is open) } */
270
+ /** M is homeList(); T todayCard(); o: { sel, ses (the initiative row whose pill is open), pOpen, restOpen, pin, avHtml, ready, err, pick (GET /api/briefing-premium/products), tones, review, phone, day (Your day is open), news (how many items are new for you) } */
271
271
  export function listHtml(M, T, o) {
272
272
  const flt = M.filter !== 'today' ? M.filters.find((f) => f.key === M.filter) : null;
273
- const head = `<div class="hm-hd hv-bar"><button type="button" class="hv-hi" data-hm-day aria-expanded="${!!o.day}" aria-label="${esc(M.word || 'Today')}. Open your day">${AD.adler(o.err ? 'honest' : 'handled', 36, { label: false, cls: 'hv-ad' })}<b>${esc(M.word || 'Today')}</b>${svg(P.chevD, 18)}</button>`
273
+ // the blue dot after "Good morning": something is new for you, in Your day's New for you fold (feedback batch 16 item 5b, FmA4Desk)
274
+ const nw = o.news > 0 ? '. ' + o.news + ' new for you' : '';
275
+ const head = `<div class="hm-hd hv-bar"><button type="button" class="hv-hi" data-hm-day aria-expanded="${!!o.day}" aria-label="${esc(M.word || 'Today')}${nw}. Open your day">${AD.adler(o.err ? 'honest' : 'handled', 36, { label: false, cls: 'hv-ad' })}<b>${esc(M.word || 'Today')}</b>${o.news > 0 ? '<i class="hv-nd" aria-hidden="true"></i>' : ''}${svg(P.chevD, 18)}</button>`
274
276
  // the product chip, always (it is also the way to add one): the ticked products' tiles, or All (canvas XhpA2States)
275
277
  + (o.pick ? chipHtml(o.pick, { id: 'hmPick', attrs: 'data-hm-pick', label: 'Products on Home', tones: o.tones }) : '')
276
278
  + (o.phone ? '' : `<button type="button" class="ut-ib hv-ib${flt ? ' on' : ''}" data-hm-flt aria-haspopup="menu" aria-label="Show: Today, Kept or Done${flt ? '. Now ' + esc(flt.label) : ''}" title="Show: Today, Kept or Done">${svg(P.filter, 18)}</button>`)
@@ -1,54 +1,90 @@
1
- /* pm/ini-more.js — the ONE initiative ⋯ menu (feedback batch 14 item 5): Home's initiative page (home-ini.js) and the Board's initiative
2
- * panel (bd-ini-panel.js) both build their ⋯ here, so the items, their words and their order cannot drift apart again.
1
+ /* pm/ini-more.js — the ONE initiative ⋯ menu and the stage chip's picker (feedback batch 14 item 5; shortened by batch 16 item 5c, canvas
2
+ * FmIMap, FmI1Menu, FmI2Stage, FmI3Deleted): Home's initiative page (home-ini.js) and the Board's initiative panel (bd-ini-panel.js) both build
3
+ * them here, so the items, their words and their order cannot drift apart again.
3
4
  *
4
- * iniMore(c) → the Viewer's more list ([{ label, note?, on(btn), danger? } | { sep: true }]). c holds what the page can do; a missing
5
- * press (null, false, undefined) hides its item. The page decides when an item applies (the PMOS-self board, an ended
6
- * initiative, no stages); this module decides only the words and the order:
7
- * change it wf { name, on }, rename, auto { on: bool, press }, back { prev, on }, toStage, dates, person
8
- * its place sm [split, merge items], pm [program move items], turnProgram (only when pm is empty)
9
- * look at it jira, board, record, link, text
10
- * end it ended (true: Back to Triage in place of Won't do), wontDo, backToTriage, archive
11
- * stop it hold, or resume when it is on hold; cancel (red, last)
12
- * iniText(title, view, tickets) the initiative as plain text, for Copy as text: the summary, the stage, the open tasks and tickets.
5
+ * iniMore(c) → the Viewer's more list ([{ label, note?, icon?, on(btn), danger? } | { sep: true }]). Seven entries at most:
6
+ * Split into a new initiative, Merge into ›, Program ›, Open on the Board, Copy › (Link, Text), The record, then Delete.
7
+ * c holds what the page can do; a missing press (null, false, undefined) hides its item:
8
+ * sm [split, merge items] · pm [the Program item] · board · link · text · record · del
9
+ * Every other action sits on the thing it changes (ini-view.js): the title renames, the workflow chip changes the
10
+ * workflow, the dashed + adds a stakeholder, the dates chip changes the plan dates, the stage chip opens stagePick, and
11
+ * the ↻ beside Jira's freshness reads Jira again. Cancel the initiative is gone: Won't do says the same and keeps the record.
12
+ * stagePick(anchor, c) the stage chip's picker, under the chip (a sheet on a phone): every stage with the current one marked (a press moves
13
+ * forward or back), the "Moves on by itself" switch, then Put on hold or Resume, Won't do or Back to Triage, and Archive.
14
+ * c: { title, stages: [{ name, ms, note? }], cur, go(name, anchor) | null, auto: { on, press } | null, hold, resume, wontDo,
15
+ * backToTriage, archive } (each a press, or null when it does not apply)
16
+ * listMenu(anchor, label, rows) a small menu under anchor: rows [{ label, sub?, icon?, on?, go(anchor) }] (Copy ›)
17
+ * iniText(title, view, tickets) the initiative as plain text, for Copy › Text: the summary, the stage, the open tasks and tickets.
18
+ * deleteSaid(title, n) the Delete toast: "Deleted Email OTP and its 67 tasks"
13
19
  * ORDER every label in menu order, for the tests and the guide.
14
20
  * "Open in full" is not here: the header's expand already opens it wide (say it once). */
21
+ import { openPop, closePop } from './hi-pop.js';
15
22
 
16
- export const ORDER = ['Change workflow', 'Rename', 'Moves on by itself', 'Move back a stage', 'Move to a stage', 'Change the plan dates', 'Add a stakeholder',
17
- 'Split into a new initiative', 'Merge into', 'Move out of', 'Move to another program', 'Turn into a program',
18
- 'Read Jira again', 'Open on the Board', 'The record', 'Copy link', 'Copy as text',
19
- 'Won’t do', 'Back to Triage', 'Archive',
20
- 'Put on hold', 'Resume', 'Cancel the initiative'];
23
+ export const ORDER = ['Split into a new initiative', 'Merge into', 'Program', 'Open on the Board', 'Copy', 'The record', 'Delete'];
24
+ export const DELETE_MS = 8000; // the Delete toast's Undo stays 8 seconds (FmI3Deleted)
25
+
26
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
27
+ const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
28
+ export const ICON = {
29
+ board: 'M4 5h4v14H4zM10 5h4v9h-4zM16 5h4v11h-4z', copy: 'M9 9h10v11H9zM5 15V4h10', record: 'M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16M12 8v4l3 2',
30
+ del: 'M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13M10 11v6M14 11v6', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1',
31
+ text: 'M5 6h14M5 10h14M5 14h10M5 18h8', hold: 'M9 6v12M15 6v12', resume: 'M8 5l11 7-11 7z', wont: 'M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16M6.5 6.5l11 11',
32
+ triage: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', archive: 'M4 5h16v4H4zM6 9v10h12V9M10 13h4',
33
+ };
21
34
 
22
35
  export function iniMore(c) {
23
- const G = [[], [], [], [], []];
24
- const [change, place, look, end, stop] = G;
25
- if (c.wf) change.push({ label: 'Change workflow', note: c.wf.name || 'Product feature', on: c.wf.on });
26
- if (c.rename) change.push({ label: 'Rename', on: c.rename });
27
- if (c.auto) change.push({ label: 'Moves on by itself', note: c.auto.on ? 'On' : 'Off', on: c.auto.press });
28
- if (c.back) change.push({ label: 'Move back a stage', note: c.back.prev, on: c.back.on });
29
- if (c.toStage) change.push({ label: 'Move to a stage', on: c.toStage });
30
- if (c.dates) change.push({ label: 'Change the plan dates', on: c.dates });
31
- if (c.person) change.push({ label: 'Add a stakeholder', on: c.person });
32
- // split or merge above the program moves (batch 11 item 14, canvas XsmA1Menu); an initiative in no program can become one (P7)
33
- place.push(...(c.sm || []), ...(c.pm || []));
34
- if (c.turnProgram && !(c.pm || []).length) place.push({ label: 'Turn into a program', on: c.turnProgram });
35
- if (c.jira) look.push({ label: 'Read Jira again', on: c.jira });
36
- if (c.board) look.push({ label: 'Open on the Board', on: c.board });
37
- if (c.record) look.push({ label: 'The record', on: c.record });
38
- if (c.link) look.push({ label: 'Copy link', on: c.link });
39
- if (c.text) look.push({ label: 'Copy as text', on: c.text });
40
- // Won't do and Archive hold from any stage (wfRules); Won't do comes back to Triage (D99, WfAWontDo)
41
- if (c.ended ? c.backToTriage : c.wontDo) end.push(c.ended ? { label: 'Back to Triage', on: c.backToTriage } : { label: 'Won’t do', on: c.wontDo });
42
- if (c.archive) end.push({ label: 'Archive', on: c.archive });
43
- if (c.hold) stop.push({ label: 'Put on hold', on: c.hold });
44
- else if (c.resume) stop.push({ label: 'Resume', on: c.resume });
45
- if (c.cancel) stop.push({ label: 'Cancel the initiative', danger: true, on: c.cancel });
46
36
  const out = [];
47
- for (const g of G) if (g.length) out.push(...(out.length ? [{ sep: true }] : []), ...g);
37
+ // split or merge, then the one Program picker (batch 11 items 2 and 14; batch 16 item 5c)
38
+ out.push(...(c.sm || []), ...(c.pm || []).filter(Boolean));
39
+ if (c.board) out.push({ label: 'Open on the Board', icon: ICON.board, on: c.board });
40
+ if (c.link || c.text) {
41
+ const rows = [c.link ? { label: 'Link', icon: ICON.link, go: c.link } : null, c.text ? { label: 'Text', icon: ICON.text, go: c.text } : null].filter(Boolean);
42
+ out.push({ label: 'Copy', icon: ICON.copy, note: rows.map((x) => x.label).join(' · '), on: (b) => listMenu(b, 'Copy', rows) });
43
+ }
44
+ if (c.record) out.push({ label: 'The record', icon: ICON.record, on: c.record });
45
+ if (c.del) out.push(...(out.length ? [{ sep: true }] : []), { label: 'Delete', icon: ICON.del, danger: true, on: c.del });
48
46
  return out;
49
47
  }
50
48
 
51
- /** The initiative as plain text, for Copy as text: the summary, the stage and the open tasks (the one view's model, ini-view-model.js). */
49
+ const anchorOf = (b) => (b && b.isConnected ? b : (typeof document !== 'undefined' && document.querySelector('#czViewer [data-cz-vw="more"]')) || document.body);
50
+ export function listMenu(anchor, label, rows) {
51
+ const a = anchorOf(anchor);
52
+ openPop(a, 'menu', `<p class="hi-mlbl">${esc(label)}</p>` + rows.map((x, i) => `<button type="button" class="hi-mi${x.on ? ' on' : ''}" role="menuitem" data-hi-mi="${i}">${x.icon ? SVG(x.icon, 16) : ''}<span>${esc(x.label)}</span>${x.sub ? `<em>${esc(x.sub)}</em>` : ''}</button>`).join(''),
53
+ (b) => { const it = rows[+b.dataset.hiMi]; closePop(); if (it && it.go) it.go(a); }, { menu: true, label });
54
+ }
55
+
56
+ /* ── the stage chip's picker (FmI2Stage) ── */
57
+ const FOLD_AFTER = 3; // stages shown after the current one before the rest fold into one row
58
+ export function stagePick(anchor, c, all = false) {
59
+ const st = c.stages || [], at = Math.max(0, st.findIndex((s) => s.name === c.cur));
60
+ const cut = !all && st.length > at + 1 + FOLD_AFTER + 1 ? at + 1 + FOLD_AFTER : st.length;
61
+ const row = (s, i) => {
62
+ const now = s.name === c.cur, note = now ? 'now' : i < at ? 'done' : s.note || '';
63
+ return `<button type="button" class="hi-mi hi-sp${now ? ' on' : ''}" role="menuitemradio" aria-checked="${now}" data-sp-go="${i}"${!c.go && !now ? ' disabled' : ''}><i class="hi-spn${s.ms ? ' ms' : ''}" aria-hidden="true">${s.ms ? '' : i + 1}</i><span>${esc(s.name)}</span>${note ? `<em>${note}</em>` : ''}</button>`;
64
+ };
65
+ const rest = st.slice(cut);
66
+ const more = rest.length ? `<button type="button" class="hi-mi hi-spm" data-sp-all aria-label="${esc('Show stages ' + (cut + 1) + ' to ' + st.length)}"><span>${cut + 1}–${st.length} ${esc(rest[0].name)} to ${esc(rest[rest.length - 1].name)}</span></button>` : '';
67
+ const sw = c.auto ? `<div class="hi-mi hi-spw"><span id="hiSpAuto">Moves on by itself</span><button type="button" class="hi-sw" role="switch" aria-checked="${!!c.auto.on}" aria-labelledby="hiSpAuto" data-sp-auto></button></div>` : '';
68
+ const life = [
69
+ c.hold ? ['hold', 'Put on hold', ICON.hold] : c.resume ? ['resume', 'Resume', ICON.resume] : null,
70
+ c.wontDo ? ['wontDo', 'Won’t do', ICON.wont] : c.backToTriage ? ['backToTriage', 'Back to Triage', ICON.triage] : null,
71
+ c.archive ? ['archive', 'Archive', ICON.archive] : null,
72
+ ].filter(Boolean).map(([k, l, ic]) => `<button type="button" class="hi-mi" role="menuitem" data-sp-life="${k}">${SVG(ic, 16)}<span>${l}</span></button>`).join('');
73
+ const html = st.slice(0, cut).map(row).join('') + more + sw + (life ? '<div class="hi-hr"></div>' + life : '');
74
+ const a = anchor;
75
+ openPop(a, 'stage', html || '<p class="hi-mlbl">No stage on record.</p>', (b, el) => {
76
+ const d = b.dataset;
77
+ if ('spAll' in d) { stagePick(a, c, true); return; }
78
+ if ('spAuto' in d) { const on = b.getAttribute('aria-checked') !== 'true'; b.setAttribute('aria-checked', String(on)); c.auto.on = on; c.auto.press(on); return; }
79
+ if (d.spGo != null) { const s = st[+d.spGo]; closePop(); if (s && s.name !== c.cur && c.go) c.go(s.name, a); return; }
80
+ if (d.spLife && c[d.spLife]) { closePop(); c[d.spLife](a); }
81
+ }, { menu: true, sheet: true, label: 'Stage of ' + (c.title || 'the initiative'), focus: '.hi-sp.on, .hi-mi' });
82
+ }
83
+
84
+ /** The Delete toast's words (FmI3Deleted): the name and how many tasks went with it; zero tasks is silence. */
85
+ export const deleteSaid = (title, n) => 'Deleted ' + title + (n ? ' and its ' + n + (n === 1 ? ' task' : ' tasks') : '');
86
+
87
+ /** The initiative as plain text, for Copy › Text: the summary, the stage and the open tasks (the one view's model, ini-view-model.js). */
52
88
  export function iniText(title, v, tickets) {
53
89
  const lines = [title];
54
90
  if (v) {
@@ -63,5 +99,5 @@ export function iniText(title, v, tickets) {
63
99
  return lines.join('\n');
64
100
  }
65
101
 
66
- /** The initiative's own address (the initiative page), for Copy link: the same on Home and the Board. */
102
+ /** The initiative's own address (the initiative page), for Copy › Link: the same on Home and the Board. */
67
103
  export const pageHref = (id, ws, board) => '/premium-initiative.html?id=' + encodeURIComponent(id) + (ws ? '&ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(board || ws) : '');
@@ -267,7 +267,7 @@ export function iniView(r, ctx = {}) {
267
267
  summary.wf = r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' };
268
268
  summary.program = ctx.program || null;
269
269
  const today2 = (n) => String(n).padStart(2, '0');
270
- return { vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r),
270
+ return { vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jira ? ctx.jiraAt || '' : '',
271
271
  // split or merge (batch 11 item 14): Claude's suggestion for it, and where its work went when it was merged
272
272
  suggest: r.suggest || null, merged: mergedOf(r),
273
273
  // what Claude proposes under the one blue ✦, and what a ✓ kept from elsewhere (batch 12 items 2, 3 and 4; pm/ini-props.js)
@@ -658,3 +658,20 @@ button.lk-mt:hover { color: var(--cz-ink) !important; }
658
658
  .iv-fd b { font-size: var(--fs-3); font-weight: 700; }
659
659
  .iv-fd small { font-size: var(--fs-2); color: var(--cz-ink3); }
660
660
  @media (max-width: 760px) { .pp .pp-ib { width: 40px; height: 40px; } .pp-its { margin-left: 12px; } }
661
+
662
+ /* what left the ⋯ for the thing it changes (batch 16 item 5c, canvas FmI2Stage): the stage chip, the dates chip, the dashed + after the
663
+ * people, the ↻ beside Jira's freshness in Linked */
664
+ .iv-stc, .iv-dtc { display: inline-flex !important; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px !important; border-radius: 12px !important; font-size: var(--fs-2); font-weight: 700; min-width: 0; }
665
+ .iv-stc { background: var(--cz-bluebg) !important; color: var(--cz-blueink) !important; }
666
+ .iv-stc b { font-size: var(--fs-3); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
667
+ .iv-stc:hover { filter: brightness(.97); }
668
+ .iv-dtc { background: var(--cz-well) !important; color: var(--cz-ink2) !important; white-space: nowrap; }
669
+ .iv-dtc:hover { background: var(--cz-well2) !important; color: var(--cz-ink) !important; }
670
+ .iv-addp { width: 22px !important; height: 22px; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--cz-ink3) 60%, var(--cz-card)) !important; color: var(--cz-ink3); display: inline-flex !important; align-items: center; justify-content: center; margin-left: 4px; flex: none; }
671
+ .iv-addp:hover { color: var(--cz-ink); border-color: var(--cz-ink3) !important; }
672
+ .iv-jfr { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-2); color: var(--cz-ink3); padding-left: 4px; }
673
+ @media (max-width: 760px) {
674
+ .iv-sch > .iv-stc { flex: 0 1 auto; }
675
+ .iv-stc, .iv-dtc { min-height: 36px; }
676
+ .iv-addp { width: 30px !important; height: 30px; }
677
+ }