create-pmos 0.422.0 → 0.423.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 (79) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/board-programs-test.js +28 -0
  7. package/workspace/briefing-premium-adddoc-test.js +1 -1
  8. package/workspace/briefing-premium-board-test.js +12 -10
  9. package/workspace/briefing-premium-initiative-test.js +30 -38
  10. package/workspace/changelog.json +12 -0
  11. package/workspace/guide/briefing-premium.md +1 -1
  12. package/workspace/guide/home.md +9 -2
  13. package/workspace/guide/programs.md +1 -0
  14. package/workspace/guide/workflows.md +5 -1
  15. package/workspace/ini-workflow-test.js +4 -4
  16. package/workspace/lib/board-premium.js +3 -2
  17. package/workspace/lib/custom-docs.js +65 -3
  18. package/workspace/lib/engine/boards.js +25 -2
  19. package/workspace/lib/initiative-writer.js +63 -1
  20. package/workspace/lib/plan-items.js +36 -5
  21. package/workspace/lib/programs.js +11 -3
  22. package/workspace/lib/route-modules.js +1 -0
  23. package/workspace/lib/routes-board-premium.js +22 -0
  24. package/workspace/lib/routes-boards.js +50 -10
  25. package/workspace/lib/routes-initiatives.js +12 -0
  26. package/workspace/lib/routes-task-links.js +329 -0
  27. package/workspace/lib/split-merge-suggest.js +162 -0
  28. package/workspace/lib/split-merge.js +379 -0
  29. package/workspace/lib/task-cli.js +58 -5
  30. package/workspace/lib/task-items.js +14 -2
  31. package/workspace/lib/task-links.js +422 -0
  32. package/workspace/package-lock.json +2 -2
  33. package/workspace/package.json +1 -1
  34. package/workspace/premium-board-actions-test.js +2 -2
  35. package/workspace/premium-core-doc-issue-test.js +2 -2
  36. package/workspace/premium-vw-backlog-test.js +3 -3
  37. package/workspace/premium-vw-item-test.js +3 -3
  38. package/workspace/premium-vw-jira-test.js +6 -6
  39. package/workspace/product-lane-test.js +165 -0
  40. package/workspace/program-panel-test.js +1 -1
  41. package/workspace/public/pm/bd-ini-panel.js +16 -6
  42. package/workspace/public/pm/bd-prog.js +6 -1
  43. package/workspace/public/pm/bd-span.js +69 -15
  44. package/workspace/public/pm/bd-views.js +3 -2
  45. package/workspace/public/pm/cozy-board.css +10 -0
  46. package/workspace/public/pm/home-app.js +25 -8
  47. package/workspace/public/pm/home-ini-model.js +0 -34
  48. package/workspace/public/pm/home-ini.js +72 -204
  49. package/workspace/public/pm/ini-groups.js +228 -0
  50. package/workspace/public/pm/ini-links.js +561 -0
  51. package/workspace/public/pm/ini-tasks.js +58 -22
  52. package/workspace/public/pm/ini-versions.js +14 -9
  53. package/workspace/public/pm/ini-view-model.js +88 -4
  54. package/workspace/public/pm/ini-view.css +259 -18
  55. package/workspace/public/pm/ini-view.js +140 -32
  56. package/workspace/public/pm/premium-board.js +54 -6
  57. package/workspace/public/pm/split-merge.css +77 -0
  58. package/workspace/public/pm/split-merge.js +265 -0
  59. package/workspace/public/pm/stage-line.js +414 -0
  60. package/workspace/public/pm/task-card.js +5 -3
  61. package/workspace/public/pm/wf-page.css +2 -0
  62. package/workspace/public/pm/wf-page.js +2 -0
  63. package/workspace/public/pm/wf-stage.js +2 -1
  64. package/workspace/server.js +15 -1
  65. package/workspace/split-merge-ui-test.js +175 -0
  66. package/workspace/stage-card-test.js +12 -11
  67. package/workspace/task-card-test.js +3 -2
  68. package/workspace/task-delete-test.js +126 -0
  69. package/workspace/task-links-test.js +227 -0
  70. package/workspace/task-milestones-test.js +1 -1
  71. package/workspace/task-plans-test.js +6 -0
  72. package/workspace/task-views-test.js +1 -1
  73. package/workspace/test-lists/bd-ini-panel.json +8 -2
  74. package/workspace/test-lists/product-lane.json +6 -0
  75. package/workspace/test-lists/split-merge.json +15 -0
  76. package/workspace/test-lists/task-delete.json +5 -0
  77. package/workspace/test-lists/task-links.json +6 -0
  78. package/workspace/tk-tasks-test.js +173 -57
  79. package/workspace/workflows-setup-test.js +4 -3
@@ -5,25 +5,35 @@
5
5
  *
6
6
  * viewHtml(v, o) the body, top to bottom: the summary card (what waits on you leads, with the one primary; else the status and why;
7
7
  * the meta line: the status when something waits, the owner, the workflow, the program), the stage card (the stage's
8
- * number and name, how much of its section is done, the day clock, the ladder, the dates line that replaced the Plan
9
- * card, the next stage), Tasks as the WBS (sections in workflow order), then Documents and Linked as folds.
8
+ * number and name, how much of its section is done, the day clock and the → to the next stage, then its one line:
9
+ * each stage on its own dates with the milestone tasks as ◇, pm/stage-line.js, batch 11 item 21), Tasks as the WBS
10
+ * (sections in workflow order), then Documents and Linked as folds.
10
11
  * o: { add (the Tasks + icon), adding (the inline field is open), next (the next stage is a press: Home's move sheet), openTask, docs: { n, html? } | null,
11
12
  * quick (each task's box carries the status caret and its date is a press: the host has h.status and h.dates),
12
13
  * draft (the empty breakdown's Draft it), program (the chip opens the program), wf (the workflow on the meta line opens the Change picker) }
13
14
  * wireView(body, h) the presses, once per body: h.check(uid, btn), h.openTask(uid), h.openTicket(key), h.add(btn) (the + icon: the host
14
15
  * redraws with o.adding, an inline field), h.addTask(title, input), h.addCancel(), h.next(btn),
15
16
  * h.primary(act, btn), h.program(id), h.docs(), h.doc(path) (a linked document), h.draft(btn), h.wf(btn), h.redraw() (after a fold opens or closes),
17
+ * h.sm(act, btn) a press on Claude's split or merge card (pm/split-merge.js press), h.openIni(id) the merged summary's link,
16
18
  * h.status(uid, state) and h.dates(uid, { start?, due? }) (the quick changes, each saved at once with Undo in the host's toast);
19
+ * the stage card's line (batch 11 item 21, pm/stage-line.js): h.add(btn, { start, due }) a gap's + (a task on those dates),
20
+ * h.hold(i, btn) a hold's ⏸ or calendar (o.hold: the host has it), h.openIni(id) "after <initiative>";
17
21
  * for planned versus actual (pm/ini-versions.js) h.where() → { ws, board }, h.reload() and h.toast(text, undo?)
18
22
  *
19
23
  * Tasks has three views (batch 9 item 5b; canvas In development, row "Tasks views"): the List (the WBS below), Timeline and Kanban
20
- * (pm/ini-tasks.js). The icon segment in the Tasks header switches them, and the last one is remembered for the PM.
24
+ * (pm/ini-tasks.js). The icon segment in the Tasks header switches them, and the last one is remembered for the PM. The group icon before
25
+ * it (batch 11 item 20, pm/ini-groups.js) groups the same tasks by Stage, Epic, Your groups, Owner or Status in all three views; By epic
26
+ * carries the send icons and Send to Jira, which used to be the old All tasks panel's.
21
27
  *
22
28
  * Folds keep their state per initiative for the session (a section, the Later line, a WBS group, the done tasks). Icon-only presses carry
23
29
  * their words in aria-label and title. Zero is silence: a part with nothing on record draws nothing. */
24
30
  import { wfIcon } from './wf-model.js';
25
31
  import * as TV from './ini-tasks.js'; // Tasks as List, Timeline or Kanban, and the quick status and dates (batch 9 item 5b)
26
32
  import * as VS from './ini-versions.js'; // planned versus actual: the version chip, Make live, a draft's writes (batch 11 item 8)
33
+ import * as LK from './ini-links.js'; // links between tasks, Claude's proposals and quiet moves (batch 11 item 15)
34
+ import * as G from './ini-groups.js'; // Group by and Send to Jira, in place of the old All tasks panel (batch 11 item 20)
35
+ import { cardHtml as smCard, mergedHtml as smMerged } from './split-merge.js'; // split or merge: Claude's card, the merged summary (batch 11 item 14)
36
+ import { lineHtml, fitLine } from './stage-line.js'; // the stage card's one line (batch 11 item 21)
27
37
 
28
38
  const CSS = new URL('./ini-view.css', import.meta.url).href;
29
39
  if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
@@ -35,6 +45,7 @@ const P = {
35
45
  go: 'M5 12h14M13 6l6 6-6 6', check: 'M5 12l5 5 9-10', right: 'M10 7l5 5-5 5', down: 'M7 10l5 5 5-5', plus: 'M12 5v14M5 12h14',
36
46
  prog: 'M12 3l9 5-9 5-9-5zM3 13l9 5 9-5', doc: 'M7 3h7l5 5v13H7zM14 3v5h5', draft: 'M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8',
37
47
  skip: 'M6 7l5 5-5 5M13 7l5 5-5 5', // » a skipped stage (batch 11 item 13: the same mark as the timelines)
48
+ pause: 'M9 6v12M15 6v12', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16',
38
49
  };
39
50
  const FOLD = new Map(); // `${id}|${key}` → true (open) | false (shut): the PM's own fold, for the session
40
51
  const isOpen = (v, key, dflt) => { const k = (v.id || v.key) + '|' + key; return FOLD.has(k) ? FOLD.get(k) : !!dflt; };
@@ -56,17 +67,26 @@ function summaryHtml(s, o = {}) {
56
67
  + `<p class="iv-meta">${meta.join('<span class="iv-sep" aria-hidden="true">·</span>')}</p></section>`;
57
68
  }
58
69
 
59
- /* ── the stage card, with the dates line (the old Plan card, item 3) ── */
60
- function stageHtml(st, o) {
61
- const right = [st.doneOf, st.day].filter(Boolean);
62
- const head = `<div class="iv-sch">${st.n ? `<span class="iv-no${st.ms ? ' ms' : ''}" aria-hidden="true">${st.ms ? '' : st.n}</span>` : ''}<b>${esc(st.name)}</b>`
63
- + (right.length ? `<span class="iv-r">${st.doneOf ? esc(st.doneOf) : ''}${st.doneOf && st.day ? ' · ' : ''}${st.day ? `<span class="${st.dayOver ? 'w' : ''}">${esc(st.day)}</span>` : ''}</span>` : '') + '</div>';
64
- const lad = st.ladder.length ? `<div class="iv-lad" role="img" aria-label="${esc(st.aria)}">${st.ladder.map((x) => `<i class="${[x.cls, x.ms ? 'ms' : ''].filter(Boolean).join(' ')}" title="${esc(x.name + (x.cls === 'skip' ? ' · skipped' : x.cls === 'done' ? ' · done' : x.cls === 'now' ? ' · now' : ''))}"></i>`).join('')}</div>` : '';
65
- const d = st.dates;
66
- const dates = d ? `<div class="iv-dl"><span>${esc(d.start)}</span><span class="e${d.over ? ' w' : ''}">${d.end ? `<b>${esc(d.end)}</b> end` : ''}${d.left ? ' · ' + esc(d.left) : ''}${d.jira ? ` · <span class="j">Jira: ${esc(d.jira)}</span>` : ''}</span></div>` : '';
70
+ /* ── the stage card: its header and one line (batch 11 item 21, agreed A; it replaced the ladder, the dates line and the next stage) ──
71
+ * The header: the stage's number and name, "N of M done" (a press shows the stage in Tasks), the clock, or the hold, done or draft chip that
72
+ * replaces it, the calendar when a date is missing, and the icon-only → that opens the move sheet (blue when every task of the stage is done
73
+ * and the next stage waits). The line is pm/stage-line.js. */
74
+ const CLOCK = 'M12 7.5V12l3 2M12 3.5a8.5 8.5 0 1 0 0 17a8.5 8.5 0 1 0 0-17';
75
+ const LINE = new Map(); // id → what is unfolded under the line ('' | 'list' | 'list+' | 'ms:<i>' | 'gap:<i>')
76
+ function stageHtml(st, o, id) {
77
+ const L = st.line;
78
+ const tile = st.n ? `<span class="iv-no${st.ms ? ' ms' : ''}" aria-hidden="true">${st.ms ? '' : st.n}</span>` : '';
79
+ const of = st.doneOf ? (st.key ? `<button type="button" class="iv-scd" data-iv-stage="${esc(st.key)}" title="Show ${esc(st.name)} in Tasks">${esc(st.doneOf)}</button>` : `<span class="iv-scd">${esc(st.doneOf)}</span>`) : '';
80
+ const chip = L && L.chip ? `<span class="iv-chp ${esc(L.chip.tone)}">${L.chip.pause ? SVG(P.pause, 11, 2.4) : ''}${esc(L.chip.text)}</span>` : '';
81
+ const clock = !chip && st.clock ? `<span class="iv-clk${st.dayOver ? ' w' : ''}">${SVG(CLOCK, 13, 2)}${esc(st.clock)}</span>` : '';
82
+ const cal = L && L.cal === 'dates' ? `<button type="button" class="iv-ib iv-scb" data-iv-tlcal aria-label="No dates yet. Set them in Tasks" title="Set the dates">${SVG(P.cal, 16)}</button>`
83
+ : L && L.cal === 'back' && o.hold ? `<button type="button" class="iv-ib iv-scb" data-iv-hold="${L.holdAt}" aria-label="On hold with no return date. Set it" title="Set the return date">${SVG(P.cal, 16)}</button>` : '';
67
84
  const n = st.next;
68
- const nx = n ? `<${o.next ? 'button type="button" data-iv-next' : 'div'} class="iv-nx"${o.next ? ` aria-label="${esc('Move to ' + n.name)}"` : ''}><span class="iv-nd${n.ms ? ' ms' : ''}" aria-hidden="true"></span><span class="w"><b>${esc(n.name)}</b><span>Next stage${n.moves ? ' · moves' : ''}${n.moves ? ` <i class="iv-kr">${esc(n.moves)}</i>` : ''}</span></span></${o.next ? 'button' : 'div'}>` : '';
69
- return `<section class="iv-sc" aria-label="${esc('Stage · ' + st.name)}">${head}${lad}${dates}${nx}</section>`;
85
+ const go = n ? `<${o.next ? 'button type="button" data-iv-next' : 'span'} class="iv-scgo${st.ready ? ' on' : ''}"${n.ms ? ' data-ms="1"' : ''} aria-label="${esc('Next: ' + (n.ms ? '◆ ' : '') + n.name + (o.next ? '. Move to ' + n.name : ''))}" title="${esc('Next: ' + n.name)}">${SVG(P.go, 16, 2.2)}</${o.next ? 'button' : 'span'}>` : '';
86
+ // a phone puts "N of M done" and the clock on a line of their own under the name (ScxA2Phone)
87
+ const meta = of || clock || chip ? `<span class="iv-scm">${of}${clock}${chip}</span>` : '';
88
+ const head = `<div class="iv-sch">${tile}<b>${esc(st.name)}</b><span class="iv-sp"></span>${meta}${cal}${go}</div>`;
89
+ return `<section class="iv-sc" aria-label="${esc(st.aria || 'Stage · ' + st.name)}">${head}${lineHtml(L, { open: LINE.get(id) || '', hold: !!o.hold })}</section>`;
70
90
  }
71
91
 
72
92
  /* ── the WBS ── */
@@ -81,20 +101,26 @@ function taskHtml(x, o, arch) {
81
101
  let meta = x.sub ? `<span class="${x.late ? 'w' : ''}">${esc(x.sub)}</span>` : '';
82
102
  if (o.quick && x.uid) {
83
103
  // no dates: the calendar icon sits last and shows on hover, so an undated row reads the same as before
84
- const parts = [x.prog ? 'In progress' : '', x.days ? TV.dateBtn(x, o) + (x.lateText ? `<span class="iv-late">, ${esc(x.lateText)}</span>` : '') + TV.slipHtml(x) : '', x.owner && x.owner !== 'You' ? esc(x.owner) : ''];
104
+ const parts = [x.prog ? 'In progress' : '', x.days ? TV.dateBtn(x, o) + (x.lateText ? `<span class="iv-late">, ${esc(x.lateText)}</span>` : '') + TV.slipHtml(x) : '', LK.metaHtml(x, o.lk, o.quick), x.owner && x.owner !== 'You' ? esc(x.owner) : ''];
85
105
  meta = `<span class="iv-rm">${parts.filter(Boolean).join('<span class="iv-sep" aria-hidden="true"> · </span>')}${x.days ? '' : TV.dateBtn(x, o)}</span>`;
86
106
  } else if (TV.msNoDate(x)) {
87
107
  meta = `<span class="iv-rm">${x.sub ? `<span>${esc(x.sub)}</span> ` : ''}<span class="iv-dc ms">Set the due date</span></span>`;
88
108
  }
89
- return `<div class="iv-tr${x.closed ? ' done' : ''}${x.wont ? ' wo' : ''}${arch ? ' ar' : ''}">${chk}<span class="w">${t}${meta}</span></div>`;
109
+ // Your groups (batch 11 item 20): a task drags to another of the PM's groups
110
+ const drag = o.gdrag && x.uid && !x.dr ? ` draggable="true" data-ig-drag="${esc(x.uid)}"` : '';
111
+ return `<div class="iv-tr${x.closed ? ' done' : ''}${x.wont ? ' wo' : ''}${arch ? ' ar' : ''}"${drag}>${chk}<span class="w">${t}${meta}</span></div>`;
90
112
  }
91
113
  const chev = (open) => `<span class="iv-cv" aria-hidden="true">${SVG(open ? P.down : P.right, 15, 2)}</span>`;
92
114
  function bodyHtml(v, sec, o) {
93
- let h = sec.top.map((x) => taskHtml(x, o)).join('');
115
+ // By epic (batch 11 item 20): an epic's tickets first, or what comes next while nothing is drafted
116
+ let h = G.tkRowsHtml(sec) + G.tkEmptyHtml(sec) + sec.top.map((x) => taskHtml(x, o)).join('');
94
117
  if (sec.jira) {
95
118
  const byEp = new Map(); for (const k of sec.jira.open) { const e = k.epic || ''; if (!byEp.has(e)) byEp.set(e, []); byEp.get(e).push(k); }
96
119
  const all = isOpen(v, sec.key + ':tk', false), shown = all ? sec.jira.open : sec.jira.open.slice(0, 3);
97
- h += shown.map((k) => `<button type="button" class="iv-tr iv-tk" data-iv-ticket="${esc(k.key)}"><span class="iv-jq" aria-hidden="true"></span><span class="w"><b class="iv-tt"><em>${esc(k.key)}</em> ${esc(k.title)}</b><span class="${k.warn ? 'w' : ''}">${esc(k.sub)}</span></span></button>`).join('');
120
+ // the title opens the ticket; with quick changes on, its dates are a press too: the start and due kept in PMOS (batch 11 item 23)
121
+ h += shown.map((k) => o.quick
122
+ ? `<div class="iv-tr iv-tkr"><span class="iv-jq" aria-hidden="true"></span><span class="w"><button type="button" class="iv-tt" data-iv-ticket="${esc(k.key)}"><em>${esc(k.key)}</em> ${esc(k.title)}</button><span class="iv-rm"><span class="${k.warn ? 'w' : ''}">${esc(k.sub)}</span>${k.days ? '<span class="iv-sep" aria-hidden="true"> · </span>' : ''}${TV.dateBtn(TV.jiraRow(k), o)}</span></span></div>`
123
+ : `<button type="button" class="iv-tr iv-tk" data-iv-ticket="${esc(k.key)}"><span class="iv-jq" aria-hidden="true"></span><span class="w"><b class="iv-tt"><em>${esc(k.key)}</em> ${esc(k.title)}</b><span class="${k.warn ? 'w' : ''}">${esc(k.sub)}</span></span></button>`).join('');
98
124
  if (sec.jira.open.length > shown.length) h += `<button type="button" class="iv-more" data-iv-fold="${esc(sec.key + ':tk')}" aria-expanded="false">${esc((sec.jira.open.length - shown.length) + ' more open' + (byEp.size > 1 ? ' · by epic' : ''))}${SVG(P.right, 14, 2)}</button>`;
99
125
  h += `<p class="iv-q">${esc(sec.jira.done + ' of ' + sec.jira.total + ' done in Jira' + (sec.jira.at ? ' · ' + sec.jira.at : ''))}</p>`;
100
126
  }
@@ -127,28 +153,37 @@ function markOf(sec) {
127
153
  if (sec.kind === 'later' || sec.kind === 'none') return '<span class="iv-no dash" aria-hidden="true"></span>';
128
154
  if (sec.status === 'skip') return `<span class="iv-no skip" aria-hidden="true">${SVG(P.skip, 12, 2)}</span>`;
129
155
  if (sec.status === 'done') return `<span class="iv-no ok" aria-hidden="true">${SVG(P.check, 12, 3)}</span>`;
156
+ if (sec.kind === 'group' || sec.kind === 'epic') return ''; // a group of another grouping has no stage number (batch 11 item 20)
130
157
  if (sec.ms) return '<span class="iv-no ms" aria-hidden="true"></span>';
131
158
  return `<span class="iv-no${sec.status === 'now' ? ' now' : ''}" aria-hidden="true">${esc(sec.n)}</span>`;
132
159
  }
133
160
  function sectionHtml(v, sec, o, inner) {
134
161
  const key = 'sec:' + (sec.key || 'none'), op = isOpen(v, key, sec.open);
135
- const has = sec.top.length || sec.groups.length || sec.done.length || (sec.archived || []).length || sec.jira || (sec.stages && sec.stages.length);
162
+ const has = sec.top.length || sec.groups.length || sec.done.length || (sec.archived || []).length || sec.jira || (sec.stages && sec.stages.length) || (sec.tk && sec.tk.length) || sec.tkEmpty;
136
163
  const name = sec.label || sec.name;
137
- const row = `<button type="button" class="iv-ws${sec.kind !== 'stage' && sec.kind !== 'none' ? ' mut' : ''}${inner ? ' in' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'}>${markOf(sec)}`
138
- + `<span class="w"><b>${esc(name)}</b>${sec.sub ? `<small class="${sec.subWarn ? 'w' : ''}">${esc(sec.sub)}</small>` : ''}</span>${sec.count ? `<span class="n${sec.warn ? ' w' : ''}">${esc(sec.count)}</span>` : ''}${has ? chev(op) : ''}</button>`;
139
- if (!op || !has) return row;
164
+ const row = `<button type="button" class="iv-ws${sec.kind === 'past' || sec.kind === 'later' ? ' mut' : ''}${inner ? ' in' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'}>${markOf(sec)}`
165
+ + `<span class="w"><b>${esc(name)}</b>${sec.sub ? `<small class="${sec.subWarn ? 'w' : ''}">${esc(sec.sub)}</small>` : ''}</span>${sec.epicKey ? `<span class="ig-key">${esc(sec.epicKey)}</span>` : ''}${sec.count ? `<span class="n${sec.warn ? ' w' : ''}">${esc(sec.count)}</span>` : ''}${has ? chev(op) : ''}</button>`;
166
+ // a group's own presses sit beside its fold: ⋯ on the PM's own group, the send icon on an epic (batch 11 item 20)
167
+ const tools = G.toolsHtml(sec), head = tools ? `<div class="iv-wsw">${row}${tools}</div>` : row;
168
+ // the PM's own groups and Not in a group take a dragged task
169
+ const drop = (h) => (sec.mine != null && o.gdrag ? `<div class="ig-dz" data-ig-drop="${esc(sec.mine || '')}">${h}</div>` : h);
170
+ if (!op || !has) return drop(head);
140
171
  // the folded lines (past stages, Later) open into their own stages, each a section of its own
141
172
  const body = sec.stages ? sec.stages.map((s) => sectionHtml(v, s, o, true)).join('') : bodyHtml(v, sec, o);
142
- return row + `<div class="iv-wl">${body}</div>`;
173
+ return drop(head + `<div class="iv-wl">${body}</div>`);
143
174
  }
144
- function tasksHtml(v, o) {
145
- const T = v.tasks;
175
+ function tasksHtml(v0, o) {
176
+ // the grouping the PM picked (batch 11 item 20): every view draws its groups as it draws the stages
177
+ const v = G.view(v0), T = v.tasks;
146
178
  const add = o.add ? `<button type="button" class="iv-ib" data-iv-add aria-label="Add a task to ${esc(v.title)}" title="Add a task">${SVG(P.plus, 16, 2.2)}</button>` : '';
147
179
  // the view switch shows once there is a task to see another way (zero is silence)
148
180
  const mode = T.empty ? 'list' : TV.viewMode();
149
181
  // planned versus actual (batch 11 item 8): the version chip and the end slip after the count; Make live (seal) while a draft is shown
150
182
  const cnt = VS.countText(v.vs, T.count, T.open + T.done);
151
- const head = `<div class="iv-th"><b>Tasks</b>${cnt ? `<span class="n">${esc(cnt)}</span>` : ''}${VS.headHtml(v.vs)}<span class="iv-sp"></span>${T.empty ? '' : TV.headExtraHtml(v, mode) + TV.switchHtml(mode)}${VS.liveHtml(v.vs)}${add}</div>`
183
+ // links (batch 11 item 15): the blue ✦ (proposals), the grey ✦ (quiet moves), the late count, between the count and the version chip
184
+ const lk = T.empty ? null : LK.of(v);
185
+ o = { ...o, lk };
186
+ const head = `<div class="iv-th"><b>Tasks</b>${cnt ? `<span class="n">${esc(cnt)}</span>` : ''}${LK.headHtml(lk)}${VS.headHtml(v.vs)}<span class="iv-sp"></span>${T.empty ? '' : TV.headExtraHtml(v, mode) + G.headHtml(v) + TV.switchHtml(mode)}${VS.liveHtml(v.vs)}${add}</div>`
152
187
  + (o.adding ? `<form class="iv-addf" data-iv-addform><input id="ivAddTask" type="text" maxlength="160" autocomplete="off" placeholder="A task for ${esc(v.title)}${o.addHint ? esc(', ' + o.addHint) : ''}" aria-label="New task"><button type="submit" class="iv-go" aria-label="Add the task" title="Add (Enter). Esc cancels.">${SVG(P.check, 16, 2.2)}</button></form>` : '');
153
188
  if (T.empty) {
154
189
  const sk = T.empty.stages.map((s) => `<span class="iv-sk"><span class="iv-no dash${s.ms ? ' ms' : ''}" aria-hidden="true">${s.ms ? '' : s.n}</span>${esc(s.name)}${s.now ? ' <i>· now</i>' : ''}</span>`).join('');
@@ -157,9 +192,11 @@ function tasksHtml(v, o) {
157
192
  }
158
193
  SHOWN.set(v.id || v.key || '', v);
159
194
  const fold = (k, d) => isOpen(v, k, d), q = { ...o, mark: markOf };
160
- if (mode === 'timeline') return head + `<div class="iv-tk">${TV.timelineHtml(v, q, fold)}</div>`;
161
- if (mode === 'kanban') return head + `<div class="iv-tk">${TV.kanbanHtml(v, q, fold)}</div>`;
162
- return head + `<div class="iv-wbs">${T.sections.map((s) => sectionHtml(v, s, o)).join('')}</div>`;
195
+ const top = head + G.sumHtml(v);
196
+ if (mode === 'timeline') return top + `<div class="iv-tk">${TV.timelineHtml(v, q, fold)}</div>`;
197
+ if (mode === 'kanban') return top + `<div class="iv-tk">${TV.kanbanHtml(v, q, fold)}</div>`;
198
+ const ol = T.by === 'mine' ? { ...o, gdrag: !!o.quick } : o;
199
+ return top + `<div class="iv-wbs">${T.sections.map((s) => sectionHtml(v, s, ol)).join('')}</div>`;
163
200
  }
164
201
  function foldsHtml(v, o) {
165
202
  const rows = [];
@@ -176,28 +213,44 @@ function foldsHtml(v, o) {
176
213
  return rows.length ? `<div class="iv-folds">${rows.join('')}</div>` : '';
177
214
  }
178
215
  export function viewHtml(v, o = {}) {
179
- return `<div class="iv" data-iv="${esc(v.id || v.key || '')}">${summaryHtml(v.summary, o)}${stageHtml(v.stage, o)}${tasksHtml(v, o)}${foldsHtml(v, o)}${o.tail || ''}</div>`;
216
+ // a merged initiative leads with where its work went, and draws no stage or tasks (they moved; its folds stay); an open one shows Claude's split or merge card under the summary (batch 11 item 14)
217
+ const top = v.merged ? smMerged(v.merged) : summaryHtml(v.summary, o) + (o.sm !== false ? smCard(v.suggest, v.title) : '');
218
+ return `<div class="iv" data-iv="${esc(v.id || v.key || '')}">${top}${v.merged ? '' : stageHtml(v.stage, o, v.id || v.key || '') + tasksHtml(v, o)}${foldsHtml(v, o)}${o.tail || ''}</div>`;
180
219
  }
181
220
 
182
221
  /* ── the presses ── */
183
222
  export function wireView(body, h) {
184
223
  if (!body) return;
185
- body.__iv = VS.wrap(h, body, (id) => SHOWN.get(id));
224
+ const idOf = () => { const n = body.querySelector('[data-iv]'); return n ? n.dataset.iv : null; };
225
+ body.__iv = LK.wrap(VS.wrap(h, body, (id) => SHOWN.get(id)), idOf);
226
+ G.attach(body, body.__iv); // the layout and the drafted tickets of the initiative shown (batch 11 item 20)
186
227
  if (body.__ivWired) return;
187
228
  body.__ivWired = true;
229
+ // the stage line's labels are checked as drawn (pm/stage-line.js fitLine): after each draw and when the panel changes width
230
+ if (typeof MutationObserver === 'function') {
231
+ let q = 0; const fit = () => { if (q) return; q = requestAnimationFrame(() => { q = 0; fitLine(body); }); };
232
+ new MutationObserver(fit).observe(body, { childList: true, subtree: true });
233
+ if (typeof ResizeObserver === 'function') new ResizeObserver(fit).observe(body);
234
+ fit();
235
+ }
188
236
  body.addEventListener('click', (e) => {
189
237
  const H = body.__iv || {}, b = e.target.closest('button, a'); if (!b || !body.contains(b)) return;
190
238
  const root = b.closest('[data-iv]'); if (!root) return;
191
239
  const id = root.dataset.iv;
192
240
  const d = b.dataset;
193
241
  if (VS.press(b, d, root, H)) return;
242
+ if (G.press(b, d, root, H)) return;
243
+ if (LK.press(b, d, root, { ...H, __dates: (x) => TV.press(x, { ivtBar: x.dataset.ivtBar }, root, H, e) })) return;
194
244
  if (TV.press(b, d, root, { ...H, __v: SHOWN.get(id) }, e)) return;
195
245
  if (d.ivFold) { e.preventDefault(); const k = id + '|' + d.ivFold; FOLD.set(k, b.getAttribute('aria-expanded') !== 'true'); if (H.redraw) H.redraw(); return; }
196
246
  if (d.ivCheck && H.check) { e.preventDefault(); H.check(d.ivCheck, b); return; }
197
247
  if (d.ivTask && H.openTask) { e.preventDefault(); H.openTask(d.ivTask, b); return; }
198
248
  if (d.ivTicket && H.openTicket) { e.preventDefault(); H.openTicket(d.ivTicket, b); return; }
199
249
  if ('ivAdd' in d && H.add) { e.preventDefault(); H.add(b); return; }
250
+ if (lineMove(b, d, id, H, e)) return;
200
251
  if ('ivNext' in d && H.next) { e.preventDefault(); H.next(b); return; }
252
+ if (d.sm && H.sm) { e.preventDefault(); H.sm(d.sm, b); return; }
253
+ if (d.smOpen && H.openIni) { e.preventDefault(); H.openIni(d.smOpen, b); return; }
201
254
  if (d.ivPrimary && H.primary) { e.preventDefault(); H.primary(d.ivPrimary, b); return; }
202
255
  if ('ivWf' in d && H.wf) { e.preventDefault(); H.wf(b); return; }
203
256
  if (d.ivProgram && H.program) { e.preventDefault(); H.program(d.ivProgram, b); return; }
@@ -211,8 +264,63 @@ export function wireView(body, h) {
211
264
  e.preventDefault(); const H = body.__iv || {}, inp = f.querySelector('input'), t = inp ? inp.value.trim() : '';
212
265
  if (t && H.addTask) H.addTask(t, inp);
213
266
  });
214
- TV.wireDrag(body);
267
+ G.wireDrag(body);
268
+ TV.wireDrag(body, () => { LK.draw(body, true); const n = body.querySelector('[data-iv]'); if (n) LK.sweep(n.dataset.iv, body.__iv || {}); });
215
269
  body.addEventListener('keydown', (e) => { if (e.key === 'Escape' && e.target.id === 'ivAddTask') { e.stopPropagation(); const H = body.__iv || {}; if (H.addCancel) H.addCancel(); } });
216
270
  }
271
+ /* ── the stage card's presses (batch 11 item 21) ──
272
+ * A part of the line or "N of M done" shows that stage in Tasks: its section opens and scrolls into view (the Kanban turns to that stage).
273
+ * A ◇ shows its task there. On a phone a tap on the line lists the stages and milestones under it instead (ScxA2Phone). A counted ◇, a
274
+ * gap and the phone's list unfold under the line; a second press folds them. */
275
+ const phone = () => typeof matchMedia === 'function' && matchMedia('(max-width: 760px)').matches;
276
+ function lineMove(b, d, id, H, e) {
277
+ const fold = (k) => { LINE.set(id, LINE.get(id) === k ? '' : k); if (H.redraw) H.redraw(); };
278
+ const inLine = !!b.closest('[data-iv-line]');
279
+ if (d.ivStage != null) { e.preventDefault(); if (inLine && phone()) fold('list'); else showIn(b, id, H, d.ivStage, null); return true; }
280
+ if (d.ivMs) { e.preventDefault(); if (inLine && phone()) { fold('list'); return true; } const v = SHOWN.get(id), f = v && findRow(v, d.ivMs); showIn(b, id, H, f ? f.sec : null, d.ivMs); return true; }
281
+ if (d.ivMsc != null) { e.preventDefault(); fold(phone() ? 'list' : 'ms:' + d.ivMsc); return true; }
282
+ if (d.ivGap != null) { e.preventDefault(); fold(phone() ? 'list' : 'gap:' + d.ivGap); return true; }
283
+ if ('ivTlall' in d) { e.preventDefault(); LINE.set(id, LINE.get(id) === 'list+' ? 'list' : 'list+'); if (H.redraw) H.redraw(); return true; }
284
+ if (d.ivGapadd && H.add) { e.preventDefault(); const [start, due] = d.ivGapadd.split(' '); LINE.set(id, ''); H.add(b, { start, due }); return true; }
285
+ if ('ivTlcal' in d) { e.preventDefault(); TV.setViewMode('timeline'); if (H.redraw) H.redraw(); later(b, (root) => root.querySelector('.iv-th')); return true; }
286
+ if (d.ivHold != null && H.hold) { e.preventDefault(); H.hold(+d.ivHold, b); return true; }
287
+ if (d.ivIni && H.openIni) { e.preventDefault(); H.openIni(d.ivIni, b); return true; }
288
+ return false;
289
+ }
290
+ /** A task row of the view by its id: { x, sec, fold } — fold: the fold inside its section that holds it (a WBS group or Done), or ''. */
291
+ function findRow(v, uid) {
292
+ for (const s of (v.tasks && v.tasks.sections) || []) {
293
+ const inner = s.stages ? s.stages : [s];
294
+ for (const c of inner) {
295
+ if ((c.top || []).some((x) => x.uid === uid)) return { x: c.top.find((x) => x.uid === uid), sec: c.key, fold: '' };
296
+ for (const g of c.groups || []) if (g.rows.some((x) => x.uid === uid)) return { x: g.rows.find((x) => x.uid === uid), sec: c.key, fold: c.key + ':g:' + g.key };
297
+ if ((c.done || []).some((x) => x.uid === uid)) return { x: c.done.find((x) => x.uid === uid), sec: c.key, fold: c.key + ':done' };
298
+ }
299
+ }
300
+ return null;
301
+ }
302
+ /** After the redraw: find the target in the view and bring it into sight, with a short highlight. */
303
+ function later(b, pick) {
304
+ const body = b.closest('[data-iv]') && b.closest('[data-iv]').parentElement;
305
+ const go = () => {
306
+ const root = body && body.querySelector('[data-iv]'); if (!root) return;
307
+ const el = pick(root); if (!el) return;
308
+ el.scrollIntoView({ block: 'center', behavior: 'smooth' });
309
+ el.classList.add('iv-hit'); setTimeout(() => el.classList.remove('iv-hit'), 1600);
310
+ };
311
+ if (typeof requestAnimationFrame === 'function') requestAnimationFrame(go); else go();
312
+ }
313
+ /** Show a stage (and one task of it) in Tasks: its section opens in the List and the Timeline, the Kanban turns to it. */
314
+ function showIn(b, id, H, key, uid) {
315
+ if (key != null) { FOLD.set(id + '|sec:' + (key || 'none'), true); TV.setKanbanStage(id, key); }
316
+ if (uid) { const v = SHOWN.get(id), f = v && findRow(v, uid); if (f && f.fold) FOLD.set(id + '|' + f.fold, true); }
317
+ if (H.redraw) H.redraw();
318
+ const q = (v) => String(v).replace(/["\\]/g, '\\$&');
319
+ later(b, (root) => {
320
+ if (uid) { const t = root.querySelector(`.iv-tk [data-iv-task="${q(uid)}"], .iv-wbs [data-iv-task="${q(uid)}"], .iv-wbs [data-iv-check="${q(uid)}"], .iv-tk [data-ivt-bar="${q(uid)}"], .iv-tk [data-iv-check="${q(uid)}"]`); if (t) return t.closest('.iv-tr') || t; }
321
+ return root.querySelector(`[data-iv-fold="sec:${q(key || 'none')}"]`) || root.querySelector('.iv-th');
322
+ });
323
+ }
324
+
217
325
  /** For the tests: forget every fold the PM opened or shut. */
218
- export const resetFolds = () => { FOLD.clear(); TV.resetViews(); VS.resetVersions(); };
326
+ export const resetFolds = () => { LINE.clear(); FOLD.clear(); TV.resetViews(); VS.resetVersions(); LK.resetLinks(); G.resetGroups(); };
@@ -35,6 +35,7 @@ import { open as viewerOpen, current as viewerCur } from './cozy-viewer.js';
35
35
  import * as VW from './cozy-viewer.js';
36
36
  import * as PP from './bd-prog-panel.js';
37
37
  import * as PO from './prog-order.js';
38
+ import * as SM from './split-merge.js'; // split one initiative in two, or merge two: Claude suggests, the PM approves (batch 11 item 14)
38
39
  import * as PM from './prog-move.js'; // move an initiative out of its program, or to another (canvas LpA1More, LpA2Other)
39
40
  import * as Pop from './bd-pop.js'; // the order of a program's initiatives: the grip and Claude's order from the dates (canvas RoADrag, RoASuggest)
40
41
  import * as BI from './bd-ini-panel.js';
@@ -346,7 +347,7 @@ function trackRow(r, cls = '', po = false) {
346
347
  }).join('');
347
348
  const many = TK.mode === 'cats'; // All: each row names its workflow with its icon (WfATrack)
348
349
  return `<div class="bt-r bt-l${cls}${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}"${po ? ` data-po-id="${esc(r.id)}"` : ''}>${po ? PO.gripHtml(r.title) : ''}`
349
- + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${esc(r.title)}</b><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
350
+ + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
350
351
  + `<div class="${cellsCls()}" role="presentation"${cellsStyle()}>${cells}</div>`
351
352
  + `<div class="bt-dl" role="cell">${nextHtml(r, { self: M.board.self, icon: !PHONE.matches })}</div></div>`; // the Next cell (XocA): what finishes the step next
352
353
  }
@@ -396,7 +397,7 @@ function drawTrack(L) {
396
397
  /* ── the timeline (AgBoardTimeline; TsCOpen, TsCDesk, TsAllSpans, TsCPhone) ───────────────────────────────────────── */
397
398
  function drawTime(L) {
398
399
  const S = M.steps || [], phone = PHONE.matches, bw = $('#ibBody').clientWidth || innerWidth;
399
- const T = timelineHtml(L, M, span, { groups: groups(L), progState, folded: PG.folded, prodHtml: (g) => PG.prodHtml(g, 'tg-prd'), subHtml: (n) => PG.subHtml(n, 'tg-psb'), progTile: () => PG.progTile(), productsOf: PG.productsOf,
400
+ const T = timelineHtml(L, M, span, { groups: groups(L), progState, folded: PG.folded, prodHtml: (g) => PG.prodHtml(g, 'tg-prd'), prodCell: (g) => PG.prodCell(g), subHtml: (n) => PG.subHtml(n, 'tg-psb'), progTile: () => PG.progTile(), productsOf: PG.productsOf,
400
401
  foldBtn: (g) => PG.foldBtn(g.key, g.program.title), memberIcon: (id) => PG.memberIcon(PGS, id), sel: peek && peek.kind !== 'acts' ? peek.key : null, status: statusOf, phone, trackPx: bw - 2 - (phone ? 0 : matchMedia('(max-width: 980px)').matches ? 180 : 250), avatar: (n) => V.avatar(n, 'sm'),
401
402
  askHref: (none) => askHref(null, 'Propose start and end dates for ' + none.map((r) => r.title).join(', ')) });
402
403
  return T.html;
@@ -490,6 +491,9 @@ $('#ibBody').addEventListener('click', (e) => {
490
491
  const pg = e.target.closest('[data-prog]'); if (pg) { PG.openProgram(pg.dataset.prog, pg); return; }
491
492
  // a counted milestone ◇ lists its milestones right under it; on a phone the row's bar lane opens them in a sheet (batch 11 item 3)
492
493
  const mc = e.target.closest('[data-ms-row]'); if (mc) { msPop(mc, rowOf(mc.dataset.msRow), mc.dataset.msIds.split(' ')); return; }
494
+ // a product lane's counted ◇ lists its milestones with their initiatives; on a phone a tap on the lane lists them all in a sheet (batch 11 item 17)
495
+ const ml = e.target.closest('[data-ms-lane]'); if (ml) { lanePop(ml, ml.dataset.msLane); return; }
496
+ const pl = PHONE.matches && e.target.closest('.tgq-r.tg-lane > .tg-p[data-lane-ms]'); if (pl) { lanePop(pl, pl.dataset.laneMs, pl.dataset.laneName); return; }
493
497
  // a gap's press (batch 11 item 13): its words, and + New task with its dates while part of it is ahead
494
498
  const gp = e.target.closest('[data-gap]'); if (gp) { gapPop(gp, rowOf(gp.dataset.gap)); return; }
495
499
  // the phone's row sheet lists the milestones, the gaps and the skipped stages in date order (XmlA5Phone, XgapA3Phone)
@@ -559,6 +563,25 @@ function moveItems(r) {
559
563
  return PM.moveItems({ programs: () => PGS, ws: r.ws || M.board.ws || '', id: r.id, product: r.product || M.board.product || M.board.name || '', pmPost, say,
560
564
  reload: async () => { await loadPrograms(); load(); }, phone: () => PHONE.matches, stateOf: (p) => progState(p), openList: moveList });
561
565
  }
566
+ /** Split or merge (pm/split-merge.js; canvas XsmA1Menu, XsmA1Suggest): the context of one row. After the write the Board reads again and the
567
+ * row the PM lands on (the new one after a split, the one that stays after a merge) is selected and open. */
568
+ function smCtx(r) {
569
+ const ws = r.ws || M.board.ws || '';
570
+ return { row: r, rows: () => ((M.initiatives && M.initiatives.list && M.initiatives.list.rows) || []).filter((x) => (x.boardId || M.board.id) === (r.boardId || M.board.id)),
571
+ ws, board: r.boardId || M.board.id, product: r.product || M.board.product || M.board.name || '', program: programOf(PGS, ws, r.id), pmPost, say,
572
+ reload: async () => { await loadPrograms(); await load(); }, openIni: (id) => openIniId(id), openList: moveList };
573
+ }
574
+ const smItems = (r) => (M.board.self ? [] : SM.menuItems(smCtx(r)));
575
+ const smPress = (r, act) => SM.press(smCtx(r), act);
576
+ /** Open a row by its record id once the read holds it (a split's new row can take a read or two to show). */
577
+ async function openIniId(id, tries = 8) {
578
+ const r = (M && M.rows || []).find((x) => x.id === id) || goneRows().find((x) => x.id === id);
579
+ if (r && r.track) { if (curView() === 'time') TL.reveal(r.key); openIni(r, null); return true; }
580
+ if (tries <= 0) return false;
581
+ await new Promise((ok) => setTimeout(ok, 900));
582
+ await load();
583
+ return openIniId(id, tries - 1);
584
+ }
562
585
  function moveList(b, label, rows) {
563
586
  const host = Pop.open(`<p class="bd-mlbl">${esc(label)}</p>${rows.map((x, i) => `<button type="button" class="bd-mi" role="menuitem" data-pm-to="${i}">${x.icon ? `<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${x.icon}"/></svg>` : ''}<span class="tx"><span>${esc(x.label)}</span>${x.sub ? `<small>${esc(x.sub)}</small>` : ''}</span></button>`).join('')}`,
564
587
  b, { label: 'Move to another program', role: 'menu', width: 280, align: 'right', cls: 'bd-menu', focus: '.bd-mi' });
@@ -642,6 +665,22 @@ function msPop(anchor, r, ids, sheet) {
642
665
  document.addEventListener('pointerdown', (e) => { if (msEl && !msEl.contains(e.target) && !(msEl.__a && msEl.__a.contains(e.target))) msClose(); }, true);
643
666
  document.addEventListener('keydown', (e) => { if (msEl && e.key === 'Escape') { e.stopPropagation(); const a = msEl.__a; msClose(); if (a && a.focus) a.focus(); } }, true);
644
667
  addEventListener('resize', () => msClose());
668
+ /** A product lane's milestones as a list (batch 11 item 17; PlmA2Folded, PlmA3Phone): ◇, the name over its initiative, the date. Under a counted
669
+ * ◇ it holds that ◇'s milestones; a phone's sheet (title: the product) holds every one, in date order. A line opens its initiative. */
670
+ function lanePop(anchor, data, title) {
671
+ const was = msEl && msEl.__a === anchor; msClose(); if (was) return;
672
+ let L = []; try { L = JSON.parse(data || '[]'); } catch { L = []; }
673
+ if (!L.length) return;
674
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], md = (iso) => MON[+iso.slice(5, 7) - 1] + ' ' + +iso.slice(8, 10);
675
+ const el = document.createElement('div');
676
+ el.className = 'tg-msp tg-lnp' + (title ? ' sh' : ''); el.setAttribute('role', 'menu'); el.setAttribute('aria-label', title || 'Milestones'); el.dataset.escLayer = '';
677
+ el.innerHTML = (title ? `<i class="gr" aria-hidden="true"></i><b class="h">${esc(title)}</b>` : '')
678
+ + L.map((m) => `<button type="button" role="menuitem" class="o" data-ms-ini="${esc(m.k)}"><i class="tg-tm-i${m.s ? ' ' + m.s : ''}" aria-hidden="true"></i><span>${esc(m.n)}<small>${esc(m.t)}</small></span><span class="k${m.s === 'late' ? ' late' : ''}">${esc(md(m.d))}</span></button>`).join('');
679
+ document.body.appendChild(el); el.__a = anchor; msEl = el; anchor.setAttribute('aria-expanded', 'true');
680
+ if (!title) { const b = anchor.getBoundingClientRect(), w = el.offsetWidth; el.style.left = Math.max(8, Math.min(b.left + b.width / 2 - w / 2, innerWidth - w - 8)) + 'px'; el.style.top = b.bottom + 8 + 'px'; }
681
+ el.onclick = (e) => { const o = e.target.closest('[data-ms-ini]'); if (!o) return; msClose(); openIni(rowOf(o.dataset.msIni), anchor); };
682
+ const f = el.querySelector('button'); if (f) f.focus({ preventScroll: true });
683
+ }
645
684
  /** A gap's card (batch 11 item 13; XgapAHard 2): its words under it; while part of it is ahead, + opens New task with those dates filled in. */
646
685
  function gapPop(anchor, r) {
647
686
  const was = msEl && msEl.__a === anchor; msClose(); if (was || !r) return;
@@ -888,9 +927,18 @@ async function setDates(r, uid, patch) {
888
927
  const res = await pmPost('/api/boards/tasks/edit', { ...body, ...patch }).catch(() => null);
889
928
  if (!res || res.ok === false) { say((res && res.error) || 'Nothing was changed.'); return; }
890
929
  const ms = 'milestone' in patch;
891
- const back = {}; for (const f of Object.keys(patch)) back[f] = f === 'milestone' ? (res.from && 'milestone' in res.from ? !!res.from.milestone : !patch.milestone) : k ? (f === 'due' ? k.end : k[f]) || '' : '';
930
+ const back = {}; for (const f of Object.keys(patch)) back[f] = f === 'milestone' ? (res.from && 'milestone' in res.from ? !!res.from.milestone : !patch.milestone) : k ? (f === 'due' ? k.end : k[f]) || '' : res.from && f in res.from ? res.from[f] || '' : ''; // a Jira ticket's days come back in from (batch 11 item 23)
892
931
  const words = ms ? (patch.milestone ? 'Milestone' : 'Not a milestone') : 'Dates saved';
893
- say(words + (k ? ': ' + k.title : '') + '.', k || ms ? async () => { const u = await pmPost('/api/boards/tasks/edit', { ...body, ...back }).catch(() => null); say(u && u.ok !== false ? (ms ? 'Put back.' : 'Dates put back.') : (u && u.error) || 'The undo did not land.'); load(); } : undefined);
932
+ const jd = !k && !ms && res.from && ('start' in res.from || 'due' in res.from); // a Jira ticket's days, kept in PMOS (batch 11 item 23)
933
+ say(words + (k ? ': ' + k.title : jd ? ': ' + uid + ', kept in PMOS' : '') + '.', k || ms || jd ? async () => { const u = await pmPost('/api/boards/tasks/edit', { ...body, ...back }).catch(() => null); say(u && u.ok !== false ? (ms ? 'Put back.' : 'Dates put back.') : (u && u.error) || 'The undo did not land.'); load(); } : undefined);
934
+ load();
935
+ }
936
+ /** The status picker's trash on the panel's Tasks (batch 11 item 16): POST /api/boards/tasks/delete, a Board task or a breakdown item; Undo restores it. */
937
+ async function removeTask(r, uid) {
938
+ const k = (r.tasks || []).find((x) => x.uid === uid), body = { ws: r.ws || M.board.ws, board: r.boardId || M.board.id, task: uid };
939
+ const res = await pmPost('/api/boards/tasks/delete', body).catch(() => null);
940
+ if (!res || res.ok === false) { say((res && res.error) || 'The task was not deleted.'); return; }
941
+ say('Deleted · ' + (k ? k.title : uid) + '.', async () => { const u = await pmPost('/api/boards/tasks/restore', body).catch(() => null); if (!u || u.ok === false) say((u && u.error) || 'The undo did not land.'); load(); });
894
942
  load();
895
943
  }
896
944
  /** A task's title on the initiative view: the one task editor (task-card.js through home-task.js), as Home opens it; ← is the initiative. */
@@ -943,8 +991,8 @@ Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePa
943
991
  grouping: () => ({ on: groupingOn(), byProduct }), setGrouping, sprintFilter: sprintFilterOn });
944
992
  BI.mount({ M: () => M, statusOf, dayTitle, usual: usualOf, fmt, md, ago, segHtml, barHtml: V.barHtml, grill: (id) => GR[id], rowOf, pageHref, askHref, refreshJira: () => refreshJira(), viewDoc,
945
993
  send: (r) => import('./tk-send.js').then((S) => S.openSend({ ws: r.ws || M.board.ws || null, board: r.boardId || M.board.id, initiative: r.id, toast: say })),
946
- acts: (r, b) => Acts.open.row(r, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
947
- programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, toast: say, rename: renameIni, setTask, setDates, addTask, openTask, turnProgram, moveItems });
994
+ acts: (r, b) => Acts.open.row(r, b), hold: (r, i, b) => Acts.open.hold(r, i, b), grillOpen: (r, b) => Asks.openGrill(r.id, r.title, (r.track && r.track.label) || 'Triage', false, b), onShow: iniShown, onHide: iniHidden,
995
+ programOf: (r) => programOf(PGS, r.ws || M.board.ws || '', r.id), openProgram: (id, b) => PG.openProgram(id, b), reload: load, toast: say, rename: renameIni, setTask, setDates, removeTask, addTask, openTask, turnProgram, moveItems, smItems, smPress, openIniId });
948
996
  /** Tap the title to rename (canvas RnAIni): the list, the Timeline and the panel show the new name at once; Undo is the same press.
949
997
  * The Jira box opens Home's chat about it with the request typed, for the PM to send (PMOS holds no Jira credential, D53). */
950
998
  // a name the PM just saved holds over a read that predates it (the board derives off the request path) until a read says it too
@@ -0,0 +1,77 @@
1
+ /* pm/split-merge.css — split or merge initiatives (pm/split-merge.js; canvas In development, row "Split or merge initiatives"). split-merge.js
2
+ * loads it once, so it works on the Board and on Home. Token vars only, over pm/cozy.css; Claude's purple is the program's (cozy-panel.css),
3
+ * with the frames' value when the page sets none. Quiet: no motion. Every class starts with sm-. */
4
+ .sm-card, .sm-dot, .sm-v, .sm-gone { --sm-prog: var(--pp-prog, var(--cz-c-6b4fa3)); --sm-progbg: var(--pp-progbg, rgba(107,79,163,.10)); }
5
+ b:has(> .sm-nm), span:has(> .sm-nm) { display: flex; align-items: center; min-width: 0; }
6
+ .sm-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
7
+ .sm-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--sm-prog); margin-left: 8px; vertical-align: 2px; flex: none; box-shadow: 0 0 0 2px var(--cz-card); }
8
+
9
+ /* the card under the summary (XsmA1Suggest) */
10
+ .sm-card { background: var(--sm-progbg); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
11
+ .sm-h { display: flex; align-items: center; gap: 8px; color: var(--sm-prog); font-size: 13.5px; }
12
+ .sm-h b { font-weight: 800; }
13
+ .sm-h.q { color: var(--cz-ink3); }
14
+ .sm-why { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--cz-ink2); }
15
+ .sm-pl { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--cz-card); font-size: 13px; color: var(--cz-ink3); font-weight: 600; }
16
+ .sm-pl svg { color: var(--sm-prog); flex: none; }
17
+ .sm-pl b { color: var(--cz-ink); font-weight: 800; }
18
+ .sm-acts { display: flex; justify-content: flex-end; gap: 6px; }
19
+ .sm-ib { all: unset; box-sizing: border-box; cursor: pointer; width: 36px; height: 36px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink2); background: var(--cz-card); }
20
+ .sm-ib.ok { background: var(--cz-ink); color: var(--cz-card); }
21
+ .sm-ib[disabled] { opacity: .4; cursor: default; }
22
+ @media (hover: hover) { .sm-ib:not([disabled]):hover { color: var(--cz-ink); box-shadow: 0 0 0 1px var(--cz-hair); } .sm-ib.ok:not([disabled]):hover { filter: brightness(1.15); color: var(--cz-card); } }
23
+ .sm-ib:focus-visible, .sm-pk:focus-visible, .sm-gone .sm-lk:focus-visible, .sm-seg button:focus-visible, .sm-cb:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
24
+
25
+ /* the merged summary (XsmA7Closed) */
26
+ .sm-gone { background: var(--cz-well); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
27
+ .sm-gone p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--cz-ink2); }
28
+ .sm-gone .sm-lk { all: unset; cursor: pointer; color: var(--cz-blueink); font-weight: 700; }
29
+
30
+ /* the split editor and the merge check (XsmA2Split, XsmA5MergeCheck) */
31
+ .sm-v { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; min-height: 100%; box-sizing: border-box; }
32
+ .sm-nf { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px 0 14px; border-radius: 16px; background: var(--cz-well); color: var(--cz-ink2); }
33
+ .sm-nf input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 17px; font-weight: 800; color: var(--cz-ink); outline: none; }
34
+ .sm-sg, .sm-sg2 { display: inline-flex; color: var(--sm-prog); }
35
+ .sm-sg2 { margin-left: 6px; vertical-align: -1px; }
36
+ .sm-keep { margin: 0 4px; font-size: 12.5px; font-weight: 700; color: var(--cz-ink3); line-height: 1.6; }
37
+ .sm-st { display: inline-flex; align-items: center; gap: 2px; position: relative; }
38
+ .sm-st select { all: unset; cursor: pointer; font: inherit; color: var(--cz-ink2); padding-right: 2px; }
39
+ .sm-list { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--cz-hair); border-radius: 18px; padding: 6px; }
40
+ .sm-gh { display: flex; align-items: center; gap: 10px; padding: 8px 8px 4px; font-size: 12px; font-weight: 800; color: var(--cz-ink3); }
41
+ .sm-gh .n { margin-left: auto; color: var(--cz-blueink); }
42
+ .sm-pk { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; border-radius: 12px; cursor: pointer; }
43
+ .sm-pk.on { background: var(--cz-bluebg); }
44
+ .sm-t { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
45
+ .sm-t b { font-size: 13.5px; font-weight: 700; color: var(--cz-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
46
+ .sm-t span { margin-left: auto; font-size: 12px; color: var(--cz-ink3); font-weight: 600; white-space: nowrap; }
47
+ .sm-cb { all: unset; box-sizing: border-box; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--cz-ink3); background: var(--cz-card); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--cz-onsolid); cursor: pointer; }
48
+ .sm-cb.on { background: var(--cz-blueink); border-color: var(--cz-blueink); }
49
+ .sm-cb.some { border-color: var(--cz-blueink); }
50
+ .sm-cb.some i { width: 9px; height: 2px; border-radius: 1px; background: var(--cz-blueink); }
51
+ .sm-ki { display: inline-flex; color: var(--cz-ink3); }
52
+ .sm-q { margin: 8px; font-size: 12.5px; color: var(--cz-ink3); }
53
+ .sm-foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 2px; }
54
+ .sm-cnt { flex: 1; font-size: 13px; font-weight: 700; color: var(--cz-ink2); }
55
+ .sm-foot .sm-ib { width: 44px; height: 44px; box-shadow: 0 0 0 1px var(--cz-hair); }
56
+ .sm-foot .sm-ib.ok { box-shadow: none; }
57
+ .sm-mc { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--cz-hair); }
58
+ .sm-mc .sm-t { flex-direction: column; gap: 2px; align-items: flex-start; }
59
+ .sm-mc .sm-t span { margin-left: 0; }
60
+ .sm-mc.gone { background: var(--cz-well); }
61
+ .sm-mc.gone b { color: var(--cz-ink2); }
62
+ .sm-mc.stay { border-color: color-mix(in srgb, var(--cz-blueink) 35%, transparent); box-shadow: 0 0 0 3px var(--cz-bluebg); }
63
+ .sm-vi { width: 28px; height: 28px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--cz-bluebg); color: var(--cz-blueink); }
64
+ .sm-mc.gone .sm-vi { background: var(--cz-card); color: var(--cz-ink3); }
65
+ .sm-mid { display: flex; align-items: center; justify-content: center; gap: 10px; margin: -4px 0; color: var(--cz-ink3); }
66
+ .sm-mid .sm-ib { box-shadow: 0 0 0 1px var(--cz-hair); }
67
+ .sm-r { margin: -2px 0 0 4px; font-size: 12px; color: var(--cz-ink3); font-weight: 600; }
68
+ .sm-dfs { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
69
+ .sm-df { display: flex; align-items: center; gap: 10px; }
70
+ .sm-dl { width: 90px; font-size: 12.5px; font-weight: 800; color: var(--cz-ink3); }
71
+ .sm-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--cz-well); gap: 2px; }
72
+ .sm-seg button { all: unset; cursor: pointer; height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--cz-ink3); display: inline-flex; align-items: center; }
73
+ .sm-seg button[aria-checked="true"] { background: var(--cz-card); color: var(--cz-ink); box-shadow: 0 1px 3px rgba(42,46,53,.12); }
74
+ .sm-dn { margin: 0; display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--cz-ink2); line-height: 1.45; }
75
+ .sm-dn svg { color: var(--cz-ink3); flex: none; }
76
+ /* a phone: the Viewer is the full-screen sheet; the touch targets grow to 44 px */
77
+ @media (max-width: 760px) { .sm-ib { width: 44px; height: 44px; } .sm-pk { min-height: 48px; } .sm-card { border-radius: 18px; } }