create-pmos 0.736.0 → 0.738.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 (37) hide show
  1. package/package.json +39 -99
  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/changelog.json +38 -0
  7. package/workspace/guide/breakdown.md +7 -1
  8. package/workspace/guide/home.md +1 -0
  9. package/workspace/guide/layout.md +10 -3
  10. package/workspace/lib/use-log.js +26 -4
  11. package/workspace/package-lock.json +2 -2
  12. package/workspace/package.json +1 -1
  13. package/workspace/public/pm/action-keys.js +1 -1
  14. package/workspace/public/pm/bd-backlog.js +4 -0
  15. package/workspace/public/pm/bd-pop-ds.css +18 -0
  16. package/workspace/public/pm/bd-pop-ds.js +33 -3
  17. package/workspace/public/pm/cozy-day-pick.css +0 -1
  18. package/workspace/public/pm/cozy-ev.css +9 -0
  19. package/workspace/public/pm/cozy-nav.js +2 -0
  20. package/workspace/public/pm/cozy-pop-work.js +52 -23
  21. package/workspace/public/pm/focus-mode.js +161 -0
  22. package/workspace/public/pm/hi-pop.js +2 -2
  23. package/workspace/public/pm/home-app.js +5 -1
  24. package/workspace/public/pm/home-ini.js +9 -5
  25. package/workspace/public/pm/ini-tasks.js +20 -22
  26. package/workspace/public/pm/live-edit.js +280 -0
  27. package/workspace/public/pm/premium-board.js +12 -6
  28. package/workspace/public/pm/range-pick.css +50 -0
  29. package/workspace/public/pm/range-pick.js +155 -0
  30. package/workspace/public/pm/task-card.css +2 -19
  31. package/workspace/public/pm/task-card.js +16 -36
  32. package/workspace/stage-card-tasks-test.js +11 -11
  33. package/workspace/task-card-test.js +17 -10
  34. package/workspace/task-views-test.js +7 -5
  35. package/workspace/test-lists/edits-show-at-once.json +9 -0
  36. package/workspace/test-lists/focus-mode.json +9 -0
  37. package/workspace/test-lists/range-pick.json +5 -0
@@ -21,10 +21,12 @@ import * as M from './pop-work-model.js';
21
21
  import * as CB from './cozy-bar.js';
22
22
  import { openPop, closePop, undoToast } from './hi-pop.js';
23
23
  import { pmGet, pmPost } from './http.js';
24
+ import * as LE from './live-edit.js'; // an edit shows at once: this popup is drawn again the moment a task write is sent, and after each read
24
25
  import * as VW from './cozy-viewer.js';
25
26
  import * as ED from './ini-edit.js';
26
27
  import * as SW from './cozy-status-when.js'; // When did this happen? after a status pick (round 3 point 18)
27
- import * as DP from './cozy-day-pick.js'; // the app's own day field, "15 Oct 2026"
28
+ import * as DP from './cozy-day-pick.js'; // the app's own day form, "15 Oct 2026"
29
+ import { mountRange, rangeHtml } from './range-pick.js'; // start and due on one calendar, like a flight's depart and return
28
30
  const { localToday } = DP;
29
31
  import * as AK from './artefact-kind.js';
30
32
  import * as WT from './work-tree.js'; // subtasks, the epic check and its fix (initiative work-subtasks)
@@ -122,7 +124,7 @@ function critSugHtml(cr) {
122
124
  return `<div class="pm-sug x" role="group" aria-label="PMOS suggests"><div class="ttl">${SVG(P.spark || P.dia, 14)}<b class="say">${esc(say)}</b></div>`
123
125
  + `<dl><dt>Why</dt><dd>${esc('The people who build these tickets do not see the done test. Each check goes on the ticket it fits, as Given / When / Then.')}</dd>`
124
126
  + `<dt>PMOS will</dt><dd><ul>${will.map((w) => `<li>${esc(w)}</li>`).join('')}</ul></dd><dt>Tickets</dt><dd><ul>${L.map(row).join('')}</ul></dd></dl>`
125
- + `<div class="ans"><button type="button" class="pm-btn primary" data-pw-crit-ok aria-label="Yes, do it" title="Yes, do it">${SVG(P.check, 14)}</button>`
127
+ + `<div class="ans"><button type="button" class="pm-btn primary" data-pw-crit-ok aria-label="Yes, do it" title="Yes, do it">${SVG(PD.I.ok, 14)}</button>`
126
128
  + `<button type="button" class="pm-btn outline" data-pw-crit-drop aria-label="No" title="No">${SVG(P.x, 14)}</button></div></div>`;
127
129
  }
128
130
  /* the goal's name, not its id (board 25: "De-risk Okta dependency", not KR-C4): GET /api/boards/anchors once per product */
@@ -148,7 +150,7 @@ function artOf(id, ws) {
148
150
  if (!ART.has(id)) {
149
151
  ART.set(id, null);
150
152
  pmGet('/api/artefacts?scope=' + encodeURIComponent('experiment:' + id) + (ws ? '&ws=' + encodeURIComponent(ws) : ''))
151
- .then((x) => { ART.set(id, x && x.ok && Array.isArray(x.artefacts) ? x.artefacts : []); if (artRedraw) artRedraw(); }).catch(() => ART.set(id, []));
153
+ .then((x) => { ART.set(id, x && x.ok && Array.isArray(x.artefacts) ? x.artefacts : []); const p = PEND.get(id); if (p && !p.saving) p.lines = {}; if (artRedraw) artRedraw(); }).catch(() => ART.set(id, []));
152
154
  }
153
155
  return ART.get(id);
154
156
  }
@@ -335,10 +337,17 @@ const mergeOf = (rows) => AK.group(rows, { dropped: dropped() }).merge;
335
337
 
336
338
  /* ── the initiative ── */
337
339
  const keyOf = (v, o) => String((o && o.id) || (v && (v.id || v.key)) || '');
338
- function model(r, v, o) {
339
- const id = keyOf(v, o), S = stOf(id), it = ITEMS.get(id);
340
+ /* a case line or the summary shows the moment it is saved (Wawan, 2026-11-23: every edit shows at once): id → { lines: { lineId: text },
341
+ * desc }. A line stays until the artefacts are read again; the summary until the host reads the initiative again. A save that fails takes
342
+ * it out and says so with Try again. */
343
+ const PEND = new Map();
344
+ const pendOf = (id) => { if (!PEND.has(id)) PEND.set(id, { lines: {}, desc: null }); return PEND.get(id); };
345
+ function model(r, v0, o) {
346
+ const id0 = keyOf(v0, o), pd = PEND.get(id0), v = pd && pd.desc != null ? { ...v0, desc: pd.desc } : v0;
347
+ const id = id0, S = stOf(id), it = ITEMS.get(id);
340
348
  const g = o.goal || goalOf(o.ws, o.board, r.anchor || v.anchor);
341
349
  const W = M.workOf(r, v, { ...o, goal: M.idShaped(g) ? '' : g, product: productName(o.product, o.ws), art: artOf(id, o.ws), open: S.open, shut: S.shut, moreOpen: S.moreOpen, farOpen: S.farOpen, focus: S.focus, subOpen: S.subOpen, subShut: S.subShut, mode: store.get(SPAN, 'full'), items: it || [], dropped: dropped() });
350
+ if (pd && W.overview) for (const L of W.overview.lines || []) if (pd.lines[L.id] != null) { L.text = pd.lines[L.id]; delete L.ask; delete L.miss; }
342
351
  const mk = M.marksOf(W.span, W.today); W.tx = mk.today;
343
352
  W.epics = (r.epics || []).filter(Boolean); RSEL = S.sel; // the epic check and the picked rows, for the Gantt rows (initiative work-subtasks)
344
353
  // the Gantt's Jira column (work-subtasks-followups): on unless Choose columns hides it, and only when the work has a Jira row
@@ -359,6 +368,9 @@ export function html(r, v, o = {}) {
359
368
  * Work breakdown as List or Gantt) and the side column (The case, Artefacts), from the system's blocks (pm/bd-pop-ds.js). The Gantt view is the
360
369
  * breakdown table with its bars and tools; List and Gantt are one remembered choice ('pw-view'). */
361
370
  const VIEW = 'pw-view';
371
+ // the Overview fold: one choice for every initiative, kept under a key that follows the person (lib/prefs-sync.js, prefix 'cz-vw-fold:')
372
+ const OV = 'cz-vw-fold:initiative:overview';
373
+ const ovOpen = () => { try { return localStorage.getItem(OV) !== '0'; } catch { return true; } };
362
374
  const allOpen = (v) => { const k = new Set(((v.tasks || {}).sections || []).filter((s) => s.kind === 'stage').map((s) => s.key)); return k; };
363
375
  // the List (S given): every stage with tasks open but a finished one (Wawan, 2026-11-22), and the PM's own fold and unfold, shared with the
364
376
  // Gantt. No S (a lookup: which stage holds a task, which stage a line names): every stage open, so every task is a row
@@ -384,8 +396,9 @@ function dsHtml(r, v, o, W, S, C, mode) {
384
396
  const mg = mergeOf(W.artefacts), merge = mg ? `<div class="pw-sugs pw-amg" role="list" aria-label="PMOS suggests">${sugLine({ id: mg.id, say: mg.say, merge: mg })}</div>` : '';
385
397
  // the done test's acceptance criteria on the initiative's Jira tickets (jira-criteria-write): its ✦ above the breakdown, unless the PM said no
386
398
  const crit = S.sel.size || dropped().has('crit:' + id) ? '' : critSugHtml(CRIT.get(id));
387
- return `<div class="pw pwd">${'<div class="pwd-main">'}${PD.standsHtml(W, r)}${PD.stagesHtml(st, W)}${crit}${wbs}</div>`
388
- + `<aside class="pwd-side">${PD.caseHtml(W, { oid: id, dropped: dropped() })}${PD.artsHtml(W.artefacts, { merge })}</aside></div>`;
399
+ // Overview (Wawan, 2026-11-23): Where it stands, The case and its facts in one block across the top; folded or open is the person's choice
400
+ return `<div class="pw pwd">${PD.overviewHtml(W, r, { oid: id, dropped: dropped(), open: ovOpen() })}<div class="pwd-main">${PD.stagesHtml(st, W)}${crit}${wbs}</div>`
401
+ + `<aside class="pwd-side">${PD.artsHtml(W.artefacts, { merge })}</aside></div>`;
389
402
  }
390
403
 
391
404
  /** The grouping ✦ the PM said no to, for this initiative: 'group:<stage>'. */
@@ -595,15 +608,18 @@ async function dropSug(s, x, h) {
595
608
  if (h.reload) await h.reload();
596
609
  }
597
610
  async function saveDesc(text, x, h) {
598
- const w = h.where ? h.where() : {}, id = x.o().id;
611
+ const w = h.where ? h.where() : {}, id = x.o().id, kid = keyOf(x.v(), x.o());
612
+ // shown at once; the host's read after the save replaces it
613
+ const pd = pendOf(kid); pd.desc = text; if (h.redraw) h.redraw();
599
614
  const res = await pmPost('/api/initiative/describe', { ws: w.ws, id, text }).catch(() => null);
600
- if (!res || res.ok === false) { if (h.toast) h.toast((res && res.error) || 'It was not saved.'); return false; }
615
+ if (!res || res.ok === false) { pd.desc = null; if (h.redraw) h.redraw(); undoToast(LE.notSaved(res), () => saveDesc(text, x, h), 12000, 'Try again'); return false; }
616
+ const settle = async () => { if (h.reload) await h.reload(); if (pd.desc === text) { pd.desc = null; if (h.redraw) h.redraw(); } };
601
617
  if (!res.same) undoToast('Saved.', async () => {
602
618
  const u = await pmPost('/api/initiative/describe-undo', { ws: w.ws, id, from: res.from || '', to: res.text }).catch(() => null);
603
619
  if (!u || u.ok === false) { if (h.toast) h.toast((u && u.error) || 'The undo did not land.'); return; }
604
620
  if (h.reload) await h.reload();
605
621
  });
606
- if (h.reload) await h.reload();
622
+ await settle();
607
623
  return true;
608
624
  }
609
625
  const findSug = (W, id) => W.suggests.find((s) => s.id === id) || [...W.rowSuggests.values()].find((s) => s.id === id) || null;
@@ -621,6 +637,7 @@ export function wire(body, h0, x0) {
621
637
  body.__pw = true;
622
638
  function cur() { const x = body.__pwx, r = x && x.r(), v = x && x.v(); return r && v ? { r, v, ...model(r, v, x.o()) } : null; }
623
639
  function redraw() { if (body.__pwh && body.__pwh.redraw) body.__pwh.redraw(); }
640
+ LE.view(body, () => { if (body.querySelector('.pw')) redraw(); });
624
641
  goalsRedraw = artRedraw = wsnRedraw = () => { if (body.isConnected && body.querySelector('.pw')) redraw(); };
625
642
  wireGrip(body);
626
643
  // a phone: a proposal swiped right says yes, left says no (its own hidden Yes and No presses, so the popup's writes and Undo stay theirs)
@@ -651,6 +668,7 @@ export function wire(body, h0, x0) {
651
668
  const h = body.__pwh, x = body.__pwx;
652
669
  const d = b.dataset, S = c.S, W = c.W;
653
670
  if (d.pwv) { store.set(VIEW, d.pwv); redraw(); return; }
671
+ if ('pwOv' in d) { try { localStorage.setItem(OV, ovOpen() ? '0' : '1'); } catch { /* a private window */ } redraw(); return; }
654
672
  if ('pwDetails' in d) { S.details = !S.details; redraw(); return; }
655
673
  if (d.pwFold != null) { const k = d.pwFold, open = b.getAttribute('aria-expanded') === 'true'; S.open.delete(k); S.shut.delete(k); (open ? S.shut : S.open).add(k); if (k === '') looseKeep(c.id, !open); redraw(); return; }
656
674
  if ('pwFar' in d) { S.farOpen = true; redraw(); return; }
@@ -752,7 +770,13 @@ function big(c, x, h) {
752
770
  if (hide) hide.click();
753
771
  VW.drill();
754
772
  VW.open({ kind: 'Work breakdown', title: 'Work breakdown', icon: 'list', id: 'wbs:' + c.id, back: true,
755
- render: (b) => { b.dataset.pwBig = '1'; const o = x.o(); S.big = true; b.innerHTML = html(x.r(), x.v(), o); wire(b, { ...h, redraw: () => { const t = b.scrollTop; b.innerHTML = html(x.r(), x.v(), x.o()); b.scrollTop = t; } }, x); },
773
+ render: (b) => {
774
+ b.dataset.pwBig = '1'; const o = x.o(); S.big = true; b.innerHTML = html(x.r(), x.v(), o);
775
+ const again = () => { if (!S.big || !b.isConnected || !x.r() || !x.v()) return; const t = b.scrollTop; b.innerHTML = html(x.r(), x.v(), x.o()); b.scrollTop = t; };
776
+ // the host draws its own popup body after a write and a read, never this drill-in: wire() puts it in pm/live-edit.js, so it follows
777
+ // the same writes and reads (Wawan, 2026-11-23: a status or day changed here showed only after the popup was opened again)
778
+ wire(b, { ...h, redraw: again }, x);
779
+ },
756
780
  onClose: () => { S.big = false; if (hid) { const ask = document.querySelector('.cz-pop [data-pop="ask"]'); if (ask && !ask.closest('[hidden]')) ask.click(); } } });
757
781
  void title;
758
782
  }
@@ -814,9 +838,17 @@ function editLine(el, L, c, x, h) {
814
838
  }
815
839
  async function saveLine(L, text, x, h) {
816
840
  if (L.edit.to === 'desc') return saveDesc(text, x, h);
817
- const w = h.where ? h.where() : {}, o = x.o(), id = o.id, ws = w.ws || o.ws;
841
+ const w = h.where ? h.where() : {}, o = x.o(), id = o.id, ws = w.ws || o.ws, kid = keyOf(x.v(), o);
842
+ // shown at once (Wawan, 2026-11-23); the next read of the artefacts replaces it
843
+ const pd = pendOf(kid); pd.lines[L.id] = text; pd.saving = (pd.saving || 0) + 1; if (h.redraw) h.redraw();
818
844
  const res = await pmPost('/api/artefacts/set', { ws, scope: 'experiment:' + id, artefact: L.edit.artefact, field: L.edit.field, text }).catch(() => null);
819
- if (!res || res.ok === false || !res.line) { if (h.toast) h.toast((res && res.error) || 'It was not saved.'); return false; }
845
+ pd.saving--;
846
+ if (!res || res.ok === false || !res.line) {
847
+ if (pd.lines[L.id] === text) delete pd.lines[L.id];
848
+ if (h.redraw) h.redraw();
849
+ undoToast(LE.notSaved(res && res.ok !== false && !res.line ? { error: 'the line was not written' } : res), () => saveLine(L, text, x, h), 12000, 'Try again');
850
+ return false;
851
+ }
820
852
  const ref = res.line.id;
821
853
  ART.delete(id);
822
854
  undoToast(L.k + ' saved.', async () => {
@@ -883,16 +915,13 @@ function setKind(row, on, h) { ED.milestone(h, { uid: row.uid, start: row.start,
883
915
  function dateMenu(btn, uid, c, h) {
884
916
  const row = c.W.rows.find((x) => x.uid === uid) || {};
885
917
  const seg = `<div class="pw-seg" role="radiogroup" aria-label="Task or milestone"><button type="button" role="radio" aria-checked="${!row.ms}" data-ty="task">${SVG(P.box, 13, 2)}Task</button><button type="button" role="radio" aria-checked="${!!row.ms}" data-ty="ms">${SVG(P.dia, 13, 2)}Milestone</button></div>`;
886
- // the app's own day form, "15 Oct 2026", with its small calendar (pm/cozy-day-pick.js), never the browser's month-first field
887
- const fields = row.ms ? '<div class="pw-dp" data-f="due"></div>' : '<div class="pw-dp" data-f="start"></div><div class="pw-dp" data-f="due"></div>';
888
- const el = openPop(btn, 'pw-date', seg + fields + jiraNote(row) + `<div class="hi-acts"><button type="button" class="hi-btn ghost" data-clear>No date</button></div>`, (b) => {
889
- if (b.dataset.ty) { const on = b.dataset.ty === 'ms'; closePop(); if (on !== !!row.ms) setKind(row, on, h); return; }
890
- if ('clear' in b.dataset) { closePop(); if (h.dates) h.dates(uid, row.ms ? { due: '' } : { start: '', due: '' }); }
891
- }, { label: 'Set the date', focus: '.dp-in' });
892
- const st = el.querySelector('[data-f="start"]'), due = el.querySelector('[data-f="due"]');
893
- if (st) DP.mountDay(st, { label: 'Start', value: row.start || '', onPick: (v) => { if (h.dates) h.dates(uid, { start: v }); } });
894
- DP.mountDay(due, { label: row.ms ? 'Date' : 'Due', value: row.end || row.start || '', open: !st, onPick: (v) => { closePop(); if (h.dates) h.dates(uid, { due: v }); } });
895
- (st || due).querySelector('.dp-in')?.focus();
918
+ // start and due on one calendar (pm/range-pick.js): the first tap sets the start, the second the due day; a milestone one date
919
+ const R = { start: row.ms ? '' : row.start || '', due: row.end || (row.ms ? row.start : '') || '', one: !!row.ms };
920
+ // drawn into the popup first, so it is placed at its full size; mountRange then wires the same markup
921
+ const el = openPop(btn, 'pw-date', seg + `<div class="pw-rp">${rangeHtml(R)}</div>` + jiraNote(row), (b) => {
922
+ if (b.dataset.ty) { const on = b.dataset.ty === 'ms'; closePop(); if (on !== !!row.ms) setKind(row, on, h); }
923
+ }, { label: 'Set the date', focus: '.rp-g [tabindex="0"]' });
924
+ mountRange(el.querySelector('.pw-rp'), { ...R, onPick: (patch, done) => { if (done) closePop(); if (h.dates) h.dates(uid, patch); } });
896
925
  }
897
926
  function rowMenu(btn, uid, c, h, body) {
898
927
  const row = c.W.rows.find((x) => x.uid === uid) || {};
@@ -0,0 +1,161 @@
1
+ /* pm/focus-mode.js — focus mode: one item and its chat, nothing else (bet A335, initiative focus-mode).
2
+ *
3
+ * f hides every part of the page except the item under the pointer (or with focus) and its chat f again puts it all back
4
+ *
5
+ * The item is what the pointer is over, or what has focus, whichever moved last (the rule of pm/action-keys.js). Its panel is the nearest
6
+ * popup card, Viewer, dialog or [data-panel]; with none, the row it is on. Its chat is the popup's chat side (already in the popup card),
7
+ * else the page's chat (#hmChat, .pc-chat, [data-chat]). Every other part of the page gets data-pm-focus-off (hidden by cozy-ev.css) and
8
+ * inert. Nothing moves in the DOM, so leaving restores each part exactly; an inert the page set itself stays. Leaving also puts back the
9
+ * scroll place and the focus. The next decision (the kept panel's first Yes button) scrolls into view on entry.
10
+ * Leave with f, or the icon-only Leave focus button at the top right. Focus ends by itself when the kept panel closes or hides (Esc on the
11
+ * popup), so the page never stays hidden. Not on a phone: it has no key, and it already shows one item at a time.
12
+ * Keys do nothing while typing, in a terminal, with Ctrl, Cmd or Alt, on a held key, or when the page already used the key.
13
+ * Each press is counted on this computer only (pm/use-log.js noteUse: focus-on, focus-off or focus-miss, no text, no value).
14
+ *
15
+ * startFocusMode(doc) called once by the menu (pm/cozy-nav.js mountNav), which every page mounts; a second call does nothing
16
+ * focusKey(e) PURE: true when the key event asks to enter or leave focus
17
+ * keepOf(here, doc) the parts to keep for the item at `here`: [panel] in the popup, [panel, chat?] elsewhere; [] for a miss
18
+ * enter(keep, doc) hide the rest; true when focus is on · leave(doc) put it all back · isOn()
19
+ * check(doc) leave when a kept part is gone or hidden; true when it left
20
+ * leaveHtml() PURE: the Leave focus button's markup */
21
+ import { noteUse } from './use-log.js';
22
+ import { actOf, wordsOf, PRESS } from './action-keys.js';
23
+
24
+ const TYPING = 'input, textarea, select, [contenteditable=""], [contenteditable="true"], [role="textbox"]';
25
+ const POP = '.cz-pop-card';
26
+ const PANEL = '.cz-pop-card, .cz-vw, dialog, [role="dialog"], [data-cz-panel], [data-panel]';
27
+ const ROW = '[role="row"], [role="option"], [role="listitem"], .pm-li, li, tr, [data-open]';
28
+ const CHAT = '#hmChat, .pc-chat, [data-chat]';
29
+ const OFF = 'data-pm-focus-off';
30
+ const say = (s) => { try { console.info('[focus-mode] ' + s); } catch { /* no console */ } };
31
+ const isPhone = () => typeof innerWidth === 'number' && innerWidth <= 760;
32
+ const shown = (el) => !!el && el.isConnected !== false && !(el.closest && el.closest('[hidden]'))
33
+ && (typeof el.getClientRects !== 'function' || el.getClientRects().length > 0);
34
+
35
+ /** PURE: true when the key event asks to enter or leave focus. */
36
+ export function focusKey(e) {
37
+ if (!e || e.defaultPrevented || e.repeat || e.ctrlKey || e.metaKey || e.altKey) return false;
38
+ if (e.key !== 'f' && e.key !== 'F') return false;
39
+ const t = e.target;
40
+ if (t && t.closest && (t.closest(TYPING) || t.closest('.xterm'))) return false;
41
+ if (t && t.isContentEditable) return false;
42
+ return true;
43
+ }
44
+
45
+ /** The parts to keep for the item at `here`: the popup card (item and chat together), or the panel or row and the page's chat. */
46
+ export function keepOf(here, doc) {
47
+ const el = here && here.nodeType === 3 ? here.parentElement : here;
48
+ if (!el || !el.closest || !doc || el === doc.body || el === doc.documentElement) return [];
49
+ const pop = el.closest(POP);
50
+ if (pop) return [pop];
51
+ const panel = el.closest(PANEL) || el.closest(ROW);
52
+ if (!panel) return [];
53
+ const chat = doc.querySelectorAll ? [...doc.querySelectorAll(CHAT)].find((c) => shown(c) && !panel.contains(c) && !c.contains(panel)) : null;
54
+ return chat ? [panel, chat] : [panel];
55
+ }
56
+
57
+ const X = '<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>';
58
+
59
+ /** PURE: the Leave focus button (icon-only, Komorebi pm-btn). */
60
+ export function leaveHtml() {
61
+ return `<button type="button" class="pm-btn pm-focus-leave" data-pm-focus-leave aria-label="Leave focus" title="Leave focus (F)">${X}</button>`;
62
+ }
63
+
64
+ const S = { on: false, keep: [], hid: [], btn: null, scroll: null, back: null, started: false, pointer: null, pointerT: 0, focusT: 0, obs: null };
65
+ export const isOn = () => S.on;
66
+
67
+ /** Hide every part of the page that is not kept and holds nothing kept. True when focus is on. */
68
+ export function enter(keep, doc) {
69
+ if (S.on || !keep || !keep.length || !doc || !doc.body) return false;
70
+ const path = new Set();
71
+ for (const k of keep) for (let e = k; e; e = e.parentElement) path.add(e);
72
+ const hid = [];
73
+ for (const p of path) {
74
+ if (keep.includes(p)) continue; // inside a kept part nothing is touched
75
+ for (const c of [...(p.children || [])]) {
76
+ if (path.has(c) || c.hasAttribute(OFF) || c.tagName === 'SCRIPT' || c.tagName === 'STYLE' || c.tagName === 'LINK') continue;
77
+ hid.push({ el: c, inert: !!c.inert });
78
+ c.setAttribute(OFF, '');
79
+ c.inert = true;
80
+ }
81
+ }
82
+ const w = doc.defaultView;
83
+ S.scroll = w ? [w.scrollX || 0, w.scrollY || 0] : null;
84
+ S.back = doc.activeElement && doc.activeElement !== doc.body ? doc.activeElement : null;
85
+ S.on = true; S.keep = keep.slice(); S.hid = hid;
86
+ doc.body.classList.add('pm-focus');
87
+ if (doc.createElement && doc.body.appendChild) {
88
+ const holder = doc.createElement('div');
89
+ holder.setAttribute('class', 'pm-focus-bar');
90
+ holder.innerHTML = leaveHtml();
91
+ doc.body.appendChild(holder);
92
+ S.btn = holder;
93
+ }
94
+ const yes = (keep[0].querySelectorAll ? [...keep[0].querySelectorAll(PRESS)] : []).find((b) => actOf(wordsOf(b)) === 'approve' && shown(b));
95
+ if (yes && yes.scrollIntoView) yes.scrollIntoView({ block: 'nearest' }); // the next decision in view
96
+ say('on: ' + hid.length + ' parts hidden');
97
+ return true;
98
+ }
99
+
100
+ /** Put every part back as it was: marks off, the page's own inert kept, the scroll place and the focus back. */
101
+ export function leave(doc) {
102
+ if (!S.on) return false;
103
+ for (const { el, inert } of S.hid) { el.removeAttribute(OFF); el.inert = inert; }
104
+ if (S.btn && S.btn.remove) S.btn.remove();
105
+ if (doc && doc.body) { const cl = doc.body.classList; (cl.remove || cl.delete).call(cl, 'pm-focus'); }
106
+ const w = doc && doc.defaultView;
107
+ if (w && S.scroll && typeof w.scrollTo === 'function') w.scrollTo(S.scroll[0], S.scroll[1]);
108
+ const back = S.back;
109
+ S.on = false; S.keep = []; S.hid = []; S.btn = null; S.scroll = null; S.back = null;
110
+ if (back && back.isConnected !== false && typeof back.focus === 'function') { try { back.focus({ preventScroll: true }); } catch { /* gone */ } }
111
+ say('off');
112
+ return true;
113
+ }
114
+
115
+ /** Leave by itself when a kept part is gone or hidden (the popup closed), so the page never stays hidden. True when it left. */
116
+ export function check(doc) {
117
+ if (!S.on) return false;
118
+ if (S.keep.every((k) => shown(k))) return false;
119
+ leave(doc);
120
+ noteUse('focus-off');
121
+ return true;
122
+ }
123
+
124
+ function hereOf(doc) {
125
+ const a = doc.activeElement;
126
+ const focused = a && a !== doc.body && a !== doc.documentElement ? a : null;
127
+ return focused && (S.focusT >= S.pointerT || !S.pointer || !S.pointer.isConnected) ? focused : (S.pointer && S.pointer.isConnected ? S.pointer : focused);
128
+ }
129
+
130
+ function toggle(doc) {
131
+ if (S.on) { leave(doc); noteUse('focus-off'); return; }
132
+ if (!enter(keepOf(hereOf(doc), doc), doc)) { noteUse('focus-miss'); say('nothing here to focus on'); return; }
133
+ noteUse('focus-on');
134
+ const w = doc.defaultView;
135
+ if (w && typeof w.MutationObserver === 'function' && !S.obs) {
136
+ S.obs = new w.MutationObserver(() => { if (check(doc) && S.obs) { S.obs.disconnect(); S.obs = null; } });
137
+ S.obs.observe(doc.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['hidden', 'class', 'open'] });
138
+ }
139
+ }
140
+
141
+ export function startFocusMode(doc = typeof document !== 'undefined' ? document : null) {
142
+ if (S.started || !doc || !doc.addEventListener) return false;
143
+ S.started = true;
144
+ doc.addEventListener('pointerover', (e) => { if (!S.on) { S.pointer = e.target; S.pointerT = Date.now(); } }, { passive: true });
145
+ doc.addEventListener('focusin', () => { if (!S.on) S.focusT = Date.now(); });
146
+ // Leave focus is a real <button>; its press is delegated from the window, like the ? list's Close (pm/action-keys.js)
147
+ if (doc.defaultView) doc.defaultView.addEventListener('click', (e) => {
148
+ if (S.on && e.target && e.target.closest && e.target.closest('[data-pm-focus-leave]')) {
149
+ leave(doc); noteUse('focus-off');
150
+ if (S.obs) { S.obs.disconnect(); S.obs = null; }
151
+ }
152
+ });
153
+ // the bubble phase, so a page's own f (the meeting view) runs first and wins
154
+ doc.addEventListener('keydown', (e) => {
155
+ if (!focusKey(e) || isPhone()) return;
156
+ e.preventDefault();
157
+ toggle(doc);
158
+ if (!S.on && S.obs) { S.obs.disconnect(); S.obs = null; }
159
+ });
160
+ return true;
161
+ }
@@ -50,11 +50,11 @@ export function openPop(anchor, kind, html, onClick, o = {}) {
50
50
  const f = el.querySelector((sheet && o.sheetFocus) || o.focus || 'input, textarea, button:not([disabled])'); if (f) setTimeout(() => f.focus(), 0);
51
51
  return el;
52
52
  }
53
- export function undoToast(text, undo, ms = 9000) {
53
+ export function undoToast(text, undo, ms = 9000, label = 'Undo') {
54
54
  ensureCss();
55
55
  let el = document.getElementById('hiToast');
56
56
  if (!el) { el = document.createElement('div'); el.id = 'hiToast'; el.className = 'hi-toast'; el.setAttribute('role', 'status'); el.setAttribute('aria-live', 'polite'); document.body.appendChild(el); }
57
- el.innerHTML = `<span>${esc(text)}</span><button type="button" data-hi-undo>Undo</button>`;
57
+ el.innerHTML = `<span>${esc(text)}</span><button type="button" data-hi-undo>${esc(label)}</button>`;
58
58
  el.hidden = false; el.classList.add('on');
59
59
  el.querySelector('[data-hi-undo]').onclick = () => { hide(); undo(); };
60
60
  const hide = () => { el.classList.remove('on'); el.hidden = true; };
@@ -30,6 +30,7 @@ import * as POP from './cozy-popup.js'; // the one popup: an initiative and As
30
30
  import { mountToday } from './cozy-today-app.js'; // Today on a desk (slice 5): today.html is this page with data-today
31
31
  import * as SV from './small-vw.js'; // the small Viewers: a stakeholder, its form, a routine (batch 18 item 2-C)
32
32
  import { pmGet, pmPost, pmHeaders } from './http.js';
33
+ import * as LE from './live-edit.js'; // a task's status or days show at once (the save answers later; a failed save is put back)
33
34
  import * as ST from './story.js';
34
35
  import * as IT from './intent.js'; // board AwI: the Intent card under the story
35
36
  import * as H from './home-data.js';
@@ -205,8 +206,10 @@ async function getRetry(path, tries = 20) {
205
206
  }
206
207
  const LAST_KEY = (WS || '') + '|' + (BOARD || ''); // the last view Home drew, by its product and board (SpA)
207
208
  let pickGen = 0; // bumped by every saved pick, so a read that started before the save does not put the old pick back
209
+ /* Home's copy of every task, drawn again the moment a task write is sent (pm/live-edit.js), before Home reads its eleven routes again */
210
+ LE.source({ model: () => [S.D, S.IM], redraw: () => { if (S.ready) draw(); } });
208
211
  async function load() {
209
- const gen = pickGen;
212
+ const gen = pickGen, since = Date.now();
210
213
  const [brief, board, ses, desk, today, sch, work, day, rev, progs, , pick] = await Promise.all([
211
214
  getRetry('/api/briefing-premium' + wsQ()), getRetry('/api/board-premium' + wsQ() + boardQ(WS ? '&' : '?')), pmGet('/api/sessions'), pmGet('/api/home-desk' + wsQ()),
212
215
  pmGet('/api/brief-page' + wsQ()), pmGet('/api/schedules' + wsQ()), pmGet('/api/my-work-premium' + wsQ()), pmGet('/api/phone-day'), pmGet('/api/home-review' + wsQ()),
@@ -241,6 +244,7 @@ async function load() {
241
244
  S.ready = true;
242
245
  await loadIni();
243
246
  draw();
247
+ LE.loaded({ since }); // a change still saving stays on the new read; open views (the big Work breakdown) follow it
244
248
  NEED.refresh(); // an open ask: its agent finished, or it left Home while it was open
245
249
  loadImpact();
246
250
  loadDrift();
@@ -36,6 +36,7 @@ import { ensureCss as ensureStepsCss } from './cozy-steps.js'; // stage card D
36
36
  import * as DB from './dash-view.js'; // the ready-made Dashboard view (batch 17 item 1)
37
37
  import * as TL from './ini-tail.js';
38
38
  import * as ED from './ini-edit.js'; // round 3 item 11b: a Today task row opens its initiative with that task's row open in place
39
+ import * as LE from './live-edit.js'; // an edit shows at once: the open initiative view is drawn again the moment a task write is sent
39
40
  import * as PW from './cozy-pop-work.js'; // what the popup shows for work (slice 3 of the six-place navigation): in the popup, in place of the old page
40
41
  import * as PP from './ini-props.js'; // everything PMOS suggests, as a drill-in (the popup's ⋯) // under Linked, as the Board draws it (UI grill U1): drafted tickets, the PRD drift, Your impact
41
42
  import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
@@ -322,13 +323,14 @@ function wirePage(b, id) {
322
323
  // the stage card's ⏸ or calendar on a hold (batch 11 item 21): what the hold says, and its return date set or changed here
323
324
  hold: (i, btn) => holdPop(btn, id),
324
325
  // opt (batch 18 item 16): the + on a stage: the task goes under that stage, with the dates its field picked; the toast offers Undo
325
- addTask: async (title, inp, opt) => {
326
+ addTask: async function add(title, inp, opt) {
326
327
  const M = curM(); if (!M) return;
327
328
  inp.disabled = true;
328
329
  const D = opt ? opt : ADD_DATES || {};
329
330
  const r = await C.pmPost('/api/boards/tasks/add', { ...bw(M), initiative: id, title, ...(D.start ? { start: D.start } : {}), ...(D.due ? { due: D.due } : {}), ...(opt && opt.section != null ? { section: opt.section } : {}), ...(opt && opt.milestone ? { milestone: true } : {}), ...(opt && opt.owner ? { owner: opt.owner } : {}) });
330
331
  inp.disabled = false;
331
- if (!r || r.ok === false) { say((r && r.error) || 'The task was not added.'); return; }
332
+ // the row showed at once (pm/live-edit.js) and is gone again: say so, with Try again
333
+ if (!r || r.ok === false) { undoToast(LE.notSaved(r), () => add(title, inp, opt), 12000, 'Try again'); return; }
332
334
  const uid = r.item && r.item.uid;
333
335
  if (opt && uid) undoToast('Added to ' + (opt.name || 'the stage') + '.', async () => { const u = await C.pmPost('/api/boards/tasks/delete', { ...bw(M), task: uid, why: 'undo of add' }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
334
336
  else say('Task added.');
@@ -367,7 +369,8 @@ async function setState(id, uid, state, w) {
367
369
  const M = curM(); if (!M) return;
368
370
  const k = taskAt(id, uid), C = X.ctx, body = { ...bw(M), task: uid }, happened = (w && w.happened) || null;
369
371
  const r = await C.pmPost('/api/boards/tasks/state', { ...body, state, ...(happened ? { happened } : {}) });
370
- if (!r || r.ok === false) { C.toast((r && r.error) || 'Nothing was changed.'); return; }
372
+ // the new status showed at once (pm/live-edit.js); a save that did not land is back as it was, and the toast says so with Try again
373
+ if (!r || r.ok === false) { undoToast(LE.notSaved(r), () => setState(id, uid, state, w), 12000, 'Try again'); return; }
371
374
  await C.load(); redrawView();
372
375
  const was = k && k.status;
373
376
  // the day it really happened is said beside the title (round 3 point 18): "Done on 14 Nov, noted today."
@@ -379,7 +382,7 @@ async function removeTask(id, uid) {
379
382
  const M = curM(); if (!M) return;
380
383
  const k = taskAt(id, uid), C = X.ctx, body = { ...bw(M), task: uid }, title = (k && k.title) || uid;
381
384
  const r = await C.pmPost('/api/boards/tasks/delete', body);
382
- if (!r || r.ok === false) { C.toast((r && r.error) || 'The task was not deleted.'); return; }
385
+ if (!r || r.ok === false) { undoToast(LE.notSaved(r), () => removeTask(id, uid), 12000, 'Try again'); return; } // the row went at once and is back
383
386
  await C.load(); redrawView();
384
387
  undoToast('Deleted · ' + title + '.', async () => { const u = await C.pmPost('/api/boards/tasks/restore', body); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); });
385
388
  }
@@ -388,7 +391,7 @@ async function setDates(id, uid, patch) {
388
391
  const M = curM(); if (!M) return;
389
392
  const k = taskAt(id, uid), C = X.ctx, body = { ...bw(M), task: uid };
390
393
  const r = await C.pmPost('/api/boards/tasks/edit', { ...body, ...patch });
391
- if (!r || r.ok === false) { C.toast((r && r.error) || 'Nothing was changed.'); return; }
394
+ if (!r || r.ok === false) { undoToast(LE.notSaved(r), () => setDates(id, uid, patch), 12000, 'Try again'); return; }
392
395
  await C.load(); redrawView();
393
396
  const back = {}; for (const f of Object.keys(patch)) back[f] = f === 'milestone' ? (r.from && 'milestone' in r.from ? !!r.from.milestone : !patch.milestone) : k ? (f === 'due' ? k.end : k[f]) || '' : r.from && f in r.from ? r.from[f] || '' : ''; // a Jira ticket's days come back in from (batch 11 item 23)
394
397
  if ('milestone' in patch) { undoToast((patch.milestone ? 'Milestone: ' : 'Not a milestone: ') + (k ? k.title : uid) + '.', async () => { const u = await C.pmPost('/api/boards/tasks/edit', { ...body, ...back }); if (!u || u.ok === false) C.toast((u && u.error) || 'The undo did not land.'); await C.load(); redrawView(); }); return; }
@@ -602,6 +605,7 @@ function draw(b) {
602
605
  // the phone keeps the Documents | Stage switch (PgTkList); in shell A on a desktop the other view sits under ⋯ (XvATasks)
603
606
  b.innerHTML = `<div class="hi-v" data-hi-v="${v}">${isPhone() || !X.ctx.VW.czSummary ? segHtml(v) : ''}${stageView(id, M, STAGE_ASK)}<p class="hi-small" role="status" id="ovMsg"></p></div>`;
604
607
  }
608
+ LE.view('home-ini', () => redrawView());
605
609
  function redrawView() {
606
610
  if (!BODY || !BODY.isConnected || !X.ctx) return;
607
611
  const cur = X.ctx.VW.current(); if (!cur) return;
@@ -23,6 +23,7 @@
23
23
  * h.dates(uid, { start?, due? }) the quick changes (each with Undo), h.remove(uid) the picker's trash (batch 11 item 16: Delete, Undo in the toast), h.redraw(). A Jira ticket is read-only: the Jira mark, a plain date, no
24
24
  * picker and no drag. Archived tasks show in no view here (the List folds them after Done). */
25
25
  import { STATES, stateIcon, stateKey, datePickerHtml, cardStyle } from './task-card.js';
26
+ import { mountRange } from './range-pick.js'; // start and due on one calendar
26
27
  import * as LK from './ini-links.js'; // the links' marks on bars and cards (batch 11 item 15)
27
28
  import * as JM from './jira-move.js'; // a Jira ticket's status, moved in Jira (Wawan 2026-10-29)
28
29
 
@@ -138,8 +139,8 @@ export function sheetHtml(m, g, z = zoomOf()) {
138
139
  }
139
140
  function openSheet(anchor, H) {
140
141
  const g = () => (H.__g && H.__g.ok ? { by: H.__g.by(), label: H.__g.label() } : null);
141
- const draw = () => { if (POP && POP.anchor === anchor) POP.el.innerHTML = sheetHtml(viewMode(), g()); };
142
- const el = openPop(anchor, sheetHtml(viewMode(), g()), (b) => {
142
+ let el = null; const draw = () => { if (POP && POP.el === el) POP.el.innerHTML = sheetHtml(viewMode(), g()); };
143
+ el = openPop(anchor, sheetHtml(viewMode(), g()), (b) => {
143
144
  const d = b.dataset;
144
145
  if (d.ivsView) { setViewMode(d.ivsView); if (H.redraw) H.redraw(); draw(); return; }
145
146
  if (d.ivsCol) { const on = timelineCols(); setTimelineCols(on.includes(d.ivsCol) ? on.filter((k) => k !== d.ivsCol) : on.concat(d.ivsCol)); if (H.redraw) H.redraw(); draw(); return; }
@@ -576,7 +577,15 @@ export function kanbanHtml(v, o, isOpen) {
576
577
  /* ── the popovers: the task card's own status segment and date picker, opened right under the press ── */
577
578
  let POP = null;
578
579
  /** The press the picker hangs from moved (or left the page) since it opened. */
579
- const moved = (P) => { if (!P.anchor || !P.anchor.isConnected || !P.at) return true; const r = P.anchor.getBoundingClientRect(); return Math.abs(r.left - P.at[0]) > 1 || Math.abs(r.top - P.at[1]) > 1; };
580
+ const moved = (P) => { if (P.anchor && !P.anchor.isConnected) rehang(P); if (!P.anchor || !P.anchor.isConnected || !P.at) return true; const r = P.anchor.getBoundingClientRect(); return Math.abs(r.left - P.at[0]) > 1 || Math.abs(r.top - P.at[1]) > 1; };
581
+ /** A redraw put a new copy of the press in place (an edit shows at once, pm/live-edit.js): the picker hangs from that copy, found by
582
+ * the press's own data attributes, so it stays open. */
583
+ const selOf = (a) => { const at = [...a.attributes].filter((x) => x.name.startsWith('data-') && !/^data-(s|e|t)$/.test(x.name)); return at.length ? a.tagName.toLowerCase() + at.map((x) => `[${x.name}="${CSS.escape(x.value)}"]`).join('') : null; };
584
+ function rehang(P) {
585
+ let n = null; try { n = P.sel && document.querySelector(P.sel); } catch { n = null; }
586
+ if (!n || P.el.contains(n)) return;
587
+ P.anchor = n; n.setAttribute('aria-expanded', 'true'); const r = n.getBoundingClientRect(); P.at = [r.left, r.top];
588
+ }
580
589
  export function closePop() { if (!POP) return; const { el, anchor, scrim } = POP; POP = null; el.remove(); if (scrim) scrim.remove(); if (anchor && anchor.isConnected) anchor.setAttribute('aria-expanded', 'false'); }
581
590
  /** o.sheet: a bottom sheet over a scrim (a phone); o.right: the popover's right edge under the press's right edge. */
582
591
  export function openPop(anchor, html, onPress, o = {}) {
@@ -593,7 +602,7 @@ export function openPop(anchor, html, onPress, o = {}) {
593
602
  }
594
603
  anchor.setAttribute('aria-expanded', 'true');
595
604
  const ar = anchor.getBoundingClientRect();
596
- POP = { el, anchor, onPress, scrim, at: [ar.left, ar.top] };
605
+ POP = { el, anchor, onPress, scrim, at: [ar.left, ar.top], sel: selOf(anchor) };
597
606
  const f = el.querySelector('[aria-checked="true"], [aria-pressed="true"], button'); if (f) f.focus({ preventScroll: true });
598
607
  return el;
599
608
  }
@@ -652,29 +661,18 @@ export function jiraPop(anchor, key, status, raw, H) {
652
661
  if (s !== status && H.jiraMove) H.jiraMove({ key, to: s, from: status, fromRaw: raw });
653
662
  });
654
663
  }
655
- /** The date picker under a date press (a bottom sheet on a phone, batch 18 item 16 StA3Dates). The press says where it starts: data-f
656
- * 'start' opens on the start (the open row's Start chip); data-one: a milestone's one day, "◇ Date" with no Start and Due tabs (StA4Milestone). */
664
+ /** The date picker under a date press (a bottom sheet on a phone, batch 18 item 16 StA3Dates): start and due on one calendar
665
+ * (pm/range-pick.js), the first tap the start and the second the due day, which closes it. data-f 'due' opens on the due day (the open
666
+ * row's Due chip); data-one: a milestone's one day, "◇ Date" (StA4Milestone). */
657
667
  export function datePop(anchor, uid, H) {
658
668
  const one = anchor.dataset.one === '1', sheet = PHONE();
659
- const t = { start: one ? '' : anchor.dataset.s || '', due: anchor.dataset.e || '' }, st = { field: !one && anchor.dataset.f === 'start' ? 'start' : 'due', month: '', one };
669
+ const t = { start: one ? '' : anchor.dataset.s || '', due: anchor.dataset.e || '' }, st = { field: !one && anchor.dataset.f === 'due' ? 'due' : 'start', month: '', one };
660
670
  const nm = anchor.dataset.t || '';
661
671
  if (sheet) st.head = `<div class="ivd-h">${one ? SVG(P.dia, 15, 2.2) : SVG(P.cal, 15, 2)}<b>${one ? 'Date' : 'Dates'}</b><button type="button" class="iv-ib" data-ivd-x aria-label="Close" title="Close">${SVG('M6 6l12 12M18 6L6 18', 16, 2)}</button></div>`
662
672
  + (nm ? `<p class="ivd-s">${esc(nm + (one ? ' · one date: the milestone' : ''))}</p>` : '');
663
- const draw = () => { if (!POP || POP.anchor !== anchor) return; POP.el.innerHTML = datePickerHtml(t, st); };
664
- openPop(anchor, datePickerHtml(t, st), (b) => {
665
- const d = b.dataset;
666
- if ('ivdX' in d) { closePop(); return; }
667
- if (d.tkcField) { st.field = d.tkcField; st.month = ''; draw(); return; }
668
- if (d.tkcMonth) { st.month = d.tkcMonth; draw(); return; }
669
- if (d.tkcDay == null) return;
670
- const iso = d.tkcDay, f = st.field, p = { [f]: iso };
671
- if (iso && f === 'due' && t.start && iso < t.start) p.start = iso; // a due day before the start moves the start with it
672
- if (iso && f === 'start' && t.due && iso > t.due) p.due = iso;
673
- Object.assign(t, p);
674
- if (H.dates) H.dates(uid, p);
675
- // after the start, the next tap is the due day; after the due day the picker closes
676
- if (f === 'start' && iso) { st.field = 'due'; st.month = ''; draw(); } else closePop();
677
- }, sheet ? { sheet: true } : {});
673
+ const el = openPop(anchor, datePickerHtml(t, st), (b) => { if ('ivdX' in b.dataset) closePop(); }, sheet ? { sheet: true } : {});
674
+ mountRange(el.querySelector('.tkc-dp'), { ...t, one, field: st.field, head: st.head, onPick: (p, done) => { Object.assign(t, p); if (done) closePop(); if (H.dates) H.dates(uid, p); } });
675
+ el.querySelector('.rp-g [tabindex="0"]')?.focus({ preventScroll: true });
678
676
  }
679
677
  function menuPop(anchor, label, items, go) {
680
678
  const html = `<div class="tkc-pop ivq-m" role="menu" aria-label="${esc(label)}">${items.map((x, i) => `<button type="button" role="menuitemradio" class="o${x.on ? ' hl' : ''}" aria-checked="${!!x.on}" data-ivq-i="${i}"><span class="ck" aria-hidden="true">${x.on ? SVG(P.check, 14, 2.4) : ''}</span><span>${esc(x.label)}</span>${x.count ? `<span class="k">${esc(x.count)}</span>` : ''}</button>`).join('')}</div>`;