create-pmos 0.609.0 → 0.611.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 (145) hide show
  1. package/package.json +69 -27
  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-columns-test.js +2 -1
  7. package/workspace/board-deliveries-test.js +2 -1
  8. package/workspace/board-programs-test.js +9 -5
  9. package/workspace/board-publish-ui-test.js +2 -1
  10. package/workspace/board-shared-ui-test.js +2 -1
  11. package/workspace/board-workflows-test.js +2 -1
  12. package/workspace/briefing-premium-adddoc-test.js +2 -1
  13. package/workspace/briefing-premium-board-test.js +10 -9
  14. package/workspace/briefing-premium-doc-edit-test.js +2 -1
  15. package/workspace/briefing-premium-initiative-test.js +7 -6
  16. package/workspace/briefing-premium-insights-test.js +12 -11
  17. package/workspace/briefing-premium-products-test.js +4 -2
  18. package/workspace/briefing-premium-sources-test.js +1 -1
  19. package/workspace/briefing-premium-test.js +6 -5
  20. package/workspace/briefing-premium-work-test.js +1 -1
  21. package/workspace/calm-timeline-test.js +2 -1
  22. package/workspace/changelog.json +68 -0
  23. package/workspace/core-docs-workflow-test.js +2 -1
  24. package/workspace/ev-everywhere-test.js +11 -10
  25. package/workspace/guide/home.md +2 -2
  26. package/workspace/guide/index.md +4 -0
  27. package/workspace/guide/layout.md +92 -11
  28. package/workspace/guide/programs.md +16 -2
  29. package/workspace/guide/routine.md +50 -0
  30. package/workspace/guide/scheduled-tasks-and-cli.md +1 -1
  31. package/workspace/guide/settings-and-switches.md +1 -1
  32. package/workspace/home-other-product-test.js +2 -1
  33. package/workspace/home-railcard-test.js +2 -1
  34. package/workspace/impact-screens-test.js +3 -1
  35. package/workspace/ini-workflow-test.js +2 -1
  36. package/workspace/lib/beside-page.js +15 -0
  37. package/workspace/lib/classic-board.js +15 -0
  38. package/workspace/lib/events-place.js +216 -0
  39. package/workspace/lib/library-items.js +78 -0
  40. package/workspace/lib/notes.js +6 -1
  41. package/workspace/lib/route-modules.js +4 -0
  42. package/workspace/lib/routes-events-place.js +166 -0
  43. package/workspace/lib/routes-library.js +89 -0
  44. package/workspace/lib/routes-pop-work.js +39 -0
  45. package/workspace/lib/routes-report-setups.js +20 -0
  46. package/workspace/lib/routes-today-log.js +48 -0
  47. package/workspace/lib/routine-reports.js +52 -0
  48. package/workspace/lib/today-log.js +131 -0
  49. package/workspace/live-pill-round-test.js +11 -9
  50. package/workspace/metric-drafts-ui-test.js +3 -1
  51. package/workspace/milestone-pins-test.js +2 -1
  52. package/workspace/milestone-suggest-test.js +3 -1
  53. package/workspace/package-lock.json +2 -2
  54. package/workspace/package.json +1 -1
  55. package/workspace/panels-test.js +6 -4
  56. package/workspace/premium-board-actions-test.js +3 -1
  57. package/workspace/premium-chat-context-test.js +6 -6
  58. package/workspace/premium-chat-line-test.js +1 -1
  59. package/workspace/premium-chat-notes-test.js +1 -1
  60. package/workspace/premium-core-doc-issue-test.js +2 -1
  61. package/workspace/premium-rec-tab-test.js +2 -1
  62. package/workspace/premium-vw-backlog-test.js +3 -1
  63. package/workspace/premium-vw-cal-test.js +1 -1
  64. package/workspace/premium-vw-doc-test.js +2 -1
  65. package/workspace/premium-vw-item-test.js +3 -1
  66. package/workspace/premium-vw-jira-test.js +3 -1
  67. package/workspace/product-lane-test.js +2 -1
  68. package/workspace/program-charter-test.js +3 -1
  69. package/workspace/program-leave-test.js +3 -1
  70. package/workspace/program-order-test.js +2 -1
  71. package/workspace/program-panel-test.js +5 -3
  72. package/workspace/public/pm/bd-ini-panel.js +75 -8
  73. package/workspace/public/pm/bd-prog-panel.js +55 -8
  74. package/workspace/public/pm/bd-scroll.js +4 -2
  75. package/workspace/public/pm/bd-work.css +130 -0
  76. package/workspace/public/pm/bd-work.js +356 -0
  77. package/workspace/public/pm/cozy-board.css +3 -0
  78. package/workspace/public/pm/cozy-ev.css +52 -0
  79. package/workspace/public/pm/cozy-events-view.js +142 -0
  80. package/workspace/public/pm/cozy-events.css +107 -0
  81. package/workspace/public/pm/cozy-events.js +210 -0
  82. package/workspace/public/pm/cozy-evmodel.js +1 -1
  83. package/workspace/public/pm/cozy-library.css +36 -0
  84. package/workspace/public/pm/cozy-live-pill.js +3 -1
  85. package/workspace/public/pm/cozy-nav.js +70 -7
  86. package/workspace/public/pm/cozy-panels.js +1 -1
  87. package/workspace/public/pm/cozy-pick.css +3 -0
  88. package/workspace/public/pm/cozy-pick.js +6 -2
  89. package/workspace/public/pm/cozy-pop-work.css +165 -0
  90. package/workspace/public/pm/cozy-pop-work.js +427 -0
  91. package/workspace/public/pm/cozy-popup.css +113 -0
  92. package/workspace/public/pm/cozy-popup.js +408 -0
  93. package/workspace/public/pm/cozy-routine-model.js +111 -0
  94. package/workspace/public/pm/cozy-routine-pop.js +196 -0
  95. package/workspace/public/pm/cozy-routine.css +102 -0
  96. package/workspace/public/pm/cozy-routine.js +156 -0
  97. package/workspace/public/pm/cozy-schedwork.js +6 -5
  98. package/workspace/public/pm/cozy-settings.js +10 -1
  99. package/workspace/public/pm/cozy-today-app.js +236 -0
  100. package/workspace/public/pm/cozy-today-model.js +176 -0
  101. package/workspace/public/pm/cozy-today-page.css +100 -0
  102. package/workspace/public/pm/cozy-today-view.js +76 -0
  103. package/workspace/public/pm/cozy-viewer.js +66 -18
  104. package/workspace/public/pm/home-app.js +29 -6
  105. package/workspace/public/pm/home-ini.js +39 -7
  106. package/workspace/public/pm/library-model.js +69 -0
  107. package/workspace/public/pm/library-open.js +34 -0
  108. package/workspace/public/pm/page-chat.js +16 -4
  109. package/workspace/public/pm/pop-sessions.js +65 -0
  110. package/workspace/public/pm/pop-work-model.js +335 -0
  111. package/workspace/public/pm/premium-board.js +137 -11
  112. package/workspace/public/pm/premium-insights.js +14 -2
  113. package/workspace/public/pm/premium-library.js +122 -0
  114. package/workspace/public/pm/premium-shell.js +1 -1
  115. package/workspace/public/premium-board.html +1 -0
  116. package/workspace/public/premium-events.html +42 -0
  117. package/workspace/public/premium-library.html +31 -0
  118. package/workspace/public/premium-routine.html +31 -0
  119. package/workspace/public/today.html +50 -0
  120. package/workspace/ready-dash-ui-test.js +3 -1
  121. package/workspace/rename-test.js +2 -1
  122. package/workspace/run-tests.js +4 -1
  123. package/workspace/server.js +3 -2
  124. package/workspace/sort-order-test.js +2 -1
  125. package/workspace/split-merge-ui-test.js +3 -1
  126. package/workspace/stage-card-tasks-test.js +5 -3
  127. package/workspace/stage-card-test.js +2 -1
  128. package/workspace/task-card-test.js +2 -1
  129. package/workspace/task-delete-test.js +3 -1
  130. package/workspace/task-links-test.js +4 -2
  131. package/workspace/task-milestones-test.js +4 -2
  132. package/workspace/task-plans-test.js +3 -1
  133. package/workspace/task-press-test.js +3 -1
  134. package/workspace/task-views-test.js +10 -8
  135. package/workspace/test-lists/events-place.json +11 -0
  136. package/workspace/test-lists/library-place.json +9 -0
  137. package/workspace/test-lists/one-popup.json +9 -0
  138. package/workspace/test-lists/pop-work.json +9 -0
  139. package/workspace/test-lists/routine-place.json +9 -0
  140. package/workspace/test-lists/today-log.json +9 -0
  141. package/workspace/test-lists/work-view.json +9 -0
  142. package/workspace/timeline-holds-test.js +3 -1
  143. package/workspace/tk-tasks-test.js +3 -1
  144. package/workspace/viewer-trail-test.js +1 -1
  145. package/workspace/workflows-setup-test.js +1 -1
@@ -64,6 +64,11 @@
64
64
  * trail; Back at the first item closes the Viewer. Close (×, Escape, close()) takes the trail's entries off again, so Back never
65
65
  * lands on a closed item. A page writes its own address with replaceUrl(url), which waits while the history is still moving.
66
66
  * placeholder(featureName, { kind?, icon? }) opens the card with czPlaceholder(featureName) in it (cozy-placeholder.js)
67
+ * The popup (slice 2 of the six-place navigation, boards 3, 7, 23; pm/cozy-popup.js): open({ pop: { … } }) on a desk puts the item in a
68
+ * Viewer of its own on the left of the near-full popup, with the chat on its right. pop is what the chat is about (cozy-popup.js show()).
69
+ * A press inside the popup (the Viewer or the chat beside it) drills in there; the header then shows the path and ←. That Viewer has no
70
+ * grip, ⤢, × or Discuss (the popup has its own grip, × and chat), and the panels engine never counts it: it is the one slide-over.
71
+ * popHook({ host(), show(pop) }) is how cozy-popup.js registers · popOpen() → whether it shows · closePop() closes it (its guard asks first)
67
72
  * onChange(fn) → fn({ open, id, kind, title, via }) after each open and close (via 'history' when the browser's Back closed it); document also gets the event 'cz-viewer' with the same detail.
68
73
  * czSummary({ line, tone, right, text, meta, primary, also, extra }) → the summary card's markup: one line of state, the words, one quiet meta
69
74
  * line and ONE primary press ({ label, act } → data-czs-act="<act>", or { label, href }). tone 'you' (blue dot), 'warn' (amber), 'live' (red).
@@ -121,17 +126,27 @@ const kindKey = (k) => String(k || 'item').trim().toLowerCase().replace(/^file
121
126
  * key or the last open() went to, so the exported API always speaks of the Viewer used last. G is what the page has once: its list's rail,
122
127
  * the listeners, the rail's card. Only the first instance (#czViewer) writes the browser history; another keeps its own ← → trail.
123
128
  * Without cozy-panels.js (Board, Intelligence) the limit stays 1 and there is one Viewer, as before. */
124
- const G = { chat: null, subs: [], card: null, railKey: null, rail: false, lw: 0, hold: 0, tick: 0, limit: 1, beside: null, place: null, managed: null, own: null };
129
+ const G = { chat: null, subs: [], card: null, railKey: null, rail: false, lw: 0, hold: 0, tick: 0, limit: 1, beside: null, place: null, managed: null, own: null, popH: null, popNext: null };
125
130
  /** The list's fold, when the page owns it (Home, batch 20 item 6): { folded() → bool, show() }. Then only the list's own icon folds or unfolds it:
126
131
  * a Viewer's width, its reset, open wide and its close never do. null: the Viewer folds the list to a rail as it needs (a page without one). */
127
132
  export function listFold(o) { G.own = o && typeof o.folded === 'function' ? o : null; }
128
133
  const owned = () => (G.own ? !!G.own.folded() : null);
129
134
  /** true: the PM has pressed the list's fold or unfold, so a full Viewer keeps the list as the PM left it (no starting fold). */
130
135
  const chosen = () => !!(G.own && typeof G.own.chosen === 'function' && G.own.chosen());
131
- const mk = (i) => ({ i, el: null, cur: null, back: null, stack: [], fwd: [], wide: false, w: 0, drill: false, over: false, used: 0, ph: false, via: '' });
136
+ const mk = (i) => ({ i, el: null, cur: null, back: null, stack: [], fwd: [], wide: false, w: 0, drill: false, over: false, used: 0, ph: false, via: '', pop: false });
132
137
  let V = mk(0);
133
138
  const ALL = [V];
134
139
  const shown = (x) => !!(x && x.el && !x.el.hidden && x.cur);
140
+ /** The Viewers of the page, without the popup's (the panels engine and a drop beside never use it). */
141
+ const side = () => ALL.filter((x) => !x.pop);
142
+ /** The popup's Viewer is the first one (#czViewer), lifted into the popup while it shows, so every page's own selectors still find it.
143
+ * An item it showed beside the page closes first (the popup takes its place); on close it goes back to the page's host (close()). */
144
+ function popInst() {
145
+ const x = ALL[0];
146
+ if (!x.pop && shown(x)) on(x, () => close());
147
+ x.pop = true; if (x.el) x.el.classList.add('cz-vw-pop');
148
+ return x;
149
+ }
135
150
  /** The open Viewer used last (or null). */
136
151
  const mru = () => ALL.filter(shown).sort((a, b) => b.used - a.used)[0] || null;
137
152
  /** A press, a key or an open on this instance: it is the one in use now. */
@@ -143,16 +158,16 @@ function on(x, fn) { const was = V; V = x; try { return fn(); } finally { V = wa
143
158
  function pick(o) {
144
159
  const b = G.beside; G.beside = null;
145
160
  if (b && Date.now() - b.t < 6000) {
146
- const free = ALL.find((x) => !shown(x));
161
+ const free = side().find((x) => !shown(x));
147
162
  if (free) return free;
148
163
  if (ALL.length < G.limit) { const n = mk(ALL.length); ALL.push(n); return n; }
149
- return ALL.filter(shown).sort((a, c) => a.used - c.used)[0];
164
+ return side().filter(shown).sort((a, c) => a.used - c.used)[0];
150
165
  }
151
166
  const p = H.press && Date.now() - H.press.t < 10000 ? H.press : null;
152
167
  if (p && p.inst && shown(p.inst) && !o.fresh) {
153
168
  // a Viewer that holds a chat (outward: the Board's chat panel) opens what it names in the other Viewer, as Home's chat column does;
154
169
  // with no other Viewer it drills in, and ← comes back to the chat
155
- const other = p.inst.cur && p.inst.cur.args && p.inst.cur.args.outward ? ALL.filter((x) => shown(x) && x !== p.inst).sort((a, c) => c.used - a.used)[0] : null;
170
+ const other = p.inst.cur && p.inst.cur.args && p.inst.cur.args.outward ? side().filter((x) => shown(x) && x !== p.inst).sort((a, c) => c.used - a.used)[0] : null;
156
171
  return other || p.inst;
157
172
  }
158
173
  return mru() || ALL[0];
@@ -175,7 +190,7 @@ export function headHtml(it) {
175
190
  const o = it || {};
176
191
  const phone = !!o.phone;
177
192
  const kind = o.kind && !sameAs(o.kind, o.title) ? `<p class="cz-vw-kind">${esc(o.kind)}</p>` : '';
178
- const disc = o.discuss && (!o.home || o.discussHome) ? ib('discuss', 'Discuss in chat', P.chat) : '';
193
+ const disc = o.discuss && !o.pop && (!o.home || o.discussHome) ? ib('discuss', 'Discuss in chat', P.chat) : ''; // in the popup the chat is beside it
179
194
  // a press marked menu (the initiative's Dashboard, batch 18 item 1) goes into ⋯ on a phone, so the title keeps the room
180
195
  const inMenu = phone && (o.presses || []).some((x) => x && x.menu && x.act && x.label);
181
196
  const more = inMenu || typeof o.more === 'function' || (Array.isArray(o.more) && o.more.some((m) => m && !m.sep)) || o.url ? ib('more', 'More', P.more, ' aria-haspopup="menu" aria-expanded="false"') : '';
@@ -187,17 +202,19 @@ export function headHtml(it) {
187
202
  // lead: a press that stands before Discuss (the initiative's kind of work, batch 29 item 11, KdV1-3)
188
203
  const lead = shown.filter((x) => x.lead).map(pressHtml).join(''), own = shown.filter((x) => !x.lead).map(pressHtml).join('');
189
204
  const sub = o.sub ? `<p class="cz-vw-sub">${esc(o.sub)}</p>` : '';
205
+ // the popup's path (board 22: initiative › suggestion): each step behind is a press that goes back to it
206
+ const pth = o.pop && (o.path || []).length ? `<nav class="cz-vw-path" aria-label="Path">${o.path.map((t, i, a) => `<button type="button" data-cz-vw-path="${i - a.length}">${esc(t || 'Back')}</button><span aria-hidden="true">›</span>`).join('')}</nav>` : '';
190
207
  const chip = o.chip && (o.chip.n > 0 || o.chip.looking) ? `<button type="button" class="cz-vw-chip${o.chip.looking ? ' live' : ''}" data-cz-vw="chip" aria-haspopup="dialog" aria-label="${esc(o.chip.label || 'PMOS proposes ' + o.chip.n + '. Open')}" title="${esc(o.chip.label || 'PMOS proposes')}">${svg(ICONS.spark, 13, 2)}${o.chip.n > 0 && !o.chip.quiet ? `<b>${esc(o.chip.n)}</b>` : ''}</button>` : '';
191
208
  return (o.canBack || phone ? ib('back', o.canBack ? (o.backTo ? 'Back to ' + o.backTo : 'Back') : 'Close the viewer', P.back) : '')
192
209
  + (o.fwdTo ? ib('fwd', 'Forward to ' + o.fwdTo, P.fwd) : '')
193
210
  + (o.check ? `<button type="button" class="cz-vw-tile cz-vw-chk s-${esc(o.check.state || 'todo')}" data-cz-vw="press" data-cz-vw-p="check" aria-label="${esc(o.check.label || 'Mark done')}" title="${esc(o.check.title || o.check.label || 'Mark done')}"${o.check.disabled ? ' disabled' : ''}><span class="bx"></span></button>`
194
211
  : `<span class="cz-vw-tile" aria-hidden="true">${svg(path(o.icon), 17)}</span>`)
195
- + (o.renaming ? renHtml(o) : `<div class="cz-vw-t">${kind}<h3 class="cz-vw-title${chip ? ' has-chip' : ''}${o.wrap ? ' wrap' : ''}" id="czVwTitle">${o.rename ? `<button type="button" class="cz-vw-rn" data-cz-vw-rn aria-label="${esc('Rename ' + (o.title || ''))}" title="Rename">${esc(o.title || '')}</button>` : chip ? `<span class="cz-vw-tt">${esc(o.title || '')}</span>` : esc(o.title || '')}${chip}</h3>${sub}</div>`)
212
+ + (o.renaming ? renHtml(o) : `<div class="cz-vw-t">${pth || kind}<h3 class="cz-vw-title${chip ? ' has-chip' : ''}${o.wrap ? ' wrap' : ''}" id="czVwTitle">${o.rename ? `<button type="button" class="cz-vw-rn" data-cz-vw-rn aria-label="${esc('Rename ' + (o.title || ''))}" title="Rename">${esc(o.title || '')}</button>` : chip ? `<span class="cz-vw-tt">${esc(o.title || '')}</span>` : esc(o.title || '')}${chip}</h3>${sub}</div>`)
196
213
  + lead + disc + own + add + more
197
214
  // ⧉ (batch 18 item 15, TbT7Place): where a page arranges panels, one placement press takes the place of ⤢ (Full screen is in it)
198
- + (phone ? '' : o.place ? ib('place', 'Arrange', P.place, ' aria-haspopup="menu" aria-expanded="false"')
215
+ + (phone || o.pop ? '' : o.place ? ib('place', 'Arrange', P.place, ' aria-haspopup="menu" aria-expanded="false"')
199
216
  : ib('wide', o.isWide ? 'Back to the side' : 'Open wide', o.isWide ? P.side : P.wide, ` aria-pressed="${o.isWide ? 'true' : 'false'}"`))
200
- + (phone ? '' : `<button type="button" class="cz-vw-ib" data-cz-vw="close" aria-label="Close the viewer" title="Close">${svg(P.close, 18)}</button>`);
217
+ + (phone || o.pop ? '' : `<button type="button" class="cz-vw-ib" data-cz-vw="close" aria-label="Close the viewer" title="Close">${svg(P.close, 18)}</button>`);
201
218
  }
202
219
 
203
220
  /* ── summary first: the card and the folding rows ── */
@@ -341,6 +358,8 @@ const sideMax = () => { const r = room(); return r.float ? r.side : Math.max(MIN
341
358
  function apply(px) {
342
359
  const el = V.el; if (!el) return;
343
360
  if (isPhone()) { el.style.width = ''; el.style.flexBasis = ''; el.classList.remove('cz-vw-w2'); setRail(false); return; }
361
+ // the popup's Viewer: the popup sizes it (its grip is between the work and the chat); the list behind is never folded for it
362
+ if (V.pop) { el.style.width = ''; el.style.flexBasis = ''; el.classList.toggle('cz-vw-w2', el.offsetWidth >= W2); return; }
344
363
  // cozy-panels.js lays the panels out itself (two Viewers, a Viewer full or sliding over): it sizes this one, the rail is its own call
345
364
  if (G.managed && G.managed('v' + V.i)) { el.style.width = ''; el.classList.toggle('cz-vw-w2', el.offsetWidth >= W2); return; } // its flex is the engine's; V.w keeps the width beside the chat
346
365
  let r = room();
@@ -465,15 +484,16 @@ function mount() {
465
484
  if (V.el && V.el.isConnected) return V.el;
466
485
  sheet();
467
486
  const el = document.createElement('section'), x = V;
468
- el.className = 'cz-vw'; el.id = V.i ? 'czViewer' + (V.i + 1) : 'czViewer'; el.hidden = true; el.dataset.czPanel = 'v' + V.i;
487
+ el.className = 'cz-vw' + (V.pop ? ' cz-vw-pop' : ''); el.id = V.i ? 'czViewer' + (V.i + 1) : 'czViewer'; el.hidden = true; el.dataset.czPanel = 'v' + V.i;
469
488
  if (!V.i) el.setAttribute('aria-labelledby', 'czVwTitle'); // a second Viewer is named by its aria-label (the title id is the first one's)
470
489
  el.tabIndex = -1;
471
490
  el.innerHTML = '<header class="cz-vw-hd"></header><div class="cz-vw-body"></div>';
472
- el.prepend(grip(el));
491
+ el.prepend(grip(el)); // hidden in the popup: its grip is the popup's own, between the work and the chat
473
492
  el.addEventListener('click', (e) => { // the header's presses, and the folds of czSections in the body
474
493
  use(x);
475
494
  const f = e.target.closest('[data-czs-fold]'); if (f && el.contains(f)) { toggleFold(f); return; }
476
495
  if (e.target.closest('[data-cz-vw-rn]')) { startRename(); return; } // the title is the rename press (RnATask)
496
+ const pa = e.target.closest('[data-cz-vw-path]'); if (pa) { const n = +pa.dataset.czVwPath; guarded(() => step(n), pa); return; } // the popup's path
477
497
  const b = e.target.closest('[data-cz-vw]'); if (!b || b.disabled || !el.querySelector('.cz-vw-hd').contains(b)) return;
478
498
  const a = b.dataset.czVw;
479
499
  if (a === 'close') guarded(close, b);
@@ -503,6 +523,7 @@ function mount() {
503
523
  }
504
524
  /** In the page's own place for it when there is one (data-cz-viewer-host), else at the end of the body, floating. */
505
525
  function place(el) {
526
+ if (V.pop && G.popH) { const h = G.popH.host(); if (h && el.parentNode !== h) h.appendChild(el); el.classList.remove('cz-vw-float'); return; }
506
527
  const host = document.querySelector('[data-cz-viewer-host]');
507
528
  if (host) { if (el.parentNode !== host) host.appendChild(el); el.classList.remove('cz-vw-float'); }
508
529
  else { if (el.parentNode !== document.body) document.body.appendChild(el); el.classList.add('cz-vw-float'); }
@@ -512,8 +533,8 @@ function place(el) {
512
533
  function emit(x) {
513
534
  x = x || V;
514
535
  const d = { open: !!V.cur, id: V.cur ? V.cur.id : null, kind: V.cur ? V.cur.kind : null, title: V.cur ? V.cur.title : null, via: V.cur ? '' : x.via || '', // via 'history': the browser's Back closed it
515
- panel: 'v' + x.i, shut: !shown(x) };
516
- document.body.classList.toggle('cz-vw-on', d.open);
536
+ panel: 'v' + x.i, shut: !shown(x), pop: !!x.pop };
537
+ if (!x.pop) document.body.classList.toggle('cz-vw-on', side().some(shown)); // the popup covers the page: the page does not make room for it
517
538
  G.subs.forEach((f) => { try { f(d); } catch { /* a listener's fault stays its own */ } });
518
539
  document.dispatchEvent(new CustomEvent('cz-viewer', { detail: d }));
519
540
  }
@@ -532,7 +553,8 @@ function redraw() {
532
553
  V.ph = isPhone();
533
554
  const hd = V.el.querySelector('.cz-vw-hd');
534
555
  const bk = V.stack[V.stack.length - 1], fw = V.fwd[V.fwd.length - 1];
535
- hd.innerHTML = headHtml({ ...V.cur, canBack: V.stack.length > 0, backTo: bk ? bk.title || '' : '', fwdTo: fw ? fw.title || 'the next item' : '', isWide: V.wide || G.rail, phone: V.ph, home: onHome(), place: !!G.place });
556
+ hd.innerHTML = headHtml({ ...V.cur, canBack: V.stack.length > 0, backTo: bk ? bk.title || '' : '', fwdTo: fw ? fw.title || 'the next item' : '', isWide: V.wide || G.rail, phone: V.ph, home: onHome(), place: !!G.place && !V.pop,
557
+ pop: V.pop, path: V.pop ? V.stack.map((a) => (a && a.title) || '') : null });
536
558
  hd.classList.toggle('cz-vw-renon', !!V.cur.renaming);
537
559
  }
538
560
 
@@ -590,9 +612,15 @@ function retitle0(id, title) { if (V.cur && V.cur.id === String(id) && title) {
590
612
  /** Show one item in the Viewer, in place of the one shown. Returns the body element the content is in. */
591
613
  export function open(it) {
592
614
  let o = it || {};
593
- let x = o._inst || (o.into && byP(o.into)) || pick(o); // into: a panel id ('v1'), the Viewer that shows it (the Board's chat panel)
615
+ // pop (the popup, slice 2): on a desk the item goes in the popup's own Viewer, and the popup shows the chat about pop beside it
616
+ const pn = !o._inst && G.popNext && Date.now() - G.popNext.t < 8000 ? G.popNext : null; if (pn) G.popNext = null; // popNext(): this open pops
617
+ const popArg = o.pop || (pn && pn.pop);
618
+ // a published read-only Board has no chat; 'beside' (the PM's choice, cozy-popup.js) keeps work beside the page, unless the popup shows
619
+ // already (it takes what opens next) or the open is the chat icon's own (force)
620
+ const toPop = !o._inst && !!popArg && !!G.popH && !isPhone() && !window.PMOS_READONLY && (!!popArg.force || popShown() || !popBeside());
621
+ let x = o._inst || (toPop && popInst()) || (o.into && byP(o.into)) || pick(o); // into: a panel id ('v1'), the Viewer that shows it (the Board's chat panel)
594
622
  // one item, one Viewer (batch 31 item 10): an item already shown in another Viewer is not opened twice; that Viewer shows it again
595
- const twin = !o._inst && o.id != null ? ALL.find((y) => y !== x && shown(y) && y.cur.id === String(o.id)) : null;
623
+ const twin = !o._inst && !x.pop && o.id != null ? ALL.find((y) => y !== x && !y.pop && shown(y) && y.cur.id === String(o.id)) : null;
596
624
  if (twin) { x.drill = false; x = twin; o = { ...o, keep: true, fresh: false }; }
597
625
  use(x);
598
626
  // an item with unsaved changes asks first; the open goes on when it says so (and keeps a drill-in asked for before it)
@@ -602,6 +630,7 @@ export function open(it) {
602
630
  now = false;
603
631
  if (!ran) return null;
604
632
  }
633
+ if (toPop) { try { G.popH.show(popArg); } catch (err) { console.error(err); } }
605
634
  const el = mount(); place(el);
606
635
  if (!V.cur) { const ae = document.activeElement; V.back = ae && ae !== document.body && !el.contains(ae) ? ae : null; }
607
636
  const was = isOpen(), pos = V.stack.length, how = stepOf(o);
@@ -666,6 +695,8 @@ export function close(o = {}) {
666
695
  const nx = mru(); // another Viewer is still open: it is the one in use now, and the list stays as it is
667
696
  if (nx) V = nx; else setRail(false);
668
697
  emit(x);
698
+ // the popup closed: its Viewer goes back to the page, as a Viewer of the page again
699
+ if (x.pop) { x.pop = false; if (x.el) { x.el.classList.remove('cz-vw-pop'); on(x, () => place(x.el)); } }
669
700
  let b = x.back; x.back = null;
670
701
  // the page drew its rows again meanwhile (a page panel back to its wide form): the same row, by its key, takes the focus
671
702
  if (b && !b.isConnected && b.dataset && b.dataset.key) b = document.querySelector(`[data-key="${CSS.escape(b.dataset.key)}"]`);
@@ -744,7 +775,12 @@ function follow(n) {
744
775
  if (!ran) hq({ go: -n });
745
776
  }
746
777
  /* where a press was: inside the Viewer it drills in, outside it starts a new trail */
747
- function pressAt(e) { const t = e.target; const inst = t && t.nodeType === 1 && !t.closest('.cz-vw-trail') ? ALL.find((x) => x.el && x.el.contains(t)) || null : null; H.press = { t: Date.now(), inst }; }
778
+ function pressAt(e) {
779
+ const t = e.target; let inst = t && t.nodeType === 1 && !t.closest('.cz-vw-trail') ? ALL.find((x) => x.el && x.el.contains(t)) || null : null;
780
+ // a press in the popup's chat (a file or a link it names) opens on the popup's left, behind the work shown there (board 22)
781
+ if (!inst && t && t.nodeType === 1 && t.closest('.cz-pop')) inst = ALL.find((x) => x.pop && shown(x)) || null;
782
+ H.press = { t: Date.now(), inst };
783
+ }
748
784
  /* the trail list: hover ← or → for a moment (a mouse), or hold it (a touch). It names every step, newest first, and the page it started on. */
749
785
  let HOLD = { t: 0, fired: 0 };
750
786
  function holdable(el, x) {
@@ -800,7 +836,7 @@ if (typeof window !== 'undefined' && typeof window.addEventListener === 'functio
800
836
  /* ── for cozy-panels.js (batch 18 item 15): the instances behind one object. A panel id is 'v' + the instance's number (v0 is #czViewer). ── */
801
837
  const byP = (id) => ALL.find((x) => 'v' + x.i === id) || null;
802
838
  export const panels = {
803
- list: () => ALL.map((x) => ({ id: 'v' + x.i, open: shown(x), used: x.used, el: x.el, item: x.cur ? { id: x.cur.id, kind: x.cur.kind, title: x.cur.title } : null })),
839
+ list: () => side().map((x) => ({ id: 'v' + x.i, open: shown(x), used: x.used, el: x.el, item: x.cur ? { id: x.cur.id, kind: x.cur.kind, title: x.cur.title } : null })),
804
840
  /** limit: how many Viewers may be open at once · place(id, button): ⧉ was pressed · managed(id) → true: the panels engine sizes it */
805
841
  config(c = {}) { if (c.limit) G.limit = c.limit; if ('place' in c) G.place = c.place; if ('managed' in c) G.managed = c.managed; ALL.filter(shown).forEach((x) => on(x, redraw)); },
806
842
  /** The next open() goes into a Viewer of its own (a drop beside, TbT5DragRow). */
@@ -816,4 +852,16 @@ export const panels = {
816
852
  rest() { ALL.filter(shown).forEach((x) => on(x, () => { const k = widthOf(V.cur.kind); V.wide = false; apply(k || room().def); redraw(); })); },
817
853
  rail(v) { setRail(!!v); }, railOn: () => G.rail, owned, chosen,
818
854
  };
855
+ /* ── the popup (slice 2, pm/cozy-popup.js) ── */
856
+ /** cozy-popup.js registers { host() → the popup's left element, show(pop) → the popup is shown with the chat about pop }. */
857
+ export function popHook(h) { G.popH = h && typeof h.host === 'function' && typeof h.show === 'function' ? h : null; }
858
+ export const popOpen = () => ALL.some((x) => x.pop && shown(x));
859
+ /** The next open() (within a few seconds) goes into the popup about pop: for an opener that does not pass pop itself (premium-vw-item.js). */
860
+ /** Where work opens on a desk: 'beside' keeps it beside the page (the panels), anything else the popup. Kept in localStorage. */
861
+ export const POP_WHERE = 'cz-pop-open';
862
+ const popBeside = () => { try { return localStorage.getItem(POP_WHERE) === 'beside'; } catch { return false; } };
863
+ const popShown = () => ALL.some((y) => y.pop && shown(y));
864
+ export function popNext(pop) { G.popNext = pop ? { pop, t: Date.now() } : null; }
865
+ /** Close the popup's Viewer (an item with unsaved changes asks first). */
866
+ export function closePop() { const x = ALL.find((y) => y.pop && shown(y)); if (x) { use(x); guarded(close); } }
819
867
  if (typeof window !== 'undefined') window.czViewer = { open, close, closeOf, bodyOf, back, forward, trail, replaceUrl, drill, setPresses, setChip, setCheck, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, railCard, railSync, keepWide, ICONS };
@@ -24,6 +24,8 @@ import { mountLivePill } from './cozy-live-pill.js';
24
24
  import { mountPanels } from './cozy-panels.js';
25
25
  import { ownTab, bring, tabUrl } from './rec-tab-core.js';
26
26
  import * as VW from './cozy-viewer.js';
27
+ import * as POP from './cozy-popup.js'; // the one popup: an initiative and Ask PMOS side by side (slice 2 of the six-place navigation)
28
+ import { mountToday } from './cozy-today-app.js'; // Today on a desk (slice 5): today.html is this page with data-today
27
29
  import * as SV from './small-vw.js'; // the small Viewers: a stakeholder, its form, a routine (batch 18 item 2-C)
28
30
  import { pmGet, pmPost, pmHeaders } from './http.js';
29
31
  import * as ST from './story.js';
@@ -88,6 +90,10 @@ const BOARD = P.get('board') || ''; // the Board's expand link names its board
88
90
  const boardQ = (pre = '?') => (BOARD ? pre + 'board=' + encodeURIComponent(BOARD) : '');
89
91
  const PHONE = 760;
90
92
  const isPhone = () => innerWidth <= PHONE;
93
+ /* Today (slice 5 of the six-place navigation): today.html is this page with data-today. On a desk it draws Today's log and agenda in place of
94
+ * the list and the chat column (pm/cozy-today-app.js); a phone keeps Home. TDY is set once the page's presses are defined (below). */
95
+ const TD_PAGE = document.body.hasAttribute('data-today');
96
+ let TDY = null;
91
97
  if (navigator.maxTouchPoints > 0) wireSettle(window); // a touch screen only: on a desktop the page does not scroll and the nudge is not needed
92
98
  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>`;
93
99
  /** The Everything chip's globe (chief-of-staff C1, board CsA). */
@@ -279,7 +285,8 @@ async function openGrillNews(id) {
279
285
  function otherProducts(D) {
280
286
  const av = (D.brief && D.brief.products && D.brief.products.available) || [];
281
287
  const own = ((D.board && D.board.board) || {}).ws || WS;
282
- return av.filter((a) => a.on && a.ws && a.ws !== own).slice(0, 4);
288
+ // Today reads every product (slice 5 of the six-place navigation): the product pick is Work's and Goals', not Today's
289
+ return av.filter((a) => (a.on || (TD_PAGE && !isPhone())) && a.ws && a.ws !== own).slice(0, 4);
283
290
  }
284
291
  async function loadIni() {
285
292
  const id = S.ini;
@@ -437,7 +444,7 @@ async function readMove() {
437
444
  const auto = await Promise.all(L.map((ws) => pmGet('/api/autonomy' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
438
445
  // C3: the Lab's findings that fit no initiative are a row here (its section on Intelligence is gone)
439
446
  const labs = await Promise.all(PR.map((p, i) => { const b = (p.model.board && p.model.board.id) || ''; const q = [L[i] ? 'ws=' + encodeURIComponent(L[i]) : '', b ? 'board=' + encodeURIComponent(b) : ''].filter(Boolean).join('&');
440
- return pmGet('/api/lab' + (q ? '?' + q : '')).then((r) => (r && r.ok && r.lab && (r.lab.loose || []).length ? { ws: L[i], board: b, n: r.lab.loose.length, say: r.lab.say || '' } : null)).catch(() => null); }));
447
+ return pmGet('/api/lab' + (q ? '?' + q : '')).then((r) => (r && r.ok && r.lab && (r.lab.loose || []).length ? { ws: L[i], board: b, n: r.lab.loose.length, say: r.lab.say || '', items: r.lab.loose.map((f) => ({ id: f.id, title: f.title, why: f.why || '' })) } : null)).catch(() => null); }));
441
448
  L.forEach((ws, i) => {
442
449
  const r = got[i], A = auto[i] && auto[i].ok ? auto[i] : null; if (!r || !r.ok) return;
443
450
  const done = A ? (A.done || []).map((d) => ({ ref: d.ref, ini: d.ini || '', said: d.title || 'done', at: d.at, via: 'autonomy', reason: d.reason || '', way: d.way || '' }))
@@ -905,6 +912,7 @@ function drawList() {
905
912
  document.body.classList.toggle('hm-plist', isPhone() && !S.phoneChat); // a phone: the list is the page until a row opens its conversation (HmPhone)
906
913
  drawRailCard();
907
914
  drawRecTop();
915
+ if (TDY) TDY.draw(); // Today on a desk (today.html): the log and the agenda, from the same reads
908
916
  }
909
917
  /** The list's own fold (batch 20 item 6): kept on this computer, the one thing that folds or unfolds the list. With a Viewer open it is the rail. */
910
918
  function setFold(on) {
@@ -1144,7 +1152,7 @@ const rich = () => !!S.ini;
1144
1152
  function iniTarget(id) {
1145
1153
  const h = S.H || {};
1146
1154
  return { key: 'init:' + id, ini: id, ws: (otherIni(id) || {}).ws || WS || undefined, title: iniTitle(id), about: iniTitle(id), newChat: () => newIn(id), sub: (S.IMid === id && h.stage) || '', scope: scopeOf(id), rich: true, placeholder: 'Message PMOS about ' + iniTitle(id),
1147
- empty: 'Ask about ' + iniTitle(id) + '. PMOS reads its records and works in a real Claude Code session.', also: alsoOf(id),
1155
+ empty: 'Ask about ' + iniTitle(id) + '. PMOS reads its records and works on it in a real session.', also: alsoOf(id),
1148
1156
  // a prototype the sentence started (lib/routes-briefing-premium.js liveAsk): the Viewer opens it beside the chat, and shows it as it renders
1149
1157
  onSent: (r) => { if (r && r.live && r.live.id) import('./cozy-lab.js').then((LC) => LC.openCompare({ where: { ws: r.live.ws || WS, board: r.live.board || '' }, id: r.live.id, H: { toast } })).catch(() => {}); },
1150
1158
  // the initiative's conversation opens on where it stands (AgInitYou), until it has messages of its own
@@ -1494,7 +1502,8 @@ async function goIni(id, o = {}) {
1494
1502
  // the address follows the page, so the entry before it (the trail's start, batch 14 item 7) keeps Home's own address
1495
1503
  if (id === 'product') { openTarget(productTarget()); if (o.page !== false) { pushPage(); openProductPage(); } syncUrl(); return; }
1496
1504
  openTarget(iniTarget(id));
1497
- if (o.page !== false) { pushPage(); iniPage(); }
1505
+ // on a desk the page opens in the one popup, and Home's own chat (already on the initiative) goes in beside it
1506
+ if (o.page !== false) { pushPage(); iniPage({ pop: { keep: true, id, kind: 'initiative', title: iniTitle(id) } }); }
1498
1507
  syncUrl();
1499
1508
  if (window.czPanels) window.czPanels.scope(id); // the initiative reopens with its last panels and shares (batch 18 item 15)
1500
1509
  await loadIni();
@@ -1680,7 +1689,7 @@ function pickProduct(chip) {
1680
1689
  PP.openPicker(chip, { P: S.D.pick, label: 'Products on Home', tones: pickTones(), lines: pickLine, onApply: async (on) => { const r = await PP.savePick(on); if (!r.ok) toast(r.error); } });
1681
1690
  }
1682
1691
  // a saved pick (from this chip or Settings): Home shows and reads the ticked products
1683
- addEventListener('pp:changed', (e) => { if (WS) { location.assign('/premium.html'); return; } pickGen++; S.D.pick = e.detail; drawList(); toast('Saved. Home, Board and Intelligence show the products you picked.'); load(); });
1692
+ addEventListener('pp:changed', (e) => { if (WS) { location.assign('/premium.html'); return; } pickGen++; S.D.pick = e.detail; drawList(); toast('Saved. Today, Work and Goals show the products you picked.'); load(); });
1684
1693
 
1685
1694
  /* ── the Viewer: needs rows, the weekly update, the overview, files, people, routines ── */
1686
1695
  let lastViewer = null;
@@ -2373,6 +2382,12 @@ PH = mountPhoneHead({
2373
2382
  PH.draw();
2374
2383
  /* The panels (batch 18 item 15, canvas TbT1Split…TbT9Divider): the chat and up to 3 Viewers side by side, the divider, open beside, ⧉, slide
2375
2384
  * over. A Live pill row opens in the chat (liveGo); a remembered Viewer of an initiative opens again here when Home has a view for it. */
2385
+ /* The one popup (slice 2): Home's own chat is the popup's chat, so the page never holds two; a session picked in it opens the way Home opens a
2386
+ * session; the chat icon opens a session's initiative on the popup's left. */
2387
+ POP.useChat({ el: $('#hmChat'), open: (t) => openTarget(t), current: () => (chat.current ? chat.current() : null), focus: () => chat.focus(),
2388
+ sessionTarget: (row) => { const s = (S.D.sessions || []).find((x) => x.id === row.id); return s ? sessionTarget(s) : null; } });
2389
+ POP.setTitles((id) => (iniRowOf(id) ? iniTitle(id) : ''));
2390
+ POP.setOpener((id) => { openIniFrom(id).then(() => iniPage()); });
2376
2391
  mountPanels({
2377
2392
  go: liveGo,
2378
2393
  reopen: (it) => {
@@ -2380,6 +2395,13 @@ mountPanels({
2380
2395
  return false;
2381
2396
  },
2382
2397
  });
2398
+ if (TD_PAGE) TDY = mountToday({ S, VW, POP, pmGet, pmPost, toast, toastUndo, isPhone, now: NOW,
2399
+ rank: () => { S.topRank = rankMove({ ...rankIn(), calls: YD.callsOf((S.M && S.M.move) || []), now: NOW() }); return S.topRank; },
2400
+ rows: () => new Map(allRows().map((r) => [r.id, r])), titleOf: (id) => (iniRowOf(id) ? iniTitle(id) : String(id || '').replace(/[-_]+/g, ' ').replace(/^./, (c) => c.toUpperCase())), hasIni: (id) => !!(id && iniRowOf(id)), boardWs, boardId,
2401
+ goIni: (id) => goIni(id), select: (id) => select(id), movePress: (b) => movePress(b), openFinished, openReviewVw, openMeeting: (m) => openMeeting(m), openCalendar,
2402
+ openInbox: () => MORE.openInbox(searchGo, ''), reload: () => load(), review: () => L.reviewModel(S.D, NOW()), meetings: () => H.todayOf(S.D),
2403
+ news: () => (S.news && S.news.ok ? S.news.count || 0 : 0), chatNow: () => (chat.current ? chat.current() : null),
2404
+ openLab: (f) => import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: f.ws, board: f.board }), iniHref: (id) => '/premium-initiative.html?' + (f.ws ? 'ws=' + encodeURIComponent(f.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })) });
2383
2405
  PHC = mountPhoneCard({ pmGet, pmPost, toast, ws: () => WS || null, openMeeting: (m) => openMeeting(m), skip: ['meeting'] }); drawList();
2384
2406
  drawList(); drawTop();
2385
2407
  { // a conversation the address names opens at once, before the lists are read, so nothing typed or attached lands in the Home chat
@@ -2426,7 +2448,7 @@ load().then(() => {
2426
2448
  else if (about) { openTarget({ ...homeTarget(), key: about, title: (P.get('label') || '').slice(0, 80) || about }); discussed(about, P.get('vid'), P.get('label')); }
2427
2449
  else if (P.get('view') === 'metrics') openMetrics(P.get('ws') || ''); // ?view=metrics: an old link lands on Intelligence › Delivery trends
2428
2450
  else if (S.ini) goIni(S.ini);
2429
- else if (!isPhone() && !blockOpen && !say && !VW.isOpen()) { const first = H.needsOf(S.D)[0]; if (first) select(first.id); } // a card the PM opened while Home was reading stays
2451
+ else if (!isPhone() && !blockOpen && !say && !VW.isOpen() && !TD_PAGE) { const first = H.needsOf(S.D)[0]; if (first) select(first.id); } // Today opens nothing by itself // a card the PM opened while Home was reading stays
2430
2452
  if (blockOpen) {
2431
2453
  const b = { kind: blockOpen[1], id: blockOpen[2] };
2432
2454
  (b.kind === 'report' ? import('./premium-report-tab.js').then((M) => M.openReportTab(b)) : import('./premium-chart-tab.js').then((M) => M.openChartTab(b))).catch(() => toast('That view could not open.'));
@@ -2442,6 +2464,7 @@ load().then(() => {
2442
2464
  const u = new URL(location.href); ['settings', 'new', 'wf', 'stage'].forEach((k) => u.searchParams.delete(k)); history.replaceState(history.state, '', u.pathname + u.search + u.hash);
2443
2465
  }
2444
2466
  if (/^(prop|men|pulse|scan|rep|src)$/.test(P.get('around') || '')) MORE.openAround(P.get('around')); // ?around=<row>: that Around you view (home-around.js)
2467
+ if (TDY) { TDY.read(); readNews(); } // Today's own marks and entries, and the quiet New for you line
2445
2468
  // the Viewer opens now or not at all: the held column goes either way, and the next open holds it only if it opened (SpJ)
2446
2469
  setTimeout(() => { if (!isPhone()) store.set(VW_HELD, VW.isOpen() ? '1' : null); LS.holdViewer($('.hm-vw'), false); }, 0);
2447
2470
  poll();
@@ -4,7 +4,7 @@
4
4
  * mountIni(ctx) once, from home-app.js. ctx: { S, VW, pmGet, pmPost, toast, load, openFile, iniTitle, drawList, wait }
5
5
  * iniList(sc) after each draw of the list column: reads the layout record and moves the stage by itself when it may. The list column
6
6
  * never changes for an initiative (canvas HbC): the initiative is a page of the Viewer.
7
- * iniPage() the initiative's page in the Viewer: the ONE view the Board's panel draws too (ini-view.js; batch 6 items 1 and 3):
7
+ * iniPage(o?) the initiative's page in the Viewer (o.pop: in the one popup, with Home's chat beside it): the ONE view the Board's panel draws too (ini-view.js; batch 6 items 1 and 3):
8
8
  * summary, stage card with the dates line, Tasks as the WBS, Documents and Linked. The next stage opens the move sheet;
9
9
  * Documents drills into the documents view, with ← back to the page. true when it opened.
10
10
  * iniOverview(v, o) the initiative in the Viewer: Documents or Stage; o.back keeps the page behind it. true when it opened. Any other view
@@ -34,7 +34,9 @@ import * as SC from './home-stage-card.js';
34
34
  import { viewHtml, wireView } from './ini-view.js'; // the one initiative view, the Board's panel's own renderer
35
35
  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)
36
36
  import * as DB from './dash-view.js'; // the ready-made Dashboard view (batch 17 item 1)
37
- import * as TL from './ini-tail.js'; // under Linked, as the Board draws it (UI grill U1): drafted tickets, the PRD drift, Your impact
37
+ import * as TL from './ini-tail.js';
38
+ 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
39
+ import * as PP from './ini-props.js'; // everything PMOS suggests, as a drill-in (the popup's ⋯) // under Linked, as the Board draws it (UI grill U1): drafted tickets, the PRD drift, Your impact
38
40
 
39
41
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
40
42
  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>`;
@@ -259,9 +261,32 @@ function holdPop(anchor, id) {
259
261
  }, { label: 'On hold', sheetFocus: '#hiBack' });
260
262
  }
261
263
  /** The one view's presses on Home's page. */
264
+ /** In the popup: what pm/cozy-pop-work.js shows for work, from the same view model and the page's own read. */
265
+ function popOpts(id, M) {
266
+ const v = X.ctx.view(id) || {};
267
+ return { today: v.today, docs: M ? MD.docRows(M) : [], product: (M && M.board && (M.board.name || M.board.ws)) || rowOf(id).ws || '', program: (v.summary && v.summary.program) || null, ws: (M && M.board && M.board.ws) || rowOf(id).ws || '', id };
268
+ }
269
+ function popHtml(id, M) {
270
+ X.ctx.head(id);
271
+ const v = X.ctx.view(id);
272
+ if (!v) return `<div class="hi-v hi-page" data-hi-v="page"><p class="hi-small" role="status">The initiative could not be read.</p></div>`;
273
+ return PW.html({ ...rowOf(id), id }, v, popOpts(id, M)) + '<p class="hi-small" role="status" id="ovMsg"></p>';
274
+ }
275
+ /** The popup's own presses: every part of the old page as a drill-in (so nothing is lost), and everything PMOS suggests. */
276
+ function popExtra(id) {
277
+ const C = X.ctx, H = { where: () => { const M = curM(); return M ? bw(M) : {}; }, reload: async () => { await C.load(); redrawView(); }, toast: (m, u) => (u ? undoToast(m, u) : C.toast(m)) };
278
+ return {
279
+ allParts: () => {
280
+ C.VW.drill();
281
+ C.VW.open({ kind: X.ctx.kindOf(id), title: C.iniTitle(id), icon: 'goal', id: 'all:' + id, back: true,
282
+ render: (b) => { b.dataset.pwAll = '1'; const M = curM(); b.innerHTML = M ? pageHtml(id, M) : ''; wire(b, id); wirePage(b, id); } });
283
+ },
284
+ props: () => { const v = X.ctx.view(id); if (v) PP.open(v, H); },
285
+ };
286
+ }
262
287
  function wirePage(b, id) {
263
288
  const C = X.ctx, say = (m) => C.toast(m);
264
- wireView(b, {
289
+ const H = {
265
290
  redraw: () => redrawView(),
266
291
  // Claude's split or merge card (batch 11 item 14): ✕ Not now, ✎ Change it first, ✓ as suggested; the merged summary's link opens the one that stays
267
292
  sm: (act) => { if (C.smPress) C.smPress(id, act); },
@@ -320,7 +345,13 @@ function wirePage(b, id) {
320
345
  stagePick: (btn) => stageChip(btn, id),
321
346
  planDates: () => { if (C.askIn) C.askIn(id, 'Propose new start and end dates for ' + C.iniTitle(id)); },
322
347
  jira: () => { const M = curM(); if (M) readJira(M); },
323
- });
348
+ };
349
+ if (PW.on(b)) {
350
+ PW.wire(b, { ...H, ...popExtra(id), redraw: () => { b.__pg = null; if (b.dataset.pwAll) return; redrawView(); } },
351
+ { r: () => ({ ...rowOf(id), id }), v: () => X.ctx.view(id), o: () => popOpts(id, curM()) });
352
+ return;
353
+ }
354
+ wireView(b, H);
324
355
  }
325
356
  /** 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). */
326
357
  function taskAt(id, uid) {
@@ -451,7 +482,8 @@ async function autoPress(id, M, on) {
451
482
  }
452
483
  /** The initiative's kind of work: the page's own model, else its Board row; none reads as Product management. */
453
484
  const kindNow = (id) => { const M = curM(); return (M && M.kind) || rowOf(id).kind || 'product'; };
454
- export function iniPage() {
485
+ /** o.pop: open it in the one popup with Ask PMOS beside it (slice 2 of the six-place navigation; cozy-viewer.js pop). */
486
+ export function iniPage(o = {}) {
455
487
  if (!X.ctx) return false;
456
488
  const S = X.ctx.S, id = S.ini;
457
489
  if (!id || id === 'product') return false;
@@ -460,7 +492,7 @@ export function iniPage() {
460
492
  let rename = X.ctx.renameIni ? X.ctx.renameIni(id, '') : null;
461
493
  if (rename) rename = { ...rename, value: X.ctx.iniTitle(id) };
462
494
  const dh = dashFor(id);
463
- BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', wrap: true, more: () => pageMore(id), rename,
495
+ BODY = VW.open({ id: 'ov:' + id, kind: X.ctx.kindOf(id), title: X.ctx.iniTitle(id), icon: 'goal', wrap: true, more: () => (PW.on(BODY) ? PW.moreItems(null, popExtra(id)) : []).concat(pageMore(id)), rename, pop: o.pop || undefined,
464
496
  discuss: () => X.ctx.newIn(id), discussHome: true, // the one view (OvViewers): Discuss starts a new session about it, where + New session was
465
497
  // the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds
466
498
  presses: [WK.pressOf(kindNow(id))].concat(dh ? dh.presses() : []), onPress: (a, btn) => {
@@ -541,7 +573,7 @@ function draw(b) {
541
573
  const v = X.view;
542
574
  if (v !== 'page') b.__pg = null;
543
575
  if (v === 'page' && dashFor(id) && dashFor(id).shows()) { b.__pg = null; b.innerHTML = dashFor(id).html(() => ''); return; }
544
- if (v === 'page') { const h = pageHtml(id, M); if (b.__pg !== h || !b.firstChild) { b.__pg = h; b.innerHTML = h; } return; }
576
+ if (v === 'page') { const h = PW.on(b) ? popHtml(id, M) : pageHtml(id, M); if (b.__pg !== h || !b.firstChild) { b.__pg = h; b.innerHTML = h; } return; }
545
577
  // Documents is shell A (XvADocs): no tabs, the summary card and folding groups straight in the body
546
578
  if (v === 'docs') { b.innerHTML = docsView(id, M) + '<p class="hi-small" role="status" id="ovMsg"></p>'; return; }
547
579
  // the phone keeps the Documents | Stage switch (PgTkList); in shell A on a desktop the other view sits under ⋯ (XvATasks)
@@ -0,0 +1,69 @@
1
+ /* pm/library-model.js — the Library's table, PURE (initiative library-place, slice 7 of the six-place navigation; boards StLibrary,
2
+ * StLibMeetings, StLibDocs on Exploring 2).
3
+ *
4
+ * FILTERS All · Documents · Meeting notes · Prototypes (a link counts as a document)
5
+ * columns(filter) → { name, third, date } the header: Kind on All; Type, Came out of it, Versions with one kind; Held for meetings
6
+ * third(item, filter) → the third cell: the Kind text on All, else the column that fits the kind
7
+ * when(item, filter) → the date the row is placed by: Held for meeting notes, else Updated
8
+ * groupOf(iso, now) → 'This week' | 'Earlier in <Month>' | 'Older'
9
+ * rows(items, { filter, q, now }) → [{ group, items }] newest first; a group with no row is not there (zero is silence)
10
+ * matches(item, q) → whether the words find the row: name, kind, about, type, what came out of it
11
+ * dayText(iso, now) → '17 Nov' · '8 Sep 2025'
12
+ * The items are GET /api/library-items (lib/library-items.js ITEM). */
13
+
14
+ export const FILTERS = ['All', 'Documents', 'Meeting notes', 'Prototypes'];
15
+ const OF = { All: () => true, Documents: (x) => x.kind === 'doc' || x.kind === 'link', 'Meeting notes': (x) => x.kind === 'meeting', Prototypes: (x) => x.kind === 'proto' };
16
+ const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
17
+ const DAY = 864e5;
18
+
19
+ export function columns(filter) {
20
+ const f = OF[filter] ? filter : 'All';
21
+ return {
22
+ name: { All: 'Name', Documents: 'Document', 'Meeting notes': 'Meeting', Prototypes: 'Prototype' }[f],
23
+ third: { All: 'Kind', Documents: 'Type', 'Meeting notes': 'Came out of it', Prototypes: 'Versions' }[f],
24
+ date: f === 'Meeting notes' ? 'Held' : 'Updated',
25
+ };
26
+ }
27
+ export function third(x, filter) {
28
+ if (!OF[filter] || filter === 'All') return x.kindText || '';
29
+ if (filter === 'Meeting notes' || filter === 'Prototypes') return x.came || '';
30
+ return x.type || x.kindText || '';
31
+ }
32
+ export const when = (x, filter) => (filter === 'Meeting notes' && x.held ? x.held : x.updated) || null;
33
+
34
+ const t = (iso) => { const n = Date.parse(String(iso || '').length === 10 ? iso + 'T12:00:00' : iso); return Number.isFinite(n) ? n : null; };
35
+ export function groupOf(iso, now = Date.now()) {
36
+ const at = t(iso);
37
+ if (at == null) return 'Older';
38
+ const n = new Date(now), start = new Date(n.getFullYear(), n.getMonth(), n.getDate()).getTime();
39
+ if (at >= start - 6 * DAY) return 'This week';
40
+ const d = new Date(at);
41
+ if (d.getFullYear() === n.getFullYear() && d.getMonth() === n.getMonth()) return 'Earlier in ' + MONTHS[n.getMonth()];
42
+ return 'Older';
43
+ }
44
+ export function dayText(iso, now = Date.now()) {
45
+ const at = t(iso); if (at == null) return '';
46
+ const d = new Date(at), y = new Date(now).getFullYear();
47
+ return d.getDate() + ' ' + MONTHS[d.getMonth()].slice(0, 3) + (d.getFullYear() !== y ? ' ' + d.getFullYear() : '');
48
+ }
49
+ const norm = (s) => String(s || '').toLowerCase();
50
+ export function matches(x, q) {
51
+ const words = norm(q).split(/\s+/).filter(Boolean);
52
+ if (!words.length) return true;
53
+ const hay = norm([x.name, x.sub, x.kindText, x.type, x.came, x.about && x.about.title, x.about && x.about.product].join(' '));
54
+ return words.every((w) => hay.includes(w));
55
+ }
56
+ export function rows(items, { filter = 'All', q = '', now = Date.now() } = {}) {
57
+ const ok = OF[filter] || OF.All;
58
+ const list = (items || []).filter((x) => x && ok(x) && matches(x, q))
59
+ .map((x) => ({ x, at: when(x, filter) }))
60
+ .sort((a, b) => (t(b.at) || 0) - (t(a.at) || 0) || String(a.x.name).localeCompare(String(b.x.name)));
61
+ const out = [];
62
+ for (const { x, at } of list) {
63
+ const g = groupOf(at, now);
64
+ let last = out[out.length - 1];
65
+ if (!last || last.group !== g) { last = out.find((o) => o.group === g); if (!last) { last = { group: g, items: [] }; out.push(last); } }
66
+ last.items.push(x);
67
+ }
68
+ return out;
69
+ }
@@ -0,0 +1,34 @@
1
+ /* pm/library-open.js — open one thing that was made, in the one popup (initiative library-place, slice 7 of the six-place navigation).
2
+ * The thing is on the left, in the Viewer that already draws it; the chat on the right is about it (cozy-popup.js openWork → popNext).
3
+ *
4
+ * openItem(item) item = GET /api/library-items ITEM (lib/library-items.js)
5
+ * doc the document as its page (premium-vw-doc.js openDocPage)
6
+ * meeting the meeting notes card: who was there, the summary, decisions and tasks (premium-vw-open.js openMeeting)
7
+ * proto the design canvas of the prototype round (cozy-lab.js openCompare, which draws cozy-proto.js)
8
+ * link a new browser tab; nothing opens in PMOS
9
+ * aboutOf(item) → { id, kind, title, ws } what the chat beside it is about
10
+ * Slice 3's Artefacts table opens its rows with the same openItem. On a phone the Viewer opens as it does today (no popup). */
11
+ import * as POP from './cozy-popup.js';
12
+
13
+ const KIND = { doc: 'document', link: 'link', meeting: 'meeting', proto: 'prototype' };
14
+ export const aboutOf = (x) => ({ id: String(x.id || '').replace(/[^A-Za-z0-9._:-]+/g, '-').slice(0, 100), kind: KIND[x.kind] || 'document', title: x.name || '', ws: (x.about && x.about.ws) || undefined });
15
+
16
+ export function openItem(x) {
17
+ if (!x || !x.open) return false;
18
+ const o = x.open;
19
+ if (o.url) { try { window.open(o.url, '_blank', 'noopener,noreferrer'); } catch { /* a blocked window: nothing opens */ } return true; }
20
+ const go = async () => {
21
+ if (o.doc) {
22
+ const M = await import('./premium-vw-doc.js');
23
+ M.openDocPage({ path: o.doc.path, title: x.name }, { ws: () => o.doc.ws || '', ini: (x.about && x.about.ini) || undefined });
24
+ } else if (o.note) {
25
+ await import('./premium-vw-open.js');
26
+ window.czViews.openMeeting({ note: o.note }, { ws: o.ws || '' });
27
+ } else if (o.proto) {
28
+ const LC = await import('./cozy-lab.js');
29
+ LC.openCompare({ where: { ws: o.proto.ws, board: o.proto.board || '' }, id: o.proto.id });
30
+ }
31
+ };
32
+ POP.openWork({ about: aboutOf(x), open: () => { go().catch((e) => console.error(e)); } });
33
+ return true;
34
+ }
@@ -8,7 +8,8 @@
8
8
  * (the same chat with the scope filled in), and Settings › Workflows' New workflow opens here too, so there is no second chat column.
9
9
  *
10
10
  * openCos({ here, ws? }) → true the chief-of-staff chat; here: the page's words for the chip ("Board · Atlas"), '' for none
11
- * openTarget(t, o) → true any chat target (home-chat.js mountChat open), o: { title, url }
11
+ * openTarget(t, o) → true any chat target (home-chat.js mountChat open), o: { title, url }; while the popup shows, its chat
12
+ * box() → { el, chat } the chat for the popup's right side (cozy-popup.js)
12
13
  *
13
14
  * "Discuss in chat" on the Board's initiative or program panel opens the chat about that item in a Viewer of its own, beside the panel
14
15
  * (1600 px and wider) or sliding over it (a laptop), through the panels engine (cozy-panels.js openBeside). The page stays where it is.
@@ -41,7 +42,7 @@ export function keyOf(it) {
41
42
  export function targetOf(it, ws) {
42
43
  const title = String((it && it.title) || 'this').slice(0, 80);
43
44
  return { key: keyOf(it), ws: ws || undefined, title, about: title, scope: { text: title, icon: FLAG }, role: CLAUDE, rich: false,
44
- placeholder: 'Message PMOS about ' + title, empty: 'Ask about ' + title + '. PMOS reads its records and works in a real Claude Code session.' };
45
+ placeholder: 'Message PMOS about ' + title, empty: 'Ask about ' + title + '. PMOS reads its records and works on it in a real session.' };
45
46
  }
46
47
  /** Home's own address for the same conversation (⋯ › Open in a new tab). */
47
48
  const homeHref = (it, key) => '/premium.html?' + new URLSearchParams({ about: key, label: String(it.title || '').slice(0, 80) }).toString();
@@ -82,16 +83,27 @@ export function cosTarget(here, ws) {
82
83
  scope: h ? { text: 'You are on ' + h, icon: PIN, drop: true } : { text: 'Everything', icon: GLOBE }, context: h || undefined,
83
84
  placeholder: 'Ask or tell PMOS', empty: 'Ask anything about your work. I read it with PMOS and say where each answer came from.' };
84
85
  }
85
- /** The chief-of-staff chat over this page (the menu's chat icon). here: "Board · Atlas"; × on the chip drops it. */
86
- export function openCos(o = {}) {
86
+ /** The chief-of-staff chat over this page (the menu's chat icon). here: "Board · Atlas"; × on the chip drops it. On a desk it opens in the
87
+ * one popup (cozy-popup.js, slice 2 of the six-place navigation) with the list of sessions beside it; a phone keeps the chat's sheet. */
88
+ export async function openCos(o = {}) {
89
+ if (!isPhone()) { const P = await import('./cozy-popup.js'); return P.openCos(cosTarget(o.here, o.ws)); }
87
90
  return openTarget(cosTarget(o.here, o.ws), { title: 'Ask PMOS', url: '/premium.html' });
88
91
  }
92
+ const isPhone = () => typeof innerWidth === 'number' && innerWidth <= 760;
93
+ /** The chat itself for the popup (cozy-popup.js): mounted once, the same element and conversation reader as the chat panel. */
94
+ export async function box() {
95
+ sheets();
96
+ const M = await mod();
97
+ if (!Q.el) { Q.el = document.createElement('section'); Q.el.className = 'hm-chat pc-chat'; Q.el.setAttribute('aria-label', 'Conversation'); Q.chat = M.mountChat(Q.el, host()); }
98
+ return { el: Q.el, chat: Q.chat };
99
+ }
89
100
  export async function openChat(it, o = {}) {
90
101
  const key = keyOf(it); if (!key) return false;
91
102
  return openTarget(targetOf(it, o.ws), { title: targetOf(it, o.ws).title, url: homeHref(it, key) });
92
103
  }
93
104
  export async function openTarget(t, o = {}) {
94
105
  if (!t || !t.key) return false;
106
+ if (VW.popOpen()) { const P = await import('./cozy-popup.js'); return P.chatTo(t); } // the popup shows: its chat changes, the work stays
95
107
  sheets();
96
108
  const M = await mod();
97
109
  if (!Q.el) {