create-pmos 0.443.0 → 0.445.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 (110) hide show
  1. package/package.json +25 -25
  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/adler-moments-test.js +8 -0
  8. package/workspace/adler-seasons-art-test.js +3 -0
  9. package/workspace/board-columns-test.js +168 -0
  10. package/workspace/board-programs-test.js +1 -1
  11. package/workspace/briefing-premium-board-test.js +91 -8
  12. package/workspace/briefing-premium-insights-test.js +83 -38
  13. package/workspace/briefing-premium-test.js +2 -1
  14. package/workspace/calm-timeline-test.js +3 -1
  15. package/workspace/changelog.json +24 -0
  16. package/workspace/goals-clear-ui-test.js +34 -20
  17. package/workspace/guide/home.md +5 -0
  18. package/workspace/guide/jira.md +13 -1
  19. package/workspace/guide/ready-made-dashboards.md +2 -2
  20. package/workspace/intel-report-ui-test.js +1 -1
  21. package/workspace/lib/board-fold.js +33 -5
  22. package/workspace/lib/board-premium.js +1 -1
  23. package/workspace/lib/console-state.js +5 -1
  24. package/workspace/lib/engine/boards.js +9 -2
  25. package/workspace/lib/factory-join.js +46 -14
  26. package/workspace/lib/freshness.js +14 -1
  27. package/workspace/lib/initiative-rows.js +38 -4
  28. package/workspace/lib/issues.js +8 -1
  29. package/workspace/lib/jira-cli.js +18 -2
  30. package/workspace/lib/jira-moves.js +119 -0
  31. package/workspace/lib/jira-tickets.js +23 -4
  32. package/workspace/lib/notes.js +4 -2
  33. package/workspace/lib/offloop.js +75 -29
  34. package/workspace/lib/page-build.js +97 -0
  35. package/workspace/lib/plan-items.js +24 -3
  36. package/workspace/lib/plan-tree.js +62 -9
  37. package/workspace/lib/ready-reports.js +22 -8
  38. package/workspace/lib/refresh.js +14 -2
  39. package/workspace/lib/routes-board-premium.js +9 -1
  40. package/workspace/lib/routes-boards.js +114 -16
  41. package/workspace/lib/routes-brief-page.js +3 -1
  42. package/workspace/lib/routes-calendar-import.js +13 -1
  43. package/workspace/lib/routes-ready-reports.js +28 -5
  44. package/workspace/lib/task-links.js +12 -1
  45. package/workspace/lib/workflows-store.js +14 -3
  46. package/workspace/live-pill-round-test.js +178 -0
  47. package/workspace/milestone-pins-test.js +1 -1
  48. package/workspace/okr-goals-ui-test.js +21 -19
  49. package/workspace/package-lock.json +2 -2
  50. package/workspace/package.json +1 -1
  51. package/workspace/panels-test.js +375 -0
  52. package/workspace/premium-rec-tab-test.js +2 -1
  53. package/workspace/premium-vw-item-test.js +10 -2
  54. package/workspace/premium-vw-jira-test.js +3 -0
  55. package/workspace/program-panel-test.js +6 -6
  56. package/workspace/public/pm/bd-cols.js +149 -0
  57. package/workspace/public/pm/bd-ini-panel.js +3 -2
  58. package/workspace/public/pm/bd-pane.js +41 -0
  59. package/workspace/public/pm/bd-span.js +29 -11
  60. package/workspace/public/pm/cozy-adler.js +21 -0
  61. package/workspace/public/pm/cozy-board.css +45 -0
  62. package/workspace/public/pm/cozy-divider.css +32 -0
  63. package/workspace/public/pm/cozy-divider.js +45 -0
  64. package/workspace/public/pm/cozy-insights.css +22 -0
  65. package/workspace/public/pm/cozy-live-pill.css +17 -22
  66. package/workspace/public/pm/cozy-live-pill.js +38 -18
  67. package/workspace/public/pm/cozy-panels.css +80 -0
  68. package/workspace/public/pm/cozy-panels.js +691 -0
  69. package/workspace/public/pm/cozy-viewer.js +148 -70
  70. package/workspace/public/pm/dash-view.js +5 -2
  71. package/workspace/public/pm/goals-clear.js +9 -2
  72. package/workspace/public/pm/home-app.js +30 -19
  73. package/workspace/public/pm/home-ini.js +9 -3
  74. package/workspace/public/pm/home-today.js +4 -2
  75. package/workspace/public/pm/ini-edit.js +405 -0
  76. package/workspace/public/pm/ini-tasks.js +175 -46
  77. package/workspace/public/pm/ini-versions.js +18 -4
  78. package/workspace/public/pm/ini-view-model.js +12 -7
  79. package/workspace/public/pm/ini-view.css +162 -26
  80. package/workspace/public/pm/ini-view.js +44 -13
  81. package/workspace/public/pm/ini-wf-model.js +9 -0
  82. package/workspace/public/pm/ini-wf.js +14 -9
  83. package/workspace/public/pm/ins-pane.js +55 -0
  84. package/workspace/public/pm/jira-move.js +50 -0
  85. package/workspace/public/pm/live-model.js +3 -2
  86. package/workspace/public/pm/pn-narrow.js +76 -0
  87. package/workspace/public/pm/premium-board.js +85 -32
  88. package/workspace/public/pm/premium-insights.js +211 -43
  89. package/workspace/public/pm/task-card.css +2 -0
  90. package/workspace/public/pm/task-card.js +4 -1
  91. package/workspace/public/premium-board.html +2 -0
  92. package/workspace/ready-dash-ui-test.js +4 -4
  93. package/workspace/server.js +71 -20
  94. package/workspace/skills/jira-move.skill +35 -0
  95. package/workspace/stage-card-tasks-test.js +397 -0
  96. package/workspace/stage-card-test.js +1 -1
  97. package/workspace/task-delete-test.js +9 -1
  98. package/workspace/task-links-test.js +1 -0
  99. package/workspace/task-milestones-test.js +3 -3
  100. package/workspace/task-plans-test.js +1 -1
  101. package/workspace/task-press-test.js +12 -4
  102. package/workspace/task-views-test.js +166 -13
  103. package/workspace/test-lists/batch18-live-pill-round.json +10 -0
  104. package/workspace/test-lists/batch18-panels.json +9 -0
  105. package/workspace/test-lists/board-columns.json +5 -0
  106. package/workspace/test-lists/jira-moves.json +11 -0
  107. package/workspace/test-lists/page-speed-fold.json +5 -0
  108. package/workspace/test-lists/page-speed-reads.json +5 -0
  109. package/workspace/test-lists/stage-card-tasks.json +6 -0
  110. package/workspace/timeline-holds-test.js +1 -1
@@ -25,6 +25,7 @@
25
25
  * picker and no drag. Archived tasks show in no view here (the List folds them after Done). */
26
26
  import { STATES, stateIcon, stateKey, datePickerHtml, cardStyle } from './task-card.js';
27
27
  import * as LK from './ini-links.js'; // the links' marks on bars and cards (batch 11 item 15)
28
+ import * as JM from './jira-move.js'; // a Jira ticket's status, moved in Jira (Wawan 2026-10-29)
28
29
 
29
30
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
30
31
  const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
@@ -81,15 +82,15 @@ const zoomOf = () => { if (!ZOOM) { const z0 = store.get('pmos.tasks.zoom'), z =
81
82
  /** The Timeline's zoom: 'week' | 'month' | 'all'. A stored zoom from before the three steps reads as All. */
82
83
  export const zoomMode = () => zoomOf();
83
84
  /** For the tests: forget the PM's picks. */
84
- export const resetViews = () => { VIEW = null; ZOOM = null; STAGE.clear(); SCROLL.clear(); };
85
+ export const resetViews = () => { VIEW = null; ZOOM = null; TC = null; STAGE.clear(); SCROLL.clear(); };
85
86
  /** The stage card's press on a stage (batch 11 item 21): the Kanban turns to that stage. */
86
87
  export const setKanbanStage = (id, key) => { if (id && key != null) STAGE.set(id, key); };
87
88
 
88
89
  /* ── days, as whole numbers (UTC, so a summer-time night never moves a bar) ── */
89
90
  const DAY = /^(\d{4})-(\d{2})-(\d{2})/;
90
- const dn = (iso) => { const m = DAY.exec(String(iso || '')); return m ? Math.round(Date.UTC(+m[1], +m[2] - 1, +m[3]) / 864e5) : null; };
91
+ export const dn = (iso) => { const m = DAY.exec(String(iso || '')); return m ? Math.round(Date.UTC(+m[1], +m[2] - 1, +m[3]) / 864e5) : null; };
91
92
  export const isoN = (n) => new Date(n * 864e5).toISOString().slice(0, 10);
92
- const md = (n) => { const d = new Date(n * 864e5); return MON[d.getUTCMonth()] + ' ' + d.getUTCDate(); };
93
+ export const md = (n) => { const d = new Date(n * 864e5); return MON[d.getUTCMonth()] + ' ' + d.getUTCDate(); };
93
94
  /** "Nov 4 → 13", "Nov 28 → Dec 3", "Nov 4": the tip while a bar drags, in the List's words. */
94
95
  export function spanText(s, e) {
95
96
  if (s == null && e == null) return '';
@@ -150,6 +151,11 @@ export function sheetHtml(m, g, z = zoomOf()) {
150
151
  if (m === 'timeline') {
151
152
  h += '<p class="ivs-h">Zoom</p>' + seg('Zoom', ZOOMS.map(([k, l]) => ({ attr: `data-ivs-zoom="${k}"`, on: k === z, text: l, aria: k === 'all' ? 'All: the whole initiative fits the screen' : l })));
152
153
  if (z === 'all') h += '<p class="ivs-note">All fits the whole initiative, however long. Tap a stage to see its tasks.</p>';
154
+ // Columns (StsA7Picker): Task always; a phone shows no columns, so it has no Columns row
155
+ else if (!PHONE()) {
156
+ const on = timelineCols(), ck = (k, l, p, fix) => `<button type="button" class="ivs-ck${p ? ' on' : ''}" role="checkbox" aria-checked="${p}"${fix ? ' aria-disabled="true"' : ` data-ivs-col="${k}"`} title="${esc(fix ? 'Always shown' : (p ? 'Hide ' : 'Show ') + l)}"><i aria-hidden="true">${p ? SVG(P.check, 12, 3) : ''}</i>${esc(l)}${fix ? '<small>always</small>' : ''}</button>`;
157
+ h += '<p class="ivs-h">Columns</p><div class="ivs-cols" role="group" aria-label="Columns">' + ck('task', 'Task', true, true) + TCOLS.map(([k, l]) => ck(k, l, on.includes(k), false)).join('') + '</div>';
158
+ }
153
159
  }
154
160
  return `<div class="tkc-pop ivs" role="dialog" aria-label="Tasks view"><span class="ivs-grab" aria-hidden="true"></span>${h}</div>`;
155
161
  }
@@ -159,6 +165,7 @@ function openSheet(anchor, H) {
159
165
  const el = openPop(anchor, sheetHtml(viewMode(), g()), (b) => {
160
166
  const d = b.dataset;
161
167
  if (d.ivsView) { setViewMode(d.ivsView); if (H.redraw) H.redraw(); draw(); return; }
168
+ if (d.ivsCol) { const on = timelineCols(); setTimelineCols(on.includes(d.ivsCol) ? on.filter((k) => k !== d.ivsCol) : on.concat(d.ivsCol)); if (H.redraw) H.redraw(); draw(); return; }
162
169
  if (d.ivsZoom) { ZOOM = d.ivsZoom; store.set('pmos.tasks.zoom', ZOOM); if (H.redraw) H.redraw(); draw(); return; }
163
170
  if (d.ivsBy && H.__g) { const r = H.__g.set(d.ivsBy); if (r && r.then) r.then(draw); else draw(); return; }
164
171
  if ('ivsMore' in d && H.__g) { const a = POP && POP.anchor; closePop(); if (a && a.isConnected) H.__g.more(a); }
@@ -174,25 +181,32 @@ const tkOf = (sec) => (sec.stages ? sec.stages.flatMap((s) => tkOf(s)) : sec.tk
174
181
  const tkMark = (t) => (t.inJira ? `<span class="ig-sq ${esc(t.cat || 'todo')}" role="img" aria-label="${esc('In Jira: ' + (t.status || 'To do'))}"></span>`
175
182
  : `<span class="ig-tkd" role="img" aria-label="Jira ticket drafted, not sent" title="Drafted, not in Jira">${SVG(P.jira, 14, 2)}</span>`);
176
183
  const tkTitle = (t) => `<button type="button" class="iv-tt" data-ig-tk="${esc(t.id)}">${t.inJira && t.key ? `<em>${esc(t.key)}</em> ` : ''}${esc(t.title)}</button>`;
177
- /** A task linked to a Jira ticket it names (ini-view-model.js linkOf): the key once, in blue, then the rest of its title. A key PMOS has not
178
- * read stays plain text in the title (0.442.0 hotfix). */
184
+ /** A task linked to a Jira ticket it names (ini-view-model.js linkOf): the key once, in blue, then the rest of its title, the same in the List,
185
+ * the Timeline and the Kanban (class lk). A key PMOS has not read stays plain text in the title (0.442.0 hotfix). */
179
186
  export function keyName(x) {
180
187
  if (!x.jkey) return esc(x.title);
181
188
  const rest = String(x.title || '').replace(new RegExp('[\\[(]?\\b' + x.jkey + '\\b[\\])]?\\s*[:\u2013\u2014-]?\\s*'), '').trim();
182
- return `<em>${esc(x.jkey)}</em>${rest ? ' ' + esc(rest) : ''}`;
189
+ return `<em class="lk">${esc(x.jkey)}</em>${rest ? ' ' + esc(rest) : ''}`;
183
190
  }
184
191
  /** The Jira mark of a linked task, in place of its box: the status square the ticket rows draw (To do, In progress, Done). Jira owns the
185
192
  * status, so it marks nothing here. */
186
- export const jqMark = (x) => `<span class="iv-jq ig-sq ${x.closed ? 'done' : x.prog ? 'doing' : 'todo'}" role="img" aria-label="${esc('Jira ' + x.jkey + ': ' + (x.jst || x.status))}" title="${esc('Jira · ' + (x.jst || x.status))}"></span>`;
193
+ export const jqMark = (x) => `<span class="iv-jq ig-sq ${x.closed ? 'done' : x.prog ? 'doing' : 'todo'}${mvCls(x.jmove)}" role="img" aria-label="${esc('Jira ' + x.jkey + ': ' + (movingOf(x.jmove) ? 'moving to ' + x.status : x.jst || x.status))}" title="${esc('Jira · ' + (movingOf(x.jmove) ? 'moving to ' + x.status : x.jst || x.status))}"></span>`;
194
+ /** A Jira ticket's status press (Wawan 2026-10-29; canvas "Exploring · Move Jira tasks"): the caret beside its mark opens To do, In progress
195
+ * and Done; the pick is asked of Jira (pm/jira-move.js). st: its status here, raw: Jira's own name for it. */
196
+ const movingOf = (m) => !!(m && m.state === 'moving');
197
+ const mvCls = (m) => (movingOf(m) ? ' mv' : '');
198
+ export const jcar = (key, st, raw, nm, o) => (o && o.quick && key ? `<button type="button" class="iv-car" data-iv-jstat="${esc(key)}" data-st="${esc(colOf(st))}" data-raw="${esc(raw || '')}" aria-haspopup="dialog" aria-label="${esc('Change the status in Jira: ' + nm)}" title="Status, moved in Jira">${SVG(P.down, 10, 2.6)}</button>` : '');
199
+ /** "Moving in Jira" after a ticket's title while the agent moves it; nothing once Jira answered (zero is silence). */
200
+ export const movingHtml = (m) => (movingOf(m) ? '<span class="iv-jmv">Moving in Jira</span>' : '');
187
201
  const box = (x, o) => {
188
- if (x.jkey && !x.dr) return `<span class="iv-bxw">${jqMark(x)}</span>`;
202
+ if (x.jkey && !x.dr) return `<span class="iv-bxw">${jqMark(x)}${jcar(x.jkey, x.status, x.jst, x.title, o)}</span>`;
189
203
  // a draft's task (batch 11 item 8) is an assumption: a dashed box that marks nothing; its caret still changes the status in the draft
190
204
  if (x.dr) return `<span class="iv-bxw"><span class="iv-cb dr" aria-hidden="true"></span>` + (o.quick ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" aria-haspopup="dialog" aria-label="${esc('Change the status in the draft: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '') + '</span>';
191
205
  const cls = ['iv-cb', x.done ? 'on' : '', x.prog ? 'pr' : '', x.wont ? 'wo' : ''].filter(Boolean).join(' ');
192
206
  return `<span class="iv-bxw"><button type="button" class="${cls}" data-iv-check="${esc(x.uid)}" aria-pressed="${x.done}" aria-label="${esc((x.done ? 'Reopen: ' : 'Mark done: ') + x.title)}" title="${x.done ? 'Reopen' : 'Mark done'}">${x.done ? SVG(P.check, 12, 3) : ''}</button>`
193
207
  + (o.quick ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" data-ms="${x.ms ? 1 : 0}" aria-haspopup="dialog" aria-label="${esc('Change the status: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '') + '</span>';
194
208
  };
195
- const jmark = (k) => `<span class="iv-jm" role="img" aria-label="${esc('Jira ticket, ' + (k.status || 'To do') + '. Status and dates come from Jira')}" title="${esc('Jira · ' + (k.status || 'To do'))}">${SVG(P.jira, 14, 2)}</span>`;
209
+ const jmark = (k, o) => `<span class="iv-bxw"><span class="iv-jm${mvCls(k.move)}" role="img" aria-label="${esc('Jira ticket, ' + (movingOf(k.move) ? 'moving to ' : '') + (k.status || 'To do'))}" title="${esc('Jira · ' + (movingOf(k.move) ? 'moving to ' : '') + (k.raw || k.status || 'To do'))}">${SVG(P.jira, 14, 2)}</span>${jcar(k.key, k.status, k.raw, k.key + ' ' + k.title, o)}</span>`;
196
210
  // noMs: the row already leads with its ◇ (Timeline at All), so the title does not repeat it
197
211
  const title = (x, o, noMs = false) => (o.openTask && x.uid && !x.dr ? `<button type="button" class="iv-tt" data-iv-task="${esc(x.uid)}">${keyName(x)}</button>` : `<b class="iv-tt">${keyName(x)}</b>`) + (noMs ? '' : msGlyph(x)) + addedMark(x);
198
212
  /* ── planned versus actual (batch 11 item 8; canvas PvaAC1Live): ⊕ after a title added after the compared version, the slip after a date ── */
@@ -210,14 +224,25 @@ export const jiraRow = (k) => ({ uid: k.key, start: k.start || '', end: k.due ||
210
224
  const ttitle = (k) => `<button type="button" class="iv-tt" data-iv-ticket="${esc(k.key)}"><em>${esc(k.key)}</em> ${esc(k.title)}</button>`;
211
225
  /** The date press: the task card's start and due picker opens right under it. No dates: a calendar icon, shown on hover. */
212
226
  export function dateBtn(x, o) {
213
- if (!o.quick || !x.uid) return x.days ? `<span class="${x.late ? 'w' : ''}">${esc(x.days)}</span>` : '';
214
- const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" title="${x.jira || x.jkey ? 'Start and due, kept in PMOS. Jira is not changed' : 'Start and due'}"`;
227
+ if (!o.quick || !x.uid) return x.days ? `<span class="${x.late ? 'w' : ''}">${daysHtml(x)}</span>` : '';
228
+ const one = x.ms && !x.jira ? ' data-one="1"' : '';
229
+ const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" data-t="${esc(x.title)}"${one} title="${one ? 'The milestone\'s date' : x.jira || x.jkey ? 'Start and due, kept in PMOS. Jira is not changed' : 'Start and due'}"`;
215
230
  // a milestone with no due date: a dashed chip asks for it, shown always (canvas XmlA6Suggest)
216
231
  if (msNoDate(x)) return `<button type="button" class="iv-dc ms" ${a} aria-label="${esc('Set the due date: ' + x.title)}">${SVG(P.cal, 13)}Set the due date</button>`;
217
- return x.days ? `<button type="button" class="iv-dc${x.late ? ' w' : ''}" ${a} aria-label="${esc('Dates: ' + x.days + '. Change')}">${esc(x.days)}</button>`
232
+ return x.days ? `<button type="button" class="iv-dc${x.late ? ' w' : ''}" ${a} aria-label="${esc((one ? 'Milestone date: ' : 'Dates: ') + x.days + '. Change')}">${daysHtml(x)}</button>`
218
233
  : `<button type="button" class="iv-dc none" ${a} aria-label="${esc('Add dates: ' + x.title)}">${SVG(P.cal, 14)}</button>`;
219
234
  }
220
235
 
236
+ /** A row's days (batch 18 item 16, StA1Rows): a milestone's one day after its ◇ ("◇ Nov 14"); start – due with the start in its own span,
237
+ * which a phone hides (it shows the due day only). */
238
+ export function daysHtml(x) {
239
+ if (x.ms && x.dueText) return `<span class="iv-dms">${SVG(P.dia, 11, 2.4)}</span>${esc(x.dueText)}`;
240
+ if (x.startText && x.dueText && x.start !== x.end) return `<span class="iv-dst">${esc(x.startText)} – </span>${esc(x.dueText)}`;
241
+ return esc(x.days);
242
+ }
243
+ /** A milestone with its day shows ◇ in its date ("◇ Nov 14"), so its title does not repeat the ◇ (say it once). */
244
+ export const msInDate = (x) => !!(x && x.ms && x.dueText && !x.wont);
245
+
221
246
  /* ── Timeline ── */
222
247
  // Year, 2 years and 5 years show a fixed span: it fills the width the Timeline has (the panel, or the window in full width), never narrower
223
248
  // than the zoom's own scale; the name column is the css --nw, clamp(150px, 36cqw, 320px)
@@ -229,7 +254,37 @@ function fitPx(z, days) {
229
254
  const nw = Math.min(320, Math.max(150, w * 0.36));
230
255
  return Math.max(z[2], Math.floor(((w - nw - 24 - 36) / days) * 1000) / 1000);
231
256
  }
232
- const tone = (x) => (x.closed ? 'dn' : x.late ? 'lt' : x.prog ? 'pr' : '');
257
+ /* The bar wears its task box (canvas StsA1Desk, StsA2Stage, StsA3Phone): To do hollow, In progress solid blue, Done grey, Won't do dashed.
258
+ * Late keeps the status: a thin --cz-late line runs from the day after the due day to Today and ends in a dot (lateLine). */
259
+ const tone = (x) => (x.wont ? 'wo' : x.closed ? 'dn' : x.prog ? 'pr' : 'to');
260
+ /** The days a task is past its due day, 0 when it is not late. */
261
+ const lateDays = (x, today) => { const b = dn(x.end); return x.late && !x.closed && b != null && b < today ? today - b : 0; };
262
+ /** A Jira ticket of the stage as a task row (StsA5Columns: one row shape for every source): its status read the way a linked task's is. */
263
+ const jiraBucket = (st) => (/^(done|closed|resolved|released)$/i.test(String(st || '')) ? 'Done' : /progress|review|test|\bqa\b|doing|started|block/i.test(String(st || '')) ? 'In progress' : 'To do');
264
+ function jiraTask(k, today) {
265
+ const status = jiraBucket(k.status), b = dn(k.due), closed = status === 'Done', late = !closed && b != null && b < today;
266
+ return { ...jiraRow(k), title: k.title, status, done: closed, closed, prog: status === 'In progress', late, lateText: late ? (today - b) + (today - b === 1 ? ' day' : ' days') + ' late' : '',
267
+ startText: k.start ? md(dn(k.start)) : '', dueText: b != null ? md(b) : '', av: k.av || '', jkey: k.key, jst: k.raw || k.status || 'To do', jonly: true, move: k.move || null };
268
+ }
269
+ /** The box of a task on the timelines. A Jira task wears the same box as any task (StsA5Columns); a press opens the Jira picker (To do,
270
+ * In progress, Done; "Moves KEY in Jira", D100), and while Jira has not answered the box is dashed. */
271
+ const glyph = (x) => `<span class="iv-cb${x.done ? ' on' : ''}${x.prog ? ' pr' : ''}${x.wont ? ' wo' : ''}${movingOf(x.move) ? ' mv' : ''}" aria-hidden="true">${x.done ? SVG(P.check, 12, 3) : ''}</span>`;
272
+ /** The press that opens the Jira picker: its data-iv-jstat is the one press() reads for Kanban, List and Timeline. */
273
+ const jstatAt = (x) => `data-iv-jstat="${esc(x.jkey)}" data-st="${esc(colOf(x.status))}" data-raw="${esc(x.jst || '')}" aria-haspopup="dialog"`;
274
+ const tbox = (x, o) => (x.jkey && !x.dr ? (o && o.quick
275
+ ? `<button type="button" class="iv-bxw jr" ${jstatAt(x)} aria-label="${esc('Jira ' + x.jkey + ': ' + (x.jst || x.status) + '. Change the status in Jira')}" title="${esc('Jira · ' + (x.jst || x.status))}">${glyph(x)}</button>`
276
+ : `<span class="iv-bxw jr" role="img" aria-label="${esc('Jira ' + x.jkey + ': ' + (x.jst || x.status))}" title="${esc('Jira · ' + (x.jst || x.status))}">${glyph(x)}</span>`) : box(x, o));
277
+
278
+ /* ── the task timeline's columns (StsA5Columns, StsA7Picker): Task always, then the ones the PM keeps on, in this order; a phone has none ── */
279
+ export const TCOLS = [['key', 'Key', 84], ['status', 'Status', 124], ['start', 'Start', 68], ['due', 'Due', 104], ['owner', 'Owner', 64]];
280
+ const COLS0 = ['key', 'status', 'start', 'due'];
281
+ let TC = null;
282
+ /** The columns the PM shows on the Timeline, remembered in this browser (as pmos.tasks.view is). */
283
+ export function timelineCols() {
284
+ if (!TC) { let v = null; try { v = JSON.parse(store.get('pmos.tasks.cols.timeline') || 'null'); } catch { v = null; } TC = Array.isArray(v) ? TCOLS.map((c) => c[0]).filter((k) => v.includes(k)) : COLS0.slice(); }
285
+ return TC;
286
+ }
287
+ export function setTimelineCols(keys) { TC = TCOLS.map((c) => c[0]).filter((k) => keys.includes(k)); store.set('pmos.tasks.cols.timeline', JSON.stringify(TC)); }
233
288
  export function timelineHtml(v, o, isOpen) {
234
289
  if (zoomOf() === 'all') return allHtml(v, o, isOpen);
235
290
  const today = dn(v.today) || Math.round(Date.now() / 864e5), z = ZOOMS.find((x) => x[0] === zoomOf());
@@ -266,13 +321,21 @@ export function timelineHtml(v, o, isOpen) {
266
321
  return `<span class="ivt-pl" role="img" data-tlx="${X(a)}" data-tlw="${Math.max(4, X(Math.max(a, b) + 1) - X(a))}" aria-label="${esc('In ' + vs + ': ' + spanText(a, b))}" title="${esc(vs + ' · ' + spanText(a, b))}"></span>`;
267
322
  };
268
323
  const slipLab = (x) => { const n = slipOf(x), e = dn(x.end); return n && e != null ? `<span class="ivt-sl" data-tlx="${X(e + 1) + 8}">${esc(md(e))}${slipHtml(x)}</span>` : ''; };
269
- const barOf = (x) => (x.wont && x.cmp ? planLine(x) : barOf0(x) + planLine(x) + slipLab(x));
324
+ // late keeps its status fill; the line from the day after the due day to Today says how late (StsA1Desk)
325
+ const lateLine = (x) => { const n = lateDays(x, today), b = dn(x.end); if (!n) return '';
326
+ const a = X(b + 1), t = X(today) + Math.round(px / 2);
327
+ return `<span class="ivt-late" role="img" data-tlx="${a}" data-tlw="${Math.max(4, t - a)}" aria-label="${esc(n + (n === 1 ? ' day' : ' days') + ' late')}" title="${esc('Due ' + md(b) + ' · ' + n + (n === 1 ? ' day' : ' days') + ' late')}"></span>`; };
328
+ const barOf = (x) => (x.wont && x.cmp ? planLine(x) : barOf0(x) + lateLine(x) + planLine(x) + slipLab(x));
270
329
  const barOf0 = (x) => {
271
330
  const a = dn(x.start), b = dn(x.end), cls = tone(x) + (x.dr ? ' dr' : ''), lbl = [x.days || 'No dates', x.owner && x.owner !== 'You' ? x.owner : '', x.closed ? x.status.toLowerCase() : x.late ? 'late' : x.prog ? 'in progress' : ''].filter(Boolean).join(', ');
272
331
  const av = x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : '';
273
332
  const lw = LK.barWords(x, o.lk);
274
333
  const at = `data-ivt-bar="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}"${o.quick && !x.closed ? drag : ''} aria-label="${esc(lbl + (lw ? ', ' + lw : '') + '. Change the dates')}"`;
275
334
  if (a == null && b == null) return x.closed || !o.quick ? '' : `<button type="button" class="ivt-g" data-iv-date="${esc(x.uid)}" data-s="" data-e="" data-tlx="${X(today) - 18}" aria-label="${esc('No dates yet. Set dates: ' + x.title)}" title="Set dates">${SVG(P.cal, 13)}</button>`;
335
+ // a milestone is its ◇ on its date, with no bar (batch 18 item 16, StA9Timeline): dragging the ◇ moves the date; its press opens the
336
+ // one-date picker
337
+ if (x.ms && b != null && !x.wont) return `<button type="button" class="ivt-d ${cls} ms" ${at} data-only="due" data-one="1" data-t="${esc(x.title)}" data-tlx="${X(b + 1)}"></button>`
338
+ + `<span class="ivt-ms lb${x.done ? ' dn' : x.late ? ' lt' : ''}" data-tlx="${X(b + 1)}" aria-hidden="true"><b>${esc(md(b))}</b></span>`;
276
339
  // a milestone with a due day only is its ◇ (the guide drops through it), not the due-only circle
277
340
  if (a == null) return `<button type="button" class="ivt-d ${cls}${x.ms && !x.wont ? ' ms' : ''}" ${at} data-only="due" data-tlx="${x.ms && !x.wont ? X(b + 1) : X(b) + Math.round(px / 2)}"></button>`;
278
341
  const e = b == null ? a : Math.max(a, b);
@@ -285,14 +348,41 @@ export function timelineHtml(v, o, isOpen) {
285
348
  return `<span class="ivt-ms${x.done ? ' dn' : x.late ? ' lt' : ''}" data-tlx="${X(b + 1)}" role="img" aria-label="${esc('Milestone ' + x.title + ', ' + md(b) + (x.done ? ', done' : x.late ? ', late' : ''))}" title="${esc(x.title + ' · ' + md(b))}"><i></i><b>${esc(md(b))}</b></span>`; };
286
349
  const guides = [...new Set(S.flatMap((s) => flat(s).concat(flatDone(s))).filter((x) => x.ms && !x.wont && x.status !== 'Archived' && dn(x.end) != null).map((x) => X(dn(x.end) + 1)))]
287
350
  .map((gx) => `<i class="ms" data-tlx="${gx}"></i>`).join('');
288
- // a Jira ticket's bar drags and its ends change the dates kept in PMOS, as a task's do (batch 11 item 23); read-only views draw the due dot
289
- const jbar = (k) => { if (o.quick) return barOf0(jiraRow(k)).replace(/class="ivt-(b|d|g) /, 'class="ivt-$1 jr ').replace('class="ivt-g"', 'class="ivt-g jr"');
290
- const b = dn(k.due); return b == null ? '' : `<span class="ivt-d jr" role="img" data-ivt-jr="${esc(k.key)}" data-tlx="${X(b) + Math.round(px / 2)}" aria-label="${esc('Due ' + md(b) + ' in Jira')}" title="${esc('Jira · ' + md(b))}"></span>`; };
351
+ // a Jira ticket's bar drags and its ends change the dates kept in PMOS, as a task's do (batch 11 item 23); read-only views draw the due dot.
352
+ // It wears its status like any task's bar (StsA5Columns: one row shape for every source)
353
+ const jbar = (x) => { if (o.quick) return barOf(x);
354
+ const b = dn(x.end); return b == null ? '' : `<span class="ivt-d ${tone(x)}" role="img" data-ivt-jr="${esc(x.jkey)}" data-tlx="${X(b) + Math.round(px / 2)}" aria-label="${esc('Due ' + md(b) + ' in Jira')}" title="${esc('Jira · ' + md(b))}"></span>` + lateLine(x); };
291
355
  // on a phone the title sits above its bar, from the bar's start (data-tln; it sticks to the left edge once the start scrolls away)
292
356
  const nx = (a, b) => { const n = a != null ? a : b; return n == null ? null : Math.max(0, Math.min(X(n), W - 220)); };
293
357
  const row = (n, c, cls = '', at = null) => `<div class="ivt-r${cls}"><div class="ivt-n"${at != null ? ` data-tln="${at}"` : ''}>${n}</div><div class="ivt-c">${c}</div></div>`;
294
- const when = (x) => (x.days ? `<span class="ivt-wn">· ${esc(x.days)}${x.lateText ? `<b>, ${esc(x.lateText)}</b>` : ''}</span>` : '');
295
- const trow = (x, cls = '') => row(`${box(x, o)}${title(x, o)}${when(x)}`, barOf(x), ' k' + cls, nx(dn(x.start), dn(x.end)));
358
+ // the dates after a title show while the Due column does not (wn-pN: they come back when a narrow panel hides it)
359
+ const dp = timelineCols().indexOf('due') + 1;
360
+ const when = (x) => (x.days ? `<span class="ivt-wn${dp ? ' wn-p' + dp : ''}">· ${esc(x.days)}${x.lateText ? `<b>, ${esc(x.lateText)}</b>` : ''}</span>` : '');
361
+ // the columns (StsA5Columns): Key, Status, Start, Due, Owner as the PM keeps them; p1… their place, so a narrow panel hides them from the
362
+ // right (the css container queries). The box shows once: in Status, or before the title while Status is hidden (bx-pN shows it again).
363
+ const CS = timelineCols(), cp = (k) => CS.indexOf(k) + 1, sp = cp('status');
364
+ const cell = (k, inner, at = '') => `<span class="ivt-col c-${k} p${cp(k)}"${at}>${inner}</span>`;
365
+ const keyCell = (x) => (x.jkey ? `<button type="button" class="ivt-key" data-iv-ticket="${esc(x.jkey)}" aria-label="${esc('Open ' + x.jkey + ' in Jira')}" title="${esc('Open ' + x.jkey)}">${esc(x.jkey)}</button>` : '');
366
+ const statCell = (x) => {
367
+ if (x.ms && !x.closed) return '';
368
+ const word = `${glyph(x)}<span>${esc(x.status)}</span>`;
369
+ // a Jira task: its picker (To do, In progress, Done; "Moves KEY in Jira", D100); "Moving in Jira" until Jira answers
370
+ if (x.jkey && !x.dr) {
371
+ const w = movingOf(x.move) ? `${glyph(x)}<span class="iv-jmv">Moving in Jira</span>` : word;
372
+ return o.quick ? `<button type="button" class="ivt-st jr" data-iv-jst="${esc(x.jkey)}" ${jstatAt(x)} aria-label="${esc('Jira ' + x.jkey + ': ' + (x.jst || x.status) + '. Change the status in Jira')}" title="${esc('Jira · ' + (x.jst || x.status))}">${w}</button>`
373
+ : `<span class="ivt-st jr" data-iv-jst="${esc(x.jkey)}" data-st="${esc(x.status)}" title="${esc('Jira · ' + (x.jst || x.status))}">${w}</span>`;
374
+ }
375
+ if (!o.quick || !x.uid) return `<span class="ivt-st">${word}</span>`;
376
+ return `<button type="button" class="ivt-st${x.dr ? ' dr' : ''}" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" data-ms="${x.ms ? 1 : 0}" aria-haspopup="dialog" aria-label="${esc('Status: ' + x.status + '. Change: ' + x.title)}" title="Change the status">${word}</button>`;
377
+ };
378
+ const dueCell = (x) => { const n = lateDays(x, today); return x.dueText ? (n ? `<span class="lt">${esc(x.dueText)} +${n}d</span>` : esc(x.dueText)) : ''; };
379
+ const cols = (x) => CS.map((k) => cell(k, k === 'key' ? keyCell(x) : k === 'status' ? statCell(x) : k === 'start' ? (x.ms ? '' : esc(x.startText || '')) : k === 'due' ? dueCell(x)
380
+ : x.av ? `<span class="ivt-av" title="${esc(x.owner || '')}">${esc(x.av)}</span>` : '')).join('');
381
+ // the title: with the Key column on, a linked task's key is said there once; a Jira ticket opens its ticket
382
+ const tname = (x) => (x.jonly ? `<button type="button" class="iv-tt" data-iv-ticket="${esc(x.jkey)}">${CS.includes('key') ? '' : `<em>${esc(x.jkey)}</em> `}${esc(x.title)}</button>`
383
+ : title(CS.includes('key') && x.jkey ? { ...x, jkey: '' } : x, o, !!(x.ms && !x.closed)));
384
+ const lead = (x) => (x.ms && !x.closed ? `<span class="iva-mg" aria-hidden="true">${SVG(P.dia, 13, 2.4)}</span>` : `<span class="ivt-bx${sp ? ' bx-p' + sp : ''}">${tbox(x, o)}</span>`);
385
+ const trow = (x, cls = '') => row(`<span class="ivt-t">${lead(x)}${tname(x)}${when(x)}</span>${cols(x)}`, x.jonly ? jbar(x) : barOf(x), ' k' + cls, nx(dn(x.start), dn(x.end)));
296
386
  const band = (rs) => { const ds = rs.flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null); if (!ds.length) return ''; const a = Math.min(...ds), b = Math.max(...ds); return `<span class="ivt-band" data-tlx="${X(a)}" data-tlw="${Math.max(8, X(b + 1) - X(a))}"></span>`; };
297
387
  // a skipped stage keeps its group row: a hairline from the band before it to the band after it, with » on it (batch 11 item 13, XgapA2Tasks);
298
388
  // a skip before the first dated stage or after the last draws nothing
@@ -320,7 +410,7 @@ export function timelineHtml(v, o, isOpen) {
320
410
  if (!op || !has) continue;
321
411
  // a ticket in Jira whose task is linked to it (By epic) draws that task's bar: its dates are the task's, kept in PMOS
322
412
  for (const t of tk) h += row(`${tkMark(t)}${tkTitle(t)}`, t.x ? barOf(t.x) : '', ' k', t.x ? nx(dn(t.x.start), dn(t.x.end)) : null);
323
- for (const k of jr) h += row(`${jmark(k)}${ttitle(k)}${k.days ? `<span class="ivt-wn">· ${esc(k.days)}</span>` : ''}`, jbar(k), ' k', nx(dn(k.start), dn(k.due)));
413
+ for (const k of jr) h += trow(jiraTask(k, today));
324
414
  for (const x of rs) h += trow(x);
325
415
  // a stage with nothing open lists its done tasks straight away, as the List does: no "Done" fold inside the stage's own fold
326
416
  // (PM, 2026-10-27: "Grouping 'Done' items is confusing")
@@ -332,16 +422,19 @@ export function timelineHtml(v, o, isOpen) {
332
422
  }
333
423
  }
334
424
  const grid = ticks.map((t) => `<i data-tlx="${t.x}"></i>`).join('') + guides;
335
- const axis = `<div class="ivt-r ax"><div class="ivt-n"></div><div class="ivt-c">${ticks.map((t) => `<span class="${t.b ? 'b' : ''}" data-tlx="${t.x}">${esc(t.t)}</span>`).join('')}</div></div>`;
425
+ const axis = `<div class="ivt-r ax"><div class="ivt-n"><span class="ivt-t">Task</span>${CS.map((k) => cell(k, esc(TCOLS.find((c) => c[0] === k)[1]))).join('')}</div><div class="ivt-c">${ticks.map((t) => `<span class="${t.b ? 'b' : ''}" data-tlx="${t.x}">${esc(t.t)}</span>`).join('')}</div></div>`;
336
426
  // Plan and Draft join the legend only when they are in view (batch 11 item 8)
337
427
  const vk = v.vs ? (v.vs.lines && v.vs.cmp ? `<span><i class="pl"></i>${esc((v.vs.cmp.kind === 'plan' ? 'Plan · ' : 'Draft · ') + v.vs.cmp.name)}</span>` : '') + (v.vs.draft ? '<span><i class="dr"></i>Draft</span>' : '') : '';
338
- const legend = `<div class="ivt-lg">${v.vs && v.vs.draft ? '' : '<span><i class="to"></i>To do</span><span><i class="pr"></i>In progress</span><span><i class="lt"></i>Late</span>'}<span><i class="dd"></i>Due only</span>${vk}`
428
+ // the bars wear their task's box, so the legend names only what is in view and is not a box (StsA5Columns: no Jira item, no status items)
429
+ const legend = `<div class="ivt-lg">${/class="ivt-d (?![^"]*\bms\b)[^"]*"/.test(h) ? '<span><i class="dd"></i>Due only</span>' : ''}${vk}`
339
430
  + (/class="ivt-ng"/.test(h) ? '<span><i class="ng"></i>No activity</span>' : '') + (/class="ivt-sk"/.test(h) ? `<span>${SVG(P.skip, 12, 2)}Skipped</span>` : '')
340
- + `${guides ? `<span>${SVG(P.dia, 11, 2.4)}Milestone</span>` : ''}<span>${SVG(P.jira, 12, 2)}Jira</span>${LK.legendHtml(o.lk)}${o.quick ? `<span class="h">${o.lk && o.lk.links.length ? 'Drag a bar to move it, an end to change dates, a dot to link it' : 'Drag a bar to move it; drag an end to change start or due'}</span>` : ''}</div>`;
431
+ + `${guides ? `<span>${SVG(P.dia, 11, 2.4)}Milestone</span>` : ''}${LK.legendHtml(o.lk)}${o.quick ? `<span class="h">${o.lk && o.lk.links.length ? 'Drag a bar to move it, an end to change dates, a dot to link it' : 'Drag a bar to move it; drag an end to change start or due'}</span>` : ''}</div>`;
341
432
  // it opens on today, moved left as far as the earliest open task's start, so a late bar is in view
342
433
  const firstOpen = S.flatMap(flat).flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null);
343
434
  const first = firstOpen.length ? X(Math.min(...firstOpen)) : X(today);
344
- return `<div class="ivt"${LK.dataOf(o.lk)} data-ivt="${esc((v.id || v.key) + '|' + z[0])}" data-px="${px}" data-today="${X(today)}" data-first="${first}"><div class="ivt-sc"><div class="ivt-in" data-tlw="${W}">`
435
+ // the columns' widths, in their order: place() sets them as --tl-c1w, --tl-c2w, … (a narrow panel's css zeroes the ones it hides)
436
+ const cw = CS.map((k) => TCOLS.find((c) => c[0] === k)[2]).join(',');
437
+ return `<div class="ivt${CS.length ? ' cols' : ''}"${cw ? ` data-tlc="${cw}"` : ''}${LK.dataOf(o.lk)} data-ivt="${esc((v.id || v.key) + '|' + z[0])}" data-px="${px}" data-today="${X(today)}" data-first="${first}"><div class="ivt-sc"><div class="ivt-in" data-tlw="${W}">`
345
438
  + `<div class="ivt-grid" aria-hidden="true">${grid}</div>${axis}${h}<span class="ivt-today" data-tlx="${X(today) + Math.round(px / 2)}" aria-hidden="true"><i>Today</i></span></div></div>`
346
439
  + `<i class="ivt-fade" aria-hidden="true"></i>${noDatesHtml(ND, o, isOpen)}</div>${legend}`;
347
440
  }
@@ -426,15 +519,18 @@ export function allHtml(v, o, isOpen) {
426
519
  const lb = esc((x.days || '') + (o.quick && x.uid && !x.closed ? '. Change the dates' : ''));
427
520
  const at = o.quick && x.uid && !x.closed ? `data-ivt-bar="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}"` : '';
428
521
  const tag = at ? 'button' : 'span', open0 = at ? 'button type="button"' : 'span';
429
- if (x.ms && b != null) return `<${open0} class="iva-md${x.done ? ' dn' : x.late ? ' lt' : ''}" ${at} data-tlx="${pc(b)}" aria-label="${lb}"></${tag}>`;
430
- const s0 = a == null ? b : a, e0 = b == null ? a : Math.max(a, b);
431
- return `<${open0} class="iva-tb ${cls}" ${at} data-tlx="${pc(s0)}" data-tlw="${pw(s0, e0)}" aria-label="${lb}"></${tag}>`;
522
+ if (x.ms && b != null) return `<${open0} class="iva-md${x.done ? ' dn' : x.late ? ' lt' : ''}" ${at}${at ? ` data-one="1" data-t="${esc(x.title)}"` : ''} data-tlx="${pc(b)}" aria-label="${lb}"></${tag}>`;
523
+ const s0 = a == null ? b : a, e0 = b == null ? a : Math.max(a, b), n = lateDays(x, today);
524
+ // late keeps its status fill; a 3 px --cz-late line runs on to Today and ends in a dot (StsA2Stage)
525
+ const ln = n ? `<i class="iva-late" role="img" data-tlx="${pc(b + 1)}" data-tlw="${pw(b + 1, today)}" aria-label="${esc(n + (n === 1 ? ' day' : ' days') + ' late')}"></i>` : '';
526
+ return `<${open0} class="iva-tb ${cls}" ${at} data-tlx="${pc(s0)}" data-tlw="${pw(s0, e0)}" aria-label="${lb}"></${tag}>` + ln;
432
527
  };
433
528
  const p0 = (x) => { const n = dn(x.start) != null ? dn(x.start) : dn(x.end); return n == null ? 0 : fr(n).toFixed(4); };
434
529
  for (const t of tk) h += trow(tkMark(t), tkTitle(t), t.x ? tbar(t.x) : '', t.x ? p0(t.x) : 0);
435
- for (const k of jr) { const r = jiraRow(k); h += trow(jmark(k), ttitle(k) + (k.days ? `<span class="ivt-wn">· ${esc(k.days)}</span>` : ''), tbar({ ...r, title: k.title }), p0(r)); }
436
- for (const x of rs) h += trow(x.ms ? dia : box(x, o), tline(x), tbar(x), p0(x));
437
- for (const x of dn_) h += trow(x.ms ? dia : box(x, o), tline(x), tbar(x), p0(x), ' x' + (x.wont ? ' wo' : ''));
530
+ // a Jira ticket wears the same box and bar as a task (StsA5Columns: one row shape for every source)
531
+ for (const k of jr) { const x = jiraTask(k, today); h += trow(tbox(x, o), ttitle(k) + (k.days ? `<span class="ivt-wn">· ${esc(k.days)}</span>` : '') + (x.lateText ? `<span class="iva-nt lt">${esc(x.lateText)}</span>` : ''), tbar({ ...x, uid: o.quick ? x.uid : '' }), p0(x)); }
532
+ for (const x of rs) h += trow(x.ms ? dia : tbox(x, o), tline(x), tbar(x), p0(x));
533
+ for (const x of dn_) h += trow(x.ms ? dia : tbox(x, o), tline(x), tbar(x), p0(x), ' x' + (x.wont ? ' wo' : ''));
438
534
  }
439
535
  const tick = (t) => `<span class="${[t.b ? 'b' : '', t.mo ? 'mo' : '', t.q ? 'qm' : ''].filter(Boolean).join(' ')}" data-tlx="${pc(t.n)}"${t.q ? ` data-q="${esc(t.q)}"` : ''}>${esc(t.t)}</span>`;
440
536
  const axis = `<div class="iva-ax"><span class="iva-n"></span><span class="iva-l"></span><span class="iva-c">${ticks.map(tick).join('')}</span></div>`;
@@ -448,7 +544,9 @@ export function allHtml(v, o, isOpen) {
448
544
  * [data-tlx] / [data-tlw] under root. Called on each draw, before the paint. */
449
545
  export function place(root) {
450
546
  if (!root || !root.querySelectorAll) return;
451
- for (const e of root.querySelectorAll('[data-tlx], [data-tlw], [data-tln], [data-tlp]')) {
547
+ const all = [...root.querySelectorAll('[data-tlx], [data-tlw], [data-tln], [data-tlp], [data-tlc]')];
548
+ if (root.dataset && root.dataset.tlc != null) all.push(root);
549
+ for (const e of all) {
452
550
  if (e.__tl) continue; // placed once: a drag moves it from there
453
551
  e.__tl = true;
454
552
  // Timeline at All places in % of its track; Weeks and Months in px
@@ -457,6 +555,7 @@ export function place(root) {
457
555
  if (e.dataset.tlw != null) e.style.setProperty('--tl-w', u(e.dataset.tlw));
458
556
  if (e.dataset.tln != null) e.style.setProperty('--tl-n', u(e.dataset.tln));
459
557
  if (e.dataset.tlp != null) e.style.setProperty('--tl-p', e.dataset.tlp); // a fraction of the track (All on a phone)
558
+ if (e.dataset.tlc != null) e.dataset.tlc.split(',').forEach((w, i) => e.style.setProperty('--tl-c' + (i + 1) + 'w', w + 'px')); // the columns' widths
460
559
  }
461
560
  }
462
561
 
@@ -474,11 +573,11 @@ export function kanbanHtml(v, o, isOpen) {
474
573
  if (c.d) return `<div class="ivk-d jr">${tkMark(c.d)}<div class="w">${tkTitle(c.d)}${c.d.av ? `<div class="ivk-m"><span class="ivt-av" aria-hidden="true">${esc(c.d.av)}</span></div>` : ''}</div></div>`;
475
574
  if (c.t) {
476
575
  const t = c.t, d = dn(t.due);
477
- return `<div class="ivk-d jr">${jmark(t)}<div class="w">${ttitle(t)}<div class="ivk-m">${d != null ? `<span>${esc(md(d))}</span>` : ''}${t.av ? `<span class="ivt-av" aria-hidden="true">${esc(t.av)}</span>` : ''}</div></div></div>`;
576
+ return `<div class="ivk-d jr${mvCls(t.move)}"${o.quick ? ` draggable="true" data-ivk-jira="${esc(t.key)}" data-st="${esc(t.status)}" data-raw="${esc(t.raw || '')}"` : ''}>${jmark(t, o)}<div class="w">${ttitle(t)}<div class="ivk-m">${movingHtml(t.move)}${d != null ? `<span>${esc(md(d))}</span>` : ''}${t.av ? `<span class="ivt-av" aria-hidden="true">${esc(t.av)}</span>` : ''}</div></div></div>`;
478
577
  }
479
578
  const x = c.x;
480
- return `<div class="ivk-d${x.closed ? ' x' : ''}${x.wont ? ' wo' : ''}${x.dr ? ' dr' : ''}${x.jkey ? ' jr' : ''}"${o.quick && x.uid && !x.jkey ? ` draggable="true" data-ivk-card="${esc(x.uid)}" data-st="${esc(x.status)}"` : ''}>${box(x, o)}<div class="w">${title(x, o)}`
481
- + `<div class="ivk-m">${dateBtn(x, o)}${LK.metaHtml(x, o.lk, o.quick)}${x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : ''}</div></div></div>`;
579
+ return `<div class="ivk-d${x.closed ? ' x' : ''}${x.wont ? ' wo' : ''}${x.dr ? ' dr' : ''}${x.jkey ? ' jr' + mvCls(x.jmove) : ''}"${o.quick && x.uid ? (x.jkey ? ` draggable="true" data-ivk-jira="${esc(x.jkey)}" data-st="${esc(x.status)}" data-raw="${esc(x.jst || '')}"` : ` draggable="true" data-ivk-card="${esc(x.uid)}" data-st="${esc(x.status)}"`) : ''}>${box(x, o)}<div class="w">${title(x, o, msInDate(x))}`
580
+ + `<div class="ivk-m">${x.jkey ? movingHtml(x.jmove) : ''}${dateBtn(x, o)}${LK.metaHtml(x, o.lk, o.quick)}${x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : ''}</div></div></div>`;
482
581
  };
483
582
  const wop = isOpen('kb:wont', false), nW = by["Won't do"].length;
484
583
  const col = ([st, lbl]) => `<section class="ivk-c" data-ivk-col="${esc(st)}" aria-label="${esc(lbl + ', ' + by[st].length)}"><h4>${esc(lbl)}${by[st].length ? `<span class="n">${by[st].length}</span>` : ''}</h4>${by[st].map(card).join('')}</section>`;
@@ -486,14 +585,14 @@ export function kanbanHtml(v, o, isOpen) {
486
585
  : `<button type="button" class="ivk-w" data-iv-fold="kb:wont" data-ivk-col="Won't do" aria-expanded="false" aria-label="${esc("Show Won't do" + (nW ? ', ' + nW : ''))}"><span>Won't do${nW ? ' · ' + nW : ''}</span></button>`;
487
586
  const tabs = `<div class="ivk-tabs" role="tablist">${COLS.map(([st, lbl], i) => `<button type="button" role="tab" data-ivk-tab="${i}" aria-selected="${i === 0}">${esc(lbl)}${by[st].length ? ` <span class="n">${by[st].length}</span>` : ''}</button>`).join('')}</div>`;
488
587
  return `${tabs}<div class="ivk${wop ? ' w4' : ''}">${COLS.map(col).join('')}${wont}</div>`
489
- + (o.quick ? '<p class="iv-q ivk-h">Drag a card to change its status. A Jira card does not drag: Jira owns its status.</p>' : '');
588
+ + (o.quick ? '<p class="iv-q ivk-h">Drag a card to change its status. A Jira card moves its ticket in Jira.</p>' : '');
490
589
  }
491
590
 
492
591
  /* ── the popovers: the task card's own status segment and date picker, opened right under the press ── */
493
592
  let POP = null;
494
- function closePop() { if (!POP) return; const { el, anchor, scrim } = POP; POP = null; el.remove(); if (scrim) scrim.remove(); if (anchor && anchor.isConnected) anchor.setAttribute('aria-expanded', 'false'); }
593
+ export function closePop() { if (!POP) return; const { el, anchor, scrim } = POP; POP = null; el.remove(); if (scrim) scrim.remove(); if (anchor && anchor.isConnected) anchor.setAttribute('aria-expanded', 'false'); }
495
594
  /** o.sheet: a bottom sheet over a scrim (a phone); o.right: the popover's right edge under the press's right edge. */
496
- function openPop(anchor, html, onPress, o = {}) {
595
+ export function openPop(anchor, html, onPress, o = {}) {
497
596
  closePop(); cardStyle();
498
597
  const el = document.createElement('div');
499
598
  el.className = 'tkc ivq' + (o.sheet != null ? ' vs-pop' : '') + (o.sheet ? ' sheet' : ''); el.dataset.escLayer = ''; el.innerHTML = html; // data-esc-layer: Escape closes this first, not the Viewer
@@ -542,19 +641,40 @@ export function msToggleHtml(on, attr) {
542
641
  const tip = on ? 'A milestone. Press to make it a plain task' : 'Make it a milestone: its due date shows as ◇ on the Board and the timeline';
543
642
  return `<button type="button" class="ivq-ms${on ? ' on' : ''}" ${attr} aria-pressed="${!!on}" aria-label="${esc(on ? 'Milestone' : 'Make it a milestone')}" title="${esc(tip)}">${SVG(P.dia, 15, 2)}${on ? 'Milestone' : ''}</button>`;
544
643
  }
545
- function statusPop(anchor, uid, status, H) {
546
- const ms = H.milestone && anchor.dataset.ms != null ? anchor.dataset.ms === '1' : null;
547
- openPop(anchor, statusPopHtml(status, ms, !!H.remove && deletable(uid)), (b) => {
644
+ export function statusPop(anchor, uid, status, H) {
645
+ // the open row's status chip (batch 18 item 16, StA2cStatus) is the five icons only: its ⋯ holds the ◇ and Delete
646
+ const plain = anchor.dataset.plain === '1';
647
+ const ms = !plain && H.milestone && anchor.dataset.ms != null ? anchor.dataset.ms === '1' : null;
648
+ openPop(anchor, statusPopHtml(status, ms, !plain && !!H.remove && deletable(uid)), (b) => {
548
649
  if ('ivqMs' in b.dataset) { closePop(); H.milestone(uid, !ms); return; }
549
650
  if ('ivqDel' in b.dataset) { closePop(); H.remove(uid); return; }
550
651
  const s = b.dataset.ivqState; if (!s) return; closePop(); if (s !== status && H.status) H.status(uid, s);
551
652
  });
552
653
  }
553
- function datePop(anchor, uid, H) {
554
- const t = { start: anchor.dataset.s || '', due: anchor.dataset.e || '' }, st = { field: 'due', month: '' };
654
+ /** A Jira ticket's status picker: To do, In progress and Done, and under them the line that says the pick moves the ticket in Jira. */
655
+ export function jiraPopHtml(status, key) {
656
+ const b = (s) => { const k = stateKey(s), on = s === status;
657
+ return `<button type="button" class="i-${k}${on ? ' on' : ''}" role="radio" aria-checked="${on}" data-ivq-state="${esc(s)}"${on ? '' : ` aria-label="${esc(s)}"`} title="${esc(s)}">${stateIcon(s)}${on ? esc(s) : ''}</button>`; };
658
+ return `<div class="tkc-pop ivq-st jq" role="dialog" aria-label="${esc('Status in Jira: ' + key)}"><div class="seg" role="radiogroup" aria-label="Status">${JM.TO.map(b).join('')}</div><p class="ivq-jn">${esc('Moves ' + key + ' in Jira')}</p></div>`;
659
+ }
660
+ export function jiraPop(anchor, key, status, raw, H) {
661
+ openPop(anchor, jiraPopHtml(status, key), (b) => {
662
+ const s = b.dataset.ivqState; if (!s) return; closePop();
663
+ if (s !== status && H.jiraMove) H.jiraMove({ key, to: s, from: status, fromRaw: raw });
664
+ });
665
+ }
666
+ /** The date picker under a date press (a bottom sheet on a phone, batch 18 item 16 StA3Dates). The press says where it starts: data-f
667
+ * 'start' opens on the start (the open row's Start chip); data-one: a milestone's one day, "◇ Date" with no Start and Due tabs (StA4Milestone). */
668
+ export function datePop(anchor, uid, H) {
669
+ const one = anchor.dataset.one === '1', sheet = PHONE();
670
+ const t = { start: one ? '' : anchor.dataset.s || '', due: anchor.dataset.e || '' }, st = { field: !one && anchor.dataset.f === 'start' ? 'start' : 'due', month: '', one };
671
+ const nm = anchor.dataset.t || '';
672
+ if (sheet) st.head = `<div class="ivd-h">${one ? SVG(P.dia, 15, 2.2) : SVG(P.cal, 15, 2)}<b>${one ? 'Date' : 'Dates'}</b><button type="button" class="iv-ib" data-ivd-x aria-label="Close" title="Close">${SVG('M6 6l12 12M18 6L6 18', 16, 2)}</button></div>`
673
+ + (nm ? `<p class="ivd-s">${esc(nm + (one ? ' · one date: the milestone' : ''))}</p>` : '');
555
674
  const draw = () => { if (!POP || POP.anchor !== anchor) return; POP.el.innerHTML = datePickerHtml(t, st); };
556
675
  openPop(anchor, datePickerHtml(t, st), (b) => {
557
676
  const d = b.dataset;
677
+ if ('ivdX' in d) { closePop(); return; }
558
678
  if (d.tkcField) { st.field = d.tkcField; st.month = ''; draw(); return; }
559
679
  if (d.tkcMonth) { st.month = d.tkcMonth; draw(); return; }
560
680
  if (d.tkcDay == null) return;
@@ -565,7 +685,7 @@ function datePop(anchor, uid, H) {
565
685
  if (H.dates) H.dates(uid, p);
566
686
  // after the start, the next tap is the due day; after the due day the picker closes
567
687
  if (f === 'start' && iso) { st.field = 'due'; st.month = ''; draw(); } else closePop();
568
- });
688
+ }, sheet ? { sheet: true } : {});
569
689
  }
570
690
  function menuPop(anchor, label, items, go) {
571
691
  const html = `<div class="tkc-pop ivq-m" role="menu" aria-label="${esc(label)}">${items.map((x, i) => `<button type="button" role="menuitemradio" class="o${x.on ? ' hl' : ''}" aria-checked="${!!x.on}" data-ivq-i="${i}"><span class="ck" aria-hidden="true">${x.on ? SVG(P.check, 14, 2.4) : ''}</span><span>${esc(x.label)}</span>${x.count ? `<span class="k">${esc(x.count)}</span>` : ''}</button>`).join('')}</div>`;
@@ -593,6 +713,7 @@ export function press(b, d, root, H, e) {
593
713
  return true;
594
714
  }
595
715
  if (d.ivStat) { statusPop(b, d.ivStat, d.st || 'To do', H); return true; }
716
+ if (d.ivJstat) { jiraPop(b, d.ivJstat, d.st || 'To do', d.raw || '', H); return true; }
596
717
  if (d.ivDate) { datePop(b, d.ivDate, H); return true; }
597
718
  if (d.ivtBar) { if (DRAGGED) { DRAGGED = false; return true; } datePop(b, d.ivtBar, H); return true; }
598
719
  if (d.ivkTab != null) { const c = root.querySelectorAll('.ivk > .ivk-c')[+d.ivkTab]; if (c) c.scrollIntoView({ block: 'nearest', inline: 'start', behavior: 'smooth' }); return true; }
@@ -608,15 +729,23 @@ export function wireDrag(body, after) {
608
729
  body.__ivtDrag = true;
609
730
  body.addEventListener('contextmenu', (e) => { if (e.target.closest && e.target.closest('[data-iv-check]') && coarse()) e.preventDefault(); });
610
731
  // Kanban: drag a card to another column to change its status
611
- body.addEventListener('dragstart', (e) => { const c = e.target.closest && e.target.closest('[data-ivk-card]'); if (!c) return; e.dataTransfer.setData('text/plain', c.dataset.ivkCard); e.dataTransfer.effectAllowed = 'move'; c.classList.add('drag'); body.__ivkFrom = c.dataset.st; });
612
- body.addEventListener('dragend', (e) => { const c = e.target.closest && e.target.closest('[data-ivk-card]'); if (c) c.classList.remove('drag'); body.querySelectorAll('.ivk-over').forEach((n) => n.classList.remove('ivk-over')); });
732
+ // a Jira card (data-ivk-jira) moves its ticket in Jira (pm/jira-move.js)
733
+ body.addEventListener('dragstart', (e) => { const c = e.target.closest && e.target.closest('[data-ivk-card], [data-ivk-jira]'); if (!c) return; e.dataTransfer.setData('text/plain', c.dataset.ivkCard || 'jira:' + c.dataset.ivkJira); e.dataTransfer.effectAllowed = 'move'; c.classList.add('drag'); body.__ivkFrom = c.dataset.st; body.__ivkRaw = c.dataset.raw || ''; });
734
+ body.addEventListener('dragend', (e) => { const c = e.target.closest && e.target.closest('[data-ivk-card], [data-ivk-jira]'); if (c) c.classList.remove('drag'); body.querySelectorAll('.ivk-over').forEach((n) => n.classList.remove('ivk-over')); });
613
735
  body.addEventListener('dragover', (e) => { const z = e.target.closest && e.target.closest('[data-ivk-col]'); if (!z || !body.__ivkFrom) return; e.preventDefault(); body.querySelectorAll('.ivk-over').forEach((n) => { if (n !== z) n.classList.remove('ivk-over'); }); z.classList.add('ivk-over'); });
614
736
  body.addEventListener('drop', (e) => {
615
737
  const z = e.target.closest && e.target.closest('[data-ivk-col]'); if (!z) return;
616
738
  e.preventDefault(); z.classList.remove('ivk-over');
617
739
  const uid = e.dataTransfer.getData('text/plain'), to = z.dataset.ivkCol, from = body.__ivkFrom; body.__ivkFrom = null;
618
740
  const H = body.__iv || {};
619
- if (uid && to && colOf(from) !== to && H.status) H.status(uid, to);
741
+ if (!uid || !to || colOf(from) === to) return;
742
+ if (uid.startsWith('jira:')) {
743
+ const key = uid.slice(5);
744
+ if (!JM.TO.includes(to)) { if (H.toast) H.toast(`A Jira ticket moves to To do, In progress or Done. ${key} stays where it is.`); return; }
745
+ if (H.jiraMove) H.jiraMove({ key, to, from: colOf(from), fromRaw: body.__ivkRaw || '' });
746
+ return;
747
+ }
748
+ if (H.status) H.status(uid, to);
620
749
  });
621
750
  // the Timeline keeps the PM's place over a redraw, and first opens on today
622
751
  const settle = () => {
@@ -178,7 +178,7 @@ const draftTask = (id, uid) => { const R = ROWS.get(id); return R && R.d ? R.d.t
178
178
  const iniOfUid = (uid) => { for (const [id, R] of ROWS) if (R.d && R.d.tasks.some((x) => x.uid === uid)) return id; return null; };
179
179
  async function draftDates(H, uid, patch) {
180
180
  const id = iniOfUid(uid), x = id && draftTask(id, uid);
181
- const set = {}; if ('start' in patch) set.start = patch.start || ''; if ('due' in patch) set.due = patch.due || '';
181
+ const set = {}; if ('start' in patch) set.start = patch.start || ''; if ('due' in patch) set.due = patch.due || ''; if ('milestone' in patch) set.milestone = !!patch.milestone;
182
182
  const res = await write(H, '/task', { task: uid, set });
183
183
  if (!res || res.ok === false) return failed(H, res);
184
184
  took(id, res); if (H.redraw) H.redraw();
@@ -186,6 +186,16 @@ async function draftDates(H, uid, patch) {
186
186
  say(H, 'Dates saved in ' + name + (x ? ': ' + x.title : '') + '.', res.from ? async () => { const u = await write(H, '/task', { task: uid, set: res.from }); if (u && u.ok) { took(id, u); if (H.redraw) H.redraw(); } else failed(H, u, 'The undo did not land.'); } : undefined);
187
187
  return true;
188
188
  }
189
+ /** One change to a draft's task (its name or its stage), with Undo. */
190
+ async function draftSet(H, uid, set, words) {
191
+ const id = iniOfUid(uid), x = id && draftTask(id, uid);
192
+ const res = await write(H, '/task', { task: uid, set });
193
+ if (!res || res.ok === false) return failed(H, res);
194
+ took(id, res); if (H.redraw) H.redraw();
195
+ const R = ROWS.get(id), name = R && R.vs ? R.vs.show.name : 'the draft';
196
+ say(H, words + name + (x ? ': ' + x.title : '') + '.', res.from ? async () => { const u = await write(H, '/task', { task: uid, set: res.from }); if (u && u.ok) { took(id, u); if (H.redraw) H.redraw(); } else failed(H, u, 'The undo did not land.'); } : undefined);
197
+ return true;
198
+ }
189
199
  async function draftStatus(H, uid, state) {
190
200
  const id = iniOfUid(uid), x = id && draftTask(id, uid);
191
201
  const R = ROWS.get(id), name = R && R.vs ? R.vs.show.name : 'the draft';
@@ -338,11 +348,15 @@ export function wrap(h, body, shown) {
338
348
  W.dates = (uid, patch) => (isDraft(uid) ? draftDates(W, uid, patch) : h.dates && h.dates(uid, patch));
339
349
  if (h.remove) W.remove = (uid) => (isDraft(uid) ? draftDrop(W, uid) : h.remove(uid));
340
350
  W.openTask = (uid, b) => (isDraft(uid) ? undefined : h.openTask && h.openTask(uid, b));
341
- W.addTask = async (title, inp) => {
351
+ // opt (batch 18 item 16): the stage whose + took the task ({ section, name, start?, due? }); without it, the stage now
352
+ W.addTask = async (title, inp, opt) => {
342
353
  const id = idOf(), v = id && shown ? shown(id) : null;
343
354
  const now = v && v.tasks ? v.tasks.sections.find((s) => s.kind === 'stage' && s.status === 'now') : null;
344
- if (id && await draftAdd(W, id, title, inp, now ? now.key : '')) return;
345
- return h.addTask && h.addTask(title, inp);
355
+ if (id && await draftAdd(W, id, title, inp, opt && opt.section != null ? opt.section : now ? now.key : '')) return;
356
+ return h.addTask && h.addTask(title, inp, opt);
346
357
  };
358
+ // a draft's task renamed or moved in place (batch 18 item 16): the draft changes, Live is not touched
359
+ W.rename = (uid, title) => (isDraft(uid) ? draftSet(W, uid, { title }, 'Renamed in ') : h.rename && h.rename(uid, title));
360
+ W.move = (uid, m) => (isDraft(uid) ? draftSet(W, uid, { section: m.to }, 'Moved in ') : h.move && h.move(uid, m));
347
361
  return W;
348
362
  }
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * iniView(r, ctx) → { summary, stage, tasks, vs } the whole view, as data (vs: what pm/ini-versions.js rowFor put on the row, or null)
8
8
  * ctx: { steps (Product feature's eight, the model's), today (YYYY-MM-DD, the model's day), usual ({ days } | null, the usual days in the
9
- * current stage), grill ({ open, later } | null), program ({ id, title } | null), jiraAt ('Jira · 2h ago' | ''), ask ({ title } | null: a
9
+ * current stage), grill ({ open, later } | null), program ({ id, title } | null), jiraAt ('Jira · 2h ago' | ''), jiraReadAt (the ISO time of the last Jira read: an open Jira row says "read 4 min ago"), ask ({ title } | null: a
10
10
  * session that waits on the PM, Home's; n: how many wait on this initiative), docs (count | null), linked (count | null), claude (Claude's
11
11
  * line while a session works on it, Home's), people ([{ name }]: the stakeholders) }
12
12
  * stagesOf(r, steps) → { list: [{ key, name, ms, status: done | now | next | skip, why }], cur } the initiative's OWN workflow (D99)
@@ -128,11 +128,13 @@ function rowOf(k0, today, J = null) {
128
128
  return { uid: k.uid, title: k.title, status: k.status || 'To do', closed, done: k.status === 'Done', wont: k.status === "Won't do", prog: k.status === 'In progress', late, due,
129
129
  days, lateText: late ? plural(between(d, today), 'day', 'days') + ' late' : '', item: !!k.item, ms: !!k.milestone, // ms: the ◇ flag (batch 11 item 3)
130
130
  start: k.start || '', end: k.end || '', owner: who, av: initials(k.owner),
131
+ // the open row's date chips (batch 18 item 16): each day alone; rank: the PM's order inside its stage (a task-order line)
132
+ startText: k.start ? dateY(k.start, today) : '', dueText: d ? dateY(k.end, today) : '', rank: Number.isFinite(k.rank) ? k.rank : null,
131
133
  sub: [k.status === 'In progress' ? 'In progress' : '', due, who && who !== 'You' ? who : ''].filter(Boolean).join(' · '), wbs: wbsOf(k.title), canCheck: !!k.uid && !k.draft && !J, order: k.order,
132
134
  // planned versus actual (batch 11 item 8, pm/ini-versions.js): the compared version's days where they differ, ⊕ added after it, a draft's task
133
135
  cmp: k.cmp || null, added: !!k.added, dr: !!k.draft,
134
136
  // jkey: the key of the Jira ticket the task is linked to, only when PMOS read that ticket; jst: its own Jira status (it owns the status)
135
- jkey: J ? J.key : '', jst: J ? String(J.raw || J.status || '') : '', _k: k0, _t: today };
137
+ jkey: J ? J.key : '', jst: J ? String(J.raw || J.status || '') : '', jmove: J && J.move ? J.move : null, _k: k0, _t: today }; // jmove: a move asked in PMOS (lib/jira-moves.js)
136
138
  }
137
139
  /** The Jira keys a task's title holds ("MSD-4376 Navigation tabs" → ['MSD-4376']). A task whose title names a ticket PMOS read IS that ticket
138
140
  * (linkOf): it shows the Jira mark and the key once, its status is Jira's, and the ticket's own row does not show again (batch 11 item 4,
@@ -150,10 +152,12 @@ export function linkRows(rows, tickets) {
150
152
  return rows.map((x) => { if (x.jkey || !x._k) return x; const J = linkOf(x.title, by); return J ? { ...rowOf(x._k, x._t, J), sec: x.sec } : x; });
151
153
  }
152
154
  const urgent = (a, b) => (b.late - a.late) || (a.end || '9999').localeCompare(b.end || '9999') || (a.order != null && b.order != null ? a.order - b.order : 0);
155
+ /* the PM's own order inside a stage (batch 18 item 16, a drag in the List) leads: the ranked tasks top to bottom, then the rest by urgency */
156
+ const ranked = (a, b) => (a.rank != null && b.rank != null ? a.rank - b.rank : a.rank != null ? -1 : b.rank != null ? 1 : urgent(a, b));
153
157
  /** A section's rows: open ones first by urgency; past 5 open, the 3 most urgent then the rest folded by the next WBS level; done fold last
154
158
  * (Won't do joins it), then the archived ones, which only the List draws, folded after Done (batch 9 item 5b). */
155
159
  export function bodyOf(rows, archived = []) {
156
- const open = rows.filter((x) => !x.closed).sort(urgent), done = rows.filter((x) => x.closed);
160
+ const open = rows.filter((x) => !x.closed).sort(ranked), done = rows.filter((x) => x.closed);
157
161
  if (open.length <= 5) return { top: open, groups: [], done, archived };
158
162
  const top = open.slice(0, 3), rest = open.slice(3), by = new Map();
159
163
  for (const x of rest) { const k = x.wbs ? x.wbs.top : ''; if (!by.has(k)) by.set(k, []); by.get(k).push(x); }
@@ -161,7 +165,7 @@ export function bodyOf(rows, archived = []) {
161
165
  const groups = [...by.entries()].map(([k, xs]) => {
162
166
  const codes = xs.map((x) => x.wbs && x.wbs.code).filter(Boolean).sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
163
167
  const label = !k ? 'Other open tasks' : heads.get(k) ? k + ' ' + heads.get(k) : codes.length > 1 ? codes[0] + ' to ' + codes[codes.length - 1] : codes[0] || k;
164
- return { key: k || '-', label, rows: xs.sort(urgent), n: xs.length };
168
+ return { key: k || '-', label, rows: xs.sort(ranked), n: xs.length };
165
169
  });
166
170
  // one group only says nothing the count does not: then it is "N more open"
167
171
  if (groups.length === 1) groups[0].label = plural(rest.length, 'more open', 'more open');
@@ -248,8 +252,9 @@ export function iniView(r, ctx = {}) {
248
252
  list.forEach((s, i) => {
249
253
  const x = one(s, i);
250
254
  if (i === cur && jira && tkOwn.length) {
251
- const opn = tkOwn.filter((k) => k.status !== 'Done').sort((a, b) => (b.blocked ? 1 : 0) - (a.blocked ? 1 : 0));
252
- x.jira = { open: opn.map((k) => ({ key: k.key, title: k.title, epic: k.epic || '', status: k.status || 'To do', start: k.start || '', due: k.due || k.sprintEnd || '', here: !!k.datesHere, days: jDays(k, today), av: initials(k.assignee), sub: [k.blocked ? 'Blocked' + (k.reason ? ' by ' + String(k.reason).replace(/^Waiting on /i, '') : '') : k.status || 'To do', k.assignee || ''].filter(Boolean).join(' · '), warn: !!k.blocked })),
255
+ // a ticket just moved to Done in PMOS stays in view until Jira's next read, so the card the PM dropped does not vanish
256
+ const opn = tkOwn.filter((k) => k.status !== 'Done' || (k.move && (k.move.state === 'moving' || k.move.state === 'moved'))).sort((a, b) => (b.blocked ? 1 : 0) - (a.blocked ? 1 : 0));
257
+ x.jira = { open: opn.map((k) => ({ key: k.key, title: k.title, epic: k.epic || '', status: k.status || 'To do', raw: k.raw || '', move: k.move || null, start: k.start || '', due: k.due || k.sprintEnd || '', here: !!k.datesHere, days: jDays(k, today), av: initials(k.assignee), sub: [k.blocked ? 'Blocked' + (k.reason ? ' by ' + String(k.reason).replace(/^Waiting on /i, '') : '') : k.status || 'To do', k.assignee || ''].filter(Boolean).join(' · '), warn: !!k.blocked })),
253
258
  done: tkOwn.length - opn.length, total: tkOwn.length, at: ctx.jiraAt || '' };
254
259
  x.count = countOf(opn.length + x.top.length + x.groups.reduce((n, g) => n + g.n, 0), x.top.filter((y) => y.late).length, 0);
255
260
  x.sub = x.sub + (x.sub ? ' · ' : '') + 'Jira tickets, by epic';
@@ -292,7 +297,7 @@ export function iniView(r, ctx = {}) {
292
297
  summary.wf = r.wf || { id: PF_ID, name: 'Product feature', icon: 'feature' };
293
298
  summary.program = ctx.program || null;
294
299
  const today2 = (n) => String(n).padStart(2, '0');
295
- return { vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jira ? ctx.jiraAt || '' : '',
300
+ return { vs: r.__vs || null, links: r.__vs && r.__vs.draft ? null : r.links || null, id: r.id || null, key: r.key, title: r.title, today: today.getFullYear() + '-' + today2(today.getMonth() + 1) + '-' + today2(today.getDate()), summary, stage, tasks, docs: ctx.docs != null ? ctx.docs : null, linked: linkedOf(r), jiraAt: jira ? ctx.jiraAt || '' : '', jiraRead: ctx.jiraReadAt || '',
296
301
  // split or merge (batch 11 item 14): Claude's suggestion for it, and where its work went when it was merged
297
302
  suggest: r.suggest || null, merged: mergedOf(r),
298
303
  // what Claude proposes under the one blue ✦, and what a ✓ kept from elsewhere (batch 12 items 2, 3 and 4; pm/ini-props.js)