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
@@ -40,6 +40,7 @@ import * as PG from './bd-prog.js';
40
40
  import { programOf, liveRows } from './program-model.js';
41
41
  import { open as viewerOpen, current as viewerCur } from './cozy-viewer.js';
42
42
  import * as VW from './cozy-viewer.js';
43
+ 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)
43
44
  import { mountPanels } from './cozy-panels.js';
44
45
  import * as PP from './bd-prog-panel.js';
45
46
  import * as PO from './prog-order.js';
@@ -59,6 +60,7 @@ import { initiativeRename, taskRename } from './rename-press.js';
59
60
  import { setSay } from './cozy-xv.js';
60
61
  import { narrowForm } from './pn-narrow.js';
61
62
  import * as BP2 from './bd-pane.js';
63
+ import * as WV from './bd-work.js'; // Work, one view on a desk (slice 4 of the six-place navigation, initiative work-one-view)
62
64
  import * as LS from './load-shapes.js'; // the skeleton and the slow-case line while the board is read (page-open-speed, SpD) // the Board as the first panel: fit(), the rows that open beside, the open row's mark
63
65
 
64
66
  const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUPING_KEY = 'pmos.board.grouping';
@@ -106,6 +108,9 @@ mountPanels({ page: document.getElementById('stage'), key: 'board', sources: BP2
106
108
  VW.chatHere((it) => { const r = M && (M.rows || []).find((x) => x.id === it.id); import('./page-chat.js').then((C) => C.openChat(it, { ws: (r && r.ws) || (M && M.board.ws) || undefined })); return true; });
107
109
  document.addEventListener('cz:chat-turn', () => { clearTimeout(chatT); chatT = setTimeout(() => load(), 400); });
108
110
  let chatT = null;
111
+ // the popup's sessions name the work they are about, and the chat icon opens a session's initiative here, in the popup
112
+ POP.setTitles((id) => { const r = M && ((M.rows || []).find((x) => x.id === id) || goneRows().find((x) => x.id === id)); return r ? r.title : ''; });
113
+ POP.setOpener((id) => { openIniId(id); });
109
114
  // a product head's goal dots (PgBoard .gd) count that product's open initiatives, the way Home's product header does
110
115
  PG.goalsFrom((name) => (M ? M.initiatives.list.rows.filter((r) => !M.board.all || r.product === name) : null));
111
116
  const SV = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
@@ -131,6 +136,10 @@ let nview = 'list';
131
136
  const NF = narrowForm({ page: $('#stage'), sheets: /\/pm\/(cozy-board|bd-[\w-]+)\.css(\?|$)/, onChange: () => { if (M) { drawChips(); drawInit(); } } });
132
137
  const narrow = () => !PHONE.matches && NF.narrow();
133
138
  const small = () => PHONE.matches || narrow();
139
+ /** Work, one view (initiative work-one-view, boards 4, 5 and 24): on a desk the list of initiatives with its timeline replaces the four views.
140
+ * A phone, the narrow form and a published read-only copy keep their views. */
141
+ const CLASSIC = (() => { try { return localStorage.getItem('pmos.work.classic') === '1'; } catch { return false; } })(); // a test seam (lib/classic-board.js): suites of the four views
142
+ const workOn = () => !CLASSIC && !small() && !window.PMOS_READONLY;
134
143
  const goneRows = () => { const G = (M && M.initiatives && M.initiatives.gone) || {}; return [...(G.cancelled || []), ...(G.archived || [])]; };
135
144
  const rowOf = (key) => (M && M.rows || []).find((r) => r.key === key) || goneRows().find((r) => r.key === key) || null;
136
145
  /** The rows on screen grouped (pm/bd-prog.js groupsOf): programs first, then the product; or By product. null when no program holds a row here. */
@@ -217,11 +226,11 @@ function shownPick() {
217
226
  }
218
227
  function drawPick() {
219
228
  const P = shownPick(), host = $('#crumbHost'); if (!host) return;
220
- host.innerHTML = P ? PK.chipHtml(P, { id: 'bdPick', label: 'Products' }) : `<span class="crpg">${esc(M.board.name || 'Board')}</span>`;
229
+ host.innerHTML = P ? PK.chipHtml(P, { id: 'bdPick', label: 'Products', names: !matchMedia('(max-width: 760px)').matches }) : `<span class="crpg">${esc(M.board.name || 'Board')}</span>`;
221
230
  const chip = $('#bdPick'); if (!chip) return;
222
231
  // a product's line: its open initiatives on this page (zero is silence)
223
232
  const lines = (ws) => { const rows = (M.initiatives.list.rows || []).filter((r) => (M.board.all ? r.ws === ws : M.board.ws === ws)); return rows.length ? rows.length + (rows.length === 1 ? ' initiative' : ' initiatives') : ''; };
224
- chip.onclick = (e) => { e.stopPropagation(); PK.openPicker(chip, { P: shownPick(), label: 'Products', lines, note: 'One pick for Home, Board and Insights: unticking a product here also takes it off Home.', onApply: async (on) => { const r = await PK.savePick(on); if (!r.ok) say(r.error); } }); };
233
+ chip.onclick = (e) => { e.stopPropagation(); PK.openPicker(chip, { P: shownPick(), label: 'Products', lines, note: 'One pick for Today, Work and Goals: unticking a product here also takes it off Today.', onApply: async (on) => { const r = await PK.savePick(on); if (!r.ok) say(r.error); } }); };
225
234
  }
226
235
  // a saved pick (this chip, or Settings): the Board opens on the ticked products, without a one-off link's ws or board
227
236
  addEventListener('pp:changed', () => { const q = new URLSearchParams(location.search); ['ws', 'board', 'all', 'pick'].forEach((k) => q.delete(k)); const s = q.toString(); location.assign(location.pathname + (s ? '?' + s : '')); });
@@ -265,7 +274,7 @@ let jiraReading = false; // a press is reading Jira again: the chip's Adler we
265
274
  const CHIP_F = [['late', 'late', 'm-warn', 'Late'], ['risk', 'risk', 'm-warn', 'At risk'], ['blocked', 'red', 'm-crit', 'Blocked'], ['idle', 'q', '', 'Idle 30+ days']];
266
275
  /** The sprint filter (the "Sprint N only" chip and Filter's Sprint group) shows on the Sprint span only among the timeline's spans (TsSprintFilter);
267
276
  * the stage track keeps its chip. */
268
- const curView = () => (PHONE.matches ? pview : narrow() ? nview : view);
277
+ const curView = () => (PHONE.matches ? pview : narrow() ? nview : workOn() ? 'work' : view);
269
278
  const sprintFilterOn = () => curView() !== 'time' || span === 'sprint';
270
279
  /** What needs a look (batch 24 item 7, canvas BbB): new asks, late, at risk, blocked and idle are ONE pill of dots and numbers. A press opens the
271
280
  * rows; a row opens what its chip opened (the asks, a metric's trend, whose "Show only" filters); a filter that is on turns off at once.
@@ -307,6 +316,8 @@ function drawChips() {
307
316
  if (pip) pip.hidden = !(phone && (jMood === 'honest' || filtered())); fb.setAttribute('aria-label', say); fb.title = say; }
308
317
  TUNE = { jira, jMood };
309
318
  if (phone) { $('#bdChipset').innerHTML = need; return; }
319
+ // Work on a desk: no count pill and no (i); the rows say late and at risk, the key is under the list, the rest is in the view menu
320
+ if (workOn()) { $('#bdChipset').innerHTML = ''; if (WK_MENU) drawWorkMenu(); return; }
310
321
  // the pill's (i) (UI grill U2): the timeline's legend (PgTimeline; a program milestone only where a program is drawn and "On hold" only where a
311
322
  // hold is drawn, feedback batch 9 item 8), the sprints and releases the calendar icon opened (BdSprint), and the Jira read with its ↻
312
323
  const lo = menuOpen('bdLgdMenu');
@@ -418,7 +429,7 @@ function visible() {
418
429
  if (F.chips.has('blocked') && !t.blocked) return false;
419
430
  if (F.chips.has('idle') && t.idle == null) return false;
420
431
  if (F.chips.has('you') && !t.you) return false;
421
- if (F.chips.has('sprint') && sp && (view === 'track' || view === 'time' || small()) && sprintFilterOn() && !inSprint(r, sp)) return false;
432
+ if (F.chips.has('sprint') && sp && !workOn() && (view === 'track' || view === 'time' || small()) && sprintFilterOn() && !inSprint(r, sp)) return false;
422
433
  if (F.q && !String(r.title || '').toLowerCase().includes(F.q.toLowerCase())) return false;
423
434
  if (F.owners.size && !F.owners.has(r.owner || 'No owner')) return false;
424
435
  if (F.cats.size && !F.cats.has(WF.catOfRow(r))) return false;
@@ -521,7 +532,7 @@ function readGoals() {
521
532
  const rows = M.initiatives.list.rows, sig = ((M.board && M.board.ws) || '') + '|' + rows.map((r) => r.anchor || '').join(',');
522
533
  if (sig === goalsFor) return;
523
534
  goalsFor = sig;
524
- GL.readGoals((M.board && M.board.ws) || '', rows).then((R) => { if (sig !== goalsFor) return; const was = goalOn(); GOALS = R; if (goalOn() !== was || goalOn()) { drawChips(); drawInit(); } });
535
+ GL.readGoals((M.board && M.board.ws) || '', rows).then((R) => { if (sig !== goalsFor) return; const was = goalOn(); GOALS = R; if (goalOn() !== was || goalOn() || workOn()) { drawChips(); drawInit(); } });
525
536
  }
526
537
  function drawTrack(L) {
527
538
  TK = trackMode(L);
@@ -591,6 +602,115 @@ function drawTime(L) {
591
602
  lane: (c) => DL.laneHtml(c, { span, progState }) });
592
603
  return T.html;
593
604
  }
605
+ /* ── Work, one view on a desk (initiative work-one-view; pm/bd-work.js draws, this wires): the list, its view menu, the Stage cell ── */
606
+ let WK_MENU = null, WK_HOV = null, WK_STM = null;
607
+ const wkMany = () => !!(M && M.board.all && (M.board.products || []).length > 1);
608
+ const wkProduct = (r) => r.product || (M && M.board && (M.board.product || M.board.name)) || '';
609
+ const wkGoalOf = (r) => { if (!GOALS) return ''; const k = (GOALS.of || {})[String(r.anchor || '')], g = k && (GOALS.goals || []).find((x) => x.key === k); return g ? g.title : ''; };
610
+ const wkProgOf = (r) => { const p = programOf(PGS, r.ws || (M && M.board.ws) || '', r.id); return p ? p.title || p.id : ''; };
611
+ function drawWork(L) {
612
+ const pk = prodKey((M.board && (M.board.product || M.board.name)) || ''), lay = SO.layout();
613
+ return WV.listHtml(L, { many: wkMany(), sel: peek && peek.kind === 'ini' ? peek.key : null, hov: WK_HOV, rowOf,
614
+ product: wkProduct, goalOf: wkGoalOf, programOf: wkProgOf, order: (rows) => sortInis(pk, rows, lay, INI_ACC),
615
+ goalGroups: (rows) => (GOALS ? GL.asGroups(rows, GOALS, (rs) => sortInis(pk, rs, lay, INI_ACC)) : null),
616
+ canMove: (r) => !!(r.track && r.acts && (r.acts.stages || []).length > 1) });
617
+ }
618
+ /** A press in the list that is Work's own (a column title, the span, the timeline's hide, a Stage cell). → true when handled. */
619
+ function workPress(e) {
620
+ const p = WV.pressOf(e.target); if (!p) return false;
621
+ if (p.kind === 'spanmenu') { spanMenu(); return true; }
622
+ if (p.kind === 'stage') { stageMenu(rowOf(p.key), p.el); return true; }
623
+ if (!WV.apply(p)) return false;
624
+ drawInit(); if (WK_MENU) drawWorkMenu();
625
+ const f = p.kind === 'sort' ? `[data-wksort="${p.k}"]` : p.kind === 'span' ? '[data-wkspan]' : p.kind === 'timeline' ? (p.on ? '[data-wktl="off"]' : '[data-wktl="on"]') : null;
626
+ const n = f && $('#ibBody ' + f); if (n) n.focus();
627
+ return true;
628
+ }
629
+ function spanMenu(open) {
630
+ const m = $('#ibBody .wk-spm'), b = $('#ibBody [data-wkspan]'); if (!m || !b) return;
631
+ const o = open == null ? m.hidden : open; m.hidden = !o; b.setAttribute('aria-expanded', String(o));
632
+ if (o) (m.querySelector('.on') || m.querySelector('button')).focus();
633
+ }
634
+ document.addEventListener('click', (e) => { if (!e.target.closest('.wk-spw')) { const m = $('#ibBody .wk-spm'); if (m && !m.hidden) spanMenu(false); } if (WK_STM && !e.target.closest('.wk-stm, [data-wkstage]')) closeStageMenu(); });
635
+ $('#ibBody').addEventListener('keydown', (e) => {
636
+ if (curView() !== 'work') return;
637
+ if (e.key === 'Escape') { const m = $('#ibBody .wk-spm'); if (m && !m.hidden) { e.stopPropagation(); spanMenu(false); $('#ibBody [data-wkspan]').focus(); } return; }
638
+ // a row is a button: Enter or Space opens it in the popup
639
+ if ((e.key === 'Enter' || e.key === ' ') && e.target.matches('.wk-i[data-key]')) { e.preventDefault(); openIni(rowOf(e.target.dataset.key), e.target); }
640
+ });
641
+ // point at a row: its stages show on its bar and in a small card under it (board 4); the keyboard's focus does the same
642
+ const wkHov = (k) => { if (curView() === 'work') WK_HOV = WV.hover($('#ibBody'), k, WK_HOV); };
643
+ $('#ibBody').addEventListener('mouseover', (e) => { const r = e.target.closest('.wk-i[data-key]'); if (r && !e.target.closest('.wk-card')) wkHov(r.dataset.key); });
644
+ $('#ibBody').addEventListener('mouseleave', () => wkHov(null));
645
+ $('#ibBody').addEventListener('focusin', (e) => { const r = e.target.closest('.wk-i[data-key]'); wkHov(r ? r.dataset.key : null); });
646
+
647
+ /** The Stage cell: the stages of the row's own workflow in a short list; a pick moves it (POST /api/boards/move, the By stage drag's write), with Undo. */
648
+ function closeStageMenu() { if (WK_STM) { WK_STM.remove(); WK_STM = null; } }
649
+ function stageMenu(r, el) {
650
+ closeStageMenu(); if (!r || !r.acts) return;
651
+ const names = r.acts.stages || [], cur = r.acts.stage;
652
+ const m = document.createElement('div'); m.className = 'wk-stm'; m.setAttribute('role', 'menu'); m.setAttribute('aria-label', 'Stage of ' + r.title);
653
+ m.innerHTML = '<span class="h">Stage</span>' + names.map((n) => `<button type="button" role="menuitemradio" aria-checked="${n === cur}" class="${n === cur ? 'on' : ''}" data-to="${esc(n)}">${esc(n)}</button>`).join('');
654
+ document.body.appendChild(m); WK_STM = m;
655
+ const b = el.getBoundingClientRect();
656
+ m.style.left = Math.max(8, Math.min(b.left, innerWidth - m.offsetWidth - 8)) + 'px'; m.style.top = Math.max(8, Math.min(b.bottom + 4, innerHeight - m.offsetHeight - 8)) + 'px';
657
+ (m.querySelector('.on') || m.querySelector('[data-to]')).focus();
658
+ m.addEventListener('click', (e) => { const x = e.target.closest('[data-to]'); if (!x) return; closeStageMenu(); el.focus(); if (x.dataset.to !== cur) moveStage(r, cur, x.dataset.to); });
659
+ m.addEventListener('keydown', (e) => {
660
+ if (e.key === 'Escape' || e.key === 'Tab') { e.preventDefault(); e.stopPropagation(); closeStageMenu(); el.focus(); return; }
661
+ if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return;
662
+ e.preventDefault(); const B = [...m.querySelectorAll('[data-to]')], i = B.indexOf(document.activeElement);
663
+ B[(i + (e.key === 'ArrowDown' ? 1 : -1) + B.length) % B.length].focus();
664
+ });
665
+ }
666
+
667
+ /** The view menu under the tune button (board 5): Group by, the Timeline, the Columns; then what left the toolbar, so no feature is dropped. */
668
+ function workMore() {
669
+ const C = (M && M.chips) || {}, J = (M && M.jira) || {}, sp = J.sprint, rel = J.release, you = youRows().length;
670
+ const it = (k, icon, label, note) => `<button type="button" class="wk-mx" data-wkx="${k}">${SV(I[icon])}<span>${esc(label)}</span>${note ? `<span class="k">${esc(String(note))}</span>` : ''}</button>`;
671
+ const sprint = [sp ? sp.name : null, rel ? rel.name : null].filter(Boolean).join(' · ');
672
+ return it('filter', 'group', 'Sort and filter', filtered() ? 'on' : '')
673
+ + (C.asks ? it('asks', 'note', C.asks === 1 ? 'New ask' : 'New asks', C.asks) : '')
674
+ + (you ? it('you', 'flag', 'Only what waits on you', F.chips.has('you') ? 'on' : you) : '')
675
+ + (!ALL && sprint ? it('sprint', 'cal', 'Sprints and releases', sprint) : '')
676
+ + it('shared', 'people', tab === 'shared' ? 'Back to the initiatives' : 'Shared with me', tab === 'shared' ? '' : SH_N || '')
677
+ + it('jira', 'refresh', jiraReading ? 'Reading Jira' : 'Read Jira again', TUNE.jira.replace(/^Jira · /, ''));
678
+ }
679
+ function drawWorkMenu(focus) {
680
+ if (!WK_MENU) return;
681
+ const was = focus || (WK_MENU.contains(document.activeElement) ? wkSel(document.activeElement) : null);
682
+ WK_MENU.innerHTML = WV.menuHtml({ many: wkMany(), more: workMore() });
683
+ const m = WK_MENU.firstElementChild, b = WK_MENU.__btn.getBoundingClientRect();
684
+ m.style.top = Math.round(b.bottom + 8) + 'px'; m.style.left = Math.max(8, Math.round(b.right - m.offsetWidth)) + 'px';
685
+ const n = was && m.querySelector(was); if (n) n.focus();
686
+ }
687
+ const wkSel = (el) => { const x = el.closest('[data-wkgroup],[data-wkcolsw],[data-wktlsw],[data-wkreset],[data-wkx]'); if (!x) return null; for (const a of ['wkgroup', 'wkcolsw', 'wkx']) if (x.dataset[a]) return `[data-${a}="${x.dataset[a]}"]`; return x.hasAttribute('data-wktlsw') ? '[data-wktlsw]' : '[data-wkreset]'; };
688
+ function closeWorkMenu(back) { if (!WK_MENU) return; const b = WK_MENU.__btn; WK_MENU.remove(); WK_MENU = null; b.setAttribute('aria-expanded', 'false'); b.classList.remove('on'); if (back) b.focus(); }
689
+ function toggleWorkMenu(btn) {
690
+ if (WK_MENU) { closeWorkMenu(true); return; }
691
+ WK_MENU = document.createElement('div'); WK_MENU.__btn = btn; document.body.appendChild(WK_MENU);
692
+ btn.setAttribute('aria-expanded', 'true'); btn.classList.add('on');
693
+ drawWorkMenu();
694
+ const f = WK_MENU.querySelector('[data-wkgroup].on') || WK_MENU.querySelector('button'); if (f) f.focus();
695
+ WK_MENU.addEventListener('click', (e) => {
696
+ const x = e.target.closest('[data-wkx]');
697
+ if (x) { workExtra(x.dataset.wkx, btn); return; }
698
+ const p = WV.pressOf(e.target); if (!p || !WV.apply(p)) return;
699
+ const sel = wkSel(e.target); drawInit(); drawWorkMenu(sel);
700
+ });
701
+ WK_MENU.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.stopPropagation(); closeWorkMenu(true); } });
702
+ WV.wireDrag(WK_MENU, (k) => { drawInit(); drawWorkMenu(k ? `[data-wkcolsw="${k}"]` : null); });
703
+ }
704
+ document.addEventListener('click', (e) => { if (WK_MENU && !WK_MENU.contains(e.target) && !e.target.closest('#bdFilter')) closeWorkMenu(); });
705
+ function workExtra(k, btn) {
706
+ if (k === 'jira') { refreshJira(null).then(() => drawWorkMenu('[data-wkx="jira"]')); drawWorkMenu('[data-wkx="jira"]'); return; }
707
+ if (k === 'you') { if (F.chips.has('you')) F.chips.delete('you'); else F.chips.add('you'); drawInit(); drawWorkMenu('[data-wkx="you"]'); return; }
708
+ if (k === 'shared') { setTab(tab === 'shared' ? 'ini' : 'shared'); drawWorkMenu('[data-wkx="shared"]'); return; }
709
+ closeWorkMenu();
710
+ if (k === 'filter') Acts.open.filter(btn);
711
+ else if (k === 'asks') Acts.open.asks(btn);
712
+ else if (k === 'sprint') Acts.open.sprint(btn);
713
+ }
594
714
  /** The View chip (batch 28 item 3, canvas BhA; on a desktop too since UI grill U2): the four views, the span and (a desktop) the Columns where they
595
715
  * apply (the timeline), then Shared with me. */
596
716
  const VIEW_ITEMS = [['list', 'List'], ['stages', 'By stage'], ['track', 'Track'], ['time', 'Timeline']];
@@ -623,7 +743,8 @@ function drawInit() {
623
743
  const phone = small(), L = visible(), v = curView();
624
744
  const body = $('#ibBody');
625
745
  body.dataset.view = v; body.dataset.span = v === 'time' ? span : '';
626
- const html = v === 'track' ? drawTrack(L) : v === 'time' ? drawTime(L) : v === 'list' ? (phone ? V.phoneListHtml(L) : V.listHtml(L, filtered())) : V.stagesHtml(L, { phone });
746
+ document.body.classList.toggle('wk-on', v === 'work');
747
+ const html = v === 'work' ? drawWork(L) : v === 'track' ? drawTrack(L) : v === 'time' ? drawTime(L) : v === 'list' ? (phone ? V.phoneListHtml(L) : V.listHtml(L, filtered())) : V.stagesHtml(L, { phone });
627
748
  // a phone has no ⋯ menu: Metrics and Cancelled and archived stay one press away in every view, not only the track
628
749
  const phx = phone && v !== 'track' ? `<div class="bd-whead bd-phx"><span class="bd-phb"><button type="button" class="bd-chip" data-open="metrics" aria-haspopup="dialog">Metrics</button><button type="button" class="bd-chip" data-open="gone" aria-haspopup="dialog">Cancelled and archived</button></span></div>` : '';
629
750
  if (v === 'time') TL.hold(); else TL.forget();
@@ -657,6 +778,7 @@ $('#bdShowing').addEventListener('click', (e) => {
657
778
  });
658
779
  function setSpan(s) { span = s; store.set(SPAN_KEY, span); drawChips(); drawInit(); }
659
780
  $('#ibBody').addEventListener('click', (e) => {
781
+ if (curView() === 'work' && workPress(e)) return;
660
782
  if (e.target.closest('#fold, [data-mefold]')) { foldOpen = !foldOpen; drawInit(); const f = $('#fold') || $('#ibBody [data-mefold]'); if (f) f.focus(); return; }
661
783
  const gf = e.target.closest('[data-fold]'); if (gf) { const k = gf.dataset.fold; PG.fold(k); drawInit(); const b = $$('#ibBody [data-fold]').find((x) => x.dataset.fold === k); if (b) b.focus(); return; }
662
784
  const pc = e.target.closest('[data-pcat]'); if (pc) { const k = pc.dataset.pcat; V.togglePcat(k); drawInit(); const b = $$('#ibBody [data-pcat]').find((x) => x.dataset.pcat === k); if (b) b.focus(); return; }
@@ -713,12 +835,16 @@ $('#ibBody').addEventListener('drop', async (e) => {
713
835
  const step = M.steps[j]; to = (r.acts.stages || []).find((n) => stepOfName(n) === step.key) || (WF.isPF(WF.wfOf(r)) ? step.label : null); // batch 7 item 4
714
836
  if (!to) { say(step.label + ' is not one of this board\'s stages, so it did not move.'); return; }
715
837
  }
838
+ moveStage(r, from, to);
839
+ });
840
+ /** Move an initiative to another of its stages (POST /api/boards/move), with Undo in the toast: the By stage drag and Work's Stage cell. */
841
+ async function moveStage(r, from, to) {
716
842
  const body = { ws: r.ws || M.board.ws, board: r.boardId || M.board.id, id: r.id };
717
843
  const res = await pmPost('/api/boards/move', { ...body, to }).catch(() => null);
718
844
  if (!res || !res.ok) { say((res && res.error) || 'It did not move. The server did not say why.'); return; }
719
845
  say('Moved to ' + to + ' · ' + r.title + '.', async () => { const u = await pmPost('/api/boards/move', { ...body, to: from, why: 'Undo' }).catch(() => null); say(u && u.ok ? 'Back in ' + from + '.' : (u && u.error) || 'The undo did not land.'); load(); });
720
846
  load();
721
- });
847
+ }
722
848
  /** The step key of one of the board's own stage names, by the same old-name map as the model (lib/board-premium.js OLD_STEP). */
723
849
  const OLD_STEP = { ideate: 'discover', ideation: 'discover', strategize: 'prioritize', intake: 'triage', ship: 'deliver', release: 'deliver', learn: 'monitor' };
724
850
  function stepOfName(n) { const k = String(n || '').trim().toLowerCase(); const s = (M.steps || []).find((x) => x.key === k || x.label.toLowerCase() === k); return s ? s.key : OLD_STEP[k] || null; }
@@ -906,7 +1032,7 @@ function markOpen() {
906
1032
  const keys = new Set(BP2.openKeys(VW.panels.list(), M ? [...(M.rows || []), ...goneRows()] : [], BI.vidOf));
907
1033
  if (peek && peek.kind === 'ini') keys.add(peek.key);
908
1034
  $$('#ibBody [data-row]').forEach((x) => x.classList.toggle('sel', keys.has(x.dataset.row)));
909
- $$('#ibBody .tgp-r, #ibBody .bd-lrow[data-key], #ibBody .bd-bc[data-key]').forEach((x) => x.classList.toggle('sel', keys.has(x.dataset.key)));
1035
+ $$('#ibBody .tgp-r, #ibBody .bd-lrow[data-key], #ibBody .bd-bc[data-key], #ibBody .wk-i[data-key]').forEach((x) => x.classList.toggle('sel', keys.has(x.dataset.key)));
910
1036
  }
911
1037
  VW.onChange(() => markOpen());
912
1038
  BP2.wire();
@@ -922,7 +1048,7 @@ document.addEventListener('click', (e) => {
922
1048
  });
923
1049
  /* ── the tools the Agreed design draws but has no frame for: plain versions with a "Waiting for design" tag (pm/bd-acts.js) ─────────── */
924
1050
  $('#bdFind').addEventListener('click', (e) => Acts.open.find(e.currentTarget));
925
- $('#bdFilter').addEventListener('click', (e) => Acts.open.filter(e.currentTarget));
1051
+ $('#bdFilter').addEventListener('click', (e) => { if (workOn()) toggleWorkMenu(e.currentTarget); else Acts.open.filter(e.currentTarget); });
926
1052
  // New (PgBoard: "New program or initiative"): a menu of the two. The program panel's own "New initiative" presses this button from code,
927
1053
  // and that press opens New initiative at once.
928
1054
  $('#newIni').addEventListener('click', (e) => { if (e.isTrusted) Asks.openNewMenu(e.currentTarget); else Acts.open.new(e.currentTarget); });
@@ -960,7 +1086,7 @@ document.addEventListener('bd:links', (e) => { if (!SH_FULL && e.detail) setShar
960
1086
  if (pb) pb.onclick = () => { if (M && !ALL && M.board.ws) import('./bd-publish.js').then((P) => P.open($('#moreBtn'), { ws: M.board.ws, board: M.board.id || M.board.ws, view })); };
961
1087
  }
962
1088
  window.addEventListener('keydown', (e) => {
963
- if (e.key !== 'Escape' || document.querySelector('.pv-ov:not([hidden]), #moreMenu:not([hidden]), #crMenu:not([hidden]), #czMenu:not([hidden]), #bdPop:not([hidden])')) return;
1089
+ if (e.key !== 'Escape' || document.querySelector('.pv-ov:not([hidden]), #moreMenu:not([hidden]), #crMenu:not([hidden]), #czMenu:not([hidden]):not(.ev-rail), #bdPop:not([hidden])')) return;
964
1090
  if ($$('.bd-pop').some((p) => !p.hidden)) closePops(true); // the shell closes itself on Escape (cozy-viewer.js)
965
1091
  }, true);
966
1092
 
@@ -1209,7 +1335,7 @@ V.init({ M: () => M, wf: wfState, statusOf, usual: usualOf, trail: TI, sel: () =
1209
1335
  Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors, programs: () => PGS, reloadPrograms: loadPrograms });
1210
1336
  Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePanel, redraw: () => { drawChips(); drawInit(); }, F, rowOf, statusOf, openIni: openIniAny,
1211
1337
  openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, viewDoc,
1212
- grouping: () => ({ on: groupingOn(), byProduct, by: grouping === 'goal' && !goalsHere() ? (groupingOn() ? 'program' : 'product') : grouping, goal: goalsHere() }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time',
1338
+ grouping: () => (workOn() ? null : { on: groupingOn(), byProduct, by: grouping === 'goal' && !goalsHere() ? (groupingOn() ? 'program' : 'product') : grouping, goal: goalsHere() }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time',
1213
1339
  tune: tuneParts, sprintOnly, toggleSprintOnly: () => { if (F.chips.has('sprint')) F.chips.delete('sprint'); else F.chips.add('sprint'); }, sortPick, refreshJira: () => refreshJira() });
1214
1340
  BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
1215
1341
  send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
@@ -49,6 +49,18 @@ import * as GC from './goals-clear.js';
49
49
  import * as LAB from './cozy-lab-ins.js'; // Intelligence › Lab (idle lab B+C, canvas I1 IlBC): what fits no initiative, the week's background record, next time
50
50
  import * as FCV from './goal-forecast.js'; // a goal's forecast in its Viewer (FcViewer, FcPhone): the state line, the range band, the baseline ✓ // goals made clear (batch 18 item 11, 11-B): the drafts table, the check panel, first readings, failed and held
51
51
  import { provenStatus } from './status-proof.js'; // T3: an initiative's status word renders only with its source and read time
52
+ import * as POP from './cozy-popup.js'; // the one popup (slice 2 of the six-place navigation): an initiative opens in it with Ask PMOS beside it
53
+ /* An initiative's link (a goal's "Moved by", the outcomes table, a step) opens the initiative in the one popup on a desk, read the way the
54
+ * Viewer reads it (premium-vw-item.js), with Ask PMOS about it on the right. ⌘/Ctrl-click, a middle click and a phone keep the link. */
55
+ document.addEventListener('click', (e) => {
56
+ const a = e.target.closest && e.target.closest('a[href^="/premium-initiative.html"]');
57
+ if (!a || e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || innerWidth <= 760) return;
58
+ const u = new URL(a.getAttribute('href'), location.origin), id = u.searchParams.get('id'); if (!id) return;
59
+ e.preventDefault();
60
+ const ws = u.searchParams.get('ws') || '', t = a.querySelector('.n, b'), title = String((t || a).textContent || '').trim();
61
+ POP.openWork({ about: { id, kind: 'initiative', title, ws: ws || undefined },
62
+ open: () => import('./premium-vw-item.js').then((M) => M.openWorkItem({ kind: 'initiative', id, ws, title: title || undefined })) });
63
+ });
52
64
 
53
65
  let M = null; // the model
54
66
  let BM = null, bmErr = ''; // the Board measures (Delivery trends)
@@ -201,11 +213,11 @@ function shownPick() {
201
213
  }
202
214
  function drawPick() {
203
215
  const P = shownPick(), host = $('#prodHost');
204
- host.innerHTML = P ? PK.chipHtml(P, { id: 'prodPick', label: 'Products' }) : `<span class="ins-ttl">${esc(M.board.name || 'Intelligence')}</span>`;
216
+ host.innerHTML = P ? PK.chipHtml(P, { id: 'prodPick', label: 'Products', names: !matchMedia('(max-width: 760px)').matches }) : `<span class="ins-ttl">${esc(M.board.name || 'Intelligence')}</span>`;
205
217
  const chip = $('#prodPick'); if (!chip) return;
206
218
  // a product's line: its goals, from what this page read (zero is silence)
207
219
  const lines = (ws) => { const n = PF ? PF.goals.filter((g) => g.ws === ws).length : ws === M.board.ws ? M.goals.length : 0; return n ? nGoals(n) : ''; };
208
- chip.onclick = (e) => { e.stopPropagation(); closeMenus(); PK.openPicker(chip, { P: shownPick(), label: 'Products', lines, note: 'One pick for Home, Board and Intelligence: unticking a product here also takes it off Home.', onApply: async (on) => { const r = await PK.savePick(on); if (!r.ok) toast(r.error); } }); };
220
+ chip.onclick = (e) => { e.stopPropagation(); closeMenus(); PK.openPicker(chip, { P: shownPick(), label: 'Products', lines, note: 'One pick for Today, Work and Goals: unticking a product here also takes it off Today.', onApply: async (on) => { const r = await PK.savePick(on); if (!r.ok) toast(r.error); } }); };
209
221
  }
210
222
  // a saved pick (this chip, or Settings): Insights opens on the ticked products, without a one-off link's ws or board
211
223
  addEventListener('pp:changed', () => { const q = new URLSearchParams(location.search); ['ws', 'board'].forEach((k) => q.delete(k)); const s = q.toString(); location.assign(location.pathname + (s ? '?' + s : '')); });
@@ -0,0 +1,122 @@
1
+ /* pm/premium-library.js — Library, the place (initiative library-place, slice 7 of the six-place navigation; boards StLibrary,
2
+ * StLibMeetings, StLibDocs, StLibMeetingOpen on Exploring 2, page "Navigation: Today, Work, Goals, Events, Library, Routine").
3
+ *
4
+ * One table of everything that was made, the newest first, from every product: documents and links, meeting notes, prototypes. The filter
5
+ * changes the third column to one that fits the kind (pm/library-model.js). Finding is the main job, so the search field always shows; / puts
6
+ * the cursor in it. The + opens Ask PMOS with "Add to Library:" in the box: PMOS adds the file, the link or the new document and says where.
7
+ * A press on a row opens it in the one popup with the chat about it (pm/library-open.js); a link opens a new tab.
8
+ * Reads GET /api/library-items once on open, and again when the tab comes back after a minute. Writes nothing. The filter is remembered
9
+ * on this device (localStorage 'pmos.lib.kind'). */
10
+ import './fetch-share.js';
11
+ import { pmGet } from './http.js';
12
+ import { mountNav } from './cozy-nav.js';
13
+ import { mountLivePill } from './cozy-live-pill.js';
14
+ import './cozy-viewer.js';
15
+ import './cozy-popup.js'; // the one popup: window.czOpenChat for the rail's chat icon, and the popup a row opens in
16
+ import { FILTERS, columns, third, when, rows, dayText } from './library-model.js';
17
+ import { openItem } from './library-open.js';
18
+
19
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
20
+ const svg = (d) => `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
21
+ const ICON = {
22
+ doc: 'M7 4h7l4 4v12H7zM14 4v4h4',
23
+ 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',
24
+ meeting: 'M9 6a3 3 0 1 0 0 6a3 3 0 1 0 0-6M3.5 19c.6-3 2.8-4.5 5.5-4.5s4.9 1.5 5.5 4.5M16 6.5a3 3 0 0 1 0 5.5M17.5 14.8c1.7.6 2.7 2 3 4.2',
25
+ proto: 'M4 5h16v12H4zM9 20h6',
26
+ };
27
+ const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { localStorage.setItem(k, v); } catch { /* a private window */ } } };
28
+ const OLDER = 100;
29
+ const S = { all: false, items: null, error: '', filter: FILTERS.includes(store.get('pmos.lib.kind')) ? store.get('pmos.lib.kind') : 'All', q: '', at: 0, shown: [] };
30
+
31
+ mountNav('library', document, { scope: () => ({ name: 'Library', hits: (q) => libHits(q) }) });
32
+ mountLivePill();
33
+
34
+ const $ = (id) => document.getElementById(id);
35
+ const kinds = $('lbKinds'), body = $('lbBody'), note = $('lbNote'), qBox = $('lbQ');
36
+
37
+ function drawKinds() {
38
+ kinds.innerHTML = FILTERS.map((f) => `<button type="button" data-lb-kind="${esc(f)}" aria-pressed="${f === S.filter}">${esc(f)}</button>`).join('');
39
+ }
40
+ function rowHtml(x, i) {
41
+ const at = when(x, S.filter);
42
+ return `<button type="button" class="lb-r" role="row" data-lb-i="${i}" aria-label="${esc(x.name)}. ${esc(x.kindText)}${x.about && x.about.title ? '. About ' + esc(x.about.title) : ''}${x.open && x.open.url ? '. Opens in a new tab' : ''}">`
43
+ + `<span class="ic" role="cell">${svg(ICON[x.kind] || ICON.doc)}</span><span class="n" role="cell">${esc(x.name)}</span>`
44
+ + `<span class="c" role="cell">${esc(third(x, S.filter))}</span><span class="c" role="cell">${esc((x.about && x.about.title) || '')}</span>`
45
+ + `<span class="c" role="cell">${esc(dayText(at))}</span></button>`;
46
+ }
47
+ function draw() {
48
+ if (S.items == null) return;
49
+ if (!S.items.length && S.error) { body.innerHTML = `<p class="lb-none">The Library could not be read: ${esc(S.error)}.</p>`; note.textContent = ''; return; }
50
+ const groups = rows(S.items, { filter: S.filter, q: S.q });
51
+ const col = columns(S.filter);
52
+ S.shown = [];
53
+ if (!groups.length) {
54
+ // zero is silence: one quiet line, no empty table
55
+ const what = S.q ? 'Nothing in the Library matches "' + S.q + '".' : S.filter === 'All' ? 'Nothing was made yet. Documents, meeting notes and prototypes show here as they are made.' : 'No ' + S.filter.toLowerCase() + ' yet.';
56
+ body.innerHTML = `<p class="lb-none">${esc(what)}</p>`;
57
+ note.textContent = '';
58
+ return;
59
+ }
60
+ let h = `<div class="lb-t" role="table" aria-label="Library"><div class="lb-r lb-h" role="row"><span role="columnheader"></span><span role="columnheader">${esc(col.name)}</span><span role="columnheader">${esc(col.third)}</span><span role="columnheader">About</span><span role="columnheader">${esc(col.date)}</span></div>`;
61
+ let left = 0;
62
+ for (const g of groups) {
63
+ h += `<div class="lb-r lb-g" role="row"><div role="rowheader">${esc(g.group)}</div></div>`;
64
+ // a long Older group shows its newest rows; one quiet press shows the rest
65
+ const cut = g.group === 'Older' && !S.all && !S.q ? g.items.slice(0, OLDER) : g.items;
66
+ left += g.items.length - cut.length;
67
+ for (const x of cut) { h += rowHtml(x, S.shown.length); S.shown.push(x); }
68
+ }
69
+ if (left) h += `<button type="button" class="lb-r lb-more" data-lb-more><span></span><span class="c q">Show ${left} older</span></button>`;
70
+ body.innerHTML = h + '</div>';
71
+ note.textContent = S.filter === 'All' && !S.q ? 'Press a row to open it with the chat beside it. Reports are in Routine.' : '';
72
+ }
73
+ /* Search (⌘K) lists the Library's own rows first */
74
+ function libHits(q) {
75
+ if (!S.items) return [];
76
+ const g = rows(S.items, { filter: 'All', q });
77
+ const list = g.flatMap((x) => x.items).slice(0, 8);
78
+ return list.length ? [{ label: 'In the Library', rows: list.map((x) => ({ id: x.id, title: x.name, sub: x.kindText + (x.about && x.about.title ? ' · ' + x.about.title : ''), open: () => openItem(x) })) }] : [];
79
+ }
80
+
81
+ async function load() {
82
+ const r = await pmGet('/api/library-items').catch((e) => ({ ok: false, error: (e && e.message) || 'the server did not answer' }));
83
+ S.at = Date.now();
84
+ if (r && r.ok) { S.items = r.items || []; S.error = ''; } else { S.items = S.items || []; S.error = (r && r.error) || 'the server did not answer'; }
85
+ draw();
86
+ }
87
+
88
+ kinds.onclick = (e) => {
89
+ const b = e.target.closest('[data-lb-kind]'); if (!b) return;
90
+ S.filter = b.dataset.lbKind; store.set('pmos.lib.kind', S.filter); drawKinds(); draw();
91
+ };
92
+ qBox.addEventListener('input', () => { S.q = qBox.value.trim(); draw(); });
93
+ qBox.addEventListener('keydown', (e) => { if (e.key === 'Escape' && qBox.value) { e.stopPropagation(); qBox.value = ''; S.q = ''; draw(); } });
94
+ body.onclick = (e) => {
95
+ if (e.target.closest('[data-lb-more]')) { S.all = true; draw(); return; }
96
+ const b = e.target.closest('[data-lb-i]'); if (!b) return;
97
+ const x = S.shown[Number(b.dataset.lbI)]; if (x) openItem(x);
98
+ };
99
+ addEventListener('keydown', (e) => {
100
+ if (e.key !== '/' || e.metaKey || e.ctrlKey || e.altKey) return;
101
+ const t = e.target; if (t && (t.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName))) return;
102
+ if (document.body.classList.contains('cz-pop-on')) return;
103
+ e.preventDefault(); qBox.focus();
104
+ });
105
+ // the +: Ask PMOS, with the words ready to finish; PMOS adds the file, the link or the new document
106
+ $('lbAdd').onclick = async () => {
107
+ const M = await import('./page-chat.js');
108
+ await M.openCos({ here: 'Library' });
109
+ let n = 0;
110
+ const t = setInterval(() => {
111
+ const box = document.querySelector('.pc-chat textarea');
112
+ if (box || ++n > 20) {
113
+ clearInterval(t);
114
+ if (box && !box.value) { box.value = 'Add to Library: '; box.dispatchEvent(new Event('input', { bubbles: true })); }
115
+ if (box) box.focus();
116
+ }
117
+ }, 50);
118
+ };
119
+ document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible' && Date.now() - S.at > 60000) load(); });
120
+
121
+ drawKinds();
122
+ load();
@@ -937,7 +937,7 @@ export function wireCrumb(o) {
937
937
  const SRCH = '<svg class="i" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>';
938
938
  const IC = (d) => `<svg class="i" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
939
939
  const GL = { place: IC('M4 5h16v14H4zM4 10h16'), ini: IC('M12 3l9 9-9 9-9-9z'), doc: IC('M6 3h9l4 4v14H6zM14 3v5h5'), ses: IC('M5 4l14 8-14 8z'), need: IC('M12 4v10M12 18v2') };
940
- const PLACES = [['Home', '/premium.html'], ['Board', '/premium-board.html'], ['Intelligence', '/premium-intelligence.html']];
940
+ const PLACES = [['Today', '/premium.html'], ['Work', '/premium-board.html'], ['Goals', '/premium-intelligence.html']]; // the places' names since slice 1 of the six places
941
941
  const PV_WS = new URLSearchParams(location.search).get('ws');
942
942
  const pvQ = (sep) => (PV_WS ? sep + 'ws=' + encodeURIComponent(PV_WS) : '');
943
943
  async function pvGet(u) { try { const r = await fetch(u, { credentials: 'same-origin' }); return { status: r.status, j: await r.json() }; } catch { return { status: 0, j: null }; } }
@@ -16,6 +16,7 @@
16
16
  <link rel="stylesheet" href="/pm/load-shapes.css" />
17
17
  <link rel="stylesheet" href="/pm/bd-pin-card.css" />
18
18
  <link rel="stylesheet" href="/pm/cozy-panel.css" />
19
+ <link rel="stylesheet" href="/pm/bd-work.css" />
19
20
  </head>
20
21
  <body class="cz bd-page">
21
22
  <!-- The Board has no dialog, dock, toast or hero of the old shell: pm/premium-shell.js binds to a detached copy when #dlg is absent. Its panels
@@ -0,0 +1,42 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="pmos-nonce" content="" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
7
+ <title>PMOS · Events</title>
8
+ <!-- Events (slice 6 of the six-place navigation, initiative events-place; board 2, StEvPlan): everything with a date in one page with no views.
9
+ Left: Late, Today, Coming up and the later delivery milestones as one line. Right, in one grey box: the small month and Show. It reads
10
+ GET /api/events-place; the page code is pm/cozy-events.js and its markup pm/cozy-events-view.js. -->
11
+ <link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
12
+ <link rel="stylesheet" href="/pm/cozy.css" />
13
+ <link rel="stylesheet" href="/pm/cozy-events.css" />
14
+ </head>
15
+ <body class="cz evp-page">
16
+ <main class="cz-panel stage evp" id="stage">
17
+ <div class="evp-hd">
18
+ <h1>Events</h1>
19
+ <p class="evp-dayf" id="evpDay" hidden>Only <b></b><button type="button" class="evp-ib" data-evp-clear aria-label="Show every day" title="Show every day"><svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button></p>
20
+ <button type="button" class="evp-ib evp-add" data-evp-add aria-label="Add your own date" title="Add your own date"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M12 5v14M5 12h14"/></svg></button>
21
+ </div>
22
+ <div class="evp-grid">
23
+ <div class="evp-left">
24
+ <form class="evp-new" id="evpAdd" hidden aria-label="Your own date">
25
+ <input name="what" type="text" placeholder="What, for example: Call Rina about the contract" aria-label="What" autocomplete="off" />
26
+ <input name="when" type="date" aria-label="When" />
27
+ <button type="submit" class="evp-ib evp-yes" aria-label="Add it" title="Add it"><svg aria-hidden="true" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></button>
28
+ </form>
29
+ <p class="evp-note" id="evpNote" role="status" hidden></p>
30
+ <div id="evpList" aria-live="polite"><p class="evp-quiet" role="status">Reading the dates.</p></div>
31
+ </div>
32
+ <aside class="evp-side" aria-label="The month">
33
+ <div id="evpMonth"></div>
34
+ <div id="evpShow"></div>
35
+ <p class="evp-hint">Press a kind to hide it or show it. Press a day to see only that day.</p>
36
+ </aside>
37
+ </div>
38
+ </main>
39
+ <div class="evp-toast" id="toast" role="status" aria-live="polite"></div>
40
+ <script type="module" src="/pm/cozy-events.js"></script>
41
+ </body>
42
+ </html>
@@ -0,0 +1,31 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="pmos-nonce" content="" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
7
+ <title>PMOS · Library</title>
8
+ <!-- Library (initiative library-place, slice 7 of the six-place navigation; boards StLibrary, StLibMeetings, StLibDocs, StLibMeetingOpen on
9
+ Exploring 2). One table of everything that was made, the newest first: Name, Kind, About, Updated, in the groups This week, Earlier in <month>
10
+ and Older. The filter All, Documents, Meeting notes, Prototypes; the search field; the + asks PMOS to add a file, a link or a new document.
11
+ A press on a row opens it in the one popup (pm/cozy-popup.js) with the chat about it. Reports live in Routine; Lab findings go to Today.
12
+ It reads GET /api/library-items (lib/routes-library.js). Nothing on this page writes. -->
13
+ <link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
14
+ <link rel="stylesheet" href="/pm/cozy.css" />
15
+ <link rel="stylesheet" href="/pm/cozy-library.css" />
16
+ </head>
17
+ <body class="cz lb-page">
18
+ <main class="stage cz-panel lb" id="stage">
19
+ <h1 class="vh">Library</h1>
20
+ <div class="lb-bar">
21
+ <span class="cz-seg" id="lbKinds" role="group" aria-label="Kind"></span>
22
+ <label class="lb-find"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M11 4.5a6.5 6.5 0 1 0 0 13a6.5 6.5 0 1 0 0-13M16 16l4 4"/></svg><span class="vh">Find in Library</span><input id="lbQ" type="search" autocomplete="off" spellcheck="false" placeholder="Find in Library" /></label>
23
+ <button type="button" class="cz-ib lb-add" id="lbAdd" aria-label="Add a file, a link or a new document" title="Add a file, a link or a new document"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button>
24
+ </div>
25
+ <div id="lbBody" aria-live="polite"><div class="lb-t lb-sk" aria-hidden="true"><div class="lb-r lb-h"><span></span><i></i><i></i><i></i><i></i></div><div class="lb-r"><span></span><i></i><i></i><i></i><i></i></div><div class="lb-r"><span></span><i></i><i></i><i></i><i></i></div><div class="lb-r"><span></span><i></i><i></i><i></i><i></i></div></div></div>
26
+ <p class="lb-n" id="lbNote"></p>
27
+ </main>
28
+ <noscript>This page needs JavaScript.</noscript>
29
+ <script type="module" src="/pm/premium-library.js"></script>
30
+ </body>
31
+ </html>
@@ -0,0 +1,31 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="pmos-nonce" content="" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
7
+ <title>PMOS · Routine</title>
8
+ <!-- Routine (initiative routine-place, slice 8 of the six-place navigation; board 11 on Exploring 2): one table of everything that repeats.
9
+ Reports with who they tell, what PMOS reads, PMOS's own jobs and your own scheduled tasks, each with When, Next and a switch that pauses it.
10
+ "PMOS did" is one line on top. A row opens the one popup (pm/cozy-popup.js): a report with its newest issue and its setup, or the setup of
11
+ the routine (pm/cozy-routine-pop.js). The rail (pm/cozy-nav.js) is the navigation. The page code is pm/cozy-routine.js. -->
12
+ <link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
13
+ <link rel="stylesheet" href="/pm/cozy.css" />
14
+ <link rel="stylesheet" href="/pm/cozy-routine.css" />
15
+ </head>
16
+ <body class="cz">
17
+ <div class="rt-toast" id="toast" role="status" aria-live="polite"></div>
18
+ <main class="cz-panel stage rt-page" id="stage">
19
+ <h1 class="vh">Routine</h1>
20
+ <div class="rt-bar">
21
+ <div class="rt-seg" id="rtKinds" role="group" aria-label="Show"></div>
22
+ <button type="button" class="rt-add" id="rtAdd" aria-label="Tell PMOS a new routine" title="Tell PMOS a new routine"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button>
23
+ </div>
24
+ <div id="rtDid"></div>
25
+ <div id="rtTable"><p class="rt-quiet">Reading what repeats.</p></div>
26
+ <p class="rt-msg" id="rtMsg" role="status"></p>
27
+ </main>
28
+ <noscript>This page needs JavaScript.</noscript>
29
+ <script type="module" src="/pm/cozy-routine.js"></script>
30
+ </body>
31
+ </html>