create-pmos 0.425.0 → 0.427.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 (75) hide show
  1. package/package.json +25 -25
  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-deliveries-test.js +153 -0
  7. package/workspace/board-programs-test.js +19 -10
  8. package/workspace/board-shot.js +4 -3
  9. package/workspace/briefing-premium-board-test.js +2 -2
  10. package/workspace/calm-timeline-test.js +190 -0
  11. package/workspace/changelog.json +24 -0
  12. package/workspace/ev-everywhere-test.js +3 -1
  13. package/workspace/guide/claude-proposes.md +19 -2
  14. package/workspace/guide/programs.md +2 -1
  15. package/workspace/lib/board-premium.js +3 -1
  16. package/workspace/lib/chat-file-locate.js +40 -2
  17. package/workspace/lib/context-use.js +54 -0
  18. package/workspace/lib/engine/boards.js +8 -2
  19. package/workspace/lib/idle-close.js +60 -0
  20. package/workspace/lib/loose-proposals.js +302 -0
  21. package/workspace/lib/my-work-premium.js +1 -1
  22. package/workspace/lib/proposal-runs.js +77 -2
  23. package/workspace/lib/propose-cli.js +42 -1
  24. package/workspace/lib/route-modules.js +1 -0
  25. package/workspace/lib/routes-boards.js +16 -4
  26. package/workspace/lib/routes-brief-page.js +9 -1
  27. package/workspace/lib/routes-live.js +3 -1
  28. package/workspace/lib/routes-loose.js +210 -0
  29. package/workspace/lib/routes-pm-items.js +27 -17
  30. package/workspace/lib/task-cli.js +18 -11
  31. package/workspace/lib/transcript-read.js +9 -2
  32. package/workspace/milestone-pins-test.js +170 -0
  33. package/workspace/package-lock.json +2 -2
  34. package/workspace/package.json +1 -1
  35. package/workspace/premium-board-actions-test.js +2 -1
  36. package/workspace/premium-briefing-depth-test.js +1 -1
  37. package/workspace/premium-chat-term-test.js +13 -2
  38. package/workspace/premium-core-doc-issue-test.js +1 -1
  39. package/workspace/product-lane-test.js +30 -17
  40. package/workspace/public/pm/bd-acts.js +6 -3
  41. package/workspace/public/pm/bd-deliveries.js +218 -0
  42. package/workspace/public/pm/bd-pin-card.css +16 -0
  43. package/workspace/public/pm/bd-pin-card.js +80 -0
  44. package/workspace/public/pm/bd-pins.js +33 -0
  45. package/workspace/public/pm/bd-pop.js +2 -0
  46. package/workspace/public/pm/bd-prog.js +5 -4
  47. package/workspace/public/pm/bd-span.js +140 -102
  48. package/workspace/public/pm/cozy-board.css +73 -11
  49. package/workspace/public/pm/cozy-home.css +23 -1
  50. package/workspace/public/pm/cozy-live-pill.css +1 -0
  51. package/workspace/public/pm/cozy-live-pill.js +2 -1
  52. package/workspace/public/pm/cozy-today.css +7 -0
  53. package/workspace/public/pm/cozy.css +6 -0
  54. package/workspace/public/pm/ctx-wedge.js +45 -0
  55. package/workspace/public/pm/home-app.js +29 -2
  56. package/workspace/public/pm/home-chat.js +7 -2
  57. package/workspace/public/pm/home-data.js +6 -3
  58. package/workspace/public/pm/home-list.js +46 -5
  59. package/workspace/public/pm/home-today.js +22 -6
  60. package/workspace/public/pm/ini-tasks.js +4 -1
  61. package/workspace/public/pm/live-model.js +1 -1
  62. package/workspace/public/pm/loose-props.css +54 -0
  63. package/workspace/public/pm/loose-props.js +262 -0
  64. package/workspace/public/pm/premium-board.js +9 -5
  65. package/workspace/public/pm/term-view.js +81 -10
  66. package/workspace/public/premium-board.html +1 -0
  67. package/workspace/server.js +135 -6
  68. package/workspace/skills/loose-propose.skill +39 -0
  69. package/workspace/task-milestones-test.js +15 -6
  70. package/workspace/test-lists/batch13-context-use.json +5 -0
  71. package/workspace/test-lists/board-deliveries.json +13 -0
  72. package/workspace/test-lists/calm-timeline.json +5 -0
  73. package/workspace/test-lists/loose-props.json +9 -0
  74. package/workspace/test-lists/milestone-pins.json +6 -0
  75. package/workspace/timeline-holds-test.js +44 -42
@@ -15,6 +15,7 @@ import { whenOf } from './home-list.js';
15
15
  import { chipHtml } from './cozy-pick.js'; // the one product picker Home, Board and Insights share (batch 12 item 5)
16
16
  import { ringHtml } from './home-line.js';
17
17
  import { gripHtml, sugHtml } from './prog-order.js'; // a program's order: the grip and ✦ (canvas RoADrag, RoAPhone)
18
+ import * as CW from './ctx-wedge.js'; // how full a session's context is: the pie, and Claude's ✦ Compact (batch 13 item 8, XctxA1Desk)
18
19
 
19
20
  export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
20
21
  export const P = {
@@ -57,14 +58,19 @@ const MS = '<span class="hv-ms" role="img" aria-label="Milestone" title="Milesto
57
58
  /** A row of the list: a next step, a task, a note, a mention, a session or a meeting. o: { sel, kid } */
58
59
  export function rowHtml(r, o) {
59
60
  const sel = o.sel === r.id;
60
- const cls = ['hm-r', 'hv-r', o.kid ? 'kid' : '', o.sub ? 'two' : '', sel ? 'sel' : '', 'st-' + (r.state || 'quiet'), r.kind === 'task' ? 'task' : '', r.kind === 'item' ? 'item' : '', r.done ? 'done' : ''].filter(Boolean).join(' ');
61
+ const cls = ['hm-r', 'hv-r', o.kid ? 'kid' : '', o.sub ? 'two' : '', o.safe ? 'safe' : '', sel ? 'sel' : '', 'st-' + (r.state || 'quiet'), r.kind === 'task' ? 'task' : '', r.kind === 'item' ? 'item' : '', r.done ? 'done' : ''].filter(Boolean).join(' ');
61
62
  const lead = isCheck(r) ? checkHtml(r) : '';
62
63
  // ending a session and putting a next step off stay on the row, shown on the row that is open (the frame draws neither)
63
64
  const end = !sel ? '' : r.kind === 'session' && r.sid ? `<button type="button" class="ut-ib hm-x" data-hm-end="${esc(r.id)}" aria-label="End ${esc(r.name)}" title="End this session">${svg(P.x, 14)}</button>`
64
65
  : r.kind === 'need' && r.row && r.row.kind !== 'source' ? `<button type="button" class="ut-ib hm-x" data-hm-end="${esc(r.id)}" aria-label="Put off ${esc(r.name)} until tomorrow" title="Put off until tomorrow">${svg(P.x, 14)}</button>` : '';
65
66
  const link = r.link && r.kind === 'loose-rec' ? '<span class="hv-st">Link it</span>' : '';
67
+ // a session's context (batch 13 item 8): the pie from 50%; in the pill's list, from 70% on the PM's turn, Claude's ✦ Compact and its ✓, drawn
68
+ // as item 7's ✦ close is. Safe to close (item 7) outranks it: one ✦ per row.
69
+ const cx = r.kind === 'session' ? r.ctx : null;
70
+ const offer = cx && o.sub ? CW.compactOffer(cx, !!(o.safe || (r.close && r.close.safe)), r.sid) : null;
71
+ const sv = o.safe || offer ? '<i class="hm-sv" aria-hidden="true">✦</i>' : '';
66
72
  return `<div class="${cls}" data-id="${esc(r.id)}">${lead}<button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"${sel ? ' aria-current="true"' : ''}${r.hint ? ` title="${esc(r.hint)}"` : ''}>${lead ? '' : markHtml(r)}`
67
- + `<span class="hm-rt${r.ms ? ' ms' : ''}"><b>${esc(r.name)}</b>${r.ms ? MS : ''}${o.sub ? `<em>${esc(o.sub)}</em>` : ''}</span>${o.sub ? '' : clock(r.when || whenOf(r))}${link}</button>${end}</div>`;
73
+ + `<span class="hm-rt${r.ms ? ' ms' : ''}"><b>${esc(r.name)}</b>${r.ms ? MS : ''}${o.sub ? `<em>${sv}${esc(offer || o.sub)}</em>` : ''}</span>${o.sub ? '' : clock(r.when || whenOf(r))}${CW.wedgeHtml(cx)}${link}</button>${end}${offer ? CW.compactBtnHtml(r.sid, cx.pct) : o.act || ''}</div>`;
68
74
  }
69
75
  /** The chat's header line on a desktop (HvACDesk .ch): the open row's mark, its title and the chip of where it sits (the initiative's stage
70
76
  * track and name, or the program's tile and name). h: { row, title, scope, at, stage, prog }. A chip that repeats the title is left out, and
@@ -78,7 +84,7 @@ export function chatHeadHtml(h) {
78
84
  const chip = same ? '' : `<span class="hm-chs" title="In ${esc(h.scope)}">${h.prog ? svg(P.layers, 13) : track(h.at == null ? -1 : h.at, h.stage || '', h.steps)}<span>${esc(h.scope)}</span></span>`;
79
85
  // session names A: an open session's name comes as the rename press (or the field), drawn by home-ses-name.js
80
86
  const name = h.titleHtml ? `<span class="hm-chn">${h.titleHtml}</span>` : `<b class="hm-chb">${esc(h.title)}</b>`;
81
- return `${mk}${same ? lead : ''}${name}${same && !h.prog ? track(h.at == null ? -1 : h.at, h.stage || '', h.steps) : ''}${chip}`;
87
+ return `${mk}${same ? lead : ''}${name}${same && !h.prog ? track(h.at == null ? -1 : h.at, h.stage || '', h.steps) : ''}${chip}${CW.wedgeHtml(h.ctx || (r && r.kind === 'session' ? r.ctx : null))}`;
82
88
  }
83
89
  /* ── what sits in an initiative: the pill on its row (batch 12 item 6, canvas HsA1Desk, HsA2Phone, HsA3Sheet) ──
84
90
  * Sessions, next steps and today's meetings no longer nest under the initiative (Wawan, 2026-10-26: Home grew too long). The row keeps one
@@ -86,14 +92,20 @@ export function chatHeadHtml(h) {
86
92
  * when one is blocked, a ring when one runs, a clock for a meeting today, else a grey dot. A press lists them right under the pill (a sheet on
87
93
  * a phone), each with its mark and one quiet line; a press on one opens it as the nested row did; + starts a new session in the initiative. */
88
94
  const RANKED = ['needs', 'blocked', 'working', 'meeting', 'quiet'];
89
- const kidState = (k) => (k.kind === 'meeting' && k.state !== 'working' ? 'meeting' : k.step ? 'needs' : RANKED.includes(k.state) ? k.state : 'quiet');
95
+ const kidState = (k) => (k.kind === 'meeting' && k.state !== 'working' ? 'meeting' : k.step || (k.kind === 'item' && k.late) ? 'needs' : RANKED.includes(k.state) ? k.state : 'quiet');
90
96
  const KID_WORD = { needs: 'Asks you', blocked: 'Blocked, asks you', working: 'Running', quiet: 'Open' };
91
97
  /** The quiet line under one row of the list: what it is and where it stands, in words (the mark says it again by shape). */
92
98
  export function kidSub(k) {
93
99
  if (k.kind === 'meeting') return k.hint || 'Meeting';
94
100
  if (k.step) return k.hint || 'Next step';
101
+ if (k.kind === 'session' && k.close) return k.close.say; // idle: why it is safe to close, or what holds it (batch 13 item 7)
95
102
  return [KID_WORD[kidState(k)] || 'Open', k.kind === 'session' && k.hint ? k.hint : ''].filter(Boolean).join(' · ');
96
103
  }
104
+ /** What Claude proposes on one row of the list (canvas XcsA1Pill): a session idle and safe to close gets the ✦ in its line and one ✓. One ✦ a row. */
105
+ export function kidActHtml(k) {
106
+ if (!(k && k.kind === 'session' && k.close && k.close.safe && k.sid)) return '';
107
+ return `<button type="button" class="ut-ib hv-ib hm-cls" data-hm-close="${esc(k.sid)}" aria-label="Close this session; Claude says it is idle and safe" title="Close this session; Claude says it is idle and safe">${svg(P.check, 16)}</button>`;
108
+ }
97
109
  /** The pill's model: the most urgent state, the count and its accessible words. Nothing in the initiative: null (zero is silence). */
98
110
  export function pillOf(r) {
99
111
  const kids = (r && r.kids) || [];
@@ -116,7 +128,7 @@ function pillHtml(r, o) {
116
128
  /** The list behind the pill: the rows that used to nest, waiting first, then + for a new session here. */
117
129
  function sesListHtml(r, o) {
118
130
  const kids = r.kids.slice().sort((a, b) => RANKED.indexOf(kidState(a)) - RANKED.indexOf(kidState(b)));
119
- return kids.map((k) => rowHtml(k, { ...o, kid: false, sub: kidSub(k) })).join('')
131
+ return kids.map((k) => rowHtml(k, { ...o, kid: false, sub: kidSub(k), act: kidActHtml(k), safe: !!(k.close && k.close.safe) })).join('')
120
132
  + `<div class="hv-spf"><button type="button" class="ut-ib hv-ib" data-hm-sesnew="${esc(r.ini || '')}" aria-label="New session in ${esc(r.name)}" title="New session here">${svg(P.plus, 18)}</button></div>`;
121
133
  }
122
134
  /** On a phone the list is a sheet over Home (as Your day was): the initiative's name and stage track on top. M is homeList(). */
@@ -190,10 +202,14 @@ function looseHtml(g, o) {
190
202
  const open = o.pOpen(g), S2 = g.sig || {};
191
203
  const say = [S2.sessions ? plural(S2.sessions, 'session', 'sessions') + (S2.needs ? ', ' + S2.needs + ' waits on you' : '') : S2.needs ? S2.needs + ' waits on you' : '', S2.tasks ? plural(S2.tasks, 'task', 'tasks') + (S2.late ? ', ' + S2.late + ' late' : '') : ''].filter(Boolean).join('; ') || String(g.n);
192
204
  const sig = open ? '' : (S2.needs ? '<span class="hv-d sm" aria-hidden="true"></span>' : '') + (S2.late ? '<span class="hv-lt" aria-hidden="true"></span>' : '') + g.n;
193
- return `<section class="hm-pg hv-g loose" aria-label="${esc(g.name)}"><button type="button" class="hv-lh" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(g.name)}: ${esc(say)}. ${open ? 'Close' : 'Open'}">${esc(g.name)}<span class="n">${sig}${svg(open ? P.chevD : P.chevR, 15)}</span></button>`
205
+ // the blue ✦ and the number of rows Claude proposes to place (batch 13 item 3, XlcA1Desk): only when it has some (zero is silence)
206
+ const c = g.chip && g.chip.n ? g.chip : null;
207
+ const chip = c ? `<button type="button" class="lp-chip" data-lp-open aria-haspopup="dialog" aria-label="${esc(c.label)}" title="Claude proposes a clean-up">${svg(SPARK, 13)}<b>${c.n}</b></button>` : '';
208
+ return `<section class="hm-pg hv-g loose" aria-label="${esc(g.name)}"><div class="hv-lhw${chip ? ' has-chip' : ''}"><button type="button" class="hv-lh" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(g.name)}: ${esc(say)}. ${open ? 'Close' : 'Open'}">${esc(g.name)}<span class="n"><span class="nl">${sig}</span>${svg(open ? P.chevD : P.chevR, 15)}</span></button>${chip}</div>`
194
209
  + (open ? `<div class="hv-card">${g.rows.map((r) => rowHtml(r, o)).join('')}</div>` : '') + '</section>';
195
210
  }
196
211
  const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many);
212
+ const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z';
197
213
 
198
214
  /* ── the Today card ── */
199
215
  /** The other meetings on now or close (T.also): one quiet line each under the card's buttons, with icon-only Open and Record. Each press
@@ -212,7 +212,10 @@ export function timelineHtml(v, o, isOpen) {
212
212
  for (const t of tk) h += row(`${tkMark(t)}${tkTitle(t)}`, '', ' k');
213
213
  for (const k of jr) h += row(`${jmark(k)}${ttitle(k)}`, jbar(k), ' k');
214
214
  for (const x of rs) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k');
215
- if (dn_.length) {
215
+ // a stage with nothing open lists its done tasks straight away, as the List does: no "Done" fold inside the stage's own fold
216
+ // (PM, 2026-10-27: "Grouping 'Done' items is confusing")
217
+ if (dn_.length && !rs.length && !jr.length && !tk.length) for (const x of dn_) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k x' + (x.wont ? ' wo' : ''));
218
+ else if (dn_.length) {
216
219
  const dk = (sec.key || 'none') + ':done', dop = isOpen(dk, false);
217
220
  h += row(`<button type="button" class="ivt-df" data-iv-fold="${esc(dk)}" aria-expanded="${dop}">Done<span class="n">${dn_.length}</span><span class="iv-cv" aria-hidden="true">${SVG(dop ? P.down : P.right, 14, 2)}</span></button>`, dop ? '' : dn_.map(barOf).join(''), ' k');
218
221
  if (dop) for (const x of dn_) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k x' + (x.wont ? ' wo' : ''));
@@ -72,7 +72,7 @@ export function liveItems(sessions, o = {}) {
72
72
  const at = ms(s.touched_at) || ms(s.created);
73
73
  const ini = iniOf(s);
74
74
  rows.push({ id: 's:' + s.id, kind: 'ses', sid: s.id, mark, name: nameOf(s), sub: mark === 'stop' ? 'Stopped · restart it' : ini ? titles[ini] || ini : 'Not in an initiative',
75
- at, time: ago(now - at), href: '/premium.html?session=' + encodeURIComponent(s.id), open: !!o.open && o.open === s.id });
75
+ at, time: ago(now - at), href: '/premium.html?session=' + encodeURIComponent(s.id), open: !!o.open && o.open === s.id, ctx: s.ctx || null });
76
76
  }
77
77
  rows.sort((a, b) => b.at - a.at || (a.id < b.id ? -1 : 1));
78
78
  return out.concat(rows).slice(0, max);
@@ -0,0 +1,54 @@
1
+ /* pm/loose-props.css — Claude's clean-up of Home's "Not in an initiative" (batch 13 item 3; canvas XlcA1Desk, XlcA3Sheet, XlcA4Pick).
2
+ * Every class here starts with lp-. The ✦ on the group's header, then the Viewer's body. Colours are the cozy tokens, so dark mode follows. */
3
+ .hv-lhw { position: relative; }
4
+ .hv-lhw.has-chip .hv-lh .nl { margin-right: 64px; }
5
+ .hv-lhw.has-chip .hv-lh .nl:empty { margin-right: 58px; }
6
+ .lp-chip { position: absolute; right: 34px; top: calc(50% + 6px); transform: translateY(-50%); display: inline-flex; align-items: center; gap: 3px; height: 26px; padding: 0 9px 0 7px; border-radius: 999px; border: 1.5px solid var(--cz-blue); background: var(--cz-card); color: var(--cz-blueink); font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; }
7
+ .lp-chip:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
8
+ @media (hover: hover) { .lp-chip:hover { background: var(--cz-bluebg); } }
9
+ @media (max-width: 760px) { .lp-chip { height: 32px; } .lp-chip::after { content: ''; position: absolute; inset: -6px; } }
10
+
11
+ .lp { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 24px; }
12
+ .lp-intro { margin: 2px 0 4px; font-size: 13.5px; line-height: 1.5; color: var(--cz-ink2); max-width: 600px; }
13
+ .lp-sec h4 { margin: 8px 0 2px; font-size: 12.5px; font-weight: 700; color: var(--cz-ink3); }
14
+ .lp-p { padding: 4px 0; }
15
+ .lp-ph { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; }
16
+ .lp-ph .w, .lp-r .w, .lp-hr .w { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
17
+ .lp-ph b { font-size: 14px; font-weight: 800; color: var(--cz-ink); }
18
+ .lp-ph small, .lp-r small, .lp-hr small { font-size: 12.5px; color: var(--cz-ink2); line-height: 1.4; display: inline-flex; align-items: center; gap: 4px; }
19
+ .lp-ic { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-blueink); flex: none; margin-top: 1px; }
20
+ .lp-ib { all: unset; box-sizing: border-box; cursor: pointer; width: 32px; height: 32px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink2); flex: none; }
21
+ .lp-ib.ok { color: var(--cz-blueink); }
22
+ .lp-ib:focus-visible, .lp-tile:focus-visible, .lp-more:focus-visible, .lp-pick button:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
23
+ .lp-ib:disabled { opacity: .45; cursor: default; }
24
+ @media (hover: hover) { .lp-ib:hover { background: var(--cz-well); color: var(--cz-ink); } }
25
+ .lp-rows { display: flex; flex-direction: column; margin: 2px 0 6px 12px; padding-left: 22px; border-left: 2px solid var(--cz-hair); }
26
+ .lp-r { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 3px 0; }
27
+ .lp-r b { font-size: 13.5px; font-weight: 600; color: var(--cz-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
28
+ .lp-r.out b { text-decoration: line-through; color: var(--cz-ink3); }
29
+ .lp-mk { width: 16px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink3); margin-left: -4px; }
30
+ .lp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cz-blue); display: inline-block; }
31
+ .lp-late { width: 9px; height: 9px; border-radius: 2px; background: var(--cz-risk); display: inline-block; }
32
+ .lp-tile { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 6px 0 8px; border-radius: 999px; background: var(--cz-well); color: var(--cz-blueink); flex: none; }
33
+ .lp-tile b { font-size: 10.5px; font-weight: 800; letter-spacing: .02em; }
34
+ .lp-tile.on { box-shadow: 0 0 0 1.5px var(--cz-blue); background: var(--cz-card); }
35
+ .lp-tile.moved { background: var(--cz-bluebg); }
36
+ .lp-more { all: unset; box-sizing: border-box; cursor: pointer; min-height: 36px; padding: 6px 0; font-size: 12.5px; font-weight: 700; color: var(--cz-blueink); }
37
+ .lp-pick { align-self: flex-end; margin: 0 0 6px; width: min(330px, 100%); background: var(--cz-card); border-radius: 18px; box-shadow: 0 24px 60px -24px rgba(42,46,53,.45), 0 0 0 1px var(--cz-hair); padding: 6px; display: flex; flex-direction: column; }
38
+ .lp-pick p { margin: 8px 10px 4px; font-size: 12px; font-weight: 700; color: var(--cz-ink3); }
39
+ .lp-pick button { all: unset; box-sizing: border-box; cursor: pointer; min-height: 44px; padding: 6px 10px; border-radius: 12px; display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; color: var(--cz-ink); }
40
+ .lp-pick button .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
41
+ .lp-pick button[aria-checked="true"] { background: var(--cz-well); }
42
+ .lp-pick button[aria-checked="true"] svg { color: var(--cz-blueink); }
43
+ .lp-pick button.nw { color: var(--cz-ink2); font-weight: 600; }
44
+ @media (hover: hover) { .lp-pick button:hover { background: var(--cz-well); } }
45
+ .lp-tl { width: 26px; height: 26px; border-radius: 8px; background: var(--cz-bluebg); color: var(--cz-blueink); display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 800; flex: none; }
46
+ .lp-pick .nw .lp-tl { background: none; color: var(--cz-ink3); }
47
+ .lp-hist { margin-top: 8px; border-top: 1px solid var(--cz-hair); padding-top: 6px; }
48
+ .lp-hist summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--cz-ink3); list-style: none; }
49
+ .lp-hist summary::-webkit-details-marker { display: none; }
50
+ .lp-hist summary:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; border-radius: 8px; }
51
+ .lp-hr { display: flex; align-items: center; gap: 8px; min-height: 44px; }
52
+ .lp-hr b { font-size: 13px; font-weight: 700; color: var(--cz-ink); }
53
+ .lp-hr.undone b { color: var(--cz-ink3); }
54
+ @media (max-width: 760px) { .lp { padding: 0 12px 24px; } .lp-ib { width: 40px; height: 40px; } .lp-rows { margin-left: 4px; padding-left: 12px; } }
@@ -0,0 +1,262 @@
1
+ /* pm/loose-props.js — Claude's clean-up of Home's "Not in an initiative" (feedback batch 13 item 3, option A; canvas In development, XlcA1Desk,
2
+ * XlcA2After, XlcA3Sheet, XlcA4Pick, and the twelve rules of XlcA0Grill). The fold and the routes are lib/loose-proposals.js and
3
+ * lib/routes-loose.js; the rows the server reads are pm/home-list.js looseSnapshot. Nothing is written before the PM's ✓.
4
+ *
5
+ * sync(M, D, H) after each read of Home: sends what the group shows (only when it changed) and keeps what Claude proposes; H.redraw()
6
+ * when the ✦ changes
7
+ * chipOf() → the ✦ on the group's header: { n, label } | null (hidden at 0: zero is silence)
8
+ * open(H) the ✦'s press: "Claude proposes N" in the Viewer. Groups Link, Tidy and Start an initiative, each proposal with ⌄, ✓ and ✕;
9
+ * a Link row's tile changes its initiative (Claude's pick first, then the PM's initiatives, last "+ New initiative from this
10
+ * row"); ✕ on a row leaves it out (struck, with Undo). ✓ in the header approves every row not left out. An open proposal
11
+ * shows 5 rows, then "+N more". After the first approval a History fold lists each one with its own Undo.
12
+ * closeOne(H, sid) the Home pill menu's ✓ on a session that is idle and safe to close (item 7)
13
+ * The host gives H.toast(text, undo?), H.reload(), H.where() → { ws, board } (the product a new initiative starts in), H.total() → the rows
14
+ * the group shows, H.today() → YYYY-MM-DD. */
15
+ import { pmGet, pmPost } from './http.js';
16
+ import { looseSnapshot } from './home-list.js';
17
+
18
+ const CSS = new URL('./loose-props.css', import.meta.url).href;
19
+ if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
20
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
21
+ }
22
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
23
+ 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>`;
24
+ export const I = {
25
+ spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z',
26
+ check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', down: 'M6 9l6 6 6-6', up: 'M6 15l6-6 6 6', undo: 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3',
27
+ link: 'M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1',
28
+ merge: 'M8 8h11v11H8zM5 16V5h11', done: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M8 12l3 3 5-6', away: 'M4 5h16v4H4zM5 9v10h14V9M10 13h4',
29
+ start: 'M12 5v14M5 12h14', clock: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 7v5l3 2', repeat: 'M17 2l3 3-3 3M4 11V9a4 4 0 0 1 4-4h12M7 22l-3-3 3-3M20 13v2a4 4 0 0 1-4 4H4',
30
+ chev: 'M7 10l5 5 5-5', plus: 'M12 5v14M5 12h14', power: 'M12 3v8M6.3 6.3a8 8 0 1 0 11.4 0',
31
+ };
32
+ const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
33
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
34
+ const md = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? MON[+m[2] - 1] + ' ' + +m[3] : ''; };
35
+ const ago = (iso, today) => {
36
+ const a = Date.parse(String(iso || '').slice(0, 10) + 'T00:00:00Z'), b = Date.parse(String(today || '').slice(0, 10) + 'T00:00:00Z');
37
+ if (!Number.isFinite(a) || !Number.isFinite(b)) return '';
38
+ const n = Math.max(0, Math.round((b - a) / 864e5));
39
+ return n === 0 ? 'today' : n + ' d ago';
40
+ };
41
+ /** Two letters for an initiative's tile ("IDPF data fixes" → ID, "Tender new CIAM" → TC). */
42
+ export const tileOf = (title) => { const w = String(title || '').trim().split(/[\s_-]+/).filter(Boolean); return (w.length > 1 && w[0].length < 4 ? w[0][0] + w[1][0] : String(w[0] || '?').slice(0, 2)).toUpperCase(); };
43
+ const SHOW = 5; // an open proposal shows 5 rows, then "+N more" (the grill's legacy pile)
44
+
45
+ const S = { props: null, history: [], inis: [], sig: '', H: null, open: new Set(), more: new Set(), out: new Set(), choices: {}, pick: null, busy: false };
46
+
47
+ /* ── reading and the ✦ ── */
48
+ const sigOf = (t) => { let h = 5381; for (let i = 0; i < t.length; i++) h = ((h * 33) ^ t.charCodeAt(i)) >>> 0; return h.toString(36); };
49
+ export async function sync(M, D, H) {
50
+ S.H = H;
51
+ const raw = looseSnapshot(M, D);
52
+ // to the day: a live chat's last output moves every few seconds, and idle is counted in days, so a new minute is not a change to send
53
+ const snap = { ...raw, rows: raw.rows.map((r) => ({ ...r, at: String(r.at || '').slice(0, 10) })) };
54
+ S.inis = snap.inis;
55
+ const sig = sigOf(JSON.stringify(snap));
56
+ const today = H.today ? H.today() : '';
57
+ // the page reads first, and sends what it shows only when the server holds something else: opening Home writes nothing new
58
+ let r = await pmGet('/api/loose-props?today=' + encodeURIComponent(today)).catch(() => null);
59
+ if (!r || r.ok === false) return;
60
+ if ((r.sig || '') !== sig && (snap.rows.length || r.sig)) r = await pmPost('/api/loose-props/rows', { ...snap, sig, today }).catch(() => null);
61
+ if (!r || r.ok === false) return;
62
+ const was = JSON.stringify(chipOf());
63
+ S.props = r.props || null; S.history = r.history || [];
64
+ if (JSON.stringify(chipOf()) !== was && H.redraw) H.redraw();
65
+ if (isShown()) draw();
66
+ }
67
+ export function chipOf() {
68
+ const p = S.props;
69
+ if (!p || !p.n) return null;
70
+ return { n: p.n, label: 'Claude proposes a clean-up of ' + plural(p.n, 'row', 'rows') + '. Open' };
71
+ }
72
+
73
+ /* ── the Viewer ── */
74
+ const VW = () => (typeof window !== 'undefined' ? window.czViewer : null);
75
+ const isShown = () => { const v = VW(), c = v && v.current(); return !!(c && c.id === 'lp'); };
76
+ const ib = (attr, label, icon, cls = '') => `<button type="button" class="lp-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(icon, 16, 2.2)}</button>`;
77
+ const iconOf = (p) => ({ ini: I.link, merge: I.merge, finish: I.done, close: I.power, away: I.away, new: I.start }[p.type] || I.link);
78
+ function titleOf(p) {
79
+ const n = p.rows.filter((x) => !S.out.has(x.row)).length;
80
+ if (p.type === 'ini') return 'Link ' + n + ' to ' + (p.data.title || p.data.ini);
81
+ if (p.type === 'merge') return 'Merge ' + plural(n, 'double', 'doubles');
82
+ if (p.type === 'finish') return 'Finish ' + plural(n, 'chat that is done', 'chats that are done');
83
+ if (p.type === 'away') return 'Put away ' + plural(n, 'idle chat', 'idle chats');
84
+ if (p.type === 'close') return 'Close ' + plural(n, 'idle session that is safe', 'idle sessions that are safe');
85
+ return 'Start “' + (p.data.title || 'a new initiative') + '” from ' + n;
86
+ }
87
+ function whyOf(p) {
88
+ if (p.type === 'merge' && p.into) return 'Your item “' + p.into.title + '” stays; the chat with the same name joins it. ' + (p.why && !/^Your item stays/.test(p.why) ? p.why : '');
89
+ if (p.type === 'new') return (p.why ? p.why + ' ' : '') + 'It starts in the first stage of your board.';
90
+ return p.why || '';
91
+ }
92
+ /** The quiet line under a row: what it is, and why it is here. */
93
+ function metaOf(p, x) {
94
+ const today = S.H && S.H.today ? S.H.today() : '';
95
+ if (p.type === 'finish') return md(x.quoteAt) + ': “' + x.quote + '”';
96
+ if (p.type === 'away') return 'Last message ' + (ago(x.at, today) || 'long ago');
97
+ if (p.type === 'close') return [x.ini ? (iniById(x.ini) || {}).title || '' : 'Not in an initiative', x.say].filter(Boolean).join(' · ');
98
+ if (x.kind === 'meeting') return (x.daily || 'Meeting') + ' · links every one from today';
99
+ return [x.kind === 'item' ? 'Your item' : 'Chat', ago(x.at, today), x.waits ? 'waits on you' : '', x.late ? 'late' : ''].filter(Boolean).join(' · ');
100
+ }
101
+ const iniById = (id) => S.inis.find((i) => i.id === id) || null;
102
+ function tileHtml(p, x) {
103
+ if (p.type !== 'ini' && p.type !== 'new') return '';
104
+ const c = S.choices[x.row];
105
+ const title = c ? (c.new ? 'New: ' + x.title : (iniById(c.ini) || {}).title || c.ini) : p.type === 'ini' ? p.data.title || p.data.ini : p.data.title;
106
+ const t = c && c.new ? '+' : tileOf(title);
107
+ const on = S.pick === x.row;
108
+ return `<button type="button" class="lp-tile${c ? ' moved' : ''}${on ? ' on' : ''}" data-lp-tile="${esc(x.row)}" data-lp-p="${esc(p.id)}" aria-haspopup="menu" aria-expanded="${on}" aria-label="${esc('Goes to ' + title + '. Choose another')}" title="${esc(title)}"><b>${esc(t)}</b>${SVG(I.chev, 12, 2.4)}</button>`;
109
+ }
110
+ function rowHtml(p, x) {
111
+ const out = S.out.has(x.row);
112
+ const lead = x.kind === 'meeting' ? `<span class="lp-mk">${SVG(I.clock, 15)}</span>` : x.waits ? '<span class="lp-mk"><i class="lp-dot" role="img" aria-label="Waits on you"></i></span>' : x.late ? '<span class="lp-mk"><i class="lp-late" role="img" aria-label="Late"></i></span>' : '<span class="lp-mk"></span>';
113
+ const meta = out ? 'Left out by you' : metaOf(p, x);
114
+ const act = out ? ib(`data-lp-back="${esc(x.row)}" data-lp-scope="${esc(p.scope)}"`, 'Undo: put it back', I.undo) : ib(`data-lp-out="${esc(x.row)}" data-lp-scope="${esc(p.scope)}"`, 'Leave this one out', I.x);
115
+ return `<div class="lp-r${out ? ' out' : ''}">${lead}<span class="w"><b>${esc(x.title)}</b><small>${x.kind === 'meeting' && x.daily && !out ? SVG(I.repeat, 12, 2) : ''}${esc(meta)}</small></span>${out ? '' : tileHtml(p, x)}${act}</div>`
116
+ + (S.pick === x.row ? pickHtml(p, x) : '');
117
+ }
118
+ /** The picker right under a tile (XlcA4Pick): Claude's pick first, then the PM's initiatives, last a new initiative from this row. */
119
+ function pickHtml(p, x) {
120
+ const c = S.choices[x.row], cur = c ? (c.new ? 'new' : c.ini) : p.type === 'ini' ? p.data.ini : 'start';
121
+ const opt = (id, title, attr, mark) => `<button type="button" role="menuitemradio" aria-checked="${cur === id}" ${attr}><span class="lp-tl">${mark || esc(tileOf(title))}</span><span class="t">${esc(title)}</span>${cur === id ? SVG(I.check, 15, 2.4) : ''}</button>`;
122
+ const first = p.type === 'ini' ? opt(p.data.ini, p.data.title || p.data.ini, `data-lp-to="${esc(p.data.ini)}"`) : opt('start', p.data.title, 'data-lp-to=""');
123
+ const rest = S.inis.filter((i) => i.id !== (p.type === 'ini' ? p.data.ini : '')).map((i) => opt(i.id, i.title, `data-lp-to="${esc(i.id)}"`)).join('');
124
+ return `<div class="lp-pick" role="menu" data-esc-layer aria-label="Where ${esc(x.title)} goes"><p>Claude’s pick</p>${first}${rest ? '<p>Your initiatives</p>' + rest : ''}`
125
+ + `<button type="button" role="menuitemradio" aria-checked="${cur === 'new'}" data-lp-to="+new" class="nw"><span class="lp-tl">${SVG(I.plus, 14, 2.2)}</span><span class="t">New initiative from this row</span></button></div>`;
126
+ }
127
+ function propHtml(p) {
128
+ const op = S.open.has(p.id), all = S.more.has(p.id), rows = all ? p.rows : p.rows.slice(0, SHOW), left = p.rows.length - rows.length;
129
+ return `<div class="lp-p" data-lp="${esc(p.id)}"><div class="lp-ph"><span class="lp-ic">${SVG(iconOf(p), 17)}</span><span class="w"><b>${esc(titleOf(p))}</b>${whyOf(p) ? `<small>${esc(whyOf(p))}</small>` : ''}</span>`
130
+ + ib(`data-lp-fold="${esc(p.id)}" aria-expanded="${op}"`, op ? 'Hide the rows' : 'Show the rows', op ? I.up : I.down)
131
+ + ib(`data-lp-keep="${esc(p.id)}"`, 'Approve', I.check, 'ok') + ib(`data-lp-drop="${esc(p.id)}"`, 'Drop it', I.x) + '</div>'
132
+ + (op ? `<div class="lp-rows">${rows.map((x) => rowHtml(p, x)).join('')}${left > 0 ? `<button type="button" class="lp-more" data-lp-more="${esc(p.id)}">+${left} more</button>` : ''}</div>` : '')
133
+ + '</div>';
134
+ }
135
+ const SECTION = { link: 'Link', tidy: 'Tidy', start: 'Start an initiative' };
136
+ function histHtml() {
137
+ const h = S.history || [];
138
+ if (!h.length) return '';
139
+ const when = (iso) => { const d = new Date(iso); return Number.isNaN(d.getTime()) ? '' : md(iso.slice(0, 10)) + ' ' + String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0'); };
140
+ return `<details class="lp-hist"><summary>History</summary>${h.map((x) => `<div class="lp-hr${x.undone ? ' undone' : ''}"><span class="w"><b>${esc(x.said || plural(x.n, 'row placed', 'rows placed'))}</b><small>${esc(when(x.at))}${x.undone ? ' · undone' : ''}</small></span>`
141
+ + (x.undone ? '' : ib(`data-lp-undo="${esc(x.batch)}"`, 'Undo this approval', I.undo)) + '</div>').join('')}</details>`;
142
+ }
143
+ function bodyHtml() {
144
+ const P = S.props;
145
+ if (!P || !P.n) return `<div class="lp">${P && P.looking ? '<p class="lp-intro">Claude is looking at the rows now. Its proposals show here.</p>' : '<p class="lp-intro">Nothing to clean up now.</p>'}${histHtml()}</div>`;
146
+ const total = Math.max(S.H && S.H.total ? S.H.total() : 0, P.total || 0, P.n), rest = total - P.n;
147
+ const intro = plural(total, 'row sits', 'rows sit') + ' outside an initiative. ' + (rest > 0 ? 'I can place ' + P.n + '; the other ' + rest + ' stay where they are.' : 'I can place ' + (P.n === 1 ? 'it' : 'all ' + P.n) + '.') + ' The tick at the top approves all.';
148
+ const secs = P.groups.map((g) => `<section class="lp-sec" aria-label="${esc(SECTION[g.group])}"><h4>${esc(SECTION[g.group])}</h4>${g.props.map(propHtml).join('')}</section>`).join('');
149
+ return `<div class="lp"><p class="lp-intro">${esc(intro)}</p>${secs}${histHtml()}</div>`;
150
+ }
151
+ const presses = () => (S.props && S.props.n ? [{ act: 'all', label: 'Approve all ' + S.props.n, icon: I.check, solid: true }] : []);
152
+ function draw() {
153
+ const v = VW(), b = v && v.body(), c = v && v.current();
154
+ if (!b || !c || c.id !== 'lp') return;
155
+ const top = b.scrollTop, hist = b.querySelector('.lp-hist'), histOpen = !!(hist && hist.open);
156
+ b.innerHTML = bodyHtml();
157
+ b.scrollTop = top;
158
+ if (histOpen) { const h = b.querySelector('.lp-hist'); if (h) h.open = true; }
159
+ v.setPresses(c.id, presses());
160
+ const t = 'Claude proposes' + (S.props && S.props.n ? ' ' + S.props.n : '');
161
+ if (c.title !== t && v.retitle) v.retitle(c.id, t);
162
+ }
163
+ const say = (m, undo) => { if (S.H && S.H.toast) S.H.toast(m, undo); };
164
+ async function after(r) {
165
+ if (r && r.props !== undefined) { S.props = r.props || null; S.history = r.history || S.history; }
166
+ draw();
167
+ if (S.H && S.H.reload) await Promise.resolve(S.H.reload()).catch(() => {});
168
+ }
169
+ async function keep(ids, all) {
170
+ if (S.busy) return;
171
+ S.busy = true;
172
+ const at = S.H && S.H.where ? S.H.where() : null, today = S.H && S.H.today ? S.H.today() : undefined;
173
+ const res = await pmPost('/api/loose-props/keep', { ...(all ? { all: true } : { ids }), out: [...S.out], choices: S.choices, ...(at ? { where: at } : {}), today }).catch(() => null);
174
+ S.busy = false;
175
+ if (!res || res.ok === false) { say((res && res.error) || 'Nothing was placed.'); return; }
176
+ S.choices = {}; S.pick = null;
177
+ const batch = res.batch;
178
+ say(res.said + (res.warn ? '. ' + res.warn : ''), async () => {
179
+ const u = await pmPost('/api/loose-props/undo', { batch, today }).catch(() => null);
180
+ if (!u || u.ok === false) return { ok: false, error: (u && u.error) || 'The undo did not land.' };
181
+ if (u.kept) say(plural(u.kept, 'change was', 'changes were') + ' kept: a started initiative stays on the Board.');
182
+ await after(u);
183
+ return { ok: true };
184
+ });
185
+ await after(res);
186
+ if (!S.props || !S.props.n) { const v = VW(); if (v && isShown()) v.close(); }
187
+ }
188
+ /** The pill menu's ✓ on one session (batch 13 item 7, canvas XcsA1Pill): closes it if it is still idle and safe; the toast has Undo. */
189
+ export async function closeOne(H, sid) {
190
+ S.H = H;
191
+ const today = H && H.today ? H.today() : undefined;
192
+ const res = await pmPost('/api/loose-props/close', { sid, today }).catch(() => null);
193
+ if (!res || res.ok === false) { say((res && res.error) || 'The session was not closed.'); if (H && H.reload) await Promise.resolve(H.reload()).catch(() => {}); return; }
194
+ const batch = res.batch;
195
+ say(res.said, async () => {
196
+ const u = await pmPost('/api/loose-props/undo', { batch, today }).catch(() => null);
197
+ if (!u || u.ok === false) return { ok: false, error: (u && u.error) || 'The undo did not land.' };
198
+ await after(u);
199
+ return { ok: true };
200
+ });
201
+ await after(res);
202
+ }
203
+ async function onPress(e) {
204
+ const b = e.target.closest('button'); if (!b) { if (S.pick && !e.target.closest('.lp-pick')) { S.pick = null; draw(); } return; }
205
+ const d = b.dataset;
206
+ if (d.lpFold) { if (S.open.has(d.lpFold)) S.open.delete(d.lpFold); else S.open.add(d.lpFold); draw(); return; }
207
+ if (d.lpMore) { S.more.add(d.lpMore); draw(); return; }
208
+ if (d.lpTile) { S.pick = S.pick === d.lpTile ? null : d.lpTile; draw(); const m = VW().body().querySelector('.lp-pick [aria-checked="true"]') || VW().body().querySelector('.lp-pick button'); if (m) m.focus(); return; }
209
+ if ('lpTo' in d) {
210
+ const row = S.pick, p = (S.props.groups || []).flatMap((g) => g.props).find((x) => x.rows.some((y) => y.row === row));
211
+ if (row && p) {
212
+ const v = d.lpTo;
213
+ if (v === '+new') { const at = S.H && S.H.where ? S.H.where() : {}; const own = iniById(p.data.ini) || {}; S.choices[row] = { new: true, ws: own.ws || at.ws, board: own.board || at.board, anchor: own.anchor || '' }; }
214
+ else if (!v || (p.type === 'ini' && v === p.data.ini)) delete S.choices[row];
215
+ else { const i = iniById(v) || { id: v }; S.choices[row] = { ini: i.id, title: i.title, ...(i.ws ? { ws: i.ws } : {}) }; }
216
+ }
217
+ S.pick = null; draw(); return;
218
+ }
219
+ if (d.lpKeep) { await keep([d.lpKeep], false); return; }
220
+ if (d.lpDrop) {
221
+ const p = (S.props.groups || []).flatMap((g) => g.props).find((x) => x.id === d.lpDrop); if (!p) return;
222
+ b.disabled = true;
223
+ const r = await pmPost('/api/loose-props/drop', { scope: p.scope, rows: p.rows.map((x) => x.row) }).catch(() => null);
224
+ if (!r || r.ok === false) { b.disabled = false; say((r && r.error) || 'Nothing was changed.'); return; }
225
+ await refresh(); return;
226
+ }
227
+ if (d.lpOut || d.lpBack) {
228
+ const row = d.lpOut || d.lpBack, back = !!d.lpBack;
229
+ b.disabled = true;
230
+ const r = await pmPost('/api/loose-props/' + (back ? 'undrop' : 'drop'), { scope: d.lpScope, rows: [row] }).catch(() => null);
231
+ if (!r || r.ok === false) { b.disabled = false; say((r && r.error) || 'Nothing was changed.'); return; }
232
+ // the row stays drawn, struck, until the Viewer closes: Undo puts it back (XlcA1Desk)
233
+ if (back) S.out.delete(row); else { S.out.add(row); delete S.choices[row]; }
234
+ draw(); return;
235
+ }
236
+ if (d.lpUndo) {
237
+ b.disabled = true;
238
+ const r = await pmPost('/api/loose-props/undo', { batch: d.lpUndo, today: S.H && S.H.today ? S.H.today() : undefined }).catch(() => null);
239
+ if (!r || r.ok === false) { b.disabled = false; say((r && r.error) || 'The undo did not land.'); return; }
240
+ say(r.kept ? 'Undone. ' + plural(r.kept, 'change was', 'changes were') + ' kept: a started initiative stays on the Board.' : 'Undone.');
241
+ await after(r);
242
+ }
243
+ }
244
+ async function refresh() {
245
+ const r = await pmGet('/api/loose-props?today=' + encodeURIComponent(S.H && S.H.today ? S.H.today() : '')).catch(() => null);
246
+ if (r && r.ok) { S.props = r.props || null; S.history = r.history || []; }
247
+ draw();
248
+ if (S.H && S.H.redraw) S.H.redraw();
249
+ }
250
+ /** The ✦'s press. */
251
+ export function open(H) {
252
+ const v = VW(); if (!v) return;
253
+ if (H) S.H = H;
254
+ S.out = new Set(); S.choices = {}; S.pick = null; S.more = new Set();
255
+ // the first proposal opens, so its rows read at once (XlcA1Desk); the rest stay folded until pressed
256
+ const first = S.props && S.props.groups && S.props.groups[0] && S.props.groups[0].props[0];
257
+ S.open = new Set(first ? [first.id] : []);
258
+ v.open({ id: 'lp', kind: 'Claude proposes', title: 'Claude proposes' + (S.props && S.props.n ? ' ' + S.props.n : ''), icon: I.spark, presses: presses(),
259
+ onPress: (act) => { if (act === 'all') keep([], true); },
260
+ render: (b) => { b.onclick = onPress; b.onkeydown = (e) => { if (e.key === 'Escape' && S.pick) { e.stopPropagation(); S.pick = null; draw(); } }; draw(); },
261
+ onClose: () => { S.out = new Set(); S.pick = null; if (S.H && S.H.redraw) S.H.redraw(); } });
262
+ }
@@ -24,6 +24,7 @@ import * as PK from './cozy-pick.js'; // the one product picker Home, Board an
24
24
  import { mountNav } from './cozy-nav.js';
25
25
  import { mountLivePill } from './cozy-live-pill.js';
26
26
  import { stepsHelpHtml } from './bd-stages.js';
27
+ import { msMode } from './bd-pins.js';
27
28
  import { timelineHtml, legendHtml, hasHold, planKeys, gapKeys, plainGaps, skipsOf, skipWords, gapWords, SPANS, md } from './bd-span.js';
28
29
  import * as TL from './bd-scroll.js';
29
30
  import * as Acts from './bd-acts.js';
@@ -40,6 +41,7 @@ import * as SM from './split-merge.js'; // split one initiative in two, or mer
40
41
  import * as PM from './prog-move.js'; // move an initiative out of its program, or to another (canvas LpA1More, LpA2Other)
41
42
  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)
42
43
  import * as BI from './bd-ini-panel.js';
44
+ import * as DL from './bd-deliveries.js'; // the Deliveries lane under the timeline's axis (batch 13 item 4, XcalmA6Lane)
43
45
  import { nextHtml } from './bd-next.js';
44
46
  import { statusOf as ivStatus } from './ini-view-model.js';
45
47
  import { initiativeRename, taskRename } from './rename-press.js';
@@ -426,9 +428,10 @@ function drawTrack(L) {
426
428
  /* ── the timeline (AgBoardTimeline; TsCOpen, TsCDesk, TsAllSpans, TsCPhone) ───────────────────────────────────────── */
427
429
  function drawTime(L) {
428
430
  const S = M.steps || [], phone = PHONE.matches, bw = $('#ibBody').clientWidth || innerWidth;
429
- 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,
431
+ const T = timelineHtml(L, M, span, { groups: groups(L), progState, folded: PG.folded, prodHtml: (g) => PG.prodHtml(g, 'tg-prd'), prodCell: (g, dots) => PG.prodCell(g, dots), msMode: msMode(), subHtml: (n) => PG.subHtml(n, 'tg-psb'), progTile: () => PG.progTile(), productsOf: PG.productsOf,
430
432
  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'),
431
- askHref: (none) => askHref(null, 'Propose start and end dates for ' + none.map((r) => r.title).join(', ')) });
433
+ askHref: (none) => askHref(null, 'Propose start and end dates for ' + none.map((r) => r.title).join(', ')),
434
+ lane: (c) => DL.laneHtml(c, { span, progState }) });
432
435
  return T.html;
433
436
  }
434
437
  /** A phone's view switch (BdPhone): List, By stage, the stage track and the timeline (TsCPhone: it scrolls sideways like the desktop's). */
@@ -516,12 +519,12 @@ $('#ibBody').addEventListener('click', (e) => {
516
519
  const op = e.target.closest('[data-open]'); if (op) { Acts.open[op.dataset.open](op); return; }
517
520
  const st = e.target.closest('[data-steps]'); if (st) { togglePop('popSteps', st); return; }
518
521
  const tk = e.target.closest('[data-tk]'); if (tk) { openTicket(tk.dataset.ini, tk.dataset.tk, tk); return; }
519
- if (e.target.closest('[data-act], [data-hold]')) return; // pm/bd-acts.js handles its own presses (a ⏸ on the timeline opens its hold there)
522
+ if (e.target.closest('[data-act], [data-hold], [data-ms-pick]')) return; // pm/bd-acts.js handles its own presses (a ⏸ on the timeline opens its hold there; a ◇ its milestones, pm/bd-pin-card.js)
520
523
  const pg = e.target.closest('[data-prog]'); if (pg) { PG.openProgram(pg.dataset.prog, pg); return; }
521
524
  // 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)
522
525
  const mc = e.target.closest('[data-ms-row]'); if (mc) { msPop(mc, rowOf(mc.dataset.msRow), mc.dataset.msIds.split(' ')); return; }
523
526
  // 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)
524
- const ml = e.target.closest('[data-ms-lane]'); if (ml) { lanePop(ml, ml.dataset.msLane); return; }
527
+ const ml = e.target.closest('[data-ms-lane]'); if (ml) { lanePop(ml, ml.dataset.msLane, ml.dataset.laneName); return; }
525
528
  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; }
526
529
  // a gap's press (batch 11 item 13): its words, and + New task with its dates while part of it is ahead
527
530
  const gp = e.target.closest('[data-gap]'); if (gp) { gapPop(gp, rowOf(gp.dataset.gap)); return; }
@@ -529,6 +532,7 @@ $('#ibBody').addEventListener('click', (e) => {
529
532
  const lane = PHONE.matches && e.target.closest('.tgq-r[data-row] > .tg-p'); if (lane) { const r = rowOf(lane.parentElement.dataset.row); if (r && ((r.milestones || []).length || plainGaps(r).length || skipsOf(r).length)) { msPop(lane, r, null, true); return; } }
530
533
  const b = e.target.closest('[data-key]'); if (b) openIni(rowOf(b.dataset.key), b, view === 'time' ? 'time' : 'track');
531
534
  });
535
+ DL.wire($('#ibBody'), { redraw: () => drawInit() }); // the Deliveries lane: hover links the row, the fold is remembered
532
536
  $('#ibBody').addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches('[data-steps]')) { e.preventDefault(); togglePop('popSteps', e.target); } });
533
537
  /* By stage (BdByStage): a card dragged to another column moves the initiative there (POST /api/boards/move), with Undo in the toast. The column is
534
538
  * one of the eight steps; the move goes to the first of the board's own stages that maps onto it. */
@@ -1019,7 +1023,7 @@ V.init({ M: () => M, wf: wfState, statusOf, usual: usualOf, trail: TI, docMeta,
1019
1023
  Asks.init({ M: () => M, load, say, panel: actsPanel, close: closePanel, rowOf, openIni: openIniAny, openDoc: viewDoc, anchors, programs: () => PGS, reloadPrograms: loadPrograms });
1020
1024
  Acts.init({ M: () => M, wf: wfState, load, say, panel: actsPanel, close: closePanel, redraw: () => { drawChips(); drawInit(); if (tab === 'docs') drawDocs(); }, F, rowOf, statusOf, openIni: openIniAny,
1021
1025
  openTicket: (ini, tk) => openTicket(ini, tk, $('#bdFind')), askHref, pageHref, trail: TI, docMeta, loadDocMeta, viewDoc,
1022
- grouping: () => ({ on: groupingOn(), byProduct }), setGrouping, sprintFilter: sprintFilterOn });
1026
+ grouping: () => ({ on: groupingOn(), byProduct }), setGrouping, sprintFilter: sprintFilterOn, timeline: () => curView() === 'time' });
1023
1027
  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,
1024
1028
  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 })),
1025
1029
  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,