create-pmos 0.785.0 → 0.787.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 +68 -27
- 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/changelog.json +67 -0
- package/workspace/guide/cli.md +11 -0
- package/workspace/guide/home.md +5 -2
- package/workspace/guide/jira.md +8 -0
- package/workspace/guide/settings-and-switches.md +1 -1
- package/workspace/lib/features.json +31 -0
- package/workspace/lib/jev-command.js +88 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/quiet-cli.js +81 -0
- package/workspace/lib/quiet-sweep.js +228 -0
- package/workspace/lib/routes-backlog.js +21 -1
- package/workspace/lib/routes-slash.js +57 -14
- package/workspace/lib/routes-your-move.js +39 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/action-keys.js +5 -1
- package/workspace/public/pm/bd-sprint.js +29 -1
- package/workspace/public/pm/cozy-home.css +2 -0
- package/workspace/public/pm/cozy-jl.js +6 -2
- package/workspace/public/pm/cozy-nav.js +4 -2
- package/workspace/public/pm/feature-match.js +77 -0
- package/workspace/public/pm/features-dir.js +83 -0
- package/workspace/public/pm/goal-chat.js +10 -7
- package/workspace/public/pm/home-app.js +9 -1
- package/workspace/public/pm/home-chat.js +49 -7
- package/workspace/public/pm/live-feed.js +1 -0
- package/workspace/public/pm/palette-all.js +12 -3
- package/workspace/public/pm/premium-shell.js +6 -3
- package/workspace/public/pm/premium-vw-features.css +17 -0
- package/workspace/public/pm/premium-vw-open.js +2 -1
- package/workspace/public/pm/premium-vw-page.js +2 -1
- package/workspace/public/pm/quiet-view.js +107 -0
- package/workspace/test-lists/feature-directory.json +9 -0
- package/workspace/test-lists/quiet-sweep.json +9 -0
|
@@ -312,10 +312,12 @@ export function mountNav(here, doc = document, opts = {}) {
|
|
|
312
312
|
doc.addEventListener('pointerover', note, { capture: true, passive: true });
|
|
313
313
|
doc.addEventListener('focusin', note, true);
|
|
314
314
|
const chat = () => { if (N.rail && typeof window.czOpenChat === 'function') window.czOpenChat(); else if (opts.chat) opts.chat(); else import('./page-chat.js').then((M) => M.openCos({ here: opts.where ? opts.where() : PLACES.find((p) => p.key === here) ? PLACES.find((p) => p.key === here).label : '' })); };
|
|
315
|
+
let feats = null; // feature-directory: the user features, read once, so Ctrl+K finds a feature by name
|
|
315
316
|
function search() {
|
|
316
317
|
const item = lastAt && lastAt.isConnected ? lastAt : null;
|
|
317
|
-
Promise.
|
|
318
|
-
|
|
318
|
+
const fr = feats ? Promise.resolve(feats) : import('./http.js').then((H) => H.pmGet('/api/features')).then((r) => (feats = r && r.ok ? r.features : [])).catch(() => []);
|
|
319
|
+
Promise.all([import('./cozy-search.js'), import('./palette-all.js'), fr]).then(([M, P, features]) => M.openSearch({ ...(opts.search ? { go: opts.search() } : {}),
|
|
320
|
+
scope: P.withEverything(opts.scope ? opts.scope() : null, { places: PLACES, here, item, doc, ws: wsParam(), wsq: wsQ, chat, setTheme: (k) => setTheme(k, doc), features }) }));
|
|
319
321
|
}
|
|
320
322
|
const read = async () => {
|
|
321
323
|
if (doc.hidden) return;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/* pm/feature-match.js — one list of features behind every door (initiative feature-directory, done test F3, F4, F6).
|
|
2
|
+
*
|
|
3
|
+
* PURE: no DOM, no fetch, so Node tests it. The list is GET /api/features (lib/features.json, user rows only); the chat's / menu
|
|
4
|
+
* gets the same rows as commands from GET /api/slash-commands.
|
|
5
|
+
*
|
|
6
|
+
* hereOf(pathname) the menu's page key for a path ('home', 'board', …) or ''
|
|
7
|
+
* ranked(cmds, here) PMOS commands for this page first, then the other PMOS ones, then the rest; each with grp
|
|
8
|
+
* match(text, cmds, here) the one command plain words ask for, or null. Local and instant: every word of one of the
|
|
9
|
+
* command's phrases is in the text (a word matches its own start, so "slips" matches "slip").
|
|
10
|
+
* expand(text, cmds) a sent "/why lendly" becomes a prompt that runs `pmos why` on "lendly"; any other text is unchanged
|
|
11
|
+
* hintOf(text, cmds) after a command is picked: { cmd, hint, name } while only its arguments are being typed, else null
|
|
12
|
+
* groupsOf(feats, groups, seen) the directory: [{ label, rows }]. seen = the feature ids this browser already listed, or null on a
|
|
13
|
+
* first visit; "New since you last looked" comes first only when a row is not in seen (zero is silence) */
|
|
14
|
+
|
|
15
|
+
const words = (s) => String(s || '').toLowerCase().replace(/[’']/g, '').split(/[^a-z0-9]+/).filter(Boolean);
|
|
16
|
+
const same = (want, have) => have === want || (want.length >= 4 && have.startsWith(want)) || (have.length >= 4 && want.startsWith(have));
|
|
17
|
+
|
|
18
|
+
const HERE = [['/today.html', 'home'], ['/premium.html', 'home'], ['/premium-board.html', 'board'], ['/premium-goals.html', 'insights'],
|
|
19
|
+
['/premium-events.html', 'events'], ['/premium-library.html', 'library'], ['/premium-routine.html', 'routine']];
|
|
20
|
+
export function hereOf(pathname) { const p = String(pathname || ''); const hit = HERE.find(([a]) => p.endsWith(a)); return hit ? hit[1] : ''; }
|
|
21
|
+
|
|
22
|
+
export function ranked(cmds, here = '') {
|
|
23
|
+
const list = Array.isArray(cmds) ? cmds : [];
|
|
24
|
+
const pm = list.filter((x) => x && x.src === 'pmos'), rest = list.filter((x) => x && x.src !== 'pmos');
|
|
25
|
+
const mine = here ? pm.filter((x) => x.place === here) : [];
|
|
26
|
+
const any = pm.filter((x) => !mine.includes(x));
|
|
27
|
+
return [...mine.map((x) => ({ ...x, grp: 'For this page' })), ...any.map((x) => ({ ...x, grp: mine.length ? 'Anywhere' : 'PMOS' })),
|
|
28
|
+
...rest.map((x) => ({ ...x, grp: 'Session' }))];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The best command for plain words, or null. Text starting with / is a command already; under 3 words is too little to guess. */
|
|
32
|
+
export function match(text, cmds, here = '') {
|
|
33
|
+
const t = String(text || '').trim();
|
|
34
|
+
if (!t || t.startsWith('/')) return null;
|
|
35
|
+
const have = words(t);
|
|
36
|
+
if (have.length < 3) return null;
|
|
37
|
+
let best = null;
|
|
38
|
+
for (const c of Array.isArray(cmds) ? cmds : []) {
|
|
39
|
+
if (!c || c.src !== 'pmos' || !Array.isArray(c.phrases)) continue;
|
|
40
|
+
for (const ph of c.phrases) {
|
|
41
|
+
const want = words(ph);
|
|
42
|
+
if (!want.length || !want.every((w) => have.some((h) => same(w, h)))) continue;
|
|
43
|
+
const score = want.length * 10 + (here && c.place === here ? 5 : 0);
|
|
44
|
+
if (!best || score > best.score) best = { score, c };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return best && best.score >= 20 ? best.c : null; // a one-word phrase alone ("glossary") needs the page to back it
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The prompt a sent PMOS command becomes. The words stay first, so the chat shows what the PM typed. */
|
|
51
|
+
export function expand(text, cmds) {
|
|
52
|
+
const t = String(text || '').trim();
|
|
53
|
+
const m = /^(\/[a-z0-9-]+)(?:\s+([\s\S]*))?$/i.exec(t);
|
|
54
|
+
if (!m) return t;
|
|
55
|
+
const c = (Array.isArray(cmds) ? cmds : []).find((x) => x && x.src === 'pmos' && x.verb && x.cmd === m[1].toLowerCase());
|
|
56
|
+
if (!c) return t;
|
|
57
|
+
const args = (m[2] || '').trim();
|
|
58
|
+
const run = 'pmos ' + c.verb + (c.sub ? ' ' + c.sub : '');
|
|
59
|
+
return `${t}\n\n(${c.name}: run \`${run}\`${args ? ' for "' + args.replace(/"/g, "'") + '"' : ''} in this repository, pass its arguments as its help asks, and answer from what it prints, in plain words.)`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function hintOf(text, cmds) {
|
|
63
|
+
const m = /^(\/[a-z0-9-]+)\s+(\S*)$/i.exec(String(text || ''));
|
|
64
|
+
if (!m) return null;
|
|
65
|
+
const c = (Array.isArray(cmds) ? cmds : []).find((x) => x && x.src === 'pmos' && x.cmd === m[1].toLowerCase());
|
|
66
|
+
return c && c.hint ? { cmd: c.cmd, hint: c.hint, name: c.name } : null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function groupsOf(feats, groups, seen) {
|
|
70
|
+
const rows = (Array.isArray(feats) ? feats : []).filter((f) => f && f.audience === 'user');
|
|
71
|
+
const known = Array.isArray(seen) ? new Set(seen) : null;
|
|
72
|
+
const fresh = known ? rows.filter((f) => !known.has(f.id)) : [];
|
|
73
|
+
const out = fresh.length ? [{ label: 'New since you last looked', fresh: true, rows: fresh }] : [];
|
|
74
|
+
const order = Array.isArray(groups) && groups.length ? groups : [...new Set(rows.map((f) => f.group))];
|
|
75
|
+
for (const g of order) { const r = rows.filter((f) => f.group === g && !fresh.includes(f)); if (r.length) out.push({ label: g, rows: r }); }
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* pm/features-dir.js — "What PMOS can do": every user feature in the Viewer (initiative feature-directory, board FdA, done test F6).
|
|
2
|
+
*
|
|
3
|
+
* One registry (GET /api/features, lib/features.json) grouped by job. "New since you last looked" leads only when this browser has
|
|
4
|
+
* listed the directory before and a feature is new to it (zero is silence); the ids it has listed are one localStorage key, no text.
|
|
5
|
+
* Each row says how to reach its feature: its command (a press puts it in the page's chat box), its page, or its keys. The keys
|
|
6
|
+
* themselves live in the ? sheet (pm/action-keys.js); this page links to it instead of listing them again.
|
|
7
|
+
* Never says Claude. Each open and each press is noted on this computer only (pm/use-log.js): features-open, features-cmd, features-page.
|
|
8
|
+
*
|
|
9
|
+
* openFeatures() open the page in the Viewer
|
|
10
|
+
* dirHtml(data, seen, places) PURE markup for { groups, features } */
|
|
11
|
+
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
12
|
+
import { groupsOf } from './feature-match.js';
|
|
13
|
+
import { pmGet } from './http.js';
|
|
14
|
+
import { noteUse } from './use-log.js';
|
|
15
|
+
|
|
16
|
+
const SEEN = 'pmos.features.seen';
|
|
17
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
18
|
+
const PAGES = { home: ['Today', '/today.html'], board: ['Work', '/premium-board.html'], insights: ['Goals', '/premium-goals.html'], events: ['Events', '/premium-events.html'], library: ['Library', '/premium-library.html'], routine: ['Routine', '/premium-routine.html'] };
|
|
19
|
+
const store = { get() { try { const v = JSON.parse(localStorage.getItem(SEEN) || 'null'); return Array.isArray(v) ? v : null; } catch { return null; } },
|
|
20
|
+
set(ids) { try { localStorage.setItem(SEEN, JSON.stringify(ids)); } catch { /* no storage: nothing is ever new */ } } };
|
|
21
|
+
|
|
22
|
+
function howHtml(f) {
|
|
23
|
+
const out = [];
|
|
24
|
+
if (f.cmd) out.push(`<button type="button" class="fd-ch" data-fd-cmd="${esc(f.cmd)}" title="Put ${esc(f.cmd)} in the chat box"><code>${esc(f.cmd)}</code></button>`);
|
|
25
|
+
if (f.place && PAGES[f.place]) out.push(`<a class="fd-ch" href="${PAGES[f.place][1]}" data-fd-page="${esc(f.place)}">${esc(PAGES[f.place][0])}</a>`);
|
|
26
|
+
if (f.keys === '?') out.push('<button type="button" class="fd-ch" data-fd-keys title="Show the keys">?</button>');
|
|
27
|
+
else if (f.keys) out.push(`<span class="fd-ch">${f.keys.split(' ').map((k) => `<kbd>${esc(k)}</kbd>`).join('')}</span>`);
|
|
28
|
+
if (f.action === 'guide') out.push('<button type="button" class="fd-ch" data-fd-guide>Open</button>');
|
|
29
|
+
return out.join('');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function dirHtml(data, seen) {
|
|
33
|
+
const groups = groupsOf((data && data.features) || [], data && data.groups, seen);
|
|
34
|
+
if (!groups.length) return '<div class="vwdoc fd"><p class="vwmut">No features to show.</p></div>';
|
|
35
|
+
return '<div class="vwdoc fd"><div class="fd-find"><input type="search" data-fd-find placeholder="Find a feature" aria-label="Find a feature" autocomplete="off"></div>'
|
|
36
|
+
+ groups.map((g) => `<section class="fd-grp${g.fresh ? ' fresh' : ''}" aria-label="${esc(g.label)}"><h3>${g.fresh ? '<i class="fd-dot" aria-hidden="true"></i>' : ''}${esc(g.label)}</h3>`
|
|
37
|
+
+ g.rows.map((f) => `<div class="fd-row" data-fd-t="${esc((f.name + ' ' + f.say + ' ' + (f.cmd || '')).toLowerCase())}"><div class="tx"><b>${esc(f.name)}</b><span>${esc(f.say)}</span></div><div class="fd-how">${howHtml(f)}</div></div>`).join('')
|
|
38
|
+
+ '</section>').join('')
|
|
39
|
+
+ '<p class="vwmut fd-none" data-fd-none hidden>No feature matches.</p></div>';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function putInChat(cmd) {
|
|
43
|
+
const box = document.querySelector('#hmIn, #askIn');
|
|
44
|
+
if (box) { box.value = cmd + ' '; box.dispatchEvent(new Event('input', { bubbles: true })); box.focus(); return true; }
|
|
45
|
+
try { navigator.clipboard.writeText(cmd + ' '); } catch { /* no clipboard */ }
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let clicks = false;
|
|
50
|
+
function wire(el) {
|
|
51
|
+
if (el.__fd) return; el.__fd = true;
|
|
52
|
+
el.addEventListener('input', (e) => {
|
|
53
|
+
if (!e.target.matches('[data-fd-find]')) return;
|
|
54
|
+
const q = e.target.value.trim().toLowerCase(); let any = false;
|
|
55
|
+
el.querySelectorAll('.fd-grp').forEach((g) => { let n = 0; g.querySelectorAll('.fd-row').forEach((r) => { const hit = !q || r.dataset.fdT.includes(q); r.hidden = !hit; if (hit) n++; }); g.hidden = !n; if (n) any = true; });
|
|
56
|
+
const none = el.querySelector('[data-fd-none]'); if (none) none.hidden = any;
|
|
57
|
+
});
|
|
58
|
+
if (clicks) return; clicks = true;
|
|
59
|
+
// the chips are real buttons and links; their clicks are delegated from the document, scoped to the directory
|
|
60
|
+
document.addEventListener('click', (e) => {
|
|
61
|
+
if (!e.target.closest || !e.target.closest('.fd')) return;
|
|
62
|
+
const c = e.target.closest('[data-fd-cmd]'); if (c) { noteUse('features-cmd'); if (!putInChat(c.dataset.fdCmd)) c.title = 'Copied: paste it in the chat'; return; }
|
|
63
|
+
if (e.target.closest('[data-fd-page]')) { noteUse('features-page'); return; }
|
|
64
|
+
if (e.target.closest('[data-fd-keys]')) { document.dispatchEvent(new KeyboardEvent('keydown', { key: '?', bubbles: true })); return; }
|
|
65
|
+
if (e.target.closest('[data-fd-guide]')) import('./premium-vw-open.js').then((M) => M.openGuide('index')).catch(() => {});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function openFeatures() {
|
|
70
|
+
vwStyle('doc'); vwStyle('features');
|
|
71
|
+
noteUse('features-open');
|
|
72
|
+
let done = null;
|
|
73
|
+
const pane = vwOpen({ id: 'features', kind: 'Guide', title: 'What PMOS can do', icon: 'doc', url: '/premium-viewer.html?open=features',
|
|
74
|
+
render: (el) => { el.innerHTML = done || '<div class="vwdoc"><p class="vwmut" role="status">Reading the features.</p></div>'; wire(el); } });
|
|
75
|
+
pmGet('/api/features').then((d) => {
|
|
76
|
+
const seen = store.get();
|
|
77
|
+
done = d && d.ok ? dirHtml(d, seen) : '<div class="vwdoc"><p class="vwmut">The features could not be read.</p></div>';
|
|
78
|
+
if (d && d.ok) store.set([...new Set([...(seen || []), ...d.features.map((f) => f.id)])]);
|
|
79
|
+
const el = document.querySelector('.obody.vw[data-vw="features"]') || pane;
|
|
80
|
+
if (el && el.isConnected) { el.innerHTML = done; wire(el); }
|
|
81
|
+
}).catch(() => {});
|
|
82
|
+
return pane;
|
|
83
|
+
}
|
|
@@ -3,20 +3,23 @@
|
|
|
3
3
|
* splits that block off the words and draws the goal before Start (XcbOptions B, row 1): the method line with Change, a row of dots (one per
|
|
4
4
|
* point the method needs), the question with tap answers, and the ready plan as a card in the chat with Start, Change and Cancel as icons,
|
|
5
5
|
* which Change turns into an editor in place. It also shows the PM's PMOS-typed turns as typed. */
|
|
6
|
+
import { ranked } from './feature-match.js';
|
|
6
7
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
7
8
|
|
|
8
|
-
/** The `/` menu (G1): PMOS's
|
|
9
|
+
/** The `/` menu (G1): PMOS's commands, then the session's own. Until GET /api/slash-commands answers, and when it cannot, these. */
|
|
9
10
|
export const SLASH = [
|
|
10
|
-
{ cmd: '/goal', name: 'Give PMOS a goal', say: 'It picks a way to ask about the goal, asks a few questions, then works on it after you press Start.' },
|
|
11
|
-
{ cmd: '/compact', name: 'Compact the conversation', say: '
|
|
12
|
-
{ cmd: '/clear', name: 'Clear the conversation', say: '
|
|
11
|
+
{ cmd: '/goal', name: 'Give PMOS a goal', say: 'It picks a way to ask about the goal, asks a few questions, then works on it after you press Start.', src: 'pmos' },
|
|
12
|
+
{ cmd: '/compact', name: 'Compact the conversation', say: 'Summarise the conversation so far to free room.', src: 'claude' },
|
|
13
|
+
{ cmd: '/clear', name: 'Clear the conversation', say: 'Start again with an empty context in the same session.', src: 'claude' },
|
|
13
14
|
];
|
|
14
|
-
/* every command
|
|
15
|
-
* until it answers, and when it cannot, the three above */
|
|
15
|
+
/* every command the session takes (GET /api/slash-commands: PMOS's from lib/features.json, the session's own, the workspace's and the
|
|
16
|
+
* PM's commands and skills), read once; until it answers, and when it cannot, the three above */
|
|
16
17
|
let ALL = null;
|
|
17
18
|
export function loadSlash(get) { if (ALL || !get) return Promise.resolve(ALL); return get('/api/slash-commands').then((r) => { if (r && r.ok && Array.isArray(r.commands) && r.commands.length) ALL = r.commands; return ALL; }).catch(() => null); }
|
|
19
|
+
/** Every command known now, for the typed-words suggestion and the send (pm/feature-match.js). */
|
|
20
|
+
export const slashList = () => ALL || SLASH;
|
|
18
21
|
/** The menu items for what is in the box, or [] when the menu stays shut (no leading `/`, or a space typed). */
|
|
19
|
-
export const slashMatches = (v) => (/^\/[a-z0-9:_.-]*$/i.test(String(v || '')) ? (ALL || SLASH).filter((x) => x.cmd.toLowerCase().startsWith(String(v).toLowerCase())) : []);
|
|
22
|
+
export const slashMatches = (v, here = '') => (/^\/[a-z0-9:_.-]*$/i.test(String(v || '')) ? ranked(ALL || SLASH, here).filter((x) => x.cmd.toLowerCase().startsWith(String(v).toLowerCase())) : []);
|
|
20
23
|
|
|
21
24
|
/** { text, block }: the words with the last `pmos-goal` block taken out, and that block parsed (null when there is none or it does not parse). */
|
|
22
25
|
export function splitGoal(text) {
|
|
@@ -448,6 +448,8 @@ function rankIn() {
|
|
|
448
448
|
for (const l of S.lab || []) extra.push({ key: 'lab:' + l.ws, go: 'lab', ws: l.ws, board: l.board, title: l.n + (l.n === 1 ? ' Lab finding' : ' Lab findings') + ' to keep or drop', sub: l.say || 'Keep one to start an initiative, or let it go.' });
|
|
449
449
|
// weekly-what-moved (A441): last week's date and scope moves of every product, one row until the PM opens the list (pm/moves-view.js)
|
|
450
450
|
if (S.movesRow) extra.push(S.movesRow);
|
|
451
|
+
// quiet-work-sweep (A503): the initiatives quiet 30 days or more on every product, one row a week until the PM opens the list (pm/quiet-view.js)
|
|
452
|
+
if (S.quietRow) extra.push(S.quietRow);
|
|
451
453
|
// try-what-shipped: one row while the updates brought changes to try (beta only; GET /api/try says the row, pm/try-view.js opens the list)
|
|
452
454
|
if (S.tryRow) extra.push(S.tryRow);
|
|
453
455
|
return { products, programs: S.D.programs || [], move: S.move || {}, mentions: MEN.mentionsOf(S.D).waiting, outbox: S.outbox || [], gaps: (S.wait && S.wait.gaps) || [], extra };
|
|
@@ -476,12 +478,17 @@ async function readMove() {
|
|
|
476
478
|
S.moves = mv.filter((r) => r && r.ok);
|
|
477
479
|
const prevMoves = JSON.stringify(S.movesRow || null);
|
|
478
480
|
try { const MV = await import('./moves-view.js'); S.movesRow = MV.rowOf(S.moves, { looked: MV.lookedWeek() }); } catch { S.movesRow = null; }
|
|
481
|
+
// quiet-work-sweep (A503): each product's quiet initiatives (GET /api/quiet, from the cached line), folded into one Your move row
|
|
482
|
+
const qs = await Promise.all(L.map((ws) => pmGet('/api/quiet' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null)));
|
|
483
|
+
S.quiet = qs.filter((r) => r && r.ok);
|
|
484
|
+
const prevQuiet = JSON.stringify(S.quietRow || null);
|
|
485
|
+
try { const QV = await import('./quiet-view.js'); S.quietRow = QV.rowOf(S.quiet, { looked: QV.lookedWeek() }); } catch { S.quietRow = null; }
|
|
479
486
|
const prevTry = JSON.stringify(S.tryRow || null);
|
|
480
487
|
try { const TV = await import('./try-view.js'); S.tryRow = TV.rowOf(await pmGet('/api/try').catch(() => null)); } catch { S.tryRow = null; }
|
|
481
488
|
const ob = await pmGet('/api/outbox').catch(() => null);
|
|
482
489
|
const outbox = ob && ob.ok && Array.isArray(ob.entries) ? ob.entries.filter((e) => e && (e.state === 'queued' || e.state === 'blocked')) : [];
|
|
483
490
|
const lab = labs.filter(Boolean);
|
|
484
|
-
const same = JSON.stringify(next) === JSON.stringify(S.move || null) && JSON.stringify(outbox) === JSON.stringify(S.outbox || []) && JSON.stringify(lab) === JSON.stringify(S.lab || []) && prevMoves === JSON.stringify(S.movesRow || null) && prevTry === JSON.stringify(S.tryRow || null);
|
|
491
|
+
const same = JSON.stringify(next) === JSON.stringify(S.move || null) && JSON.stringify(outbox) === JSON.stringify(S.outbox || []) && JSON.stringify(lab) === JSON.stringify(S.lab || []) && prevMoves === JSON.stringify(S.movesRow || null) && prevQuiet === JSON.stringify(S.quietRow || null) && prevTry === JSON.stringify(S.tryRow || null);
|
|
485
492
|
S.move = next; S.outbox = outbox; S.lab = lab;
|
|
486
493
|
if (!same) { redrawLater(); drawList(); }
|
|
487
494
|
// a demotion notice is said once: drawn now, then marked seen so the next read leaves it out
|
|
@@ -519,6 +526,7 @@ async function movePress(b) {
|
|
|
519
526
|
if (r.go === 'impact') { S.day = false; S.sel = 'impact'; if (isPhone()) S.phoneChat = true; openTarget(homeTarget()); drawList(); return; }
|
|
520
527
|
if (r.go === 'loose') { VW.drill(); LPV.open(lpHost); return; }
|
|
521
528
|
if (r.go === 'moves') { VW.drill(); import('./moves-view.js').then((MV) => { MV.openMoves(S.moves || [], { toast }); S.movesRow = null; drawList(); }); return; }
|
|
529
|
+
if (r.go === 'quiet') { VW.drill(); import('./quiet-view.js').then((QV) => { QV.openQuiet(S.quiet || [], { pmPost, toast, toastUndo }); S.quietRow = null; drawList(); }); return; }
|
|
522
530
|
if (r.go === 'try') { VW.drill(); import('./try-view.js').then((TV) => TV.openTry({ toast, toastUndo, onChange: (l) => { S.tryRow = TV.rowOf({ ...l, ok: true, row: l.total ? { ...S.tryRow, title: l.total + (l.total === 1 ? ' new thing to try' : ' new things to try') } : null }); drawList(); } })); return; }
|
|
523
531
|
if (r.go === 'lab') { VW.drill(); import('./cozy-lab-ins.js').then((LB) => LB.openLab({ where: () => ({ ws: r.ws, board: r.board }), iniHref: (id) => '/premium-initiative.html?' + (r.ws ? 'ws=' + encodeURIComponent(r.ws) + '&' : '') + 'id=' + encodeURIComponent(id), toast: (m, undo) => (undo ? toastUndo(m, undo) : toast(m)) })); return; }
|
|
524
532
|
return;
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
* viewerClosed(), reopenViewer(), head(target), touch(sid) (the PM opened, typed in or answered that session: the Live pill) } */
|
|
25
25
|
import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
|
|
26
26
|
import { streamOf, roleOf, tintOf, hm } from './home-data.js';
|
|
27
|
-
import { splitGoal, shownUser, goalBlockHtml, goalViewHtml, goalNow, slashMatches, loadSlash } from './goal-chat.js';
|
|
27
|
+
import { splitGoal, shownUser, goalBlockHtml, goalViewHtml, goalNow, slashMatches, loadSlash, slashList } from './goal-chat.js';
|
|
28
|
+
import { hereOf, match as matchWords, expand as expandCmd, hintOf } from './feature-match.js'; // feature-directory: PMOS commands, typed words, the send
|
|
29
|
+
import { noteUse } from './use-log.js';
|
|
28
30
|
import { goalModel, sessionModel, lineHtml, viewHtml, dividerHtml, goalDivider } from './home-line.js';
|
|
29
31
|
import { goalUi } from './home-goal.js';
|
|
30
32
|
import { splitReport, reportChipHtml, blockSig } from './report-chat.js';
|
|
@@ -528,6 +530,9 @@ export function mountChat(el, host) {
|
|
|
528
530
|
async function send(text) {
|
|
529
531
|
const t = C.t; text = String(text || '').trim();
|
|
530
532
|
if (!t || (!text && !C.files.length) || C.sending) return false;
|
|
533
|
+
if (C.cmdSug && C.cmdSug.for.trim() === text) { noteUse('slash-suggest-skip'); C.cmdSug = null; } // sent as typed: the suggestion was not wanted
|
|
534
|
+
{ const cmd = /^\/[a-z0-9-]+/i.exec(text), own = cmd && slashList().find((x) => x.src === 'pmos' && x.cmd === cmd[0].toLowerCase()); if (own) noteUse('slash-pmos-' + own.cmd.slice(1)); }
|
|
535
|
+
text = expandCmd(text, slashList()); // a PMOS command runs its pmos verb (feature-directory F4); any other text is unchanged
|
|
531
536
|
if (t.key && C.files.some((f) => f.state === 'saving')) { host.toast('A file is still being saved. Send again in a moment.'); return false; }
|
|
532
537
|
// the canvas's marks go before the words (lib/live-round.js marksOf reads them), then they are used up
|
|
533
538
|
const mk = C.mark || {};
|
|
@@ -632,6 +637,7 @@ export function mountChat(el, host) {
|
|
|
632
637
|
send(d.chatSay); return;
|
|
633
638
|
}
|
|
634
639
|
if (d.slash) { pickSlash(d.slash); return; }
|
|
640
|
+
if (d.cmdSug) { takeSug(); return; }
|
|
635
641
|
if (d.askPick) {
|
|
636
642
|
const card = b.closest('.tc'), btn = card && card.querySelector('[data-ask-send]'), at = btn ? btn.dataset.askSend : null, ask = at != null && askOf(at); if (!ask) return;
|
|
637
643
|
const [q, k] = d.askPick.split(':').map(Number);
|
|
@@ -684,16 +690,17 @@ export function mountChat(el, host) {
|
|
|
684
690
|
if (e.key === 'Escape' && GU.escape()) { e.preventDefault(); e.stopPropagation(); return; }
|
|
685
691
|
if (e.target.id !== 'hmIn') { if (e.key === 'Escape' && running() && !document.querySelector('[data-esc-layer]') && !(window.czViewer && window.czViewer.isOpen())) press('esc'); return; }
|
|
686
692
|
if (e.isComposing || e.keyCode === 229) return;
|
|
687
|
-
const list =
|
|
693
|
+
const list = menuList(e.target.value), sm = el.querySelector('#hmSlash'), menu = list.length && sm && !sm.hidden;
|
|
688
694
|
if (menu && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); C.slashAt = (C.slashAt + (e.key === 'ArrowDown' ? 1 : list.length - 1)) % list.length; drawSlash(); return; }
|
|
689
695
|
if (menu && (e.key === 'Tab' || (e.key === 'Enter' && !e.shiftKey && e.target.value !== list[C.slashAt].cmd))) { e.preventDefault(); pickSlash(list[C.slashAt].cmd); return; }
|
|
696
|
+
if (!menu && e.key === 'Tab' && !e.shiftKey && sugNow(e.target.value)) { e.preventDefault(); takeSug(); return; }
|
|
690
697
|
if (menu && e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); e.target.value = ''; drawSlash(); grow(e.target); return; }
|
|
691
698
|
if (e.key === 'Enter' && !e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey) { e.preventDefault(); el.querySelector('#hmForm').requestSubmit(); }
|
|
692
699
|
});
|
|
693
700
|
el.addEventListener('input', (e) => {
|
|
694
701
|
const card = C.t && C.t.intro && C.t.intro.card;
|
|
695
702
|
if (card && card.input && e.target.closest('.hm-icard')) { card.input(e.target, e.target.closest('.hm-icard')); return; }
|
|
696
|
-
if (e.target.id === 'hmIn') { grow(e.target); C.slashAt = 0; drawSlash(); NPU.input(e.target.value); if (C.err) { C.err = ''; const er = foot.querySelector('.hm-senderr'); if (er) er.remove(); foot.__h = null; } }
|
|
703
|
+
if (e.target.id === 'hmIn') { grow(e.target); C.slashAt = 0; suggestFor(e.target.value); drawSlash(); NPU.input(e.target.value); if (C.err) { C.err = ''; const er = foot.querySelector('.hm-senderr'); if (er) er.remove(); foot.__h = null; } }
|
|
697
704
|
});
|
|
698
705
|
/* ── the mic ── dictation into the box only (HmMic). A desk shows the blue dot in the box; a phone shows the Speak to Claude sheet. */
|
|
699
706
|
const box = () => foot.querySelector('textarea');
|
|
@@ -731,18 +738,53 @@ export function mountChat(el, host) {
|
|
|
731
738
|
else { C.sendAfter = true; C.dict.stop(); }
|
|
732
739
|
sheetOf({ on: false });
|
|
733
740
|
}
|
|
734
|
-
/* the / menu: opens on a leading /, arrows move, Enter or Tab picks, Esc shuts it
|
|
741
|
+
/* the / menu: opens on a leading /, arrows move, Enter or Tab picks, Esc shuts it. PMOS's commands for this page come first, then
|
|
742
|
+
* the other PMOS ones; the session's own commands fold away on a bare / and show once a letter is typed (feature-directory).
|
|
743
|
+
* With a command picked, its arguments' hint stays above the box. Plain words that ask for a command get one suggestion; Tab takes it. */
|
|
744
|
+
const here = () => hereOf(location.pathname);
|
|
745
|
+
function menuList(v) { const l = slashMatches(v, here()); return v === '/' ? l.filter((x) => x.grp !== 'Session') : l; }
|
|
735
746
|
function drawSlash() {
|
|
736
747
|
const ta = foot.querySelector('textarea'); if (!ta) return;
|
|
737
748
|
let m = el.querySelector('#hmSlash');
|
|
738
|
-
const
|
|
739
|
-
if (!list.length) { if (m) { m.hidden = true; m.removeAttribute('data-esc-layer'); } return; }
|
|
749
|
+
const v = ta.value, list = menuList(v), hint = list.length ? null : hintOf(v, slashList()), sug = list.length || hint ? null : sugNow(v);
|
|
750
|
+
if (!list.length && !hint && !sug) { if (m) { m.hidden = true; m.removeAttribute('data-esc-layer'); } return; }
|
|
740
751
|
if (!m) { foot.insertAdjacentHTML('afterbegin', '<div class="hm-slash" id="hmSlash" role="listbox" aria-label="Commands"></div>'); m = el.querySelector('#hmSlash'); }
|
|
752
|
+
if (hint) { m.innerHTML = `<p class="hm-slhint"><code>${esc(hint.cmd)} ${esc(hint.hint)}</code><span>${esc(hint.name)}</span></p>`; m.hidden = false; m.removeAttribute('data-esc-layer'); return; }
|
|
753
|
+
if (sug) { m.innerHTML = `<button type="button" role="option" aria-selected="true" data-cmd-sug="1" title="Tab turns your words into this command"><span class="l1"><code>${esc(sug.cmd)}</code><b>${esc(sug.name)}</b></span><em>Tab turns your words into this command</em></button>`; m.hidden = false; m.removeAttribute('data-esc-layer'); return; }
|
|
741
754
|
C.slashAt = Math.min(C.slashAt, list.length - 1);
|
|
742
|
-
|
|
755
|
+
let grp = null;
|
|
756
|
+
const multi = new Set(list.map((x) => x.grp)).size > 1;
|
|
757
|
+
m.innerHTML = list.map((x, i) => { const head = multi && x.grp !== grp ? `<p class="hm-slgrp" role="presentation">${esc(x.grp)}</p>` : ''; grp = x.grp;
|
|
758
|
+
return head + `<button type="button" role="option" aria-selected="${i === C.slashAt}" data-slash="${esc(x.cmd)}"><span class="l1"><code>${esc(x.cmd)}</code>${x.name && x.name !== x.cmd.slice(1) ? `<b>${esc(x.name)}</b>` : ''}</span>${x.say ? `<em>${esc(x.say)}</em>` : ''}</button>`; }).join('')
|
|
759
|
+
+ (v === '/' ? '<p class="hm-slgrp" role="presentation">Session commands show as you type their name</p>' : '');
|
|
743
760
|
const on = m.querySelector('[aria-selected="true"]'); if (on && on.scrollIntoView) on.scrollIntoView({ block: 'nearest' });
|
|
744
761
|
m.hidden = false; m.setAttribute('data-esc-layer', '');
|
|
745
762
|
}
|
|
763
|
+
/* the typed-words suggestion: the local phrases first (instant, on this computer); only when they find nothing, and only when the PM
|
|
764
|
+
* switched "Suggest commands with Jev" on for this repository, one question to Jev a moment after typing stops (lib/jev-command.js) */
|
|
765
|
+
let sugT = null, jevOn = null;
|
|
766
|
+
const sugNow = (v) => (C.cmdSug && C.cmdSug.for === v ? C.cmdSug : null);
|
|
767
|
+
function suggestFor(v) {
|
|
768
|
+
clearTimeout(sugT);
|
|
769
|
+
const t = String(v || '');
|
|
770
|
+
const loc = matchWords(t, slashList(), here());
|
|
771
|
+
if (loc) { C.cmdSug = { ...loc, for: t, from: 'local' }; return; }
|
|
772
|
+
if (C.cmdSug && C.cmdSug.for !== t) C.cmdSug = null;
|
|
773
|
+
if (t.startsWith('/') || t.trim().split(/\s+/).length < 4 || !C.t || !C.t.ws) return;
|
|
774
|
+
sugT = setTimeout(async () => {
|
|
775
|
+
if (jevOn == null) { const f = await host.pmGet('/api/features?ws=' + encodeURIComponent(C.t.ws)).catch(() => null); jevOn = !!(f && f.ok && f.suggest); }
|
|
776
|
+
if (!jevOn) return;
|
|
777
|
+
const r = await host.pmPost('/api/features/suggest', { ws: C.t.ws, text: t }).catch(() => null);
|
|
778
|
+
const ta = foot.querySelector('textarea');
|
|
779
|
+
const c = r && r.ok && r.cmd ? slashList().find((x) => x.cmd === r.cmd) : null;
|
|
780
|
+
if (c && ta && ta.value === t) { C.cmdSug = { ...c, for: t, from: 'jev' }; drawSlash(); }
|
|
781
|
+
}, 500);
|
|
782
|
+
}
|
|
783
|
+
function takeSug() {
|
|
784
|
+
const ta = foot.querySelector('textarea'), s = C.cmdSug; if (!ta || !s) return;
|
|
785
|
+
noteUse('slash-suggest-take'); C.cmdSug = null;
|
|
786
|
+
ta.value = s.cmd + ' ' + s.for.trim(); drawSlash(); grow(ta); ta.focus();
|
|
787
|
+
}
|
|
746
788
|
function pickSlash(cmd) { const ta = foot.querySelector('textarea'); ta.value = cmd + ' '; C.slashAt = 0; drawSlash(); grow(ta); ta.focus(); }
|
|
747
789
|
/* Notes: the notepad opens in the Viewer for the conversation's key; Add selection writes into this box, Share with Claude puts the note
|
|
748
790
|
* on the next message as a chip (premium-attach's sink), and on a phone both return to the chat. */
|
|
@@ -27,6 +27,7 @@ export function opOf(ev) {
|
|
|
27
27
|
let started = false;
|
|
28
28
|
export function start(g = globalThis) {
|
|
29
29
|
if (started || !g || typeof g.EventSource !== 'function') return false;
|
|
30
|
+
if (g.PMOS_READONLY) return false; // a published, read-only board (pm/readonly-boot.js) reads nothing from the server
|
|
30
31
|
started = true;
|
|
31
32
|
let es;
|
|
32
33
|
try { es = new g.EventSource('/api/live-rows'); } catch { started = false; return false; }
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
*
|
|
15
15
|
* paletteGroups(q, ctx) PURE (but for the item's buttons, read from the page): [{ label, allOnly: true, rows: [{ id, title, sub?, tag?, icon, open() }] }]
|
|
16
16
|
* withEverything(scope, ctx) a Search scope ({ name, hits(q) }): the page's own groups first, then paletteGroups
|
|
17
|
-
* ctx: { places: [{ key, label, href }], here, item?, doc?, wsq?(prefix) → '?ws=…' | '', chat?(), setTheme?(pick), go?(url)
|
|
17
|
+
* ctx: { places: [{ key, label, href }], here, item?, doc?, wsq?(prefix) → '?ws=…' | '', chat?(), setTheme?(pick), go?(url),
|
|
18
|
+
* features?: the user features (feature-directory), found by name; a pick opens What PMOS can do } */
|
|
18
19
|
import { KEYS, targetOf, wordsOf } from './action-keys.js';
|
|
19
20
|
import { SECTIONS } from './set-ds.js';
|
|
20
21
|
import { noteUse } from './use-log.js';
|
|
@@ -54,6 +55,7 @@ function actionRows(q, ctx) {
|
|
|
54
55
|
const A = [
|
|
55
56
|
{ id: 'chat', title: 'Ask PMOS', also: 'chat talk', icon: 'chat', run: () => (ctx.chat ? ctx.chat() : null) },
|
|
56
57
|
{ id: 'guide', title: 'Open the Guide', also: 'help how', icon: 'guide', run: lazy('./premium-vw-open.js', (M) => M.openGuide('index')) },
|
|
58
|
+
{ id: 'features', title: 'What PMOS can do', also: 'features commands shortcuts directory slash', icon: 'guide', run: lazy('./premium-vw-open.js', (M) => M.openFeatures()) },
|
|
57
59
|
{ id: 'calendar', title: 'Open the calendar', also: 'events meetings', icon: 'cal', run: lazy('./premium-vw-open.js', (M) => M.openCalendar({ ws: ctx.ws || '' })) },
|
|
58
60
|
{ id: 'notes', title: 'Open notes', also: 'meeting notes', icon: 'doc', run: lazy('./premium-vw-open.js', (M) => M.openNotes({ ws: ctx.ws || '' })) },
|
|
59
61
|
{ id: 'note', title: 'New note', also: 'write capture', icon: 'doc', run: lazy('./premium-vw-open.js', (M) => M.newNote(ctx.ws || '')) },
|
|
@@ -79,11 +81,18 @@ function itemRows(q, ctx) {
|
|
|
79
81
|
return out;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
/* feature-directory: the user features (GET /api/features, held by the menu in ctx.features) found by name; a pick opens the directory */
|
|
85
|
+
function featureRows(q, ctx) {
|
|
86
|
+
return (Array.isArray(ctx.features) ? ctx.features : []).filter((f) => f && matches(q, f.name, f.say, f.cmd || ''))
|
|
87
|
+
.map((f) => ({ id: 'feature:' + f.id, title: f.name, sub: f.cmd || 'Feature', icon: 'guide', open: pick('palette-feature', lazy('./premium-vw-open.js', (M) => M.openFeatures())) }))
|
|
88
|
+
.sort(byName(q));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The groups for a query: On this item, Go to, Do, Features; a group with no row is left out. */
|
|
83
92
|
export function paletteGroups(q, ctx = {}) {
|
|
84
93
|
const s = String(q || '').trim();
|
|
85
94
|
if (s.length < 2) return [];
|
|
86
|
-
return [['On this item', itemRows(s, ctx)], ['Go to', pageRows(s, ctx).slice(0, 6)], ['Do', actionRows(s, ctx).slice(0, 6)]]
|
|
95
|
+
return [['On this item', itemRows(s, ctx)], ['Go to', pageRows(s, ctx).slice(0, 6)], ['Do', actionRows(s, ctx).slice(0, 6)], ['Features', featureRows(s, ctx).slice(0, 6)]]
|
|
87
96
|
.filter(([, rows]) => rows.length).map(([label, rows]) => ({ label, rows, allOnly: true })); // Search: on All only, never counted as initiatives
|
|
88
97
|
}
|
|
89
98
|
|
|
@@ -6,7 +6,8 @@ import { turnsOf } from './chat-context.js';
|
|
|
6
6
|
import { chipsHtml, itemOf, openCtx } from './premium-vw-ctx.js';
|
|
7
7
|
import { lineItems, behindOf, whenRead } from './freshness-words.js';
|
|
8
8
|
import { weeksOf, lineOf, KINDS } from './upd-weeks.js';
|
|
9
|
-
import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, goalChipHtml, goalViewHtml, goalNow, slashMatches } from './goal-chat.js';
|
|
9
|
+
import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, goalChipHtml, goalViewHtml, goalNow, slashMatches, slashList, loadSlash } from './goal-chat.js';
|
|
10
|
+
import { hereOf, expand as expandCmd } from './feature-match.js'; // feature-directory: PMOS commands run their pmos verb
|
|
10
11
|
import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
|
|
11
12
|
import { splitReport, reportChipHtml, blockSig } from './report-chat.js';
|
|
12
13
|
import { askCardHtml, answerText } from './chat-ask.js';
|
|
@@ -730,6 +731,7 @@ $('#dBody').addEventListener('click', onWebLink); $('#dOut').addEventListener('c
|
|
|
730
731
|
/** Send one message to the open popup's own conversation (a viewer tab's Read it now). False when no popup conversation is open. */
|
|
731
732
|
export async function askHere(text) { return S.key && $('#dlg').classList.contains('on') ? sendText(S.key, text) : false; }
|
|
732
733
|
async function sendText(key, text, files) {
|
|
734
|
+
text = expandCmd(text, slashList());
|
|
733
735
|
const go = $('#askGo'); if (go) go.disabled = true; $('#askNote').textContent = 'Sending.';
|
|
734
736
|
const ctx = S.ctx && key === S.key ? { context: S.ctx } : {};
|
|
735
737
|
const res = await chatPost('ask', files && files.length ? { key, text, files, ...ctx } : { key, text, ...ctx });
|
|
@@ -778,9 +780,10 @@ $('#dBody').addEventListener('click', onGoalPress);
|
|
|
778
780
|
$('#dOut').addEventListener('click', (e) => { if (e.target.closest('.vwgoal [data-goal]')) onGoalPress(e); }); // Start, Change, Cancel and Stop in the Goal tab
|
|
779
781
|
/* the `/` menu (G1): opens on a leading `/`, arrows move, Enter or Tab picks, Esc shuts it */
|
|
780
782
|
let slashAt = 0;
|
|
783
|
+
loadSlash(pmGet); // every command, PMOS's own first (feature-directory)
|
|
781
784
|
function drawSlash() {
|
|
782
785
|
const m = $('#slashM'), inp = $('#askIn'); if (!m || !inp) return;
|
|
783
|
-
const list = slashMatches(inp.value);
|
|
786
|
+
const list = slashMatches(inp.value, hereOf(location.pathname));
|
|
784
787
|
if (!list.length) { m.hidden = true; m.removeAttribute('data-esc-layer'); inp.removeAttribute('aria-activedescendant'); return; }
|
|
785
788
|
slashAt = Math.min(slashAt, list.length - 1);
|
|
786
789
|
m.innerHTML = list.map((x, i) => `<button type="button" role="option" id="slash-${i}" aria-selected="${i === slashAt}" class="${i === slashAt ? 'sel' : ''}" data-slash="${esc(x.cmd)}"><code>${esc(x.cmd)}</code><b>${esc(x.name)}</b><em>${esc(x.say)}</em></button>`).join('');
|
|
@@ -795,7 +798,7 @@ export function growAsk() {
|
|
|
795
798
|
$('#dBody').addEventListener('input', (e) => { if (e.target.id === 'askIn') { slashAt = 0; drawSlash(); growAsk(); } });
|
|
796
799
|
$('#dBody').addEventListener('keydown', (e) => {
|
|
797
800
|
if (e.target.id !== 'askIn' || e.isComposing || e.keyCode === 229) return; // an IME is still composing: its Enter picks the word, it does not send
|
|
798
|
-
const list = slashMatches(e.target.value), menu = list.length && !$('#slashM').hidden;
|
|
801
|
+
const list = slashMatches(e.target.value, hereOf(location.pathname)), menu = list.length && !$('#slashM').hidden;
|
|
799
802
|
if (menu && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); slashAt = (slashAt + (e.key === 'ArrowDown' ? 1 : list.length - 1)) % list.length; drawSlash(); }
|
|
800
803
|
else if (menu && (e.key === 'Tab' || (e.key === 'Enter' && !e.shiftKey && e.target.value !== list[slashAt].cmd))) { e.preventDefault(); pickSlash(list[slashAt].cmd); }
|
|
801
804
|
else if (menu && e.key === 'Escape') { e.preventDefault(); e.target.value = ''; drawSlash(); growAsk(); }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* premium-vw-features.css — What PMOS can do in the Viewer (pm/features-dir.js; board FdA, Exploring 3 page features). Quiet: one row
|
|
2
|
+
* shape, the group name as the only header, a blue dot only on the New group, chips that say how to reach each feature. */
|
|
3
|
+
.vwdoc.fd{display:flex;flex-direction:column;gap:var(--space-4)}
|
|
4
|
+
.fd-find input{width:100%;height:40px;box-sizing:border-box;padding:0 var(--space-12);border-radius:var(--radius-md);border:0;background:var(--well);color:var(--ink);font:inherit}
|
|
5
|
+
.fd-grp h3{display:flex;align-items:center;gap:var(--space-8);margin:var(--space-12) 0 var(--space-4);font-size:var(--fs-meta);line-height:var(--lh-meta);font-weight:var(--fw-strong);color:var(--ink-3)}
|
|
6
|
+
.fd-dot{width:8px;height:8px;border-radius:4px;background:var(--ember);display:inline-block}
|
|
7
|
+
.fd-row{display:flex;align-items:center;gap:var(--space-12);min-height:56px;padding:6px var(--space-8);border-radius:var(--radius-md)}
|
|
8
|
+
.fd-row:hover{background:var(--well)}
|
|
9
|
+
.fd-row .tx{flex:1;min-width:0;display:flex;flex-direction:column}
|
|
10
|
+
.fd-row .tx b{font-weight:var(--fw-strong)}
|
|
11
|
+
.fd-row .tx span{font-size:var(--fs-meta);line-height:var(--lh-meta);color:var(--ink-3)}
|
|
12
|
+
.fd-how{display:flex;gap:6px;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end}
|
|
13
|
+
.fd-ch{min-height:32px;display:inline-flex;align-items:center;gap:4px;padding:0 10px;border-radius:999px;border:1px solid var(--hair);background:none;font:inherit;font-size:var(--fs-meta);color:var(--ink);text-decoration:none;cursor:pointer}
|
|
14
|
+
.fd-ch:hover{background:var(--well)}
|
|
15
|
+
.fd-ch code{font-family:var(--mono);color:var(--vw-lnk)}
|
|
16
|
+
.fd-ch kbd{font-family:var(--mono)}
|
|
17
|
+
@media (max-width:760px){.fd-row{flex-wrap:wrap}.fd-how{justify-content:flex-start}.fd-ch{min-height:44px}}
|
|
@@ -30,8 +30,9 @@ export async function openReport(ref, o = {}) { vzStyle(); return (await rep()).
|
|
|
30
30
|
export async function newNote(o) { vzStyle(); return (await mtg()).newNote(typeof o === 'string' ? o : (o && o.ws) || ''); }
|
|
31
31
|
export async function makeWorkItem(noteId, step) { return (await mtg()).workItem(noteId, step); }
|
|
32
32
|
export async function openGuide(page) { vzStyle(); return (await gd()).openGuide(page); }
|
|
33
|
+
export async function openFeatures() { vzStyle(); return (await import('./features-dir.js')).openFeatures(); } // feature-directory: What PMOS can do
|
|
33
34
|
|
|
34
|
-
export const views = { openMeeting, openCalendar, openNotes, openReport, newNote, makeWorkItem, openGuide };
|
|
35
|
+
export const views = { openMeeting, openCalendar, openNotes, openReport, newNote, makeWorkItem, openGuide, openFeatures };
|
|
35
36
|
if (typeof window !== 'undefined') {
|
|
36
37
|
window.czViews = Object.assign(window.czViews || {}, views);
|
|
37
38
|
window.pmViewer = window.czViews;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* pm/premium-vw-page.js — /premium-viewer.html: opens the item its address names in the Viewer card (initiative premium-agreed-design).
|
|
2
2
|
* ?open=meeting¬e=<id> | &event=<id>&date=YYYY-MM-DD ?open=calendar[&tab=notes][&date=] ?open=notes[&initiative=]
|
|
3
|
-
* ?open=report&path=reports/<cadence>/<date>.md ?open=guide[&page=<name>] each with an optional &ws=
|
|
3
|
+
* ?open=report&path=reports/<cadence>/<date>.md ?open=guide[&page=<name>] ?open=features each with an optional &ws=
|
|
4
4
|
* Closing the card leaves a line that links to Home. An address that names nothing says so. */
|
|
5
5
|
import { views } from './premium-vw-open.js';
|
|
6
6
|
import { onChange } from './cozy-viewer.js';
|
|
@@ -15,4 +15,5 @@ else if (what === 'calendar') views.openCalendar({ ws, tab: q.get('tab') === 'no
|
|
|
15
15
|
else if (what === 'notes') views.openNotes({ ws, initiative: q.get('initiative') || '' });
|
|
16
16
|
else if (what === 'report' && q.get('path')) views.openReport(q.get('path'), { ws });
|
|
17
17
|
else if (what === 'guide') views.openGuide(q.get('page') || 'index');
|
|
18
|
+
else if (what === 'features') views.openFeatures();
|
|
18
19
|
else gone.hidden = false;
|