create-pmos 0.788.0 → 0.790.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 +44 -46
- package/payload/KIT-VERSION +1 -1
- package/payload/design-system/ui/components/bundle.css +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 +43 -10
- package/workspace/design-system/ui/components/bundle.css +1 -1
- package/workspace/guide/cli.md +4 -0
- package/workspace/guide/layout.md +11 -3
- package/workspace/lib/board-premium.js +1 -0
- package/workspace/lib/initiative-cli.js +41 -4
- package/workspace/lib/initiative-writer.js +31 -1
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-boards.js +2 -0
- package/workspace/lib/routes-proposals.js +1 -1
- package/workspace/lib/routes-status-line.js +51 -0
- package/workspace/lib/status-line.js +165 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-viewer-download-test.js +1 -1
- package/workspace/premium-vw-copy-test.js +2 -0
- package/workspace/public/pm/bd-views.js +7 -2
- package/workspace/public/pm/cozy-board.css +7 -0
- package/workspace/public/pm/cozy-pop-work.css +8 -0
- package/workspace/public/pm/cozy-pop-work.js +53 -2
- package/workspace/public/pm/home-data.js +2 -1
- package/workspace/public/pm/komorebi.css +1 -1
- package/workspace/public/pm/pop-work-model.js +2 -1
- package/workspace/public/pm/premium-vw-copies.js +17 -10
- package/workspace/public/pm/premium-vw-copy.css +7 -0
- package/workspace/public/pm/premium-vw-doc.css +13 -1
- package/workspace/public/pm/premium-vw-doc.js +1 -1
- package/workspace/public/pm/premium-vw-file.js +21 -9
- package/workspace/public/pm/premium-vw-guide.css +2 -1
- package/workspace/public/pm/premium-vw-guide.js +1 -1
- package/workspace/public/pm/premium-vw-notepad.css +1 -1
- package/workspace/public/premium-board.html +1 -1
- package/workspace/public/premium-library.html +1 -1
- package/workspace/test-lists/status-line.json +5 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* status-line.js — an initiative's status in one line (status-line, idea A505; boards StatusLineDS and PopupStatusPhone, agreed 2026-11-24).
|
|
3
|
+
*
|
|
4
|
+
* Where status shows (the board card, the item header, the Home row, the phone row) it is the state glyph, the derived stage, then ONE LINE
|
|
5
|
+
* OF AT MOST 12 WORDS. A longer status is kept whole in the item's log with its date and author, so nothing is lost.
|
|
6
|
+
*
|
|
7
|
+
* PURE words(t) · wordCount(t) · cut(t) → the line from a text (its first sentence when that fits, else its first 12 words)
|
|
8
|
+
* lineOf(status) → the line a surface shows ('' for no status or a bare state word); never more than 12 words
|
|
9
|
+
* isLong(t) → more than 12 words
|
|
10
|
+
* FILES logOf(root, id) → [{ at, by, text, line, batch? }] newest first (entries of an undone batch are left out)
|
|
11
|
+
* set(root, id, text, { actor, line?, now?, batch? }) → { ok, id, line, from, logged }
|
|
12
|
+
* migrate(root, { apply, actor, now }) → { ok, total, long, items: [{ id, words, line }], batch? }
|
|
13
|
+
* undo(root, batch, { actor, now }) → { ok, restored, kept }
|
|
14
|
+
* ASYNC suggest(ctx, text) → { line, made }: PMOS's short line from a long status (a normal session), else cut()
|
|
15
|
+
*
|
|
16
|
+
* The status itself is the record's `status:` front-matter line (lib/initiative-writer.js setStatusLine, the one writer of the record). The
|
|
17
|
+
* log is planning/runs/status-log.jsonl (layout-paths ledgerDir), append-only; this file is its one writer (pmos/graph-membership.json).
|
|
18
|
+
* `pmos status` (lib/status-cli.js) reads and writes both, so a chat write lands where the page reads. */
|
|
19
|
+
const fs = require('fs');
|
|
20
|
+
const path = require('path');
|
|
21
|
+
const W = require('./initiative-writer.js');
|
|
22
|
+
|
|
23
|
+
const MAX_WORDS = 12;
|
|
24
|
+
const LOG = 'status-log.jsonl';
|
|
25
|
+
// a status that is only a state word is not a line: the glyph says it (state-glyphs)
|
|
26
|
+
const STATE_ONLY = /^(on track|ontrack|at risk|late|overdue|on hold|held|hold|blocked|waiting|done|closed|shipped|complete|completed|active|in progress|live|cancell?ed|stopped|no signal|open|new|draft|proposed|planned|accepted|merged)\.?$/i;
|
|
27
|
+
|
|
28
|
+
const clean = (t) => String(t == null ? '' : t).replace(/\s+/g, ' ').trim();
|
|
29
|
+
const words = (t) => clean(t).split(' ').filter((w) => /[\p{L}\p{N}]/u.test(w));
|
|
30
|
+
const wordCount = (t) => words(t).length;
|
|
31
|
+
const isLong = (t) => wordCount(t) > MAX_WORDS;
|
|
32
|
+
|
|
33
|
+
/** PURE. The line from a text: the whole text when it fits; else its first sentence when that fits (2 to 12 words); else its first 12 words,
|
|
34
|
+
* without a dangling comma, with "…" to say there is more in the log. */
|
|
35
|
+
function cut(t) {
|
|
36
|
+
const s = clean(t);
|
|
37
|
+
if (!s) return '';
|
|
38
|
+
if (!isLong(s)) return s;
|
|
39
|
+
const first = (/^(.+?[.;!?])(\s|$)/.exec(s) || [])[1] || '';
|
|
40
|
+
const n = wordCount(first);
|
|
41
|
+
if (first && n >= 2 && n <= MAX_WORDS) return first.replace(/;$/, '.');
|
|
42
|
+
let k = 0, out = [];
|
|
43
|
+
for (const tok of s.split(' ')) { if (/[\p{L}\p{N}]/u.test(tok)) k++; if (k > MAX_WORDS) break; out.push(tok); }
|
|
44
|
+
while (out.length && !/[\p{L}\p{N}]/u.test(out[out.length - 1])) out.pop(); // no lone "?" or "—" at the end
|
|
45
|
+
return out.join(' ').replace(/[,;:\-–—(/]+$/, '') + '…';
|
|
46
|
+
}
|
|
47
|
+
/** PURE. What a surface shows for a record's status: '' for none or a bare state word, else at most 12 words. */
|
|
48
|
+
function lineOf(status) {
|
|
49
|
+
const s = clean(status);
|
|
50
|
+
if (!s || STATE_ONLY.test(s)) return '';
|
|
51
|
+
return cut(s);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function logFile(root) {
|
|
55
|
+
try { const { repoScript } = require('./repo-script.js'); return path.join(require(repoScript('signals/layout-paths.js')).pathsFor(root).ledgerDir, LOG); }
|
|
56
|
+
catch { return path.join(root, 'planning', 'runs', LOG); }
|
|
57
|
+
}
|
|
58
|
+
function readAll(root) {
|
|
59
|
+
let raw = '';
|
|
60
|
+
try { raw = fs.readFileSync(logFile(root), 'utf8'); } catch { return []; }
|
|
61
|
+
const out = [];
|
|
62
|
+
for (const l of raw.split('\n')) { if (!l.trim()) continue; try { const e = JSON.parse(l); if (e && typeof e === 'object') out.push(e); } catch { /* a torn line is skipped */ } }
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
function append(root, rows) {
|
|
66
|
+
const f = logFile(root);
|
|
67
|
+
fs.mkdirSync(path.dirname(f), { recursive: true });
|
|
68
|
+
fs.appendFileSync(f, rows.map((r) => JSON.stringify(r)).join('\n') + '\n');
|
|
69
|
+
}
|
|
70
|
+
const undone = (all) => new Set(all.filter((e) => e.kind === 'undo' && e.batch).map((e) => e.batch));
|
|
71
|
+
/** The item's log of statuses, newest first. */
|
|
72
|
+
function logOf(root, id) {
|
|
73
|
+
const all = readAll(root), off = undone(all);
|
|
74
|
+
return all.filter((e) => e.kind === 'status' && e.id === id && !(e.batch && off.has(e.batch))).map((e) => ({ at: e.at, by: e.by, text: e.text, line: e.line, ...(e.batch ? { batch: e.batch } : {}) })).reverse();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Write a status: the whole text to the log, the line (the caller's, else cut()) to the record. A line over 12 words is refused. */
|
|
78
|
+
function set(root, id, text0, { actor, line: line0, now = Date.now(), batch } = {}) {
|
|
79
|
+
const text = clean(text0);
|
|
80
|
+
if (!text) return { ok: false, status: 400, error: 'say the status in a few words' };
|
|
81
|
+
const line = line0 != null && clean(line0) ? clean(line0) : cut(text);
|
|
82
|
+
if (isLong(line)) return { ok: false, status: 400, error: `the line has ${wordCount(line)} words: keep it to ${MAX_WORDS} (the whole text goes to the log)` };
|
|
83
|
+
const cur = W.readStatusLine(root, id);
|
|
84
|
+
if (!cur.ok) return cur;
|
|
85
|
+
const at = new Date(now).toISOString(), by = (actor && actor.by) || 'unknown';
|
|
86
|
+
append(root, [{ v: 1, kind: 'status', id, at, by, text, line, from: cur.text || '', ...(batch ? { batch } : {}) }]);
|
|
87
|
+
const w = W.setStatusLine(root, id, line, { actor });
|
|
88
|
+
if (!w.ok) return w;
|
|
89
|
+
return { ok: true, id, line, from: w.from, logged: true };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function recordIds(root) {
|
|
93
|
+
let dir = null;
|
|
94
|
+
try { dir = require('./console-state').loadEngine().engine.layout(root).initiatives; } catch { dir = null; }
|
|
95
|
+
if (!dir) return [];
|
|
96
|
+
let names = [];
|
|
97
|
+
try { names = fs.readdirSync(dir); } catch { return []; }
|
|
98
|
+
return names.filter((n) => /\.md$/.test(n) && n !== 'README.md' && W.ID_RE.test(n.slice(0, -3))).map((n) => n.slice(0, -3)).sort();
|
|
99
|
+
}
|
|
100
|
+
/** The one-time move: every status longer than 12 words gets its line, and its whole text goes to the log. A dry run (no apply) counts. */
|
|
101
|
+
function migrate(root, { apply = false, actor, now = Date.now() } = {}) {
|
|
102
|
+
const items = [];
|
|
103
|
+
let total = 0;
|
|
104
|
+
for (const id of recordIds(root)) {
|
|
105
|
+
const r = W.readStatusLine(root, id);
|
|
106
|
+
if (!r.ok || !r.text) continue;
|
|
107
|
+
total++;
|
|
108
|
+
if (STATE_ONLY.test(clean(r.text)) || !isLong(r.text)) continue;
|
|
109
|
+
items.push({ id, words: wordCount(r.text), line: cut(r.text) });
|
|
110
|
+
}
|
|
111
|
+
if (!apply) return { ok: true, total, long: items.length, items };
|
|
112
|
+
const batch = 'migrate-' + new Date(now).toISOString().replace(/[:.]/g, '-');
|
|
113
|
+
const done = [];
|
|
114
|
+
for (const it of items) { const w = set(root, it.id, W.readStatusLine(root, it.id).text, { actor, line: it.line, now, batch }); if (w.ok) done.push(it); }
|
|
115
|
+
return { ok: true, total, long: items.length, moved: done.length, items: done, batch };
|
|
116
|
+
}
|
|
117
|
+
/** Undo a migration: each record whose line is still the migrated one gets its whole text back; one edited since keeps its edit. */
|
|
118
|
+
function undo(root, batch, { actor, now = Date.now() } = {}) {
|
|
119
|
+
const all = readAll(root);
|
|
120
|
+
const rows = all.filter((e) => e.kind === 'status' && e.batch === batch);
|
|
121
|
+
if (!rows.length) return { ok: false, status: 404, error: `no status batch ${batch}` };
|
|
122
|
+
if (undone(all).has(batch)) return { ok: true, restored: 0, kept: 0, already: true };
|
|
123
|
+
let restored = 0, kept = 0;
|
|
124
|
+
for (const e of rows) { const w = W.setStatusLine(root, e.id, e.from || e.text, { actor, expect: e.line }); if (w.ok && !w.kept) restored++; else kept++; }
|
|
125
|
+
append(root, [{ v: 1, kind: 'undo', batch, at: new Date(now).toISOString(), by: (actor && actor.by) || 'unknown' }]);
|
|
126
|
+
return { ok: true, restored, kept };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* ── the short line PMOS offers when a status runs past 12 words (a normal session, `claude -p`; never the API key) ── */
|
|
130
|
+
const MODEL = 'claude-sonnet-5-5';
|
|
131
|
+
const LEAN = Object.freeze([{ flag: '--strict-mcp-config' }, { flag: '--disable-slash-commands' }, { flag: '--setting-sources', value: 'user' }, { flag: '--tools', value: 'Read' }]);
|
|
132
|
+
const TIMEOUT_MS = 60000;
|
|
133
|
+
const promptOf = (text) => [
|
|
134
|
+
'Write the status line of a piece of work from the status below.',
|
|
135
|
+
`Rules: at most ${MAX_WORDS} words, one line, plain words, the newest fact or the next decision first. Keep names and dates the text gives.`,
|
|
136
|
+
'Do not say the stage or a state word such as On track, At risk or Late: the page shows those. Answer with the line only.',
|
|
137
|
+
'', 'Status:', clean(text).slice(0, 4000)].join('\n');
|
|
138
|
+
function viaSession(ctx, prompt, key) {
|
|
139
|
+
if (ctx && typeof ctx.askClaude === 'function') return Promise.resolve(ctx.askClaude(prompt, { job: 'status-line', key })).catch(() => null);
|
|
140
|
+
let headless = null; try { headless = require('./headless.js'); } catch { return Promise.resolve(null); }
|
|
141
|
+
const origin = 'briefing-ask:status-line:' + key;
|
|
142
|
+
if (!ctx || typeof ctx.spawnSession !== 'function' || headless.kindFor({ agent: 'claude', origin }) !== 'ask') return Promise.resolve(null);
|
|
143
|
+
return new Promise((resolve) => {
|
|
144
|
+
let settled = false; const done = (v) => { if (settled) return; settled = true; clearTimeout(t); resolve(v); };
|
|
145
|
+
const t = setTimeout(() => done(null), TIMEOUT_MS);
|
|
146
|
+
let s = null;
|
|
147
|
+
try {
|
|
148
|
+
s = ctx.spawnSession({ name: 'status: write its line', agent: 'claude', origin, initialInput: prompt,
|
|
149
|
+
modelAsk: { explicit: { model: MODEL, effort: 'low' } }, launchFlags: LEAN.map((f) => ({ ...f })),
|
|
150
|
+
onDone: (d) => { const r = d && d.result; done(r && r.ok && !r.isError ? String(r.text || '') : null); } });
|
|
151
|
+
} catch { s = null; }
|
|
152
|
+
if (!s || s.state === 'exited') done(null);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/** PMOS's short line for a long status: the session's line when it keeps the rule, else cut(). → { line, made } */
|
|
156
|
+
async function suggest(ctx, text) {
|
|
157
|
+
const t = clean(text);
|
|
158
|
+
if (!isLong(t)) return { line: t, made: false };
|
|
159
|
+
const key = require('crypto').createHash('sha1').update(t).digest('hex').slice(0, 12);
|
|
160
|
+
const said = clean(String((await viaSession(ctx, promptOf(t), key)) || '').split('\n')[0]).replace(/^["'“]|["'”]$/g, '');
|
|
161
|
+
if (said && wordCount(said) >= 2 && !isLong(said)) return { line: said, made: true };
|
|
162
|
+
return { line: cut(t), made: false };
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
module.exports = { suggest, promptOf, MAX_WORDS, words, wordCount, isLong, cut, lineOf, logFile, logOf, set, migrate, undo };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.790.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.790.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -54,7 +54,7 @@ const SHOTS = process.env.PMOS_SHOTS || '';
|
|
|
54
54
|
ok('W1 a file still reading, missing or unreadable offers nothing', !M.downloadsOf({ loading: true }).length && !M.downloadsOf({ reason: 'missing' }).length && !M.downloadsOf({ err: 'x' }).length);
|
|
55
55
|
const h = M.printSrc({ name: 'r.html', kind: 'html', text: '<!doctype html><p>x</p>' }), m = M.printSrc({ name: 'n.md', kind: 'markdown', text: '# Notes\n\nThe **rate** is 38%.' });
|
|
56
56
|
ok('W2 the print page keeps the CSP first and prints itself on load', h.startsWith('<!doctype html><meta http-equiv="Content-Security-Policy"') && /addEventListener\("load"[\s\S]*print\(\)/.test(h), h.slice(0, 200));
|
|
57
|
-
ok('W2 markdown prints as a page of its words', /<h1
|
|
57
|
+
ok('W2 markdown prints as a page of its words', /<h1[^>]*>Notes<\/h1>/.test(m) && /<strong>rate<\/strong>/.test(m) && m.includes(M.FRAME_CSP), m.slice(0, 300));
|
|
58
58
|
ok('W1 the title row of a read file carries the download icon', /data-fdl/.test(M.fileHtml({ name: 'n.md', kind: 'markdown', text: '# N', rel: 'n.md' })) && !/data-fdl/.test(M.fileHtml({ loading: true })));
|
|
59
59
|
}
|
|
60
60
|
const exe = findBrowser();
|
|
@@ -103,6 +103,8 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
103
103
|
ok('R7 Today is up at 390px, with no old dialog', await openDialog(page));
|
|
104
104
|
await openCopy(page, { ws: '', path: 'planning/launch.md', kind: 'google', url: URL_G, title: 'Launch plan (Doc)' });
|
|
105
105
|
await until(() => page.$('#czViewer:not([hidden]) .obody.vw [data-cp="use"]'));
|
|
106
|
+
// the view's sheet is added when it opens (vwStyle('copy')): measure once it has loaded, not while the button has only the base rules
|
|
107
|
+
await until(() => page.evaluate(() => { const l = document.querySelector('link[data-vw-css="copy"]'); try { return !!(l && l.sheet && l.sheet.cssRules.length); } catch { return false; } }));
|
|
106
108
|
const m = await page.evaluate(() => {
|
|
107
109
|
const p = document.querySelector('#czViewer:not([hidden]) .obody.vw'), bs = [...p.querySelectorAll('.cpv-acts .dmcta')].filter((b) => b.offsetParent);
|
|
108
110
|
return { minH: Math.min(...bs.map((b) => b.getBoundingClientRect().height)), n: bs.length, over: document.documentElement.scrollWidth > window.innerWidth, bg: getComputedStyle(p.querySelector('.cpv-page')).backgroundColor };
|
|
@@ -196,6 +196,9 @@ function columnsOf(L) {
|
|
|
196
196
|
/** A card (BdByStage, PgKanban). With All (mixed), it names its own stage under the title with its workflow's icon (WfABoard). */
|
|
197
197
|
function card(r, drag, mixed) {
|
|
198
198
|
const t = r.track || {}, s = statusLine(r), u = A.usual(t);
|
|
199
|
+
// status in one line (status-line, A505): the state is the glyph before the title; under it the record's line of at most 12 words, else
|
|
200
|
+
// the status's fact ("15 days over"); a bare state word is not said twice
|
|
201
|
+
const gs = fromStatus(s), say = r.line || (isStateWord(s.text) ? '' : s.text);
|
|
199
202
|
// the foot leads with the next step (PgKanban, the nextfirst rule): your next part in blue when it waits on you, else the output and its
|
|
200
203
|
// count ("BRD 1 of 4"); the owner is in the List, the panel and the card's name for a reader
|
|
201
204
|
const out = t.count && t.count !== 'Not counted yet' ? String(t.output || '').replace(/ complete$/, '').split(/[ ,+]/)[0] + ' ' + String(t.count).replace(/ parts?$/, '') : '';
|
|
@@ -206,7 +209,7 @@ function card(r, drag, mixed) {
|
|
|
206
209
|
const counted = /^\d/.test(String(t.count || '')) ? out.trim() : ''; // "PRD 4 of 9", not "PRD — of 9" or "No tickets yet"
|
|
207
210
|
const meta = mixed ? `<span class="cm">${WF.wfIcon(WF.wfOf(r), 16)}<span>${w && w.milestone ? '◆ ' : ''}${esc(stageName(r) || 'No stage')}${counted ? ' · ' + esc(counted) : ''}</span></span>` : '';
|
|
208
211
|
const foot = left || right ? `<span class="f">${left || '<span></span>'}<span>${esc(right)}</span></span>` : '';
|
|
209
|
-
return `<button type="button" class="bd-bc ini2${t.ms ? ' ms' : ''}${t.you ? ' you' : ''}${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}"${drag ? ' draggable="true"' : ''} aria-haspopup="dialog"${r.owner ? ` title="${esc(r.title + ' · owner ' + r.owner)}"` : ''}><b class="t">${r.inProgram && A.memberIcon ? A.memberIcon(r.inProgram) : ''}${esc(r.title)}</b>${meta}
|
|
212
|
+
return `<button type="button" class="bd-bc ini2${t.ms ? ' ms' : ''}${t.you ? ' you' : ''}${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}"${drag ? ' draggable="true"' : ''} aria-haspopup="dialog"${r.owner ? ` title="${esc(r.title + ' · owner ' + r.owner)}"` : ''}><b class="t">${stateGlyph(gs.state, { why: gs.why, size: 14, progress: outOf(r) ? outOf(r).pct / 100 : 0, cls: 'bd-sg' })}${r.inProgram && A.memberIcon ? A.memberIcon(r.inProgram) : ''}${esc(r.title)}</b>${meta}${say ? `<span class="s cs s-${s.tone}${r.line ? ' ln' : ''}">${esc(say)}</span>` : ''}${foot}</button>`;
|
|
210
213
|
}
|
|
211
214
|
/** The place a column drops a card into: one of Product feature's eight steps (data-step), or a stage of the picked workflow (data-wfstage). */
|
|
212
215
|
const dropAt = (c, cur) => (c.end ? '' : c.step != null ? ` data-step="${c.step}"` : c.stage ? ` data-wfstage="${esc(c.stage.key)}" data-wf="${esc(cur.id)}"` : '');
|
|
@@ -326,7 +329,9 @@ function phoneRow(r) {
|
|
|
326
329
|
const line = PL.lineHtml(r, { today, next: ahead, alert: s.tone === 'red' || s.tone === 'late' || s.tone === 'risk' });
|
|
327
330
|
const sg = r.signals && r.signals.n ? esc(sigWords(r.signals.n)) : ''; // A157: the count in words; the tap opens the panel, which lists them (sigListHtml)
|
|
328
331
|
const sub = [st ? stIc + esc(st) : '', line ? '' : ends, nx, lt, sg, say ? `<em class="${t.you ? 'you' : esc(s.tone)}">${esc(say)}</em>` : '', r.owner ? esc(r.owner) : ''].filter(Boolean).join(' · ');
|
|
329
|
-
|
|
332
|
+
// status in one line (status-line, A505): the record's line of at most 12 words under the title, before the stage line
|
|
333
|
+
const said = r.line ? `<span class="s ln">${esc(r.line)}</span>` : '';
|
|
334
|
+
return `<button type="button" class="bd-lrow ini2${A.sel && A.sel() === r.key ? ' sel' : ''}" data-key="${esc(r.key)}" aria-haspopup="dialog">${stateGlyph(gs.state, { why: gs.why, size: 16, progress: outOf(r) ? outOf(r).pct / 100 : 0 })}<span class="tx"><span class="t">${nameHtml(r)}</span>${said}<span class="s q">${sub}</span>${line}</span>${t.you && t.days != null ? `<span class="r">${t.days}d</span>` : ''}${many() ? WF.wfIcon(WF.wfOf(r), 18) : ''}</button>`;
|
|
330
335
|
}
|
|
331
336
|
export function phoneListHtml(L) {
|
|
332
337
|
const you = L.filter((r) => r.track && r.track.you), bad = L.filter((r) => !you.includes(r) && needOf(r) <= 3), left = L.filter((r) => !you.includes(r) && !bad.includes(r));
|
|
@@ -27,6 +27,8 @@ body.bd-page .dock, body.bd-page .sky, body.bd-page .hero, body.bd-page .rail {
|
|
|
27
27
|
/* the panel (AgBoard .panel): no page header; it starts at the top */
|
|
28
28
|
body.bd-page main.bd-main { position: relative; max-width: none; margin: var(--space-16); padding: 22px 28px 20px; min-height: calc(100vh - 32px); box-sizing: border-box; font-family: var(--cz-sans); font-size: var(--fs-body); color: var(--cz-ink);
|
|
29
29
|
background: var(--cz-card); border-radius: 28px; box-shadow: 0 30px 70px -36px rgba(42,46,53,.28); display: flex; flex-direction: column; gap: 14px; line-height: var(--lh-body); }
|
|
30
|
+
/* Work sits on the system's pm-layout-open (reading-layouts, A334): its grid and its gap token win over the panel's own column */
|
|
31
|
+
body.bd-page main.bd-main.pm-layout-open { display: grid; gap: var(--space-16); }
|
|
30
32
|
.bd-page main.bd-main * { box-sizing: border-box; }
|
|
31
33
|
|
|
32
34
|
/* ── the toolbar (AgBoard .hd .tools) ── */
|
|
@@ -622,6 +624,7 @@ span.tg-end { left: var(--tl-x); cursor: default; } /* a shared board's milest
|
|
|
622
624
|
/* ── phone (AgBoardPhone, AgBoardPhoneSheet, AgBoardTimelinePhone): a one-line top bar, cards, and a bottom sheet ── */
|
|
623
625
|
@media (max-width: 720px) {
|
|
624
626
|
body.bd-page main.bd-main { margin: 0; border-radius: 0; min-height: 100vh; padding: var(--space-16) var(--space-16) 110px; box-shadow: none; background: transparent; gap: 10px; }
|
|
627
|
+
body.bd-page main.bd-main.pm-layout-open { gap: var(--space-8); }
|
|
625
628
|
.bd-hd { gap: 2px; min-height: 44px; }
|
|
626
629
|
.bd-tools { gap: 0; margin-left: auto; }
|
|
627
630
|
.bd-hide-s, .bd-views, .bd-spw, .bd-lgdw, #chSprint, .bd-page #pvBell, .bd-page #moreBtn, .bd-page .tools-top { display: none !important; }
|
|
@@ -1620,3 +1623,7 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
|
|
|
1620
1623
|
/* the state glyph at the end of a Timeline bar (state-glyphs): after the end label, or alone at the bar's end */
|
|
1621
1624
|
.tg-endl .tg-sg { margin-left: 6px; vertical-align: -1px; }
|
|
1622
1625
|
.tg-sgw { position: absolute; top: 50%; transform: translate(8px, -50%); line-height: 0; z-index: 3; }
|
|
1626
|
+
/* status in one line (status-line, A505): the state glyph leads the card's title; the record's line (at most 12 words) wraps under it in ink */
|
|
1627
|
+
.bd-bc .t .bd-sg { margin-right: 6px; }
|
|
1628
|
+
.bd-bc .s.ln { color: var(--cz-ink2); }
|
|
1629
|
+
.bd-lrow .s.ln { color: var(--cz-ink2); white-space: normal; }
|
|
@@ -369,3 +369,11 @@ button.pw-fv .grey { color: var(--cz-ink3); }
|
|
|
369
369
|
.pw-ptk2.sel { box-shadow: inset 3px 0 0 var(--blue); background: var(--blue-tint); }
|
|
370
370
|
.pw-ph .ws-bar { margin: 0 0 var(--space-8); }
|
|
371
371
|
@container (max-width: 640px) { .pw-wbs .pw-jc { display: none; } }
|
|
372
|
+
/* status in one line (status-line, A505): the line is a press that writes the status; the editor counts words and offers PMOS's short line */
|
|
373
|
+
.pw-sline { all: unset; cursor: text; display: block; }
|
|
374
|
+
.pw-sline:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; border-radius: 4px; }
|
|
375
|
+
.pw-swc { display: block; margin-top: 4px; font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
376
|
+
.pw-swc.over { color: var(--cz-late); }
|
|
377
|
+
.pw-sws { display: block; margin-top: 4px; font-size: var(--fs-meta); color: var(--cz-ink2); }
|
|
378
|
+
.pw-sws:empty { display: none; }
|
|
379
|
+
.pw-swb { display: flex; justify-content: flex-end; margin-top: 6px; }
|
|
@@ -195,12 +195,13 @@ function overviewHtml(W, S, oid) {
|
|
|
195
195
|
if (RO) {
|
|
196
196
|
// a copy: the lines as plain words, with no source and no offer; the status line; the facts as text
|
|
197
197
|
const lines = `<div class="pw-ols">${ov.lines.filter((L) => L.text).map((L) => `<div class="pw-ol"><span class="pw-ok">${esc(L.k)}</span><p class="pw-ot"><span>${esc(L.text)}</span>${L.serves ? ' <span>' + esc(L.serves) + '</span>' : ''}</p></div>`).join('')}</div>`;
|
|
198
|
-
const stl = ov.status ? `<p class="pw-ostat">${esc(ov.status)}</p>` : '';
|
|
198
|
+
const stl = ov.line || ov.status ? `<p class="pw-ostat">${esc(ov.line || ov.status)}</p>` : '';
|
|
199
199
|
const dt = `<button type="button" class="pw-det" data-pw-details aria-expanded="${open}">${open ? 'Less' : 'Details'}${SVG(open ? P.down : P.right, 14)}</button>`;
|
|
200
200
|
return `<section class="pw-ov" aria-label="Overview"><div class="pw-ovh"><h3>Overview</h3>${dt}</div>${lines}${stl}${open ? factsHtml(W.facts.filter((f) => !/^no signal$/i.test(String(f.v || '').trim())).map((f) => ({ ...f, read: true }))) : ''}</section>`;
|
|
201
201
|
}
|
|
202
202
|
const mark = `<span class="pw-spark" role="img" aria-label="PMOS wrote this from the records" title="PMOS wrote this from the records">${SVG(P.spark, 14, 2)}</span>`;
|
|
203
|
-
|
|
203
|
+
// status in one line (status-line, A505): the record's line, else PMOS's words of where it stands; a press writes the status
|
|
204
|
+
const st = ov.line || ov.status ? `<p class="pw-ostat"><button type="button" class="pw-sline" data-pw-sline title="Write the status: one line of at most 12 words">${esc(ov.line || ov.status)}</button></p>` : '';
|
|
204
205
|
const sug = W.suggests.length ? `<div class="pw-sugs" role="list" aria-label="PMOS suggests"><p class="pw-sugh">PMOS suggests</p>${W.suggests.map((s) => sugLine(s)).join('')}${W.more ? `<button type="button" class="pw-lk" data-pw-props>${esc(W.more + ' more')}</button>` : ''}</div>` : '';
|
|
205
206
|
const facts = open ? factsHtml(W.facts) : '';
|
|
206
207
|
const det = `<button type="button" class="pw-det" data-pw-details aria-expanded="${open}">${open ? 'Less' : 'Details'}${SVG(open ? P.down : P.right, 14)}</button>`;
|
|
@@ -754,6 +755,53 @@ async function saveDesc(text, x, h) {
|
|
|
754
755
|
await settle();
|
|
755
756
|
return true;
|
|
756
757
|
}
|
|
758
|
+
/* ── status in one line (status-line, A505; board StatusLineDS "When you write a status") ──
|
|
759
|
+
* The editor counts the words ("9 of 12 words"); past 12 the count turns red and PMOS offers a short line from the text (POST
|
|
760
|
+
* /api/initiative/status-suggest, a normal session, else the first 12 words). Use it puts the line in; Save keeps the whole text in the
|
|
761
|
+
* item's log and the line as the status (POST /api/initiative/status). Escape leaves it as it was. */
|
|
762
|
+
const SL_MAX = 12;
|
|
763
|
+
let SLED = null; // the open status editor's Use it and Save
|
|
764
|
+
const slWords = (t) => String(t || '').replace(/\s+/g, ' ').trim().split(' ').filter((w) => /[\p{L}\p{N}]/u.test(w)).length;
|
|
765
|
+
function editStatus(btn, W, x, h) {
|
|
766
|
+
const p = btn.closest('.pw-ostat');
|
|
767
|
+
if (!p || p.querySelector('textarea')) return;
|
|
768
|
+
const was = (W.overview && W.overview.line) || '';
|
|
769
|
+
p.innerHTML = `<textarea class="pw-sumed" rows="2" maxlength="4000" aria-label="Status"></textarea><span class="pw-swc" aria-live="polite"></span><span class="pw-sws"></span>`
|
|
770
|
+
+ `<span class="pw-swb"><button type="button" class="pw-lk" data-sw-save>Save</button></span>`;
|
|
771
|
+
const ta = p.querySelector('textarea'), wc = p.querySelector('.pw-swc'), sg = p.querySelector('.pw-sws');
|
|
772
|
+
ta.value = was; ta.focus();
|
|
773
|
+
let line = '', tm = null, asked = '';
|
|
774
|
+
const count = () => {
|
|
775
|
+
const n = slWords(ta.value);
|
|
776
|
+
wc.textContent = n + ' of ' + SL_MAX + ' words'; wc.classList.toggle('over', n > SL_MAX);
|
|
777
|
+
if (n <= SL_MAX) { line = ''; sg.innerHTML = ''; return; }
|
|
778
|
+
clearTimeout(tm);
|
|
779
|
+
tm = setTimeout(async () => {
|
|
780
|
+
const text = ta.value; if (text === asked) return; asked = text;
|
|
781
|
+
const w = h.where ? h.where() : {};
|
|
782
|
+
const r = await pmPost('/api/initiative/status-suggest', { ws: w.ws, id: x.o().id, text }).catch(() => null);
|
|
783
|
+
if (!r || r.ok === false || ta.value !== text) return;
|
|
784
|
+
line = r.line;
|
|
785
|
+
sg.innerHTML = `<i class="pw-spark" aria-hidden="true">✦</i> PMOS keeps the ${slWords(text)} words in the log and suggests: <b>${esc(r.line)}</b> <button type="button" class="pw-lk" data-sw-use>Use it</button>`;
|
|
786
|
+
}, 600);
|
|
787
|
+
};
|
|
788
|
+
ta.addEventListener('input', count); count();
|
|
789
|
+
let done = false;
|
|
790
|
+
const leave = async (save) => {
|
|
791
|
+
if (done) return; done = true; clearTimeout(tm); SLED = null;
|
|
792
|
+
const text = ta.value.replace(/\s+/g, ' ').trim();
|
|
793
|
+
if (!save || !text || text === was) { if (h.redraw) h.redraw(); return; }
|
|
794
|
+
const w = h.where ? h.where() : {};
|
|
795
|
+
const body = { ws: w.ws, id: x.o().id, text };
|
|
796
|
+
if (slWords(text) > SL_MAX && line) body.line = line;
|
|
797
|
+
const res = await pmPost('/api/initiative/status', body).catch(() => null);
|
|
798
|
+
if (!res || res.ok === false) { if (h.redraw) h.redraw(); if (h.toast) h.toast((res && res.error) || 'The status was not saved.'); return; }
|
|
799
|
+
if (h.toast) h.toast(slWords(text) > SL_MAX ? 'Saved. The whole text is in the log.' : 'Saved.');
|
|
800
|
+
if (h.reload) await h.reload(); else if (h.redraw) h.redraw();
|
|
801
|
+
};
|
|
802
|
+
SLED = { use: () => { ta.value = line; count(); ta.focus(); }, save: () => leave(true) }; // the presses come through wire()'s one listener
|
|
803
|
+
ta.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); leave(false); } else if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); leave(true); } });
|
|
804
|
+
}
|
|
757
805
|
const findSug = (W, id) => W.suggests.find((s) => s.id === id) || [...W.rowSuggests.values()].find((s) => s.id === id) || null;
|
|
758
806
|
|
|
759
807
|
/* ── the presses ── */
|
|
@@ -815,6 +863,9 @@ export function wire(body, h0, x0) {
|
|
|
815
863
|
if (d.pwDrop) { const s = findSug(W, d.pwDrop); if (s) { b.disabled = true; await dropSug(s, x, h); if (VW.current() && /^sug:/.test(VW.current().id)) VW.back(); } return; }
|
|
816
864
|
if (d.pwSug) { const s = findSug(W, d.pwSug); if (s) openSug(s, c, x, h); return; }
|
|
817
865
|
if ('pwProps' in d) { if (h.props) h.props(); return; }
|
|
866
|
+
if ('pwSline' in d) { editStatus(b, W, x, h); return; }
|
|
867
|
+
if ('swUse' in d) { if (SLED) SLED.use(); return; }
|
|
868
|
+
if ('swSave' in d) { if (SLED) SLED.save(); return; }
|
|
818
869
|
if (d.pwLine) { const L = W.overview.lines.find((q) => q.id === d.pwLine); if (L && L.edit) editLine(b, L, c, x, h); return; }
|
|
819
870
|
// a phone asks for several lines in one proposal: "problem,done"
|
|
820
871
|
if (d.pwLkeep) { const ls = d.pwLkeep.split(',').map((k) => W.overview.lines.find((q) => q.id === k)).filter((L) => L && L.ask); for (const L of ls) { if (L.edit) draftLine(L, x, h); else toAsk(L.ask, h); } return; }
|
|
@@ -224,7 +224,8 @@ export function weeklyUpdate(D, now = Date.now()) {
|
|
|
224
224
|
const why = r.signal && r.signal.why ? '. ' + r.signal.why : '';
|
|
225
225
|
return days + over + fin + why + '.';
|
|
226
226
|
};
|
|
227
|
-
|
|
227
|
+
// status in one line (status-line, A505): the record's line of at most 12 words when it has one, else where it stands in PMOS's words
|
|
228
|
+
const item = (r) => ({ id: r.id, title: r.title, meta: [r.stage, anchorOf(r)].filter(Boolean).join(' · '), text: r.line || line(r), flag: r.late && !/late/.test(statusOf(r)) ? 'Looks green, but it is past its planned finish' : '' });
|
|
228
229
|
const decide = rows.filter((r) => needIds.has(r.id) || /stalled|hold/.test(statusOf(r)));
|
|
229
230
|
const risk = rows.filter((r) => !decide.includes(r) && risky(r));
|
|
230
231
|
const ok = rows.filter((r) => !decide.includes(r) && !risk.includes(r) && onTrack(r));
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
.pm-ds .pm-layout-side, .pm-ds .pm-layout-open, .pm-ds .pm-layout-reading{display:grid;gap:var(--space-16);align-items:start}
|
|
150
150
|
.pm-ds .pm-layout-side{grid-template-columns:minmax(0,1fr) var(--width-side)}
|
|
151
151
|
.pm-ds .pm-layout-side>.pm-side, .pm-ds .pm-layout-reading>.pm-contents{position:sticky;top:0}
|
|
152
|
-
.pm-ds .pm-layout-open{grid-template-columns:minmax(0,1fr)}
|
|
152
|
+
.pm-ds .pm-layout-open{grid-template-columns:minmax(0,1fr);align-content:start}
|
|
153
153
|
.pm-ds .pm-layout-open:has(>.pm-item){grid-template-columns:minmax(0,1fr) var(--width-item)}
|
|
154
154
|
.pm-ds .pm-layout-open>.pm-item, .pm-ds .pm-layout-popup{background:var(--card);border-radius:var(--radius-panel);box-shadow:var(--raise);padding:var(--space-24)}
|
|
155
155
|
.pm-ds .pm-layout-popup{box-shadow:var(--lift);padding:var(--space-24) var(--space-32)}
|
|
@@ -303,7 +303,8 @@ export function overviewOf(r, v, o = {}) {
|
|
|
303
303
|
else lines.push({ id: 'done', k: 'Done when', text: '', edit: { to: 'artefact', artefact: 'done-test', field: 'check' }, ...offer('Done when', 'the done test (how we will know it worked, and when we check)', 'done-test', 'check') });
|
|
304
304
|
const sm = summaryOf(r, v, o);
|
|
305
305
|
const status = sm.status.replace(/^It is in /, 'In ');
|
|
306
|
-
|
|
306
|
+
// status in one line (status-line, A505): the record's line of at most 12 words; the item header shows it before PMOS's own words
|
|
307
|
+
return { lines, status, line: typeof r.line === 'string' ? r.line : '', reading: o.art == null };
|
|
307
308
|
}
|
|
308
309
|
|
|
309
310
|
/** The goal's name for an anchor (GET /api/boards/anchors rows { value, kind, label }): "KR-C4", "O-C:KR-C4" or "O-C.KR-C4" finds the KR
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* copyModel(link, text) · readModel(answer) the pure models (premium-vw-copy.test.js) */
|
|
10
10
|
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
11
11
|
import { pmGet, pmPost } from './http.js';
|
|
12
|
-
import {
|
|
13
|
-
import * as SB from './state-blocks.js';
|
|
12
|
+
import { copyKindOf } from './premium-doc-edit.js';
|
|
13
|
+
import * as SB from './state-blocks.js';
|
|
14
|
+
import { readMinutes } from './premium-vw-doc-model.js';
|
|
15
|
+
import { readingPageHtml, wireReading } from './reading-view.js'; // the copy's text reads in the Reading layout (reading-layouts, A334) // the empty, loading and error states every block has (Komorebi State)
|
|
14
16
|
|
|
15
17
|
const TOOL = { google: 'Google Docs', confluence: 'Confluence', 'google-slides': 'Google Slides', 'google-sheets': 'Google Sheets' };
|
|
16
18
|
const COPY = { google: 'the Google Doc', confluence: 'the Confluence page', 'google-slides': 'the slides', 'google-sheets': 'the sheet' };
|
|
@@ -53,12 +55,16 @@ export function readModel(a, now) {
|
|
|
53
55
|
|
|
54
56
|
const ICON = (k) => `<span class="cpv-lg" aria-hidden="true">${k === 'confluence' ? 'C' : 'G'}</span>`;
|
|
55
57
|
const ext = (url, tool) => (url ? `<a class="dmcta alt" href="${esc(url)}" target="_blank" rel="noopener noreferrer">Open in ${esc(tool)}</a>` : '');
|
|
56
|
-
|
|
58
|
+
/* The text in the Reading layout (reading-layouts, A334): the status, the why and the buttons sit above the title in the reading column; a
|
|
59
|
+
* dimmed PMOS version dims the text only, never the buttons. */
|
|
60
|
+
const page = (text, dim, o) => `<div class="cpv-page cpv-rd vwdoc rdw pm-reads${dim ? ' dim' : ''}">` + readingPageHtml(text, {
|
|
61
|
+
path: 'copy:' + o.key, title: o.title, above: `<div class="cpv">${o.top}</div>`,
|
|
62
|
+
meta: () => `<p class="rd-meta cfby">${esc(o.tool)} · ${readMinutes(text)} min read</p>` }) + '</div>';
|
|
57
63
|
|
|
58
64
|
/** Open one page in the viewer. With `path`, it is a copy linked to that PMOS file; without, a page PMOS only has the address of. */
|
|
59
65
|
export function openCopy(o) {
|
|
60
66
|
if (!o || !o.url) return null;
|
|
61
|
-
vwStyle('copy');
|
|
67
|
+
vwStyle('doc'); vwStyle('copy');
|
|
62
68
|
const kind = o.kind || copyKindOf(o.url) || 'google';
|
|
63
69
|
const id = 'copy:' + (o.path ? o.path + '|' + kind : o.url);
|
|
64
70
|
const S = { o: { ...o, kind }, model: null, read: null, err: '', wait: null, poll: null, busy: false };
|
|
@@ -66,7 +72,7 @@ export function openCopy(o) {
|
|
|
66
72
|
let pane = null;
|
|
67
73
|
const tok = String(Date.now()) + Math.random();
|
|
68
74
|
const live = () => !!(pane && pane.isConnected && pane.dataset.cpTok === tok);
|
|
69
|
-
const draw = () => { if (live()) pane.innerHTML = html(); };
|
|
75
|
+
const draw = () => { if (live()) { pane.innerHTML = html(); wireReading(pane, pane, 'copy:' + id); } };
|
|
70
76
|
function html() {
|
|
71
77
|
const tool = TOOL[kind] || 'the tool', t = esc(o.title || S.model && S.model.title || tool);
|
|
72
78
|
if (S.err) return `<div class="cpv"><div class="cpv-bar">${ICON(kind)}<div><b>${t}</b><small>${esc(tool)}</small></div></div><p class="note">${esc(S.err)}</p><div class="cpv-acts">${ext(o.url, tool)}</div></div>`;
|
|
@@ -74,16 +80,17 @@ export function openCopy(o) {
|
|
|
74
80
|
const m = S.model; if (!m) return `<div class="cpv"><p class="note">Reading the copy and the PMOS file.</p></div>`;
|
|
75
81
|
const acts = S.wait ? `<button type="button" class="dmcta alt" data-cp="undo">Undo</button><span class="note">Using the version in ${esc(TOOL[kind])} in five seconds.</span>`
|
|
76
82
|
: `${m.use && !m.syncing ? `<button type="button" class="dmcta" data-cp="use">Use the ${esc(TOOL[kind])} version</button>` : ''}<button type="button" class="dmcta alt" data-cp="check"${S.busy ? ' disabled' : ''}>${S.busy ? 'Checking' : 'Check again'}</button>${ext(m.url || o.url, m.tool)}`;
|
|
77
|
-
|
|
78
|
-
+ `<p class="note cpv-why">${esc(m.syncing ? 'A session is writing the copy\'s text into the PMOS file.' : m.why)} File: <code>${esc(o.path)}</code></p><div class="cpv-acts">${acts}</div
|
|
79
|
-
|
|
83
|
+
const top = `<div class="cpv-bar ${m.tone}">${ICON(kind)}<div><b>${esc(m.head)}</b><small>${esc(m.meta)}</small></div><span class="chp ${m.tone}"><i></i>${esc(m.syncing ? 'Updating' : m.chip)}</span></div>`
|
|
84
|
+
+ `<p class="note cpv-why">${esc(m.syncing ? 'A session is writing the copy\'s text into the PMOS file.' : m.why)} File: <code>${esc(o.path)}</code></p><div class="cpv-acts">${acts}</div>`;
|
|
85
|
+
return m.text == null ? `<div class="cpv">${top}<p class="note">The PMOS file could not be read.</p></div>` : page(m.text, m.dim, { key: id, title: o.title || m.title, tool: m.tool, top });
|
|
80
86
|
}
|
|
81
87
|
const r = S.read || { state: 'loading' }, where = o.where ? ' · ' + esc(o.where) : '';
|
|
82
88
|
if (r.state === 'loading') return `<div class="cpv"><p class="note">Reading what PMOS holds for this page.</p></div>`;
|
|
83
89
|
if (r.state === 'read') {
|
|
84
|
-
|
|
90
|
+
const top = `<div class="cpv-bar">${ICON(kind)}<div><b>Read ${esc(r.at)} by ${esc(r.by)}</b><small>${esc(tool)}${r.revision ? ' · revision ' + esc(r.revision) : ''} · view only${where}</small></div><span class="chp"><i></i>Read</span></div>`
|
|
85
91
|
+ `<p class="note cpv-why">This is the text as it was when it was read. Edits made in ${esc(tool)} after that show after you read it again.</p>`
|
|
86
|
-
+ `<div class="cpv-acts"><button type="button" class="dmcta alt" data-cp="read"${S.busy ? ' disabled' : ''}>Read again</button>${ext(o.url, tool)}</div
|
|
92
|
+
+ `<div class="cpv-acts"><button type="button" class="dmcta alt" data-cp="read"${S.busy ? ' disabled' : ''}>Read again</button>${ext(o.url, tool)}</div>`;
|
|
93
|
+
return page(r.text, false, { key: id, title: r.title || o.title || tool, tool, top });
|
|
87
94
|
}
|
|
88
95
|
const head = `<div class="cpv-bar">${ICON(kind)}<div><b>${t}</b><small>${esc(tool)}${where}</small></div><span class="chp"><i></i>${r.state === 'reading' ? 'Reading' : 'Link only'}</span></div>`;
|
|
89
96
|
if (r.state === 'reading') return `<div class="cpv">${head}<p class="note">A session is reading the page with your ${esc(tool)} connector${r.since ? ' (started ' + esc(r.since) + ')' : ''}. The text shows here when it is done.</p><div class="cpv-acts">${ext(o.url, tool)}</div></div>`;
|
|
@@ -16,8 +16,15 @@
|
|
|
16
16
|
.cpv-acts .dmcta{border-radius:var(--radius-sm);text-decoration:none}
|
|
17
17
|
.cpv-page{padding:18px 22px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid)}
|
|
18
18
|
.cpv-page.dim{opacity:.62}
|
|
19
|
+
/* The text in the Reading layout (reading-layouts, A334): no card of its own; the status and buttons sit in the reading column, and a dimmed
|
|
20
|
+
PMOS version dims the words only. */
|
|
21
|
+
.cpv-page.cpv-rd{padding:0;border:0;background:none}
|
|
22
|
+
.cpv-page.cpv-rd.dim{opacity:1}
|
|
23
|
+
.cpv-page.cpv-rd.dim .rd-hd,.cpv-page.cpv-rd.dim .rd-doc{opacity:.62}
|
|
24
|
+
.cpv-rd .cpv{max-width:none}
|
|
19
25
|
@media (max-width:700px){
|
|
20
26
|
.cpv-bar{flex-wrap:wrap}
|
|
21
27
|
.cpv-acts .dmcta{min-height:44px}
|
|
22
28
|
.cpv-page{padding:14px}
|
|
29
|
+
.cpv-page.cpv-rd{padding:0}
|
|
23
30
|
}
|
|
@@ -318,8 +318,20 @@ iframe.vwprint{position:fixed;right:0;bottom:0;width:1px;height:1px;border:0;opa
|
|
|
318
318
|
.rd-cm p{margin:0}
|
|
319
319
|
.rd-q{color:var(--muted)}
|
|
320
320
|
@media (max-width: 720px){ .rd-sb{padding-left:0} .rd-short{padding:var(--space-12) var(--space-16)} }
|
|
321
|
+
/* A reader in a panel follows its own width, not the window's: the host (.pm-reads) is the container. Contents goes under 900 px, the margin
|
|
322
|
+
under 640 px. The window rules of pm-layout-reading (komorebi.css) still hold. */
|
|
323
|
+
.pm-reads{container:reading/inline-size}
|
|
324
|
+
@container reading (max-width: 900px){
|
|
325
|
+
.pm-ds .pm-layout-reading.rd{grid-template:"head head" auto "main margin" 1fr/minmax(0,var(--doc-measure)) var(--width-margin)}
|
|
326
|
+
.pm-ds .pm-layout-reading.rd:not(:has(>.pm-margin)){grid-template:"head" auto "main" 1fr/minmax(0,var(--doc-measure))}
|
|
327
|
+
.pm-ds .pm-layout-reading.rd>.pm-contents{display:none}
|
|
328
|
+
}
|
|
329
|
+
@container reading (max-width: 640px){
|
|
330
|
+
.pm-ds .pm-layout-reading.rd>.pm-margin{display:none}
|
|
331
|
+
.pm-ds .pm-layout-reading.rd,.pm-ds .pm-layout-reading.rd:not(:has(>.pm-margin)){grid-template:"head" auto "main" 1fr/minmax(0,1fr)}
|
|
332
|
+
}
|
|
321
333
|
/* A page with no Contents (one section or none) gives its column back: the column stays at the reading measure, centred. */
|
|
322
|
-
@
|
|
334
|
+
@container reading (min-width: 901px){
|
|
323
335
|
.pm-ds .pm-layout-reading.rd:not(:has(>.pm-contents)){grid-template:"head head" auto "main margin" 1fr/minmax(0,var(--doc-measure)) var(--width-margin)}
|
|
324
336
|
.pm-ds .pm-layout-reading.rd:not(:has(>.pm-contents)):not(:has(>.pm-margin)){grid-template:"head" auto "main" 1fr/minmax(0,var(--doc-measure))}
|
|
325
337
|
}
|
|
@@ -327,7 +327,7 @@ function makePage(d, ctx) {
|
|
|
327
327
|
if (!el || !el.isConnected) return;
|
|
328
328
|
const keepScroll = el.scrollTop;
|
|
329
329
|
const reading = P.mode === 'read' && !ctx.host && P.text != null && !P.err && !openProp();
|
|
330
|
-
el.innerHTML = `<div class="vwdoc${reading ? ' rdw' : ''}">${pageHtml()}</div>`;
|
|
330
|
+
el.innerHTML = `<div class="vwdoc${reading ? ' rdw pm-reads' : ''}">${pageHtml()}</div>`;
|
|
331
331
|
el.scrollTop = keepScroll;
|
|
332
332
|
if (reading) wireReading(el, el, d.path); else if (P.mode === 'read') tocOf();
|
|
333
333
|
if (P.mode === 'edit') startEdit();
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* A share icon beside it opens the share popover (premium-vw-share.js: Send a copy on a phone, a public link with a password and an end date, open links).
|
|
9
9
|
* openChatFile(path, { session, ws }) -> the tab's pane */
|
|
10
10
|
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
11
|
-
import {
|
|
11
|
+
import { pageHead, readMinutes } from './premium-vw-doc-model.js';
|
|
12
12
|
import { needsReader, drawPdf } from './premium-vw-pdf.js';
|
|
13
13
|
import { readingPageHtml, wireReading } from './reading-view.js'; // a markdown file reads in the Reading layout (reading-layouts)
|
|
14
14
|
|
|
@@ -61,14 +61,26 @@ export function pageSrc(f, print = false) {
|
|
|
61
61
|
if (isHtml(f)) return framedSrc(String(f.text || '') + go);
|
|
62
62
|
const title = f.kind === 'markdown' ? pageHead(f.text).title || f.name : f.name;
|
|
63
63
|
let body;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// a plain document: the browser's own
|
|
69
|
-
const css = ':root{color-scheme:light}body{font:16px/1.6 -apple-system,"Segoe UI",system-ui,sans-serif;max-width:
|
|
64
|
+
// A markdown file is drawn in the Reading layout (reading-layouts, A334): the title, In short, a section per heading that folds, and
|
|
65
|
+
// Contents at the left on a wide screen. A shared link and a printed page are the same page: no comments, no chat, nothing that runs.
|
|
66
|
+
if (f.kind === 'markdown') body = readingPageHtml(f.text, { title: pageHead(f.text).title || f.name });
|
|
67
|
+
else body = `<h1>${esc(title)}</h1><pre>${esc(f.text)}</pre>`;
|
|
68
|
+
// a plain document: the browser's own colours, black on white, no app colours (the frame cannot load the app's stylesheets)
|
|
69
|
+
const css = ':root{color-scheme:light}body{font:16px/1.6 -apple-system,"Segoe UI",system-ui,sans-serif;max-width:1000px;margin:32px auto;padding:0 24px}'
|
|
70
70
|
+ 'table{border-collapse:collapse;width:100%}th,td{border:1px solid;padding:5px 9px;text-align:left;vertical-align:top}'
|
|
71
|
-
+ 'pre,code{font:14px ui-monospace,Menlo,monospace;white-space:pre-wrap}img{max-width:100%}@page{margin:18mm}'
|
|
71
|
+
+ 'pre,code{font:14px ui-monospace,Menlo,monospace;white-space:pre-wrap}img{max-width:100%}@page{margin:18mm}'
|
|
72
|
+
+ '.pm-layout-reading{display:grid;grid-template-columns:180px minmax(0,640px);gap:24px 40px;justify-content:center;align-items:start}'
|
|
73
|
+
+ '.pm-layout-reading:not(:has(>.pm-contents)){grid-template-columns:minmax(0,640px)}'
|
|
74
|
+
+ '.pm-contents{position:sticky;top:24px;display:flex;flex-direction:column;gap:6px;line-height:1.4}'
|
|
75
|
+
+ '.pm-contents a{color:inherit;opacity:.7;text-decoration:none}.pm-contents a:hover{opacity:1}'
|
|
76
|
+
+ '.rd-lab{margin:0 0 4px;letter-spacing:.06em;text-transform:uppercase;opacity:.65}'
|
|
77
|
+
+ '.rd-t{margin:0 0 16px;line-height:1.2}.rd-hd{margin:0 0 8px}'
|
|
78
|
+
+ '.rd-short{margin:0 0 16px;padding:16px 24px;border-radius:12px;background:rgba(0,0,0,.05)}.rd-short p:last-child{margin-bottom:0}'
|
|
79
|
+
+ '.rd-sec{border-bottom:1px solid rgba(0,0,0,.12)}.rd-sec>summary{display:flex;align-items:center;gap:8px;padding:12px 0;cursor:pointer;list-style:none}'
|
|
80
|
+
+ '.rd-sec>summary::-webkit-details-marker{display:none}.rd-sec>summary::before{content:"\\203A";width:16px;opacity:.6}'
|
|
81
|
+
+ '.rd-sec[open]>summary::before{transform:rotate(90deg)}.rd-sec>summary h2{margin:0}.rd-sb{padding:0 0 16px 24px}'
|
|
82
|
+
+ '@media (max-width:900px){.pm-layout-reading{grid-template-columns:minmax(0,1fr)}.pm-contents{display:none}.rd-sb{padding-left:0}}'
|
|
83
|
+
+ '@media print{.pm-layout-reading{display:block}.pm-contents{display:none}.rd-sec>summary::before{content:none}.rd-sb{padding-left:0}}';
|
|
72
84
|
return framedSrc(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${esc(String(title || 'Document').replace(/\.[A-Za-z0-9]+$/, ''))}</title><style>${css}</style></head><body>${body}${go}</body></html>`);
|
|
73
85
|
}
|
|
74
86
|
/** The page a PDF is printed from, as the srcdoc of a sandboxed frame. Pure. */
|
|
@@ -111,7 +123,7 @@ export function fileHtml(f, view = 'page') {
|
|
|
111
123
|
if (f.kind === 'markdown') {
|
|
112
124
|
// the Reading layout (reading-layouts, A334): a text file reads like every document; Download and Share sit in the head row
|
|
113
125
|
const h = pageHead(f.text);
|
|
114
|
-
return `<div class="vwdoc rdw">` + readingPageHtml(f.text, {
|
|
126
|
+
return `<div class="vwdoc rdw pm-reads">` + readingPageHtml(f.text, {
|
|
115
127
|
path: 'file:' + (f.abs || f.rel || f.path), title: h.title || f.name, head: `<span class="gap"></span>${actsHtml(f)}`,
|
|
116
128
|
meta: () => `<p class="rd-meta cfby">Read-only · ${readMinutes(f.text)} min read</p>`,
|
|
117
129
|
extraHead: h.labels.length ? `<div class="cflb">${h.labels.map((l) => `<span>${esc(l)}</span>`).join('')}</div>` : '',
|
|
@@ -39,11 +39,12 @@
|
|
|
39
39
|
.gd-railon .gd-rail{display:flex;position:absolute;z-index:3;top:64px;left:0;right:0;width:auto;max-height:70vh;padding:var(--space-12);border:1px solid var(--hair);border-radius:14px;background:var(--card-solid);box-shadow:var(--card-shadow)}
|
|
40
40
|
}
|
|
41
41
|
/* The Reading layout (reading-layouts, A334): the page reads like every document; the page rail opens over it from the list icon at every
|
|
42
|
-
width, and the section chips stand in for Contents where Contents is hidden (under 1100 px). */
|
|
42
|
+
width, and the section chips stand in for Contents where Contents is hidden (the reader under 900 px, or the window under 1100 px). */
|
|
43
43
|
.gd-railable{display:block}
|
|
44
44
|
.gd-railable .gd-tog{display:flex}
|
|
45
45
|
.gd-railable>.gd-rail{display:none}
|
|
46
46
|
.gd-railable.gd-railon>.gd-rail{display:flex;position:absolute;z-index:3;top:var(--space-48);left:0;width:var(--width-margin);max-height:70vh;padding:var(--space-12);border:1px solid var(--line);border-radius:var(--radius-card);background:var(--card);box-shadow:var(--lift)}
|
|
47
47
|
.gd .gd-secs{display:none}
|
|
48
48
|
@media (max-width: 1100px){ .gd .gd-secs{display:flex} }
|
|
49
|
+
@container reading (max-width: 900px){ .gd .gd-secs{display:flex} }
|
|
49
50
|
@media (max-width: 720px){ .gd-railable.gd-railon>.gd-rail{right:0;width:auto} }
|