create-pmos 0.397.0 → 0.398.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.
- package/package.json +13 -13
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +101 -52
- package/workspace/briefing-premium-board-test.js +252 -128
- package/workspace/briefing-premium-calendar-2-test.js +135 -198
- package/workspace/briefing-premium-calendar-3-test.js +143 -418
- package/workspace/briefing-premium-calendar-test.js +86 -196
- package/workspace/briefing-premium-doc-edit-test.js +95 -83
- package/workspace/briefing-premium-initiative-test.js +159 -296
- package/workspace/briefing-premium-insights-test.js +337 -219
- package/workspace/briefing-premium-metrics-test.js +53 -97
- package/workspace/briefing-premium-products-test.js +40 -27
- package/workspace/briefing-premium-sources-test.js +66 -48
- package/workspace/briefing-premium-test.js +150 -647
- package/workspace/briefing-premium-work-test.js +88 -283
- package/workspace/changelog.json +12 -0
- package/workspace/fixtures/board-premium-trail.js +32 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +182 -0
- package/workspace/guide/briefing-premium.md +3 -1
- package/workspace/guide/home.md +47 -0
- package/workspace/guide/index.md +1 -0
- package/workspace/lib/agent-roles.js +71 -0
- package/workspace/lib/board-premium.js +85 -19
- package/workspace/lib/board-trail.js +223 -0
- package/workspace/lib/home-work-item.js +58 -0
- package/workspace/lib/insights-goals.js +196 -0
- package/workspace/lib/insights-premium.js +62 -14
- package/workspace/lib/insights-records.js +101 -0
- package/workspace/lib/jira-tickets.js +1 -1
- package/workspace/lib/route-modules.js +4 -0
- package/workspace/lib/routes-board-trail.js +33 -0
- package/workspace/lib/routes-home-desk.js +176 -0
- package/workspace/lib/routes-insights-premium.js +12 -3
- package/workspace/lib/routes-insights-records.js +129 -0
- package/workspace/lib/routes-notes.js +1 -0
- package/workspace/lib/routes-viewer.js +108 -0
- package/workspace/lib/transcript-steps.js +123 -0
- package/workspace/lib/viewer-meeting.js +205 -0
- package/workspace/lib/viewer-report.js +89 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +85 -75
- package/workspace/premium-briefing-depth-test.js +66 -53
- package/workspace/premium-chat-attach-test.js +54 -63
- package/workspace/premium-chat-chart-tab-test.js +35 -37
- package/workspace/premium-chat-context-test.js +19 -18
- package/workspace/premium-chat-goal-view-test.js +23 -23
- package/workspace/premium-chat-notes-test.js +26 -31
- package/workspace/premium-chat-report-tab-test.js +32 -28
- package/workspace/premium-chat-term-test.js +16 -16
- package/workspace/premium-chat-viewer-test.js +60 -59
- package/workspace/premium-core-doc-issue-test.js +50 -43
- package/workspace/premium-html-viewer-test.js +14 -17
- package/workspace/premium-phone-card-test.js +7 -2
- package/workspace/premium-phone-room-test.js +41 -35
- package/workspace/premium-report-read-test.js +115 -197
- package/workspace/premium-viewer-download-test.js +19 -22
- package/workspace/premium-viewer-flicker-test.js +11 -16
- package/workspace/premium-viewer-share-test.js +6 -9
- package/workspace/premium-viewer-test.js +41 -60
- package/workspace/premium-vw-backlog-test.js +53 -33
- package/workspace/premium-vw-cal-test.js +82 -128
- package/workspace/premium-vw-copy-test.js +17 -33
- package/workspace/premium-vw-doc-test.js +11 -10
- package/workspace/premium-vw-item-test.js +50 -49
- package/workspace/premium-vw-jira-test.js +53 -27
- package/workspace/premium-vw-meet-test.js +118 -187
- package/workspace/premium-vw-notes-test.js +85 -108
- package/workspace/premium-vw-rec-test.js +72 -194
- package/workspace/premium-vw-slides-test.js +46 -50
- package/workspace/premium-welcome-test.js +3 -2
- package/workspace/premium-work-depth-test.js +61 -53
- package/workspace/public/pm/bd-acts.js +305 -0
- package/workspace/public/pm/bd-span.js +186 -82
- package/workspace/public/pm/bd-stages.js +25 -11
- package/workspace/public/pm/c3-doc-sheet.js +1 -1
- package/workspace/public/pm/c3-md.js +3 -395
- package/workspace/public/pm/c3-phone-detail.js +1 -1
- package/workspace/public/pm/c3-phone-model.js +3 -68
- package/workspace/public/pm/chat-term.js +3 -3
- package/workspace/public/pm/cozy-board.css +497 -230
- package/workspace/public/pm/cozy-home.css +570 -142
- package/workspace/public/pm/cozy-home.js +5 -3
- package/workspace/public/pm/cozy-insights.css +296 -167
- package/workspace/public/pm/cozy-md.js +396 -0
- package/workspace/public/pm/cozy-nav.js +17 -6
- package/workspace/public/pm/cozy-placeholder.js +26 -0
- package/workspace/public/pm/cozy-viewer.css +3 -3
- package/workspace/public/pm/cozy-viewer.js +144 -0
- package/workspace/public/pm/cozy-vw.css +485 -0
- package/workspace/public/pm/cozy.css +83 -1
- package/workspace/public/pm/home-adddoc.js +48 -0
- package/workspace/public/pm/home-app.js +905 -0
- package/workspace/public/pm/home-around.js +515 -0
- package/workspace/public/pm/home-chat.js +459 -0
- package/workspace/public/pm/home-data.js +312 -0
- package/workspace/public/pm/home-draft.js +68 -0
- package/workspace/public/pm/home-more.js +249 -0
- package/workspace/public/pm/home-phone-card.js +109 -0
- package/workspace/public/pm/home-work.js +519 -0
- package/workspace/public/pm/phone-moment.js +69 -0
- package/workspace/public/pm/pm-work-view.js +1 -1
- package/workspace/public/pm/premium-attach.js +4 -0
- package/workspace/public/pm/premium-board.js +423 -394
- package/workspace/public/pm/premium-chart-tab.js +110 -62
- package/workspace/public/pm/premium-deck.js +3 -3
- package/workspace/public/pm/premium-first.js +25 -21
- package/workspace/public/pm/premium-insights.js +792 -568
- package/workspace/public/pm/premium-meeting.js +61 -549
- package/workspace/public/pm/premium-notes.js +1 -1
- package/workspace/public/pm/premium-report-frame.css +20 -0
- package/workspace/public/pm/premium-report-read.js +509 -480
- package/workspace/public/pm/premium-report-tab.js +87 -63
- package/workspace/public/pm/premium-shell.js +72 -119
- package/workspace/public/pm/premium-viewer.js +22 -1
- package/workspace/public/pm/premium-vw-cal.js +187 -48
- package/workspace/public/pm/premium-vw-doc.css +6 -0
- package/workspace/public/pm/premium-vw-doc.js +40 -2
- package/workspace/public/pm/premium-vw-file.js +2 -2
- package/workspace/public/pm/premium-vw-meet.js +6 -83
- package/workspace/public/pm/premium-vw-mtg.js +731 -0
- package/workspace/public/pm/premium-vw-notes.js +56 -69
- package/workspace/public/pm/premium-vw-open.js +35 -0
- package/workspace/public/pm/premium-vw-page.js +16 -0
- package/workspace/public/pm/premium-vw-rec.js +11 -218
- package/workspace/public/pm/premium-vw-slides.css +5 -0
- package/workspace/public/pm/premium-vw-slides.js +44 -8
- package/workspace/public/pm/term-view.js +22 -0
- package/workspace/public/premium-board.html +28 -70
- package/workspace/public/premium-initiative.html +8 -48
- package/workspace/public/premium-insights.html +22 -60
- package/workspace/public/premium-viewer.html +20 -0
- package/workspace/public/premium.html +16 -107
- package/workspace/server.js +18 -3
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/home-libs.json +9 -0
- package/workspace/test-lists/premium-report-read.json +1 -1
- package/workspace/test-lists/premium-vw-agreed.json +9 -0
- package/workspace/test-lists/premium-vw-notes.json +1 -1
- package/workspace/public/pm/premium-work.js +0 -729
- package/workspace/public/pm/premium.js +0 -1146
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/* pm/premium-shell.js — what the premium Briefing and My work pages share: the theme, the toast, the standard dialog and the read-only agent's conversation (initiatives briefing-premium and my-work-premium). */
|
|
2
2
|
import { pmGet, pmPost } from './http.js';
|
|
3
|
-
import { recChipView, STOP_LINE } from './premium-meeting.js';
|
|
4
3
|
import { vwReset, vwOn, vwCount, vwOpen, vwStyle } from './premium-viewer.js';
|
|
5
4
|
import { openChatFile, openWebLink } from './premium-vw-file.js';
|
|
6
5
|
import { turnsOf } from './chat-context.js';
|
|
7
6
|
import { chipsHtml, itemOf, openCtx } from './premium-vw-ctx.js';
|
|
8
|
-
import { chipActs, openLive, openFocus, mountRecord, HL_LINE } from './premium-vw-rec.js';
|
|
9
7
|
import { lineItems, behindOf, whenRead } from './freshness-words.js';
|
|
10
8
|
import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, goalChipHtml, goalViewHtml, goalNow, slashMatches } from './goal-chat.js';
|
|
11
9
|
import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
|
|
@@ -13,17 +11,33 @@ import { splitReport, reportChipHtml, blockSig } from './report-chat.js';
|
|
|
13
11
|
import { askCardHtml, answerText } from './chat-ask.js';
|
|
14
12
|
import { termTarget, TERM_ICON } from './chat-term.js';
|
|
15
13
|
import { openReportTab } from './premium-report-tab.js';
|
|
14
|
+
import { placeholder as czPlaceholderView } from './cozy-viewer.js'; // the Agreed design's Viewer; imported first, so its Escape runs before the dialog's
|
|
16
15
|
import { openChartTab } from './premium-chart-tab.js';
|
|
17
16
|
/** A pmos-report block opens the Report tab, or the Chart tab for a chart or a dashboard (premium-reports-from-chat, slice C). */
|
|
18
17
|
export const openBlockTab = (b) => (b && b.kind === 'report' ? openReportTab(b) : openChartTab(b));
|
|
19
18
|
import { mountNotes, openNotes, flushNotes, syncNotes } from './premium-notes.js';
|
|
20
19
|
import { attachMarkup, attachRowMarkup, mountAttach, attachNames, clearAttach, syncAttach, dropFiles, splitFiles, filesHtml, openAttachment } from './premium-attach.js';
|
|
21
|
-
import { railModel, railHtml, teaser,
|
|
22
|
-
|
|
20
|
+
import { railModel, railHtml, teaser, loudestRow, factsOf, titleOf, endAsks, DOT, WORD } from './session-rail.js';
|
|
21
|
+
/* premium-agreed-design (Home): a page without the old dialog (Home has none) can still import this module. Its top-level wiring then binds to a
|
|
22
|
+
* detached copy of the dialog's parts that is never put in the page, so nothing old shows and nothing throws. A page with #dlg is unchanged. */
|
|
23
|
+
const DETACHED = typeof document !== 'undefined' && !document.getElementById('dlg') ? (() => {
|
|
24
|
+
const d = document.createElement('div');
|
|
25
|
+
d.innerHTML = '<div class="veil" id="veil"></div><div class="dlg" id="dlg" data-mode="split"><p id="dEye"></p><h2 id="dTitle"></h2><p id="dSub"></p>'
|
|
26
|
+
+ '<div class="dtools"><button id="dPane"></button><button id="dExpand"><svg><path id="dExpP"/></svg></button><button id="dClose"></button></div><div id="dTabs"></div>'
|
|
27
|
+
+ '<div id="dGrid"><section id="dBody"></section><section id="dOut"><div class="otop"><span id="oLab"></span></div><div class="obody" id="oMain"></div><button id="tabGo"></button></section></div></div>'
|
|
28
|
+
+ '<div id="toast"></div>';
|
|
29
|
+
return d;
|
|
30
|
+
})() : null;
|
|
31
|
+
export const $ = (s, r = document) => r.querySelector(s) || (DETACHED && r === document ? DETACHED.querySelector(s) : null);
|
|
23
32
|
/* Home (initiative premium-agreed-design, H2): on a desktop the chat is docked beside Home's list, as the middle and right panes, instead of a
|
|
24
33
|
* popup. It is the Chat page's held-open dialog (chatpg) placed right of the list; on a phone, and on every other page, the dialog stays a popup. */
|
|
25
34
|
if (document.body.classList.contains('cz-home') && innerWidth >= 1000) document.body.classList.add('chatpg', 'cz-dock');
|
|
26
35
|
export const homeDock = () => document.body.classList.contains('cz-dock');
|
|
36
|
+
/* The Agreed design has one way between places, the floating place menu (cozy-nav.js). The old five-place rail (Briefing, My work, Chat,
|
|
37
|
+
* Board, Insights) and the old dock are no longer wired: the rail leaves the page, and the dock stays hidden and inert until the pages stop
|
|
38
|
+
* writing their counts into it (premium-agreed-design, shared foundation). */
|
|
39
|
+
document.querySelectorAll('nav.rail').forEach((n) => n.remove());
|
|
40
|
+
{ const d = document.getElementById('dock'); if (d) { d.hidden = true; d.inert = true; } }
|
|
27
41
|
export const $$ = (s, r = document) => [...r.querySelectorAll(s)];
|
|
28
42
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
29
43
|
export const RM = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
@@ -42,35 +56,38 @@ export function flip() {
|
|
|
42
56
|
theme(next); store.set(THEME_KEY, next); tbTheme();
|
|
43
57
|
}
|
|
44
58
|
{ const t = new URLSearchParams(location.search).get('theme') || store.get(THEME_KEY); theme(t); }
|
|
45
|
-
/* ── the top bar (
|
|
46
|
-
*
|
|
47
|
-
*
|
|
59
|
+
/* ── the top bar: one ⋯ menu (premium-agreed-design). The design draws no Sources chip, no bell, no mic and no help button, and leaves the menu's
|
|
60
|
+
* contents to be designed (only Insights names them: Sources, Export, About these numbers). So each item opens the Viewer on its placeholder, and
|
|
61
|
+
* Theme stays a plain switch. Nothing in the menu leads to the console. The ids moreBtn, moreMenu, modeRow and settingsBtn stay: pages add their
|
|
62
|
+
* own items before #settingsBtn and anchor their popovers on #moreBtn. ── */
|
|
48
63
|
const MORE = '<svg class="i" viewBox="0 0 24 24"><circle cx="6" cy="12" r="1.3"/><circle cx="12" cy="12" r="1.3"/><circle cx="18" cy="12" r="1.3"/></svg>';
|
|
49
64
|
const TH = [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']];
|
|
65
|
+
/** The ⋯ menu's items that open a placeholder: [id, label, icon]. Insights adds what its own design names. Pure, for a unit test. */
|
|
66
|
+
export const moreItems = (path = location.pathname) => (/premium-insights/.test(path)
|
|
67
|
+
? [['srcItem', 'Sources', 'source'], ['tbExport', 'Export', 'export'], ['tbAbout', 'About these numbers', 'info']]
|
|
68
|
+
: [['srcItem', 'Sources', 'source']]);
|
|
50
69
|
function tbMount() {
|
|
51
70
|
const t = $('.tools-top'); if (!t || $('#tbMore')) return;
|
|
52
|
-
|
|
53
|
-
|
|
71
|
+
const items = moreItems();
|
|
72
|
+
t.insertAdjacentHTML('beforeend', `<span class="mwrap" id="tbMore"><button type="button" class="glass round" id="moreBtn" aria-haspopup="menu" aria-expanded="false" aria-controls="moreMenu" aria-label="More" title="More">${MORE}</button>`
|
|
54
73
|
+ '<div class="crmenu tbmenu" id="moreMenu" role="menu" aria-label="More" hidden>'
|
|
55
|
-
+
|
|
56
|
-
+ '<button role="menuitem" id="srcItem" class="tbm-src" aria-haspopup="dialog">Sources</button>'
|
|
57
|
-
+ '<a role="menuitem" id="toConsole" href="/console.html" aria-label="Open the console">Console</a>'
|
|
74
|
+
+ items.map(([id, label]) => `<button role="menuitem" id="${id}" aria-haspopup="dialog">${esc(label)}</button>`).join('')
|
|
58
75
|
+ '<div class="tbrow" id="modeRow" hidden><span>Open initiatives</span></div>'
|
|
59
76
|
+ `<div class="tbrow" role="group" aria-label="Theme"><span>Theme</span><span class="tbseg" id="tbTheme">${TH.map(([k, w]) => `<button role="menuitemradio" data-th="${k}" aria-checked="false">${w}</button>`).join('')}</span></div>`
|
|
60
|
-
+ '<button role="menuitem" id="settingsBtn" aria-haspopup="dialog">Settings
|
|
77
|
+
+ '<button role="menuitem" id="settingsBtn" aria-haspopup="dialog">Settings</button></div></span>');
|
|
61
78
|
const ms = $('#modeSeg'); if (ms) { $('#modeRow').appendChild(ms); $('#modeRow').hidden = false; }
|
|
62
79
|
tbTheme();
|
|
63
80
|
const btn = $('#moreBtn'), menu = $('#moreMenu');
|
|
64
|
-
const
|
|
81
|
+
const live = () => $$('#moreMenu [role^="menuitem"]').filter((x) => x.offsetParent !== null || x.closest('.tbseg'));
|
|
65
82
|
const close = (back) => { if (menu.hidden) return; menu.hidden = true; btn.setAttribute('aria-expanded', 'false'); if (back) btn.focus(); };
|
|
66
83
|
btn.onclick = (e) => {
|
|
67
84
|
e.stopPropagation();
|
|
68
85
|
if (!menu.hidden) { close(); return; }
|
|
69
86
|
menu.hidden = false; btn.setAttribute('aria-expanded', 'true');
|
|
70
87
|
if ($('#modeSeg', menu)) pillOf($('#modeSeg', menu));
|
|
71
|
-
const f =
|
|
88
|
+
const f = live()[0]; if (f) f.focus();
|
|
72
89
|
};
|
|
73
|
-
// capture: the menu closes and focus goes back to its button before the item's own press runs, so a
|
|
90
|
+
// capture: the menu closes and focus goes back to its button before the item's own press runs, so a view it opens returns focus there
|
|
74
91
|
menu.addEventListener('click', (e) => {
|
|
75
92
|
const th = e.target.closest('[data-th]');
|
|
76
93
|
if (th) { const v = th.dataset.th; theme(v === 'auto' ? null : v); store.set(THEME_KEY, v === 'auto' ? '' : v); tbTheme(); return; }
|
|
@@ -81,10 +98,10 @@ function tbMount() {
|
|
|
81
98
|
menu.addEventListener('keydown', (e) => {
|
|
82
99
|
if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); close(true); return; }
|
|
83
100
|
if (e.key !== 'ArrowDown' && e.key !== 'ArrowUp') return;
|
|
84
|
-
const L =
|
|
101
|
+
const L = live(), i = L.indexOf(document.activeElement); if (!L.length) return;
|
|
85
102
|
e.preventDefault(); L[(i + (e.key === 'ArrowDown' ? 1 : L.length - 1) + (i < 0 ? 1 : 0)) % L.length].focus();
|
|
86
103
|
});
|
|
87
|
-
|
|
104
|
+
items.forEach(([id, label, icon]) => { $('#' + id).onclick = () => czPlaceholderView(label, { icon }); });
|
|
88
105
|
tbReadSrc();
|
|
89
106
|
setInterval(() => { if (!document.hidden) tbReadSrc(); }, 300000);
|
|
90
107
|
}
|
|
@@ -92,9 +109,8 @@ function tbTheme() {
|
|
|
92
109
|
const cur = document.documentElement.dataset.theme || 'auto';
|
|
93
110
|
$$('#tbTheme [data-th]').forEach((b) => b.setAttribute('aria-checked', String(b.dataset.th === cur)));
|
|
94
111
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
export function chatAbout(key, label) { ABOUT = key ? { key, label: label || '' } : null; }
|
|
112
|
+
/** The page's own conversation (premium-chat-page). The rail's Chat that carried it is gone; the pages still name it, and nothing reads it now. */
|
|
113
|
+
export function chatAbout(key, label) { return key ? { key, label: label || '' } : null; }
|
|
98
114
|
/** On the Chat page the dialog is the page: it never closes, Escape does nothing, and the rail stays live. */
|
|
99
115
|
const chatPage = () => document.body.classList.contains('chatpg');
|
|
100
116
|
|
|
@@ -259,8 +275,8 @@ export function openChatPage(key, label) {
|
|
|
259
275
|
? 'Talk to Claude about ' + label + '. It works in a real Claude Code session: it can read, change files, run commands and take slash commands.'
|
|
260
276
|
: 'Talk to Claude. It works in a real Claude Code session: it can read, change files, run commands and take slash commands. Pick another session from the list.';
|
|
261
277
|
openDlg({ eye: label ? 'Chat · ' + label : 'Chat', title: label ? 'Ask about ' + label : 'Chat', say, stream: turnA(ptx(say)), noteKey: key, pane: `<article class="paper doc"><p class="note">${esc(label ? 'This conversation is about ' + label + '. Files Claude opens show here.' : 'Files Claude opens show here.')}</p></article>`, paneEmpty: true, label: label || 'Chat', sessions: true });
|
|
262
|
-
if (chatPage()) { // the held-open chat (desktop Home) leaves the
|
|
263
|
-
|
|
278
|
+
if (chatPage()) { // the held-open chat (desktop Home) leaves the page live; on a phone Home's chat is a popup and keeps openDlg's veil and inert page
|
|
279
|
+
document.documentElement.style.overflow = '';
|
|
264
280
|
$('#veil').classList.remove('on');
|
|
265
281
|
}
|
|
266
282
|
$('#askIn').placeholder = label ? 'Message Claude about ' + label : 'Message Claude, or type /';
|
|
@@ -268,9 +284,8 @@ export function openChatPage(key, label) {
|
|
|
268
284
|
vwShutPane(); // premium-chat-viewer V1: the conversation has the room until something opens in the viewer
|
|
269
285
|
loadThread(key);
|
|
270
286
|
}
|
|
271
|
-
tbMount(); // the top bar first: the menu holds the Settings
|
|
272
|
-
{ const
|
|
273
|
-
{ const b = $('#settingsBtn'); if (b) b.onclick = () => openSettings(); } // hoisted: the function below is declared, not assigned
|
|
287
|
+
tbMount(); // the top bar first: the menu holds the Settings item the code below reads
|
|
288
|
+
{ const b = $('#settingsBtn'); if (b) b.onclick = () => czPlaceholderView('Settings', { icon: 'gear' }); } // Settings has no design yet (premium-agreed-design)
|
|
274
289
|
|
|
275
290
|
/* ── toast ──────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
276
291
|
let tt = null;
|
|
@@ -317,7 +332,7 @@ export function openDlg(o) {
|
|
|
317
332
|
if (S.ctx) markSeen(S.key, S.ctx);
|
|
318
333
|
park(); // a page's own control lent to the dialog (the Briefing's product picker) goes home before the pane is replaced
|
|
319
334
|
const ae = document.activeElement; if (ae && ae !== document.body) lastFocus = ae;
|
|
320
|
-
$$('
|
|
335
|
+
$$('main.stage').forEach((x) => { x.inert = true; });
|
|
321
336
|
$('#dlg').inert = false; document.documentElement.style.overflow = 'hidden';
|
|
322
337
|
$('#dEye').textContent = o.eye; $('#dTitle').textContent = o.title; $('#dSub').textContent = o.sub || ''; $('#dSub').hidden = !o.sub;
|
|
323
338
|
$('#oMain').innerHTML = o.pane || `<article class="paper doc">${o.html}</article>`; $('#oLab').textContent = o.label || 'Detail';
|
|
@@ -340,7 +355,7 @@ export function openDlg(o) {
|
|
|
340
355
|
* detail to show; a placeholder note leaves it folded, and the icon at the chat's top right opens it again. */
|
|
341
356
|
function dockOpen(o) {
|
|
342
357
|
$('#dlg').setAttribute('aria-modal', 'false'); // docked, the list beside it stays live: a modal flag would hide the list from a screen reader
|
|
343
|
-
$('#veil').classList.remove('on'); $$('
|
|
358
|
+
$('#veil').classList.remove('on'); $$('main.stage').forEach((x) => { x.inert = false; }); document.documentElement.style.overflow = '';
|
|
344
359
|
setFull(true);
|
|
345
360
|
if (o.paneEmpty || o.sessions) vwShutPane(); else vwOpenPane(true);
|
|
346
361
|
}
|
|
@@ -373,9 +388,8 @@ export function closeDlg() {
|
|
|
373
388
|
if (chatPage()) return;
|
|
374
389
|
clearTimeout(threadTimer); S.key = null; syncTerm(null); flushNotes(); railOnClose();
|
|
375
390
|
park();
|
|
376
|
-
$('#veil').classList.remove('on'); $$('
|
|
391
|
+
$('#veil').classList.remove('on'); $$('main.stage').forEach((x) => { x.inert = false; });
|
|
377
392
|
$('#dlg').inert = true; document.documentElement.style.overflow = ''; $('#dlg').classList.remove('on');
|
|
378
|
-
$('#dock').inert = !document.body.classList.contains('docked');
|
|
379
393
|
if (lastFocus) { try { lastFocus.focus(); } catch { /* gone */ } }
|
|
380
394
|
}
|
|
381
395
|
export function pillOf(s) { const o = $('button[aria-pressed="true"]', s), p = $('.pill', s); requestAnimationFrame(() => { if (!o || !p) return; p.style.left = o.offsetLeft + 'px'; p.style.width = o.offsetWidth + 'px'; }); }
|
|
@@ -401,6 +415,7 @@ function syncTerm(t = null) {
|
|
|
401
415
|
}
|
|
402
416
|
$('#dTerm').onclick = async () => {
|
|
403
417
|
const t = S.term; if (!t) return;
|
|
418
|
+
if (t.term) { import('./term-view.js').then((M) => M.openTermView(t.term, { title: ($('#dTitle') || {}).textContent || t.term })); return; }
|
|
404
419
|
if (t.href) { window.open(t.href, '_blank', 'noopener'); return; }
|
|
405
420
|
try { await navigator.clipboard.writeText(t.copy); toast('Copied. Paste it in Terminal on the computer PMOS runs on.'); }
|
|
406
421
|
catch { toast('Copy did not work here. The command: ' + t.copy); }
|
|
@@ -421,6 +436,7 @@ addEventListener('keydown', (e) => {
|
|
|
421
436
|
}, true);
|
|
422
437
|
(() => {
|
|
423
438
|
const g = $('#dlg .grab'); let y0 = null, dy = 0;
|
|
439
|
+
if (!g) return; // a page with no dialog (the DETACHED stub has no grab handle)
|
|
424
440
|
g.addEventListener('pointerdown', (e) => { y0 = e.clientY; dy = 0; try { g.setPointerCapture(e.pointerId); } catch { /* none */ } });
|
|
425
441
|
g.addEventListener('pointermove', (e) => { if (y0 == null) return; dy = Math.max(0, e.clientY - y0); $('#dlg').style.transition = 'none'; $('#dlg').style.transform = `translateY(${dy}px)`; });
|
|
426
442
|
const end = () => { if (y0 == null) return; const d = dy; y0 = null; dy = 0; $('#dlg').style.transition = ''; $('#dlg').style.transform = ''; if (d > 90) closeDlg(); };
|
|
@@ -765,16 +781,12 @@ $('#dBody').addEventListener('submit', async (e) => {
|
|
|
765
781
|
if (await sendText(key, text, files)) { inp.value = ''; inp.placeholder = 'Message Claude, or type /'; clearAttach(); drawSlash(); growAsk(); }
|
|
766
782
|
});
|
|
767
783
|
|
|
768
|
-
/* ──
|
|
784
|
+
/* ── on scroll: a card's head sticks while its card is on screen. The old hero no longer folds into a dock (premium-agreed-design). ── */
|
|
769
785
|
let tick = false;
|
|
770
786
|
export function onScroll() {
|
|
771
787
|
if (tick) return; tick = true;
|
|
772
788
|
requestAnimationFrame(() => {
|
|
773
789
|
tick = false;
|
|
774
|
-
const y = scrollY, h = $('.hero').offsetHeight, p = Math.max(0, Math.min(1, y / (h * 0.55))), big = $('.brief');
|
|
775
|
-
if (!RM) { big.style.transform = `translateY(${-p * 30}px) scale(${1 - p * 0.12})`; big.style.opacity = 1 - p * 0.9; }
|
|
776
|
-
document.body.classList.toggle('docked', p > 0.62);
|
|
777
|
-
if (!$('#dlg').classList.contains('on')) $('#dock').inert = p <= 0.62;
|
|
778
790
|
$$('.ch').forEach((c) => { const k = c.closest('.card, .cz-grp'); if (k) c.classList.toggle('stuck', c.getBoundingClientRect().top <= 61 && k.getBoundingClientRect().bottom > 140); });
|
|
779
791
|
});
|
|
780
792
|
}
|
|
@@ -796,64 +808,11 @@ if (window.visualViewport) {
|
|
|
796
808
|
visualViewport.addEventListener('resize', () => { const shut = visualViewport.height >= innerHeight - 1; if (kb && shut) settleFixed(); kb = !shut; });
|
|
797
809
|
}
|
|
798
810
|
|
|
799
|
-
/* ──
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
const c = document.createElement('div'); c.className = 'recchip glass'; c.id = 'recChip'; c.hidden = true; c.setAttribute('role', 'status'); document.body.appendChild(c);
|
|
805
|
-
let rows = [], ask = false, msg = '';
|
|
806
|
-
const holding = () => (window.__premiumHolding && window.__premiumHolding.id) || null;
|
|
807
|
-
const draw = () => {
|
|
808
|
-
const v = recChipView(rows, { holdingId: holding(), here });
|
|
809
|
-
if (!v) { c.hidden = true; c.innerHTML = ''; ask = false; return; }
|
|
810
|
-
c.hidden = false; c.dataset.mode = v.mode;
|
|
811
|
-
if (ask) { c.innerHTML = `<span>Stop “${esc(v.title)}” for good? ${esc(STOP_LINE)}</span><button data-r="no">Cancel</button>${v.held ? '<button data-r="pause">Pause instead</button>' : ''}<button data-r="stopgo">Stop for good</button>`; return; }
|
|
812
|
-
const L = { hl: 'Highlight', pause: 'Pause', fv: 'Focus', open: 'Open', resume: 'Resume', stop: 'Stop' }; // the presses premium-vw-rec.js gives this page
|
|
813
|
-
c.innerHTML = `<i${v.mode === 'paused' ? ' class="paused"' : ''}></i><span>${esc(msg || v.text)}</span>${chipActs(v, here).map((a) => `<button data-r="${a}"${a === 'hl' ? ` title="${esc(HL_LINE)}"` : ''}>${L[a]}</button>`).join('')}`;
|
|
814
|
-
};
|
|
815
|
-
const read = async () => { const r = await pmGet('/api/notes'); if (r && r.ok === true && Array.isArray(r.notes)) rows = r.notes; draw(); };
|
|
816
|
-
c.addEventListener('click', async (e) => {
|
|
817
|
-
const b = e.target.closest('button'); if (!b) return;
|
|
818
|
-
const v = recChipView(rows, { holdingId: holding(), here }); if (!v) return;
|
|
819
|
-
const act = b.dataset.r; msg = '';
|
|
820
|
-
const d = { openDlg, toast, pmGet, pmPost };
|
|
821
|
-
if (act === 'open') { if (here === 'brief' && window.__premiumRec) openLive(v.id, d); else location.assign('/premium.html?meeting=' + encodeURIComponent(v.id)); return; }
|
|
822
|
-
if (act === 'fv') { openFocus(v.id, d); return; }
|
|
823
|
-
if (act === 'stop') { ask = true; draw(); const g = c.querySelector('[data-r="no"]'); if (g) g.focus(); return; }
|
|
824
|
-
if (act === 'no') { ask = false; draw(); return; }
|
|
825
|
-
b.disabled = true;
|
|
826
|
-
if (act === 'hl') { const r = window.__premiumRec ? await window.__premiumRec.highlight() : { ok: false }; msg = r.ok ? 'Highlighting the last 30 seconds and the next ones.' : (r.error || 'The highlight was not started.'); draw(); setTimeout(() => { msg = ''; draw(); }, 6000); return; }
|
|
827
|
-
if (act === 'pause') { ask = false; const r = window.__premiumRec ? await window.__premiumRec.pause() : { ok: false }; msg = r.ok ? '' : (r.error || 'It was not paused.'); }
|
|
828
|
-
else if (act === 'resume') { const r = window.__premiumRec ? await window.__premiumRec.resume(v.id) : { ok: false }; msg = r.ok ? '' : (r.error || 'It was not resumed.'); }
|
|
829
|
-
else if (act === 'stopgo') {
|
|
830
|
-
ask = false;
|
|
831
|
-
const r = window.__premiumRec ? await window.__premiumRec.stop(v.id) : await pmPost('/api/notes/stop', { id: v.id });
|
|
832
|
-
if (r && r.ok === true) toast('Stopped for good. The final notes are written now.'); else msg = (r && r.error) || 'The meeting was not stopped.';
|
|
833
|
-
}
|
|
834
|
-
await read();
|
|
835
|
-
});
|
|
836
|
-
addEventListener('premium-rec', read);
|
|
837
|
-
read(); setInterval(read, 20000);
|
|
838
|
-
mountRecord(here, { openDlg, toast, pmGet, pmPost });
|
|
839
|
-
}
|
|
840
|
-
export function wireRail(here) {
|
|
841
|
-
mountRecChip(here);
|
|
842
|
-
const rail = $('.rail');
|
|
843
|
-
// premium-chat-rail: five places with Chat in the middle. The phone bar slides by whole places (--pi); the desktop rail's Chat is taller, so
|
|
844
|
-
// the indicator there is placed at the current place's own top (--py).
|
|
845
|
-
const cur = $(`.rail [data-go="${here}"]`), all = $$('.rail .pl');
|
|
846
|
-
rail.style.setProperty('--pi', String(all.indexOf(cur)));
|
|
847
|
-
const place = () => { if (cur) rail.style.setProperty('--py', (cur.offsetTop - all[0].offsetTop) + 'px'); };
|
|
848
|
-
place(); addEventListener('resize', place);
|
|
849
|
-
$$('.rail [data-go]').forEach((b) => { b.onclick = () => { if (b.dataset.go !== here) location.assign(b.dataset.go === 'chat' ? chatHref() : GO[b.dataset.go]); }; });
|
|
850
|
-
}
|
|
851
|
-
/** The Chat page's address: the workspace the PM is in, and the page they came from as the conversation it opens (premium-chat-page). */
|
|
852
|
-
function chatHref() {
|
|
853
|
-
const q = new URLSearchParams(), ws = new URLSearchParams(location.search).get('ws');
|
|
854
|
-
if (ws) q.set('ws', ws);
|
|
855
|
-
if (ABOUT) { q.set('about', ABOUT.key); if (ABOUT.label) q.set('label', ABOUT.label); }
|
|
856
|
-
const s = q.toString(); return GO.chat + (s ? '?' + s : '');
|
|
811
|
+
/* ── a page's start (premium-agreed-design): the old rail, the floating record chip (#recChip) and the round mic (#recCtl) are gone; the place
|
|
812
|
+
* menu (cozy-nav.js) moves between places, and recording shows in the Viewer's recording bar and Home's meeting line. Recording starts from
|
|
813
|
+
* the Viewer (window.czViews.newNote, or a meeting's Record), so a page start draws no recorder; an old page's mic is taken out. ── */
|
|
814
|
+
export function wireRail() {
|
|
815
|
+
const mic = document.getElementById('recCtl'); if (mic) mic.remove();
|
|
857
816
|
}
|
|
858
817
|
|
|
859
818
|
/* ── the crumb: where you are and a menu to switch board or initiative. Its Chat moved to the rail (premium-chat-rail) ──────────── */
|
|
@@ -923,9 +882,9 @@ export function openAddDoc(o) {
|
|
|
923
882
|
};
|
|
924
883
|
}
|
|
925
884
|
|
|
926
|
-
/* ── Search (Ctrl K or "/") and the
|
|
885
|
+
/* ── Search (Ctrl K or "/") and the agent inbox (initiative premium-search-bell). Reads only; a press goes to a page.
|
|
886
|
+
* The Agreed design draws no bell, so none is drawn: the inbox is still read (its count, its toast and the panel premium.js opens). ── */
|
|
927
887
|
const SRCH = '<svg class="i" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>';
|
|
928
|
-
const BELL = '<svg class="i" viewBox="0 0 24 24"><path d="M6 16V11a6 6 0 0 1 12 0v5l2 2H4z"/><path d="M10 20a2 2 0 0 0 4 0"/></svg>';
|
|
929
888
|
const IC = (d) => `<svg class="i" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
|
|
930
889
|
const GL = { place: IC('M4 5h16v14H4zM4 10h16'), ini: IC('M12 3l9 9-9 9-9-9z'), doc: IC('M6 3h9l4 4v14H6zM14 3v5h5'), ses: IC('M5 4l14 8-14 8z'), need: IC('M12 4v10M12 18v2') };
|
|
931
890
|
const PLACES = [['Home', '/premium.html'], ['Board', '/premium-board.html'], ['Insights', '/premium-insights.html']];
|
|
@@ -937,10 +896,9 @@ const pvOv = { kind: null, back: null, at: 0, list: [], pal: null, need: null };
|
|
|
937
896
|
* first read never toasts), shown the new ids the open panel shows (closing the panel marks them seen), toastAt the last toast (at most one per 15 min). */
|
|
938
897
|
const IB = { r: null, ids: null, shown: [], toastAt: 0 };
|
|
939
898
|
function pvMount() {
|
|
940
|
-
|
|
941
|
-
a.insertAdjacentHTML('beforebegin', `<button class="glass round pv-hp" id="pvBell" aria-haspopup="dialog" aria-label="Needs you" title="Needs you">${BELL}<span class="pv-bdg" id="pvBdg" hidden></span></button>`);
|
|
899
|
+
if (!$('#tbMore') || $('#pvOv')) return;
|
|
942
900
|
document.body.insertAdjacentHTML('beforeend', '<div class="pv-scrim" id="pvScrim"></div><div class="pv-ov" id="pvOv" role="dialog" aria-modal="true" hidden inert></div>');
|
|
943
|
-
$('#
|
|
901
|
+
$('#pvScrim').onclick = pvClose;
|
|
944
902
|
pvNeeds(); ibRead();
|
|
945
903
|
setInterval(() => { if (!document.hidden) ibRead(); }, 60000);
|
|
946
904
|
document.addEventListener('visibilitychange', () => { if (!document.hidden) ibRead(); });
|
|
@@ -949,7 +907,7 @@ export function pvClose() {
|
|
|
949
907
|
if (!pvOv.kind) return;
|
|
950
908
|
if (pvOv.kind === 'bell' && IB.shown.length) { const ids = IB.shown.slice(0, 100); IB.shown = []; pmPost('/api/inbox/seen', { ids }).then(ibRead); } // seen is not done: they move to Still waiting
|
|
951
909
|
pvOv.kind = null; $('#pvOv').hidden = true; $('#pvOv').inert = true; $('#pvScrim').classList.remove('on');
|
|
952
|
-
$$('
|
|
910
|
+
$$('main.stage').forEach((x) => { x.inert = false; }); document.documentElement.style.overflow = '';
|
|
953
911
|
if (homeDock()) $('#dlg').inert = false;
|
|
954
912
|
if (pvOv.back) { try { pvOv.back.focus(); } catch { /* gone */ } }
|
|
955
913
|
}
|
|
@@ -957,15 +915,16 @@ export const pvOpenBell = () => pvOpen('bell');
|
|
|
957
915
|
function pvOpen(kind) {
|
|
958
916
|
if (pvOv.kind === kind) { pvClose(); return; }
|
|
959
917
|
if (pvOv.kind) pvClose();
|
|
960
|
-
const ae = document.activeElement; pvOv.back = ae && ae !== document.body ? ae : $(
|
|
918
|
+
const ae = document.activeElement; pvOv.back = ae && ae !== document.body ? ae : $('#moreBtn');
|
|
961
919
|
pvOv.kind = kind; pvOv.at = 0;
|
|
962
|
-
$$('
|
|
920
|
+
$$('main.stage').forEach((x) => { x.inert = true; }); document.documentElement.style.overflow = 'hidden';
|
|
963
921
|
if (homeDock()) $('#dlg').inert = true;
|
|
964
922
|
const o = $('#pvOv'); o.className = 'pv-ov ' + kind; o.setAttribute('aria-label', kind === 'pal' ? 'Search' : 'Needs you'); o.hidden = false; o.inert = false; $('#pvScrim').classList.add('on');
|
|
965
923
|
if (kind === 'pal') { o.innerHTML = '<div class="pv-pin">' + SRCH + '<input id="pvQ" type="text" placeholder="Search places, initiatives, documents and sessions" aria-label="Search" autocomplete="off" role="combobox" aria-expanded="true" aria-controls="pvList"><kbd>Esc</kbd></div><div id="pvList" role="listbox" aria-label="Results"></div><p class="pv-note">Ctrl K or / opens this from any page. Arrow keys move, Enter opens.</p>'; $('#pvQ').focus(); pvPal(); }
|
|
966
924
|
else { o.innerHTML = '<div class="pv-hd"><h2>Needs you</h2><small id="pvN"></small><button type="button" class="ib-all" id="ibAll" hidden>Mark all seen</button></div><div id="pvList" class="pv-lst"></div>'; pvBellDraw(); pvNeeds(); ibRead(); }
|
|
967
925
|
}
|
|
968
|
-
|
|
926
|
+
/* A session opens in Home's chat: in place on Home, or Home opens on it (?session=<id>, read at the end of this file). Never the console. */
|
|
927
|
+
const pvGo = (it) => { pvClose(); if (it.sid && pvOnBriefing()) { openSessionAt(it.sid); return; } if (it.go) location.assign(it.go); };
|
|
969
928
|
const pvRow = (it, i, sel) => `<button type="button" class="pv-row" role="option" id="pvo${i}" data-i="${i}" aria-selected="${sel}"><span class="gl">${GL[it.gl]}</span><span><b>${esc(it.t)}</b>${it.s ? `<small>${esc(it.s)}</small>` : ''}</span></button>`;
|
|
970
929
|
async function pvPal() {
|
|
971
930
|
if (!pvOv.pal) {
|
|
@@ -973,7 +932,7 @@ async function pvPal() {
|
|
|
973
932
|
const miss = [];
|
|
974
933
|
const ini = b.j && b.j.ok && Array.isArray(b.j.rows) ? b.j.rows.map((r) => ({ g: 'Initiatives', gl: 'ini', t: r.title || r.id, s: [r.lane, r.stage].filter(Boolean).join(' · '), go: '/premium-initiative.html?id=' + encodeURIComponent(r.id) + (b.j.ws ? '&ws=' + encodeURIComponent(b.j.ws) + '&board=' + encodeURIComponent(b.j.board) : '') })) : (miss.push('initiatives'), []);
|
|
975
934
|
const docs = d.j && d.j.ok && Array.isArray(d.j.docs) ? d.j.docs.map((x) => ({ g: 'Documents', gl: 'doc', t: x.title || x.key, s: d.j.scope && d.j.scope.name ? d.j.scope.name : 'Board', go: '/premium-board.html' + pvQ('?') })) : (miss.push('documents'), []);
|
|
976
|
-
const ses = s.j && Array.isArray(s.j.sessions) ? s.j.sessions.filter((x) => !x.automatic).map((x) => ({ g: 'Sessions', gl: 'ses', t: x.name || x.id, s: [x.cwd && x.cwd !== '.' ? x.cwd : '', x.state].filter(Boolean).join(' · '), go: '/
|
|
935
|
+
const ses = s.j && Array.isArray(s.j.sessions) ? s.j.sessions.filter((x) => !x.automatic).map((x) => ({ g: 'Sessions', gl: 'ses', t: x.name || x.id, s: [x.cwd && x.cwd !== '.' ? x.cwd : '', x.state].filter(Boolean).join(' · '), sid: x.id, go: '/premium.html?' + ['session=' + encodeURIComponent(x.id), PV_WS ? 'ws=' + encodeURIComponent(PV_WS) : ''].filter(Boolean).join('&') })) : (miss.push('sessions'), []);
|
|
977
936
|
pvOv.pal = { items: [...PLACES.map(([t, go]) => ({ g: 'Places', gl: 'place', t, s: 'Place', go })), ...ini, ...docs, ...ses], miss };
|
|
978
937
|
}
|
|
979
938
|
if (pvOv.kind === 'pal') pvPalDraw();
|
|
@@ -1069,7 +1028,7 @@ addEventListener('keydown', (e) => {
|
|
|
1069
1028
|
else if ((e.ctrlKey || e.metaKey) && (e.key === 'k' || e.key === 'K')) { e.preventDefault(); pvClose(); }
|
|
1070
1029
|
return;
|
|
1071
1030
|
}
|
|
1072
|
-
if (!$('#
|
|
1031
|
+
if (!$('#pvOv') || ($('#dlg').classList.contains('on') && !homeDock())) return; // Home's docked chat is always open: Ctrl K still searches
|
|
1073
1032
|
if ((e.ctrlKey || e.metaKey) && !e.altKey && (e.key === 'k' || e.key === 'K')) { e.preventDefault(); pvOpen('pal'); return; }
|
|
1074
1033
|
if ($('#dlg').classList.contains('on')) return;
|
|
1075
1034
|
const t = document.activeElement;
|
|
@@ -1204,7 +1163,7 @@ export async function openSettings() {
|
|
|
1204
1163
|
<div class="two" style="margin-top:10px"><label><input id="stP" maxlength="500" placeholder="Folder path of a repository" aria-label="Folder path of a repository"></label><button type="button" class="cta" id="stAdd">Add repository</button></div></div>
|
|
1205
1164
|
<div><span class="label">Connectors</span><p class="note" style="margin:0 0 8px">Every connector your Claude session has. Your sessions can use all of them; a switch chooses only what PMOS reads on its own, such as the sources of the Briefing. PMOS keeps no passwords or keys.</p>${srcRows}${connRows}</div>
|
|
1206
1165
|
<p class="note" id="stM" role="status" style="margin:0;min-height:1.2em">${esc(M.err)}</p>
|
|
1207
|
-
<p class="note" style="margin:0">Everything else runs on a default
|
|
1166
|
+
<p class="note" style="margin:0">Everything else runs on a default.</p></div></article>`;
|
|
1208
1167
|
};
|
|
1209
1168
|
openDlg({ eye: 'Settings · real data', title: 'Settings', say: 'Updates and what each kit changed, then two choices: which repositories PMOS works in, and which sources the Briefing reads.', stream: turnA(ptx('Updates and what each published kit changed, copied from its merged pull requests. Then two choices: which repositories PMOS works in, and which sources the Briefing reads. Each press saves that one record and changes nothing else.')), noteKey: popKey('settings'), pane: '<article class="paper doc"></article>', label: 'Settings' });
|
|
1210
1169
|
setMode('detail'); draw();
|
|
@@ -1385,7 +1344,6 @@ function railDraw() {
|
|
|
1385
1344
|
t.hidden = !tz || !t.dataset.on || $('#dlg').classList.contains('full');
|
|
1386
1345
|
if (tz) { $('i', t).className = 'sdot2 ' + tz.dot; $('em', t).textContent = tz.text; t.setAttribute('aria-label', 'Sessions, ' + tz.text + '. Switch between sessions'); t.title = 'Switch between sessions'; t.setAttribute('aria-expanded', String($('#dlg').classList.contains('srl-open'))); }
|
|
1387
1346
|
}
|
|
1388
|
-
sessBadge(menuCount(R.rows));
|
|
1389
1347
|
document.dispatchEvent(new CustomEvent('pmos:sessions', { detail: m })); // Home's list counts them and finds an initiative's own sessions
|
|
1390
1348
|
}
|
|
1391
1349
|
/** Home: open one session from the list's own rows (an initiative's sessions). */
|
|
@@ -1453,7 +1411,7 @@ function cardDraw(r) {
|
|
|
1453
1411
|
${R.ask ? `<div class="ssc" role="group" aria-label="Confirm stop"><p><b>Stop “${esc(r.name)}”?</b> ${what} Files it already wrote stay where they are.</p><div class="ssx"><button type="button" class="cta bad" data-yes="1">Stop</button><button type="button" class="cta alt" data-no="1">Keep running</button></div></div>`
|
|
1454
1412
|
: R.slow ? `<div class="ssc" role="group" aria-label="Still running"><p><b>Asked “${esc(r.name)}” to end.</b> It has not exited yet. Press Stop again to remove it.</p><div class="ssx"><button type="button" class="cta bad" data-yes="1">Stop again</button><button type="button" class="cta alt" data-no="1">Keep running</button></div></div>`
|
|
1455
1413
|
: `<div class="ssx"><button type="button" class="cta alt" data-stop="1"${R.busy ? ' disabled' : ''}>${R.busy ? 'Ending…' : 'Stop'}</button></div>`}
|
|
1456
|
-
<p class="note" role="status">${esc(R.err)}</p
|
|
1414
|
+
<p class="note" role="status">${esc(R.err)}</p></article>`;
|
|
1457
1415
|
}
|
|
1458
1416
|
$('#oMain').addEventListener('click', async (e) => {
|
|
1459
1417
|
const card = e.target.closest('.scard'); if (!card || R.busy) return;
|
|
@@ -1478,18 +1436,6 @@ $('#oMain').addEventListener('click', async (e) => {
|
|
|
1478
1436
|
cardDraw(r);
|
|
1479
1437
|
}
|
|
1480
1438
|
});
|
|
1481
|
-
/* The rail's Chat carries the count the ⋯ menu's Sessions used to: a dot when a session is Ready or Maybe blocked (premium-chat-rail C5). */
|
|
1482
|
-
function sessBadge(n) {
|
|
1483
|
-
const a = $('.rail [data-go="chat"]'); if (!a) return;
|
|
1484
|
-
const d = $('.cdot', a); if (d) d.hidden = !n;
|
|
1485
|
-
a.setAttribute('aria-label', n ? 'Chat, ' + n + (n === 1 ? ' session needs you' : ' sessions need you') : 'Chat');
|
|
1486
|
-
}
|
|
1487
|
-
{
|
|
1488
|
-
if ($('.rail [data-go="chat"]')) {
|
|
1489
|
-
const poll = async () => { if (document.hidden || railShowing()) return; const s = await pmGet('/api/sessions').catch(() => null); if (s && Array.isArray(s.sessions)) { R.rows = s.sessions; sessBadge(menuCount(R.rows)); } };
|
|
1490
|
-
poll(); setInterval(poll, BADGE_POLL);
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
1439
|
/** The session list on its own (the rail's Chat on a page with no conversation): the chat panel, full screen with the list (the list itself on a phone), on the session that needs you most. */
|
|
1494
1440
|
export async function openSessions() {
|
|
1495
1441
|
openDlg({ eye: 'Sessions', title: 'Sessions', say: 'Pick a session from the list.', stream: turnA(ptx('Pick a session from the list. A dot shows its state: Ready, Running or Maybe blocked.')), noteKey: null, sessions: true, pane: '<article class="paper doc"><p class="note">Pick a session from the list.</p></article>', label: 'Session' });
|
|
@@ -1500,3 +1446,10 @@ export async function openSessions() {
|
|
|
1500
1446
|
const top = loudestRow(R.model);
|
|
1501
1447
|
if (top && desk()) pickSession(top.id);
|
|
1502
1448
|
}
|
|
1449
|
+
/** Open one session in Home's chat: the session list opens on it (a desktop docks it beside the list; a phone shows the chat). */
|
|
1450
|
+
async function openSessionAt(id) {
|
|
1451
|
+
await openSessions();
|
|
1452
|
+
if (R.model && R.model.rows.some((x) => x.id === id)) pickSession(id); else toast('That session is not running any more.');
|
|
1453
|
+
}
|
|
1454
|
+
/* Home opened from a search result elsewhere: ?session=<id>. It waits one turn, so Home's own chat (premium-chat.js) opens first. */
|
|
1455
|
+
{ const sid = new URLSearchParams(location.search).get('session'); if (sid && pvOnBriefing()) setTimeout(() => openSessionAt(sid), 0); }
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* premium-chat-viewer: #oMain with data-empty="1" holds only a placeholder note, so its tab is not drawn and closing the last other tab empties
|
|
10
10
|
* the viewer. vwOn(fn) hears fn('open', id), fn('show', id) and fn('empty'): the Chat page opens and closes its viewer on them. Tabs that do not
|
|
11
11
|
* fit fold, oldest first, into a "+N" button that lists them; the current tab always shows. */
|
|
12
|
+
import { open as czOpen, current as czCurrent, close as czClose } from './cozy-viewer.js';
|
|
12
13
|
const MAX = 4;
|
|
13
14
|
const IC = {
|
|
14
15
|
doc: 'M6 3h9l4 4v14H6zM14 3v5h5M9 12h7M9 16h5', cal: 'M3.5 5h17v15h-17zM3.5 10h17M8 3v4M16 3v4', notes: 'M6 3h9l4 4v14H6zM14 3v5h5M9 12h7M9 16h5',
|
|
@@ -77,7 +78,25 @@ if (typeof ResizeObserver !== 'undefined') {
|
|
|
77
78
|
setTimeout(watch, 0);
|
|
78
79
|
vwOn(() => watch());
|
|
79
80
|
}
|
|
80
|
-
function pane(id) { return id === 'main' ? q('#oMain') : document.querySelector(
|
|
81
|
+
function pane(id) { return id === 'main' ? q('#oMain') : document.querySelector(`.obody.vw[data-vw="${CSS.escape(id)}"]`); }
|
|
82
|
+
/* A page with no dialog (Home in the Agreed design): a view opens in the cozy Viewer card (cozy-viewer.js) instead of a tab of #dOut, one at a time.
|
|
83
|
+
* The view draws into the same .obody.vw element, so its own code does not change. */
|
|
84
|
+
const CZ_ICON = { tk: 'jira', list: 'list', goal: 'goal', mic: 'mic', cal: 'cal', notes: 'notes', doc: 'doc' };
|
|
85
|
+
let czLast = null;
|
|
86
|
+
/** Opens again the last item the cozy Viewer showed through vwOpen (Home's "Open the Viewer" button). False when there is none. */
|
|
87
|
+
export function vwReopen() { if (!czLast) return false; czVw(czLast); return true; }
|
|
88
|
+
function czVw(it) {
|
|
89
|
+
let el = null; czLast = it;
|
|
90
|
+
czOpen({ id: 'vw:' + it.id, kind: it.kind || it.title || 'Item', title: it.name || it.title || 'Item', icon: CZ_ICON[it.icon] || 'doc', url: it.url || '',
|
|
91
|
+
render: (body) => {
|
|
92
|
+
el = document.createElement('div'); el.className = 'obody vw'; el.dataset.vw = it.id; el.setAttribute('role', 'region'); body.append(el);
|
|
93
|
+
if (it.render) it.render(el); else el.innerHTML = it.html || '';
|
|
94
|
+
if (it.wire) it.wire(el);
|
|
95
|
+
},
|
|
96
|
+
onClose: () => emit('empty') });
|
|
97
|
+
emit('open', it.id);
|
|
98
|
+
return el;
|
|
99
|
+
}
|
|
81
100
|
export function vwShow(id) {
|
|
82
101
|
if (id !== 'main' && !V.items.some((x) => x.id === id)) id = 'main';
|
|
83
102
|
if (id === 'main' && !mainReal() && V.items.length) id = V.items[V.items.length - 1].id; // the placeholder is never a tab of its own
|
|
@@ -90,6 +109,7 @@ export function vwShow(id) {
|
|
|
90
109
|
}
|
|
91
110
|
export function vwOpen(it) {
|
|
92
111
|
if (!it || !it.id) return null;
|
|
112
|
+
if (typeof document !== 'undefined' && !document.getElementById('dOut')) return czVw(it);
|
|
93
113
|
const was = V.items.find((x) => x.id === it.id);
|
|
94
114
|
if (was) { Object.assign(was, it); fill(was); vwShow(it.id); emit('open', it.id); return pane(it.id); }
|
|
95
115
|
if (V.items.length >= MAX) vwClose(V.items[0].id, true);
|
|
@@ -105,6 +125,7 @@ function fill(rec) {
|
|
|
105
125
|
if (rec.wire) rec.wire(el);
|
|
106
126
|
}
|
|
107
127
|
export function vwClose(id, quiet) {
|
|
128
|
+
if (typeof document !== 'undefined' && !document.getElementById('dOut')) { const c = czCurrent(); if (c && c.id === 'vw:' + id) czClose(); return; }
|
|
108
129
|
const i = V.items.findIndex((x) => x.id === id); if (i < 0) return;
|
|
109
130
|
V.items.splice(i, 1); const p = pane(id); if (p) p.remove();
|
|
110
131
|
if (quiet) return;
|