create-pmos 0.328.0 → 0.330.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 (34) hide show
  1. package/package.json +227 -1
  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/briefing-premium-insights-test.js +56 -25
  7. package/workspace/briefing-premium-test.js +3 -1
  8. package/workspace/changelog.json +672 -0
  9. package/workspace/guide/briefing-premium.md +10 -8
  10. package/workspace/lib/insights-premium.js +111 -26
  11. package/workspace/lib/kit-update.js +57 -8
  12. package/workspace/lib/premium-dashboards.js +25 -5
  13. package/workspace/lib/routes-insights-premium.js +19 -4
  14. package/workspace/lib/routes-premium-dashboards.js +12 -1
  15. package/workspace/lib/settings-store.js +3 -1
  16. package/workspace/package-lock.json +2 -2
  17. package/workspace/package.json +1 -1
  18. package/workspace/premium-report-read-test.js +4 -2
  19. package/workspace/premium-studio-chart-test.js +3 -3
  20. package/workspace/premium-studio-report-test.js +1 -1
  21. package/workspace/premium-studio-test.js +4 -4
  22. package/workspace/premium-vw-cal-test.js +3 -1
  23. package/workspace/premium-vw-slides-test.js +8 -4
  24. package/workspace/public/pm/c3-settings.js +1 -1
  25. package/workspace/public/pm/premium-insights.css +52 -0
  26. package/workspace/public/pm/premium-insights.js +129 -50
  27. package/workspace/public/pm/premium-shell.js +137 -3
  28. package/workspace/public/pm/premium-vw-cal.css +66 -42
  29. package/workspace/public/pm/premium-vw-cal.js +38 -17
  30. package/workspace/public/pm/premium.css +22 -0
  31. package/workspace/public/pm/premium.js +1 -1
  32. package/workspace/public/premium-insights.html +29 -19
  33. package/workspace/server.js +7 -2
  34. package/workspace/test-run.js +2 -0
@@ -41,7 +41,7 @@ function tbMount() {
41
41
  + '<a role="menuitem" id="toConsole" href="/console.html" aria-label="Open the console">Console</a>'
42
42
  + '<div class="tbrow" id="modeRow" hidden><span>Open initiatives</span></div>'
43
43
  + `<div class="tbrow" role="group" aria-label="Theme"><span>Theme</span><span class="tbseg" id="tbTheme">${TH.map(([k, w]) => `<button role="menuitemradio" data-th="${k}" aria-checked="false">${w}</button>`).join('')}</span></div>`
44
- + '<button role="menuitem" id="settingsBtn" aria-haspopup="dialog">Settings</button></div></span>');
44
+ + '<button role="menuitem" id="settingsBtn" aria-haspopup="dialog">Settings<em class="updpill" id="updPill" hidden></em></button></div></span>');
45
45
  const ms = $('#modeSeg'); if (ms) { $('#modeRow').appendChild(ms); $('#modeRow').hidden = false; }
46
46
  tbTheme();
47
47
  const btn = $('#moreBtn'), menu = $('#moreMenu');
@@ -502,29 +502,163 @@ pvMount();
502
502
  * Workspaces: GET /api/workspaces · POST /api/workspaces, /api/workspaces/forget. Connectors: GET and POST /api/proactive/settings {briefSources}.
503
503
  * Each press saves what the console's section saves, and nothing else. Every other setting runs on a default and stays in the console. */
504
504
  const SRC = { calendar: 'Calendar', wispr: 'Wispr Flow', mail: 'Mail', slack: 'Slack', jira: 'Jira', confluence: 'Confluence', github: 'GitHub', drive: 'Google Drive', figma: 'Figma', website: 'Your websites' };
505
+
506
+ /* ── Updates and What's new (initiative premium-updates) ──────────────────────────────────────────────────────────────────────
507
+ * GET /api/kit/status per workspace (versions, the installed changelog, the last check, the daily setting; disk only).
508
+ * POST /api/kit/check (the npm registry: the latest version and the newer kits' summaries), /api/kit/update, /api/kit/upgrade-app:
509
+ * the presses the console's Settings › Updates makes. Once a day an open page posts the check by itself (upd.check, default daily).
510
+ * Every summary is a line kit-publish copied from a merged PR; this page writes none. */
511
+ const UPD = { ws: [], st: {} };
512
+ const cmpVer = (a, b) => { const x = String(a || '0').split('-')[0].split('.').map(Number), y = String(b || '0').split('-')[0].split('.').map(Number); for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) < (y[i] || 0) ? -1 : 1; return 0; };
513
+ const updHome = () => (UPD.ws[0] && UPD.st[UPD.ws[0].id]) || null;
514
+ const updLatest = () => { const s = updHome(); return (s && (s.latest || (s.lastCheck && s.lastCheck.latest))) || null; };
515
+ const updGit = () => { const s = updHome(); return !!(s && s.app && s.app.fromCheckout && !(s.source && s.source.kind === 'local')); };
516
+ const updKitsBehind = () => UPD.ws.filter((w) => UPD.st[w.id] && UPD.st[w.id].kitBehind);
517
+ const updAppBehind = () => { const s = updHome(); return !!(s && s.appBehind && !updGit()); };
518
+ const updReady = () => updAppBehind() || updKitsBehind().length > 0;
519
+ function updDot() {
520
+ const on = updReady(), d = $('#moreDot'), p = $('#updPill');
521
+ if (d) d.hidden = !on;
522
+ if (p) { p.hidden = !on; p.textContent = on ? updLatest() + ' ready' : ''; }
523
+ const b = $('#settingsBtn'); if (b) b.setAttribute('aria-label', on ? 'Settings, PMOS ' + updLatest() + ' is ready' : 'Settings');
524
+ }
525
+ async function updRead() {
526
+ const w = await pmGet('/api/workspaces');
527
+ UPD.ws = w && Array.isArray(w.workspaces) ? w.workspaces : [];
528
+ await Promise.all(UPD.ws.map(async (x) => { const r = await pmGet('/api/kit/status?ws=' + encodeURIComponent(x.id)); if (r && r.ok) UPD.st[x.id] = r; }));
529
+ updDot();
530
+ }
531
+ /** The check, for every workspace: one registry read each, as the console's Check now. Returns the first error, or ''. */
532
+ async function updCheck() {
533
+ let err = '';
534
+ for (const w of UPD.ws) {
535
+ const r = await pmPost('/api/kit/check', { ws: w.id });
536
+ if (r && r.ok) UPD.st[w.id] = { ...(UPD.st[w.id] || {}), ...r }; else if (!err) err = (r && r.error) || 'The check failed.';
537
+ }
538
+ updDot();
539
+ return err;
540
+ }
541
+ /** On every page: read the versions; once a day (the default) ask the registry when the last check is a day old. */
542
+ (async () => {
543
+ if (!$('#settingsBtn')) return;
544
+ await updRead();
545
+ const s = updHome();
546
+ if (s && s.checkDaily && !document.hidden && (!s.lastCheck || Date.now() - Date.parse(s.lastCheck.at) > 864e5)) await updCheck();
547
+ })();
548
+ /** Installed entries and the newer ones the check read, newest first, one per version. */
549
+ function updList() {
550
+ const s = updHome(); if (!s) return [];
551
+ const all = new Map();
552
+ for (const e of [...((s.lastCheck && s.lastCheck.changes) || []), ...(s.latestChanges || []), ...(s.changes || [])]) if (e && e.v && !all.has(e.v)) all.set(e.v, e);
553
+ return [...all.values()].sort((a, b) => cmpVer(b.v, a.v));
554
+ }
555
+ const pad2 = (n) => String(n).padStart(2, '0');
556
+ const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
557
+ function updDay(iso) {
558
+ const d = iso ? new Date(iso) : null; if (!d || isNaN(d)) return 'Date not recorded';
559
+ const t = new Date(); const y = new Date(t); y.setDate(t.getDate() - 1);
560
+ const dm = d.getDate() + ' ' + MON[d.getMonth()];
561
+ return d.toDateString() === t.toDateString() ? 'Today, ' + dm : d.toDateString() === y.toDateString() ? 'Yesterday, ' + dm : DOW[d.getDay()] + ' ' + dm;
562
+ }
563
+ const updTime = (iso) => { const d = iso ? new Date(iso) : null; return d && !isNaN(d) ? pad2(d.getHours()) + ':' + pad2(d.getMinutes()) : ''; };
564
+ function updWhatsNew(U) {
565
+ const list = updList(), s = updHome(), mine = s && s.app && !updGit() ? s.app.version : null; // a checkout has no published version
566
+ if (!list.length) return '<p class="note">No kit summaries yet. Each kit published from now on carries one, and Check now reads the newest ones.</p>';
567
+ const days = []; for (const e of list) { const k = updDay(e.at); const g = days[days.length - 1]; if (g && g.k === k) g.e.push(e); else days.push({ k, e: [e] }); }
568
+ return days.map((g, i) => {
569
+ const open = U.open.has(g.k) || (i === 0 && !U.shut.has(g.k)), full = U.full.has(g.k);
570
+ const rows = open ? g.e.slice(0, full ? g.e.length : 5).map((e) => {
571
+ const newer = mine && cmpVer(e.v, mine) > 0, yours = mine && e.v === mine;
572
+ const lines = e.prs.length ? e.prs.map((p) => `<p>${esc(p.s)}${p.n ? ` <em>#${esc(p.n)}</em>` : ''}</p>`).join('') : '<p class="note">No summary was recorded for this kit.</p>';
573
+ return `<li class="kver${newer ? ' new' : ''}"><span class="kv"><b>${esc(e.v)}</b>${yours ? '<i>yours</i>' : newer ? '<i class="nw">newer</i>' : ''}<em>${esc(updTime(e.at))}</em></span><div class="kp">${lines}</div></li>`;
574
+ }).join('') : '';
575
+ const more = open && !full && g.e.length > 5 ? `<button type="button" class="kmore" data-kfull="${esc(g.k)}">Show ${g.e.length - 5} more from ${esc(g.k.split(',')[0])}</button>` : '';
576
+ return `<div class="kday"><button type="button" class="kdh" data-kday="${esc(g.k)}" aria-expanded="${open}"><span>${esc(g.k)}</span><em>${g.e.length} ${g.e.length === 1 ? 'kit' : 'kits'}</em></button>${open ? `<ul class="kvl">${rows}</ul>${more}` : ''}</div>`;
577
+ }).join('');
578
+ }
579
+ function updBlock(U) {
580
+ const s = updHome();
581
+ if (!s) return '<p class="note">Reading the versions.</p>';
582
+ const app = (s.app && s.app.version) || '?', latest = updLatest(), kits = updKitsBehind(), appB = updAppBehind(), ready = appB || kits.length > 0;
583
+ const head = U.phase === 'busy' ? `<b>Updating to ${esc(latest)}</b><span class="note" role="status" aria-live="polite">${esc(U.say || 'Working.')}</span>`
584
+ : ready ? `<b>PMOS ${esc(latest)} is ready</b><span class="note">You have ${esc(app)}.${appB ? ' PMOS stops for about a minute while it installs. Open terminals keep running.' : ''}</span>`
585
+ : latest ? `<b>PMOS ${esc(app)} is up to date</b><span class="note">${updGit() && s.appBehind ? esc(latest) + ' is published. This PMOS runs from a checkout: update it with git pull.' : 'The newest published kit is ' + esc(latest) + '.'}</span>`
586
+ : `<b>PMOS ${esc(app)}</b><span class="note">Press Check now to ask for the latest version.</span>`;
587
+ const acts = U.phase === 'busy' ? '' : U.phase === 'confirm'
588
+ ? '<button type="button" class="cta alt" data-upd="cancel">Cancel</button><button type="button" class="cta" data-upd="go">Restart and update</button>'
589
+ : `<button type="button" class="cta alt" data-upd="check"${U.checking ? ' disabled' : ''}>${U.checking ? 'Checking…' : 'Check now'}</button>${ready ? '<button type="button" class="cta" data-upd="update">Update</button>' : ''}`;
590
+ const rows = UPD.ws.map((w) => { const k = UPD.st[w.id], kit = k && k.kit;
591
+ const tag = !k || !(kit && kit.present) ? '' : k.kitBehind && latest ? `<b class="updpill">${esc(latest)} ready</b>` : k.lastCheck || k.latest ? '<b class="updpill ok">Up to date</b>' : '';
592
+ return `<div class="sr"><span class="sn"><b>${esc(w.label || w.name || w.id)}</b><em>${kit && kit.present ? 'kit ' + esc(kit.version || 'vendored by hand') : 'no kit in this workspace'}${w.root ? ' · ' + esc(w.root) : ''}</em></span>${tag}</div>`; }).join('');
593
+ const last = s.lastCheck ? 'Last checked ' + updDay(s.lastCheck.at).replace(/^Today, .*/, 'today').replace(/^Yesterday, .*/, 'yesterday') + ' at ' + updTime(s.lastCheck.at) + '. ' : '';
594
+ return `<div class="updb"><div class="t">${head}</div><div class="a">${acts}</div></div>${rows}
595
+ <p class="note">${esc(last)}${s.checkDaily ? 'PMOS checks once a day while a page is open; Check now asks again.' : 'PMOS checks only when you press Check now.'}</p>`;
596
+ }
597
+ /** The app update stops this server and starts a new one: wait for it, then reload (the console's waitForRestart). */
598
+ async function updWaitRestart(from, log, say) {
599
+ let down = false; const until = Date.now() + 5 * 60000;
600
+ while (Date.now() < until) {
601
+ await new Promise((r) => setTimeout(r, 2000));
602
+ const j = await pmGet('/api/sessions').catch(() => null);
603
+ if (!j || j.ok === false || !j.version) { down = true; continue; }
604
+ if (j.version !== from) { location.reload(); return; }
605
+ if (down) { say('PMOS started again on ' + j.version + ', so the update did not finish. The update log is ' + log + '.'); return; }
606
+ }
607
+ say('PMOS did not come back on this address. Type pmos in a terminal to open it. The update log is ' + log + '.');
608
+ }
609
+
505
610
  export async function openSettings() {
506
611
  const M = { ws: null, src: null, err: '', busy: false };
612
+ const U = { phase: null, say: '', checking: false, open: new Set(), shut: new Set(), full: new Set() };
507
613
  const draw = () => {
508
614
  const w = M.ws, s = M.src;
509
615
  const wsRows = w === null ? '<p class="note">Reading the repositories.</p>' : w.length ? w.map((x) => `<div class="sr"><span class="sn"><b>${esc(x.label || x.name || x.id)}</b><em>${esc(x.root || '')}${x.home ? ' · home' : ''}</em></span>${x.home ? '' : `<button type="button" class="cta alt" data-rm="${esc(x.id)}">Remove</button>`}</div>`).join('') : '<p class="note">No repository is registered yet.</p>';
510
616
  const srcRows = s === null ? '<p class="note">Reading the sources.</p>' : Object.keys(SRC).filter((k) => k in s).map((k) => `<div class="sr"><span class="sn"><b>${esc(SRC[k])}</b><em>${s[k] ? 'The Briefing reads it' : 'The Briefing does not read it'}</em></span><button type="button" class="fchip" role="switch" aria-checked="${s[k]}" aria-label="${esc(SRC[k])}: the Briefing reads it" data-src="${esc(k)}">${s[k] ? 'On' : 'Off'}</button></div>`).join('');
511
617
  $('#oMain').innerHTML = `<article class="paper doc"><div class="addf">
618
+ <div data-upd-block><span class="label">Updates</span>${updBlock(U)}</div>
619
+ <div data-whats-new><span class="label">What's new</span>${updWhatsNew(U)}</div>
512
620
  <div><span class="label">Workspaces</span><p class="note" style="margin:0 0 8px">A workspace is one repository PMOS works in. Removing one forgets the address only; the folder is not deleted.</p>${wsRows}
513
621
  <div class="two" style="margin-top:10px"><label><input id="stP" maxlength="500" placeholder="Folder path of a repository" aria-label="Folder path of a repository"></label><button type="button" class="cta" id="stAdd">Add repository</button></div></div>
514
622
  <div><span class="label">Connectors</span><p class="note" style="margin:0 0 8px">Which sources the Briefing reads. PMOS keeps no passwords or keys; your Claude session reaches each tool through its own connectors.</p>${srcRows}</div>
515
623
  <p class="note" id="stM" role="status" style="margin:0;min-height:1.2em">${esc(M.err)}</p>
516
624
  <p class="note" style="margin:0">Everything else runs on a default. <a href="/console.html?tab=settings">More settings in the console</a>.</p></div></article>`;
517
625
  };
518
- openDlg({ eye: 'Settings · real data', title: 'Settings', say: 'Two choices only: which repositories PMOS works in, and which sources the Briefing reads.', stream: turnA(ptx('Two choices only: which repositories PMOS works in, and which sources the Briefing reads. Each press saves that one record and changes nothing else.')), noteKey: null, pane: '<article class="paper doc"></article>', label: 'Settings' });
626
+ openDlg({ eye: 'Settings · real data', title: 'Settings', say: 'Updates and what each kit changed, then two choices: which repositories PMOS works in, and which sources the Briefing reads.', stream: turnA(ptx('Updates and what each published kit changed, copied from its merged pull requests. Then two choices: which repositories PMOS works in, and which sources the Briefing reads. Each press saves that one record and changes nothing else.')), noteKey: null, pane: '<article class="paper doc"></article>', label: 'Settings' });
519
627
  $('#askF').hidden = true; setMode('detail'); draw();
520
628
  const load = async () => {
521
- const [w, p] = await Promise.all([pmGet('/api/workspaces'), pmGet('/api/proactive/settings')]);
629
+ const [w, p] = await Promise.all([pmGet('/api/workspaces'), pmGet('/api/proactive/settings'), updRead()]);
522
630
  M.ws = w && Array.isArray(w.workspaces) ? w.workspaces : []; M.src = p && p.ok && p.settings ? { ...p.settings.briefSources } : {};
523
631
  if (!w || !Array.isArray(w.workspaces)) M.err = 'The repositories could not be read.'; else if (!p || !p.ok) M.err = 'The sources could not be read.';
524
632
  draw();
525
633
  };
634
+ const say = (t) => { U.phase = null; M.err = t; draw(); };
526
635
  $('#oMain').onclick = async (e) => {
527
636
  if (M.busy) return;
637
+ const day = e.target.closest('[data-kday]'), full = e.target.closest('[data-kfull]'), up = e.target.closest('[data-upd]');
638
+ if (day) { const k = day.dataset.kday, was = day.getAttribute('aria-expanded') === 'true'; if (was) { U.open.delete(k); U.shut.add(k); } else { U.open.add(k); U.shut.delete(k); } draw(); const b = $(`#oMain [data-kday="${CSS.escape(k)}"]`); if (b) b.focus(); return; }
639
+ if (full) { U.full.add(full.dataset.kfull); draw(); return; }
640
+ if (up) {
641
+ const a = up.dataset.upd; M.err = '';
642
+ if (a === 'check') { U.checking = true; draw(); const err = await updCheck(); U.checking = false; M.err = err; draw(); if (!err) toast(updReady() ? 'PMOS ' + updLatest() + ' is ready' : 'Checked. PMOS is up to date'); return; }
643
+ if (a === 'cancel') { U.phase = null; draw(); return; }
644
+ if (a === 'update' && updAppBehind()) { U.phase = 'confirm'; draw(); return; }
645
+ if (a === 'update' || a === 'go') {
646
+ const v = updLatest(), home = updHome(); U.phase = 'busy';
647
+ for (const w of updKitsBehind()) {
648
+ U.say = 'Updating the kit in ' + (w.label || w.name || w.id) + '.'; draw();
649
+ const r = await pmPost('/api/kit/update', { ws: w.id, version: v });
650
+ if (!(r && r.ok)) return say((r && r.error) || 'The kit in ' + (w.label || w.name || w.id) + ' was not updated.');
651
+ UPD.st[w.id] = { ...UPD.st[w.id], ...r, kitBehind: false };
652
+ }
653
+ updDot();
654
+ if (!updAppBehind()) { U.phase = null; draw(); toast('Updated the kits to ' + v + '.'); return; }
655
+ U.say = 'Installing PMOS ' + v + '. This page reloads when the new version starts.'; draw();
656
+ const r = await pmPost('/api/kit/upgrade-app', { ws: UPD.ws[0].id, version: v });
657
+ if (!r || r.ok === false) return say((r && r.error) || 'The update did not start.');
658
+ await updWaitRestart(r.from || (home.app && home.app.version) || '', r.log || '', say);
659
+ }
660
+ return;
661
+ }
528
662
  const rm = e.target.closest('[data-rm]'), sw = e.target.closest('[data-src]');
529
663
  M.err = '';
530
664
  if (rm) {
@@ -12,7 +12,7 @@
12
12
  .vc .vc-w{background:var(--card-solid);border:1px solid var(--hair);border-radius:8px;box-shadow:var(--card-shadow);overflow:hidden}
13
13
  .vc .vc-h{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--hair);flex-wrap:wrap}
14
14
  .vc .vc-t{font-size:var(--fs-3);font-weight:600;color:var(--ink)}
15
- .vc .vc-cap{flex:1;min-width:0;font:400 var(--fs-2) var(--mono);color:var(--ink-3)}
15
+ .vc .vc-cap{flex:1 0 auto;font:400 var(--fs-2) var(--mono);color:var(--ink-3);white-space:nowrap}
16
16
  .vc .vc-ib{width:36px;height:36px;border-radius:6px;display:grid;place-items:center;background:var(--well);color:var(--ink)}
17
17
  .vc .vc-ib .i{width:16px;height:16px}
18
18
  .vc .vc-tdy{min-height:36px;padding:0 12px;border-radius:6px;border:1px solid var(--hair);font-size:var(--fs-2);font-weight:500;color:var(--ink)}
@@ -22,28 +22,48 @@
22
22
  .vc button:focus-visible{outline:2px solid var(--ember);outline-offset:2px}
23
23
  .vc .vc-empty{margin:0;padding:12px 14px;font-size:var(--fs-2);color:var(--ink-3);border-bottom:1px solid var(--hair)}
24
24
  .vc .vc-w>.vc-empty:last-child{border-bottom:0}
25
- /* the timeline (Day and Week) */
25
+ /* the timeline (Day and Week), as the console's Calendar draws it (console3.css .cal3-tg): 46px an hour, every hour labelled */
26
+ .vc{--vc-ev:color-mix(in oklab,var(--ember) 30%,var(--card-solid));--vc-evh:color-mix(in oklab,var(--ember) 42%,var(--card-solid));--vc-we:color-mix(in oklab,var(--well) 70%,transparent);--vc-now:color-mix(in oklab,var(--ember) 9%,transparent)}
27
+ .vc .vc-sx{overflow-x:auto;min-width:0}
26
28
  .vc .vc-g{display:grid;grid-template-columns:48px repeat(var(--tl-n),minmax(0,1fr))}
27
- .vc .vc-dh{padding:8px 6px 6px;font-size:var(--fs-2);color:var(--ink-3);border-left:1px solid var(--hair);text-align:center}
28
- .vc .vc-dh b{display:grid;place-items:center;margin:2px auto 0;width:30px;height:30px;border-radius:6px;font-size:var(--fs-4);font-weight:600;color:var(--ink)}
29
- .vc .vc-dh.now b{background:var(--solid);color:var(--on-solid)}
30
- .vc .vc-adl{border-top:1px solid var(--hair);font:400 var(--fs-1) var(--mono);color:var(--ink-3);padding:6px 4px 0;text-align:right}
31
- .vc .vc-adc{min-height:28px;border-left:1px solid var(--hair);border-top:1px solid var(--hair);padding:3px;display:grid;gap:2px;align-content:start}
32
- .vc .vc-ad{display:block;min-width:0;border-radius:6px;padding:1px 6px;font-size:var(--fs-1);font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left;
33
- border-left:3px solid var(--ec,var(--ember));background:color-mix(in oklab,var(--ec,var(--ember)) 12%,transparent);color:var(--ink)}
34
- .vc .vc-ad.meet{--ec:var(--sky)}
29
+ .vc .vc-g:not(.one){min-width:620px}
30
+ .vc .vc-dh{display:grid;gap:4px;align-content:start;min-width:0;padding:6px 4px 4px;border-left:1px solid var(--hair);border-bottom:1px solid var(--hair)}
31
+ .vc .vc-c{border-bottom:1px solid var(--hair)}
32
+ .vc .vc-dl{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:0 6px;min-width:0}
33
+ .vc .vc-dl b,.vc .vc-db{font:500 var(--fs-2) var(--mono);color:var(--ink);white-space:nowrap}
34
+ .vc .vc-db{min-height:24px;padding:2px 4px;border-radius:6px;text-align:left}
35
+ .vc .vc-dh.now .vc-dl b,.vc .vc-dh.now .vc-db{color:var(--ember-ink)}
36
+ .vc .vc-hrs{font:400 var(--fs-1) var(--mono);color:var(--ink-3);white-space:nowrap}
37
+ .vc .vc-lb{display:flex;gap:2px;height:5px;margin:0 4px}
38
+ .vc .vc-lb i{display:block;border-radius:0;background:var(--well)}
39
+ .vc .vc-lb i.tied{width:var(--tl-a,0);background:var(--ember)}
40
+ .vc .vc-lb i.rt{width:var(--tl-b,0);background:var(--ink-3)}
41
+ .vc .vc-lb::after{content:"";flex:1;background:var(--well)}
42
+ .vc .vc-adl{font:400 var(--fs-1) var(--mono);color:var(--ink-3);padding:6px 4px;border-bottom:1px solid var(--hair)}
43
+ .vc .vc-sc{min-width:0;min-height:30px;padding:3px;display:grid;gap:2px;align-content:start;border-left:1px solid var(--hair);border-bottom:1px solid var(--hair)}
44
+ .vc .vc-sc.line{display:flex;flex-wrap:wrap;align-items:center;gap:4px}
45
+ .vc .vc-sc.line .vc-ad{max-width:280px}
46
+ .vc .vc-sc.we,.vc .vc-dh.we{background:var(--vc-we)}
47
+ .vc .vc-none{padding:4px;font:400 var(--fs-1) var(--mono);color:var(--ink-3)}
48
+ .vc .vc-ad{display:block;min-width:0;min-height:22px;border-radius:6px;padding:2px 6px;font-size:var(--fs-1);font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left;
49
+ border-left:3px solid var(--ec,var(--ink-3));background:var(--well);color:var(--ink)}
50
+ .vc .vc-ad.meet{border-left-color:var(--ember);background:var(--vc-ev);font-weight:600}
35
51
  .vc .vc-ad.t-warn{--ec:var(--ember)}.vc .vc-ad.t-bad{--ec:var(--bad)}.vc .vc-ad.t-ok{--ec:var(--ok)}
36
- .vc .vc-gut{border-top:1px solid var(--hair);font:400 var(--fs-1) var(--mono);color:var(--ink-3)}
37
- .vc .vc-gut i{display:block;height:44px;font-style:normal;text-align:right;padding-right:6px;transform:translateY(-7px)}
38
- .vc .vc-gut i:first-child{visibility:hidden}
39
- .vc .vc-day{position:relative;height:var(--tl-hh);border-left:1px solid var(--hair);border-top:1px solid var(--hair);background:repeating-linear-gradient(to bottom,transparent 0 43px,var(--hair) 43px 44px)}
40
- .vc .vc-day.past{background-color:color-mix(in oklab,var(--well) 40%,transparent)}
41
- .vc .vc-ev{position:absolute;top:var(--tl-t);height:var(--tl-h);left:calc(var(--tl-l) + 3px);width:calc(var(--tl-w) - 6px);border-radius:6px;padding:3px 7px;font-size:var(--fs-1);line-height:1.3;overflow:hidden;text-align:left;
42
- border-left:3px solid var(--sky);background:color-mix(in oklab,var(--sky) 14%,var(--card-solid));color:var(--ink);z-index:1}
43
- .vc .vc-ev b{display:block;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
44
- .vc .vc-ev small{display:block;font-size:var(--fs-1);color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
45
- .vc .vc-ev.sh{padding:0 7px;display:flex;align-items:center}.vc .vc-ev.sh small{display:none}
46
- .vc .vc-ev.past{opacity:.7}
52
+ .vc .vc-more{justify-self:start;min-height:20px;padding:0 6px;border-radius:6px;font:400 var(--fs-1) var(--mono);color:var(--ink-3)}
53
+ .vc .vc-gut{position:relative;height:var(--tl-hh)}
54
+ .vc .vc-gut i{position:absolute;top:var(--tl-t);right:6px;font:400 var(--fs-1) var(--mono);font-style:normal;color:var(--ink-3);line-height:1;padding-top:3px}
55
+ .vc .vc-day{position:relative;height:var(--tl-hh);border-left:1px solid var(--hair);background-image:repeating-linear-gradient(to bottom,var(--hair) 0 1px,transparent 1px 46px)}
56
+ .vc .vc-day.we{background-color:var(--vc-we)}
57
+ .vc .vc-day.now{background-color:var(--vc-now)}
58
+ .vc .vc-ev{position:absolute;top:var(--tl-t);height:var(--tl-h);left:calc(2px + (100% - 4px) * var(--tl-l) / var(--tl-lc));width:calc((100% - 4px) / var(--tl-lc) - 2px);
59
+ display:block;border-radius:6px;padding:3px 6px;font-size:var(--fs-2);line-height:1.3;overflow:hidden;white-space:nowrap;text-align:left;
60
+ background:var(--vc-ev);color:var(--ink);box-shadow:inset 3px 0 0 var(--ember);z-index:1}
61
+ .vc .vc-ev b{display:block;font-weight:600;overflow:hidden;text-overflow:ellipsis}
62
+ .vc .vc-ev small{display:block;font:400 var(--fs-1) var(--mono);color:var(--ink-2);overflow:hidden;text-overflow:ellipsis}
63
+ .vc .vc-ev.rt{background:var(--well);color:var(--ink-2);box-shadow:inset 3px 0 0 var(--ink-3)}
64
+ .vc .vc-ev.rt b{font-weight:500}
65
+ .vc .vc-ev.sh{padding:1px 6px;font-size:var(--fs-1)}
66
+ .vc .vc-ev.past{opacity:.55}
47
67
  .vc .vc-now{position:absolute;top:var(--tl-t);left:0;right:0;height:2px;background:var(--bad);z-index:2;pointer-events:none}
48
68
  .vc .vc-now::before{content:"";position:absolute;left:-4px;top:-3px;width:8px;height:8px;border-radius:6px;background:var(--bad)}
49
69
  /* the day list (Day and Week in a narrow pane) */
@@ -53,44 +73,48 @@
53
73
  .vc .vc-ag h4.now{color:var(--ember-ink)}
54
74
  .vc .vc-ag>.vc-ad{margin:2px 10px}
55
75
  .vc .vc-ar{display:flex;gap:10px;align-items:baseline;width:calc(100% - 20px);min-height:44px;margin:3px 10px;padding:8px 10px;border-radius:8px;text-align:left;
56
- border-left:3px solid var(--sky);background:color-mix(in oklab,var(--sky) 12%,transparent);color:var(--ink);font-size:var(--fs-3)}
76
+ box-shadow:inset 3px 0 0 var(--ember);background:var(--vc-ev);color:var(--ink);font-size:var(--fs-3)}
57
77
  .vc .vc-ar time{width:48px;flex:none;font:400 var(--fs-2) var(--mono);color:var(--ink-2)}
58
78
  .vc .vc-ar span{min-width:0}
59
79
  .vc .vc-ar b{display:block;font-weight:500}
60
80
  .vc .vc-ar small{display:block;font-size:var(--fs-2);color:var(--ink-3)}
81
+ .vc .vc-ar.rt{background:var(--well);box-shadow:inset 3px 0 0 var(--ink-3)}
61
82
  .vc .vc-ar.past{opacity:.7}
62
83
  .vc .vc-none{margin:0;padding:4px 14px 10px;font-size:var(--fs-2);color:var(--ink-3)}
63
- @container (max-width:559px){.vc .vc-g{display:none}.vc .vc-ag{display:block;padding-bottom:8px}}
64
- /* the month */
65
- .vc .vc-mh{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border-bottom:1px solid var(--hair)}
66
- .vc .vc-mh span{padding:6px 8px;font:400 var(--fs-1) var(--mono);text-transform:uppercase;letter-spacing:.06em;color:var(--ink-3)}
67
- .vc .vc-mb{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}
68
- .vc .vc-md{min-width:0;min-height:96px;padding:4px;border-left:1px solid var(--hair);border-top:1px solid var(--hair);display:flex;flex-direction:column;gap:2px}
69
- .vc .vc-md:nth-child(7n+1){border-left:0}
70
- .vc .vc-md:nth-child(-n+7){border-top:0}
71
- .vc .vc-md.out{background:color-mix(in oklab,var(--well) 50%,transparent)}
72
- .vc .vc-md.out .vc-dn b{color:var(--ink-3)}
73
- .vc .vc-dn{display:flex;align-items:center;gap:6px;min-height:28px;padding:0 4px;border-radius:6px;text-align:left}
74
- .vc .vc-dn b{display:grid;place-items:center;min-width:24px;height:24px;border-radius:6px;font-size:var(--fs-2);font-weight:600;color:var(--ink)}
75
- .vc .vc-md.now .vc-dn b{background:var(--solid);color:var(--on-solid)}
76
- .vc .vc-dn i{display:none;font-style:normal;font:500 var(--fs-1) var(--mono);color:var(--ink-3)}
77
- .vc .vc-me{display:block;min-width:0;border-radius:6px;padding:2px 6px;font-size:var(--fs-1);line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left;color:var(--ink);
78
- background:color-mix(in oklab,var(--sky) 12%,transparent)}
84
+ @container (max-width:559px){.vc .vc-sx:has(.vc-g:not(.one)){display:none}.vc .vc-ag{display:block;padding-bottom:8px}}
85
+ /* the month, as the console draws it (console3.css .cal3-mg): a card per day, the weekend muted, today outlined */
86
+ .vc .vc-mg{padding:8px}
87
+ .vc .vc-mh{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;padding-bottom:4px}
88
+ .vc .vc-mh span{padding:2px 8px;font:400 var(--fs-1) var(--mono);text-transform:uppercase;letter-spacing:.06em;color:var(--ink-3)}
89
+ .vc .vc-mb{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}
90
+ .vc .vc-md{min-width:0;min-height:96px;padding:4px;border:1px solid var(--hair);border-radius:8px;display:flex;flex-direction:column;gap:2px;background:var(--card-solid)}
91
+ .vc .vc-md:nth-child(7n+6),.vc .vc-md:nth-child(7n){background:var(--vc-we)}
92
+ .vc .vc-md.out{opacity:.55}
93
+ .vc .vc-md.now{border-color:var(--ember);box-shadow:inset 0 0 0 1px var(--ember)}
94
+ .vc .vc-dn{display:flex;align-items:center;gap:6px;min-height:24px;padding:0 4px;border-radius:6px;text-align:left}
95
+ .vc .vc-dn b{font:500 var(--fs-2) var(--mono);color:var(--ink)}
96
+ .vc .vc-md.now .vc-dn b{color:var(--ember-ink)}
97
+ .vc .vc-dn i{font-style:normal;font:400 var(--fs-1) var(--mono);color:var(--ink-3)}
98
+ .vc .vc-me{display:block;min-width:0;min-height:20px;border-radius:6px;padding:1px 6px;font-size:var(--fs-1);font-weight:500;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left;color:var(--ink);
99
+ background:var(--vc-ev);box-shadow:inset 3px 0 0 var(--ember)}
79
100
  .vc .vc-me time{font:400 var(--fs-1) var(--mono);color:var(--ink-2);margin-right:4px}
80
101
  .vc .vc-md>.vc-ad{font-size:var(--fs-1)}
81
- .vc .vc-more{align-self:flex-start;padding:1px 6px;border-radius:6px;font-size:var(--fs-1);font-weight:500;color:var(--ink-3)}
102
+ .vc .vc-md>.vc-more{align-self:flex-start}
82
103
  @container (max-width:559px){
104
+ .vc .vc-mg{padding:4px}.vc .vc-mb,.vc .vc-mh{gap:2px}
83
105
  .vc .vc-md{min-height:48px;padding:2px}
84
106
  .vc .vc-md>.vc-me,.vc .vc-md>.vc-more,.vc .vc-md>.vc-ad{display:none}
85
107
  .vc .vc-dn{flex:1;flex-direction:column;justify-content:center;gap:2px;min-height:44px;padding:0}
86
108
  .vc .vc-dn i{display:block}
109
+ .vc .vc-dn b{font-size:var(--fs-2)}
87
110
  .vc .vc-mh span{padding:6px 2px;text-align:center}
88
111
  }
89
- @media (max-width:640px){.vc-open,.vc .vc-ib{width:44px;height:44px}.vc .vc-tdy,.vc .vc-seg button{min-height:44px}}
112
+ @media (max-width:640px){.vc-open,.vc .vc-ib{width:44px;height:44px}.vc .vc-tdy,.vc .vc-seg button,.vc .vc-db,.vc .vc-more,.vc .vc-ad{min-height:44px}.vc .vc-ad{padding-block:0;line-height:44px}}
90
113
  @media (hover:hover){
91
114
  .vc-open:hover{color:var(--ink)}
92
- .vc .vc-ev:hover{background:color-mix(in oklab,var(--sky) 24%,var(--card-solid))}
115
+ .vc .vc-ev:hover,.vc .vc-ad.meet:hover,.vc .vc-me:hover,.vc .vc-ar:hover{background:var(--vc-evh)}
116
+ .vc .vc-ev.rt:hover{background:color-mix(in oklab,var(--ink) 8%,var(--well))}
117
+ .vc .vc-db:hover{background:var(--well)}
93
118
  .vc .vc-dn:hover{background:var(--well)}
94
- .vc .vc-me:hover{background:color-mix(in oklab,var(--sky) 22%,transparent)}
95
119
  .vc .vc-more:hover{color:var(--ink);background:var(--well)}
96
120
  }
@@ -3,7 +3,10 @@
3
3
  * Meetings come from the answer's cells; the all-day row also carries the answer's dated layers (an initiative's promised date, a plan item,
4
4
  * a release, a report, your own due items). Nothing is invented: a range with no meeting says so, and a calendar that did not answer says why.
5
5
  * Pressing a meeting opens its detail (premium-meeting.js openRow, the meeting dialog of slice S3) with the calendar as a tab beside it.
6
- * The mockup is the iteration-3 calendar of prototype/premium-conversation-shell/index.html (.calw, .cg, .ev, .agd).
6
+ * The grid follows the console's Calendar (pm/c3-calendar.js timeGrid and monthGrid): 46px an hour from 08:00 (or the earliest meeting) to 18:00
7
+ * (or the latest), every hour labelled; a day head with the day, its meeting hours and a load bar; a "dates" row of all-day meetings and dated
8
+ * marks, four a day in a week and a "+N" that opens the day; overlapping meetings side by side in lanes; a routine meeting (a stand-up, a 1:1,
9
+ * or one tied to no initiative, prep or record) drawn muted. A week is at least 620px wide and scrolls sideways in a narrower pane.
7
10
  * calModel(r, view, date, today) pure · calHtml(M, esc) pure · mountCal(el, st, d) · openCalendar(d, st?) */
8
11
  import { weekView } from './premium-meeting.js';
9
12
  import { vwOpen, vwShow, vwStyle } from './premium-viewer.js';
@@ -20,6 +23,10 @@ const wd = (k) => { const [y, m, d] = parts(k); return (new Date(Date.UTC(y, m -
20
23
  const hasTime = (s) => /T\d{2}:\d{2}/.test(String(s || ''));
21
24
  const minOf = (s) => Number(String(s).slice(11, 13)) * 60 + Number(String(s).slice(14, 16)); // the wall clock as written, like premium-meeting.js hhmm
22
25
  const hh = (m) => `${pad(Math.floor(m / 60))}:${pad(m % 60)}`;
26
+ const PPH = 46; // pixels an hour, the console's PPH_PAGE
27
+ const DAY_LOAD = 6; // the load bar's scale, in hours (c3-calendar.js)
28
+ const STRIP_WEEK = 4, STRIP_DAY = 12; // dates shown in a day's strip before "+N"
29
+ const ROUTINE = /stand-?up|\b1\s*[:/-]\s*1\b|one[- ]on[- ]one/i;
23
30
  export const todayKey = () => { const t = new Date(); return `${t.getFullYear()}-${pad(t.getMonth() + 1)}-${pad(t.getDate())}`; };
24
31
 
25
32
  /** The date one step before (-1) or after (1) `date` in `view`. */
@@ -63,6 +70,10 @@ export function calModel(r, view, date, today) {
63
70
  if (W.state !== 'ok') return { ...base, state: 'error', reason: W.reason, days: [], total: 0, caption: 'Calendar not read' };
64
71
  const layers = Array.isArray(r.layers) ? r.layers.filter((x) => x && x.title && /^\d{4}-\d{2}-\d{2}/.test(String(x.date))) : [];
65
72
  const byKey = new Map(W.days.map((x) => [x.key, x]));
73
+ const raw = new Map(); (Array.isArray(r.cells) ? r.cells : []).forEach((c) => (c.events || []).forEach((e) => { if (e && e.id) raw.set(e.id, e); }));
74
+ // routine, as the console reads it: a stand-up or a 1:1, the event's own routine flag, or a meeting tied to no initiative, prep or record
75
+ const routineOf = (row) => { const e = raw.get(row.id) || {}; const tied = !!(e.initiative || (Array.isArray(e.prep) ? e.prep.length : e.prep) || row.level);
76
+ return e.routine === true || ROUTINE.test(row.title || '') || !tied; };
66
77
  let from = 8 * 60, to = 18 * 60;
67
78
  const dayOf = (key) => {
68
79
  const src = byKey.get(key), rows = src ? src.rows : [];
@@ -73,7 +84,7 @@ export function calModel(r, view, date, today) {
73
84
  const s = minOf(row.at), endSame = row.end && hasTime(row.end) && String(row.end).slice(0, 10) === key;
74
85
  const e = Math.max(s + 15, endSame ? minOf(row.end) : row.end ? 24 * 60 : s + 30);
75
86
  from = Math.min(from, Math.floor(s / 60) * 60); to = Math.max(to, Math.min(24 * 60, Math.ceil(e / 60) * 60));
76
- timed.push({ ref, s, e, title: row.title, time: `${hh(s)}–${hh(e)}`, sub: row.sub, about: row.about, past: row.past, row });
87
+ timed.push({ ref, s, e, title: row.title, time: `${hh(s)}–${hh(e)}`, sub: row.sub, about: row.about, past: row.past, routine: routineOf(row), row });
77
88
  } else allday.push({ ref, title: row.title, sub: row.sub, kind: 'meet', row });
78
89
  });
79
90
  for (const x of layers) {
@@ -81,7 +92,8 @@ export function calModel(r, view, date, today) {
81
92
  if (a <= key && key <= b) allday.push({ title: x.title, kind: x.kind || x.layer || 'mark', tone: x.tone || null });
82
93
  }
83
94
  const [, m, d] = parts(key);
84
- return { key, dow: DOW[wd(key)], n: d, mon: MON[m - 1], label: `${DOW[wd(key)]} ${d} ${MON[m - 1]}`, today: key === today, past: key < today,
95
+ const hrs = timed.reduce((t, b) => t + (b.e - b.s) / 60, 0), tiedHrs = timed.filter((b) => !b.routine).reduce((t, b) => t + (b.e - b.s) / 60, 0);
96
+ return { key, weekend: wd(key) > 4, hrs, tiedHrs, dow: DOW[wd(key)], n: d, mon: MON[m - 1], label: `${DOW[wd(key)]} ${d} ${MON[m - 1]}`, today: key === today, past: key < today,
85
97
  inRange: key >= range.start && key <= range.end, timed: lanes(timed), allday, meetings: rows.length };
86
98
  };
87
99
  let keys = [];
@@ -89,9 +101,7 @@ export function calModel(r, view, date, today) {
89
101
  const first = addDays(range.start, -wd(range.start)), last = addDays(range.end, 6 - wd(range.end));
90
102
  for (let k = first; k <= last; k = addDays(k, 1)) keys.push(k);
91
103
  } else for (let k = range.start; k <= range.end; k = addDays(k, 1)) keys.push(k);
92
- let days = keys.map(dayOf);
93
- // the week shows Saturday and Sunday only when they hold something, or one is today
94
- if (view === 'week') days = days.filter((x) => wd(x.key) < 5 || x.today || x.meetings || x.allday.length);
104
+ const days = keys.map(dayOf); // the week shows all seven days, the weekend muted, as the console does
95
105
  const total = days.filter((x) => x.inRange).reduce((s, x) => s + x.meetings, 0);
96
106
  const none = r.events_source === 'none' ? 'PMOS holds no calendar to read.' : `No meetings ${view === 'day' ? 'on this day' : 'in this ' + view}.`;
97
107
  return { ...base, state: 'ok', days, from, to, total, caption: total ? `${total} ${total === 1 ? 'meeting' : 'meetings'}` : 'No meetings', empty: total ? '' : none };
@@ -104,12 +114,11 @@ const ic = (k) => `<svg class="i" viewBox="0 0 24 24"><path d="${ICON[k]}"/></sv
104
114
 
105
115
  /** The grid's markup. Both the timeline and the list are drawn for Day and Week; the pane's width picks one (premium-vw-cal.css). */
106
116
  export function calHtml(M, esc, nowMin = null) {
107
- const H = 44, top = (m) => ((m - M.from) / 60) * H;
108
117
  const seg = `<div class="vc-seg" role="group" aria-label="Calendar view">${VIEWS.map(([k, l]) => `<button type="button" data-cv="${k}" aria-pressed="${M.view === k}">${l}</button>`).join('')}</div>`;
109
118
  const step = M.view === 'day' ? 'day' : M.view === 'week' ? 'week' : 'month';
110
119
  const head = `<div class="vc-h"><button type="button" class="vc-ib" data-cn="-1" aria-label="Previous ${step}">${ic('back')}</button><button type="button" class="vc-ib" data-cn="1" aria-label="Next ${step}">${ic('next')}</button><button type="button" class="vc-tdy" data-cn="0">Today</button><b class="vc-t">${esc(M.title)}</b><small class="vc-cap">${esc(M.caption)}</small>${seg}</div>`;
111
120
  if (M.state !== 'ok') return `<div class="vc-w">${head}<p class="vc-empty" role="status">Calendar not read. ${esc(M.reason)}</p></div>`;
112
- const chip = (a) => a.row ? `<button type="button" class="vc-ad meet" data-ev="${esc(a.ref)}" title="${esc(a.title)}">${esc(a.title)}</button>` : `<span class="vc-ad ${esc(a.kind)}${a.tone ? ' t-' + esc(a.tone) : ''}" title="${esc(a.title)}">${esc(a.title)}</span>`;
121
+ const chip = (a) => a.row ? `<button type="button" class="vc-ad meet" data-ev="${esc(a.ref)}" title="${esc(a.title + ', all day')}">${esc(a.title)}</button>` : `<span class="vc-ad ${esc(a.kind)}${a.tone ? ' t-' + esc(a.tone) : ''}" title="${esc(a.title)}">${esc(a.title)}</span>`;
113
122
  const empty = M.empty ? `<p class="vc-empty" role="status">${esc(M.empty)}</p>` : '';
114
123
  if (M.view === 'month') {
115
124
  const cells = M.days.map((x) => {
@@ -119,21 +128,32 @@ export function calHtml(M, esc, nowMin = null) {
119
128
  }).join('');
120
129
  return `<div class="vc-w">${head}<div class="vc-mg"><div class="vc-mh">${DOW.map((d) => `<span>${d}</span>`).join('')}</div><div class="vc-mb">${cells}</div></div>${empty}</div>`;
121
130
  }
122
- const n = M.days.length, hours = [];
131
+ const n = M.days.length, one = n === 1, hours = [];
123
132
  for (let m = M.from; m < M.to; m += 60) hours.push(m);
124
- const blk = (e) => `<button type="button" class="vc-ev${e.past ? ' past' : ''}${e.e - e.s < 30 ? ' sh' : ''}" data-ev="${esc(e.ref)}" data-tl="${top(e.s) + 1}px ${Math.max(14, ((e.e - e.s) / 60) * H - 3)}px ${(e.lane / e.lanes) * 100}% ${100 / e.lanes}%" title="${esc(e.title + ' · ' + e.time)}"><b>${esc(e.title)}</b><small>${e.time}</small></button>`;
125
- const grid = `<div class="vc-g" data-tl="${n}"><div class="vc-c"></div>${M.days.map((x) => `<div class="vc-dh${x.today ? ' now' : ''}">${x.dow}<b>${x.n}</b></div>`).join('')}<div class="vc-adl">all day</div>${M.days.map((x) => `<div class="vc-adc">${x.allday.map(chip).join('')}</div>`).join('')}<div class="vc-gut">${hours.map((m) => `<i>${hh(m)}</i>`).join('')}</div>${M.days.map((x) => `<div class="vc-day${x.past ? ' past' : ''}" data-tl="${hours.length * H}px">${x.today && nowMin != null && nowMin >= M.from && nowMin <= M.to ? `<span class="vc-now" data-tl="${top(nowMin)}px" aria-hidden="true"></span>` : ''}${x.timed.map(blk).join('')}</div>`).join('')}</div>`;
126
- const list = `<div class="vc-ag">${M.days.map((x) => { const rows = [...x.allday.filter((a) => a.row), ...x.timed]; return `<h4${x.today ? ' class="now"' : ''}>${x.label}${x.today ? ' · today' : ''}</h4>${x.allday.filter((a) => !a.row).map(chip).join('')}${rows.length ? rows.map((e) => `<button type="button" class="vc-ar${e.past ? ' past' : ''}" data-ev="${esc(e.ref)}"><time>${e.s != null ? hh(e.s) : 'All day'}</time><span><b>${esc(e.title)}</b>${e.sub || e.about ? `<small>${esc([e.sub, e.about].filter(Boolean).join(' · '))}</small>` : ''}</span></button>`).join('') : '<p class="vc-none">No meetings</p>'}`; }).join('')}</div>`;
127
- return `<div class="vc-w">${head}${empty}${grid}${list}</div>`;
133
+ const H = PPH, top = (m) => ((m - M.from) / 60) * H;
134
+ const blk = (e) => `<button type="button" class="vc-ev${e.routine ? ' rt' : ''}${e.past ? ' past' : ''}${e.e - e.s < 30 ? ' sh' : ''}" data-ev="${esc(e.ref)}" data-tl="${top(e.s) + 1}px ${Math.max(16, ((e.e - e.s) / 60) * H - 3)}px ${e.lane} ${e.lanes}" title="${esc(e.title + ', ' + e.time)}"><b>${esc(e.title)}</b>${e.e - e.s >= 30 ? `<small>${e.time}</small>` : ''}</button>`;
135
+ const hrsText = (x) => x.hrs ? `${+x.hrs.toFixed(1)} h` : '';
136
+ const pct = (h) => Math.min(100, (h / DAY_LOAD) * 100).toFixed(1) + '%';
137
+ const dh = (x) => `<div class="vc-dh${x.today ? ' now' : ''}${x.weekend ? ' we' : ''}"><div class="vc-dl">${one ? `<b>${x.label}</b>` : `<button type="button" class="vc-db" data-day="${x.key}" title="Open ${x.label}">${x.label}</button>`}<span class="vc-hrs">${hrsText(x)}</span></div><span class="vc-lb" aria-hidden="true" data-tl="${pct(x.tiedHrs)} ${pct(x.hrs - x.tiedHrs)}"><i class="tied"></i><i class="rt"></i></span></div>`;
138
+ const strip = (x) => {
139
+ const max = one ? STRIP_DAY : STRIP_WEEK, all = [...x.allday.filter((a) => a.row), ...x.allday.filter((a) => !a.row)];
140
+ const more = all.length > max ? `<button type="button" class="vc-more" data-day="${x.key}" aria-label="${all.length - max} more on ${x.label}">+${all.length - max}</button>` : '';
141
+ return `<div class="vc-sc${one ? ' line' : ''}${x.weekend ? ' we' : ''}">${all.slice(0, max).map(chip).join('')}${more}${!all.length && one ? '<span class="vc-none">No dated item on this day</span>' : ''}</div>`;
142
+ };
143
+ const grid = `<div class="vc-sx"><div class="vc-g${one ? ' one' : ''}" data-tl="${n}"><div class="vc-c"></div>${M.days.map(dh).join('')}<div class="vc-adl">dates</div>${M.days.map(strip).join('')}<div class="vc-gut" data-tl="${hours.length * H}px">${hours.map((m, i) => `<i data-tl="${i * H}px">${hh(m)}</i>`).join('')}</div>${M.days.map((x) => `<div class="vc-day${x.past ? ' past' : ''}${x.today ? ' now' : ''}${x.weekend ? ' we' : ''}" data-tl="${hours.length * H}px">${x.today && nowMin != null && nowMin >= M.from && nowMin <= M.to ? `<span class="vc-now" data-tl="${top(nowMin)}px" aria-hidden="true"></span>` : ''}${x.timed.map(blk).join('')}</div>`).join('')}</div></div>`;
144
+ const list = `<div class="vc-ag">${M.days.map((x) => { const rows = [...x.allday.filter((a) => a.row), ...x.timed]; return `<h4${x.today ? ' class="now"' : ''}>${x.label}${x.today ? ' · today' : ''}</h4>${x.allday.filter((a) => !a.row).map(chip).join('')}${rows.length ? rows.map((e) => `<button type="button" class="vc-ar${e.routine ? ' rt' : ''}${e.past ? ' past' : ''}" data-ev="${esc(e.ref)}"><time>${e.s != null ? hh(e.s) : 'All day'}</time><span><b>${esc(e.title)}</b>${e.sub || e.about ? `<small>${esc([e.sub, e.about].filter(Boolean).join(' · '))}</small>` : ''}</span></button>`).join('') : '<p class="vc-none">No meetings</p>'}`; }).join('')}</div>`;
145
+ return `<div class="vc-w">${head}${empty}${grid}${one ? '' : list}</div>`;
128
146
  }
129
147
 
130
- /** The run-time geometry of the timeline: data-tl on a block is "top height left width", on the grid its column count, on a day its height. */
148
+ /** The run-time geometry of the timeline: data-tl on a block is "top height lane lanes", on the grid its column count, on a day and the hour
149
+ * gutter their height, on a load bar its two widths, on an hour label and the now line their top. */
131
150
  export function placeAll(el) {
132
151
  el.querySelectorAll('[data-tl]').forEach((n) => {
133
152
  const v = n.dataset.tl.split(' ');
134
- if (n.classList.contains('vc-ev')) ['--tl-t', '--tl-h', '--tl-l', '--tl-w'].forEach((k, i) => n.style.setProperty(k, v[i]));
153
+ if (n.classList.contains('vc-ev')) ['--tl-t', '--tl-h', '--tl-l', '--tl-lc'].forEach((k, i) => n.style.setProperty(k, v[i]));
154
+ else if (n.classList.contains('vc-lb')) ['--tl-a', '--tl-b'].forEach((k, i) => n.style.setProperty(k, v[i]));
135
155
  else if (n.classList.contains('vc-g')) n.style.setProperty('--tl-n', v[0]);
136
- else if (n.classList.contains('vc-day')) n.style.setProperty('--tl-hh', v[0]);
156
+ else if (n.classList.contains('vc-day') || n.classList.contains('vc-gut')) n.style.setProperty('--tl-hh', v[0]);
137
157
  else n.style.setProperty('--tl-t', v[0]);
138
158
  });
139
159
  }
@@ -169,7 +189,7 @@ export function mountCal(el, st, d) {
169
189
  return { state: () => ({ ...me.st }), reload: read };
170
190
  }
171
191
 
172
- /** The calendar on its own: a dialog whose detail is the grid. d = { openDlg, turnA, ptx, $, pmGet, esc, ws(), openRow(row) } where openRow
192
+ /** The calendar on its own: a dialog whose detail is the grid. d = { openDlg, setMode, turnA, ptx, $, pmGet, esc, ws(), openRow(row) } where openRow
173
193
  * opens the meeting dialog. After a meeting opens, the grid comes back as a tab beside it at the same view and date. */
174
194
  export function openCalendar(d, st) {
175
195
  const open = (row, at) => {
@@ -180,6 +200,7 @@ export function openCalendar(d, st) {
180
200
  d.openDlg({ eye: 'Calendar · real data', title: 'Calendar', stream: d.turnA(d.ptx('This is the calendar PMOS holds. Press a meeting to open its detail; the calendar stays as a tab beside it.')),
181
201
  pane: '<div class="vc" id="vcMain"></div>', label: 'Calendar' });
182
202
  const f = d.$('#askF'); if (f) f.hidden = true;
203
+ if (d.setMode) d.setMode('detail'); // the grid takes the whole dialog; the dialog's own button brings the conversation back
183
204
  return mountCal(d.$('#vcMain'), st || { view: 'week', date: todayKey() }, { ...d, openRow: open });
184
205
  }
185
206
 
@@ -2085,3 +2085,25 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
2085
2085
  .where #crIni{max-width:calc(100vw - 316px)}
2086
2086
  .top .tools-top{gap:8px}
2087
2087
  }
2088
+ /* ── Updates and What's new in Settings (initiative premium-updates) ── */
2089
+ .updpill{display:inline-flex;align-items:center;height:22px;padding:0 9px;border-radius:999px;background:var(--spot);color:var(--ember-ink);font:600 var(--fs-1) var(--mono);font-style:normal;white-space:nowrap;flex:none}
2090
+ .updpill.ok{background:transparent;border:1px solid var(--ok);color:var(--ok)}
2091
+ .updpill[hidden]{display:none}
2092
+ .crmenu .updpill{margin-left:auto;color:var(--ember-ink)}
2093
+ .updb{display:flex;flex-wrap:wrap;align-items:center;gap:12px 14px;padding:14px 16px;border-radius:18px;background:var(--spot);margin-bottom:6px}
2094
+ .updb .t{display:grid;gap:2px;flex:1 1 240px;min-width:0}.updb .t b{font-size:var(--fs-4)}
2095
+ .updb .a{display:flex;flex-wrap:wrap;gap:8px}.updb .cta{height:auto;min-height:44px;padding:0 18px}
2096
+ .kday{border-top:1px solid var(--hair)}
2097
+ .kdh{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:44px;font:600 var(--fs-2) var(--mono);color:var(--ink-2)}
2098
+ .kdh em{font-style:normal;color:var(--ink-3)}
2099
+ .kdh[aria-expanded="false"]::after{content:"Show";font:600 var(--fs-2) var(--sans);color:var(--ink-2)}
2100
+ .doc .kvl{list-style:none;margin:0 0 6px;padding:0;display:grid;gap:2px;max-width:none}
2101
+ .doc .kver{display:grid;grid-template-columns:110px minmax(0,1fr);gap:4px 14px;padding:10px 8px;margin:0;border-radius:14px;color:var(--ink)}
2102
+ .doc .kver.new{background:linear-gradient(90deg,var(--spot),transparent)}
2103
+ .kv{display:grid;gap:2px;align-content:start}.kv b{font:600 var(--fs-3) var(--mono)}
2104
+ .kv i{justify-self:start;font:600 var(--fs-1) var(--mono);font-style:normal;padding:0 7px;border-radius:999px;border:1px solid var(--hair);color:var(--ink-2)}
2105
+ .kv i.nw{border-color:transparent;background:var(--spot);color:var(--ember-ink)}
2106
+ .kv em{font:500 var(--fs-2) var(--mono);font-style:normal;color:var(--ink-3)}
2107
+ .kp{display:grid;gap:6px;min-width:0;overflow-wrap:anywhere}.doc .kp p{margin:0;color:var(--ink);max-width:none;line-height:1.5}.kp p em{font:500 var(--fs-2) var(--mono);font-style:normal;color:var(--ink-3)}
2108
+ .kmore{min-height:44px;font-weight:600;color:var(--ink-2)}
2109
+ @media (max-width:640px){.doc .kver{grid-template-columns:minmax(0,1fr)}.kv{grid-auto-flow:column;justify-content:start;align-items:center;gap:8px}}
@@ -25,7 +25,7 @@ const pinned = new Set();
25
25
 
26
26
  wireRail('brief');
27
27
  const week = mountMeeting({ $, $$, esc, openDlg, toast, pmGet, pmPost, turnA, ptx, kv, H, ws: () => new URLSearchParams(location.search).get('ws'), redraw: () => { if (M) drawTl(); } });
28
- mountCalEntry($('#todayCard'), { $, esc, openDlg, turnA, ptx, pmGet, ws: () => new URLSearchParams(location.search).get('ws'), openRow: week.openRow }); // the full calendar: Day, Week and Month in the viewer
28
+ mountCalEntry($('#todayCard'), { $, esc, openDlg, setMode, turnA, ptx, pmGet, ws: () => new URLSearchParams(location.search).get('ws'), openRow: week.openRow }); // the full calendar: Day, Week and Month in the viewer
29
29
  mountNotes({ $, esc, openDlg, toast, pmGet, pmPost, task: week.task });
30
30
 
31
31
  /* ── a day's baseline, kept on this device, so "N of M done" counts rows that cleared since the page first read today ────── */