create-pmos 0.443.0 → 0.445.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/package.json +25 -25
  2. package/payload/KIT-VERSION +2 -2
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/payload/state/log.md +1 -1
  7. package/workspace/adler-moments-test.js +8 -0
  8. package/workspace/adler-seasons-art-test.js +3 -0
  9. package/workspace/board-columns-test.js +168 -0
  10. package/workspace/board-programs-test.js +1 -1
  11. package/workspace/briefing-premium-board-test.js +91 -8
  12. package/workspace/briefing-premium-insights-test.js +83 -38
  13. package/workspace/briefing-premium-test.js +2 -1
  14. package/workspace/calm-timeline-test.js +3 -1
  15. package/workspace/changelog.json +24 -0
  16. package/workspace/goals-clear-ui-test.js +34 -20
  17. package/workspace/guide/home.md +5 -0
  18. package/workspace/guide/jira.md +13 -1
  19. package/workspace/guide/ready-made-dashboards.md +2 -2
  20. package/workspace/intel-report-ui-test.js +1 -1
  21. package/workspace/lib/board-fold.js +33 -5
  22. package/workspace/lib/board-premium.js +1 -1
  23. package/workspace/lib/console-state.js +5 -1
  24. package/workspace/lib/engine/boards.js +9 -2
  25. package/workspace/lib/factory-join.js +46 -14
  26. package/workspace/lib/freshness.js +14 -1
  27. package/workspace/lib/initiative-rows.js +38 -4
  28. package/workspace/lib/issues.js +8 -1
  29. package/workspace/lib/jira-cli.js +18 -2
  30. package/workspace/lib/jira-moves.js +119 -0
  31. package/workspace/lib/jira-tickets.js +23 -4
  32. package/workspace/lib/notes.js +4 -2
  33. package/workspace/lib/offloop.js +75 -29
  34. package/workspace/lib/page-build.js +97 -0
  35. package/workspace/lib/plan-items.js +24 -3
  36. package/workspace/lib/plan-tree.js +62 -9
  37. package/workspace/lib/ready-reports.js +22 -8
  38. package/workspace/lib/refresh.js +14 -2
  39. package/workspace/lib/routes-board-premium.js +9 -1
  40. package/workspace/lib/routes-boards.js +114 -16
  41. package/workspace/lib/routes-brief-page.js +3 -1
  42. package/workspace/lib/routes-calendar-import.js +13 -1
  43. package/workspace/lib/routes-ready-reports.js +28 -5
  44. package/workspace/lib/task-links.js +12 -1
  45. package/workspace/lib/workflows-store.js +14 -3
  46. package/workspace/live-pill-round-test.js +178 -0
  47. package/workspace/milestone-pins-test.js +1 -1
  48. package/workspace/okr-goals-ui-test.js +21 -19
  49. package/workspace/package-lock.json +2 -2
  50. package/workspace/package.json +1 -1
  51. package/workspace/panels-test.js +375 -0
  52. package/workspace/premium-rec-tab-test.js +2 -1
  53. package/workspace/premium-vw-item-test.js +10 -2
  54. package/workspace/premium-vw-jira-test.js +3 -0
  55. package/workspace/program-panel-test.js +6 -6
  56. package/workspace/public/pm/bd-cols.js +149 -0
  57. package/workspace/public/pm/bd-ini-panel.js +3 -2
  58. package/workspace/public/pm/bd-pane.js +41 -0
  59. package/workspace/public/pm/bd-span.js +29 -11
  60. package/workspace/public/pm/cozy-adler.js +21 -0
  61. package/workspace/public/pm/cozy-board.css +45 -0
  62. package/workspace/public/pm/cozy-divider.css +32 -0
  63. package/workspace/public/pm/cozy-divider.js +45 -0
  64. package/workspace/public/pm/cozy-insights.css +22 -0
  65. package/workspace/public/pm/cozy-live-pill.css +17 -22
  66. package/workspace/public/pm/cozy-live-pill.js +38 -18
  67. package/workspace/public/pm/cozy-panels.css +80 -0
  68. package/workspace/public/pm/cozy-panels.js +691 -0
  69. package/workspace/public/pm/cozy-viewer.js +148 -70
  70. package/workspace/public/pm/dash-view.js +5 -2
  71. package/workspace/public/pm/goals-clear.js +9 -2
  72. package/workspace/public/pm/home-app.js +30 -19
  73. package/workspace/public/pm/home-ini.js +9 -3
  74. package/workspace/public/pm/home-today.js +4 -2
  75. package/workspace/public/pm/ini-edit.js +405 -0
  76. package/workspace/public/pm/ini-tasks.js +175 -46
  77. package/workspace/public/pm/ini-versions.js +18 -4
  78. package/workspace/public/pm/ini-view-model.js +12 -7
  79. package/workspace/public/pm/ini-view.css +162 -26
  80. package/workspace/public/pm/ini-view.js +44 -13
  81. package/workspace/public/pm/ini-wf-model.js +9 -0
  82. package/workspace/public/pm/ini-wf.js +14 -9
  83. package/workspace/public/pm/ins-pane.js +55 -0
  84. package/workspace/public/pm/jira-move.js +50 -0
  85. package/workspace/public/pm/live-model.js +3 -2
  86. package/workspace/public/pm/pn-narrow.js +76 -0
  87. package/workspace/public/pm/premium-board.js +85 -32
  88. package/workspace/public/pm/premium-insights.js +211 -43
  89. package/workspace/public/pm/task-card.css +2 -0
  90. package/workspace/public/pm/task-card.js +4 -1
  91. package/workspace/public/premium-board.html +2 -0
  92. package/workspace/ready-dash-ui-test.js +4 -4
  93. package/workspace/server.js +71 -20
  94. package/workspace/skills/jira-move.skill +35 -0
  95. package/workspace/stage-card-tasks-test.js +397 -0
  96. package/workspace/stage-card-test.js +1 -1
  97. package/workspace/task-delete-test.js +9 -1
  98. package/workspace/task-links-test.js +1 -0
  99. package/workspace/task-milestones-test.js +3 -3
  100. package/workspace/task-plans-test.js +1 -1
  101. package/workspace/task-press-test.js +12 -4
  102. package/workspace/task-views-test.js +166 -13
  103. package/workspace/test-lists/batch18-live-pill-round.json +10 -0
  104. package/workspace/test-lists/batch18-panels.json +9 -0
  105. package/workspace/test-lists/board-columns.json +5 -0
  106. package/workspace/test-lists/jira-moves.json +11 -0
  107. package/workspace/test-lists/page-speed-fold.json +5 -0
  108. package/workspace/test-lists/page-speed-reads.json +5 -0
  109. package/workspace/test-lists/stage-card-tasks.json +6 -0
  110. package/workspace/timeline-holds-test.js +1 -1
@@ -34,11 +34,13 @@ import * as PK from './cozy-pick.js'; // the one product picker Home, Board an
34
34
  import { openReport } from './premium-report-read.js';
35
35
  import { mountNav } from './cozy-nav.js';
36
36
  import { mountLivePill } from './cozy-live-pill.js';
37
+ import { mountPanels } from './cozy-panels.js';
37
38
  import * as IM from './impact.js'; // Your impact's ✦ line (batch 16 item 7): a key result your work moved
38
39
  import * as AD from './cozy-adler.js'; // Adler in Claude's ✦ line only, never in a chart (batch 16 item 2, canvas AdH3, AdM3)
39
40
  import * as RL from './ready-lib.js'; // the ready-made reports of every program, product and initiative (batch 17 item 1, PbA6, PbG4)
40
41
  import * as RI from './premium-report-intel.js'; // a report made from Intelligence (batch 15 item 4): the header icon, the ✦ proposals, the draft panel
41
42
  import * as OK from './okr-list.js'; // Claude runs the OKRs (batch 16 item 6, 6-B): the goal list, its drafts, the ✦ line, ⋯ › Metrics, the notify choice
43
+ import * as IP2 from './ins-pane.js'; // Intelligence as the first panel (panels on Board and Intelligence, P-B): the narrow form, Moved by, the open row
42
44
  import * as GC from './goals-clear.js'; // goals made clear (batch 18 item 11, 11-B): the drafts table, the check panel, first readings, failed and held
43
45
 
44
46
  let M = null; // the model
@@ -57,6 +59,8 @@ let selecting = false; let picked = []; // New dashboard: the goals picked in
57
59
  wireRail('rep');
58
60
  mountNav('insights');
59
61
  mountLivePill();
62
+ // the page is the first panel (canvas BiI1Split): a goal row drags beside or opens beside on ⌘/Ctrl-click; the table needs about 880 px whole
63
+ mountPanels({ page: document.getElementById('stage'), key: 'intel', sources: IP2.SOURCES, fit: IP2.fit });
60
64
 
61
65
  const SV = (d, sw) => `<svg viewBox="0 0 24 24" aria-hidden="true"${sw ? ` stroke-width="${sw}"` : ''}><path d="${d}"/></svg>`;
62
66
  const I = {
@@ -461,33 +465,85 @@ async function pressMove(b) {
461
465
  await load();
462
466
  }
463
467
 
464
- /* ── the North Star (GsM1–M5; before it Iq8Overview's card with its inputs): the KR metric record with role north-star ── */
468
+ /* ── the North Star and its inputs (Iq8Overview; GcJ2FirstMonday while it has fewer than 3 readings): the KR metric record with role north-star,
469
+ * drawn as its number with the change against the span before it and its readings as a line; the records with role input (and guardrail) as a
470
+ * list beside it, each with its change over the same span. Every number is a reading. One reading is a starting point: the line waits in a dashed
471
+ * box for the 2nd, and the span buttons wait for a line. A read that failed or a held reading (GcR4Failed, GcR5Held) keeps the last good number
472
+ * and says so. The drafts that repair the North Star sit under its card. With no North Star the row is not drawn (zero is silence); a drafted
473
+ * North Star is a row of the drafts table, never a second North Star here. ── */
474
+ let nsSpan = '4';
475
+ const SPANS = [['4', '4 weeks', 28], ['12', '12 weeks', 84], ['q', 'This quarter vs last', null]];
465
476
  const isOwnKr = (g) => !g.program && !g.initiative;
466
477
  const nsGoal = () => (PF ? null : M.goals.find((g) => g.role === 'north-star' && isOwnKr(g)) || null);
467
- /** The North Star as the list's first row (GsM1–M5): its dot, its reading with the change since the quarter's first reading and its age; the
468
- * chart is in the Viewer and its inputs are in the more menu, Metrics, as a tree. A drafted North Star (or a drafted input or guardrail) that is not a
469
- * record yet is a hollow row with its keep press. Nothing to show: the card is not drawn (zero is silence). */
470
- function nsMeta(g) {
471
- const lk = rowLook(g); if (lk.meta) return lk.meta;
472
- if (g.reading && g.reading.txt) return OK.metaOf(g, today());
473
- const S = g.series || [];
474
- if (!S.length) return OK.metaOf(g, today());
475
- const a = S[0], z = S[S.length - 1], d = z.v - a.v, pctU = /^%$/.test(String(g.unit || '').trim());
476
- const ch = S.length > 1 && d !== 0 ? (d > 0 ? 'up ' : 'down ') + (Math.round(Math.abs(d) * 100) / 100) + (pctU ? '' : g.unit ? (/^[A-Za-z]/.test(g.unit) ? ' ' + g.unit : g.unit) : '') + ' since ' + md(day(a.at)) : '';
477
- return [g.nowTxt, ch, OK.ageOf(z.at, today())].filter(Boolean).join(' · ');
478
+ const inputGoals = () => (PF ? [] : M.goals.filter((g) => (g.role === 'input' || g.role === 'guardrail') && isOwnKr(g)));
479
+ /** The reading at or before a day, from a goal's series; null when the series does not reach back that far. */
480
+ const atOrBefore = (g, t) => { const S = (g.series || []).filter((r) => day(r.at) <= t); return S.length ? S[S.length - 1] : null; };
481
+ /** The change of a goal over the span: the latest reading against the one a span before it (a quarter: the same day of the quarter before). */
482
+ function spanChange(g, span = nsSpan) {
483
+ const S = g.series || []; if (S.length < 2) return null;
484
+ const last = S[S.length - 1], tl = day(last.at), back = (SPANS.find((x) => x[0] === span) || SPANS[0])[2];
485
+ const t0 = back ? tl - back * DAY : (() => { const d = new Date(tl); return Date.UTC(d.getUTCFullYear(), d.getUTCMonth() - 3, d.getUTCDate()); })();
486
+ const prev = atOrBefore(g, t0); if (!prev || prev === last) return null;
487
+ const d = last.v - prev.v, pctd = prev.v ? d / Math.abs(prev.v) * 100 : null, better = d === 0 ? null : (g.direction === 'down' ? d < 0 : d > 0);
488
+ return { d, pct: pctd, prev, last, better, t0 };
489
+ }
490
+ const pctSay = (p) => (p === null ? '' : (p > 0 ? '+' : p < 0 ? '−' : '') + (Math.round(Math.abs(p) * 10) / 10) + '%');
491
+ /** The North Star's line: the readings of the span solid, the span before it dashed and laid under it, the latest a dot. Each reading has a
492
+ * title, so a hover says its value and day. */
493
+ function nsSvg(g, ch, W = 520, H = 120) {
494
+ const S = g.series || [], tl = day(S[S.length - 1].at), span = ch ? tl - ch.t0 : 28 * DAY;
495
+ const cur = S.filter((r) => day(r.at) >= tl - span), prev = S.filter((r) => day(r.at) >= tl - 2 * span && day(r.at) <= tl - span);
496
+ const ys = cur.concat(prev).map((r) => r.v), lo = Math.min(...ys), hi = Math.max(...ys), rg = hi - lo || 1, f = (n) => n.toFixed(1);
497
+ const x = (t) => 8 + (span ? (t - (tl - span)) / span : 1) * (W - 16), y = (v) => 10 + (1 - (v - lo) / rg) * (H - 26);
498
+ const path = (L, sh) => L.map((r, i) => (i ? 'L' : 'M') + f(x(day(r.at) + sh)) + ' ' + f(y(r.v))).join('');
499
+ const dots = cur.map((r) => `<circle class="pt" cx="${f(x(day(r.at)))}" cy="${f(y(r.v))}" r="3"><title>${esc(md(day(r.at)) + ' · ' + unitV(g, r.v))}</title></circle>`).join('');
500
+ const z = cur[cur.length - 1];
501
+ return `<svg class="ins-nsch" viewBox="0 0 ${W} ${H}" preserveAspectRatio="none" role="img" aria-label="${esc(g.title + ': ' + cur.length + ' readings in the span' + (prev.length > 1 ? ', the span before it dashed' : ''))}">`
502
+ + (prev.length > 1 ? `<path class="pv" d="${path(prev, span)}"/>` : '') + (cur.length > 1 ? `<path class="ar" d="${path(cur, 0)}L${f(x(tl))} ${H}L${f(x(day(cur[0].at)))} ${H}Z"/><path class="ln" d="${path(cur, 0)}"/>` : '')
503
+ + dots + `<circle class="dt" cx="${f(x(day(z.at)))}" cy="${f(y(z.v))}" r="4.5"/></svg>`;
504
+ }
505
+ const RM = () => typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
506
+ let nsCounted = false;
507
+ /** The North Star's number counts up once, on the first draw (principle 12 as amended for Intelligence: subtle, honest, reduced motion respected). */
508
+ function countUp(el, g) {
509
+ if (nsCounted || RM() || !el || g.now === null) { nsCounted = true; return; }
510
+ nsCounted = true;
511
+ const txt = g.nowTxt, m = /-?\d[\d,]*(\.\d+)?/.exec(txt || ''); if (!m) return;
512
+ const dec = (m[1] || '').length - (m[1] ? 1 : 0), to = Number(m[0].replace(/,/g, '')), t0 = performance.now();
513
+ const step = (t) => { const k = Math.min(1, (t - t0) / 900), e = 1 - Math.pow(1 - k, 3), v = (to * e).toFixed(Math.max(0, dec)); el.textContent = txt.replace(m[0], m[0].includes(',') ? Number(v).toLocaleString('en-US', { minimumFractionDigits: dec, maximumFractionDigits: dec }) : v); if (k < 1) requestAnimationFrame(step); else el.textContent = txt; };
514
+ requestAnimationFrame(step);
515
+ }
516
+ /** What the North Star's number is (said once, beside it): the last good reading after a failed read or a held one; the source and time of
517
+ * the first readings; else the source and how fresh it is. */
518
+ function nsNote(g) {
519
+ const good = GC.lastGoodSay(g); if (good) return good;
520
+ const F = GC.firstOf(g); if (F) return [F.source, GC.atTxt(F.at)].filter(Boolean).join(' · ');
521
+ const src = srcOf(g); return [src === 'Recorded' ? '' : src, freshOf(g)].filter(Boolean).join(' · ');
478
522
  }
479
523
  function drawNs() {
480
524
  const box = $('#nsRow');
481
525
  if (!M || PF) { box.hidden = true; box.innerHTML = ''; return; }
482
- // batch 18 item 11: a drafted North Star is a row of the drafts table, never a second North Star row here
483
526
  const g = nsGoal();
484
527
  if (!g) { box.hidden = true; box.innerHTML = ''; return; }
485
- const rows = OK.rowHtml(g, Object.assign({ meta: nsMeta(g), drafts: draftsFor(g.id), drawDraft: drHtml, noOwner: !OK.whoOf(g), today: today() }, rowLook(g)));
486
- box.innerHTML = `<div class="okr-sec"><h2 class="okr-h">North Star</h2></div><div class="okr-card">${rows}</div>`;
487
- box.hidden = false; box.classList.add('okr-ns');
528
+ const F = GC.firstOf(g), line = !F || F.n >= 2, ch = line ? spanChange(g) : null, I0 = inputGoals(), bad = !!(g.failed || (g.held || []).length);
529
+ const pill = ch && ch.pct !== null && !bad ? `<span class="cz-pill ${ch.better === null ? 'q' : ch.better ? 'ok' : 'late'}">${esc(pctSay(ch.pct))}</span><span class="note">vs ${esc(unitV(g, ch.prev.v))} ${nsSpan === 'q' ? 'last quarter, same day' : 'the previous ' + (SPANS.find((x) => x[0] === nsSpan) || SPANS[0])[1]}</span>` : '';
530
+ const seg = line && (g.series || []).length > 1 ? `<div class="cz-seg ins-seg" role="group" aria-label="Compare">${SPANS.map(([k, l]) => `<button type="button" aria-pressed="${nsSpan === k}" data-span="${k}">${esc(l)}</button>`).join('')}</div>` : '';
531
+ const chart = !line ? GC.firstChart(g) : (g.series || []).length ? nsSvg(g, ch) : `<p class="note">${esc(nextReading(g))}</p>`;
532
+ const drafts = draftsFor(g.id).map(drHtml).join('');
533
+ const card = `<div class="ins-nsc${bad ? ' bad' : ''}" data-goal="${esc(g.id)}"><div class="ins-nsh"><span class="ins-lbl2">${OK.dotOf(g) === 'broken' ? OK.dotHtml('broken') + ' ' : ''}North Star <span>${esc(g.title)}</span></span>${seg}</div>`
534
+ + `<div class="ins-nsv"><button type="button" class="ins-big" data-nsopen aria-label="Open ${esc(g.title)}"><b id="nsNum">${esc(nowOf(g))}</b></button>${pill}<span class="note ins-nsn">${esc(nsNote(g))}</span></div>`
535
+ + chart + (drafts ? `<div class="ins-nsd">${drafts}</div>` : '') + '</div>';
536
+ const row = (x) => { const c = F ? null : spanChange(x), warn = gcSay(x); return `<button type="button" class="ins-inr" data-goal="${esc(x.id)}"><span class="nm">${esc(x.title)}${warn ? `<small class="note">${esc(warn)}</small>` : ''}</span><span class="v"><b>${esc(nowOf(x))}</b>${c && !warn ? `<span class="${c.better === null ? 'q' : c.better ? 'up' : 'dn'}">${esc(sgn(c.d, x.unit))}</span>` : ''}</span></button>`; };
537
+ const ins = I0.filter((x) => x.role === 'input'), grd = I0.filter((x) => x.role === 'guardrail');
538
+ const side = ins.length || grd.length ? `<div class="ins-nsi">${ins.length ? `<span class="ins-lbl2">Inputs <span>what moves the North Star</span></span>${ins.map(row).join('')}` : ''}${grd.length ? `<span class="ins-lbl2">Guardrails <span>must not get worse</span></span>${grd.map(row).join('')}` : ''}</div>` : '';
539
+ box.innerHTML = card + side; box.hidden = false; box.classList.toggle('one', !side);
540
+ countUp($('#nsNum'), g);
488
541
  }
489
542
  $('#nsRow').addEventListener('click', (e) => {
490
- const r = e.target.closest('[data-goal]'); if (r && e.target.closest('.okr-main')) openGoalDetail(r.dataset.goal);
543
+ if (e.target.closest('.okr-dr')) return; // a draft under the North Star has its own presses
544
+ const s = e.target.closest('[data-span]'); if (s) { nsSpan = s.dataset.span; drawNs(); return; }
545
+ if (e.target.closest('[data-nsopen]')) { const g = nsGoal(); if (g) openGoalDetail(g.id); return; }
546
+ const r = e.target.closest('.ins-inr[data-goal]'); if (r) openGoalDetail(r.dataset.goal);
491
547
  });
492
548
 
493
549
  /* ── what Claude drafted (GsM1–M5; before it Iq8Suggest, Iq9Draft): GET /api/metric-drafts for this product. Each draft sits under the row it
@@ -761,42 +817,150 @@ function bandSvg(pts, lim, ceil, tone, label, w = 210, h = 40) {
761
817
  const line = L.length > 1 ? `<polygon points="${L[0].split(',')[0]},${h} ${L.join(' ')} ${last[0]},${h}" class="ar"/><polyline points="${L.join(' ')}" class="ln"/>` : '';
762
818
  return `<svg class="ins-spark" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}" role="img" aria-label="${esc(label)}">${band}${line}<circle cx="${last[0]}" cy="${last[1]}" r="3.6" class="dt" style="fill:${TONE_BAR[tone] || TONE_BAR.q}"/></svg>`;
763
819
  }
764
- /* the goal list (GsM1–M5): Key results, then Health budgets, one row per goal: the dot, the outcome, the reading with its age, and the owner. No
765
- * sparkline and no initiative status on a row: the chart and what moves it are in the Viewer. The same list on a phone and a desktop. */
766
- const okrRow = (g, o = {}) => OK.rowHtml(g, Object.assign({ today: today(), drafts: PF ? [] : draftsFor(g.id), drawDraft: drHtml, mark: markHtml,
767
- selecting, sel: selecting && picked.includes(g.id), meta: PF ? [g.prod, OK.metaOf(g, today())].filter(Boolean).join(' · ') : undefined }, PF ? {} : rowLook(g), o));
768
- const budgetOkr = (b) => OK.rowHtml(Object.assign({}, b, { title: b.outcome || b.title }), { budget: true, today: today(), meta: OK.budgetMeta(b, today()), dot: OK.dotOf(Object.assign({ anchor: b.anchor }, b)), drafts: draftsFor(b.id), drawDraft: drHtml, mark: markHtml });
820
+ /* ── the key results (Iq8Overview, GcJ2FirstMonday): one table, Key results · Now, of target · So far · By its date · Moved by, by objective,
821
+ * then Health budgets. A goal with fewer than 3 readings shows its reading, a grey dot for So far and "Known after 3 readings" for By its date;
822
+ * a read that failed or a held reading keeps the last good reading and says what happened under it (GcR4Failed, GcR5Held). The drafts that
823
+ * repair a goal sit under its row. On a phone each goal is a card (Iq8Phone). ── */
824
+ const COLS = 'ins-cols';
825
+ function barHtml(g, cls = '') {
826
+ return `<div class="ins-bar1${cls}" role="img" aria-label="${g.done === null ? 'No progress to read' : Math.round(g.done * 100) + '% of the way to the target'}${g.timeGone == null ? '' : ', ' + Math.round(g.timeGone * 100) + '% of its time gone'}"><i style="width:${g.done === null ? 0 : Math.round(g.done * 100)}%;background:${TONE_BAR[g.tone] || TONE_BAR.q}"></i>${g.timeGone == null ? '' : `<span class="today" title="today" style="left:${Math.round(g.timeGone * 100)}%"></span>`}</div>`;
827
+ }
828
+ /** The so-far sparkline: the readings at their dates across the goal's span, the target dashed, and the pace carried to the date, dashed. */
829
+ function sparkHtml(g, w = 210, h = 40) {
830
+ const c = g.key ? byKey(g.key) : null;
831
+ if (!c) return g.readings ? `<span class="ins-one"><span class="note">${g.readings === 1 ? '1 reading' : g.readings + ' readings'}</span><span class="cz-pill ins-dash">No trend yet</span></span>` : '<span class="note">No reading yet</span>'; // IsMenus: the one value, never a flat line
832
+ const t0 = day(c.pts[0].at), tl = day(c.pts[c.pts.length - 1].at), t1 = Math.max(tl, day(g.byAt) || tl);
833
+ const ys = c.pts.map((p) => p.v).concat(g.target !== null ? [g.target] : [], g.proj ? [g.proj.atDue] : []), lo = Math.min(...ys), hi = Math.max(...ys), rg = hi - lo || 1;
834
+ const x = (t) => 5 + (t1 > t0 ? (t - t0) / (t1 - t0) : 1) * (w - 10), y = (v) => 4 + (1 - (v - lo) / rg) * (h - 8);
835
+ const pts = c.pts.map((p) => x(day(p.at)).toFixed(1) + ',' + y(p.v).toFixed(1)), last = pts[pts.length - 1].split(',');
836
+ const fill = `${x(t0).toFixed(1)},${h} ${pts.join(' ')} ${last[0]},${h}`;
837
+ const proj = g.proj && day(g.byAt) > tl ? `<polyline points="${last.join(',')} ${x(day(g.byAt)).toFixed(1)},${y(g.proj.atDue).toFixed(1)}" class="pj"/>` : '';
838
+ return `<svg class="ins-spark" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}" role="img" aria-label="${esc(g.title + ': ' + c.pts.length + ' readings' + (g.targetTxt ? ', target ' + g.targetTxt : ''))}"><polygon points="${fill}" class="ar"/>${g.target !== null ? `<line x1="0" x2="${w}" y1="${y(g.target).toFixed(1)}" y2="${y(g.target).toFixed(1)}" class="tg"/>` : ''}${proj}<polyline points="${pts.join(' ')}" class="ln"/><circle cx="${last[0]}" cy="${last[1]}" r="3.6" class="dt" style="fill:${TONE_BAR[g.tone]}"/></svg>`;
839
+ }
840
+ /** A Count goal with a small whole target is drawn as blocks: one per unit of the target, the ones reached filled. */
841
+ const isBlocks = (g) => g.type === 'Count' && Number.isInteger(g.target) && g.target >= 1 && g.target <= 12 && Number.isInteger(g.now) && g.now >= 0;
842
+ const blocksHtml = (g, w, names = true) => `<div class="ins-blocks" style="width:${w}px" role="img" aria-label="${esc(g.now + ' of ' + g.target)}">${Array.from({ length: g.target }, (_, i) => `<i class="${i < g.now ? 'on' : ''}"></i>`).join('')}</div>`
843
+ + (names && g.items && g.items.length ? `<div class="note ins-items">${esc(g.items.slice(0, g.now).join(', '))}</div>` : ''); // the reached items, when the goal records them
844
+ /** The grey dot of So far while a goal has fewer than 3 readings (GcJ2FirstMonday): one reading is a starting point, not a trend. */
845
+ const firstDot = (g) => `<span class="ins-dot1" role="img" aria-label="${esc((GC.firstOf(g) || {}).n === 1 ? '1 reading, no trend yet' : '2 readings, no trend yet')}"></span>`;
846
+ function soFarHtml(g, w = 210) {
847
+ if (g.type === 'Done or not') return g.steps && g.steps.length ? stepsHtml(g) : '<span class="note">No steps recorded</span>';
848
+ if (GC.firstOf(g)) return firstDot(g);
849
+ if (g.type === 'Stay within' && g.target !== null && g.series && g.series.length) {
850
+ return bandSvg(g.series, g.target, g.limit !== 'floor', g.pace && g.pace.tone !== 'q' ? g.pace.tone : g.tone, g.title + ': ' + g.series.length + (g.series.length === 1 ? ' reading' : ' readings') + ', the green band is inside the budget', w);
851
+ }
852
+ if (isBlocks(g)) return blocksHtml(g, w);
853
+ return sparkHtml(g, w);
854
+ }
855
+ const PACE_C = { ok: 'var(--cz-ok)', late: 'var(--cz-late)', risk: 'var(--cz-risk)', q: 'var(--cz-ink3)' };
856
+ const GAP_DAYS = { hourly: 1 / 24, daily: 1, weekly: 7, monthly: 30 };
857
+ /** When the pace of a goal with fewer than 3 readings is known: the day of its 3rd reading, from its next read and its rhythm. */
858
+ function knownAt(g) {
859
+ const F = GC.firstOf(g); if (!F || !F.next) return '';
860
+ const c = (g.rhythm && g.rhythm.cadence) || (g.recipe && g.recipe.cadence), gap = GAP_DAYS[c];
861
+ const t = Date.parse(F.next); if (!Number.isFinite(t)) return '';
862
+ return GC.dayTxt(new Date(t + Math.max(0, 2 - F.n) * (gap || 0) * DAY).toISOString());
863
+ }
864
+ /** The pace column: "≈16.5% by Dec 31" with its words; "Known after 3 readings" and the day it will be while the line is too short. */
865
+ function paceHtml(g) {
866
+ if (GC.firstOf(g)) { const k = knownAt(g); return `<div class="pace" role="cell"><span>Known after 3 readings</span>${k ? `<div class="note">${esc(k)}</div>` : ''}</div>`; }
867
+ return `<div class="pace" role="cell"><b style="color:${PACE_C[g.pace.tone]}">${esc(g.pace.head)}</b><div class="note">${esc(g.pace.sub)}</div></div>`;
868
+ }
869
+ /** What happened to a goal's last reading, said once under its number: "not read Mon 16 Nov", "1 reading held". */
870
+ const gcSay = (g) => (g.failed ? 'not read ' + GC.dayTxt(g.failed.at) : (g.held || []).length ? ((g.held.length === 1 ? '1 reading' : g.held.length + ' readings') + ' held') : '');
871
+ function goalSub(g) {
872
+ const by = day(g.byAt), late = per && by !== null && by > per.to && per.key !== 'y' && per.key !== 'c';
873
+ if (g.type === 'Done or not') return [g.steps && g.steps.length ? g.steps.filter((x) => x.done).length + ' of ' + g.steps.length + ' steps' : '', by !== null ? 'due ' + md(by) : ''].filter(Boolean).join(' · ');
874
+ if (g.type === 'Stay within') return [g.dirTxt + ' ' + (g.targetTxt || ''), g.alwaysOn ? 'always on' : by !== null ? 'until ' + md(by) : ''].filter(Boolean).join(' · ');
875
+ const from = g.baseTxt ? 'from ' + g.baseTxt + (g.fromAt && (g.type === 'Percentage' || g.type === 'Amount') ? ' on ' + md(day(g.fromAt)) : '') : '';
876
+ const cp = late ? (g.checkpoints || []).find((c) => day(c.by) >= per.from && day(c.by) <= per.to) : null;
877
+ return [g.dirTxt, from, late ? 'due ' + md(by) + ' ' + new Date(by).getUTCFullYear() + ' · ' + (cp ? per.short + ' checkpoint ' + unitV(g, cp.target) : 'no ' + per.short + ' checkpoint recorded') : ''].filter(Boolean).join(' · ');
878
+ }
879
+ /** The drafts that repair a goal or a budget, as one full row under it (zero is silence). */
880
+ const draftsRow = (id) => { const D = PF ? [] : draftsFor(id); return D.length ? `<div class="ins-drr" role="row" data-drafts-for="${esc(id)}"><div role="cell">${D.map(drHtml).join('')}</div></div>` : ''; };
881
+ /** The number a row shows: after a failed read or a held reading it is the last good one (GcR4Failed, GcR5Held), never the held value. */
882
+ const nowOf = (g) => ((g.failed || (g.held || []).length) && g.lastRead && g.lastRead.txt ? g.lastRead.txt : g.nowTxt) || '—';
883
+ function goalRow(g) {
884
+ const sel = selecting && picked.includes(g.id), warn = gcSay(g), crit = OK.dotOf(g) === 'broken';
885
+ return `<div class="ins-tr ins-row ${COLS}${sel ? ' sel' : ''}${crit ? ' crit' : ''}" role="row" data-goal="${esc(g.id)}" tabindex="0" aria-label="${esc(g.title)}"${selecting ? ` aria-selected="${sel}"` : ''}>`
886
+ + `<div class="nm" role="cell">${crit ? OK.dotHtml('broken') : ''}<span><b>${markHtml(g.title)}</b><small><span class="cz-pill q ins-type">${esc(g.type)}</span><span class="ins-sub" title="${esc(goalSub(g))}">${esc(PF && g.prod ? [g.prod, goalSub(g)].filter(Boolean).join(' · ') : goalSub(g))}</span></small></span></div>`
887
+ + `<div class="val" role="cell"><b>${esc(nowOf(g))}</b> <span class="note">${esc(g.targetTxt ? 'of ' + g.targetTxt : 'no target')}</span>${warn ? `<div class="note ins-warn">${esc(warn)}</div>` : GC.firstOf(g) ? '' : barHtml(g)}</div>`
888
+ + `<div class="sofar" role="cell">${soFarHtml(g)}</div>`
889
+ + paceHtml(g)
890
+ + `<div class="mv" role="cell">${g.moves.length ? g.moves.slice(0, 3).map((r) => initRow(r)).join('') + (g.moves.length > 3 ? `<span class="note">and ${g.moves.length - 3} more</span>` : '') : `<span class="note">${M.initiativesRead ? 'No initiative anchors to it' : 'The initiatives are not read yet'}</span>`}</div>`
891
+ + '</div>' + draftsRow(g.id);
892
+ }
893
+ /** A health budget (D59): always on. Its reading is its share of the board's open initiatives, against its quarterly cap (planning/okrs/health-budgets.md). */
894
+ const pct = (v) => Math.round(v * 100) + '%';
895
+ function budgetRow(b) {
896
+ const R = b.reading, cap = b.cap;
897
+ const val = R ? `<b>${R.n}</b> <span class="note">of ${R.total} open initiatives</span>` : '<b>—</b> <span class="note">' + (b.declared ? 'the initiatives are not read' : 'not in the budget registry') + '</span>';
898
+ const scale = R && R.share !== null && cap !== null ? Math.max(cap * 1.5, R.share) || 1 : 1;
899
+ const bar = R && R.share !== null && cap !== null ? `<div class="ins-bar1" role="img" aria-label="${esc(pct(R.share) + ' of open initiatives, cap ' + pct(cap))}"><i style="width:${Math.round(R.share / scale * 100)}%;background:${R.over ? TONE_BAR.late : TONE_BAR.ok}"></i><span class="today" title="cap" style="left:${Math.round(cap / scale * 100)}%"></span></div>` : barHtml({ done: null, timeGone: null, tone: 'q' });
900
+ const pace = !R || R.share === null ? ['var(--cz-ink3)', '—', b.declared ? 'no open initiative to share' : 'add it to health-budgets.md to give it a cap']
901
+ : R.over ? ['var(--cz-late)', 'Over its ' + pct(cap) + ' cap', pct(R.share) + ' of open initiatives'] : ['var(--cz-ok)', 'Within its ' + pct(cap) + ' cap', pct(R.share) + ' of open initiatives'];
902
+ return `<div class="ins-tr ins-row ${COLS} ins-budget${R && R.over ? ' crit' : ''}" role="row" data-budget="${esc(b.id)}" tabindex="0" aria-label="${esc(b.title)}">`
903
+ + `<div class="nm" role="cell">${R && R.over ? OK.dotHtml('broken') : ''}<span><b>${markHtml(b.title)}</b><small><span class="cz-pill q ins-type">Stay within</span><span class="ins-sub">always on${cap !== null ? ' · cap ' + pct(cap) + ' of a quarter' : ''}</span></small></span></div>`
904
+ + `<div class="val" role="cell">${val}${bar}</div>`
905
+ + `<div class="sofar" role="cell">${R && R.share !== null && cap !== null ? bandSvg([{ at: M.today || iso(today()), v: R.share * 100 }], cap * 100, true, R.over ? 'late' : 'ok', b.title + ': ' + pct(R.share) + ' of open initiatives, the green band is inside its ' + pct(cap) + ' cap') : ''}<span class="note">${esc(b.covers ? 'Covers ' + b.covers : 'What it covers is not declared')}</span></div>`
906
+ + `<div class="pace" role="cell"><b style="color:${pace[0]}">${esc(pace[1])}</b><div class="note">${esc(pace[2])}</div></div>`
907
+ + `<div class="mv" role="cell">${b.moves.length ? b.moves.slice(0, 3).map((r) => initRow(r)).join('') : '<span class="note">No initiative anchors to it</span>'}</div></div>` + draftsRow(b.id);
908
+ }
909
+ const GRP_PILL = (L) => {
910
+ const scored = L.filter((g) => g.tone !== 'q'), bad = scored.filter((g) => g.tone === 'late' || g.tone === 'red').length;
911
+ return !scored.length ? '' : bad ? `<span class="cz-pill late">${bad} of ${L.length} behind</span>` : '<span class="cz-pill ok">on track</span>';
912
+ };
769
913
  function drawGoals() {
770
914
  const G = goalsShown(), T = $('#goalTbl');
771
915
  document.body.classList.toggle('ins-trv', dash === TRENDS);
772
- T.classList.toggle('okr-list', dash !== TRENDS);
773
- $('#goalCards').innerHTML = '';
774
- if (dash === TRENDS) { T.innerHTML = bmHtml(true); return; }
916
+ if (dash === TRENDS) { T.innerHTML = bmHtml(true); $('#goalCards').innerHTML = ''; return; }
917
+ const head = `<div class="ins-tr ins-th ${COLS}" role="row"><div role="columnheader">Key results <span>${G.length} · ${esc(per ? per.label : '')}</span></div><div role="columnheader">Now, of target <span class="ins-lg"><span><i class="ins-tdk"></i>today</span></span></div><div role="columnheader">So far</div><div role="columnheader">By its date</div><div role="columnheader" class="ins-mvh">Moved by <span class="ins-lg"><span><i class="ins-trk"><i class="k"></i></i>Skipped</span><span><i class="ins-trk"><i class="p m"></i></i>Milestone</span></span></div></div>`;
775
918
  const D = curDash();
776
- const krDrafts = []; // batch 18 item 11: a drafted key result is a row of the drafts table
777
- const sub = per ? per.label : '';
778
- const head = `<div class="okr-sec"><h2 class="okr-h">Key results</h2><span class="note">${esc(sub)}</span></div>`;
779
- if (!M.goals.filter(isKr).length && !krDrafts.length) {
919
+ if (!M.goals.filter(isKr).length) {
780
920
  // the drafts table above says what is drafted: no empty card under it (zero is silence)
781
- T.innerHTML = PF || !tableRows().length ? head + '<div class="okr-card"><p class="okr-none">No key result is recorded for this workspace.</p></div>' + budgetsHtml(D) : budgetsHtml(D);
782
- return;
921
+ const B = budgetsHtml(D);
922
+ T.innerHTML = PF || !tableRows().length ? '<div class="ins-empty"><b>No key result is recorded for this workspace.</b> A key result is a metric with a target and a date. Press + to add one.</div>' + B : B;
923
+ T.hidden = !T.innerHTML; drawCards([]); IP2.drawn(); return;
783
924
  }
784
- /* by objective when there is more than one; Portfolio groups by product */
925
+ T.hidden = false;
926
+ /* by objective; Portfolio groups by product, each product's objectives said in its rows */
785
927
  const keyOf = (g) => (PF ? g.prod : g.pillar || '');
786
928
  const by = new Map(); for (const g of G) { const k = keyOf(g); if (!by.has(k)) by.set(k, []); by.get(k).push(g); }
787
929
  const objs = [...new Set(M.goals.filter(isKr).map((g) => g.pillar || ''))];
788
- const sub1 = by.size > 1 || PF ? (k) => `<p class="okr-obj">${PF ? esc(k || 'A product') : k ? 'Objective ' + (objs.indexOf(k) + 1) + ' · ' + esc(k) : 'No objective'}</p>` : () => '';
789
- const groups = [...by.entries()].map(([k, L]) => sub1(k) + L.map((g) => okrRow(g)).join('')).join('');
790
- const drafted = krDrafts.map((r) => (drEdit === r.id ? `<div class="okr-row">${drEditHtml(r)}</div>` : OK.draftRowHtml(r))).join('');
791
- T.innerHTML = head + (G.length || drafted ? `<div class="okr-card">${groups}${drafted}</div>` : `<div class="okr-card"><p class="okr-none">No goal matches${find ? ' “' + esc(find) + '”' : ''}${noFilter() ? '' : ' this filter'} in ${esc(per.label)}. <button type="button" class="lk" id="goalsAll">Show every goal</button></p></div>`) + budgetsHtml(D);
930
+ const head1 = (k) => (PF ? esc(k || 'A product') : k ? 'Objective ' + (objs.indexOf(k) + 1) + ' · ' + esc(k) : 'No objective');
931
+ const groups = [...by.entries()].map(([k, L]) => `<div class="ins-grp" role="row"><span role="cell">${head1(k)}</span> <span class="q">${esc(per ? per.label : '')}</span>${GRP_PILL(L)}</div>` + L.map(goalRow).join('')).join('');
932
+ T.innerHTML = head + (G.length ? groups : `<div class="ins-empty">No goal matches${find ? ' “' + esc(find) + '”' : ''}${noFilter() ? '' : ' this filter'} in ${esc(per.label)}. <button type="button" class="lk" id="goalsAll">Show every goal</button></div>`) + budgetsHtml(D);
933
+ drawCards(G);
934
+ IP2.drawn();
792
935
  }
793
- const pct = (v) => Math.round(v * 100) + '%';
794
936
  function budgetsHtml(D) {
795
937
  if (PF || D.saved || D.id.startsWith('p:') || (!M.initiativesRead && !(M.budgets || []).length) || (filt.kind.length && !filt.kind.includes('budgets'))) return '';
796
938
  const B = (M.budgets || []).filter((b) => hit(b.title, ...b.moves.map((m) => m.title)) && ownerHit(b.moves.map((m) => m.owner).filter(Boolean)) && (!filt.status.length || filt.status.includes(budgetStatus(b))));
797
939
  if (!B.length) return ''; // zero is silence
798
- return `<div class="okr-sec"><h2 class="okr-h">Health budgets</h2></div><div class="okr-card">${B.map(budgetOkr).join('')}</div>`;
940
+ return '<div class="ins-grp" role="row"><span role="cell">Health budgets</span> <span class="q">always on, judged every week</span></div>' + B.map(budgetRow).join('');
799
941
  }
942
+ /* the phone (Iq8Phone): one card per goal, its status at the top right, its value, its so-far, its bar and the first initiative that moves it */
943
+ function cardPill(g) {
944
+ if (g.failed) return ['risk', 'Not read'];
945
+ if ((g.held || []).length) return ['risk', 'Held'];
946
+ if (GC.firstOf(g)) return null;
947
+ const t = g.pace && g.pace.tone !== 'q' ? g.pace.tone : g.tone;
948
+ if (t === 'late' || t === 'red') return ['late', 'Behind'];
949
+ if (t === 'ok') return g.done !== null && g.timeGone != null && g.done > g.timeGone ? ['ok', 'Ahead'] : ['ok', 'On track'];
950
+ return null;
951
+ }
952
+ function drawCards(G) {
953
+ $('#goalCards').innerHTML = G.map((g) => {
954
+ const p = cardPill(g), tg = g.targetTxt ? (g.type === 'Count' ? 'of ' : 'target ') + g.targetTxt + (g.byAt ? ' by ' + md(day(g.byAt)) : '') : 'no target', first = GC.firstOf(g);
955
+ const gr = first ? `<span class="note">${esc(GC.firstMeta(g).split(' · ').slice(1).join(' · '))}</span>` : isBlocks(g) ? blocksHtml(g, 190, false) : g.type === 'Stay within' && g.series.length && g.target !== null ? bandSvg(g.series, g.target, g.limit !== 'floor', g.tone, g.title, 190, 30) : g.key ? sparkHtml(g, 190, 30) : '';
956
+ return `<div class="ins-card" role="listitem" data-goal="${esc(g.id)}" tabindex="0" aria-label="${esc(g.title)}"><div class="ins-ch"><b>${esc(g.title)}</b>${p ? `<span class="cz-pill ${p[0]}">${p[1]}</span>` : ''}</div>`
957
+ + `<div class="ins-cs"><span class="cz-pill q ins-type">${esc(g.type)}</span><span class="note">${esc(tg)}</span></div>`
958
+ + `<div class="ins-cv"><b>${esc(nowOf(g))}</b><span class="ins-cg">${gr}</span></div>${first || gcSay(g) ? '' : barHtml(g, ' ins-wide')}`
959
+ + (g.moves[0] ? `<div class="ins-c1">${initRow(g.moves[0], false)}</div>` : '') + '</div>' + (PF ? '' : draftsFor(g.id).map(drHtml).join(''));
960
+ }).join('') || (M.goals.filter(isKr).length ? '<p class="note">No goal in this period.</p>' : '');
961
+ }
962
+ IP2.mount({ page: $('#stage'), table: $('#goalTbl'), selecting: () => selecting });
963
+ $('#goalCards').addEventListener('click', (e) => { if (e.target.closest('a, .okr-dr')) return; const c = e.target.closest('[data-goal]'); if (c) pressGoal(c.dataset.goal); });
800
964
  $('#goalTbl').addEventListener('click', (e) => {
801
965
  if (e.target.closest('#goalsAll')) { find = ''; $('#findIn').value = ''; clearFilter(); per = periods()[3]; redraw(); return; }
802
966
  if (e.target.closest('a')) return;
@@ -805,7 +969,7 @@ $('#goalTbl').addEventListener('click', (e) => {
805
969
  const bu = e.target.closest('[data-budget]'); if (bu) { openBudget(bu.dataset.budget); return; }
806
970
  const r = e.target.closest('[data-goal]'); if (r) pressGoal(r.dataset.goal);
807
971
  });
808
- $('#goalTbl').addEventListener('keydown', (e) => { if (e.key !== 'Enter' && e.key !== ' ') return; const r = e.target.closest && e.target.closest('.okr-main, .ins-row, [data-tile]'); if (!r || e.target !== r) return; e.preventDefault(); r.click(); });
972
+ $('#goalTbl').addEventListener('keydown', (e) => { if (e.key !== 'Enter' && e.key !== ' ') return; const r = e.target.closest && e.target.closest('.ins-row, [data-tile]'); if (!r || e.target !== r) return; e.preventDefault(); r.click(); });
809
973
  /** A goal press: picks it while New dashboard is open; opens Edit chart on a saved dashboard (AgInsChart); otherwise the goal's detail (IsGoal). */
810
974
  function pressGoal(id) {
811
975
  if (selecting) { picked = picked.includes(id) ? picked.filter((x) => x !== id) : picked.concat(id); drawGoals(); drawDashSide(); return; }
@@ -832,8 +996,12 @@ function detailSvg(g, c, W = 490, H = 150) {
832
996
  const x = (t) => 12 + (t1 > t0 ? (t - t0) / (t1 - t0) : 1) * (W - 24), y = (v) => 26 + (1 - (v - lo) / rg) * (H - 56), f = (n) => n.toFixed(1);
833
997
  let out = '';
834
998
  if (g.target !== null) { const ty = y(g.target); out += `<path class="tg" d="M0 ${f(ty)}H${W}"/><text class="tgl" x="${W - 2}" y="${f(ty < 18 ? ty + 14 : ty - 6)}" text-anchor="end">Target ${esc(g.targetTxt)}</text>`; }
835
- for (const s of shipsOf(g)) { if (s.t < t0 || s.t > t1) continue; const sx = x(s.t), end = sx > W - 160; out += `<path class="ship" d="M${f(sx)} 20V${H - 10}"/><text class="shipl" x="${f(end ? sx - 4 : sx + 4)}" y="${H - 14}"${end ? ' text-anchor="end"' : ''}>${esc(s.label)}</text>`; }
836
- for (const m of marks) { const mx = x(m.t), end = mx > W - 120; out += `<path class="msr" d="M${f(mx)} 14V${H - 16}"/><path class="msd" d="M${f(mx)} ${H - 14}l5 5-5 5-5-5z"/><text class="msl" x="${f(end ? mx - 9 : mx + 9)}" y="${H - 5}"${end ? ' text-anchor="end"' : ''}>${esc(m.label)}</text>`; }
999
+ // the labels at the foot never overlap: the first milestone label (Deliver, Evaluate) keeps the bottom line, and a milestone or release label
1000
+ // that would touch one moves up a line (7.5 units a character is the bold label font, a little over; a line is 17 units)
1001
+ const lanes = [], laneOf = (a, b) => { let i = 0; while ((lanes[i] || []).some(([p, q]) => a < q + 6 && b > p - 6)) i++; (lanes[i] = lanes[i] || []).push([a, b]); return i; };
1002
+ const span = (px, end, label) => { const w = String(label).length * 7.5; return end ? [px - w, px] : [px, px + w]; };
1003
+ for (const m of marks) { const mx = x(m.t), end = mx > W - 120, lx = end ? mx - 9 : mx + 9; const [a, b] = span(lx, end, m.label), ly = H - 5 - 17 * laneOf(Math.min(a, mx - 6), Math.max(b, mx + 6)); out += `<path class="msr" d="M${f(mx)} 14V${H - 16}"/><path class="msd" d="M${f(mx)} ${H - 14}l5 5-5 5-5-5z"/><text class="msl" x="${f(lx)}" y="${ly}"${end ? ' text-anchor="end"' : ''}>${esc(m.label)}</text>`; }
1004
+ for (const s of shipsOf(g)) { if (s.t < t0 || s.t > t1) continue; const sx = x(s.t), end = sx > W - 160, lx = end ? sx - 4 : sx + 4, ly = H - 5 - 17 * laneOf(...span(lx, end, s.label)); out += `<path class="ship" d="M${f(sx)} 20V${H - 10}"/><text class="shipl" x="${f(lx)}" y="${ly}"${end ? ' text-anchor="end"' : ''}>${esc(s.label)}</text>`; }
837
1005
  const L = pts.map((p) => f(x(day(p.at))) + ' ' + f(y(p.v))), last = L[L.length - 1];
838
1006
  out += `<path class="ln" d="M${L.join('L')}"/>` + (proj ? `<path class="pj" d="M${last}L${f(x(proj.t))} ${f(y(proj.v))}"/>` : '');
839
1007
  out += `<circle class="pt now" cx="${f(x(day(pts[pts.length - 1].at)))}" cy="${f(y(pts[pts.length - 1].v))}" r="3.5"/>`;
@@ -934,8 +1102,8 @@ function goalBodyHtml(g, o) {
934
1102
  o.own && savedDash().length ? { id: 'dash', title: 'On dashboards', count: onDash, render: () => dashSwitches(g) } : null,
935
1103
  ];
936
1104
  const ask = `<form class="ins-askf" data-askf><input name="q" maxlength="300" autocomplete="off" placeholder="Ask about this goal" aria-label="Ask about this goal"><button type="submit" class="cz-ib sm solid" aria-label="Ask in Home" title="Ask in Home">${SV(I.up)}</button></form>`;
937
- const failedOrHeld = !!(g.failed || (g.held || []).length);
938
- return head + form + (failedOrHeld ? kr : '') + `<div class="ins-gbig">${chart}</div>` + (failedOrHeld ? '' : kr) + whyCard + window.czViewer.czSections(rows.filter(Boolean), { key: 'goal' }) + '<p class="note ins-gmsg" data-gmsg role="status"></p>' + ask;
1105
+ // GcR3Goal: the panel leads with the number and how it is counted, never with its chart; the chart follows the words
1106
+ return head + form + kr + `<div class="ins-gbig">${chart}</div>` + whyCard + window.czViewer.czSections(rows.filter(Boolean), { key: 'goal' }) + '<p class="note ins-gmsg" data-gmsg role="status"></p>' + ask;
939
1107
  }
940
1108
  /** The goal as plain text, for Copy as text. */
941
1109
  function goalText(g) {
@@ -98,3 +98,5 @@
98
98
  .tkc .tkc-hu { width: 30px; height: 30px; border-radius: 999px; border: 0; background: none; color: var(--cz-ink2); display: inline-flex; align-items: center; justify-content: center; flex: none; cursor: pointer; }
99
99
  .tkc .tkc-hu:hover { background: var(--cz-well); color: var(--cz-ink); }
100
100
  .tkc .seg .ivq-del:hover, .tkc .seg .ivq-del:focus-visible { color: var(--cz-red); background: var(--cz-redbg, transparent); }
101
+ /* one date (batch 18 item 16, StA4Milestone): a milestone's picker names its one day, with no Start and Due tabs */
102
+ .tkc .tkc-dp .one { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 4px; margin-bottom: 8px; font-size: var(--fs-3); color: var(--cz-ink); }
@@ -126,7 +126,10 @@ function picker(t, o, now) {
126
126
  const tom = (() => { const d = todayOf(now); d.setDate(d.getDate() + 1); return isoOf(d); })();
127
127
  const two = ['start', 'due'].map((f) => `<button type="button" data-tkc-field="${f}"${f === field ? ' class="on" aria-pressed="true"' : ' aria-pressed="false"'}><small>${f === 'start' ? 'Start' : 'Due'}</small><b>${esc(short(t[f]) || 'None')}</b></button>`).join('');
128
128
  const prevM = isoOf(new Date(y, m - 1, 1)).slice(0, 7), nextM = isoOf(new Date(y, m + 1, 1)).slice(0, 7);
129
- return `<div class="tkc-pop tkc-dp" role="dialog" aria-label="Start and due"><div class="two">${two}</div>`
129
+ // one date (batch 18 item 16, StA4Milestone): a milestone has its day only, so the Start and Due tabs give way to "◇ Date"; o.head: a
130
+ // sheet's own head (its title and ✕), drawn first
131
+ const top = o.one ? (o.head ? '' : `<div class="one">${ico('<path d="M12 4l8 8-8 8-8-8z"/>', 14)}<b>Date</b></div>`) : `<div class="two">${two}</div>`;
132
+ return `<div class="tkc-pop tkc-dp${o.one ? ' one' : ''}" role="dialog" aria-label="${o.one ? 'Date' : 'Start and due'}">${o.head || ''}${top}`
130
133
  + `<div class="qk"><button type="button" data-tkc-day="${today}">Today</button><button type="button" data-tkc-day="${tom}">Tomorrow</button><button type="button" data-tkc-day="${fri}">Fri</button>`
131
134
  + `<button type="button" data-tkc-day="" aria-label="Clear the ${field === 'start' ? 'start' : 'due'} date" title="Clear">${ico(I.clear, 14)}</button></div>`
132
135
  + `<div class="mh"><button type="button" class="tkc-ib s" data-tkc-month="${prevM}" aria-label="Previous month">${ico(I.prev, 16)}</button><span>${MONTHS[m]} ${y}</span><button type="button" class="tkc-ib s" data-tkc-month="${nextM}" aria-label="Next month">${ico(I.next, 16)}</button></div>`
@@ -40,6 +40,8 @@
40
40
  <span class="bd-vr bd-hide-s"></span>
41
41
  <button type="button" class="bd-ib" id="bdFind" aria-label="Find an initiative or work-item" title="Find an initiative or work-item" aria-haspopup="dialog"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M11 4a7 7 0 1 0 0 14a7 7 0 1 0 0-14M20 20l-4-4"/></svg></button>
42
42
  <button type="button" class="bd-ib bd-show-s" id="bdView" aria-label="Change view" title="Change view"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 5h18v4H3zM3 11h18v4H3zM3 17h12v3H3z"/></svg></button>
43
+ <!-- the timeline's columns (batch 19 item 5, StsA8Board): which show beside the names; a desktop timeline only -->
44
+ <span class="bd-grpw2" id="bdColsw" hidden><button type="button" class="bd-ib" id="bdCols" aria-haspopup="true" aria-expanded="false" aria-controls="bdColsMenu" aria-label="Columns" title="Columns"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16v14H4zM10 5v14M15 5v14"/></svg></button><span class="bd-grpm bd-colm" id="bdColsMenu" role="group" aria-labelledby="bdColsH" hidden></span></span>
43
45
  <button type="button" class="bd-ib" id="bdSort" data-so-btn aria-haspopup="menu" aria-label="Sort. Now: My order" title="Sort · My order"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 4v16M4 17l3 3 3-3M13 6h8M13 12h6M13 18h4"/></svg></button>
44
46
  <button type="button" class="bd-ib" id="bdFilter" aria-label="Filter by owner, kind or sprint" title="Filter by owner, kind or sprint" aria-haspopup="dialog"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16l-6 8v6l-4-2v-4z"/></svg></button>
45
47
  <button type="button" class="bd-ib bd-hide-s" id="bdBell" aria-label="Notifications" title="Notifications" aria-haspopup="dialog"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 16v-5a6 6 0 0 1 12 0v5l2 2H4zM10 21h4"/></svg></button>
@@ -114,17 +114,17 @@ const SPONSORS = '# Inline login slips to early December unless passkeys move to
114
114
  ok('D the ✦ line leads with what Claude handled, with Adler\'s face', !!d0 && d0.hd === '3 of 4 milestones hold their dates. I drafted the sponsor update for Thursday.' && d0.face, JSON.stringify(d0));
115
115
  const h1 = await head(p);
116
116
  ok('D the same icon now shows the list to go back, pressed', !!h1.toggle && h1.toggle.label === 'Show the work' && h1.toggle.pressed === 'true', JSON.stringify(h1));
117
- ok('D in the 560 px panel the blocks stack in one column', !!d0 && d0.cols === 1, JSON.stringify(d0));
117
+ ok('D in the panel beside the Board the blocks stack in one column', !!d0 && d0.cols === 1, JSON.stringify(d0));
118
118
  const ds = await sizes(p, '#czViewer .db');
119
119
  ok('S the Dashboard uses the type scale only', ds.length && ds.every((x) => SCALE.has(x)), ds.join());
120
120
  await shot(p, 'PbA2Prog-desk-built');
121
121
 
122
- /* ── W: wide ── */
123
- await p.click('#czViewer [data-cz-vw="wide"]');
122
+ /* ── W: wide (the Board's ⧉ Full screen, panels on Board and Intelligence: ⧉ took ⤢'s place) ── */
123
+ await p.click('#czViewer [data-cz-vw="place"]'); await p.click('.cz-pn-menu [data-cz-pn-place="full"]');
124
124
  const dw = await until(async () => { const d = await dash(p); return d && d.cols === 2 ? d : null; }, 4000);
125
125
  ok('W wide (PbA7): two columns, each block its own card', !!dw && dw.cols === 2, JSON.stringify(await dash(p)));
126
126
  await shot(p, 'PbA7Desk-built');
127
- await p.click('#czViewer [data-cz-vw="wide"]');
127
+ await p.click('#czViewer [data-cz-vw="place"]'); await p.click('.cz-pn-menu [data-cz-pn-place="split"]');
128
128
 
129
129
  /* ── N: Needs you ✓ ── */
130
130
  await p.click('#czViewer .db-need [data-db="needs"][data-k="keep"]');