create-pmos 0.415.0 → 0.416.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 (78) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +2 -2
  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/payload/state/log.md +1 -1
  7. package/workspace/briefing-premium-adddoc-test.js +3 -3
  8. package/workspace/briefing-premium-board-test.js +72 -43
  9. package/workspace/briefing-premium-doc-edit-test.js +2 -2
  10. package/workspace/briefing-premium-initiative-test.js +19 -22
  11. package/workspace/briefing-premium-insights-test.js +28 -17
  12. package/workspace/changelog.json +12 -0
  13. package/workspace/core-docs-workflow-test.js +1 -1
  14. package/workspace/guide/workflows.md +2 -1
  15. package/workspace/ini-workflow-test.js +11 -11
  16. package/workspace/lib/board-premium.js +7 -2
  17. package/workspace/lib/board-trail.js +6 -1
  18. package/workspace/lib/engine/boards.js +8 -2
  19. package/workspace/lib/initiative-chat.js +4 -3
  20. package/workspace/lib/insights-premium.js +9 -1
  21. package/workspace/lib/pmos-verbs.js +1 -1
  22. package/workspace/lib/route-modules.js +1 -0
  23. package/workspace/lib/routes-boards.js +32 -4
  24. package/workspace/lib/routes-live.js +53 -0
  25. package/workspace/lib/task-cli.js +88 -24
  26. package/workspace/lib/task-items.js +3 -1
  27. package/workspace/lib/workflow-cli.js +1 -1
  28. package/workspace/milestone-suggest-test.js +2 -1
  29. package/workspace/package-lock.json +2 -2
  30. package/workspace/package.json +1 -1
  31. package/workspace/premium-board-actions-test.js +3 -3
  32. package/workspace/premium-chat-report-tab-test.js +13 -5
  33. package/workspace/premium-core-doc-issue-test.js +1 -1
  34. package/workspace/premium-report-read-test.js +66 -51
  35. package/workspace/premium-vw-backlog-test.js +3 -3
  36. package/workspace/premium-vw-doc-test.js +3 -3
  37. package/workspace/premium-vw-item-test.js +4 -4
  38. package/workspace/premium-vw-jira-test.js +14 -13
  39. package/workspace/premium-vw-slides-test.js +7 -5
  40. package/workspace/program-panel-test.js +1 -1
  41. package/workspace/public/pm/bd-ini-panel.js +68 -230
  42. package/workspace/public/pm/cozy-insights.css +15 -0
  43. package/workspace/public/pm/cozy-live-pill.css +48 -0
  44. package/workspace/public/pm/cozy-live-pill.js +141 -0
  45. package/workspace/public/pm/cozy-viewer.js +4 -3
  46. package/workspace/public/pm/cozy-vw-rp.css +48 -0
  47. package/workspace/public/pm/home-app.js +45 -8
  48. package/workspace/public/pm/home-chat.js +5 -2
  49. package/workspace/public/pm/home-ini.js +57 -22
  50. package/workspace/public/pm/home-task.js +16 -5
  51. package/workspace/public/pm/ini-view-model.js +277 -0
  52. package/workspace/public/pm/ini-view.css +122 -0
  53. package/workspace/public/pm/ini-view.js +180 -0
  54. package/workspace/public/pm/live-model.js +104 -0
  55. package/workspace/public/pm/ov-view.css +44 -0
  56. package/workspace/public/pm/premium-board.js +14 -15
  57. package/workspace/public/pm/premium-insights.js +61 -35
  58. package/workspace/public/pm/premium-report-read.js +74 -50
  59. package/workspace/public/pm/premium-report-tab.js +36 -15
  60. package/workspace/public/pm/premium-shell.js +1 -1
  61. package/workspace/public/pm/premium-vw-item-model.js +6 -3
  62. package/workspace/public/pm/premium-vw-item.js +25 -6
  63. package/workspace/public/pm/premium-vw-jira.js +17 -15
  64. package/workspace/public/pm/rp-parts.js +75 -12
  65. package/workspace/public/pm/task-card.css +24 -49
  66. package/workspace/public/pm/task-card.js +90 -64
  67. package/workspace/public/pm/tk-view.css +21 -0
  68. package/workspace/public/pm/tk-view.js +216 -0
  69. package/workspace/public/pm/wf-page.js +2 -0
  70. package/workspace/server.js +24 -1
  71. package/workspace/stage-card-test.js +49 -41
  72. package/workspace/task-card-test.js +83 -38
  73. package/workspace/test-files.json +3 -1
  74. package/workspace/test-lists/bd-ini-panel.json +3 -3
  75. package/workspace/tk-tasks-test.js +3 -3
  76. package/workspace/public/pm/bd-ini-model.js +0 -81
  77. package/workspace/public/pm/cozy-rec-pill.css +0 -12
  78. package/workspace/public/pm/cozy-rec-pill.js +0 -46
@@ -1,28 +1,31 @@
1
1
  /* pm/premium-report-read.js — a report cycle in the Viewer card (initiative premium-agreed-design, area viewer; ReportPanel.dc.html; the
2
2
  * uncovered parts drawn by premium-uncovered-features, workstream reports: canvas RpBrief, RpStates, RpDoc, RpLive, RpPhone).
3
3
  *
4
- * One report cycle, drawn as the design's report panel inside the czViewer card (cozy-viewer.js): no conversation, nothing in #dlg.
5
- * Header kind "Report · <audience>" (the template's audience), the report's name.
6
- * Tabs Report | Brief, Brief with the count of what waits for the PM's confirm (RpBrief).
7
- * Chips the cycle chip (Draft · Oct 21, Issued · Oct 21; orange "Editing the Oct 21 draft" while editing) and its menu in groups:
8
- * Draft, Issued, Archived with Bring back, and Archive <cycle> (RpStates); the schedule chip and its popover (Every week, Every
9
- * 2 weeks, Every month on the 1st, Something else: say it in the chat; Mon to Fri; the time; Cancel and Schedule it).
10
- * Toolbar Slides | Document | Live page, Edit, Present, Share (its popover: Link | Send a file, Ends in, Password, Create link, the open
11
- * links and Turn off), Download (PDF or Word), the blue Issue button and More (PPTX DOCX PDF XLSX CSV MD, Print, Versions
12
- * "N cycles", Discard this draft… or Archive).
4
+ * One report cycle, drawn as the one report Viewer (canvas OvReport) inside the czViewer card (cozy-viewer.js): no conversation, nothing in #dlg.
5
+ * Header kind "Report · <audience>" (the template's audience), the report's name; ⋯ holds Schedule, Start the next cycle and Discard
6
+ * or Archive (moreItems).
7
+ * Summary what waits on you ("Draft · Oct 21 · 1 to confirm", "Goes out Mon 9:00"), the words, the one primary as an icon (Issue it,
8
+ * Share, Bring back) and the meta chips: the schedule (it opens the schedule popover: Every week, Every 2 weeks, Every month on
9
+ * the 1st, Something else: say it in the chat; Mon to Fri; the time; Cancel and Schedule it) and who reads it, or its format.
10
+ * Bar Slides | Document | Live page, then Edit (a draft), Present, Share (its popover: Link | Send a file, Ends in, Password,
11
+ * Create link, the open links and Turn off; not on an issued cycle, where Share is the primary) and Download (PPTX DOCX PDF XLSX
12
+ * CSV MD, Print), as icons.
13
+ * Folds Please confirm (Confirm or Correct, Use it or Read again), At a glance (For, Read by, Goes out, Built from), Earlier cycles
14
+ * (each opens; an archived one has Bring back), Structure and look (the sections, Why it looks like this, Earlier looks with Go
15
+ * back to it) (rp-parts.js briefModel). A fold with nothing in it is not drawn.
16
+ * Editing the orange "Editing the Oct 21 draft" chip and its cycle menu in groups: Draft, Issued, Archived with Bring back, and Archive
17
+ * <cycle> (RpStates).
13
18
  * Issue a confirm with the three checks of GET /api/viewer-report/checks, Issue it and Not yet. POST /api/report/issue freezes the cycle.
14
19
  * Issued the lock line "Issued, so it stays as sent. Changes go into the next cycle." with Start the next cycle (RpStates).
15
20
  * Discard a card at the foot of the panel: "Discard the Oct 12 draft?", the cycle that stays, "This cannot be undone." (RpStates).
16
- * Slides the current slide, "Slides", the counter (1 of 5) with previous and next, and a thumbnail of each slide.
21
+ * Slides the current slide, ‹ "Slide 1 of 5" ›, and a thumbnail of each slide.
17
22
  * Document the words as paper pages: the eyebrow, the title, "In one minute", numbered sections, tables, the sources as footnotes,
18
23
  * "Page n of N" and Download as PDF or Word (RpDoc; rp-parts.js paperModel). A designed cycle shows its designed page.
19
24
  * Live page the numbers Insights reads (GET /api/insights-premium): the goal tiles, Goals on track, Shipped and At risk, the picked goal's
20
25
  * line with its range and its points, the shipped rows that open for detail (RpLive; rp-parts.js liveModel). An issued cycle
21
26
  * reads only the readings up to its day, so its page never changes later.
22
- * Brief At a glance (For, Read by, Goes out, Built from), Please confirm (Confirm or Correct, Use it or Read again), Why it looks like
23
- * this, Earlier looks with Go back to it (RpBrief; rp-parts.js briefModel).
24
27
  * Present the slide over the whole page, "Slide n of N", the numbered strip, ← → and B to blank the screen, Stop presenting.
25
- * Phone Report | Brief, Slides | Page, the slide, "Slide 1 of 6 · swipe for the next", the lock line and Present (RpPhone).
28
+ * Phone the same Viewer full screen: the slide swipes, and the thumbnails are left out (OvReport phone).
26
29
  * The page editor that Edit mounts on Document (premium-vw-doc.js) and the slide editor's own tools have no artboard: they keep the "Waiting
27
30
  * for design" marker.
28
31
  * Edit (Slides) the design's edit mode: the tip, the slide with a dashed outline and the selected item boxed, then "Slides ‹ n of N ›" and the
@@ -42,11 +45,12 @@
42
45
  * (Read again: a redraft that keeps the notes; Start the next cycle without a template), /api/report-setups/draft (Start the next cycle),
43
46
  * /api/report-design/revert (Go back to it). */
44
47
  import { pmGet, pmPost } from './http.js';
45
- import { open as vOpen, current as vCur, czSummary } from './cozy-viewer.js';
48
+ import { open as vOpen, current as vCur, czSections } from './cozy-viewer.js';
46
49
  import * as MP from './premium-mtg-present.js'; // the one presenter window for every kind (canvas note xvPresent)
47
50
  import { placeholderHtml } from './cozy-placeholder.js';
48
51
  import './premium-vw-open.js'; // registers window.czViews
49
- import { cycleGroups, cycleName, briefModel, briefHtml, paperModel, paperHtml, liveModel, liveHtml, presentHtml, dayMon, reportSummary } from './rp-parts.js';
52
+ import { cycleGroups, cycleName, briefModel, briefGlanceHtml, briefConfirmHtml, briefWhyHtml, briefLooksHtml, paperModel, paperHtml, liveModel, liveHtml, presentHtml, dayMon, reportSummary,
53
+ rpSumHtml, rpBarHtml, cadenceWords, goesOutWords, FORMATS } from './rp-parts.js';
50
54
 
51
55
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
52
56
  const svg = (p, n = 18) => `<svg viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true">${p}</svg>`;
@@ -246,27 +250,20 @@ function cycPop() {
246
250
  + (R.issued && !R.archived && !R.edit ? `<hr><button type="button" class="vz-mi vz-hv" role="menuitem" data-r="archive">${ic('box')}Archive ${esc(cycleName(R.row, R.id))}</button>` : '') + '</div>';
247
251
  }
248
252
  /**
249
- * What ⋯ holds (canvas note xvMore, XvAReportMore), in its order: change it, look back, stop or remove (red, last). The card's one primary is
250
- * never repeated here: a draft's Issue, an issued cycle's Share, an archived cycle's Bring back. Each item is { r, label, note, danger } or
251
- * { sep }; r is the press, the same one the panel's own buttons send.
253
+ * What ⋯ holds (canvas note xvMore; OvReport): only what the card does not already show. The bar has the read-as switch, Edit, Present,
254
+ * Share and Download; the folds have the cycles and the Brief; the summary has the one primary. So ⋯ holds Schedule, Start the next cycle
255
+ * (an issued cycle) and, red and last, Discard this draft or Archive this cycle. Each item is { r, label, note, danger } or { sep }; r is the
256
+ * press, the same one the panel's own buttons send.
252
257
  */
253
258
  export function moreItems(o) {
254
- if (o.edit) return [];
255
- const L = [], n = o.cycles || 1, sched = o.schedule && o.schedule !== 'Not scheduled' ? o.schedule.replace(/\s\d{2}:\d{2}$/, '') : '';
256
- if (!o.issued) L.push({ r: 'share', label: 'Share', note: 'Link or file' });
257
- if (!o.archived) L.push({ r: 'sched', label: 'Schedule', note: sched });
258
- if (!o.issued) L.push({ r: 'edit', label: 'Edit' }); else if (!o.archived) L.push({ r: 'nextcyc', label: 'Start the next cycle' });
259
- L.push({ r: 'present', label: 'Present' });
260
- if (o.view !== 'deck') L.push({ r: 'view|deck', label: 'Read as slides' });
261
- if (o.view !== 'doc') L.push({ r: 'view|doc', label: 'Read as a page' });
262
- if (o.view !== 'live') L.push({ r: 'view|live', label: 'Live numbers' });
263
- L.push({ sep: true }, { r: 'dlm', label: 'Download', note: 'PPTX, PDF…' }, { r: 'cycm', label: 'Versions', note: n + (n === 1 ? ' cycle' : ' cycles') },
264
- { r: 'tab|brief', label: 'Brief', note: o.confirm ? o.confirm + ' to confirm' : '' });
265
- if (!o.issued) L.push({ sep: true }, { r: 'discard', label: 'Discard this draft', danger: true });
266
- else if (!o.archived) L.push({ sep: true }, { r: 'archive', label: 'Archive this cycle', danger: true });
259
+ if (o.edit || o.archived) return [];
260
+ const L = [], sched = o.schedule && o.schedule !== 'Not scheduled' ? o.schedule.replace(/\s\d{2}:\d{2}$/, '') : '';
261
+ L.push({ r: 'sched', label: 'Schedule', note: sched });
262
+ if (o.issued) L.push({ r: 'nextcyc', label: 'Start the next cycle' });
263
+ L.push({ sep: true }, o.issued ? { r: 'archive', label: 'Archive this cycle', danger: true } : { r: 'discard', label: 'Discard this draft', danger: true });
267
264
  return L;
268
265
  }
269
- const menuOf = () => moreItems({ edit: R.edit, issued: R.issued, archived: R.archived, schedule: R.setup === undefined ? '' : schedLabel(R.setup), view: R.view, cycles: R.cycles.length, confirm: R.BF ? R.BF.count : 0 });
266
+ const menuOf = () => moreItems({ edit: R.edit, issued: R.issued, archived: R.archived, schedule: R.setup === undefined ? '' : schedLabel(R.setup) });
270
267
  /** Shell A's ⋯ (open({ more })) reads the list when it opens, so the list is refilled in place as the cycle changes: one array per report. */
271
268
  function syncMore() {
272
269
  if (!R) return;
@@ -327,23 +324,55 @@ function askHtml() {
327
324
  + (R.askErr ? `<p class="vz-msg" data-tone="bad" role="alert">${esc(R.askErr)}</p>` : '')
328
325
  + `<div><button type="button" class="rp-btn${R.ask === 'discard' ? ' bad' : ' dark'}" data-r="askok"${R.busy ? ' disabled' : ''}>${esc(T[2])}</button><button type="button" class="rp-btn" data-r="askno">Keep it</button></div></div>`;
329
326
  }
330
- /** The summary card (XvAReport, XvAReportDoc): what this cycle is and the one thing to do with it. */
327
+ /** The summary card (OvReport): what waits on you, the one primary as an icon (Issue it, Share, Bring back), and the meta chips: the
328
+ * schedule (it opens Schedule) and who reads it, or its format. */
329
+ const PRI_ICON = { issue: 'send', share: 'share' };
330
+ const liveSched = () => (R.setup && R.setup.status !== 'paused' ? R.setup.schedule : null);
331
331
  function sumHtml() {
332
- const w = R.W || { sections: [] }, f = headFigure(w), P = R.view === 'doc' && !R.cyc ? paperModel(w, {}) : null;
332
+ const w = R.W || { sections: [] }, f = headFigure(w), confirm = !R.issued && R.BF ? R.BF.count : 0;
333
333
  const S = reportSummary({ state: R.archived ? 'archived' : R.issued ? 'issued' : 'draft', slot: R.row.slot || R.row.date, path: R.row.path,
334
- purpose: R.setup && R.setup.purpose, sub: w.sub, schedule: R.setup ? schedLabel(R.setup).replace(/^Not scheduled$/, '') : '', dataFrom: f && f.data,
335
- shares: R.shares, nextDraft: R.setup && R.setup.status !== 'paused' && R.setup.next_draft ? String(R.setup.next_draft).slice(0, 10) : '',
336
- view: R.view, slides: R.view === 'deck' ? slides().length : 0, pages: P ? P.n : 0, foot: !!(P && P.foot) });
337
- return czSummary({ line: S.line, tone: S.tone, text: S.text, meta: S.meta, primary: { label: S.primary.label, act: S.primary.r, disabled: R.busy } });
334
+ purpose: R.setup && R.setup.purpose, sub: w.sub, dataFrom: f && f.data, confirm,
335
+ shares: R.shares, nextDraft: R.setup && R.setup.status !== 'paused' && R.setup.next_draft ? String(R.setup.next_draft).slice(0, 10) : '' });
336
+ const readBy = R.BF && R.BF.glance.readBy && R.BF.glance.readBy.length <= 28 && R.BF.glance.readBy.toLowerCase() !== String(R.audience || '').toLowerCase() ? R.BF.glance.readBy : '';
337
+ const fmt = R.setup && R.setup.output ? FORMATS[R.setup.output] || R.setup.output : '';
338
+ const chips = [R.setup === undefined ? null : { icon: 'repeat', label: cadenceWords(liveSched()), act: R.archived ? '' : 'sched', exp: R.archived ? null : R.pop === 'sched' },
339
+ readBy ? { icon: 'people', label: readBy } : fmt ? { icon: 'file', label: fmt } : null];
340
+ return rpSumHtml({ line: S.line, tone: S.tone, right: R.issued ? '' : goesOutWords(liveSched()), text: S.text, chips,
341
+ primary: { act: S.primary.r, label: S.primary.label, icon: PRI_ICON[S.primary.r] || 'back', disabled: R.busy } });
342
+ }
343
+ /** The bar (OvReport): Slides | Document | Live page, then Edit (a draft), Present, Share (when it is not the primary) and Download. */
344
+ function barHtml() {
345
+ return rpBarHtml({ view: R.view, views: [['deck', 'Slides'], ['doc', 'Document'], ['live', 'Live page']], tools: [
346
+ R.issued ? null : { act: 'edit', label: 'Edit', icon: 'pen' }, { act: 'present', label: 'Present', icon: 'present' },
347
+ R.issued && !R.archived ? null : { act: 'share', label: 'Share', icon: 'share', exp: R.pop === 'share', pop: 'dialog' },
348
+ { act: 'dlm', label: 'Download', icon: 'dl', exp: R.pop === 'dl' }] });
349
+ }
350
+ /** The folds (OvReport): Please confirm (what waits), At a glance, Earlier cycles, Structure and look. A fold with nothing in it is not drawn. */
351
+ function foldsHtml() {
352
+ const B = R.BF, o = { issued: R.issued, busy: R.busy }, others = R.cycles.filter((x) => x.path !== R.row.path);
353
+ const msg = R.bfMsg ? `<p class="vz-msg" role="status">${esc(R.bfMsg)}</p>` : '';
354
+ const cyc = (x) => x.archived
355
+ ? `<div class="rp-cy"><span><b>${esc(cycleName(x, R.id))}</b><small>Archived</small></span><button type="button" class="rp-btn soft" data-r="unarch|${esc(x.path)}"${R.busy ? ' disabled' : ''}>Bring back</button></div>`
356
+ : `<button type="button" class="rp-cy" data-r="cyc|${esc(x.path)}"><span><b>${esc(cycleName(x, R.id))}</b><small>${x.state === 'issued' ? 'Issued' : 'Draft'}</small></span>${ic('next', 15)}</button>`;
357
+ const heads = ((R.W && R.W.sections) || []).map((x) => x.h);
358
+ const saved = B && B.saved != null ? B.saved : null;
359
+ return czSections([
360
+ B && B.count && !R.issued ? { id: 'confirm', title: 'Please confirm', count: B.count, open: true, render: () => briefConfirmHtml(B, o) + msg } : null,
361
+ B ? { id: 'glance', title: 'At a glance', count: 'For, read by, built from', render: () => briefGlanceHtml(B) } : null,
362
+ others.length ? { id: 'cycles', title: 'Earlier cycles', count: others.length, render: () => `<div class="rp-cys">${others.map(cyc).join('')}</div>` } : null,
363
+ B ? { id: 'look', title: 'Structure and look', count: saved != null ? 'v' + saved : '', render: () => (heads.length ? `<p class="rp-lbl">Sections</p><ol class="rp-ol">${heads.map((h) => `<li>${esc(h)}</li>`).join('')}</ol>` : '')
364
+ + `<p class="rp-lbl">Why it looks like this</p>${briefWhyHtml(B)}${briefLooksHtml(B, o)}${B.count ? '' : msg}` } : null,
365
+ ], { key: 'report' });
338
366
  }
339
367
  function deckHtml() {
340
368
  const L = slides();
341
369
  if (!L.length) return '<p class="vz-empty">This cycle has no slides. Read it as a page.</p>';
342
370
  const i = R.i = Math.max(0, Math.min(R.i, L.length - 1));
343
371
  return `<div class="vz-slide" tabindex="0" role="group" aria-roledescription="slide" aria-label="Slide ${i + 1} of ${L.length}: ${esc(L[i].h)}. Use the arrow keys to change slide." data-r="slide">${slideCard(L[i])}</div>`
344
- + `<div class="rp-strip">${ib('prev', ic('prev', 17), 'Previous slide', { off: i === 0 })}<div class="vz-thumbs rp-thumbs" role="group" aria-label="Slides">`
372
+ + `<div class="rp-nav">${ib('prev', ic('prev', 15), 'Previous slide', { off: i === 0 })}<span class="rp-count" aria-live="polite">Slide ${i + 1} of ${L.length}</span>${ib('next', ic('next', 15), 'Next slide', { off: i === L.length - 1 })}</div>`
373
+ + `<div class="vz-thumbs rp-thumbs" role="group" aria-label="Slides">`
345
374
  + L.map((x, j) => `<button type="button" class="vz-th rp-th${x.k === 'title' ? ' rp-tt' : ''}" data-r="go|${j}"${j === i ? ' aria-current="true"' : ''} aria-label="Slide ${j + 1}: ${esc(x.h)}" title="${j + 1} · ${esc(x.h)}">${x.k === 'frame' ? `<span>${slideCard(x, true)}</span>` : ''}</button>`).join('')
346
- + `</div>${ib('next', ic('next', 17), 'Next slide', { off: i === L.length - 1 })}</div><p class="rp-count" aria-live="polite">${i + 1} of ${L.length}</p>`;
375
+ + '</div>';
347
376
  }
348
377
  function pageHtml() {
349
378
  if (R.cyc) return `<div class="vz-pagefr">${frame(R.cyc.style, R.cyc.body, '', 'The report as a page')}</div>`;
@@ -362,12 +391,9 @@ function bodyHtml() {
362
391
  + (R.view === 'deck' && !R.noTip ? `<p class="vz-tip"><span>${tipText(at, n)}</span>${ib('notip', ic('x', 14), 'Hide this tip', { cls: ' vz-small' })}</p>` : '')
363
392
  + (R.view === 'deck' ? '' : `<div class="vz-r1">${WAIT('Page editor')}</div>`) + '<div class="vz-ed" data-vz-ed></div></div>';
364
393
  }
365
- if (R.tab === 'brief') { // ⋯ Brief: the brief in place of the report, ← back to it
366
- return `<div class="vz-rpb"><div class="rp-back">${ib('tab|report', ic('prev', 17), 'Back to the report')}<b>Brief</b></div>${briefHtml(R.BF, { issued: R.issued, busy: R.busy, msg: R.bfMsg })}</div>`;
367
- }
368
394
  const view = R.err ? `<p class="vz-msg" data-tone="bad" role="alert">The document could not be read: ${esc(R.err)}</p>` : !R.W ? '<p class="vz-empty" role="status">Reading the report.</p>'
369
395
  : R.view === 'deck' ? deckHtml() : R.view === 'live' ? liveView() : pageHtml();
370
- return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${view}${askHtml()}</div>`;
396
+ return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${R.W && !R.err ? barHtml() : ''}${view}${R.W && !R.err ? foldsHtml() : ''}${askHtml()}</div>`;
371
397
  }
372
398
  const tipText = (i, n) => `Slide ${i + 1} of ${n}. Click an item to change it; double-click text to type.`;
373
399
  /** The editor's slide and its undo history changed: the tip and the dimmed Undo and Redo follow it. */
@@ -377,12 +403,11 @@ function edState(S) {
377
403
  const u = b.querySelector('[data-r="ed|undo"]'), r = b.querySelector('[data-r="ed|redo"]');
378
404
  if (u) u.classList.toggle('vz-dim', !S.hist.length); if (r) r.classList.toggle('vz-dim', !S.fut.length);
379
405
  }
380
- /** The whole panel as html. */
381
- /** The whole panel as html. Shell A (XvAReport): the summary card with its one primary, the report, and the popovers ⋯ opens, kept at the top of
382
- * the card as it scrolls. While editing, the edit bar takes the summary's place. */
406
+ /** The whole panel as html (OvReport): the summary card with its one primary, the bar, the report, the folds, and the popovers kept at the
407
+ * top of the card as it scrolls. While editing, the edit bar takes the summary's place. */
383
408
  export function panelHtml() {
384
409
  const pop = R.edit ? '' : R.pop === 'share' ? sharePop() : R.pop === 'sched' ? schedPop() : R.pop === 'dl' ? dlPop() : R.pop === 'cyc' ? cycPop() : '';
385
- return `<div class="vz vz-rp0 rp-a" data-view="${R.view}" data-tab="${R.tab}"${R.edit ? ' data-edit' : ''}>${pop ? `<div class="rp-pops">${pop}</div>` : ''}`
410
+ return `<div class="vz vz-rp0 rp-a" data-view="${R.view}"${R.edit ? ' data-edit' : ''}>${pop ? `<div class="rp-pops">${pop}</div>` : ''}`
386
411
  + `${R.edit ? `<div class="vz-rph">${chipsHtml()}${toolHtml()}</div>` : ''}${bodyHtml()}</div>`;
387
412
  }
388
413
 
@@ -443,7 +468,6 @@ export function fit(root) { root.querySelectorAll('.vz-fr').forEach((c) => { if
443
468
  const say = (text, tone) => { R.msg = { text, tone }; draw(); };
444
469
  async function act([k, v], t) {
445
470
  if (k === 'pop') { R.pop = v || null; return draw(); }
446
- if (k === 'tab') { if (R.tab === v) return; R.tab = v; R.pop = null; R.conf = false; R.ask = ''; if (v === 'brief' && !R.BF) readBrief(); return draw(); }
447
471
  if (k === 'bf') return briefAct(v, t.dataset.r.split('|').slice(2).join('|'));
448
472
  if (k === 'lv') return liveAct(v, t.dataset.r.split('|').slice(2).join('|'));
449
473
  if (k === 'dlm') { R.pop = R.pop === 'dl' ? null : 'dl'; return draw(); }
@@ -829,7 +853,7 @@ export async function openReport(row, hand = {}) {
829
853
  rpStyle();
830
854
  if (R) present(false);
831
855
  const me = R = { row, ws: hand.ws || '', id: c.cadence, name: hand.name || row.name || c.cadence || 'Report', audience: hand.audience || '', issued: row.state === 'issued', archived: !!row.archived,
832
- text: '', err: '', W: null, view: 'deck', tab: 'report', BF: null, bfRaw: null, bfMsg: '', LV: null, blank: false, i: 0, cyc: null, setup: undefined, pop: null, conf: false, checks: null, issueErr: '', busy: false, ask: '', askErr: '', edit: false, msg: null,
856
+ text: '', err: '', W: null, view: 'deck', BF: null, bfRaw: null, bfMsg: '', LV: null, blank: false, i: 0, cyc: null, setup: undefined, pop: null, conf: false, checks: null, issueErr: '', busy: false, ask: '', askErr: '', edit: false, msg: null,
833
857
  sch: schedPick(null), schErr: '', shr: null, shares: null, more: [], hand, cycles: (hand.cycles || []).slice(), onIssue: hand.onIssue || null, onChange: hand.onChange || null, vid: 'report:' + row.path };
834
858
  const head = me.head = () => ({ id: me.vid, kind: 'Report' + (me.audience ? ' · ' + me.audience : ''), title: me.name, icon: me.view === 'doc' ? 'doc' : 'report', full: true, url: viewUrl(row, me.ws), more: me.more,
835
859
  render: (b) => { syncMore(); b.innerHTML = panelHtml(); wire(b); }, onClose: () => { if (R === me && !me.reopen) { present(false); R = null; } } });
@@ -2,11 +2,11 @@
2
2
  * premium-agreed-design, area viewer: Main.dc.html viewer "deck"). The PM asks in the chat, Claude ends its answer with a `pmos-report` block
3
3
  * (public/pm/report-chat.js), and this view shows it in the czViewer card (cozy-viewer.js): no #dlg, no old tab, no premium.css.
4
4
  *
5
- * A NEW REPORT (block.proposal) is drawn as the design's slide deck: kind "Slide deck", the report's name, one large slide (the title slide,
6
- * then one slide per section every new report has), ‹ "Slide n of N" ›, and the thumbnails. Under it, At a glance as the Brief draws it
7
- * (premium-uncovered-features, canvas RpBrief): For, Read by, Goes out (the Schedule chip) and Format, then Set it up
8
- * (POST /api/report-setups/setup). A report with Schedule Off (none said) is then paused at once with POST /api/report-setups/edit, so it
9
- * runs once (PM, 2026-10-21).
5
+ * A NEW REPORT (block.proposal) opens the one report Viewer in its first state (canvas OvReport; newHtml): kind "Report · <audience>",
6
+ * the summary "New · from your chat", "Not set up yet", Set it up as a check icon (POST /api/report-setups/setup) and the chips Once (the
7
+ * schedule; it opens the choices) and the format; Slides | Document; the deck (the title slide, then one slide per section every new
8
+ * report has, ‹ "Slide n of N" ›, the thumbnails); the folds At a glance and Structure and look. A report with Schedule Off (none said) is
9
+ * then paused at once with POST /api/report-setups/edit, so it runs once (PM, 2026-10-21).
10
10
  * A SET-UP REPORT (block.id): At a glance with the Schedule chip (POST .../edit), Structure | Design with their versions, the cycles (Open
11
11
  * opens one in the report panel, czViews.openReport), Share, Discard or Archive, and Delete template (POST .../remove). A change Claude proposes
12
12
  * in words (block.structure, block.design, block.schedule) shows as one press. Structure: GET /api/report-structure; turn, accept (Use this) and
@@ -17,11 +17,12 @@
17
17
  * Every write is a press here, behind the launch nonce (http.js pmPost). Claude writes nothing: the routes refuse an agent session. A render is
18
18
  * HTML the server sanitized, shown in a frame with an empty sandbox, so nothing in it runs. Nothing is sent outward. */
19
19
  import { pmGet, pmPost } from './http.js';
20
- import { open as vOpen, current as vCur, body as vBody } from './cozy-viewer.js';
20
+ import { open as vOpen, current as vCur, body as vBody, czSections } from './cozy-viewer.js';
21
+ import { rpSumHtml, rpBarHtml, cadenceWords, FORMATS } from './rp-parts.js';
21
22
  import { vzStyle } from './premium-vw-open.js';
22
23
 
23
24
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
24
- const OUT = { 'google-slides': 'Google Slides', 'google-doc': 'Google Doc', 'google-sheets': 'Google Sheets', confluence: 'Confluence page', pdf: 'PDF' };
25
+ const OUT = FORMATS;
25
26
  const FRAME = [['Headline', 'The one thing the readers must know this cycle.'], ['Timeline', 'The dated items, written in full.'], ['Initiatives', 'Done, in progress, next and the key open item.'],
26
27
  ['New since last report', 'What is new in the window, each with its date.'], ['Decided this cycle', 'The decisions, marked Decided or Acknowledged.'], ['Needs your call', 'The asks to the readers: what, who, by when.'], ['Sources', 'The sources reached and not reached.']];
27
28
  const DAYN = { Mon: 'Mondays', Tue: 'Tuesdays', Wed: 'Wednesdays', Thu: 'Thursdays', Fri: 'Fridays', Sat: 'Saturdays', Sun: 'Sundays' };
@@ -60,7 +61,7 @@ export function openReportTab(block) {
60
61
  const id = 'report:' + (block.id || block.proposal.name).toLowerCase().replace(/[^a-z0-9]+/g, '-').slice(0, 60);
61
62
  let t = T.get(id);
62
63
  if (!t || JSON.stringify(t.block) !== JSON.stringify(block)) {
63
- t = { id, block, sched: block.proposal ? (block.proposal.schedule || 'off') : null, open: false, view: 'structure', busy: false, msg: '', setup: null, docs: [], S: null, Z: null, sv: null, dv: null, render: new Map(), gone: false, loaded: false, i: 0, ask: null };
64
+ t = { id, block, nv: 'deck', sched: block.proposal ? (block.proposal.schedule || 'off') : null, open: false, view: 'structure', busy: false, msg: '', setup: null, docs: [], S: null, Z: null, sv: null, dv: null, render: new Map(), gone: false, loaded: false, i: 0, ask: null };
64
65
  T.set(id, t);
65
66
  if (block.id) load(t);
66
67
  }
@@ -68,7 +69,7 @@ export function openReportTab(block) {
68
69
  }
69
70
  function show(t) {
70
71
  const P = t.block.proposal;
71
- return vOpen({ id: t.id, kind: P ? 'Slide deck' : 'Report template', title: P ? P.name : (t.setup && t.setup.name) || t.block.id, icon: P ? 'slides' : 'report',
72
+ return vOpen({ id: t.id, kind: P ? 'Report' + (P.audience ? ' · ' + P.audience : '') : 'Report template', title: P ? P.name : (t.setup && t.setup.name) || t.block.id, icon: 'report',
72
73
  render: (el) => { el.onclick = (e) => press(t, e); draw(t, el); } });
73
74
  }
74
75
  const paneOf = (t) => (vCur() && vCur().id === t.id ? vBody() : null);
@@ -121,11 +122,15 @@ const lastSaid = (log) => { const l = (log || []).filter((x) => x.who === 'pmos'
121
122
  const btn = (a, label, o = {}) => `<button type="button" class="${o.sec ? 'vz-sec2' : 'vz-issue'} vz-hv${o.cls ? ' ' + o.cls : ''}" data-rt="${esc(a)}"${o.off ? ' disabled' : ''}${o.pressed != null ? ` aria-pressed="${o.pressed}"` : ''}>${esc(label)}</button>`;
122
123
  function schedHtml(t, cur) {
123
124
  const chip = `<button type="button" class="vz-c vz-hv" data-rt="sched" aria-haspopup="menu" aria-expanded="${t.open}">${SV('M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 7v5l3 2', 14)}Schedule · <b>${esc(schedWords(cur))}</b>${SV('M7 10l5 5 5-5', 14)}</button>`;
124
- if (!t.open) return chip;
125
+ return chip + schedMenu(t, cur);
126
+ }
127
+ /** The schedule's choices, under the chip that opened them (a set-up report's Schedule chip, a new report's meta chip). */
128
+ function schedMenu(t, cur) {
129
+ if (!t.open) return '';
125
130
  const opts = schedChoices(cur).map((s, i) => `<button type="button" class="vz-mi vz-hv" role="menuitemradio" aria-checked="${sameSched(s, cur)}" data-rt="pick|${i}"><span class="vz-ring"></span>${esc(schedWords(s))}</button>`).join('');
126
131
  const days = cur && cur !== 'off' && (cur.cadence === 'weekly' || cur.cadence === 'bi-weekly')
127
132
  ? `<div class="vz-r1 vz-g6" role="group" aria-label="Day">${Object.keys(DAYN).slice(0, 5).map((d) => `<button type="button" class="vz-dbtn vz-hv" data-rt="day|${d}" aria-pressed="${cur.day === d}">${d}</button>`).join('')}</div>` : '';
128
- return chip + `<div class="vz-schm" role="menu" aria-label="Schedule">${opts}${days}<p class="vz-note">Or say it in the chat: “make it every two weeks”.</p></div>`;
133
+ return `<div class="vz-schm" role="menu" aria-label="Schedule">${opts}${days}<p class="vz-note">Or say it in the chat: “make it every two weeks”.</p></div>`;
129
134
  }
130
135
  /** At a glance (RpBrief): For, Read by, Goes out (the Schedule chip, html) and Format. A field no record holds says "not said". */
131
136
  const glance = (forTxt, readBy, goes, fmt) => `<dl class="rp-kv"><dt>For</dt><dd>${forTxt ? esc(forTxt) : '<span class="rp-ns">not said</span>'}</dd><dt>Read by</dt><dd>${readBy ? esc(readBy) : '<span class="rp-ns">not said</span>'}</dd>`
@@ -143,13 +148,28 @@ function draw(t, el) {
143
148
  export function deckOf(p) {
144
149
  return [{ eye: p.audience ? 'For ' + p.audience : 'New report', h: p.name, t: p.purpose || '' }].concat(FRAME.map(([h, d]) => ({ eye: p.name, h, t: d })));
145
150
  }
151
+ /**
152
+ * A new report from the chat: the one report Viewer in its first state (canvas OvReport). The summary says it is new and not set up, what
153
+ * it will hold, and its one primary, Set it up (a check icon); its chips are the schedule (Once until one is picked; it opens the choices)
154
+ * and the format. Slides | Document, then the deck (the slide, ‹ Slide n of N ›, the thumbnails) or the outline as a page. The folds are
155
+ * At a glance and Structure and look ("new"). Edit, Present, Share and Download have nothing to act on until it is set up, so they are not drawn.
156
+ */
146
157
  function newHtml(t) {
147
158
  const p = t.block.proposal, L = deckOf(p), i = t.i = Math.max(0, Math.min(t.i, L.length - 1)), s = L[i];
148
- return `<div class="vz-dks" role="group" aria-roledescription="slide" aria-label="Slide ${i + 1} of ${L.length}: ${esc(s.h)}"><p class="vz-dke">${esc(s.eye)}</p><h2>${esc(s.h)}</h2>${s.t ? `<p>${esc(s.t)}</p>` : ''}</div>`
159
+ const sum = rpSumHtml({ line: 'New · from your chat', tone: 'you', right: 'Not set up yet',
160
+ text: 'One slide per section: ' + FRAME.map(([h]) => h).join(', ') + '. Nothing goes out until you set it up.',
161
+ chips: [{ icon: 'repeat', label: cadenceWords(t.sched), act: 'sched', exp: t.open }, { icon: 'file', label: OUT[p.output] || p.output || 'PDF' }],
162
+ primary: { act: 'setup', label: t.busy ? 'Setting it up' : 'Set it up', icon: 'check', disabled: t.busy } }, 'data-rt');
163
+ const bar = rpBarHtml({ view: t.nv, views: [['deck', 'Slides'], ['doc', 'Document']] }, 'data-rt');
164
+ const deck = `<div class="vz-dks" role="group" aria-roledescription="slide" aria-label="Slide ${i + 1} of ${L.length}: ${esc(s.h)}"><p class="vz-dke">${esc(s.eye)}</p><h2>${esc(s.h)}</h2>${s.t ? `<p>${esc(s.t)}</p>` : ''}</div>`
149
165
  + `<div class="vz-dkn"><button type="button" class="vz-dkb vz-hv" data-rt="sl|-1" aria-label="Previous slide"${i === 0 ? ' disabled' : ''}>${SV('M15 6l-6 6 6 6')}</button><span aria-live="polite">Slide ${i + 1} of ${L.length}</span><button type="button" class="vz-dkb vz-hv" data-rt="sl|1" aria-label="Next slide"${i === L.length - 1 ? ' disabled' : ''}>${SV('M9 6l6 6-6 6')}</button></div>`
150
- + `<div class="vz-dkt" role="group" aria-label="Slides">${L.map((x, k) => `<button type="button" class="vz-hv" data-rt="go|${k}" aria-label="Slide ${k + 1}: ${esc(x.h)}"${k === i ? ' aria-current="true"' : ''}><span>${esc(x.h)}</span></button>`).join('')}</div>`
151
- + `<section class="vz-blk rp-brief" aria-label="Set it up"><p class="rp-lbl">At a glance</p>${glance(p.purpose, p.audience, schedHtml(t, t.sched), OUT[p.output] || p.output)}`
152
- + `<p class="vz-note">Every new report has these sections. Once it is set up, ask in the chat to shape them.</p><div class="vz-r1">${btn('setup', t.busy ? 'Setting it up' : 'Set it up', { off: t.busy })}</div></section>`;
166
+ + `<div class="vz-dkt" role="group" aria-label="Slides">${L.map((x, k) => `<button type="button" class="vz-hv" data-rt="go|${k}" aria-label="Slide ${k + 1}: ${esc(x.h)}"${k === i ? ' aria-current="true"' : ''}><span>${esc(x.h)}</span></button>`).join('')}</div>`;
167
+ const page = `<article class="vz-dkp"><h2>${esc(p.name)}</h2>${p.purpose ? `<p class="vz-note">${esc(p.purpose)}</p>` : ''}${sectionsHtml(FRAME)}</article>`;
168
+ const folds = czSections([
169
+ { id: 'glance', title: 'At a glance', count: 'For, read by, goes out', render: () => `<div class="rp-brief">${glance(p.purpose, p.audience, esc(schedWords(t.sched)), OUT[p.output] || p.output)}</div>` },
170
+ { id: 'look', title: 'Structure and look', count: 'new', render: () => `${sectionsHtml(FRAME)}<p class="vz-note">Every new report has these sections. Once it is set up, ask in the chat to shape them. It uses the standard PMOS look until you say how it should look.</p>` },
171
+ ], { key: 'report-new' });
172
+ return sum + schedMenu(t, t.sched) + bar + (t.nv === 'doc' ? page : deck) + folds;
153
173
  }
154
174
  function setupHtml(t) {
155
175
  const s = t.setup;
@@ -228,6 +248,7 @@ async function press(t, e) {
228
248
  if (a === 'askno') { t.ask = null; redraw(t); return; }
229
249
  if (a === 'askyes') { const A = t.ask; t.ask = null; if (A) await A.run(); return; }
230
250
  if (a === 'sl') { t.i += +v; redraw(t); return; }
251
+ if (a === 'view' && t.block.proposal) { t.nv = v; redraw(t); return; }
231
252
  if (a === 'go') { t.i = +v; redraw(t); return; }
232
253
  if (a === 'sched') { t.open = !t.open; redraw(t); return; }
233
254
  if (a === 'pick') { await setSchedule(t, schedChoices(cur)[+v]); return; }
@@ -393,7 +393,7 @@ export function closeDlg() {
393
393
  $('#dlg').inert = true; document.documentElement.style.overflow = ''; $('#dlg').classList.remove('on');
394
394
  if (lastFocus) { try { lastFocus.focus(); } catch { /* gone */ } }
395
395
  }
396
- export function pillOf(s) { const o = $('button[aria-pressed="true"]', s), p = $('.pill', s); requestAnimationFrame(() => { if (!o || !p) return; p.style.left = o.offsetLeft + 'px'; p.style.width = o.offsetWidth + 'px'; }); }
396
+ export function pillOf(s) { if (!s) return; const o = $('button[aria-pressed="true"]', s), p = $('.pill', s); requestAnimationFrame(() => { if (!o || !p) return; p.style.left = o.offsetLeft + 'px'; p.style.width = o.offsetWidth + 'px'; }); }
397
397
  export function setTab(t) {
398
398
  if (chatPage() && innerWidth < 1000) { // premium-chat-viewer V5: the Chat page on a phone has no switch; the viewer is a layer over the conversation
399
399
  if (t === 'out') { if (vwCount()) vwOpenPane(); return; }
@@ -4,6 +4,7 @@
4
4
  * and an answer that is still reading or failed is said as such. Every value is escaped here. */
5
5
 
6
6
  import { cardHtml, taskOf } from './task-card.js';
7
+ import { tkHtml, ticketOf } from './tk-view.js';
7
8
 
8
9
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
9
10
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@@ -47,8 +48,8 @@ export function iniHtml(m, pageHref) {
47
48
  return `<article class="paper doc vwi">${top}${kv(facts)}${sec('Next', next)}${sec('Watch', watch.length ? `<ul class="vwi-w">${watch.map((w) => `<li>${esc(w)}</li>`).join('')}</ul>` : '')}${sec('Checks', checks)}${sec('Tasks', tasks)}${sec('Links', linkHtml)}${miss}<p class="vwi-foot"><a class="vwi-go" href="${esc(pageHref)}">Open the initiative page</a></p></article>`;
48
49
  }
49
50
 
50
- /** The task tab. A PMOS task or a Jira ticket is the one task editor (task-card.js; canvas XetX1Rest, XetX1Jira): this is its first drawing,
51
- * and premium-vw-item.js mounts the same card to edit it. A PRD requirement is read from the PRD and has nothing to edit. A task the model
51
+ /** The task tab. A PMOS task is the one task Viewer (task-card.js) and a Jira ticket the one ticket Viewer (tk-view.js; canvas OvViewers):
52
+ * this is its first drawing, and premium-vw-item.js mounts the same view to edit it. A PRD requirement is read from the PRD and has nothing to edit. A task the model
52
53
  * no longer holds says so. o: { groups, inis, owners, now } for the card's pickers. */
53
54
  export function taskHtml(m, key, o = {}) {
54
55
  const t = findTask(m, key);
@@ -57,7 +58,9 @@ export function taskHtml(m, key, o = {}) {
57
58
  const note = 'Read from the initiative’s PRD' + (m.tasks && m.tasks.basis && m.tasks.basis.source ? ' (' + m.tasks.basis.source + ')' : '') + '. The repository records no result for one requirement.';
58
59
  return `<article class="paper doc vwi"><div class="vwi-head"><b>${esc(t.title)}</b></div><p class="vwi-p">${esc(note)}</p>${iniLink(m)}</article>`;
59
60
  }
60
- return `<article class="paper doc vwi vwi-tk">${cardHtml(cardTask(m, t), o)}</article>`;
61
+ const c = cardTask(m, t);
62
+ if (c.jira) return `<article class="paper doc vwi vwi-tk">${tkHtml(ticketOf({ base: { key: c.jira.key, title: c.title, status: c.status }, ini: m.id, iniTitle: m.title, readAt: c.jira.readAt, notes: c.notes }), o)}</article>`;
63
+ return `<article class="paper doc vwi vwi-tk">${cardHtml(c, o)}</article>`;
61
64
  }
62
65
  /** A task row of the model as the card's task (task-card.js taskOf). */
63
66
  export const cardTask = (m, row, group = '') => taskOf(row, { ini: m.id, iniTitle: m.title, group, board: m.board && m.board.id });
@@ -7,7 +7,7 @@
7
7
  * 'reading' while the board derives, and the tab asks again. Inside a tab a task opens its own tab and the initiative link opens the initiative's. */
8
8
  import { vwOpen, vwStyle } from './premium-viewer.js';
9
9
  import { esc, iniId, taskId, stateOf, readingHtml, errorHtml, iniHtml, taskHtml, findTask, cardTask } from './premium-vw-item-model.js';
10
- import { mountCard, boardSaver, checkOf, cardStyle, toastUndo } from './task-card.js';
10
+ import { mountCard, boardSaver, checkOf, cardStyle, toastUndo, placeOf } from './task-card.js';
11
11
  import { pmPost } from './http.js';
12
12
  import { setCheck } from './cozy-viewer.js';
13
13
 
@@ -72,24 +72,37 @@ export function openWorkItem(o) {
72
72
  };
73
73
  },
74
74
  });
75
- /* the one task editor: a PMOS task edits in place; a Jira ticket keeps Jira's fields and takes the PM's notes */
75
+ /* the one task Viewer: a PMOS task edits in place; a Jira ticket is the one ticket Viewer (tk-view.js), its Jira fields plain, its notes the PM's */
76
76
  function mountTask(el, m, row) {
77
77
  const ws = ctx.ws || (m.board && m.board.ws) || '', board = ctx.board || (m.board && m.board.id) || '';
78
78
  const t = cardT = cardTask(m, row);
79
- const lists = { inis: null, owners: null, groups: null };
79
+ const lists = { inis: null, owners: null, groups: null, sections: null };
80
80
  const host = document.createElement('article'); host.className = 'paper doc vwi vwi-tk'; el.innerHTML = ''; el.append(host);
81
+ if (t.jira) {
82
+ try { setCheck('vw:' + vid, null); } catch { /* the old dialog has no header check */ } // Jira owns the status: the tile, not a check box
83
+ card = { setStatus: () => {} };
84
+ import('./tk-view.js').then(async (TV) => {
85
+ const base = { key: t.jira.key, title: t.title, status: t.status };
86
+ const v = TV.mountTicket(host, TV.ticketOf({ base, ini: m.id, iniTitle: m.title, readAt: t.jira.readAt, notes: t.notes }), { ws, board, post: (p, b) => pmPost(p, b), toast: toastUndo,
87
+ openIni: (id) => openWorkItem({ kind: 'initiative', id, title: id === m.id ? m.title : '', ws: ctx.ws, board: ctx.board }),
88
+ openRef: (ref) => import('./premium-vw-jira.js').then((J) => J.openTicket({ ws, board, initiative: m.id, ref })) });
89
+ const R = await TV.readTicket({ ws, board, ini: m.id, iniTitle: m.title, ref: t.jira.key });
90
+ if (!host.isConnected) return;
91
+ Object.assign(v.ticket, TV.ticketOf({ base, model: R.model, notes: R.notes != null ? R.notes : t.notes, ini: m.id, iniTitle: m.title, readAt: t.jira.readAt || (R.model && R.model.readAt) }));
92
+ v.draw();
93
+ });
94
+ return;
95
+ }
81
96
  const check = () => { try { setCheck('vw:' + vid, checkOf(t)); } catch { /* the old dialog has no header check */ } };
82
97
  card = mountCard(host, t, {
83
98
  save: boardSaver({ ws, board, t, post: (p, b) => pmPost(p, b) }),
84
99
  toast: toastUndo,
85
100
  changed: () => { cache.clear(); check(); }, // the next read of the initiative sees the change
86
101
  openIni: (id) => openWorkItem({ kind: 'initiative', id, title: id === m.id ? m.title : '', ws: ctx.ws, board: ctx.board }),
87
- openTicket: (x) => import('./premium-vw-jira.js').then((J) => J.openTicket({ ws, board, initiative: x.ini, ref: x.jira.key })).catch(() => toastUndo('The ticket could not open.')),
88
102
  iniTitleOf: (id) => ((lists.inis || []).find((x) => x.id === id) || {}).title || id,
89
- inis: () => lists.inis || [], owners: () => lists.owners || [], groups: () => lists.groups,
103
+ inis: () => lists.inis || [], owners: () => lists.owners || [], groups: () => lists.groups, sections: () => lists.sections,
90
104
  });
91
105
  check();
92
- if (t.jira) return;
93
106
  // the pickers' lists: the board's initiatives and owners, the initiative's groups (read once, after the card shows)
94
107
  const q = (p) => fetch(p, { credentials: 'same-origin' }).then((r) => r.json()).catch(() => null);
95
108
  const wq = ws ? '&ws=' + encodeURIComponent(ws) : '';
@@ -100,6 +113,12 @@ export function openWorkItem(o) {
100
113
  lists.owners = [...new Set((items.items || []).filter((x) => x.src === 'pmos' && x.owner).map((x) => x.owner))];
101
114
  }
102
115
  if (L && L.ok) { lists.groups = L.names || []; t.group = (L.of || {})[t.key] || ''; }
116
+ // where it sits: the initiative's stages (the sections), the task's section and its breakdown item
117
+ const ini = items && items.ok ? (items.initiatives || []).find((x) => x.id === t.ini) : null;
118
+ lists.sections = ini && Array.isArray(ini.stages) && ini.stages.length ? ini.stages : null;
119
+ const it = items && items.ok ? (items.items || []).find((x) => x.uid === t.uid) : null;
120
+ const sibs = items && items.ok ? (items.items || []).filter((x) => x.ini === t.ini && x.src !== 'jira') : [];
121
+ placeOf(it || row, lists.sections || [], sibs).then((P) => { if (!host.isConnected) return; t.section = P.section; t.wbs = P.wbs; card.draw(); });
103
122
  card.draw();
104
123
  });
105
124
  }
@@ -1,7 +1,7 @@
1
1
  /* pm/premium-vw-jira.js — a Jira ticket and a sprint board as tabs of the premium viewer (initiative premium-viewer, S5, PRD R5 and R6).
2
- * openTicket({ ws, board, initiative, ref }) a ticket of the initiative's Jira draft: key, title, status, sprint, points, its sections,
3
- * subtasks and links, and a line that sends the rest to Jira (PM, 2026-10-19: no comments,
4
- * history or fields panel; those stay in Jira)
2
+ * openTicket({ ws, board, initiative, ref }) a ticket: the one ticket Viewer of tk-view.js (feedback batch 6 item 1b), the same as the
3
+ * Board's. Comments, history and the other fields stay in Jira (PM, 2026-10-19). ticketHtml below
4
+ * now draws only the "nothing to show" state of a ticket no record holds.
5
5
  * openSprint({ ws, board, name }) a sprint of the board as columns by status; a card of the board opens its ticket
6
6
  * Reads GET /api/jira/tickets and GET /api/boards/sprints only; the model is pm/premium-vw-jira-model.js. Read-only: Jira owns status, sprint and
7
7
  * assignee (D88), so nothing here moves a ticket. With no Jira data a view says what is missing.
@@ -65,23 +65,25 @@ function ticketHtml(m) {
65
65
  </article></div>`;
66
66
  }
67
67
 
68
- /** A ticket of the initiative's Jira draft in its own tab. ref is a Jira key or a draft ticket id. */
68
+ /** A ticket of the initiative's Jira draft: the one ticket Viewer (tk-view.js; canvas OvViewers "Jira ticket"), the same as the Board's. A page
69
+ * with the old dialog (#dOut) gets it as a tab; every other page opens it in the Viewer card. ref is a Jira key or a draft ticket id. */
69
70
  export async function openTicket(o) {
70
71
  const { ws, board, initiative, ref } = o || {};
71
72
  if (!ref) return null;
72
- vwStyle('jira');
73
- const id = 'jira:' + ref;
73
+ const TV = await import('./tk-view.js');
74
74
  const draw = async (el) => {
75
- el.innerHTML = '<div class="jv"><p class="jnote">Reading the ticket</p></div>';
76
- const [view, sprints] = await Promise.all([initiative ? getJson('/api/jira/tickets', { ws, initiative }) : null, board ? getJson('/api/boards/sprints', { ws, board }) : null]);
77
- let m = ticketModel(view, ref, sprints);
78
- if (!m.ok && !(view && view.ok === false && view.error)) m = storedModel(await getJson('/api/jira/ticket', { ws, key: ref }), ref);
79
- el.innerHTML = ticketHtml(m); bars(el);
80
- const rd = el.querySelector('[data-jread]'); if (rd) rd.onclick = async () => { rd.disabled = true; toast(await askHere(readAsk(ref)) ? 'Claude is reading ' + ref + ' in this popup\'s chat.' : 'Open the ticket from its popup to read it.'); };
81
- el.querySelectorAll('[data-jt]').forEach((b) => { b.onclick = () => openTicket({ ws, board, initiative, ref: b.dataset.jt }); });
82
- const re = el.querySelector('[data-jre]'); if (re) re.onclick = async () => { await draw(el); toast('Read the cached Jira reading again. A Jira check reads Jira itself.'); };
75
+ el.innerHTML = '<div class="tkv"><p class="tkv-q">Reading the ticket</p></div>';
76
+ const R = await TV.readTicket({ ws, board, ini: initiative, ref });
77
+ if (!R.model.ok) {
78
+ el.innerHTML = ticketHtml(R.model);
79
+ const rd = el.querySelector('[data-jread]'); if (rd) rd.onclick = async () => { rd.disabled = true; toast(await askHere(readAsk(ref)) ? 'Claude is reading ' + ref + ' in this popup\'s chat.' : 'Open the ticket from its popup to read it.'); };
80
+ return;
81
+ }
82
+ TV.mountTicket(el, TV.ticketOf({ base: { key: R.model.key || ref, epic: R.epicKey }, model: R.model, notes: R.notes, ini: R.ini, iniTitle: R.iniTitle }), { ws, board, post: (p, b) => import('./http.js').then((H) => H.pmPost(p, b)),
83
+ openRef: (k) => openTicket({ ws, board, initiative, ref: k }) });
83
84
  };
84
- return vwOpen({ id, title: ref, icon: 'tk', render: (el) => { draw(el); } });
85
+ vwStyle('jira');
86
+ return vwOpen({ id: 'jira:' + ref, title: ref, icon: 'tk', render: (el) => { draw(el); } });
85
87
  }
86
88
 
87
89
  /* ── the sprint ─────────────────────────────────────────────────────────────────────────────────────────── */