create-pmos 0.632.0 → 0.633.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 (59) hide show
  1. package/package.json +14 -50
  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-adddoc-test.js +3 -0
  7. package/workspace/briefing-premium-board-test.js +4 -2
  8. package/workspace/briefing-premium-doc-edit-test.js +3 -0
  9. package/workspace/briefing-premium-initiative-test.js +4 -0
  10. package/workspace/briefing-premium-insights-test.js +1 -1
  11. package/workspace/briefing-premium-sources-test.js +2 -2
  12. package/workspace/changelog.json +13 -0
  13. package/workspace/core-docs-workflow-test.js +3 -0
  14. package/workspace/ev-everywhere-test.js +7 -17
  15. package/workspace/guide/layout.md +12 -5
  16. package/workspace/ini-workflow-test.js +3 -0
  17. package/workspace/lib/meeting-focus.js +5 -3
  18. package/workspace/lib/routes-meeting-focus.js +2 -2
  19. package/workspace/live-pill-round-test.js +7 -2
  20. package/workspace/package-lock.json +2 -2
  21. package/workspace/package.json +1 -1
  22. package/workspace/premium-board-actions-test.js +3 -1
  23. package/workspace/premium-vw-backlog-test.js +2 -2
  24. package/workspace/premium-vw-doc-test.js +3 -0
  25. package/workspace/premium-vw-item-test.js +1 -1
  26. package/workspace/premium-vw-jira-test.js +4 -3
  27. package/workspace/public/pm/bd-ini-panel.js +4 -1
  28. package/workspace/public/pm/bd-prog-panel.js +3 -3
  29. package/workspace/public/pm/bd-views.js +8 -2
  30. package/workspace/public/pm/buddy-core.js +2 -2
  31. package/workspace/public/pm/cozy-board.css +15 -0
  32. package/workspace/public/pm/cozy-ev.css +25 -0
  33. package/workspace/public/pm/cozy-home.css +38 -2
  34. package/workspace/public/pm/cozy-nav.js +72 -6
  35. package/workspace/public/pm/cozy-phone-rec.css +68 -0
  36. package/workspace/public/pm/cozy-phone-rec.js +105 -0
  37. package/workspace/public/pm/cozy-phone-settings.css +18 -0
  38. package/workspace/public/pm/cozy-phone-settings.js +73 -0
  39. package/workspace/public/pm/cozy-phone-swipe.js +51 -0
  40. package/workspace/public/pm/cozy-pop-work.css +56 -0
  41. package/workspace/public/pm/cozy-pop-work.js +72 -4
  42. package/workspace/public/pm/cozy-rec-tab.js +10 -0
  43. package/workspace/public/pm/cozy-today-app.js +56 -5
  44. package/workspace/public/pm/cozy-today-page.css +75 -1
  45. package/workspace/public/pm/cozy-today-view.js +87 -0
  46. package/workspace/public/pm/cozy-viewer.js +27 -7
  47. package/workspace/public/pm/home-app.js +31 -2
  48. package/workspace/public/pm/home-chat.js +8 -0
  49. package/workspace/public/pm/home-ini.js +7 -3
  50. package/workspace/public/pm/phone-ask.js +57 -0
  51. package/workspace/split-merge-ui-test.js +3 -1
  52. package/workspace/stage-card-tasks-test.js +6 -0
  53. package/workspace/stage-card-test.js +3 -0
  54. package/workspace/task-delete-test.js +3 -0
  55. package/workspace/task-links-test.js +3 -0
  56. package/workspace/task-plans-test.js +3 -0
  57. package/workspace/task-views-test.js +3 -0
  58. package/workspace/test-lists/phone-design-v2.json +9 -0
  59. package/workspace/tk-tasks-test.js +4 -0
@@ -76,7 +76,7 @@ const TICKETS = {
76
76
  // Home's initiative layout (premium-agreed-design): the card's Overview has the Sprint press; the Viewer shows one item at a time
77
77
  const viaMore = async (pg, label) => { const it = (l) => `#czViewer .cz-vw-menu [role="menuitem"]:has(> span:first-child:text-is("${l}"))`, more = async () => { await pg.click('#czViewer:not([hidden]) [data-cz-vw="more"]'); await until(() => pg.evaluate(() => !!document.querySelector('#czViewer .cz-vw-menu'))); }, view = (v) => until(() => pg.evaluate((x) => !!document.querySelector(`#czViewer:not([hidden]) [data-hi-v="${x}"]`), v)); if ((await pg.$('#czViewer:not([hidden]) [data-hi-v="page"]')) && (await pg.$('#czViewer:not([hidden]) [data-iv-docs]')) && !['Split into a new initiative', 'Merge into', 'Program', 'Open on the Board', 'Copy', 'The record', 'Delete'].includes(label)) { await pg.click('#czViewer:not([hidden]) [data-iv-docs]'); await view('docs'); if (label === 'Documents') return; } await more(); for (let i = 0; i < 20 && !(await pg.$(it(label))) && !(await pg.$(it('Stage'))); i++) { await pg.keyboard.press('Escape'); await pg.waitForTimeout(250); await more(); } if (!(await pg.$(it(label))) && (await pg.$(it('Stage')))) { await pg.click(it('Stage')); await view('stage'); if (label === 'Stage') return; await more(); } await pg.click(it(label)); }; // batch 16 item 5c: the page's ⋯ is short; Documents opens from its fold, and the Documents view's ⋯ holds Stage, whose ⋯ holds Documents, Open the full record and Sprint
78
78
  const overview = async (pg) => { await (async (g) => { const P = '#czViewer:not([hidden]) [data-hi-v="page"]', r = '#hmList [data-hm-sel^="i:"][aria-current="true"]'; for (let i = 0; i < 4 && !(await g.$(P)) && (await g.$('#czViewer:not([hidden]) [data-cz-vw="back"]')); i++) { await g.click('#czViewer [data-cz-vw="back"]'); await g.waitForTimeout(150); } if (await g.$(P)) return; if (await g.$(r)) await g.click(r); else await g.reload(); await g.waitForSelector(P + ' .iv', { timeout: 30000 }); })(pg); /* ← back to the initiative's page, else its row, else the address again (an initiative the list does not show) */ /* the page holds the Tasks (batch 11 item 20) */ return until(() => pg.evaluate(() => !!document.querySelector('#czViewer:not([hidden]) [data-hi-v]'))); };
79
- const openSprint = async (pg) => { if (!(await pg.$('#czViewer:not([hidden]) [data-hi-v]'))) await overview(pg); /* open() already showed the Overview */ await viaMore(pg, 'Sprint'); };
79
+ const openSprint = async (pg) => { if (!(await pg.$('#czViewer:not([hidden]) :is([data-hi-v], .pw-ph)'))) await overview(pg); /* open() already showed the Overview */ await viaMore(pg, 'Sprint'); };
80
80
  const open = async ({ w = 1280, h = 900, theme = 'light', sprints = SPRINTS, tickets = TICKETS } = {}) => {
81
81
  const ctx = await openMission(await browser.newContext({ viewport: { width: w, height: h }, colorScheme: theme }));
82
82
  await ctx.addInitScript((t) => { try { localStorage.setItem('pmos.c3.theme', t); } catch { /* none */ } }, theme);
@@ -90,8 +90,9 @@ const TICKETS = {
90
90
  await page.route('**/api/initiative-premium*', (r) => json(r, { ok: true, state: 'ready', model: IMODEL, as_of: Date.now() }));
91
91
  await page.route('**/api/briefing-premium/**', (r) => json(r, { ok: true, turns: [], working: false }));
92
92
  await page.goto(BASE + '/premium-initiative.html?id=self-serve-v2&ws=w1&board=w1&theme=' + theme); // the Board's expand link: Home with the initiative
93
- await until(() => page.evaluate(() => !!document.querySelector('#czViewer .iv-mc') && !!window.__premiumVwJira), 20000);
94
- await overview(page);
93
+ // a phone shows the popup's phone page (Ph2_init); its ⋯ keeps Sprint (pm/home-ini.js)
94
+ if (w <= 760) await page.waitForSelector('#czViewer .pw-ph', { state: 'attached', timeout: 20000 });
95
+ else { await until(() => page.evaluate(() => !!document.querySelector('#czViewer .iv-mc') && !!window.__premiumVwJira), 20000); await overview(page); }
95
96
  await sleep(300); reads.length = 0; posts.length = 0; // Home's own reads; the checks below are about the sprint view's
96
97
  return { ctx, page, errors, posts, reads };
97
98
  };
@@ -211,7 +211,8 @@ function popExtra(r) {
211
211
  const x = O.rowOf(r.key) || r;
212
212
  VW.drill();
213
213
  VW.open({ kind: 'Initiative', title: x.title, icon: 'goal', id: 'all:' + vidOf(x), back: true,
214
- render: (b) => { b.dataset.pwAll = '1'; const y = O.rowOf(r.key) || x; b.innerHTML = iniBody(y, b); wire(b, y.key); } });
214
+ // the Board's next read draws it again (refresh): it is the initiative shown while it is open
215
+ render: (b) => { b.dataset.pwAll = '1'; const y = O.rowOf(r.key) || x; cur = { key: y.key, tk: null, vid: vidOf(y) }; O.onShow(y.key); b.innerHTML = iniBody(y, b); wire(b, y.key); } });
215
216
  },
216
217
  props: r.id ? () => { const x = O.rowOf(r.key) || r; VW.drill(); PP.open(viewOf(x), H); } : null,
217
218
  product: () => openProduct(O.rowOf(r.key) || r),
@@ -372,6 +373,8 @@ export function refresh(force) {
372
373
  if (!cur) return;
373
374
  const r = O.rowOf(cur.key); if (!r || !r.track) { close(); return; }
374
375
  // the Viewer that shows this initiative, not the one used last (a chat beside it took the initiative's body, batch 31 item 10)
376
+ // Every part (the old page as a drill-in, the way a phone reaches it, Ph2_init) reads the same row, so it is drawn again too
377
+ const all = !cur.tk && VW.bodyOf('all:' + vidOf(r)); if (all) { const t = all.scrollTop; all.innerHTML = iniBody(r, all); all.scrollTop = t; }
375
378
  const b = VW.bodyOf(vidOf(r)); if (!b || (!force && document.activeElement && b.contains(document.activeElement))) return;
376
379
  if (cur.tk) return; // the ticket Viewer reads its own records (tk-view.js); Read Jira again opens it fresh
377
380
  const top = b.scrollTop;
@@ -414,7 +414,7 @@ function draw(keepFocus) {
414
414
  const p = progOf(cur.id); if (!p) { VW.close(); return; }
415
415
  readAway(p); readMore(p); readDrafts(p);
416
416
  const b = VW.body(); if (!b) return;
417
- if (PW.on(b)) { const t = b.scrollTop, L = levelOf(cur.id); if (L) { b.innerHTML = PW.levelHtml(L, { today: L.today, add: false }); b.scrollTop = t; } return; } // the program in the popup (board 26)
417
+ if (PW.inPop(b)) { const t = b.scrollTop, L = levelOf(cur.id); if (L) { b.innerHTML = PW.levelHtml(L, { today: L.today, add: false }); b.scrollTop = t; } return; } // the program in the popup (board 26)
418
418
  const f = keepFocus && document.activeElement && b.contains(document.activeElement) ? document.activeElement : null;
419
419
  const sel = f ? (f.dataset.pp ? `[data-pp="${f.dataset.pp}"]` + (f.dataset.fold ? `[data-fold="${CSS.escape(f.dataset.fold)}"]` : '') + (f.dataset.key ? `[data-key="${CSS.escape(f.dataset.key)}"]` : '') + (f.dataset.ms ? `[data-ms="${CSS.escape(f.dataset.ms)}"]` : '') : f.dataset.czsFold ? `[data-czs-fold="${CSS.escape(f.dataset.czsFold)}"]` : null) : null;
420
420
  const top = b.scrollTop;
@@ -478,10 +478,10 @@ function openPanel(id, from, via) {
478
478
  VW.open({ kind: 'Program', title: titleOf(p), icon: I.prog, id: 'program:' + id,
479
479
  // on a desk the program opens in the one popup, the chat about it beside it (slice 3 of the six-place navigation, board 26)
480
480
  pop: RO ? undefined : { id: p.id, kind: 'program', title: p.title, ws: p.home || board().ws || undefined },
481
- discuss: true, more: () => (PW.on(VW.bodyOf('program:' + id)) ? [{ label: 'Every part', on: () => allParts(id) }, { sep: true }] : []).concat(moreOf(progOf(id) || p)), rename,
481
+ discuss: true, more: () => (PW.inPop(VW.bodyOf('program:' + id)) ? [{ label: 'Every part', on: () => allParts(id) }, { sep: true }] : []).concat(moreOf(progOf(id) || p)), rename,
482
482
  render: (body) => {
483
483
  { const q = progOf(id); if (q && VW.current() && VW.current().title !== titleOf(q)) VW.retitle('program:' + id, titleOf(q)); } // a rename in the charter, on ←
484
- if (PW.on(body)) { levelDraw(body, id, from); return; }
484
+ if (PW.inPop(body)) { levelDraw(body, id, from); return; }
485
485
  oldDraw(body, id, from);
486
486
  },
487
487
  onClose: () => {
@@ -263,8 +263,14 @@ export function stagesHtml(L, o = {}) {
263
263
  /** A phone row: the status dot, the title, the stage and what it waits on; the workflow's icon at the end when the board has more than one. */
264
264
  function phoneRow(r) {
265
265
  const s = statusLine(r), t = r.track || {}, w = WF.stageOfRow(r);
266
- const sub = [stageName(r) || (w && w.name), t.you ? t.you.replace(/^Your /, 'your ') : s.tone !== 'ok' && s.tone !== 'q' ? s.text.toLowerCase() : '', r.owner].filter(Boolean).join(' · ');
267
- return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i><span class="tx"><span class="t">${WK.iconHtml(r.kind)}${nameHtml(r)}</span><span class="s${t.you ? '' : ' q'}">${esc(sub)}</span></span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
266
+ // the phone design (Ph2_work): "Discover · 15 days over · wawan", the late or at risk words in their own tone, no kind icon before the name
267
+ const say = t.you ? t.you.replace(/^Your /, 'your ') : s.tone !== 'ok' && s.tone !== 'q' ? s.text.toLowerCase() : '';
268
+ const st = stageName(r) || (w && w.name) || '';
269
+ // a Project (Ph2 checks across kinds): the end date leads the late words, "ends 4 Dec"
270
+ const em = WK.kindOf(r.kind) === 'project' && /^\d{4}-\d{2}-\d{2}/.test(String(r.end || '')) ? String(r.end).slice(0, 10).split('-') : null;
271
+ const ends = em ? 'ends ' + (+em[2]) + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+em[1] - 1] : '';
272
+ const sub = [st ? esc(st) : '', ends, say ? `<em class="${t.you ? 'you' : esc(s.tone)}">${esc(say)}</em>` : '', r.owner ? esc(r.owner) : ''].filter(Boolean).join(' · ');
273
+ return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog"><i class="cz-dot ${s.tone} ${s.mo || ''}"></i><span class="tx"><span class="t">${nameHtml(r)}</span><span class="s q">${sub}</span></span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
268
274
  }
269
275
  export function phoneListHtml(L) {
270
276
  const you = L.filter((r) => r.track && r.track.you), bad = L.filter((r) => !you.includes(r) && needOf(r) <= 3), left = L.filter((r) => !you.includes(r) && !bad.includes(r));
@@ -143,12 +143,12 @@ export function contextHtml(m) {
143
143
  return m.context.map((c) => row(c.label, esc(c.text), c.href ? `<a class="mb-ib" href="${esc(c.href)}" target="_blank" rel="noopener noreferrer" aria-label="Open it" title="Open it">${svg(P.open)}</a>` : '')).join('');
144
144
  }
145
145
  export function draftsHtml(m) {
146
- return m.drafts.map((d) => `<div class="mb-r mb-draft" data-draft="${esc(d.id)}"><span class="t"><small>Draft for the call chat</small>${esc(d.text)}</span>`
146
+ return m.drafts.map((d) => `<div class="mb-r mb-draft" data-draft="${esc(d.id)}" data-sw-right="copy" data-sw-left="chat-x"><span class="t"><small>Draft for the call chat</small>${esc(d.text)}</span>`
147
147
  + ib('copy', 'Copy the line, then paste it in the call chat', P.copy, ` data-id="${esc(d.id)}"`, 'go') + ib('chat-x', 'Not now', P.x, ` data-id="${esc(d.id)}"`) + '</div>').join('');
148
148
  }
149
149
  export function consentHtml(m) {
150
150
  if (!m.consent.show) return '';
151
- return `<div class="mb-r mb-consent"><span class="t"><small>PMOS proposes</small>Tell the call you are taking notes with PMOS?<q class="mb-line">${esc(CONSENT_LINE)}</q></span>`
151
+ return `<div class="mb-r mb-consent" data-sw-right="copy" data-sw-left="consent-x"><span class="t"><small>PMOS proposes</small>Tell the call you are taking notes with PMOS?<q class="mb-line">${esc(CONSENT_LINE)}</q></span>`
152
152
  + `<span class="mb-acts">${ib('copy', 'Copy the line, then paste it in the call chat', P.copy, ' data-id="consent"', 'go')}${ib('consent-x', 'Not now', P.x)}</span></div>`;
153
153
  }
154
154
  export function answerHtml(m) {
@@ -1586,3 +1586,18 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
1586
1586
  /* slice 1: the rail of places leaves the toolbar 80 px less beside a Viewer; the "what needs a look" pill gives way first (it leaves the
1587
1587
  toolbar with slice 4), so ⋯ never runs past the panel's edge (its menu hangs from the wrapper, so only the chip clips) */
1588
1588
  @media (min-width: 761px) { .bd-hd #bdNeedw { min-width: 0; } .bd-hd #bdNeedw .bd-chip.bd-need { flex: 0 1 auto; min-width: 0; max-width: 100%; overflow: hidden; } .bd-hd .bd-chip.bd-need > span { flex: none; } }
1589
+
1590
+ /* ── The phone design (board Ph2_work; build brief nav-structure/phone/build-brief-v2.md) ──
1591
+ * The product chip with its name, then Find and the tune button; the ⋯ of the menu sits at the right (pm/cozy-nav.js), so the head leaves it
1592
+ * 48 px. The View chip, the needs pill and New stay as they were (a phone list by default). A row says "Discover · 15 days over · wawan", the late words in their
1593
+ * tone, and its name wraps to two lines. */
1594
+ @media (max-width: 760px) {
1595
+ body.cz-phmore .bd-hd { padding-right: 48px; }
1596
+ body.cz-phmore .bd-lrow.ini2 { align-items: flex-start; border-radius: 12px; }
1597
+ body.cz-phmore .bd-lrow.ini2 > .cz-dot { margin-top: 8px; }
1598
+ body.cz-phmore .bd-lrow.ini2 .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
1599
+ body.cz-phmore .bd-lrow.ini2 .s em { font-style: normal; }
1600
+ body.cz-phmore .bd-lrow.ini2 .s em.red, body.cz-phmore .bd-lrow.ini2 .s em.late { color: var(--cz-late); }
1601
+ body.cz-phmore .bd-lrow.ini2 .s em.risk { color: var(--cz-risk); }
1602
+ body.cz-phmore .bd-lrow.ini2 .s em.you { color: var(--cz-blueink); }
1603
+ }
@@ -507,3 +507,28 @@
507
507
  html.ro body.cz-railon.cz-pn-page { padding-left: 16px; }
508
508
  html.ro body.cz.cz-railon main.cz-panel.stage { margin-left: 16px; }
509
509
  }
510
+
511
+ /* ── The phone's ⋯ (phone design, boards Ph2_menu and Ph2_today; build brief nav-structure/phone/build-brief-v2.md) ──
512
+ * No round button and no bottom bar: #czFab is a plain ⋯ at the top right of every page, its one dot on its top right corner, and the menu
513
+ * drops under it. The pages leave 48 px free at the right of their top line (body.cz-phmore). Rules here win over a page's own phone
514
+ * position of the old round button (bottom right), so they carry !important on the place only. */
515
+ @media (max-width: 760px) {
516
+ body.cz-phmore .cz-fabw { top: calc(env(safe-area-inset-top, 0px) + 8px) !important; right: 8px !important; bottom: auto !important; left: auto !important;
517
+ flex-direction: column-reverse; align-items: flex-end; gap: 6px; z-index: 70; }
518
+ body.cz-phmore .cz-fab { width: 44px; height: 44px; border: 0; background: transparent; box-shadow: none; color: var(--cz-ink); }
519
+ body.cz-phmore .cz-fab[aria-expanded="true"] { background: var(--cz-well); }
520
+ body.cz-phmore .cz-fab svg { width: 22px; height: 22px; stroke-width: 2.6; }
521
+ body.cz-phmore .ev-fd { top: 5px; width: 8px; height: 8px; border-width: 2px; }
522
+ body.cz-phmore .ev-fd.you, body.cz-phmore .ev-fd.risk { left: auto; right: 5px; }
523
+ body.cz-phmore .cz-ears, body.cz-phmore .cz-fabw .cz-live, body.cz-phmore .cz-fabw .lv-pill { display: none !important; } /* Live now is a menu row */
524
+ body.cz-phmore .cz-fabm.ev-menu.ev-phm { width: 232px; padding: 8px; gap: 2px; border-radius: 18px; }
525
+ body.cz-phmore .cz-fabm.ev-menu.ev-phm a, body.cz-phmore .cz-fabm.ev-menu.ev-phm button.ev-mi { min-height: 44px; font-weight: var(--fw-regular); position: relative; }
526
+ body.cz-phmore .cz-fabm.ev-menu.ev-phm .bad { color: var(--cz-late); }
527
+ body.cz-phmore .cz-fabm.ev-menu.ev-phm [aria-current="page"] { font-weight: var(--fw-strong); }
528
+ body.cz-phmore .cz-fabm.ev-menu.ev-phm .ev-k { color: var(--cz-ink2); font-size: var(--fs-row); font-weight: var(--fw-regular); }
529
+ body.cz-phmore .cz-fabm.ev-menu.ev-phm .ev-k + .ev-md.you { margin-left: 8px; width: 7px; height: 7px; }
530
+ body.cz-phmore .cz-fabm.ev-menu.ev-phm .ev-md.risk { position: static; margin-left: auto; border: 0; }
531
+ body.cz-phmore .cz-fabm.ev-menu.ev-phm .ev-hr { border: 0; border-top: 1px solid var(--cz-hair); margin: 4px 6px; width: auto; }
532
+ body.cz-phmore .ins-bar { padding-right: 48px; } /* Goals keeps its own top line clear of the ⋯ */
533
+ body.cz-phmore .ev-scrim { background: rgba(42,46,53,.22); }
534
+ }
@@ -928,9 +928,11 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
928
928
  /* no name and time line and no "You · 12:09": still read out to a screen reader. The ask card keeps its name line. */
929
929
  body.cz-home:not(.hm-plist) .hm-a:not(.ask):not(.hm-intro) .hm-ab > .hm-who:not(:has(.hm-say)),
930
930
  body.cz-home:not(.hm-plist) .hm-u > .hm-you { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
931
- /* Copy, Retry and Make it a task: on the newest message; an older one shows them on press and hold, or on focus */
931
+ /* Copy, Retry and Make it a task, and the "Worked …" line: only on a touch of the message (phone design, Ph2_ask), or on focus. A tap on
932
+ * the message shows them; a tap elsewhere hides them (home-chat.js). An opened "Worked" line stays. */
932
933
  body.cz-home:not(.hm-plist) .hm-tools { margin-top: 8px; }
933
- body.cz-home:not(.hm-plist) .hm-a:not(.last):not(.held):not(:focus-within) .hm-tools { height: 0; margin: 0; overflow: hidden; opacity: 0; }
934
+ body.cz-home:not(.hm-plist) .hm-a:not(.held):not(:focus-within) .hm-tools { height: 0; margin: 0; overflow: hidden; opacity: 0; }
935
+ body.cz-home:not(.hm-plist) .hm-log > .hm-worked:has(+ .hm-a:not(.held):not(:focus-within)):not(:has([aria-expanded="true"])):not(:focus-within) { display: none; }
934
936
 
935
937
  /* the foot: one box, + · input · mic · send, on the card with no fade over the stream */
936
938
  body.cz-home:not(.hm-plist) #hmFoot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--cz-card); }
@@ -988,3 +990,37 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
988
990
  /* the notes a turn's worked line folds (popup round 3 point 19c): quiet, above its steps */
989
991
  .hm-notes { padding: 4px 0 2px 18px; }
990
992
  .hm-notes p { margin: 0 0 4px; font-size: var(--fs-meta); color: var(--cz-ink2); }
993
+
994
+ /* ── Ask PMOS on a phone (phone design, board Ph2_asklist; pm/phone-ask.js) ──
995
+ * Home's page on a phone: the chats grouped by work, on the white page, no cards. The title alone at the top (the menu's ⋯ is at its right,
996
+ * cozy-ev.css); the composer is fixed at the foot and starts a chat. Home's own list is not drawn; an open chat covers the page as before. */
997
+ .pa-page[hidden] { display: none !important; }
998
+ @media (max-width: 760px) {
999
+ body.cz-home.pa-on.hm-plist { background: var(--cz-card); }
1000
+ body.cz-home.pa-on.hm-plist #hmDesk > .hm-list { display: none !important; }
1001
+ body.cz-home.pa-on:not(.hm-plist) .pa-page { display: none !important; }
1002
+ .pa-page { display: block; font-family: var(--cz-sans); color: var(--cz-ink); padding: calc(env(safe-area-inset-top, 0px) + 14px) 0 112px; }
1003
+ .pa h1, .pa h2, .pa ul { margin: 0; padding: 0; }
1004
+ .pa ul { list-style: none; }
1005
+ .pa-top { min-height: 44px; display: flex; align-items: center; padding-right: 44px; margin-bottom: 14px; }
1006
+ .pa-top h1 { font-size: var(--fs-display); font-weight: var(--fw-strong); line-height: 1.25; }
1007
+ .pa-none { margin: 12px 0; font-size: var(--fs-body); color: var(--cz-ink3); line-height: var(--lh-body); }
1008
+ .pa-g { padding-top: 16px; }
1009
+ .pa-g h2 { display: flex; align-items: center; gap: 10px; padding: 4px 0 6px; font-size: var(--fs-body); font-weight: var(--fw-strong); line-height: var(--lh-body); color: var(--cz-ink); }
1010
+ .pa-gi { flex: none; width: 24px; height: 24px; border-radius: 7px; display: inline-grid; place-items: center; background: var(--cz-bluebg); color: var(--cz-blue); }
1011
+ .pa-gi.loose { background: var(--cz-well); color: var(--cz-ink3); }
1012
+ .pa-gt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1013
+ .pa-g h2 em { font-style: normal; font-weight: var(--fw-regular); color: var(--cz-ink3); font-size: var(--fs-meta); }
1014
+ .pa-r { all: unset; box-sizing: border-box; position: relative; width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 10px 0 10px 18px; border-bottom: 1px solid var(--cz-hair); cursor: pointer; }
1015
+ .pa-r:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
1016
+ .pa-d { position: absolute; left: 0; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--cz-blue); }
1017
+ .pa-x { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
1018
+ .pa-x b { font-size: var(--fs-row); font-weight: var(--fw-strong); line-height: var(--lh-row); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1019
+ .pa-x small { font-size: var(--fs-meta); color: var(--cz-ink3); line-height: var(--lh-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1020
+ .pa-r time { flex: none; font-size: var(--fs-meta); color: var(--cz-ink3); line-height: var(--lh-row); }
1021
+ .pa-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 8px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--cz-card); }
1022
+ .pa-new { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 6px 0 14px; border-radius: 999px; background: var(--cz-well); color: var(--cz-ink3); cursor: text; }
1023
+ .pa-ph { flex: 1; font-size: var(--fs-field); }
1024
+ .pa-pl, .pa-mic { display: inline-grid; place-items: center; color: var(--cz-ink2); }
1025
+ .pa-go { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--cz-solid); color: var(--cz-onsolid); }
1026
+ }
@@ -31,6 +31,12 @@
31
31
  * the round Live button keeps its list at the foot of the rail. A phone keeps the floating button and its menu as they were.
32
32
  * FROM THE TOP BAR (batch 31 item 5, board RcBmenu): openMenu({ anchor, rows }) opens the same menu under a page's own ⋯ (the phone
33
33
  * chat has no round button). rows go on top of the places, each { label, icon, dot, go }; the menu closes and focus goes back to the anchor.
34
+ * THE PHONE (phone design, boards Ph2_menu and Ph2_today on Exploring 2; build brief nav-structure/phone/build-brief-v2.md): no round button
35
+ * and no bottom bar. The same button (#czFab) is a ⋯ at the top right of every page, with one small blue dot while something waits on you
36
+ * (zero is silence). It opens phoneMenuHtml(): "Waiting on you N" (the lines for today plus the chats that wait for you; it opens Today,
37
+ * or Ask PMOS when only chats wait), "Live now N" while sessions run, then Today, Work, Ask PMOS and Settings. Goals, Events, Library and
38
+ * Routine are not in the phone menu for now (their pages still open from a link). Ask PMOS on a phone is Home's page (premium.html?chats=1), which
39
+ * lists the chats by work (pm/phone-ask.js). The page's own ⋯ (the phone chat) opens the same menu; its own rows are not added on a phone.
34
40
  */
35
41
  import { esc, svg, ICON, wsQ } from './cozy-evui.js';
36
42
  import { fabLabel, bannerOf } from './cozy-evmodel.js';
@@ -56,13 +62,26 @@ const ALL_PLACES = [
56
62
  { key: 'routine', label: 'Routine', href: '/premium-routine.html', d: RAIL_ICON.routine }, // slice 8 shipped: Routine is a place
57
63
  ];
58
64
  export const PLACES = ALL_PLACES.filter((p) => p.href);
65
+ /* The phone's places (Ph2_menu): Today, Work, Ask PMOS; Settings is the last row. 'ask' is Home's page (premium.html) on a phone. */
66
+ const SPARK = 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z';
67
+ const GEAR = 'M12 9a3 3 0 1 0 0 6a3 3 0 1 0 0-6M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z';
68
+ export const PHONE_PLACES = [
69
+ { key: 'home', label: 'Today', href: '/today.html', d: RAIL_ICON.today },
70
+ { key: 'board', label: 'Work', href: '/premium-board.html', d: RAIL_ICON.work },
71
+ { key: 'ask', label: 'Ask PMOS', href: '/premium.html?chats=1', d: SPARK }, // ?chats: a bare /premium.html opens Today (server.js)
72
+ ];
73
+ const PHONE_Q = '(max-width: 760px)';
74
+ /** A phone: the ⋯ at the top right and the phone menu. */
75
+ export const phoneOn = () => typeof matchMedia === 'function' && matchMedia(PHONE_Q).matches;
76
+ /** The place a phone page is: Home's page is Ask PMOS there, Today's page (body[data-today]) is Today. */
77
+ export const phoneHere = (here, doc = typeof document !== 'undefined' ? document : null) => (here === 'home' && doc && doc.body && !doc.body.hasAttribute('data-today') ? 'ask' : here);
59
78
  const DESK = '(min-width: 761px)';
60
79
  /** The rail is drawn on a desktop; a phone keeps the floating button. */
61
80
  export const railOn = () => typeof matchMedia === 'function' && matchMedia(DESK).matches;
62
81
  export { fabLabel };
63
82
  const THEME_KEY = 'pmos.c3.theme';
64
83
  const CSS = new URL('./cozy-ev.css', import.meta.url).href;
65
- const N = { news: 0, stale: null, here: 'home', calls: 0, fresh: new Set(), extra: [], from: null, waiting: 0, rail: false };
84
+ const N = { news: 0, stale: null, here: 'home', calls: 0, fresh: new Set(), extra: [], from: null, waiting: 0, live: 0, rail: false, phone: false };
66
85
  let OPEN = null; // mountNav's own open(o): openMenu reaches the one menu of the page
67
86
  /* A place that just opened (onboarding B3, ObA4Gradual; GET /api/moments places[p].dot): its menu row gets one soft blue dot until the PM
68
87
  * first opens it. Reports live in Intelligence, so their dot is on the Intelligence row. */
@@ -101,6 +120,21 @@ export function menuHtml(here, o = {}) {
101
120
  + '</div>';
102
121
  }
103
122
 
123
+ /** The phone's menu (board Ph2_menu); pure, so a unit test can read it. here: home (Today) | board (Work) | ask | any other page.
124
+ * o: { calls, waiting, live, stale, extra }. extra: the shown item's own ⋯ rows [{ label, danger }], drawn first. calls: Today's lines for today; waiting: the chats that wait for you; live: the sessions running.
125
+ * "Waiting on you" is calls + waiting, and a row with zero is not drawn (zero is silence). */
126
+ export function phoneMenuHtml(here, o = {}) {
127
+ const wait = (o.calls > 0 ? o.calls : 0) + (o.waiting > 0 ? o.waiting : 0), live = o.live > 0 ? o.live : 0;
128
+ const n = (v) => `<span class="ev-k">${esc(v > 99 ? '99+' : v)}</span>`;
129
+ const top = (wait ? `<button type="button" class="ev-mi ev-x" data-cz-wait aria-label="${esc('Waiting on you: ' + wait)}">${svg(ICON.chat, 18)}<span>Waiting on you</span>${n(wait)}<i class="ev-md you" aria-hidden="true"></i></button>` : '')
130
+ + (live ? `<button type="button" class="ev-mi ev-x" data-cz-live aria-label="${esc('Live now: ' + live)}">${svg('M12 9a3 3 0 1 0 0 6a3 3 0 1 0 0-6M6 6a8.5 8.5 0 0 0 0 12M18 6a8.5 8.5 0 0 1 0 12', 18)}<span>Live now</span>${n(live)}</button>` : '');
131
+ // the shown item's own ⋯ rows lead the menu (cozy-viewer.js phoneMoreRows): the page has one ⋯
132
+ const own = (o.extra || []).map((x, i) => `<button type="button" class="ev-mi${x.danger ? ' bad' : ''}" data-cz-extra="${i}"><span>${esc(x.label)}</span></button>`).join('');
133
+ const places = PHONE_PLACES.map((p) => `<a href="${p.href}"${p.key === here ? ' aria-current="page"' : ''}${p.key === 'ask' ? ' data-cz-ask' : ''}>${svg(p.d, 18)}${p.key === here ? `<b>${p.label}</b>` : `<span>${p.label}</span>`}</a>`).join('');
134
+ return own + (own ? '<hr class="ev-hr">' : '') + top + (top ? '<hr class="ev-hr">' : '') + places
135
+ + `<button type="button" class="ev-mi" data-cz-settings aria-label="Settings${o.stale ? '. ' + esc(o.stale.text) : ''}">${svg(GEAR, 18)}<span>Settings</span>${o.stale ? '<i class="ev-md risk" aria-hidden="true"></i>' : ''}</button>`;
136
+ }
137
+
104
138
  /** The rail's markup; pure, so a unit test can read it. here: home | board | insights. o: { calls, stale, fresh, waiting }
105
139
  * calls: the calls that are yours (Today's number); waiting: the sessions that wait for you (the chat icon's number). Zero is silence. */
106
140
  export function railHtml(here, o = {}) {
@@ -132,6 +166,9 @@ export const callWords = (n) => (n === 1 ? 'One call is yours' : n + ' calls are
132
166
  export function openMenu(o = {}) { if (OPEN) OPEN(o); }
133
167
 
134
168
  /** Mount the menu once. `here` is home | board | insights. Returns the wrapper. */
169
+ /** An open item's ⋯ on a phone (pm/cozy-viewer.js moreMenu) ends with the places and Settings, so the screen keeps one ⋯. */
170
+ if (typeof window !== 'undefined') window.__czPhonePlaces = () => (phoneOn() ? PHONE_PLACES.map((p) => ({ label: p.label, on: () => location.assign(p.href) }))
171
+ .concat({ label: 'Settings', on: () => import('./cozy-phone-settings.js').then((M) => M.openPhoneSettings()) }) : []);
135
172
  export function mountNav(here, doc = document, opts = {}) {
136
173
  const old = doc.getElementById('czNav'); if (old) return old;
137
174
  N.here = here;
@@ -142,7 +179,7 @@ export function mountNav(here, doc = document, opts = {}) {
142
179
  const w = doc.createElement('div'); w.className = 'cz-fabw'; w.id = 'czNav';
143
180
  w.innerHTML = '<div class="ev-scrim" id="czScrim" hidden></div>'
144
181
  + `<nav class="cz-fabm ev-menu" id="czMenu" aria-label="Menu" hidden></nav>`
145
- + `<button type="button" class="cz-fab" id="czFab" aria-controls="czMenu" aria-expanded="false" aria-label="${fabLabel(here, false)}">${svg(ICON.menu, 22)}</button>`
182
+ + `<button type="button" class="cz-fab" id="czFab" aria-controls="czMenu" aria-expanded="false" aria-label="${fabLabel(here, false)}">${svg(phoneOn() ? ICON.more : ICON.menu, 22)}</button>`
146
183
  + '<i class="ev-fd you" id="czFdYou" hidden></i><i class="ev-fd risk" id="czFdRisk" hidden></i>';
147
184
  doc.body.appendChild(w);
148
185
  mountToastFaces(doc); loadPrefs();
@@ -162,6 +199,18 @@ export function mountNav(here, doc = document, opts = {}) {
162
199
  return;
163
200
  }
164
201
  menu.__h = '';
202
+ N.phone = phoneOn();
203
+ doc.body.classList.toggle('cz-phmore', N.phone); // a phone: the button is the ⋯ at the top right (cozy-ev.css)
204
+ menu.classList.toggle('ev-phm', N.phone);
205
+ if (N.phone) {
206
+ menu.innerHTML = phoneMenuHtml(phoneHere(here, doc), { calls: N.calls, waiting: N.waiting, live: N.live, stale: N.stale, extra: N.extra });
207
+ const any = N.calls > 0 || N.waiting > 0;
208
+ // one dot on ⋯: amber while a source needs the PM, else blue while something waits on you
209
+ w.querySelector('#czFdRisk').hidden = !N.stale || !menu.hidden;
210
+ w.querySelector('#czFdYou').hidden = !!N.stale || !any || !menu.hidden;
211
+ if (menu.hidden) fab.setAttribute('aria-label', 'Menu' + (N.calls > 0 ? '. ' + callWords(N.calls) : '') + (N.waiting > 0 ? '. ' + N.waiting + (N.waiting === 1 ? ' chat waits' : ' chats wait') + ' on you' : '') + (N.stale ? '. ' + (N.stale.text || 'A source is stale') : ''));
212
+ return;
213
+ }
165
214
  menu.innerHTML = menuHtml(here, { calls: N.calls, stale: N.stale, fresh: N.fresh, extra: N.extra });
166
215
  const opened = [...N.fresh].some((k) => k !== here);
167
216
  // one dot: amber while a source needs the PM, else blue while a call is theirs or a place has something new
@@ -173,7 +222,7 @@ export function mountNav(here, doc = document, opts = {}) {
173
222
  if (N.rail) { if (N.from) { N.from.setAttribute('aria-expanded', 'false'); N.from = null; N.extra = []; } draw(); return; } // the rail is always shown
174
223
  if (!open && N.from) { N.from.setAttribute('aria-expanded', 'false'); N.from = null; N.extra = []; w.classList.remove('cz-top'); }
175
224
  menu.hidden = !open; scrim.hidden = !open; fab.setAttribute('aria-expanded', String(open));
176
- fab.setAttribute('aria-label', fabLabel(here, open, N.stale)); fab.innerHTML = svg(open ? ICON.close : ICON.menu, 22);
225
+ fab.setAttribute('aria-label', fabLabel(here, open, N.stale)); fab.innerHTML = phoneOn() ? svg(ICON.more, 22) : svg(open ? ICON.close : ICON.menu, 22);
177
226
  draw();
178
227
  if (open) { const f = menu.querySelector('a, button'); if (f) f.focus(); }
179
228
  };
@@ -181,13 +230,13 @@ export function mountNav(here, doc = document, opts = {}) {
181
230
  if (N.rail) return; // a desktop has no menu to open: the rail is the menu (the ⋯ that calls this is the phone chat's)
182
231
  const back = N.from;
183
232
  if (!menu.hidden) { set(false); if (back === o.anchor) { if (back) back.focus(); return; } }
184
- N.from = o.anchor || null; N.extra = o.rows || [];
233
+ N.from = o.anchor || null; N.extra = phoneOn() ? [] : o.rows || []; // a phone's menu has its own Waiting on you and Live now
185
234
  w.classList.toggle('cz-top', !!N.from);
186
235
  if (N.from) N.from.setAttribute('aria-expanded', 'true');
187
236
  set(true);
188
237
  };
189
238
  draw();
190
- fab.addEventListener('click', () => set(menu.hidden));
239
+ fab.addEventListener('click', () => { if (menu.hidden && phoneOn() && !N.rail) N.extra = typeof window.__czVwMore === 'function' ? window.__czVwMore(fab) : []; set(menu.hidden); });
191
240
  scrim.addEventListener('click', () => set(false));
192
241
  doc.addEventListener('keydown', (e) => { if (e.key === 'Escape' && !menu.hidden && !N.rail) { e.stopPropagation(); const back = N.from || fab; set(false); back.focus(); } }, true);
193
242
  // set() redraws the button's icon, so the pressed icon may be gone from the page by now: only a press still on the page closes the menu
@@ -195,6 +244,7 @@ export function mountNav(here, doc = document, opts = {}) {
195
244
  doc.addEventListener('click', (e) => { if (!menu.hidden && !N.rail && e.target.isConnected && !w.contains(e.target) && !(N.from && N.from.contains(e.target))) set(false); });
196
245
  menu.addEventListener('click', (e) => {
197
246
  // the page you are on, pressed again: a page that passes opts.here goes back to its start without a reload (Home: the list, no page open)
247
+ if (N.phone && doc.body.classList.contains('phs-on')) import('./cozy-phone-settings.js').then((M) => { if (e.target.closest('a[aria-current="page"], [data-cz-wait], [data-cz-live]')) M.closePhoneSettings(); });
198
248
  const a = e.target.closest('a[aria-current="page"]');
199
249
  if (a && N.rail && !opts.here) { e.preventDefault(); return; } // the rail: pressing the place you are on reloads nothing
200
250
  if (a && opts.here && !e.metaKey && !e.ctrlKey && !e.shiftKey) { e.preventDefault(); set(false); opts.here(); return; }
@@ -202,11 +252,22 @@ export function mountNav(here, doc = document, opts = {}) {
202
252
  const x = 'czExtra' in b.dataset ? N.extra[+b.dataset.czExtra] : null;
203
253
  set(false);
204
254
  if (x) { if (x.go) x.go(); return; }
255
+ // the phone's Waiting on you: Today while lines for today wait (Today's own page scrolls to its top), else Ask PMOS, where the chats
256
+ // that wait carry their dot; Live now opens the Live list (pm/cozy-live-pill.js)
257
+ if ('czWait' in b.dataset) {
258
+ const to = N.calls > 0 ? 'home' : 'ask', cur = phoneHere(here, doc);
259
+ if (to === cur) { if (opts.here) opts.here(); else scrollTo(0, 0); return; }
260
+ location.assign(to === 'home' ? '/today.html' + wsQ() : '/premium.html?chats=1' + wsQ('&'));
261
+ return;
262
+ }
263
+ if ('czLive' in b.dataset) { doc.dispatchEvent(new CustomEvent('cz:live-open')); return; }
205
264
  if ('czChat' in b.dataset && N.rail && typeof window.czOpenChat === 'function') { window.czOpenChat(); return; } // the popup with the chat (slice 2)
206
265
  if ('czChat' in b.dataset) { if (opts.chat) opts.chat(); else import('./page-chat.js').then((M) => M.openCos({ here: opts.where ? opts.where() : PLACES.find((p) => p.key === here) ? PLACES.find((p) => p.key === here).label : '' })); }
207
266
  else if ('czSearch' in b.dataset) import('./cozy-search.js').then((M) => M.openSearch({ ...(opts.search ? { go: opts.search() } : {}), ...(opts.scope ? { scope: opts.scope() } : {}) }));
208
267
  // a stale source opens Settings at Connectors, the stale one first (FmA3Settings: open where it matters)
209
268
  else if ('czGuide' in b.dataset) import('./premium-vw-open.js').then((M) => M.openGuide('index'));
269
+ // a phone opens its one-screen Settings (Ph2_more, pm/cozy-phone-settings.js); a computer the full dialog
270
+ else if ('czSettings' in b.dataset && N.phone) import('./cozy-phone-settings.js').then((M) => M.openPhoneSettings());
210
271
  else if ('czSettings' in b.dataset) import('./cozy-settings.js').then((M) => M.openSettings(N.stale ? 'connectors' : undefined));
211
272
  });
212
273
  // Ctrl K (Cmd K) and "/" open Search from any page; a second press focuses it
@@ -251,8 +312,13 @@ export function mountNav(here, doc = document, opts = {}) {
251
312
  addEventListener('storage', (e) => { if (e.key === 'pmos.today.count') storedCalls(); });
252
313
  doc.addEventListener('adler:prefs', () => draw());
253
314
  // the chat icon's number: the sessions that wait for you (cozy-live-pill.js counts them)
254
- doc.addEventListener('cz:live-n', (e) => { const a = e.detail && Number(e.detail.asks); const v = Number.isFinite(a) && a > 0 ? a : 0; if (v !== N.waiting) { N.waiting = v; draw(); } });
315
+ doc.addEventListener('cz:live-n', (e) => {
316
+ const a = e.detail && Number(e.detail.asks), l = e.detail && Number(e.detail.n);
317
+ const v = Number.isFinite(a) && a > 0 ? a : 0, lv = Number.isFinite(l) && l > 0 ? l : 0;
318
+ if (v !== N.waiting || lv !== N.live) { N.waiting = v; N.live = lv; draw(); }
319
+ });
255
320
  if (typeof matchMedia === 'function') { const mq = matchMedia(DESK); const f = () => { if (!N.rail) set(false); draw(); }; if (mq.addEventListener) mq.addEventListener('change', f); }
321
+ if (typeof matchMedia === 'function') { const mp = matchMedia(PHONE_Q); const f = () => { if (!N.rail) set(false); }; if (mp.addEventListener) mp.addEventListener('change', f); }
256
322
  window.addEventListener('pm:sources', (e) => { const d = e.detail; if (d && d.ok) { N.stale = bannerOf(d.sources); draw(); } });
257
323
  return w;
258
324
  }
@@ -0,0 +1,68 @@
1
+ /* pm/cozy-phone-rec.css — the recording tab on a phone (board Ph2_record; pm/cozy-phone-rec.js). Phone only (max-width 760px) and only while the
2
+ * meeting records or is paused (body.phr-on): one light page, no cards. The desktop recording tab is unchanged. Token vars from cozy.css only. */
3
+ @media (max-width: 760px) {
4
+ body.phr-on.rt-page { background: var(--cz-card); }
5
+ body.phr-on .rt { padding: 0; gap: 0; }
6
+ body.phr-on .rt-main, body.phr-on .rt[data-mode="screen"] .rt-main { border-radius: 0; box-shadow: none; background: var(--cz-card); color: var(--cz-ink); padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 0; min-height: 0; }
7
+ body.phr-on .rt-side { border-radius: 0; box-shadow: none; background: var(--cz-card); overflow: visible; }
8
+ body.phr-on .rt { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); }
9
+
10
+ /* the header: red dot, clock, title, a small red stop; the ⋯ sits to its right (cozy-nav.js) */
11
+ body.phr-on .rt-hd { padding-right: 44px; gap: 8px; }
12
+ body.phr-on .rt-ad { display: none; }
13
+ body.phr-on .rt-title { flex: 1; }
14
+ .rt-phstop { display: none; }
15
+ body.phr-on .rt-phstop { display: inline-flex; flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0; align-items: center; justify-content: center; background: var(--cz-dot-red); color: var(--cz-onsolid); cursor: pointer; }
16
+ body.phr-on .rt-phstop svg { fill: currentColor; }
17
+ body.phr-on .rt-phstop:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
18
+ .phr-told { margin: 0 0 0 18px; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink3); }
19
+ .phr-told[hidden] { display: none; }
20
+
21
+ /* no bar and no meeting-so-far line on a phone; the stop is in the header. Paused keeps the bar's Resume */
22
+ body.phr-on .rt:not([data-mode="paused"]) .rt-bar, body.phr-on .rt-line { display: none; }
23
+ body.phr-on .rt[data-mode="paused"] .rt-bar [data-a="stop"], body.phr-on .rt-bar .rt-slot { display: none; }
24
+ body.phr-on .rt-stage { margin-top: 0; flex: none; }
25
+ body.phr-on.phr-cut .rt-own { display: none; }
26
+ body.phr-on .rt-scr { max-height: 220px; margin-top: 12px; }
27
+ body.phr-on .rt[data-mode="paused"] .rt-wait { align-items: flex-start; text-align: left; margin-top: 12px; }
28
+ body.phr-on .rt[data-mode="paused"] .rt-wait h2 { display: none; }
29
+ body.phr-on .rt[data-mode="paused"] .rt-wait p { margin: 0; font-size: var(--fs-meta); line-height: var(--lh-meta); }
30
+
31
+ /* Shared screen, cut to the slide */
32
+ .phr-scr, .phr-sf { margin-top: 20px; }
33
+ .phr h5 { margin: 0 0 8px; display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-meta); line-height: var(--lh-meta); font-weight: var(--fw-regular); color: var(--cz-ink3); }
34
+ .phr-big { border-radius: 10px; overflow: hidden; background: var(--cz-c-17191c); }
35
+ .phr-crop { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; }
36
+ .phr-crop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
37
+ .phr-crop.boxed img { inset: auto; object-fit: fill; max-width: none; }
38
+ .phr-th { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
39
+ .phr-tb { width: 36px; border-radius: 4px; overflow: hidden; background: var(--cz-well); flex: none; }
40
+ .phr-tb.on { box-shadow: 0 0 0 2px var(--cz-blue); }
41
+ .phr-th small { margin-left: 6px; font-size: var(--fs-meta); color: var(--cz-ink3); }
42
+
43
+ /* So far: newest first, each point with its time */
44
+ .phr-sf ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
45
+ .phr-sf li { display: grid; grid-template-columns: 48px 1fr; align-items: start; }
46
+ .phr-sf time { font-size: var(--fs-meta); line-height: var(--lh-body); color: var(--cz-ink3); font-variant-numeric: tabular-nums; }
47
+ .phr-sf li span { padding-left: 12px; border-left: 2px solid var(--cz-hair); font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
48
+ .phr-sf li.now span { border-left-color: var(--cz-blue); }
49
+
50
+ /* the Now panel on a phone: PMOS proposes and the note box only. No topic line, no "Next" chips, no Caught so far (So far says it) */
51
+ body.phr-on .rn-room .rn-nw { padding: 0; gap: 0; justify-content: flex-start; }
52
+ body.phr-on .rn-now, body.phr-on .rn-stp, body.phr-on .rn-cgt, body.phr-on .rn-sec[aria-label="To cover"] { display: none; }
53
+ body.phr-on .rt-side .rn-nw { padding: 0 16px; }
54
+ body.phr-on .rn-sec[aria-label="PMOS heard"] { margin-top: 20px; }
55
+ body.phr-on .rn-sec[aria-label="PMOS heard"] > h5 { display: none; }
56
+ body.phr-on .mb-card { border-radius: 0; box-shadow: none; background: none; overflow: visible; }
57
+ body.phr-on .mb-r { padding: 12px 0; border-bottom: 1px solid var(--cz-hair); border-top: 0; background: var(--cz-card); font-size: var(--fs-body); line-height: var(--lh-body); }
58
+ body.phr-on .mb-consent, body.phr-on .mb-draft { background: var(--cz-card); }
59
+ body.phr-on .mb-r .t small { font-size: var(--fs-meta); line-height: var(--lh-meta); margin-bottom: 2px; }
60
+ body.phr-on .mb-line { margin-top: 8px; padding: 2px 0 2px 12px; border-radius: 0; background: none; border-left: 2px solid var(--cz-blue); }
61
+ body.phr-on [data-mb="consent-x"], body.phr-on [data-mb="chat-x"] { display: none; }
62
+ body.phr-on .mb-ib, body.phr-on .mb-ib.go { width: 32px; height: 32px; border: 0; background: none; color: var(--cz-blue); }
63
+ body.phr-on .mb-r.sw-on { transition: none; }
64
+ body.phr-on .mb-r { transition: transform .18s ease; }
65
+
66
+ /* the note box rests at the foot */
67
+ body.phr-on .rn-room .rn-mine, body.phr-on .rt-side .rn-mine { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); width: auto; max-width: none; margin: 0; z-index: 4; background: var(--cz-well); box-shadow: none; border-radius: 26px; }
68
+ }
@@ -0,0 +1,105 @@
1
+ /* pm/cozy-phone-rec.js — the recording tab on a phone (phone design, board Ph2_record; build brief nav-structure/phone/build-brief-v2.md item 5).
2
+ *
3
+ * soFar(F, { max? }) → [{ at, time, text }] pure: "So far", the companion's gists newest first, each with its wall time (HH:MM).
4
+ * GET /api/meeting-focus `gists`; an older server with only `gist` gives one point.
5
+ * slidesOf(one) → { shots: [{ t, box, w, h }], latest } pure: the shared screen cut to the slide (Jev's box), faces left out, oldest first
6
+ * phoneRecHtml({ noteId, points, slides, wallOf }) → string the Shared screen section (only with slides) and So far (only with points)
7
+ * mountPhoneRec(slots, ctx) pm/cozy-rec-tab.js calls it on a phone; ctx is the Now panel's ctx (cozy-rec-now.js)
8
+ *
9
+ * The phone page, top to bottom: red dot, clock, title and a small red stop (the tab's own header, with the stop moved into it);
10
+ * "Recording. Everyone in the room is told." once the PM copied the consent line, "Recording." before; the shared screen as Jev's
11
+ * cut to the slide with its thumbnails, only when a screen is shared and a slide is kept; "So far", newest first; "PMOS proposes"
12
+ * (the buddy's consent line and call-chat drafts, cozy-rec-now.js, drawn flat on a phone and swiped: right copies, left drops); the
13
+ * note box "Note, or ask PMOS". No "Next on the agenda" line and no button bar: the desktop keeps both.
14
+ * Reads nothing itself: the tab's GET /api/notes/one (ctx.note) and GET /api/meeting-focus (ctx.focus). Writes nothing itself. */
15
+ import { wireSwipe } from './cozy-phone-swipe.js';
16
+
17
+ const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
18
+ const pad = (n) => String(n).padStart(2, '0');
19
+ const hm = (ms) => { const d = new Date(ms); return pad(d.getHours()) + ':' + pad(d.getMinutes()); };
20
+ export const PHONE_REC_Q = '(max-width: 760px)';
21
+ const GIST_MAX = 8, THUMBS_MAX = 6;
22
+
23
+ export function soFar(F, { max = GIST_MAX } = {}) {
24
+ const f = F && F.ok !== false ? F || {} : {};
25
+ let list = Array.isArray(f.gists) ? f.gists.filter((g) => g && typeof g.text === 'string' && g.text.trim() && Number.isFinite(g.at)) : [];
26
+ if (!list.length && typeof f.gist === 'string' && f.gist.trim()) {
27
+ const at = Number.isFinite(f.companion && Date.parse(f.companion.last_run_at)) ? Date.parse(f.companion.last_run_at) : Number(f.now_ms);
28
+ if (Number.isFinite(at)) list = [{ at, text: f.gist }];
29
+ }
30
+ return list.slice().reverse().slice(0, max).map((g) => ({ at: g.at, time: hm(g.at), text: g.text.trim() }));
31
+ }
32
+
33
+ export function slidesOf(one) {
34
+ const fr = one && one.ok !== false && one.screen && Array.isArray(one.screen.frames) ? one.screen.frames : [];
35
+ const shots = fr.filter((f) => f && Number.isFinite(f.t) && !(f.jev && f.jev.kind === 'faces'))
36
+ .map((f) => ({ t: f.t, w: f.w || 16, h: f.h || 9, box: f.jev && Array.isArray(f.jev.box) && f.jev.box.length === 4 ? f.jev.box : null }));
37
+ return { shots, latest: shots.length ? shots[shots.length - 1] : null };
38
+ }
39
+
40
+ const shot = (id, s) => `<span class="phr-crop"><img alt="" src="/api/notes/screen?id=${encodeURIComponent(id)}&amp;t=${s.t}"${s.box ? ` data-box="${s.box.join(',')}" data-wh="${s.w},${s.h}"` : ''}></span>`;
41
+
42
+ export function phoneRecHtml({ noteId = '', points = [], slides = null, wallOf = null } = {}) {
43
+ let h = '';
44
+ if (noteId && slides && slides.latest) {
45
+ const L = slides.latest, at = typeof wallOf === 'function' ? wallOf(L.t) : '';
46
+ const thumbs = slides.shots.slice(-THUMBS_MAX);
47
+ h += `<section class="phr-scr" aria-label="Shared screen"><h5>Shared screen<span>${esc([at, L.box ? 'cut to the slide' : ''].filter(Boolean).join(' · '))}</span></h5>`
48
+ + `<div class="phr-big">${shot(noteId, L)}</div>`
49
+ + (slides.shots.length > 1 ? `<div class="phr-th">${thumbs.map((s) => `<span class="phr-tb${s === L ? ' on' : ''}">${shot(noteId, s)}</span>`).join('')}<small>${slides.shots.length} slides</small></div>` : '')
50
+ + '</section>';
51
+ }
52
+ if (points.length) {
53
+ h += `<section class="phr-sf" aria-label="So far"><h5>So far</h5><ol>${points.map((p, i) => `<li${i === 0 ? ' class="now"' : ''}><time>${esc(p.time)}</time><span>${esc(p.text)}</span></li>`).join('')}</ol></section>`;
54
+ }
55
+ return h;
56
+ }
57
+
58
+ /** Jev's box: the image is scaled and moved so only the box shows (the Viewer's crop, premium-vw-mtg.js). */
59
+ function crop(root) {
60
+ root.querySelectorAll('img[data-box]').forEach((im) => {
61
+ const [x, y, w, h] = im.dataset.box.split(',').map(Number), [fw, fh] = String(im.dataset.wh || '16,9').split(',').map(Number);
62
+ if (![x, y, w, h].every(Number.isFinite) || !(w > 0) || !(h > 0)) return;
63
+ const fr = im.closest('.phr-crop'); if (fr) { fr.classList.add('boxed'); fr.style.setProperty('aspect-ratio', String((w * (fw || 16)) / (h * (fh || 9)))); }
64
+ im.style.setProperty('width', (100 / w) + '%'); im.style.setProperty('height', (100 / h) + '%');
65
+ im.style.setProperty('left', (-x / w * 100) + '%'); im.style.setProperty('top', (-y / h * 100) + '%');
66
+ });
67
+ }
68
+
69
+ export function mountPhoneRec(slots, ctx) {
70
+ if (typeof matchMedia !== 'function' || !slots || !ctx) return;
71
+ const on = () => matchMedia(PHONE_REC_Q).matches;
72
+ const main = slots.stage && slots.stage.parentElement; if (!main) return;
73
+ if (!document.querySelector('link[data-phr-css]')) {
74
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = new URL('./cozy-phone-rec.css', import.meta.url).href; l.setAttribute('data-phr-css', '');
75
+ document.head.appendChild(l);
76
+ }
77
+ // the small red stop in the header; the tab's own click handler (data-a="stop") asks first, as on a computer
78
+ const hd = main.querySelector('.rt-hd');
79
+ if (hd && !hd.querySelector('.rt-phstop')) hd.insertAdjacentHTML('beforeend', '<button type="button" class="rt-phstop" data-a="stop" aria-label="Stop the recording" title="Stop the recording"><svg aria-hidden="true" width="14" height="14" viewBox="0 0 24 24"><rect x="6" y="6" width="12" height="12" rx="2"/></svg></button>');
80
+ const told = document.createElement('p'); told.className = 'phr-told'; told.hidden = true;
81
+ const sec = document.createElement('div'); sec.className = 'phr';
82
+ hd.after(told); told.after(sec);
83
+ const one = () => { try { return ctx.note(); } catch { return null; } };
84
+ const focus = () => { try { return ctx.focus(); } catch { return null; } };
85
+ const mode = () => { try { return ctx.mode(); } catch { return 'idle'; } };
86
+ let last = '';
87
+ const draw = () => {
88
+ const live = ['screen', 'room', 'paused'].includes(mode());
89
+ document.body.classList.toggle('phr-on', on() && live);
90
+ if (!on() || !live) { if (last) { sec.innerHTML = ''; told.hidden = true; last = ''; } return; }
91
+ const O = one(), F = focus(), n = O && O.note;
92
+ const from = n && Date.parse(n.recorded_from || '');
93
+ const consent = !!main.closest('.rt') && !!document.querySelector('#rt .mb-consent');
94
+ told.hidden = false;
95
+ told.textContent = mode() === 'paused' ? 'Paused.' : consent ? 'Recording.' : 'Recording. Everyone in the room is told.';
96
+ const html = phoneRecHtml({ noteId: n ? n.id : '', points: soFar(F), slides: mode() === 'screen' ? slidesOf(O) : null, wallOf: (t) => (Number.isFinite(from) ? hm(from + t) : '') });
97
+ if (html !== last) { last = html; sec.innerHTML = html; crop(sec); }
98
+ document.body.classList.toggle('phr-cut', mode() === 'screen' && !!sec.querySelector('.phr-scr'));
99
+ };
100
+ ctx.on('note', draw); ctx.on('mode', draw); ctx.on('tick', () => { if (Date.now() % 5000 < 1000) draw(); });
101
+ matchMedia(PHONE_REC_Q).addEventListener('change', draw);
102
+ // PMOS proposes: right copies the line, left puts it away (the rows' own buttons, so the buddy's marks and Undo stay theirs)
103
+ wireSwipe(document.getElementById('rt'), { on, act: (row, way) => { const a = way === 'right' ? row.dataset.swRight : row.dataset.swLeft; const b = a && row.querySelector(`[data-mb="${a}"]`); if (b) b.click(); setTimeout(draw, 300); } });
104
+ draw();
105
+ }
@@ -0,0 +1,18 @@
1
+ /* pm/cozy-phone-settings.css — Settings on a phone (board Ph2_more; pm/cozy-phone-settings.js). One white screen under the menu's ⋯ (cozy-ev.css
2
+ * keeps the ⋯ above it), a 16 px gutter, hairlines between the rows, no cards. */
3
+ .phs { position: fixed; inset: 0; z-index: 65; overflow: auto; box-sizing: border-box; padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px 32px;
4
+ background: var(--cz-card); color: var(--cz-ink); font-family: var(--cz-sans); }
5
+ .phs[hidden] { display: none; }
6
+ body.phs-on { overflow: hidden; }
7
+ .phs-h { margin: 0 44px 12px 0; font-size: var(--fs-display); font-weight: var(--fw-strong); line-height: 1.25; }
8
+ .phs-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--cz-hair); }
9
+ .phs-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
10
+ .phs-t b { font-size: var(--fs-row); font-weight: var(--fw-strong); line-height: var(--lh-row); }
11
+ .phs-t small { font-size: var(--fs-meta); color: var(--cz-ink3); line-height: var(--lh-meta); }
12
+ .phs-t .phs-said { color: var(--cz-ink2); }
13
+ .phs .phs-seg button { height: 34px; padding: 0 10px; font-size: var(--fs-body); font-weight: var(--fw-regular); }
14
+ .phs .phs-seg button[aria-pressed="true"] { font-weight: var(--fw-strong); }
15
+ .phs-b { flex: none; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); font: inherit; font-size: var(--fs-row); font-weight: var(--fw-strong); cursor: pointer; }
16
+ .phs-b:disabled { color: var(--cz-ink3); }
17
+ .phs-note { margin: 14px 0 0; font-size: var(--fs-body); color: var(--cz-ink2); line-height: var(--lh-body); }
18
+ .phs :focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }