create-pmos 0.268.0 → 0.270.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 +1 -1
- package/payload/KIT-VERSION +1 -1
- 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/workspace/briefing-premium-calendar-2-test.js +2 -2
- package/workspace/briefing-premium-calendar-3-test.js +360 -0
- package/workspace/briefing-premium-calendar-test.js +2 -2
- package/workspace/briefing-premium-insights-test.js +13 -9
- package/workspace/briefing-premium-test.js +26 -0
- package/workspace/guide/briefing-premium.md +14 -4
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-studio-test.js +156 -0
- package/workspace/public/pm/premium-insights.js +3 -45
- package/workspace/public/pm/premium-meeting.js +375 -16
- package/workspace/public/pm/premium-shell.js +135 -0
- package/workspace/public/pm/premium-studio.js +217 -0
- package/workspace/public/pm/premium.css +131 -0
- package/workspace/public/pm/premium.js +3 -1
- package/workspace/test-files.json +2 -0
- package/workspace/test-lists/briefing-premium.json +2 -0
- package/workspace/test-lists/premium-studio.json +9 -0
|
@@ -1,5 +1,6 @@
|
|
|
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';
|
|
3
4
|
export const $ = (s, r = document) => r.querySelector(s);
|
|
4
5
|
export const $$ = (s, r = document) => [...r.querySelectorAll(s)];
|
|
5
6
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
@@ -144,7 +145,42 @@ addEventListener('scroll', onScroll, { passive: true }); addEventListener('resiz
|
|
|
144
145
|
|
|
145
146
|
/* ── the rail: Briefing, My work, Board and Insights are premium pages ── */
|
|
146
147
|
const GO = { brief: '/premium.html', work: '/premium-work.html', init: '/premium-board.html', rep: '/premium-insights.html' };
|
|
148
|
+
/* ── the recording chip: while a note records or is paused, every premium page says so and can stop it (initiative briefing-premium-calendar, slice 3) ───────────────
|
|
149
|
+
* It reads GET /api/notes. Only the Briefing holds a recorder; the other pages show what the server holds, and Stop there ends the meeting through POST /api/notes/stop. */
|
|
150
|
+
function mountRecChip(here) {
|
|
151
|
+
const c = document.createElement('div'); c.className = 'recchip glass'; c.id = 'recChip'; c.hidden = true; c.setAttribute('role', 'status'); document.body.appendChild(c);
|
|
152
|
+
let rows = [], ask = false, msg = '';
|
|
153
|
+
const holding = () => (window.__premiumHolding && window.__premiumHolding.id) || null;
|
|
154
|
+
const draw = () => {
|
|
155
|
+
const v = recChipView(rows, { holdingId: holding(), here });
|
|
156
|
+
if (!v) { c.hidden = true; c.innerHTML = ''; ask = false; return; }
|
|
157
|
+
c.hidden = false; c.dataset.mode = v.mode;
|
|
158
|
+
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; }
|
|
159
|
+
c.innerHTML = `<i${v.mode === 'paused' ? ' class="paused"' : ''}></i><span>${esc(msg || v.text)}</span><button data-r="open">Open</button>${v.canPause ? '<button data-r="pause">Pause</button>' : ''}${v.canResume ? '<button data-r="resume">Resume</button>' : ''}<button data-r="stop">Stop</button>`;
|
|
160
|
+
};
|
|
161
|
+
const read = async () => { const r = await pmGet('/api/notes'); if (r && r.ok === true && Array.isArray(r.notes)) rows = r.notes; draw(); };
|
|
162
|
+
c.addEventListener('click', async (e) => {
|
|
163
|
+
const b = e.target.closest('button'); if (!b) return;
|
|
164
|
+
const v = recChipView(rows, { holdingId: holding(), here }); if (!v) return;
|
|
165
|
+
const act = b.dataset.r; msg = '';
|
|
166
|
+
if (act === 'open') { if (here === 'brief' && window.__premiumRec) window.__premiumRec.open(v.id); else location.assign('/premium.html?meeting=' + encodeURIComponent(v.id)); return; }
|
|
167
|
+
if (act === 'stop') { ask = true; draw(); const g = c.querySelector('[data-r="no"]'); if (g) g.focus(); return; }
|
|
168
|
+
if (act === 'no') { ask = false; draw(); return; }
|
|
169
|
+
b.disabled = true;
|
|
170
|
+
if (act === 'pause') { ask = false; const r = window.__premiumRec ? await window.__premiumRec.pause() : { ok: false }; msg = r.ok ? '' : (r.error || 'It was not paused.'); }
|
|
171
|
+
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.'); }
|
|
172
|
+
else if (act === 'stopgo') {
|
|
173
|
+
ask = false;
|
|
174
|
+
const r = window.__premiumRec ? await window.__premiumRec.stop(v.id) : await pmPost('/api/notes/stop', { id: v.id });
|
|
175
|
+
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.';
|
|
176
|
+
}
|
|
177
|
+
await read();
|
|
178
|
+
});
|
|
179
|
+
addEventListener('premium-rec', read);
|
|
180
|
+
read(); setInterval(read, 20000);
|
|
181
|
+
}
|
|
147
182
|
export function wireRail(here) {
|
|
183
|
+
mountRecChip(here);
|
|
148
184
|
const rail = $('.rail');
|
|
149
185
|
rail.style.setProperty('--pi', String(['brief', 'work', 'init', 'rep'].indexOf(here)));
|
|
150
186
|
$$('.rail [data-go]').forEach((b) => { b.onclick = () => { if (b.dataset.go !== here) location.assign(GO[b.dataset.go]); }; });
|
|
@@ -213,6 +249,105 @@ export function openAddDoc(o) {
|
|
|
213
249
|
};
|
|
214
250
|
}
|
|
215
251
|
|
|
252
|
+
/* ── Search (Ctrl K or "/") and the bell, in the header of every premium page (initiative premium-search-bell). Reads only; a press goes to a page. ── */
|
|
253
|
+
const SRCH = '<svg class="i" viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m20 20-4-4"/></svg>';
|
|
254
|
+
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>';
|
|
255
|
+
const IC = (d) => `<svg class="i" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
|
|
256
|
+
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') };
|
|
257
|
+
const PLACES = [['Briefing', '/premium.html'], ['My work', '/premium-work.html'], ['Board', '/premium-board.html'], ['Insights', '/premium-insights.html']];
|
|
258
|
+
const PV_WS = new URLSearchParams(location.search).get('ws');
|
|
259
|
+
const pvQ = (sep) => (PV_WS ? sep + 'ws=' + encodeURIComponent(PV_WS) : '');
|
|
260
|
+
async function pvGet(u) { try { const r = await fetch(u, { credentials: 'same-origin' }); return { status: r.status, j: await r.json() }; } catch { return { status: 0, j: null }; } }
|
|
261
|
+
const pvOv = { kind: null, back: null, at: 0, list: [], pal: null, need: null };
|
|
262
|
+
function pvMount() {
|
|
263
|
+
const a = $('#toConsole'); if (!a || $('#pvSearch')) return;
|
|
264
|
+
a.insertAdjacentHTML('beforebegin', `<button class="glass round" id="pvSearch" aria-haspopup="dialog" aria-label="Search (Ctrl K)" title="Search (Ctrl K)">${SRCH}</button><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>`);
|
|
265
|
+
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>');
|
|
266
|
+
$('#pvSearch').onclick = () => pvOpen('pal'); $('#pvBell').onclick = () => pvOpen('bell'); $('#pvScrim').onclick = pvClose;
|
|
267
|
+
pvNeeds();
|
|
268
|
+
}
|
|
269
|
+
export function pvClose() {
|
|
270
|
+
if (!pvOv.kind) return;
|
|
271
|
+
pvOv.kind = null; $('#pvOv').hidden = true; $('#pvOv').inert = true; $('#pvScrim').classList.remove('on');
|
|
272
|
+
$$('.rail,main.stage,#dock').forEach((x) => { x.inert = false; }); $('#dock').inert = !document.body.classList.contains('docked'); document.documentElement.style.overflow = '';
|
|
273
|
+
if (pvOv.back) { try { pvOv.back.focus(); } catch { /* gone */ } }
|
|
274
|
+
}
|
|
275
|
+
function pvOpen(kind) {
|
|
276
|
+
if (pvOv.kind === kind) { pvClose(); return; }
|
|
277
|
+
if (pvOv.kind) pvClose();
|
|
278
|
+
const ae = document.activeElement; pvOv.back = ae && ae !== document.body ? ae : $(kind === 'pal' ? '#pvSearch' : '#pvBell');
|
|
279
|
+
pvOv.kind = kind; pvOv.at = 0;
|
|
280
|
+
$$('.rail,main.stage,#dock').forEach((x) => { x.inert = true; }); document.documentElement.style.overflow = 'hidden';
|
|
281
|
+
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');
|
|
282
|
+
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(); }
|
|
283
|
+
else { o.innerHTML = '<div class="pv-hd"><h2>Needs you</h2><small id="pvN"></small></div><div id="pvList" class="pv-lst"></div><p class="pv-note">Read from the Briefing. A press opens it.</p>'; pvBellDraw(); pvNeeds(); }
|
|
284
|
+
}
|
|
285
|
+
const pvGo = (it) => { pvClose(); if (it.go) location.assign(it.go); };
|
|
286
|
+
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>`;
|
|
287
|
+
async function pvPal() {
|
|
288
|
+
if (!pvOv.pal) {
|
|
289
|
+
const [b, d, s] = await Promise.all([pvGet('/api/boards/backlog?limit=200' + pvQ('&')), pvGet('/api/core-docs?level=board' + pvQ('&')), pvGet('/api/sessions')]);
|
|
290
|
+
const miss = [];
|
|
291
|
+
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'), []);
|
|
292
|
+
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'), []);
|
|
293
|
+
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: '/c3.html' })) : (miss.push('sessions'), []);
|
|
294
|
+
pvOv.pal = { items: [...PLACES.map(([t, go]) => ({ g: 'Places', gl: 'place', t, s: 'Place', go })), ...ini, ...docs, ...ses], miss };
|
|
295
|
+
}
|
|
296
|
+
if (pvOv.kind === 'pal') pvPalDraw();
|
|
297
|
+
}
|
|
298
|
+
function pvPalDraw() {
|
|
299
|
+
const box = $('#pvList'), q = ($('#pvQ') || { value: '' }).value.trim().toLowerCase(), P = pvOv.pal;
|
|
300
|
+
const items = P ? P.items.filter((x) => !q || (x.t + ' ' + (x.s || '')).toLowerCase().includes(q)) : PLACES.map(([t, go]) => ({ g: 'Places', gl: 'place', t, s: 'Place', go }));
|
|
301
|
+
const per = {}, list = items.filter((x) => (per[x.g] = (per[x.g] || 0) + 1) <= (q ? 6 : 4));
|
|
302
|
+
pvOv.list = list; pvOv.at = Math.min(pvOv.at, Math.max(0, list.length - 1));
|
|
303
|
+
let g = '', h = '';
|
|
304
|
+
list.forEach((it, i) => { if (it.g !== g) { g = it.g; h += `<div class="pv-grp">${esc(g)}</div>`; } h += pvRow(it, i, i === pvOv.at); });
|
|
305
|
+
if (!list.length) h = '<p class="pv-note" role="status">Nothing matches.</p>';
|
|
306
|
+
if (!P) h += '<p class="pv-note" role="status">Reading the records.</p>'; else if (P.miss.length) h += `<p class="pv-note" role="status">Not read: ${esc(P.miss.join(', '))}.</p>`;
|
|
307
|
+
box.innerHTML = h;
|
|
308
|
+
const a = $('#pvo' + pvOv.at); if (a) { $('#pvQ').setAttribute('aria-activedescendant', a.id); a.scrollIntoView({ block: 'nearest' }); }
|
|
309
|
+
}
|
|
310
|
+
/** The Briefing page feeds the bell the answer it has already read (so the bell asks nothing there); every other page asks once. r: the parsed /api/briefing-premium answer or null. */
|
|
311
|
+
export function pvFeed(r) {
|
|
312
|
+
const M = r && r.ok && r.model, L = M && M.list;
|
|
313
|
+
pvOv.need = r && r.state === 'reading' ? { state: 'reading' } : L ? { state: 'ready', count: L.count, rows: L.rows || [] } : { state: 'error' };
|
|
314
|
+
const n = pvOv.need, b = $('#pvBdg'), btn = $('#pvBell'); if (!b) return;
|
|
315
|
+
const on = n.state === 'ready' && n.count > 0;
|
|
316
|
+
b.hidden = !on; b.textContent = on ? (n.count > 99 ? '99+' : String(n.count)) : '';
|
|
317
|
+
btn.setAttribute('aria-label', n.state === 'ready' ? 'Needs you: ' + n.count : 'Needs you');
|
|
318
|
+
if (pvOv.kind === 'bell') pvBellDraw();
|
|
319
|
+
}
|
|
320
|
+
const pvOnBriefing = () => /^\/premium\.html$/.test(location.pathname);
|
|
321
|
+
async function pvNeeds() {
|
|
322
|
+
if (pvOnBriefing()) return;
|
|
323
|
+
const r = await pvGet('/api/briefing-premium' + pvQ('?'));
|
|
324
|
+
pvFeed(r.status === 202 ? { state: 'reading' } : r.j);
|
|
325
|
+
}
|
|
326
|
+
function pvBellDraw() {
|
|
327
|
+
const n = pvOv.need, box = $('#pvList'); if (!box) return;
|
|
328
|
+
$('#pvN').textContent = n && n.state === 'ready' ? String(n.count) : '';
|
|
329
|
+
if (!n || n.state === 'reading') { box.innerHTML = '<p class="pv-note" role="status">Reading the initiative state. What needs you is not known yet.</p>'; return; }
|
|
330
|
+
if (n.state === 'error') { box.innerHTML = '<p class="pv-note" role="status">What needs you could not be read.</p>'; return; }
|
|
331
|
+
if (!n.rows.length) { box.innerHTML = '<p class="pv-note" role="status">Nothing needs you.</p>'; return; }
|
|
332
|
+
pvOv.list = n.rows.map((r) => ({ gl: 'need', t: r.title, s: r.subject, go: '/premium.html' + pvQ('?') }));
|
|
333
|
+
box.innerHTML = pvOv.list.map((it, i) => pvRow(it, i, false).replace('role="option"', 'role="listitem"').replace(' aria-selected="false"', '')).join('') + (n.count > n.rows.length ? `<p class="pv-note">${n.count - n.rows.length} more on the Briefing.</p>` : '');
|
|
334
|
+
}
|
|
335
|
+
document.addEventListener('click', (e) => { const b = e.target.closest('#pvList .pv-row'); if (b && pvOv.list[+b.dataset.i]) pvGo(pvOv.list[+b.dataset.i]); });
|
|
336
|
+
document.addEventListener('input', (e) => { if (e.target.id === 'pvQ') { pvOv.at = 0; pvPalDraw(); } });
|
|
337
|
+
addEventListener('keydown', (e) => {
|
|
338
|
+
if (pvOv.kind) {
|
|
339
|
+
if (e.key === 'Escape') { e.preventDefault(); e.stopImmediatePropagation(); pvClose(); return; }
|
|
340
|
+
if (pvOv.kind === 'pal' && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); const n = pvOv.list.length; if (n) { pvOv.at = (pvOv.at + (e.key === 'ArrowDown' ? 1 : n - 1)) % n; pvPalDraw(); } }
|
|
341
|
+
else if (pvOv.kind === 'pal' && e.key === 'Enter' && pvOv.list[pvOv.at]) { e.preventDefault(); pvGo(pvOv.list[pvOv.at]); }
|
|
342
|
+
else if ((e.ctrlKey || e.metaKey) && (e.key === 'k' || e.key === 'K')) { e.preventDefault(); pvClose(); }
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if ($('#dlg').classList.contains('on') || !$('#pvSearch')) return;
|
|
346
|
+
if ((e.ctrlKey || e.metaKey) && !e.altKey && (e.key === 'k' || e.key === 'K')) { e.preventDefault(); pvOpen('pal'); return; }
|
|
347
|
+
const t = document.activeElement;
|
|
348
|
+
if (e.key === '/' && !e.ctrlKey && !e.metaKey && !e.altKey && !(t && t.matches && t.matches('input,textarea,select,[contenteditable="true"]'))) { e.preventDefault(); pvOpen('pal'); }
|
|
349
|
+
}, true);
|
|
350
|
+
pvMount();
|
|
216
351
|
/* ── Settings: the two things that cannot be defaulted (initiative premium-settings) ────────────────────────────────────────────────────
|
|
217
352
|
* Workspaces: GET /api/workspaces · POST /api/workspaces, /api/workspaces/forget. Connectors: GET and POST /api/proactive/settings {briefSources}.
|
|
218
353
|
* Each press saves what the console's section saves, and nothing else. Every other setting runs on a default and stays in the console. */
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/* pm/premium-studio.js — the Insight Studio on the premium Insights page, part 1: dashboards (initiative premium-studio-dashboard).
|
|
2
|
+
* The mockup's Studio (prototype/premium-ux-concept/build-src/stu.js.txt) in its Dashboard mode: a conversation on the left, and on the right a brief of
|
|
3
|
+
* chips, a library, a live preview and checks. A turn changes the draft in the page and writes nothing. The one write is Save (or Remove), through the
|
|
4
|
+
* existing POST /api/premium-dashboards/save behind the launch nonce. Every title and chart comes from the page's model: the KR metric records and the
|
|
5
|
+
* board's saved dashboards. No demo measure is drawn.
|
|
6
|
+
*
|
|
7
|
+
* openStudio(P) P = { M, D (the saved dashboard to edit, or null), tile (the page's chart tile), save (body → answer), done (saved id | null) } */
|
|
8
|
+
import { $, esc, openDlg, closeDlg, toast, turnA, turnU, ptx, setFull } from './premium-shell.js';
|
|
9
|
+
|
|
10
|
+
const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
|
|
11
|
+
const UPI = ICO('<path d="M12 19V5M6 11l6-6 6 6"/>'), DNI = ICO('<path d="M12 5v14M6 13l6 6 6-6"/>'), XI = ICO('<path d="M6 6l12 12M18 6 6 18"/>');
|
|
12
|
+
const OKI = ICO('<path d="M5 12.5l4.5 4.5L19 7.5"/>'), WRN = ICO('<path d="M12 4 2.5 20h19z"/><path d="M12 10v4M12 17v.5"/>'), CHV = ICO('<path d="M6 9l6 6 6-6"/>');
|
|
13
|
+
const DSI = ICO('<rect x="3" y="3" width="8" height="8" rx="2"/><rect x="13" y="3" width="8" height="8" rx="2"/><rect x="3" y="13" width="8" height="8" rx="2"/><rect x="13" y="13" width="8" height="8" rx="2"/>');
|
|
14
|
+
const MAX_UNDO = 30;
|
|
15
|
+
|
|
16
|
+
let P = null; // the page's hand: { M, D, tile, save, done }
|
|
17
|
+
let st = null; // the Studio: { d: draft, h: undo stack, pop, lib, ck, msg, armed, busy }
|
|
18
|
+
|
|
19
|
+
const measures = () => P.M.measures || [];
|
|
20
|
+
const chartOf = (id) => (P.M.charts || []).find((c) => c.id === id) || null;
|
|
21
|
+
const titleOf = (id) => { const m = measures().find((x) => x.id === id); return m ? m.title : id; };
|
|
22
|
+
const savedDash = () => (P.M.dashboards || []).filter((x) => x.saved);
|
|
23
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
24
|
+
|
|
25
|
+
/* ── the draft and its undo ── */
|
|
26
|
+
const snap = () => { const h = st.h, cur = JSON.stringify(st.d); if (h.length && h[h.length - 1] === cur) return; h.push(cur); if (h.length > MAX_UNDO) h.shift(); };
|
|
27
|
+
const undo = () => { if (!st.h.length) return false; st.d = JSON.parse(st.h.pop()); return true; };
|
|
28
|
+
const blank = () => ({ id: null, name: '', use: '', charts: [], main: false });
|
|
29
|
+
|
|
30
|
+
/* ── the canvas ── */
|
|
31
|
+
const chip = (k, l, v) => `<button type="button" class="suc${st.pop === k ? ' on' : ''}${v === 'Not set' ? ' req' : ''}" data-st="chip|${k}" aria-expanded="${st.pop === k}"><em>${esc(l)}</em><b>${esc(v)}</b></button>`;
|
|
32
|
+
function briefHtml() {
|
|
33
|
+
const d = st.d;
|
|
34
|
+
return `<div class="stbr" role="group" aria-label="Brief">${chip('name', 'Name', d.name || 'Not set')}${chip('use', 'Purpose', d.use || 'Not set')}${chip('charts', 'Charts', String(d.charts.length))}${chip('main', 'Main dashboard', d.main ? 'Yes' : 'No')}</div>`;
|
|
35
|
+
}
|
|
36
|
+
const opt = (act, l, sub, on) => `<button type="button" class="sto" data-st="${act}" aria-pressed="${!!on}"><b>${esc(l)}</b>${sub ? `<small>${esc(sub)}</small>` : ''}</button>`;
|
|
37
|
+
const field = (f, v, ph, max) => `<input class="sti" id="stI" data-stf="${f}" value="${esc(v)}" placeholder="${esc(ph)}" maxlength="${max}" aria-label="${esc(ph)}" autocomplete="off">`;
|
|
38
|
+
function trayHtml() {
|
|
39
|
+
const p = st.pop, d = st.d; if (!p) return '';
|
|
40
|
+
let h = '';
|
|
41
|
+
if (p === 'name') h = field('name', d.name, 'For example: Weekly partner review', 60);
|
|
42
|
+
else if (p === 'use') h = field('use', d.use, 'What routine is this for?', 200);
|
|
43
|
+
else if (p === 'main') h = `<div class="sol">${opt('set|main|1', 'Yes', 'It opens first on this board. One dashboard is main.', d.main)}${opt('set|main|0', 'No', 'Keep it as another dashboard', !d.main)}</div>`;
|
|
44
|
+
else if (p === 'charts') {
|
|
45
|
+
h = (d.charts.length ? `<ul class="sul">${d.charts.map((id, i) => `<li><span>${esc(titleOf(id))}${chartOf(id) ? '' : '<small>No series yet</small>'}</span><span class="stlc"><button type="button" data-st="mv|${i}|-1" aria-label="Move ${esc(titleOf(id))} up"${i ? '' : ' disabled'}>${UPI}</button><button type="button" data-st="mv|${i}|1" aria-label="Move ${esc(titleOf(id))} down"${i < d.charts.length - 1 ? '' : ' disabled'}>${DNI}</button><button type="button" data-st="rm|${i}" aria-label="Remove ${esc(titleOf(id))}">${XI}</button></span></li>`).join('')}</ul>` : '<p class="note">No charts yet.</p>')
|
|
46
|
+
+ '<button type="button" class="dmcta alt" data-st="lib">Add from the library</button>';
|
|
47
|
+
}
|
|
48
|
+
return h ? `<div class="sup" role="group" aria-label="Change this">${h}<button type="button" class="lk stdone" data-st="chip|${p}">Done</button></div>` : '';
|
|
49
|
+
}
|
|
50
|
+
const W = 96, H = 30;
|
|
51
|
+
function spark(c) {
|
|
52
|
+
if (!c) return '<span class="stlic" aria-hidden="true"></span>';
|
|
53
|
+
const d = c.pts.map((p, i) => (i ? 'L' : 'M') + (2 + p.fx * (W - 4)).toFixed(1) + ',' + (2 + (1 - p.fy) * (H - 4)).toFixed(1)).join('');
|
|
54
|
+
return `<svg class="spk" viewBox="0 0 ${W} ${H}" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
55
|
+
}
|
|
56
|
+
function libHtml() {
|
|
57
|
+
if (!st.lib) return '';
|
|
58
|
+
const d = st.d, L = measures(), S = savedDash().filter((x) => x.id !== d.id);
|
|
59
|
+
const rows = L.map((m) => { const on = d.charts.includes(m.id), c = chartOf(m.id); return `<button type="button" class="stli" data-st="libc|${esc(m.id)}"${on ? ' disabled' : ''}>${spark(c)}<span><b>${esc(m.title)}</b><small>${esc(c ? c.sub : 'No series yet')}</small></span><em>${on ? 'Added' : 'Add'}</em></button>`; }).join('');
|
|
60
|
+
const dl = S.map((x) => `<button type="button" class="stli" data-st="libd|${esc(x.id)}"><span class="stlic">${DSI}</span><span><b>${esc(x.name)}</b><small>${plural(x.charts.length, 'chart', 'charts')}</small></span><em>Add its charts</em></button>`).join('');
|
|
61
|
+
return `<div class="stlib" role="region" aria-label="Library of ${esc(P.M.board.name || 'this board')}"><div class="stlh"><b>Library</b><small>${esc(P.M.board.name || '')}</small><button type="button" class="lk" data-st="lib">Close</button></div>`
|
|
62
|
+
+ `<p class="label">Measures · ${L.length}</p>${L.length ? `<div class="stlg">${rows}</div>` : '<p class="note">No KR metric is recorded for this workspace.</p>'}`
|
|
63
|
+
+ (dl ? `<p class="label">Dashboards · ${S.length}</p><div class="stlg">${dl}</div>` : '') + '</div>';
|
|
64
|
+
}
|
|
65
|
+
function previewHtml() {
|
|
66
|
+
const d = st.d, L = d.charts.map(chartOf).filter(Boolean), gone = d.charts.filter((id) => !chartOf(id));
|
|
67
|
+
return `<div class="stpvw"><h3 class="ndt">${esc(d.name || 'Untitled dashboard')}${d.main ? '<span class="npin2">Main dashboard</span>' : ''}</h3><p class="mut stuse">${esc(d.use || 'No purpose yet.')}</p>`
|
|
68
|
+
+ (L.length ? `<div class="ngrid">${L.map((c) => `<div class="ntw">${P.tile(c)}</div>`).join('')}</div>` : '<p class="note">No chart is drawn yet. Add a measure with a series.</p>')
|
|
69
|
+
+ (gone.length ? `<p class="label ngl">Not drawn · ${gone.length}</p>${gone.map((id) => `<p class="note stgone"><b>${esc(titleOf(id))}</b> has fewer than two readings, so it has no chart.</p>`).join('')}` : '') + '</div>';
|
|
70
|
+
}
|
|
71
|
+
/* The six checks of the mockup, computed from the draft. A fix is an action the Studio can take in one press. */
|
|
72
|
+
function checks() {
|
|
73
|
+
const d = st.d, dup = d.charts.length - new Set(d.charts).size, other = savedDash().some((x) => x.main && x.id !== d.id);
|
|
74
|
+
return [
|
|
75
|
+
{ ok: !!d.name.trim(), l: 'It has a name', d: d.name.trim() || 'Give it a name.', fix: ['Name it', 'chip|name'] },
|
|
76
|
+
{ ok: !!d.use.trim(), l: 'It says what routine it serves', d: d.use.trim() || 'A dashboard without a purpose collects charts.', fix: ['Say the purpose', 'chip|use'] },
|
|
77
|
+
{ ok: d.charts.length > 0, l: 'It has a chart', d: plural(d.charts.length, 'chart', 'charts') + '.', fix: ['Open the library', 'lib'] },
|
|
78
|
+
{ ok: d.charts.length <= 6, l: 'Six charts or fewer', d: d.charts.length > 6 ? d.charts.length + ' charts. Past six, readers stop looking at each one.' : 'The count is easy to scan.', fix: ['Choose which to keep', 'chip|charts'] },
|
|
79
|
+
{ ok: !dup, l: 'No measure appears twice', d: dup ? plural(dup, 'measure is', 'measures are') + ' drawn twice.' : 'Each measure appears once.', fix: ['Take out the repeats', 'dedup'] },
|
|
80
|
+
{ ok: d.main || other, l: 'The board has a main dashboard', d: d.main || other ? 'One dashboard opens first.' : 'No dashboard opens first on this board.', fix: ['Make it the main one', 'set|main|1'] },
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
function checksHtml() {
|
|
84
|
+
const L = checks(), bad = L.filter((x) => !x.ok), n = L.length - bad.length;
|
|
85
|
+
return `<div class="suck${bad.length ? ' bad' : ''}"><button type="button" class="suckb" data-st="ck" aria-expanded="${st.ck}">${bad.length ? WRN : OKI}<b>${n} of ${L.length} checks pass</b>${bad.length && !st.ck ? `<span>${esc(bad[0].d)}</span>` : ''}${CHV}</button>`
|
|
86
|
+
+ `<div class="mprog stbar" role="progressbar" aria-label="Checks passing" aria-valuemin="0" aria-valuemax="${L.length}" aria-valuenow="${n}" data-n="${n}"><b></b></div>`
|
|
87
|
+
+ (st.ck ? `<ul class="sucl">${L.map((x, i) => `<li class="${x.ok ? 'ok' : 'bad'}">${x.ok ? OKI : WRN}<span><b>${esc(x.l)}</b><small>${esc(x.d)}</small></span>${!x.ok && x.fix ? `<button type="button" class="dmcta alt" data-st="fix|${i}">${esc(x.fix[0])}</button>` : ''}</li>`).join('')}</ul>` : '') + '</div>';
|
|
88
|
+
}
|
|
89
|
+
function footHtml() {
|
|
90
|
+
const saved = !!st.d.id;
|
|
91
|
+
return `<div class="stft"><button type="button" class="dmcta alt" data-st="undo"${st.h.length ? '' : ' disabled'}>Undo</button>${saved ? `<button type="button" class="dmcta alt" data-st="del">${st.armed ? 'Press again to remove it' : 'Remove the dashboard'}</button>` : ''}<span class="sp"></span><button type="button" class="dmcta alt" data-st="cancel">Cancel</button><button type="button" class="dmcta" data-st="save"${st.busy ? ' disabled' : ''}>${saved ? 'Save changes' : 'Save the dashboard'}</button></div>`;
|
|
92
|
+
}
|
|
93
|
+
const guide = () => 'A dashboard answers one routine. Give it a purpose and keep it to six charts or fewer.' + (st.d.id ? ' <button type="button" class="lk" data-st="new">Start a new one instead</button>' : '');
|
|
94
|
+
function canvasHtml() {
|
|
95
|
+
return `<div class="stu"><div class="stt"><span class="stx"><button type="button" class="lk" data-st="lib" aria-expanded="${st.lib}">Library</button></span></div><p class="stsug" id="stG">${guide()}</p><div id="stBr">${briefHtml()}</div><div id="stTr">${trayHtml()}</div><div id="stLb">${libHtml()}</div><div id="stPv">${previewHtml()}</div><div id="stCk">${checksHtml()}</div><p class="note stmsg" id="stMsg" role="status"></p><div id="stFt">${footHtml()}</div></div>`;
|
|
96
|
+
}
|
|
97
|
+
function draw(parts) {
|
|
98
|
+
const all = !parts, set = (id, h) => { const e = $('#' + id); if (e) e.innerHTML = h; };
|
|
99
|
+
if (all || parts.includes('g')) set('stG', guide());
|
|
100
|
+
if (all || parts.includes('br')) set('stBr', briefHtml());
|
|
101
|
+
if (all || parts.includes('tr')) set('stTr', trayHtml());
|
|
102
|
+
if (all || parts.includes('lb')) set('stLb', libHtml());
|
|
103
|
+
if (all || parts.includes('pv')) set('stPv', previewHtml());
|
|
104
|
+
if (all || parts.includes('ck')) set('stCk', checksHtml());
|
|
105
|
+
if (all || parts.includes('ft')) set('stFt', footHtml());
|
|
106
|
+
const m = $('#stMsg'); if (m) m.textContent = st.msg;
|
|
107
|
+
const l = $('.stu [data-st="lib"]'); if (l) l.setAttribute('aria-expanded', st.lib);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* ── doing things ── */
|
|
111
|
+
function act(a) {
|
|
112
|
+
const [k, x, y] = a; st.msg = '';
|
|
113
|
+
if (k !== 'del') st.armed = false;
|
|
114
|
+
if (k === 'chip') { st.pop = st.pop === x ? null : x; draw(['br', 'tr', 'ft']); const i = $('#stI'); if (i) { i.focus(); try { i.setSelectionRange(i.value.length, i.value.length); } catch { /* no caret */ } } return; }
|
|
115
|
+
if (k === 'lib') { st.lib = !st.lib; draw(['lb', 'tr', 'ft']); return; }
|
|
116
|
+
if (k === 'ck') { st.ck = !st.ck; draw(['ck']); return; }
|
|
117
|
+
if (k === 'fix') { const f = checks()[+x]; if (f && f.fix) act(f.fix[1].split('|')); return; }
|
|
118
|
+
if (k === 'undo') { if (undo()) { st.pop = null; draw(); } return; }
|
|
119
|
+
if (k === 'cancel') { closeDlg(); return; }
|
|
120
|
+
if (k === 'save') { save(); return; }
|
|
121
|
+
if (k === 'del') { remove(); return; }
|
|
122
|
+
if (k === 'new') { snap(); st.d = blank(); st.pop = null; draw(); return; }
|
|
123
|
+
if (k === 'set' && x === 'main') { snap(); st.d.main = y === '1'; st.pop = null; draw(); return; }
|
|
124
|
+
if (k === 'dedup') { snap(); st.d.charts = st.d.charts.filter((id, i) => st.d.charts.indexOf(id) === i); draw(); return; }
|
|
125
|
+
if (k === 'mv') { const i = +x, j = i + +y, c = st.d.charts; if (j < 0 || j >= c.length) return; snap(); [c[i], c[j]] = [c[j], c[i]]; draw(); const b = $(`#stTr [data-st="mv|${j}|${y}"]`) || $(`#stTr [data-st="mv|${j}|${-y}"]`); if (b) b.focus(); return; }
|
|
126
|
+
if (k === 'rm') { snap(); st.d.charts.splice(+x, 1); draw(); return; }
|
|
127
|
+
if (k === 'libc') { if (st.d.charts.includes(x)) return; snap(); st.d.charts.push(x); draw(); return; }
|
|
128
|
+
if (k === 'libd') { const D = savedDash().find((q) => q.id === x); if (!D) return; snap(); D.charts.forEach((id) => { if (!st.d.charts.includes(id)) st.d.charts.push(id); }); draw(); }
|
|
129
|
+
}
|
|
130
|
+
let typed = false; // one undo step per text field edit, not per key
|
|
131
|
+
function onInput(e) {
|
|
132
|
+
const f = e.target.dataset && e.target.dataset.stf; if (!f) return;
|
|
133
|
+
if (!typed) { snap(); typed = true; }
|
|
134
|
+
st.d[f] = e.target.value; st.msg = ''; draw(['g', 'br', 'pv', 'ck', 'ft']);
|
|
135
|
+
}
|
|
136
|
+
async function save() {
|
|
137
|
+
const d = st.d, name = d.name.trim(), use = d.use.trim();
|
|
138
|
+
if (!name) { st.msg = 'Give the dashboard a name.'; draw(['ft']); return; }
|
|
139
|
+
if (!use) { st.msg = 'Say what the dashboard is for, in one line.'; draw(['ft']); return; }
|
|
140
|
+
st.busy = true; st.msg = 'Saving.'; draw(['ft']);
|
|
141
|
+
const res = await P.save({ id: d.id || undefined, name, purpose: use, charts: d.charts, main: d.main });
|
|
142
|
+
st.busy = false;
|
|
143
|
+
if (!res || res.ok !== true) { st.msg = (res && res.error) || 'The dashboard could not be saved.'; draw(['ft']); return; }
|
|
144
|
+
closeDlg(); toast('Dashboard "' + name + '" saved in the workspace\'s state folder.'); P.done(res.dashboard ? res.dashboard.id : d.id);
|
|
145
|
+
}
|
|
146
|
+
async function remove() {
|
|
147
|
+
if (!st.armed) { st.armed = true; st.msg = 'Removing takes the dashboard off this board. The measures and their records stay.'; draw(['ft']); return; }
|
|
148
|
+
st.busy = true; draw(['ft']);
|
|
149
|
+
const res = await P.save({ id: st.d.id, remove: true });
|
|
150
|
+
st.busy = false;
|
|
151
|
+
if (!res || res.ok !== true) { st.armed = false; st.msg = (res && res.error) || 'The dashboard could not be removed.'; draw(['ft']); return; }
|
|
152
|
+
closeDlg(); toast('Dashboard removed. The line is saved in the workspace\'s state folder.'); P.done(null);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* ── the conversation: the phrases the Studio understands. A turn changes the draft only; it writes nothing and starts no agent. ── */
|
|
156
|
+
const HELP = 'I understand: add or remove a measure by its name, move a measure up, down or first, call it something, it is for something, make it the main dashboard (or not), undo, and start a new one.';
|
|
157
|
+
const clean = (s) => s.trim().replace(/^["']|["']$/g, '').replace(/[.\s]+$/, '').trim();
|
|
158
|
+
function hits(low) { return measures().map((m) => ({ m, i: low.indexOf(m.title.toLowerCase()) })).filter((x) => x.i >= 0 && x.m.title).sort((a, b) => a.i - b.i || b.m.title.length - a.m.title.length); }
|
|
159
|
+
function command(text) {
|
|
160
|
+
const t = text.trim(), low = t.toLowerCase(), d = st.d, said = [];
|
|
161
|
+
if (/^undo\b/.test(low)) return undo() ? (st.pop = null, 'Done: one step undone.') : 'I changed nothing. There is nothing to undo.';
|
|
162
|
+
if (/\b(start (a )?new|new dashboard|start over)\b/.test(low)) { snap(); st.d = blank(); return 'Done: a new, empty dashboard. Name it and say what it is for.'; }
|
|
163
|
+
const before = JSON.stringify(d); snap();
|
|
164
|
+
const nm = t.match(/(?:call it|name it|rename it to|rename it|called|named)\s+(.+?)(?=,|;|\s+and\s+(?:it|make|add|remove|for)\b|$)/i);
|
|
165
|
+
if (nm && clean(nm[1])) { d.name = clean(nm[1]).slice(0, 60); said.push('named it "' + d.name + '"'); }
|
|
166
|
+
const us = t.match(/(?:(?:it is|it's|its purpose is|purpose is|purpose:|use it)\s+for|purpose[:\s]+)\s*(.+?)(?=;|$)/i);
|
|
167
|
+
if (us && clean(us[1])) { d.use = clean(us[1]).slice(0, 200); said.push('the purpose is "' + d.use + '"'); }
|
|
168
|
+
if (/\b(not|no longer|don't make it|do not make it)\b[^.]*\bmain\b/.test(low)) { if (d.main) { d.main = false; said.push('it is not the main dashboard'); } }
|
|
169
|
+
else if (/\bmain\b/.test(low) && /\b(make|set|mark|as)\b/.test(low)) { if (!d.main) { d.main = true; said.push('it is the main dashboard'); } }
|
|
170
|
+
const H = hits(low), verbs = H.reduce((v, x) => v.split(x.m.title.toLowerCase()).join(' '), low); // the verbs, read with the measures' names taken out ("Time to first call" is not "first")
|
|
171
|
+
if (H.length && /\b(remove|take off|take out|drop|delete|without)\b/.test(verbs)) {
|
|
172
|
+
H.forEach(({ m }) => { const i = d.charts.indexOf(m.id); if (i >= 0) { d.charts.splice(i, 1); said.push('removed ' + m.title); } });
|
|
173
|
+
} else if (H.length && /\b(move|put|first|top|up|down|last|bottom)\b/.test(verbs)) {
|
|
174
|
+
const m = H[0].m, i = d.charts.indexOf(m.id);
|
|
175
|
+
if (i >= 0) {
|
|
176
|
+
const j = /\b(first|top)\b/.test(verbs) ? 0 : /\b(last|bottom)\b/.test(verbs) ? d.charts.length - 1 : /\bup\b/.test(verbs) ? Math.max(0, i - 1) : Math.min(d.charts.length - 1, i + 1);
|
|
177
|
+
if (j !== i) { d.charts.splice(i, 1); d.charts.splice(j, 0, m.id); said.push('moved ' + m.title + ' to place ' + (j + 1)); }
|
|
178
|
+
}
|
|
179
|
+
} else if (H.length && /\b(add|include|show|put in|with)\b/.test(verbs)) {
|
|
180
|
+
H.forEach(({ m }) => { if (!d.charts.includes(m.id)) { d.charts.push(m.id); said.push('added ' + m.title + (chartOf(m.id) ? '' : ' (it has no series yet, so it is listed, not drawn)')); } });
|
|
181
|
+
}
|
|
182
|
+
if (JSON.stringify(d) === before) { st.h.pop(); return 'I changed nothing. ' + (H.length || !/\b(add|remove)\b/.test(low) ? HELP : 'No measure of this board has that name. Open the Library to see them.'); }
|
|
183
|
+
st.pop = null;
|
|
184
|
+
return 'Done: ' + said.join(', ') + '.';
|
|
185
|
+
}
|
|
186
|
+
function onSay(e) {
|
|
187
|
+
e.preventDefault(); e.stopPropagation();
|
|
188
|
+
const inp = $('#stIn'), text = inp.value.trim(); if (!text) return;
|
|
189
|
+
inp.value = ''; const answer = command(text);
|
|
190
|
+
const s = $('#dBody .stream'); if (s) { s.insertAdjacentHTML('beforeend', turnU(text) + turnA(ptx(answer))); s.scrollTop = s.scrollHeight; }
|
|
191
|
+
draw();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ── opening ── */
|
|
195
|
+
export function openStudio(p) {
|
|
196
|
+
P = p; typed = false;
|
|
197
|
+
const D = p.D;
|
|
198
|
+
st = { d: D ? { id: D.id, name: D.name, use: D.purpose || '', charts: D.charts.slice(), main: !!D.main } : blank(), h: [], pop: null, lib: !D, ck: false, msg: '', armed: false, busy: false };
|
|
199
|
+
const board = p.M.board.name || 'this board';
|
|
200
|
+
const say = D ? 'This is "' + D.name + '". Tell me what to change: measures to add or remove, a new purpose, or make it the main dashboard. Nothing is saved until you press Save.'
|
|
201
|
+
: 'Name the dashboard and say what it is for. Then add measures from the library, or tell me which. Nothing is saved until you press Save.';
|
|
202
|
+
openDlg({ eye: 'Insight Studio · ' + board, title: 'Insight Studio', sub: 'Make a dashboard from ' + board + '. Say it, or use the brief.', stream: turnA(ptx(say)), noteKey: null, pane: canvasHtml(), label: 'Dashboard' });
|
|
203
|
+
$('#dlg').classList.add('stud');
|
|
204
|
+
$('#askF').hidden = true; const an = $('#askNote'); if (an) an.hidden = true;
|
|
205
|
+
$('#dBody').insertAdjacentHTML('beforeend', `<form class="askbar" id="stF"><input id="stIn" placeholder="Say what to change" maxlength="400" autocomplete="off" aria-label="Say what to change in the dashboard"><button type="submit" aria-label="Send" title="Send">${ICO('<path d="M5 12h14M13 6l6 6-6 6"/>')}</button></form><p class="fine2">${esc(HELP)} Nothing is saved until you press Save.</p>`);
|
|
206
|
+
$('#stF').onsubmit = onSay;
|
|
207
|
+
if (innerWidth >= 1000) setFull(true);
|
|
208
|
+
draw();
|
|
209
|
+
}
|
|
210
|
+
/* The Studio's presses. The dialog is shared, so each listener first asks whether the Studio is what it holds. */
|
|
211
|
+
const inStudio = (e) => $('#dlg').classList.contains('stud') && $('#dlg').classList.contains('on') && e.target.closest('#oMain');
|
|
212
|
+
document.addEventListener('click', (e) => { if (!inStudio(e)) return; const t = e.target.closest('[data-st]'); if (t && !t.disabled) act(t.dataset.st.split('|')); });
|
|
213
|
+
document.addEventListener('input', (e) => { if (inStudio(e)) onInput(e); });
|
|
214
|
+
document.addEventListener('focusout', (e) => { if (e.target && e.target.id === 'stI') typed = false; });
|
|
215
|
+
document.addEventListener('keydown', (e) => { if (e.key === 'Enter' && e.target.id === 'stI' && inStudio(e)) { e.preventDefault(); st.pop = null; typed = false; draw(['br', 'tr']); } });
|
|
216
|
+
/* Another dialog of the page opens without the Studio's class. */
|
|
217
|
+
new MutationObserver(() => { const d = $('#dlg'); if (d && !d.classList.contains('on') && d.classList.contains('stud')) d.classList.remove('stud'); }).observe($('#dlg'), { attributes: true, attributeFilter: ['class'] });
|
|
@@ -826,6 +826,77 @@ a.round{color:inherit;text-decoration:none}
|
|
|
826
826
|
.addf .cact{display:flex;flex-wrap:wrap;gap:10px}.addf .note[role="status"]{margin:0;min-height:1.2em}
|
|
827
827
|
@media (max-width:760px){.inirw>.ini2{padding-right:48px}.baiact .dmcta,.lifeb .dmcta,.baa .dmcta{height:44px}.baa .baact .dmcta{flex:1;justify-content:center}.bapl button{min-height:44px}}
|
|
828
828
|
|
|
829
|
+
/* ── Insight Studio (initiative premium-studio-dashboard): the mockup's Dashboard mode; brief, tray, library, preview, checks and footer ── */
|
|
830
|
+
#dlg.stud .p-out .obody{padding-bottom:0}
|
|
831
|
+
.stu{display:grid;gap:12px;min-width:0}
|
|
832
|
+
.stt{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap}
|
|
833
|
+
#dlg.stud #askF,#dlg.stud #askNote{display:none}
|
|
834
|
+
.stx{display:flex;align-items:center;gap:12px}
|
|
835
|
+
.stx .lk,.stlh .lk,.stdone{min-height:44px;padding:0 10px;font-size:13px}
|
|
836
|
+
.stsug{margin:0;font-size:13.5px;color:var(--ink-2);line-height:1.5;padding:0 2px}
|
|
837
|
+
.stbr{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px}
|
|
838
|
+
.suc{display:grid;gap:2px;align-content:center;min-height:52px;padding:8px 12px;border-radius:14px;background:var(--well);box-shadow:inset 0 0 0 1px var(--hair);max-width:100%;text-align:left;transition:background .2s}
|
|
839
|
+
.suc em{font-style:normal;font-size:11px;font-weight:600;color:var(--ink-3);white-space:nowrap}
|
|
840
|
+
.suc b{font-size:14px;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
|
|
841
|
+
.suc.on{background:var(--solid);color:var(--on-solid)}
|
|
842
|
+
.suc.on em{color:color-mix(in oklab,var(--on-solid) 70%,transparent)}
|
|
843
|
+
.suc.req{box-shadow:inset 0 0 0 1.5px color-mix(in oklab,var(--ember) 60%,transparent)}
|
|
844
|
+
.sup{padding:14px;border-radius:18px;background:var(--well);display:grid;gap:10px}
|
|
845
|
+
.stdone{justify-self:end}
|
|
846
|
+
.sol{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:8px}
|
|
847
|
+
.sto{display:grid;gap:2px;text-align:left;padding:10px 12px;border-radius:14px;background:var(--card-solid);box-shadow:inset 0 0 0 1px var(--hair);align-content:start;min-height:44px}
|
|
848
|
+
.sto b{font-size:13.5px}
|
|
849
|
+
.sto small{font-size:12px;color:var(--ink-3);line-height:1.35}
|
|
850
|
+
.sto[aria-pressed="true"]{box-shadow:inset 0 0 0 2px var(--ink)}
|
|
851
|
+
.sti{width:100%;height:44px;border-radius:12px;border:1px solid var(--hair);background:var(--card-solid);padding:0 12px;font:inherit;font-size:14px;color:var(--ink)}
|
|
852
|
+
.sti:focus{outline:2px solid var(--ember);outline-offset:1px}
|
|
853
|
+
.sul{list-style:none;margin:0;padding:0;display:grid;gap:6px}
|
|
854
|
+
.sul li{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 12px;border-radius:12px;background:var(--card-solid)}
|
|
855
|
+
.sul small{display:block;color:var(--ink-3);font-size:12px}
|
|
856
|
+
.stlc{display:flex;gap:4px;flex:none}
|
|
857
|
+
.stlc button{min-width:44px;height:44px;border-radius:10px;background:var(--well);display:grid;place-items:center;padding:0 10px}
|
|
858
|
+
.stlc svg{width:15px;height:15px}
|
|
859
|
+
.stlc button:disabled{opacity:.35}
|
|
860
|
+
.stlib{padding:14px;border-radius:18px;background:var(--well)}
|
|
861
|
+
.stlh{display:flex;align-items:center;gap:10px}
|
|
862
|
+
.stlh small{color:var(--ink-3);margin-right:auto}
|
|
863
|
+
.stlib .label{margin:10px 0 0}
|
|
864
|
+
.stlg{display:grid;gap:6px;margin-top:6px}
|
|
865
|
+
.stli{display:grid;grid-template-columns:96px minmax(0,1fr) auto;gap:12px;align-items:center;text-align:left;padding:8px 12px;border-radius:12px;background:var(--card-solid);min-height:44px}
|
|
866
|
+
.stli .spk{width:96px;height:30px}
|
|
867
|
+
.stli .spk path{fill:none;stroke:var(--ink-2);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
|
|
868
|
+
.stli b{font-size:13.5px}
|
|
869
|
+
.stli small{display:block;color:var(--ink-3);font-size:12px}
|
|
870
|
+
.stli em{font-style:normal;font-size:12.5px;font-weight:650;color:var(--ink-2)}
|
|
871
|
+
.stli:disabled{opacity:.5}
|
|
872
|
+
.stlic{display:grid;place-items:center;width:96px}
|
|
873
|
+
.stlic svg{width:22px;height:22px;color:var(--ink-3)}
|
|
874
|
+
.stpvw{padding:16px;border-radius:18px;background:var(--card-solid);box-shadow:inset 0 0 0 1px var(--hair);min-width:0}
|
|
875
|
+
.stpvw .ndt{margin:0;font-size:18px;font-weight:650;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
|
|
876
|
+
.stpvw .npin2{font-size:11.5px;font-weight:650;padding:3px 9px;border-radius:999px;background:var(--well);color:var(--ink-2)}
|
|
877
|
+
.stpvw .stuse{margin:4px 0 10px;font-size:13.5px}
|
|
878
|
+
.stgone{margin:4px 0 0}
|
|
879
|
+
.suck{border-radius:16px;background:var(--well);overflow:hidden}
|
|
880
|
+
.suckb{display:flex;align-items:center;gap:10px;width:100%;min-height:48px;padding:10px 14px;text-align:left}
|
|
881
|
+
.suckb svg{width:18px;height:18px;flex:none}
|
|
882
|
+
.suckb b{font-size:13.5px;white-space:nowrap}
|
|
883
|
+
.suckb span{font-size:12.5px;color:var(--ink-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}
|
|
884
|
+
.suckb svg:last-child{margin-left:auto;transition:transform .2s}
|
|
885
|
+
.suckb[aria-expanded="true"] svg:last-child{transform:rotate(180deg)}
|
|
886
|
+
.suck.bad .suckb>svg:first-child{color:var(--ember-ink)}
|
|
887
|
+
.stbar{margin:0 14px 12px;width:auto}
|
|
888
|
+
.stbar b{width:0}.stbar[data-n="1"] b{width:16.67%}.stbar[data-n="2"] b{width:33.33%}.stbar[data-n="3"] b{width:50.0%}.stbar[data-n="4"] b{width:66.67%}.stbar[data-n="5"] b{width:83.33%}.stbar[data-n="6"] b{width:100.0%}
|
|
889
|
+
.sucl{list-style:none;margin:0;padding:0 14px 12px;display:grid;gap:8px}
|
|
890
|
+
.sucl li{display:grid;grid-template-columns:18px minmax(0,1fr) auto;gap:10px;align-items:center}
|
|
891
|
+
.sucl li svg{width:16px;height:16px}
|
|
892
|
+
.sucl li.bad svg{color:var(--ember-ink)}
|
|
893
|
+
.sucl b{font-size:13px;display:block}
|
|
894
|
+
.sucl small{font-size:12px;color:var(--ink-3)}
|
|
895
|
+
.stmsg{min-height:1.2em;margin:0;color:var(--ember-ink)}
|
|
896
|
+
.stft{display:flex;gap:8px;align-items:center;flex-wrap:wrap;position:sticky;bottom:0;padding:10px 0 12px;background:linear-gradient(to top,var(--card-solid) 70%,transparent)}
|
|
897
|
+
.stft .sp{flex:1}
|
|
898
|
+
.stft .dmcta{height:44px}
|
|
899
|
+
@media (max-width:700px){.sol{grid-template-columns:minmax(0,1fr)}.stli{grid-template-columns:72px minmax(0,1fr)}.stli .spk,.stlic{width:72px}.stli em{grid-column:2}.stt{gap:8px}.sucl li{grid-template-columns:18px minmax(0,1fr)}.sucl li .dmcta{grid-column:2;justify-self:start}}
|
|
829
900
|
/* ── initiative page (initiative briefing-premium-initiative) ── */
|
|
830
901
|
.ckr.current i{background:var(--ember)}
|
|
831
902
|
.ckr.done i{background:var(--ok)}
|
|
@@ -1300,6 +1371,31 @@ button.dsn:hover{box-shadow:inset 0 0 0 1.5px rgb(79,109,245)}
|
|
|
1300
1371
|
.top:has(#iH1) .tools-top{flex-basis:100%;justify-content:flex-start}
|
|
1301
1372
|
#cIniChk .ckr small{overflow-wrap:anywhere}
|
|
1302
1373
|
|
|
1374
|
+
/* search and the bell in the header (initiative premium-search-bell); the look is the mockup's overlays ov-pal and ov-bell */
|
|
1375
|
+
.pv-hp{position:relative}
|
|
1376
|
+
.pv-bdg{position:absolute;top:-4px;right:-4px;min-width:20px;height:20px;padding:0 5px;border-radius:999px;display:grid;place-items:center;background:var(--ember);color:rgb(255,255,255);font:700 11.5px var(--mono)}
|
|
1377
|
+
.pv-bdg[hidden]{display:none}
|
|
1378
|
+
.pv-scrim{position:fixed;inset:0;z-index:44;background:rgba(30,34,60,.34);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);opacity:0;pointer-events:none;transition:opacity .3s}
|
|
1379
|
+
.pv-scrim.on{opacity:1;pointer-events:auto}
|
|
1380
|
+
.pv-ov{position:fixed;z-index:45;left:50%;top:12vh;transform:translateX(-50%);width:min(640px,calc(100% - 32px));max-height:72vh;overflow:auto;overscroll-behavior:contain;background:var(--card-solid);border:1px solid var(--hair);border-radius:var(--r-card);box-shadow:var(--card-shadow);padding:14px}
|
|
1381
|
+
.pv-ov[hidden]{display:none}
|
|
1382
|
+
.pv-ov.bell{left:auto;right:max(16px,calc((100vw - 1360px)/2 + 16px));top:96px;transform:none;width:min(420px,calc(100% - 32px))}
|
|
1383
|
+
.pv-pin{display:flex;align-items:center;gap:12px;height:56px;padding:0 16px;border-radius:999px;background:var(--well)}
|
|
1384
|
+
.pv-pin input{flex:1;min-width:0;height:100%;border:0;background:transparent;color:var(--ink);font:inherit;font-size:16px;outline:0}
|
|
1385
|
+
.pv-pin kbd{font:600 11.5px var(--mono);color:var(--ink-3);border:1px solid var(--b3);border-radius:8px;padding:2px 6px}
|
|
1386
|
+
.pv-grp{font:600 var(--t-micro) var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3);padding:18px 14px 6px}
|
|
1387
|
+
.pv-lst{display:grid;gap:2px;margin-top:8px}
|
|
1388
|
+
.pv-row{display:grid;grid-template-columns:40px minmax(0,1fr);gap:14px;align-items:center;width:100%;min-height:56px;padding:8px 14px;border-radius:var(--r-in);text-align:left}
|
|
1389
|
+
.pv-row:hover,.pv-row[aria-selected="true"],.pv-row:focus-visible{background:var(--well)}
|
|
1390
|
+
.pv-row .gl{width:40px;height:40px;border-radius:14px;display:grid;place-items:center;background:var(--well);color:var(--ink-2)}
|
|
1391
|
+
.pv-row b{display:block;font-weight:620;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1392
|
+
.pv-row small{display:block;color:var(--ink-3);font-size:var(--t-small);margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
1393
|
+
.pv-lst .pv-row .gl{background:var(--spot);color:var(--ember-ink)}
|
|
1394
|
+
.pv-hd{display:flex;align-items:baseline;gap:10px;padding:8px 6px 4px}.pv-hd h2{margin:0;font-size:18px}.pv-hd small{color:var(--ink-3);font:600 12px var(--mono)}
|
|
1395
|
+
.pv-note{margin:0;padding:10px 14px 4px;color:var(--ink-3);font-size:var(--t-small)}
|
|
1396
|
+
@media (max-width:700px){.pv-ov{top:8vh}.pv-ov.bell{right:16px}}
|
|
1397
|
+
.pv-row .gl svg{width:20px;height:20px}
|
|
1398
|
+
@media (max-width:700px){.top .tools{position:relative}.pkw{position:static}.pkmenu{left:0;right:0;min-width:0}}
|
|
1303
1399
|
/* Settings dialog rows (initiative premium-settings) */
|
|
1304
1400
|
.sr{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:8px 0;border-bottom:1px solid var(--hair)}
|
|
1305
1401
|
.sr .sn{display:grid;gap:2px;min-width:0}.sr .sn b{font-size:15px}.sr .sn em{font-style:normal;font-size:12.5px;color:var(--ink-3);overflow-wrap:anywhere}
|
|
@@ -1370,3 +1466,38 @@ button.dsn:hover{box-shadow:inset 0 0 0 1.5px rgb(79,109,245)}
|
|
|
1370
1466
|
.dsiss .dsa{display:flex;gap:8px;flex-wrap:wrap}
|
|
1371
1467
|
.dsiss.dsok{background:color-mix(in oklab,var(--ok) 12%,transparent)}
|
|
1372
1468
|
.dsiss.dsok svg{color:var(--ok)}
|
|
1469
|
+
|
|
1470
|
+
/* slice 3 of briefing-premium-calendar: recording, Focus, Replay and the chip. Cut from the mockup (version 63: .recchip, .cons, .fh, .trk2, .fnow, .tp, .out3, .rctl, .kps, .ln) and renamed m3- so no earlier rule meets them. */
|
|
1471
|
+
.recchip{position:fixed;z-index:30;left:max(16px,env(safe-area-inset-left,0px));bottom:max(16px,env(safe-area-inset-bottom,0px));display:flex;align-items:center;flex-wrap:wrap;gap:12px;max-width:min(560px,calc(100vw - 32px));padding:8px 8px 8px 16px;border-radius:var(--r-chip);font-size:var(--t-small);font-weight:600}
|
|
1472
|
+
.recchip[hidden]{display:none}.recchip i{width:9px;height:9px;border-radius:50%;background:var(--bad);animation:br 1.6s ease-in-out infinite}.recchip i.paused{background:var(--ember);animation:none}
|
|
1473
|
+
.recchip span{min-width:0;overflow-wrap:anywhere}
|
|
1474
|
+
.recchip button{min-height:44px;padding:0 13px;border-radius:var(--r-chip);background:var(--well);font-weight:650;font-size:var(--t-small)}.recchip button:last-child{background:var(--solid);color:var(--on-solid)}
|
|
1475
|
+
@media (max-width:999px){.recchip{bottom:calc(max(12px,env(safe-area-inset-bottom,0px)) + 84px)}}
|
|
1476
|
+
.m3-mark{display:inline-flex;align-items:center;gap:6px;margin-left:8px;font-style:normal;font-size:var(--t-small);font-weight:650;color:var(--bad)}.m3-mark::before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor}.m3-mark.m3-paused{color:var(--ember-ink)}
|
|
1477
|
+
.m3-acts{margin:16px 0 4px;display:grid;gap:8px}.m3-acts .note{margin:0}
|
|
1478
|
+
.m3-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.m3-row b{font-size:var(--t-body)}
|
|
1479
|
+
.m3-dot{width:9px;height:9px;border-radius:50%;background:var(--bad);animation:br 1.6s ease-in-out infinite}
|
|
1480
|
+
.m3-msg{margin:0}
|
|
1481
|
+
.m3-cons{padding:16px 18px;border-radius:var(--r-in);background:color-mix(in oklab,var(--ember) 14%,transparent);display:grid;gap:12px}.m3-cons p{margin:0}.m3-cons div{display:flex;gap:8px;flex-wrap:wrap}
|
|
1482
|
+
.m3-fh{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:14px}.m3-fti{display:grid;flex:1;min-width:0}.m3-fti b{font-size:var(--t-body)}
|
|
1483
|
+
.m3-trk{position:relative;display:flex;gap:3px;height:30px;margin:8px 0}
|
|
1484
|
+
.m3-stc{display:grid;place-items:center;border-radius:8px;background:var(--b3);font:600 var(--t-micro) var(--mono);color:var(--ink-2);min-width:18px;min-height:30px;transition:background .25s}
|
|
1485
|
+
button.m3-stc{min-height:44px;margin:-7px 0}button.m3-stc:hover{background:var(--b2)}.m3-stc.on{background:var(--solid);color:var(--on-solid)}
|
|
1486
|
+
.m3-mk{position:absolute;top:-5px;width:9px;height:9px;border-radius:50%;margin-left:-4px;background:var(--ink-3);box-shadow:0 0 0 2px var(--card);pointer-events:none}.m3-mk.decision{background:var(--ok)}.m3-mk.action{background:var(--ember)}.m3-mk.question{background:var(--ink)}
|
|
1487
|
+
.m3-ph{position:absolute;top:-3px;bottom:-3px;width:2px;margin-left:-1px;background:var(--bad);border-radius:8px;pointer-events:none}
|
|
1488
|
+
.m3-lgd{display:flex;gap:16px;flex-wrap:wrap;margin-top:10px;font-size:var(--t-small);color:var(--ink-2)}.m3-lgd i{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:6px}.m3-lgd .decision{background:var(--ok)}.m3-lgd .action{background:var(--ember)}.m3-lgd .question{background:var(--ink)}
|
|
1489
|
+
.m3-now{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:16px 0 6px;padding:12px 16px;border-radius:14px;box-shadow:inset 0 0 0 1.5px var(--b3)}.m3-now .label{margin:0}.m3-now b{font-size:var(--t-body)}.m3-now .mtg-b,.m3-now .note{margin-left:auto}
|
|
1490
|
+
.m3-chg{display:flex;gap:8px;flex-wrap:wrap;margin:6px 0 8px}.m3-chg .note{flex-basis:100%;margin:0}.m3-chg .mtg-b[aria-pressed="true"]{background:var(--solid);color:var(--on-solid)}
|
|
1491
|
+
.mtg .m3-say{margin:8px 0;font-size:var(--t-body);color:var(--ink)}
|
|
1492
|
+
.m3-chips{display:flex;gap:6px;flex-wrap:wrap;margin:6px 0}.m3-chp{display:inline-flex;flex-direction:column;padding:6px 12px;border-radius:14px;background:var(--well);font-size:var(--t-small);font-weight:600}.m3-chp small{font-weight:500;color:var(--ink-3)}
|
|
1493
|
+
.m3-ftr{display:grid;gap:8px;margin:8px 0 4px}.m3-ftr p{margin:0;font-size:var(--t-body);color:var(--ink-3);line-height:1.5}.m3-ftr p.cur{color:var(--ink)}.m3-ftr p b{color:var(--ink-2);font-weight:650;margin-right:4px}
|
|
1494
|
+
.m3-tops{display:grid}.m3-tp{display:grid;grid-template-columns:26px minmax(0,1fr) auto;gap:10px;align-items:center;padding:8px 0;border-top:1px solid var(--hair);font-size:var(--t-body)}.m3-tp:first-child{border-top:0}
|
|
1495
|
+
.m3-tp i{width:24px;height:24px;border-radius:50%;display:grid;place-items:center;font:600 var(--t-micro) var(--mono);font-style:normal;box-shadow:inset 0 0 0 1.8px var(--ink-3);color:var(--ink-3)}
|
|
1496
|
+
.m3-tp.now i{background:var(--solid);color:var(--on-solid);box-shadow:none}.m3-tp.now{font-weight:650}.m3-tp.done i{background:var(--ok);color:var(--on-solid);box-shadow:none}.m3-tp.done span{color:var(--ink-3)}.m3-tp small{color:var(--ink-3);font-size:var(--t-small)}
|
|
1497
|
+
.m3-cap{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:6px 0 10px}.m3-cap div{background:var(--well);border-radius:14px;padding:12px 14px;display:grid;gap:2px}.m3-cap b{font:600 20px var(--mono)}.m3-cap span{font-size:var(--t-small);color:var(--ink-3)}
|
|
1498
|
+
.m3-rctl .seg2 .mtg-b{min-width:44px;justify-content:center}.m3-rctl{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px}.m3-pos{margin-left:auto;font-family:var(--mono)}
|
|
1499
|
+
.m3-kps{display:grid}.m3-kps button,.m3-kp0{display:grid;grid-template-columns:86px minmax(0,1fr) auto;gap:10px;align-items:center;text-align:left;padding:9px 6px;border-top:1px solid var(--hair);font-size:var(--t-body);border-radius:8px;min-height:44px}.m3-kps>:first-child{border-top:0}
|
|
1500
|
+
.m3-kps button:hover{background:var(--well)}.m3-kps time,.m3-kp0 em{font:500 var(--t-small) var(--mono);color:var(--ink-3);font-style:normal}.m3-kps .kd{font-size:var(--t-small);color:var(--ink-3)}
|
|
1501
|
+
.m3-ln{display:grid;grid-template-columns:44px 56px minmax(0,1fr);gap:10px;text-align:left;padding:8px 10px;border-radius:14px;font-size:var(--t-body);color:var(--ink-2);line-height:1.45;min-height:44px}.m3-ln time{font:500 var(--t-small) var(--mono);color:var(--ink-3)}.m3-ln b{color:var(--ink)}.m3-ln:hover{background:var(--well)}.m3-ln.cur{background:var(--well);color:var(--ink)}
|
|
1502
|
+
.m3-shot{margin:8px 0;display:grid;gap:6px}.m3-shot img{max-width:100%;border-radius:14px;border:1px solid var(--hair)}.m3-shot figcaption{margin:0}
|
|
1503
|
+
@media (max-width:1000px){.m3-cap{grid-template-columns:1fr}.m3-kps button,.m3-kp0{grid-template-columns:70px minmax(0,1fr)}.m3-kps time,.m3-kp0 em{display:none}.m3-ln{grid-template-columns:40px 48px minmax(0,1fr)}}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Slice 3: the reply box asks a read-only agent. A control with nothing honest to write stays disabled and says why. */
|
|
5
5
|
import { pmPost, pmGet } from './http.js';
|
|
6
6
|
import { mountMeeting } from './premium-meeting.js';
|
|
7
|
-
import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail } from './premium-shell.js';
|
|
7
|
+
import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail, pvFeed } from './premium-shell.js';
|
|
8
8
|
const ICON = {
|
|
9
9
|
meeting: '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>',
|
|
10
10
|
merge: '<circle cx="6" cy="6" r="2"/><circle cx="6" cy="18" r="2"/><circle cx="18" cy="9" r="2"/><path d="M6 8v8M18 11c0 4-6 3-12 5"/>',
|
|
@@ -81,6 +81,7 @@ function drawTl() {
|
|
|
81
81
|
$('#todayCap').textContent = `${early.length} earlier · ${ahead.length} ahead`;
|
|
82
82
|
$('#tl').innerHTML = `<div class="grp">Ahead</div>${ahead.length ? ahead.map((e) => evHtml(e, all.indexOf(e))).join('') : '<div class="empty">Nothing ahead in these sources.</div>'}<div class="nowl">${esc(T.now.t)} · ${esc(T.now.label)}</div><div class="grp" style="padding-top:6px">Earlier today</div><div class="early">${early.length ? early.map((e) => evHtml(e, all.indexOf(e))).join('') : `<div class="empty">${esc(T.note || 'Nothing yet in these sources.')}</div>`}</div>`;
|
|
83
83
|
$$('#tl .ev').forEach((x, i) => { x.tabIndex = i ? -1 : 0; });
|
|
84
|
+
week.mark((i) => ALL()[i]);
|
|
84
85
|
const next = ahead[0];
|
|
85
86
|
$('#dNext').innerHTML = next ? `<i></i>Next <b>${esc(next.t)}</b> ${esc(next.title)}` : (M.header.missing.includes('calendar') ? 'Calendar not read' : 'Nothing more today');
|
|
86
87
|
}
|
|
@@ -259,6 +260,7 @@ async function load() {
|
|
|
259
260
|
const ws = new URLSearchParams(location.search).get('ws');
|
|
260
261
|
try { const res = await fetch('/api/briefing-premium' + (ws ? '?ws=' + encodeURIComponent(ws) : ''), { credentials: 'same-origin' }); status = res.status; r = await res.json(); } catch { r = null; }
|
|
261
262
|
clearInterval(readTimer);
|
|
263
|
+
pvFeed(r);
|
|
262
264
|
if (r && r.state === 'reading') {
|
|
263
265
|
// the first read has no end I can promise: say how long it has run, and ask again
|
|
264
266
|
const t0 = Date.now() - (r.elapsed_ms || 0), tick = () => { $('#brief').textContent = 'Reading the products for the first time. ' + Math.round((Date.now() - t0) / 1000) + ' s so far. This page shows nothing until it has read, rather than guess.'; };
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"briefing-premium-doc-edit.test.js",
|
|
48
48
|
"briefing-premium-calendar.test.js",
|
|
49
49
|
"briefing-premium-calendar-2.test.js",
|
|
50
|
+
"briefing-premium-calendar-3.test.js",
|
|
50
51
|
"briefing-premium-products.test.js",
|
|
51
52
|
"briefing-premium-sources.test.js",
|
|
52
53
|
"briefing-premium-metrics.test.js",
|
|
@@ -215,6 +216,7 @@
|
|
|
215
216
|
"briefing-premium-doc-edit.test.js": 1,
|
|
216
217
|
"briefing-premium-calendar.test.js": 1,
|
|
217
218
|
"briefing-premium-calendar-2.test.js": 1,
|
|
219
|
+
"briefing-premium-calendar-3.test.js": 1,
|
|
218
220
|
"briefing-premium-products.test.js": 1,
|
|
219
221
|
"briefing-premium-sources.test.js": 1,
|
|
220
222
|
"briefing-premium-metrics.test.js": 1,
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"briefing-premium-doc-edit-test.js",
|
|
11
11
|
"briefing-premium-calendar-test.js",
|
|
12
12
|
"briefing-premium-calendar-2-test.js",
|
|
13
|
+
"briefing-premium-calendar-3-test.js",
|
|
13
14
|
"briefing-premium-products-test.js",
|
|
14
15
|
"briefing-premium-sources-test.js",
|
|
15
16
|
"briefing-premium-metrics-test.js",
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
"briefing-premium-doc-edit-test.js": 90,
|
|
26
27
|
"briefing-premium-calendar-test.js": 90,
|
|
27
28
|
"briefing-premium-calendar-2-test.js": 90,
|
|
29
|
+
"briefing-premium-calendar-3-test.js": 120,
|
|
28
30
|
"briefing-premium-products-test.js": 90,
|
|
29
31
|
"briefing-premium-sources-test.js": 90,
|
|
30
32
|
"briefing-premium-metrics-test.js": 120,
|