create-pmos 0.631.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 (68) hide show
  1. package/package.json +27 -69
  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 +26 -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/guide/notes.md +7 -3
  17. package/workspace/ini-workflow-test.js +3 -0
  18. package/workspace/lib/extension-cli.js +4 -1
  19. package/workspace/lib/extension-setup.js +93 -0
  20. package/workspace/lib/meeting-focus.js +5 -3
  21. package/workspace/lib/route-modules.js +1 -0
  22. package/workspace/lib/routes-extension.js +23 -0
  23. package/workspace/lib/routes-meeting-focus.js +2 -2
  24. package/workspace/live-pill-round-test.js +7 -2
  25. package/workspace/package-lock.json +2 -2
  26. package/workspace/package.json +1 -1
  27. package/workspace/premium-board-actions-test.js +3 -1
  28. package/workspace/premium-vw-backlog-test.js +2 -2
  29. package/workspace/premium-vw-doc-test.js +3 -0
  30. package/workspace/premium-vw-item-test.js +1 -1
  31. package/workspace/premium-vw-jira-test.js +4 -3
  32. package/workspace/public/pm/bd-ini-panel.js +4 -1
  33. package/workspace/public/pm/bd-prog-panel.js +3 -3
  34. package/workspace/public/pm/bd-views.js +8 -2
  35. package/workspace/public/pm/buddy-core.js +2 -2
  36. package/workspace/public/pm/cozy-board.css +15 -0
  37. package/workspace/public/pm/cozy-buddy.js +2 -0
  38. package/workspace/public/pm/cozy-ev.css +25 -0
  39. package/workspace/public/pm/cozy-ext.js +76 -0
  40. package/workspace/public/pm/cozy-home.css +38 -2
  41. package/workspace/public/pm/cozy-nav.js +72 -6
  42. package/workspace/public/pm/cozy-phone-rec.css +68 -0
  43. package/workspace/public/pm/cozy-phone-rec.js +105 -0
  44. package/workspace/public/pm/cozy-phone-settings.css +18 -0
  45. package/workspace/public/pm/cozy-phone-settings.js +73 -0
  46. package/workspace/public/pm/cozy-phone-swipe.js +51 -0
  47. package/workspace/public/pm/cozy-pop-work.css +56 -0
  48. package/workspace/public/pm/cozy-pop-work.js +72 -4
  49. package/workspace/public/pm/cozy-rec-tab.js +10 -0
  50. package/workspace/public/pm/cozy-settings.js +6 -2
  51. package/workspace/public/pm/cozy-today-app.js +56 -5
  52. package/workspace/public/pm/cozy-today-page.css +75 -1
  53. package/workspace/public/pm/cozy-today-view.js +87 -0
  54. package/workspace/public/pm/cozy-viewer.js +27 -7
  55. package/workspace/public/pm/home-app.js +31 -2
  56. package/workspace/public/pm/home-chat.js +8 -0
  57. package/workspace/public/pm/home-ini.js +7 -3
  58. package/workspace/public/pm/phone-ask.js +57 -0
  59. package/workspace/split-merge-ui-test.js +3 -1
  60. package/workspace/stage-card-tasks-test.js +6 -0
  61. package/workspace/stage-card-test.js +3 -0
  62. package/workspace/task-delete-test.js +3 -0
  63. package/workspace/task-links-test.js +3 -0
  64. package/workspace/task-plans-test.js +3 -0
  65. package/workspace/task-views-test.js +3 -0
  66. package/workspace/test-lists/meeting-buddy.json +1 -1
  67. package/workspace/test-lists/phone-design-v2.json +9 -0
  68. package/workspace/tk-tasks-test.js +4 -0
@@ -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; }
@@ -0,0 +1,73 @@
1
+ /* pm/cozy-phone-settings.js — Settings on a phone (phone design, board Ph2_more on Exploring 2; build brief nav-structure/phone/build-brief-v2.md).
2
+ *
3
+ * One screen, no scrolling: Theme (Light, Dark, Auto: this phone), Version ("PMOS 0.630.0") with Check update, and the note "Connectors,
4
+ * workspaces and updates are on your computer." Nothing else: Product, Your day, Jira writes, Your impact and Signed in stay in the
5
+ * computer's Settings (pm/cozy-settings.js), which a phone no longer opens from the menu. The menu's ⋯ stays at the top right over it.
6
+ *
7
+ * phoneSettingsHtml({ pick, version, said }) → string PURE
8
+ * openPhoneSettings() → the element pm/cozy-nav.js calls it on a phone; Back, Escape or another place closes it
9
+ * closePhoneSettings()
10
+ * Reads GET /api/kit/status (the version) when it opens. Writes only on a press: the theme on this phone (localStorage, cozy-nav.js
11
+ * setTheme) and POST /api/kit/check (Check update; it reads the newest version and changes nothing on the computer). */
12
+ import { pmGet, pmPost } from './http.js';
13
+ import { setTheme, themePick } from './cozy-nav.js';
14
+
15
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
16
+ const S = { el: null, version: '', ws: '', said: '', busy: false, back: null };
17
+ const THEMES = [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']];
18
+
19
+ export function phoneSettingsHtml(o = {}) {
20
+ const pick = o.pick || 'auto';
21
+ const sub = pick === 'auto' ? 'Auto follows your phone' : pick === 'dark' ? 'Dark on this phone' : 'Light on this phone';
22
+ return '<h1 class="phs-h" id="phsTitle">Settings</h1>'
23
+ + `<div class="phs-row"><div class="phs-t"><b id="phsTheme">Theme</b><small>${esc(sub)}</small></div><div class="ev-seg phs-seg" role="group" aria-labelledby="phsTheme">`
24
+ + THEMES.map(([k, l]) => `<button type="button" data-phs-theme="${k}" aria-pressed="${pick === k}">${l}</button>`).join('') + '</div></div>'
25
+ + `<div class="phs-row"><div class="phs-t"><b>Version</b><small>${esc(o.version ? 'PMOS ' + o.version : 'PMOS')}</small>${o.said ? `<small class="phs-said" role="status">${esc(o.said)}</small>` : ''}</div>`
26
+ + `<button type="button" class="phs-b" data-phs-check${o.busy ? ' disabled' : ''}>${o.busy ? 'Checking' : 'Check update'}</button></div>`
27
+ + '<p class="phs-note">Connectors, workspaces and updates are on your computer.</p>';
28
+ }
29
+ function draw() { if (S.el) S.el.innerHTML = phoneSettingsHtml({ pick: themePick(), version: S.version, said: S.said, busy: S.busy }); }
30
+ function addCss() {
31
+ const href = new URL('./cozy-phone-settings.css', import.meta.url).href;
32
+ if (!document.querySelector(`link[href="${href}"]`)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.appendChild(l); }
33
+ }
34
+ async function readVersion() {
35
+ const r = await pmGet('/api/kit/status').catch(() => null);
36
+ if (r && r.ok) { S.version = (r.app && r.app.version) || ''; S.ws = r.ws || ''; draw(); }
37
+ }
38
+ async function check() {
39
+ if (S.busy) return;
40
+ S.busy = true; S.said = ''; draw();
41
+ const r = await pmPost('/api/kit/check', { ws: S.ws || undefined }).catch(() => null);
42
+ S.busy = false;
43
+ if (!r || !r.ok) S.said = 'The check did not go through: ' + ((r && r.error) || 'the computer did not answer') + '.';
44
+ else S.said = r.appBehind || r.kitBehind ? 'PMOS ' + r.latest + ' is ready. Update it on your computer.' : 'This is the newest PMOS.';
45
+ draw();
46
+ }
47
+ export function openPhoneSettings() {
48
+ addCss();
49
+ if (!S.el) {
50
+ S.el = document.createElement('section');
51
+ S.el.className = 'phs'; S.el.id = 'phSettings'; S.el.setAttribute('role', 'dialog'); S.el.setAttribute('aria-modal', 'true'); S.el.setAttribute('aria-labelledby', 'phsTitle');
52
+ document.body.appendChild(S.el);
53
+ S.el.addEventListener('click', (e) => {
54
+ const t = e.target.closest('[data-phs-theme]'); if (t) { setTheme(t.dataset.phsTheme, document); draw(); return; }
55
+ if (e.target.closest('[data-phs-check]')) check();
56
+ });
57
+ document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && S.el && !S.el.hidden) { e.stopPropagation(); closePhoneSettings(); } }, true);
58
+ addEventListener('popstate', () => { if (S.el && !S.el.hidden) closePhoneSettings(true); });
59
+ }
60
+ S.said = ''; S.back = document.activeElement;
61
+ S.el.hidden = false; document.body.classList.add('phs-on');
62
+ try { history.pushState({ phs: 1 }, ''); } catch { /* no history */ }
63
+ draw(); readVersion();
64
+ const f = S.el.querySelector('button'); if (f) f.focus();
65
+ return S.el;
66
+ }
67
+ export function closePhoneSettings(fromHistory = false) {
68
+ if (!S.el || S.el.hidden) return;
69
+ S.el.hidden = true; document.body.classList.remove('phs-on');
70
+ if (!fromHistory) { try { if (history.state && history.state.phs) history.back(); } catch { /* no history */ } }
71
+ if (S.back && S.back.isConnected) { try { S.back.focus(); } catch { /* gone */ } }
72
+ }
73
+ export const phoneSettingsOpen = () => !!(S.el && !S.el.hidden);
@@ -0,0 +1,51 @@
1
+ /* pm/cozy-phone-swipe.js — swipe a row on a phone (phone design, build brief nav-structure/phone/build-brief-v2.md: "Proposals and log rows SWIPE:
2
+ * right = accept / do / send, left = drop / put off. No tick and cross buttons, no Do/Send words. Undo line after each swipe.").
3
+ *
4
+ * wireSwipe(root, { on() → boolean, act(row, dir) }) once per root. A row is any element under root with data-sw-right and/or
5
+ * data-sw-left (the act each way). A horizontal drag of 72 px or more one way calls act(row, 'right' | 'left'); a shorter drag, a
6
+ * vertical scroll or a way with no act puts the row back. While the finger moves, the row follows it and its tint says which way
7
+ * (green right, grey left); on release it rests flat again. on() false (a desktop, a pointer that is not touch or pen): nothing.
8
+ * decide(dx, dy, row) → 'right' | 'left' | '' pure: the way a finished drag goes (Node tests it)
9
+ * The keyboard and a screen reader keep the row's own press (the title opens it); the hint line names the swipe. Writes nothing itself. */
10
+ export const SWIPE_PX = 72;
11
+ export function decide(dx, dy, row = {}) {
12
+ if (Math.abs(dx) < SWIPE_PX || Math.abs(dy) > Math.abs(dx) * 0.7) return '';
13
+ const way = dx > 0 ? 'right' : 'left';
14
+ const ds = row.dataset || row;
15
+ return (way === 'right' ? ds.swRight : ds.swLeft) ? way : '';
16
+ }
17
+ export function wireSwipe(root, o = {}) {
18
+ if (!root || root.__sw) return; root.__sw = true;
19
+ let cur = null;
20
+ const reset = (el) => { if (!el) return; el.style.transform = ''; el.classList.remove('sw-r', 'sw-l', 'sw-on'); };
21
+ root.addEventListener('pointerdown', (e) => {
22
+ if (o.on && !o.on()) return;
23
+ if (e.pointerType === 'mouse') return; // a desktop keeps its buttons; a phone swipes
24
+ const row = e.target.closest('[data-sw-right], [data-sw-left]'); if (!row || !root.contains(row)) return;
25
+ cur = { row, x: e.clientX, y: e.clientY, id: e.pointerId, dx: 0, dy: 0, lock: '' };
26
+ });
27
+ root.addEventListener('pointermove', (e) => {
28
+ if (!cur || e.pointerId !== cur.id) return;
29
+ cur.dx = e.clientX - cur.x; cur.dy = e.clientY - cur.y;
30
+ if (!cur.lock) { if (Math.abs(cur.dx) > 10 && Math.abs(cur.dx) > Math.abs(cur.dy)) cur.lock = 'x'; else if (Math.abs(cur.dy) > 10) cur.lock = 'y'; }
31
+ if (cur.lock !== 'x') return;
32
+ const way = cur.dx > 0 ? 'swRight' : 'swLeft';
33
+ const dx = cur.row.dataset[way] ? cur.dx : cur.dx / 4; // a way with no act gives a little, then comes back
34
+ cur.row.classList.add('sw-on'); cur.row.classList.toggle('sw-r', cur.dx > 0 && !!cur.row.dataset.swRight); cur.row.classList.toggle('sw-l', cur.dx < 0 && !!cur.row.dataset.swLeft);
35
+ cur.row.style.transform = `translateX(${Math.max(-140, Math.min(140, dx))}px)`;
36
+ });
37
+ const end = (e) => {
38
+ if (!cur || (e && e.pointerId !== cur.id)) return;
39
+ const c = cur; cur = null;
40
+ const way = c.lock === 'x' ? decide(c.dx, c.dy, c.row) : '';
41
+ reset(c.row);
42
+ if (way) {
43
+ // the press that a swipe ends with is not a press on the row's title
44
+ const stop = (ev) => { if (!ev.isTrusted) return; ev.stopPropagation(); ev.preventDefault(); }; // act's own press (a script's click) goes through
45
+ root.addEventListener('click', stop, { capture: true, once: true }); setTimeout(() => root.removeEventListener('click', stop, { capture: true }), 400);
46
+ if (o.act) o.act(c.row, way);
47
+ }
48
+ };
49
+ root.addEventListener('pointerup', end);
50
+ root.addEventListener('pointercancel', end);
51
+ }
@@ -233,3 +233,59 @@ button.pw-fv .grey { color: var(--cz-ink3); }
233
233
  .pw-loose { margin: 8px 2px 0; }
234
234
  .pw-loose .pw-lk { display: inline-flex; align-items: center; gap: 2px; color: var(--cz-ink3); }
235
235
  .pw-loose .pw-lk:hover { color: var(--cz-blue); }
236
+
237
+ /* ── a phone (board Ph2_init; cozy-pop-work.js phoneHtml): the popup's content as one page. No cards, no table; 16 px gutter; a proposal is a
238
+ * blue ✦ line that is swiped (right yes, left no). The item's header keeps back and the title only: its ⋯ items are in the page's ⋯. */
239
+ .pw-ph { padding: 4px 16px calc(env(safe-area-inset-bottom, 0px) + 88px); display: flex; flex-direction: column; gap: 0; color: var(--cz-ink); }
240
+ .pw-phd { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
241
+ .pw-phd b { font-size: var(--fs-panel); line-height: var(--lh-panel); font-weight: var(--fw-strong); flex: 1; min-width: 0; }
242
+ .pw-phd > span:last-child:not(.pw-pn) { font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink3); flex: none; }
243
+ .pw-phd > span.warn, .pw-ph .warn { color: var(--cz-late); }
244
+ .pw-pn { width: 26px; height: 26px; border-radius: 6px; background: var(--cz-bluebg); color: var(--cz-blueink); display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-meta); font-weight: var(--fw-strong); flex: none; }
245
+ .pw-pgate { margin: 8px 0 0; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink2); }
246
+ .pw-pov { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--cz-hair); }
247
+ .pw-pov h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 6px; font-size: var(--fs-meta); line-height: var(--lh-meta); font-weight: var(--fw-strong); letter-spacing: .08em; text-transform: uppercase; color: var(--cz-ink2); }
248
+ .pw-pov h3 svg { color: var(--cz-blue); }
249
+ .pw-pl { margin: 0 0 6px; font-size: var(--fs-body); line-height: var(--lh-body); }
250
+ .pw-pl b { font-weight: var(--fw-strong); margin-right: 4px; }
251
+ .pw-pl .pw-otx { cursor: text; }
252
+ .pw-pstat { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--cz-hair); }
253
+ .pw-pstat > p { margin: 0 0 6px; font-size: var(--fs-body); line-height: var(--lh-body); }
254
+ .pw-psugs { display: flex; flex-direction: column; }
255
+ .pw-psug { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; color: var(--cz-blue); background: var(--cz-card); transition: transform .18s ease; touch-action: pan-y; }
256
+ .pw-psug.sw-on { transition: none; }
257
+ .pw-psug.sw-r { background: var(--cz-bluebg); }
258
+ .pw-psug.sw-l { background: var(--cz-well); }
259
+ .pw-psug > svg { flex: none; margin-top: 4px; }
260
+ .pw-psay { flex: 1; min-width: 0; text-align: left; border: 0; padding: 0; background: none; font: inherit; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-blue); cursor: pointer; }
261
+ .pw-psb[hidden] { display: none; }
262
+ .pw-psec { margin-top: 20px; }
263
+ .pw-psec h4 { margin: 0 0 4px; font-size: var(--fs-meta); line-height: var(--lh-meta); font-weight: var(--fw-strong); color: var(--cz-ink2); }
264
+ .pw-pwbs, .pw-parts { list-style: none; margin: 0; padding: 0; }
265
+ .pw-pwbs li, .pw-parts li { display: flex; align-items: center; gap: 10px; min-height: 46px; border-bottom: 1px solid var(--cz-hair); }
266
+ .pw-pdot { width: 8px; height: 8px; border-radius: 50%; flex: none; box-sizing: border-box; }
267
+ .pw-pdot.dn { background: color-mix(in srgb, var(--cz-ink3) 60%, transparent); }
268
+ .pw-pdot.now { background: var(--cz-blue); }
269
+ .pw-pdot.todo { border: 1.5px solid var(--cz-ink3); }
270
+ .pw-pstg { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; border: 0; padding: 0; background: none; font: inherit; color: var(--cz-ink); text-align: left; cursor: pointer; }
271
+ .pw-pstg:disabled { cursor: default; color: var(--cz-ink); }
272
+ .pw-pstg .pw-n { font-size: var(--fs-body); color: var(--cz-ink2); }
273
+ .pw-pstg b { font-size: var(--fs-row); font-weight: var(--fw-strong); }
274
+ .pw-pd { flex: none; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--cz-ink3); }
275
+ .pw-ptk { padding-left: 18px; }
276
+ .pw-ptk .pw-tt, .pw-ptk .pw-dn, .pw-parts .pw-an { flex: 1; min-width: 0; text-align: left; border: 0; padding: 0; background: none; font: inherit; font-size: var(--fs-body); color: var(--cz-ink); cursor: pointer; }
277
+ .pw-ptk .pw-dn { color: var(--cz-ink3); }
278
+ .pw-ptk.done .pw-tt { color: var(--cz-ink3); }
279
+ .pw-ph .pw-loose { margin: 10px 0 0; }
280
+ .pw-ph .pw-loose .pw-lk, .pw-pdocs { font-size: var(--fs-meta); color: var(--cz-ink2); }
281
+ .pw-pdocs { display: inline-flex; align-items: center; gap: 2px; margin-top: 10px; border: 0; padding: 0; background: none; cursor: pointer; font-family: inherit; }
282
+ .pw-pnone { margin: 6px 0 0; font-size: var(--fs-meta); color: var(--cz-ink3); }
283
+ .pw-pask { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); z-index: 4; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 26px; background: var(--cz-well); }
284
+ .pw-pask input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: var(--fs-body); color: var(--cz-ink); height: 36px; }
285
+ .pw-pask input::placeholder { color: var(--cz-ink3); }
286
+ .pw-pask button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--cz-solid); color: var(--cz-onsolid); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
287
+ .pw-pask:focus-within { box-shadow: 0 0 0 2px var(--cz-blue); }
288
+ @media (max-width: 760px) {
289
+ /* the item's header on a phone: back and the title; the page's ⋯ (cozy-nav.js) holds the item's own ⋯ items */
290
+ .cz-vw:has(.pw-ph) .cz-vw-hd .cz-vw-tile, .cz-vw:has(.pw-ph) .cz-vw-hd .cz-vw-kind, .cz-vw:has(.pw-ph) .cz-vw-hd [data-cz-vw="discuss"], .cz-vw:has(.pw-ph) .cz-vw-hd [data-cz-vw-p="kind"] { display: none; }
291
+ }