create-pmos 0.402.0 → 0.403.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/payload/KIT-VERSION +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/board-programs-test.js +6 -5
- package/workspace/briefing-premium-adddoc-test.js +28 -22
- package/workspace/briefing-premium-board-test.js +91 -73
- package/workspace/briefing-premium-calendar-2-test.js +23 -10
- package/workspace/briefing-premium-calendar-3-test.js +23 -19
- package/workspace/briefing-premium-calendar-test.js +19 -17
- package/workspace/briefing-premium-initiative-test.js +25 -12
- package/workspace/briefing-premium-insights-test.js +31 -18
- package/workspace/briefing-premium-metrics-test.js +8 -8
- package/workspace/briefing-premium-test.js +4 -3
- package/workspace/changelog.json +12 -0
- package/workspace/fixtures/premium-viewer-fixtures.js +24 -2
- package/workspace/guide/jira.md +38 -6
- package/workspace/home-rows-test.js +184 -0
- package/workspace/lib/calendar-layers.js +8 -4
- package/workspace/lib/initiative-layout.js +4 -3
- package/workspace/lib/jira-cli.js +17 -12
- package/workspace/lib/jira-status.js +1 -1
- package/workspace/lib/jira-tickets.js +126 -24
- package/workspace/lib/meeting-files.js +58 -0
- package/workspace/lib/meeting-learn.js +139 -0
- package/workspace/lib/meeting-material.js +12 -5
- package/workspace/lib/notes.js +3 -0
- package/workspace/lib/routes-brief-page.js +8 -1
- package/workspace/lib/routes-calendar-views.js +24 -3
- package/workspace/lib/routes-meeting-material.js +38 -0
- package/workspace/lib/routes-meeting-points.js +23 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +30 -24
- package/workspace/premium-chat-context-test.js +1 -1
- package/workspace/premium-chat-goal-view-test.js +1 -1
- package/workspace/premium-chat-viewer-test.js +1 -1
- package/workspace/premium-core-doc-issue-test.js +13 -7
- package/workspace/premium-discuss-landing-test.js +83 -0
- package/workspace/premium-link-suggest-test.js +103 -0
- package/workspace/premium-report-read-test.js +86 -82
- package/workspace/premium-vw-backlog-test.js +6 -5
- package/workspace/premium-vw-cal-test.js +46 -23
- package/workspace/premium-vw-item-test.js +8 -6
- package/workspace/premium-vw-jira-test.js +3 -2
- package/workspace/premium-vw-meet-test.js +122 -66
- package/workspace/premium-vw-notes-test.js +7 -6
- package/workspace/premium-vw-rec-test.js +14 -13
- package/workspace/premium-vw-slides-test.js +11 -5
- package/workspace/program-panel-test.js +64 -55
- package/workspace/public/pm/bd-acts.js +1 -1
- package/workspace/public/pm/bd-asks.js +22 -7
- package/workspace/public/pm/bd-ini-panel.js +229 -0
- package/workspace/public/pm/bd-pop.js +2 -2
- package/workspace/public/pm/bd-prog-panel.js +176 -191
- package/workspace/public/pm/cozy-board.css +5 -28
- package/workspace/public/pm/cozy-evui.js +4 -2
- package/workspace/public/pm/cozy-home-rows.css +54 -0
- package/workspace/public/pm/cozy-home.css +9 -0
- package/workspace/public/pm/cozy-insights.css +1 -2
- package/workspace/public/pm/cozy-mtg-present.css +160 -0
- package/workspace/public/pm/cozy-panel.css +11 -34
- package/workspace/public/pm/cozy-rec-pill.css +12 -0
- package/workspace/public/pm/cozy-rec-pill.js +46 -0
- package/workspace/public/pm/cozy-viewer.js +307 -43
- package/workspace/public/pm/cozy-vw-mtg.css +96 -94
- package/workspace/public/pm/cozy-vw-rp.css +40 -25
- package/workspace/public/pm/cozy-vw-shell.css +127 -0
- package/workspace/public/pm/cozy-xv.css +51 -0
- package/workspace/public/pm/cozy-xv.js +34 -0
- package/workspace/public/pm/home-app.js +122 -58
- package/workspace/public/pm/home-chat.js +11 -2
- package/workspace/public/pm/home-day.js +64 -0
- package/workspace/public/pm/home-ini-model.js +1 -1
- package/workspace/public/pm/home-ini.js +197 -54
- package/workspace/public/pm/home-list.js +6 -14
- package/workspace/public/pm/home-mentions.js +187 -0
- package/workspace/public/pm/home-rec-row.js +67 -0
- package/workspace/public/pm/home-review.js +20 -10
- package/workspace/public/pm/home-task.js +19 -18
- package/workspace/public/pm/home-today.js +3 -3
- package/workspace/public/pm/premium-board.js +73 -235
- package/workspace/public/pm/premium-insights.js +118 -82
- package/workspace/public/pm/premium-mtg-present.js +408 -100
- package/workspace/public/pm/premium-mtg-replay.js +70 -10
- package/workspace/public/pm/premium-report-read.js +118 -63
- package/workspace/public/pm/premium-vw-cal.js +62 -34
- package/workspace/public/pm/premium-vw-mtg.js +348 -192
- package/workspace/public/pm/rec-state.js +63 -0
- package/workspace/public/pm/rp-parts.js +33 -8
- package/workspace/public/pm/tk-draft.js +107 -0
- package/workspace/public/pm/tk-model.js +134 -0
- package/workspace/public/pm/tk-send.js +124 -0
- package/workspace/public/pm/tk-tasks.css +120 -0
- package/workspace/public/premium-board.html +0 -1
- package/workspace/server.js +4 -2
- package/workspace/skills/jira-push.skill +3 -3
- package/workspace/test-lists/prd-to-jira.json +6 -0
- package/workspace/test-lists/viewer-home-rows.json +9 -0
- package/workspace/test-lists/viewer-meetings.json +9 -0
- package/workspace/test-lists/viewer-shell-a.json +15 -0
- package/workspace/tk-tasks-test.js +199 -0
|
@@ -35,26 +35,53 @@ export function dueText(due, now = Date.now()) {
|
|
|
35
35
|
}
|
|
36
36
|
const RAISED_CATS = new Set(['statement', 'decision', 'action', 'todo', 'question']);
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/* What PMOS learns from a correction (XvAReplayEdit): the same rule as lib/meeting-learn.js phraseOf and mentions, so the page can say
|
|
39
|
+
* what it will remember while the PM types. premium-uncovered-meetings.test.js checks the two agree. */
|
|
40
|
+
const STOP = new Set(('a an and are as at be but by can could did do does for from had has have how i if in into is it its may might must no not of on or our '
|
|
41
|
+
+ 'shall should so than that the their them then there these they this those to too us was we were what when where which who why will with would you your '
|
|
42
|
+
+ 'yes ok okay also just still more less very much some any all each both other same new old next last first one two three').split(' '));
|
|
43
|
+
const words = (s) => (String(s || '').toLowerCase().match(/[\p{L}\p{N}][\p{L}\p{N}.'-]*/gu) || []).map((w) => w.replace(/[.'-]+$/, '')).filter(Boolean);
|
|
44
|
+
const content = (w) => w.length > 2 && !STOP.has(w);
|
|
45
|
+
export function phraseOf(before, after) {
|
|
46
|
+
const a = words(before), b = words(after);
|
|
47
|
+
if (!a.length || !b.length) return '';
|
|
48
|
+
const inA = new Set();
|
|
49
|
+
for (let n = 1; n <= 4; n++) for (let i = 0; i + n <= a.length; i++) inA.add(a.slice(i, i + n).join(' '));
|
|
50
|
+
let best = '', bestN = 0;
|
|
51
|
+
for (let n = 4; n >= 1; n--) {
|
|
52
|
+
for (let i = 0; i + n <= b.length; i++) { const run = b.slice(i, i + n); if (!content(run[0]) || !content(run[n - 1])) continue; const g = run.join(' '); if (inA.has(g)) { best = g; bestN = n; } }
|
|
53
|
+
if (bestN) break;
|
|
54
|
+
}
|
|
55
|
+
return best;
|
|
56
|
+
}
|
|
57
|
+
export const mentions = (text, phrase) => !!phrase && (' ' + words(text).join(' ') + ' ').includes(' ' + phrase + ' ');
|
|
58
|
+
export const KIND_OF = { decision: 'Decision', question: 'Question', action: 'Action' };
|
|
59
|
+
|
|
60
|
+
/** The view model of the Replay tab. edits: the PM's corrections ({ [pointId]: { kind, text, orig } }); lessons: what PMOS learned. */
|
|
61
|
+
export function replayView(rep, { n = null, points = {}, edits = {}, lessons = [], now = Date.now() } = {}) {
|
|
40
62
|
if (!rep) return null;
|
|
41
63
|
const raw = Array.isArray(rep.raw) ? rep.raw : [];
|
|
42
64
|
const rawOf = (k) => raw.find((x) => x && (x.id === k.id || (x.k === k.k && x.text === k.text))) || k;
|
|
43
65
|
const lineAt = (t) => { if (t == null) return null; let best = null; for (const l of rep.lines) if (best === null || Math.abs(l.t - t) < Math.abs(best.t - t)) best = l; return best && Math.abs(best.t - t) <= NEAR ? best : null; };
|
|
44
66
|
const all = rep.keys.map((k) => {
|
|
45
|
-
const r = rawOf(k), state = r.state || k.state || '', owner = clip(r.owner || k.owner, 40), line = lineAt(k.t);
|
|
67
|
+
const r = rawOf(k), ed = edits[k.id] || null, state = ed ? '' : r.state || k.state || '', owner = clip(r.owner || k.owner, 40), line = lineAt(k.t);
|
|
46
68
|
const quote = line ? clip(line.who, 30) + ': “' + clip(line.text, 90) + '”' : '';
|
|
47
|
-
const
|
|
69
|
+
const kind0 = k.k === 'action' ? 'action' : k.k === 'question' ? 'question' : 'decision';
|
|
70
|
+
const kind = ed && KIND[ed.kind] ? ed.kind : kind0;
|
|
48
71
|
let keep = true, why = '';
|
|
49
|
-
if (kind === 'action' && !owner) { keep = false; why = 'nobody took it on'; }
|
|
72
|
+
if (!ed && kind === 'action' && !owner) { keep = false; why = 'nobody took it on'; }
|
|
50
73
|
if (kind === 'question' && state === 'answered') { keep = false; why = 'answered in the meeting'; }
|
|
51
|
-
const verdict = points[k.id] || '';
|
|
74
|
+
const verdict = points[k.id] || (ed ? 'confirmed' : ''); // a correction is the PM saying what was really said
|
|
52
75
|
if (verdict === 'wrong') { keep = false; why = 'you marked it not right'; }
|
|
53
76
|
const ev = kind === 'question'
|
|
54
77
|
? [quote || (r.by ? 'Asked by ' + clip(r.by, 30) : ''), state === 'open' ? 'No answer at the end' : ''].filter(Boolean).join(' · ')
|
|
55
78
|
: [quote, owner ? (kind === 'action' ? owner + (r.due || k.due ? ' · ' + dueText(r.due || k.due, now) : '') : 'owner ' + owner) : ''].filter(Boolean).join(' · ');
|
|
56
|
-
|
|
57
|
-
|
|
79
|
+
const text = clip(ed ? ed.text : k.text, 200);
|
|
80
|
+
const lesson = !ed ? (lessons || []).find((x) => x && x.phrase && !(x.note === (rep.noteId || (n && n.id)) && x.point === k.id) && mentions(text, x.phrase)) : null;
|
|
81
|
+
return { id: k.id, kind, label: KIND[kind].label, pill: KIND[kind].pill, text, quote: ev, t: k.t, time: k.t == null ? '' : mmss(k.t), open: kind === 'question' && state === 'open',
|
|
82
|
+
owner, due: r.due || k.due || '', keep, why, verdict, at: k.t == null ? null : Math.min(100, Math.max(0, k.t / rep.len * 100)),
|
|
83
|
+
edited: !!ed, orig: ed && ed.orig ? { kind: ed.orig.kind || kind0, text: clip(ed.orig.text, 200) } : { kind: kind0, text: clip(k.text, 200) },
|
|
84
|
+
check: lesson ? { phrase: lesson.phrase, meaning: clip(lesson.meaning, 200) } : null, by: clip(r.by || owner || (line && line.who) || '', 40) };
|
|
58
85
|
});
|
|
59
86
|
const kept = all.filter((x) => x.keep);
|
|
60
87
|
/* what else was raised: the live transcript's remarks (a statement, a proposal, a question) that no key point was caught from */
|
|
@@ -71,7 +98,7 @@ export function replayView(rep, { n = null, points = {}, now = Date.now() } = {}
|
|
|
71
98
|
const shots = rep.shots.map((s, i) => ({ i, t: s.t, time: mmss(s.t), why: clip(s.why, 80), who: whoAt(s.t) }));
|
|
72
99
|
return {
|
|
73
100
|
len: rep.len, lenText: mmss(rep.len), noteId: rep.noteId || (n && n.id) || '', audio: rep.audio, strip, shots,
|
|
74
|
-
points: kept, left, raised,
|
|
101
|
+
points: kept, left, raised, toConfirm: kept.filter((x) => !x.verdict).length,
|
|
75
102
|
seg: [['all', 'All', kept.length], ['decision', 'Decided', count('decision')], ['action', 'To do', count('action')], ['question', 'Open', count('question')]],
|
|
76
103
|
keptLine: raised > kept.length ? 'Kept ' + kept.length + ' of ' + raised + ' raised: ' + KEPT_WHY : kept.length ? 'Kept ' + kept.length + ': ' + KEPT_WHY : 'Nothing was agreed, owned or left open',
|
|
77
104
|
leftLine: left.length ? 'Left out · ' + left.length + (left.length === 1 ? ' remark' : ' remarks') : '',
|
|
@@ -104,13 +131,46 @@ export function playerHtml(V, ui = {}) {
|
|
|
104
131
|
return `<div class="vzp-pl" role="group" aria-label="Replay">${cap ? `<div class="vzp-pr">${cap}<div class="vzp-pc">${ctl}${thumbs}</div></div>` : `<div class="vzp-pc">${ctl}${thumbs}</div>`}${strip}</div>`;
|
|
105
132
|
}
|
|
106
133
|
|
|
134
|
+
/** One kept point as a row the PM can press to correct it (XvAReplay "In this part"). */
|
|
135
|
+
function pointRow(p, ui) {
|
|
136
|
+
if (ui.edit === p.id) return editHtml(p, ui.draft || {}, ui.also || 0);
|
|
137
|
+
const meta = [p.time, p.by, p.kind === 'action' && p.due ? dueText(p.due) : '', p.open ? 'open' : ''].filter(Boolean).join(' · ');
|
|
138
|
+
return `<button type="button" class="vzp-pt" data-a="pedit" data-id="${esc(p.id)}" title="Fix its kind or its words"><span class="vzp-pill" data-k="${p.pill}">${KIND_OF[p.kind]}</span><span class="vzp-kt"><b>${esc(p.text)}</b><small>${esc(meta)}</small>`
|
|
139
|
+
+ (p.check ? `<small class="vzp-chk2">Check: you said “${esc(p.check.phrase)}” means ${esc(p.check.meaning)}</small>` : '') + '</span></button>';
|
|
140
|
+
}
|
|
141
|
+
const stop = (t) => (/[.!?…”]$/.test(t) ? t : t + '.');
|
|
142
|
+
/** The correction (XvAReplayEdit): the kind, the old words struck, the new words, what PMOS will remember, Cancel and Save.
|
|
143
|
+
* d = { kind, text, learn }; also = how many other points of this note use the learned words. */
|
|
144
|
+
export function editHtml(p, d = {}, also = 0) {
|
|
145
|
+
const kind = d.kind || p.kind, text = d.text == null ? p.text : d.text, learn = d.learn !== false;
|
|
146
|
+
const changed = kind !== p.orig.kind || text.trim() !== p.orig.text;
|
|
147
|
+
const phrase = phraseOf(p.orig.text, text);
|
|
148
|
+
const lessonText = !changed ? 'Change the kind or the words, and PMOS remembers what you meant for the next notes.'
|
|
149
|
+
: !learn ? 'Only this point is fixed. PMOS learns nothing from it.'
|
|
150
|
+
: (phrase ? '“' + phrase + '” means: ' + stop(clip(text, 140)) + ' ' : 'This correction goes into the next notes. ') + (also ? (also === 1 ? '1 more point' : also + ' more points') + ' in this note say' + (also === 1 ? 's' : '') + ' the same thing; I will mark ' + (also === 1 ? 'it' : 'them') + ' for you to check. ' : '') + 'Future notes use it as well.';
|
|
151
|
+
return `<div class="vzp-ed" role="group" aria-label="Fix this point"><div class="vzp-kinds" role="radiogroup" aria-label="Kind">${['decision', 'question', 'action'].map((k) => `<button type="button" role="radio" aria-checked="${k === kind}" data-a="ekind" data-k="${k}" data-pk="${KIND[k].pill}">${KIND_OF[k]}</button>`).join('')}</div>`
|
|
152
|
+
+ (changed ? `<p class="vzp-was"><s>${esc(KIND_OF[p.orig.kind] + ' · ' + p.orig.text)}</s></p>` : '')
|
|
153
|
+
+ `<textarea class="vzp-eta" data-a="etext" rows="3" aria-label="What was really said">${esc(text)}</textarea>`
|
|
154
|
+
+ `<div class="vzp-learn"><b>${learn && changed ? 'I will remember this.' : ''}</b> <span data-pl="lesson">${esc(lessonText)}</span>${changed ? ` <button type="button" class="vzp-link" data-a="elearn" aria-pressed="${!learn}">${learn ? 'Only fix this one' : 'Remember it'}</button>` : ''}</div>`
|
|
155
|
+
+ `<div class="vzp-ef"><span class="vzp-mut vzp-sm">${esc([p.time, p.by].filter(Boolean).join(' · '))}</span><span class="vzp-sp"></span><button type="button" class="vzp-gbtn" data-a="ecancel">Cancel</button><button type="button" class="vzp-dark" data-a="esave"${changed && text.trim() ? '' : ' disabled'}>Save</button></div></div>`;
|
|
156
|
+
}
|
|
157
|
+
/** "In this part · <topic>": the kept points said in the stretch the replay is in. */
|
|
158
|
+
export function partHtml(V, ui = {}) {
|
|
159
|
+
const pos = ui.pos || 0, st = V.stretchAt(pos);
|
|
160
|
+
const rows = V.points.filter((p) => p.t != null && st && p.t >= st.from && p.t < st.to);
|
|
161
|
+
if (!rows.length) return ''; // zero is silence: a part with nothing kept says nothing
|
|
162
|
+
return `<p class="vzp-lbl">In this part${st && st.text ? ' · ' + esc(st.text) : ''}</p><div class="vzp-pts">${rows.map((p) => pointRow(p, ui)).join('')}</div>`;
|
|
163
|
+
}
|
|
164
|
+
/** Every kept point as a row to press (the "All N kept" fold): grouped as the filter says, the bulk bar for the ticked, Left out. */
|
|
165
|
+
export function keptHtml(V, ui = {}) { return pointsHtml(V, { ...ui, rows: true }); }
|
|
166
|
+
|
|
107
167
|
/** The kept points, desktop: filter, the kept line, the bulk bar, the rows, the Left out fold. */
|
|
108
168
|
export function pointsHtml(V, ui = {}) {
|
|
109
169
|
const f = ui.filter || 'all', sel = ui.sel || new Set(), rows = V.points.filter((p) => f === 'all' || p.kind === f);
|
|
110
170
|
const h = [];
|
|
111
171
|
h.push(`<div class="vzp-fl"><div class="vzp-seg" role="group" aria-label="Show">${V.seg.map(([k, l, c]) => `<button type="button" data-a="pf" data-k="${k}" aria-pressed="${f === k}">${esc(l + ' ' + c)}</button>`).join('')}</div><span class="vzp-mut vzp-sm">${esc(V.keptLine)}</span></div>`);
|
|
112
172
|
if (sel.size) h.push(`<div class="vzp-bulk" role="toolbar" aria-label="The ticked points"><b>${sel.size} selected</b><button type="button" data-a="bulk" data-k="task">Make tasks</button><button type="button" data-a="bulk" data-k="confirmed">Confirm</button><button type="button" data-a="bulk" data-k="wrong" class="vzp-gh">Not right</button></div>`);
|
|
113
|
-
h.push(`<div class="vzp-kl">${rows.length ? rows.map((p) => `<div class="vzp-kr${sel.has(p.id) ? ' sel' : ''}"><button type="button" class="vzp-chk" role="checkbox" aria-checked="${sel.has(p.id)}" data-a="tick" data-id="${esc(p.id)}" aria-label="${esc('Tick: ' + p.text)}">${sel.has(p.id) ? ic('chk', 12) : ''}</button><span class="vzp-pill" data-k="${p.pill}">${p.label}</span><
|
|
173
|
+
h.push(`<div class="vzp-kl">${rows.length ? rows.map((p) => ui.edit === p.id ? editHtml(p, ui.draft || {}, ui.also || 0) : `<div class="vzp-kr${sel.has(p.id) ? ' sel' : ''}"><button type="button" class="vzp-chk" role="checkbox" aria-checked="${sel.has(p.id)}" data-a="tick" data-id="${esc(p.id)}" aria-label="${esc('Tick: ' + p.text)}">${sel.has(p.id) ? ic('chk', 12) : ''}</button><span class="vzp-pill" data-k="${p.pill}">${p.label}</span><button type="button" class="vzp-kt" data-a="pedit" data-id="${esc(p.id)}" title="Fix its kind or its words"><p><b>${esc(p.text)}</b>${p.verdict === 'confirmed' ? ' <span class="vzp-conf">' + ic('chk', 12) + (p.edited ? 'Fixed' : 'Confirmed') + '</span>' : ''}</p>${p.quote ? `<p class="vzp-q">${esc(p.quote)}</p>` : ''}${p.check ? `<p class="vzp-q vzp-chk2">Check: you said “${esc(p.check.phrase)}” means ${esc(p.check.meaning)}</p>` : ''}</button>${p.time ? `<button type="button" class="vzp-tm${p.open ? ' risk' : ''}" data-a="seekto" data-t="${p.t}" aria-label="Play from ${p.time}">${p.time}</button>` : '<span></span>'}</div>`).join('')
|
|
114
174
|
: `<p class="vzp-empty">${V.points.length ? 'No point of this kind was kept.' : 'Nothing was agreed, owned or left open in this meeting.'}</p>`}</div>`);
|
|
115
175
|
if (V.left.length) {
|
|
116
176
|
h.push(`<button type="button" class="vzp-left" data-a="leftout" aria-expanded="${!!ui.leftOpen}">${ic('chev', 14)}<b>${esc(V.leftLine)}</b><span>${esc(V.leftEg)}</span></button>`);
|
|
@@ -42,10 +42,11 @@
|
|
|
42
42
|
* (Read again: a redraft that keeps the notes; Start the next cycle without a template), /api/report-setups/draft (Start the next cycle),
|
|
43
43
|
* /api/report-design/revert (Go back to it). */
|
|
44
44
|
import { pmGet, pmPost } from './http.js';
|
|
45
|
-
import { open as vOpen, current as vCur } from './cozy-viewer.js';
|
|
45
|
+
import { open as vOpen, current as vCur, czSummary } from './cozy-viewer.js';
|
|
46
|
+
import * as MP from './premium-mtg-present.js'; // the one presenter window for every kind (canvas note xvPresent)
|
|
46
47
|
import { placeholderHtml } from './cozy-placeholder.js';
|
|
47
48
|
import './premium-vw-open.js'; // registers window.czViews
|
|
48
|
-
import { cycleGroups, cycleName, briefModel, briefHtml, paperModel, paperHtml, liveModel, liveHtml, presentHtml, dayMon } from './rp-parts.js';
|
|
49
|
+
import { cycleGroups, cycleName, briefModel, briefHtml, paperModel, paperHtml, liveModel, liveHtml, presentHtml, dayMon, reportSummary } from './rp-parts.js';
|
|
49
50
|
|
|
50
51
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
51
52
|
const svg = (p, n = 18) => `<svg viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true">${p}</svg>`;
|
|
@@ -56,7 +57,7 @@ const P = {
|
|
|
56
57
|
more: '<circle cx="5" cy="12" r="1.6"/><circle cx="12" cy="12" r="1.6"/><circle cx="19" cy="12" r="1.6"/>', clock: '<circle cx="12" cy="12" r="8"/><path d="M12 8v4l3 2"/>',
|
|
57
58
|
brief: '<path d="M6 3h9l4 4v14H6zM14 3v5h5M9 12h7M9 16h5"/>', slides: '<rect x="3" y="5" width="18" height="12" rx="1.5"/><path d="M8 21h8M12 17v4"/>',
|
|
58
59
|
page: '<path d="M6 3h9l4 4v14H6zM14 3v5h5"/>', print: '<path d="M7 9V4h10v5M7 17H5v-6h14v6h-2M8 14h8v6H8z"/>', hist: '<path d="M3 12a9 9 0 1 0 3-6.7L3 8M3 3v5h5M12 7v5l3 2"/>',
|
|
59
|
-
bin: '<path d="M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13"/>', box: '<path d="M4 5h16v4H4zM5 9v10h14V9M10 13h4"/>', lock: '<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/>',
|
|
60
|
+
warn: '<path d="M12 4l9 16H3zM12 10v4M12 17h.01"/>', bin: '<path d="M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13"/>', box: '<path d="M4 5h16v4H4zM5 9v10h14V9M10 13h4"/>', lock: '<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V8a4 4 0 0 1 8 0v3"/>',
|
|
60
61
|
redo2: '<path d="M20 11a8 8 0 1 0-2.3 5.7M20 4v7h-7"/>', undo: '<path d="M9 14 4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3"/>', redo: '<path d="m15 14 5-5-5-5M20 9H9a5 5 0 0 0 0 10h3"/>',
|
|
61
62
|
plus: '<path d="M12 5v14M5 12h14"/>', dl: '<path d="M12 4v11M7 10l5 5 5-5M5 20h14"/>', live: '<path d="M3 17l5-5 4 4 8-8M16 8h4v4"/>', layout: '<rect x="4" y="4" width="16" height="16" rx="2"/><path d="M4 10h16M10 10v10"/>',
|
|
62
63
|
theme: '<path d="M12 3a9 9 0 1 0 0 18c1 0 1.5-.8 1.5-1.6 0-1-.8-1.4-.8-2.4 0-1 .8-1.6 1.8-1.6H17a4 4 0 0 0 4-4c0-4.6-4-8.4-9-8.4z"/><circle cx="7.5" cy="11" r="1"/><circle cx="10.5" cy="7.5" r="1"/><circle cx="15" cy="7.5" r="1"/>',
|
|
@@ -194,20 +195,12 @@ export function slideCard(s, mini) {
|
|
|
194
195
|
/* ── drawing ── */
|
|
195
196
|
const chip = (k, inner, a, o = {}) => `<button type="button" class="vz-c vz-hv${o.cls || ''}" data-r="${a}"${k ? ` data-k="${k}"` : ''}${o.exp != null ? ` aria-haspopup="${o.pop || 'menu'}" aria-expanded="${o.exp}"` : ''}${o.label ? ` aria-label="${esc(o.label)}"` : ''}>${inner}</button>`;
|
|
196
197
|
const ib = (a, icon, name, o = {}) => `<button type="button" class="vz-ib vz-hv${o.cls || ''}" data-r="${a}" aria-label="${esc(name)}" title="${esc(name)}"${o.exp != null ? ` aria-haspopup="${o.pop || 'menu'}" aria-expanded="${o.exp}"` : ''}${o.off ? ' disabled' : ''}>${icon}</button>`;
|
|
198
|
+
/** While editing: the orange "Editing the Oct 21 draft" chip, which opens the cycle menu. */
|
|
197
199
|
function chipsHtml() {
|
|
198
200
|
const when = shortSlot(R.row.slot || R.row.date);
|
|
199
|
-
|
|
200
|
-
const st = R.issued ? (R.archived ? 'Archived' : 'Issued') : 'Draft';
|
|
201
|
-
const sched = R.setup === undefined ? '' : chip(R.pop === 'sched' ? 'open' : '', `${ic('clock', 14)}${esc(schedLabel(R.setup))}${ic('chev', 14)}`, 'sched', { exp: R.pop === 'sched', pop: 'dialog', label: 'Schedule: ' + schedLabel(R.setup) + '. Change it' });
|
|
202
|
-
return `<div class="vz-rpc">${chip(R.issued ? 'issued' : '', `<i aria-hidden="true"></i>${st} · ${esc(when)}${ic('chev', 14)}`, 'cycm', { exp: R.pop === 'cyc', label: st + ', ' + when + '. Other cycles' })}`
|
|
203
|
-
+ `${sched}${R.pop === 'sched' ? schedPop() : R.pop === 'cyc' ? cycPop() : ''}</div>`;
|
|
204
|
-
}
|
|
205
|
-
/** Report | Brief (RpBrief). Brief carries the count of what waits for the PM's confirm. */
|
|
206
|
-
function tabsHtml() {
|
|
207
|
-
const n = R.BF ? R.BF.count : 0;
|
|
208
|
-
return `<div class="cz-tabs rp-tabs" role="tablist" aria-label="Report or its brief"><button type="button" role="tab" class="cz-tab" data-r="tab|report" aria-selected="${R.tab === 'report'}">Report</button>`
|
|
209
|
-
+ `<button type="button" role="tab" class="cz-tab" data-r="tab|brief" aria-selected="${R.tab === 'brief'}">Brief${n ? ` <span class="cz-pill late rp-n" aria-label="${n} to confirm">${n}</span>` : ''}</button></div>`;
|
|
201
|
+
return `<div class="vz-rpc">${chip('edit', `<i aria-hidden="true"></i>Editing the ${esc(when)} draft${ic('chev', 14)}`, 'cycm', { exp: R.pop === 'cyc' })}${R.pop === 'cyc' ? cycPop() : ''}</div>`;
|
|
210
202
|
}
|
|
203
|
+
/** The edit bar (the report panel's edit mode): Slides | Page, the slide tools, Cancel and Save. */
|
|
211
204
|
function toolHtml() {
|
|
212
205
|
const sb = (k, icon, l, cls) => `<button type="button" data-r="view|${k}" aria-pressed="${R.view === k}" aria-label="${l}" title="${l}"${cls ? ` class="${cls}"` : ''}>${ic(icon, 16)}<span class="vz-dko">${l}</span></button>`;
|
|
213
206
|
const seg = `<div class="vz-sg" role="group" aria-label="${R.edit ? 'Edit as' : 'Read as'}">${sb('deck', 'slides', 'Slides')}${sb('doc', 'page', R.edit ? 'Page' : 'Document')}${R.edit ? '' : sb('live', 'live', 'Live page', 'vz-dko')}</div>`;
|
|
@@ -219,19 +212,14 @@ function toolHtml() {
|
|
|
219
212
|
+ ib('ed|layout', ic('layout'), 'Layout') + ib('ed|theme', ic('theme'), 'Theme') : seg}<span class="vz-sp"></span>`
|
|
220
213
|
+ `<button type="button" class="vz-sec2 vz-hv" data-r="edcancel">Cancel</button>${deck ? `<button type="button" class="vz-issue vz-hv" data-r="edsave"${R.busy ? ' disabled' : ''}>Save</button>` : ''}${R.pop === 'ins' ? insPop() : ''}</div>`;
|
|
221
214
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
+ ib('present', ic('play'), 'Present', { cls: ' vz-dko' }) + ib('share', ic('share'), 'Share a link to a copy', { cls: ' vz-dko', exp: R.pop === 'share', pop: 'dialog' })
|
|
226
|
-
+ ib('dlm', ic('dl'), 'Download', { cls: ' vz-dko', exp: R.pop === 'dl' })
|
|
227
|
-
+ (issue ? '<span class="vz-sep vz-dko"></span>' + issue : '') + ib('more', ic('more'), 'More', { exp: R.pop === 'more' })
|
|
228
|
-
+ (R.pop === 'more' ? morePop() : R.pop === 'share' ? sharePop() : R.pop === 'dl' ? dlPop() : '') + '</div>';
|
|
229
|
-
}
|
|
230
|
-
/** Download (RpDoc): the paper as PDF (the browser prints it) or Word. The other files stay in More. */
|
|
215
|
+
return '';
|
|
216
|
+
}
|
|
217
|
+
/** Download (under ⋯, XvAReportMore "Download · PPTX, PDF…"): every file the report exports, then Print. PDF keeps the look. */
|
|
231
218
|
function dlPop() {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
+ `<
|
|
219
|
+
const fmt = (k, l) => (k === 'pdf' || k === 'md' ? `<button type="button" class="vz-fmt" data-r="${k}">${l}</button>` : `<a class="vz-fmt" data-r="dl|${k}" href="/api/report-export?${esc(q({ ws: R.ws, path: R.row.path, fmt: k }))}" download>${l}</a>`);
|
|
220
|
+
return `<div class="vz-pop vz-pop-dl" data-esc-layer="1" role="menu" aria-label="Download"><p class="vz-lab">Download</p>`
|
|
221
|
+
+ `<div class="vz-fmts">${fmt('pptx', 'PPTX')}${fmt('docx', 'DOCX')}${fmt('pdf', 'PDF')}${fmt('xlsx', 'XLSX')}${fmt('csv', 'CSV')}${fmt('md', 'MD')}</div>`
|
|
222
|
+
+ `<p class="vz-note vz-padmi">Slides as PowerPoint, words as Word or Markdown, tables as Excel or CSV. PDF keeps the look.</p><hr>${mi('print', 'print', 'Print')}</div>`;
|
|
235
223
|
}
|
|
236
224
|
function schedPop() {
|
|
237
225
|
const k = R.sch, opts = [['weekly', 'Every week'], ['bi-weekly', 'Every 2 weeks'], ['monthly', 'Every month, on the 1st'], ['else', 'Something else: say it in the chat']];
|
|
@@ -257,15 +245,33 @@ function cycPop() {
|
|
|
257
245
|
+ G.map((g) => `<p class="vz-lab">${g.t}</p>` + g.rows.map((x) => row(x, g.k)).join('')).join('')
|
|
258
246
|
+ (R.issued && !R.archived && !R.edit ? `<hr><button type="button" class="vz-mi vz-hv" role="menuitem" data-r="archive">${ic('box')}Archive ${esc(cycleName(R.row, R.id))}</button>` : '') + '</div>';
|
|
259
247
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
248
|
+
/**
|
|
249
|
+
* What ⋯ holds (canvas note xvMore, XvAReportMore), in its order: change it, look back, stop or remove (red, last). The card's one primary is
|
|
250
|
+
* never repeated here: a draft's Issue, an issued cycle's Share, an archived cycle's Bring back. Each item is { r, label, note, danger } or
|
|
251
|
+
* { sep }; r is the press, the same one the panel's own buttons send.
|
|
252
|
+
*/
|
|
253
|
+
export function moreItems(o) {
|
|
254
|
+
if (o.edit) return [];
|
|
255
|
+
const L = [], n = o.cycles || 1, sched = o.schedule && o.schedule !== 'Not scheduled' ? o.schedule.replace(/\s\d{2}:\d{2}$/, '') : '';
|
|
256
|
+
if (!o.issued) L.push({ r: 'share', label: 'Share', note: 'Link or file' });
|
|
257
|
+
if (!o.archived) L.push({ r: 'sched', label: 'Schedule', note: sched });
|
|
258
|
+
if (!o.issued) L.push({ r: 'edit', label: 'Edit' }); else if (!o.archived) L.push({ r: 'nextcyc', label: 'Start the next cycle' });
|
|
259
|
+
L.push({ r: 'present', label: 'Present' });
|
|
260
|
+
if (o.view !== 'deck') L.push({ r: 'view|deck', label: 'Read as slides' });
|
|
261
|
+
if (o.view !== 'doc') L.push({ r: 'view|doc', label: 'Read as a page' });
|
|
262
|
+
if (o.view !== 'live') L.push({ r: 'view|live', label: 'Live numbers' });
|
|
263
|
+
L.push({ sep: true }, { r: 'dlm', label: 'Download', note: 'PPTX, PDF…' }, { r: 'cycm', label: 'Versions', note: n + (n === 1 ? ' cycle' : ' cycles') },
|
|
264
|
+
{ r: 'tab|brief', label: 'Brief', note: o.confirm ? o.confirm + ' to confirm' : '' });
|
|
265
|
+
if (!o.issued) L.push({ sep: true }, { r: 'discard', label: 'Discard this draft', danger: true });
|
|
266
|
+
else if (!o.archived) L.push({ sep: true }, { r: 'archive', label: 'Archive this cycle', danger: true });
|
|
267
|
+
return L;
|
|
268
|
+
}
|
|
269
|
+
const menuOf = () => moreItems({ edit: R.edit, issued: R.issued, archived: R.archived, schedule: R.setup === undefined ? '' : schedLabel(R.setup), view: R.view, cycles: R.cycles.length, confirm: R.BF ? R.BF.count : 0 });
|
|
270
|
+
/** Shell A's ⋯ (open({ more })) reads the list when it opens, so the list is refilled in place as the cycle changes: one array per report. */
|
|
271
|
+
function syncMore() {
|
|
272
|
+
if (!R) return;
|
|
273
|
+
const L = menuOf().map((x) => (x.sep ? { sep: true } : { label: x.label, note: x.note, danger: x.danger, on: () => { if (R) act(x.r.split('|')); } }));
|
|
274
|
+
R.more.length = 0; R.more.push(...L);
|
|
269
275
|
}
|
|
270
276
|
const mi = (a, i, l) => `<button type="button" class="vz-mi vz-hv" role="menuitem" data-r="${a}">${ic(i)}${esc(l)}</button>`;
|
|
271
277
|
function insPop() {
|
|
@@ -303,10 +309,10 @@ function confHtml() {
|
|
|
303
309
|
const C = R.checks;
|
|
304
310
|
const list = !C ? '<li><span>…</span><span>Checking the sources, the sections and the figures.</span></li>'
|
|
305
311
|
: !C.ok ? `<li data-ok="false"><span>!</span><span>The checks could not run: ${esc(C.error || 'no answer')}</span></li>`
|
|
306
|
-
: C.checks.map((c) => `<li data-ok="${!!c.ok}"><span>${c.ok ? '
|
|
307
|
-
return `<div class="vz-conf" role="group" aria-label="Issue this cycle"><b
|
|
312
|
+
: C.checks.map((c) => `<li data-ok="${!!c.ok}"><span>${c.ok ? ic('check', 15) : ic('warn', 15)}</span><span>${esc(c.text)}</span></li>`).join('');
|
|
313
|
+
return `<div class="vz-conf rp-cfm" role="group" aria-label="Issue this cycle"><b>Issue the ${esc(shortSlot(R.row.slot || R.row.date))} cycle?</b><ul>${list}</ul><p class="vz-note">Issuing freezes the words and the look. Nothing is sent: you share it yourself.</p>`
|
|
308
314
|
+ (R.issueErr ? `<p class="vz-msg" data-tone="bad" role="alert">${esc(R.issueErr)}</p>` : '')
|
|
309
|
-
+ `<div><button type="button" class="
|
|
315
|
+
+ `<div class="czs-acts"><button type="button" class="czs-pri" data-r="issueok"${R.busy ? ' disabled' : ''}>Issue it</button><button type="button" class="rp-sec vz-hv" data-r="issueno"${R.busy ? ' disabled' : ''}>Not yet</button></div></div>`;
|
|
310
316
|
}
|
|
311
317
|
return '';
|
|
312
318
|
}
|
|
@@ -321,25 +327,28 @@ function askHtml() {
|
|
|
321
327
|
+ (R.askErr ? `<p class="vz-msg" data-tone="bad" role="alert">${esc(R.askErr)}</p>` : '')
|
|
322
328
|
+ `<div><button type="button" class="rp-btn${R.ask === 'discard' ? ' bad' : ' dark'}" data-r="askok"${R.busy ? ' disabled' : ''}>${esc(T[2])}</button><button type="button" class="rp-btn" data-r="askno">Keep it</button></div></div>`;
|
|
323
329
|
}
|
|
324
|
-
/** The
|
|
325
|
-
function
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
330
|
+
/** The summary card (XvAReport, XvAReportDoc): what this cycle is and the one thing to do with it. */
|
|
331
|
+
function sumHtml() {
|
|
332
|
+
const w = R.W || { sections: [] }, f = headFigure(w), P = R.view === 'doc' && !R.cyc ? paperModel(w, {}) : null;
|
|
333
|
+
const S = reportSummary({ state: R.archived ? 'archived' : R.issued ? 'issued' : 'draft', slot: R.row.slot || R.row.date, path: R.row.path,
|
|
334
|
+
purpose: R.setup && R.setup.purpose, sub: w.sub, schedule: R.setup ? schedLabel(R.setup).replace(/^Not scheduled$/, '') : '', dataFrom: f && f.data,
|
|
335
|
+
shares: R.shares, nextDraft: R.setup && R.setup.status !== 'paused' && R.setup.next_draft ? String(R.setup.next_draft).slice(0, 10) : '',
|
|
336
|
+
view: R.view, slides: R.view === 'deck' ? slides().length : 0, pages: P ? P.n : 0, foot: !!(P && P.foot) });
|
|
337
|
+
return czSummary({ line: S.line, tone: S.tone, text: S.text, meta: S.meta, primary: { label: S.primary.label, act: S.primary.r, disabled: R.busy } });
|
|
329
338
|
}
|
|
330
339
|
function deckHtml() {
|
|
331
340
|
const L = slides();
|
|
332
|
-
if (!L.length) return '<p class="vz-empty">This cycle has no slides. Read it as a
|
|
341
|
+
if (!L.length) return '<p class="vz-empty">This cycle has no slides. Read it as a page.</p>';
|
|
333
342
|
const i = R.i = Math.max(0, Math.min(R.i, L.length - 1));
|
|
334
343
|
return `<div class="vz-slide" tabindex="0" role="group" aria-roledescription="slide" aria-label="Slide ${i + 1} of ${L.length}: ${esc(L[i].h)}. Use the arrow keys to change slide." data-r="slide">${slideCard(L[i])}</div>`
|
|
335
|
-
+ `<div class="
|
|
336
|
-
+ `<
|
|
337
|
-
+
|
|
344
|
+
+ `<div class="rp-strip">${ib('prev', ic('prev', 17), 'Previous slide', { off: i === 0 })}<div class="vz-thumbs rp-thumbs" role="group" aria-label="Slides">`
|
|
345
|
+
+ L.map((x, j) => `<button type="button" class="vz-th rp-th${x.k === 'title' ? ' rp-tt' : ''}" data-r="go|${j}"${j === i ? ' aria-current="true"' : ''} aria-label="Slide ${j + 1}: ${esc(x.h)}" title="${j + 1} · ${esc(x.h)}">${x.k === 'frame' ? `<span>${slideCard(x, true)}</span>` : ''}</button>`).join('')
|
|
346
|
+
+ `</div>${ib('next', ic('next', 17), 'Next slide', { off: i === L.length - 1 })}</div><p class="rp-count" aria-live="polite">${i + 1} of ${L.length}</p>`;
|
|
338
347
|
}
|
|
339
348
|
function pageHtml() {
|
|
340
349
|
if (R.cyc) return `<div class="vz-pagefr">${frame(R.cyc.style, R.cyc.body, '', 'The report as a page')}</div>`;
|
|
341
350
|
const w = R.W || { title: R.name, sections: [] };
|
|
342
|
-
return paperHtml(paperModel(w, { audience: R.audience, name: R.name, slot: R.row.slot })
|
|
351
|
+
return paperHtml(paperModel(w, { audience: R.audience, name: R.name, slot: R.row.slot }));
|
|
343
352
|
}
|
|
344
353
|
function liveView() {
|
|
345
354
|
const L = R.LV && R.LV.m ? liveModel(R.LV.m, { upTo: R.issued ? R.row.slot : null, range: R.LV.range, pick: R.LV.pick, open: R.LV.open }) : R.LV && R.LV.err ? { none: R.LV.err } : null;
|
|
@@ -353,11 +362,12 @@ function bodyHtml() {
|
|
|
353
362
|
+ (R.view === 'deck' && !R.noTip ? `<p class="vz-tip"><span>${tipText(at, n)}</span>${ib('notip', ic('x', 14), 'Hide this tip', { cls: ' vz-small' })}</p>` : '')
|
|
354
363
|
+ (R.view === 'deck' ? '' : `<div class="vz-r1">${WAIT('Page editor')}</div>`) + '<div class="vz-ed" data-vz-ed></div></div>';
|
|
355
364
|
}
|
|
356
|
-
if (R.tab === 'brief')
|
|
365
|
+
if (R.tab === 'brief') { // ⋯ Brief: the brief in place of the report, ← back to it
|
|
366
|
+
return `<div class="vz-rpb"><div class="rp-back">${ib('tab|report', ic('prev', 17), 'Back to the report')}<b>Brief</b></div>${briefHtml(R.BF, { issued: R.issued, busy: R.busy, msg: R.bfMsg })}</div>`;
|
|
367
|
+
}
|
|
357
368
|
const view = R.err ? `<p class="vz-msg" data-tone="bad" role="alert">The document could not be read: ${esc(R.err)}</p>` : !R.W ? '<p class="vz-empty" role="status">Reading the report.</p>'
|
|
358
369
|
: R.view === 'deck' ? deckHtml() : R.view === 'live' ? liveView() : pageHtml();
|
|
359
|
-
return `<div class="vz-rpb">${confHtml()}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${
|
|
360
|
-
+ (R.view === 'deck' && R.W && !R.err ? `<button type="button" class="rp-btn rp-present rp-pho" data-r="present">${ic('play', 16)}Present</button>` : '') + askHtml() + '</div>';
|
|
370
|
+
return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${view}${askHtml()}</div>`;
|
|
361
371
|
}
|
|
362
372
|
const tipText = (i, n) => `Slide ${i + 1} of ${n}. Click an item to change it; double-click text to type.`;
|
|
363
373
|
/** The editor's slide and its undo history changed: the tip and the dimmed Undo and Redo follow it. */
|
|
@@ -368,7 +378,13 @@ function edState(S) {
|
|
|
368
378
|
if (u) u.classList.toggle('vz-dim', !S.hist.length); if (r) r.classList.toggle('vz-dim', !S.fut.length);
|
|
369
379
|
}
|
|
370
380
|
/** The whole panel as html. */
|
|
371
|
-
|
|
381
|
+
/** The whole panel as html. Shell A (XvAReport): the summary card with its one primary, the report, and the popovers ⋯ opens, kept at the top of
|
|
382
|
+
* the card as it scrolls. While editing, the edit bar takes the summary's place. */
|
|
383
|
+
export function panelHtml() {
|
|
384
|
+
const pop = R.edit ? '' : R.pop === 'share' ? sharePop() : R.pop === 'sched' ? schedPop() : R.pop === 'dl' ? dlPop() : R.pop === 'cyc' ? cycPop() : '';
|
|
385
|
+
return `<div class="vz vz-rp0 rp-a" data-view="${R.view}" data-tab="${R.tab}"${R.edit ? ' data-edit' : ''}>${pop ? `<div class="rp-pops">${pop}</div>` : ''}`
|
|
386
|
+
+ `${R.edit ? `<div class="vz-rph">${chipsHtml()}${toolHtml()}</div>` : ''}${bodyHtml()}</div>`;
|
|
387
|
+
}
|
|
372
388
|
|
|
373
389
|
const bodyEl = () => (R && vCur() && vCur().id === R.vid ? document.querySelector('#czViewer .cz-vw-body') : null);
|
|
374
390
|
function draw() {
|
|
@@ -378,14 +394,19 @@ function draw() {
|
|
|
378
394
|
if (ed && ed.dataset.mounted) { const h = b.querySelector('.vz-rph'); if (h) h.innerHTML = chipsHtml() + toolHtml(); const m = b.querySelector('.vz-rpb > .vz-msg'); if (m) m.remove(); if (R.msg) b.querySelector('.vz-rpb').insertAdjacentHTML('afterbegin', `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>`); return; }
|
|
379
395
|
}
|
|
380
396
|
const ae = document.activeElement, keep = ae && b.contains(ae) ? ae.getAttribute('data-r') : null;
|
|
397
|
+
syncMore();
|
|
381
398
|
b.innerHTML = panelHtml();
|
|
382
399
|
wire(b);
|
|
383
400
|
fit(b);
|
|
384
|
-
|
|
401
|
+
const f = R.pop && R.pop !== R.popWas ? b.querySelector('.rp-pops button:not([disabled]), .rp-pops a, .rp-pops input') : null; // a popover that just opened takes the focus
|
|
402
|
+
if (f) f.focus(); else if (keep) { const k = b.querySelector(`[data-r="${CSS.escape(keep)}"]`); if (k) k.focus(); }
|
|
403
|
+
R.popWas = R.pop;
|
|
385
404
|
if (R.edit) mountEditor();
|
|
386
405
|
}
|
|
387
406
|
function wire(b) {
|
|
388
407
|
b.onclick = (e) => {
|
|
408
|
+
const pa = e.target.closest('[data-czs-act]');
|
|
409
|
+
if (pa && !pa.disabled) { e.preventDefault(); return act(pa.dataset.czsAct.split('|'), pa); }
|
|
389
410
|
const t = e.target.closest('[data-r]');
|
|
390
411
|
if (!t) { if (R.pop && R.pop !== 'brief' && !e.target.closest('.vz-pop')) { R.pop = null; draw(); } return; }
|
|
391
412
|
if (t.disabled || t.tagName === 'INPUT' || t.tagName === 'SELECT') return;
|
|
@@ -405,6 +426,12 @@ function wire(b) {
|
|
|
405
426
|
if (x0 == null) return; const dx = e.changedTouches[0].clientX - x0; x0 = null;
|
|
406
427
|
if (Math.abs(dx) < 40) return; const j = R.i + (dx < 0 ? 1 : -1); if (j >= 0 && j < slides().length) { R.i = j; draw(); }
|
|
407
428
|
};
|
|
429
|
+
b.onscroll = () => { // "Page n of N" under the sheets follows the page in view
|
|
430
|
+
if (!R || R.view !== 'doc' || bodyEl() !== b) return;
|
|
431
|
+
const c = b.querySelector('[data-rp-page]'), pgs = b.querySelectorAll('.rp-pg'); if (!c || !pgs.length) return;
|
|
432
|
+
const top = b.getBoundingClientRect().top + 80; let n = 1; pgs.forEach((g, k) => { if (g.getBoundingClientRect().top <= top) n = k + 1; });
|
|
433
|
+
const t = 'Page ' + n + ' of ' + pgs.length; if (c.textContent !== t) c.textContent = t;
|
|
434
|
+
};
|
|
408
435
|
b.onmousemove = (e) => { if (R.view !== 'live' || !R.LV) return; const pt = e.target.closest('.rp-pt'); if (pt) { const h = +pt.dataset.r.split('|')[2]; if (R.LV.hover !== h) { R.LV.hover = h; draw(); } } };
|
|
409
436
|
}
|
|
410
437
|
/* a 1280 x 720 frame scales to its slide's width */
|
|
@@ -420,9 +447,14 @@ async function act([k, v], t) {
|
|
|
420
447
|
if (k === 'bf') return briefAct(v, t.dataset.r.split('|').slice(2).join('|'));
|
|
421
448
|
if (k === 'lv') return liveAct(v, t.dataset.r.split('|').slice(2).join('|'));
|
|
422
449
|
if (k === 'dlm') { R.pop = R.pop === 'dl' ? null : 'dl'; return draw(); }
|
|
423
|
-
if (k === 'nextcyc') return nextCycle();
|
|
450
|
+
if (k === 'nextcyc') { R.pop = null; return nextCycle(); }
|
|
424
451
|
if (k === 'unarch') { R.pop = null; return lifeIt('unarchive', v); }
|
|
425
|
-
if (k === 'view') {
|
|
452
|
+
if (k === 'view') {
|
|
453
|
+
if (R.view === v) return; const ico = (x) => (x === 'doc' ? 'doc' : 'report'), was = R.view; R.view = v; R.pop = null; if (v === 'live' && !R.LV) readLive();
|
|
454
|
+
const ed = R.edit && bodyEl() && bodyEl().querySelector('[data-vz-ed]'); if (ed) delete ed.dataset.mounted;
|
|
455
|
+
if (!R.edit && ico(was) !== ico(v) && vCur() && vCur().id === R.vid) { R.reopen = true; vOpen(R.head()); R.reopen = false; } // the header's tile follows what it is read as (XvAReportDoc)
|
|
456
|
+
return draw();
|
|
457
|
+
}
|
|
426
458
|
if (k === 'cycm') { R.pop = R.pop === 'cyc' ? null : 'cyc'; return draw(); }
|
|
427
459
|
if (k === 'cyc') { const row = R.cycles.find((x) => x.path === v); R.pop = null; if (row && row.path !== R.row.path) return openReport(row, R.hand); return draw(); }
|
|
428
460
|
if (k === 'sched') { if (R.pop !== 'sched') { R.sch = schedPick(R.setup); R.schErr = ''; } R.pop = R.pop === 'sched' ? null : 'sched'; return draw(); }
|
|
@@ -430,13 +462,12 @@ async function act([k, v], t) {
|
|
|
430
462
|
if (k === 'sday') { R.sch.day = v; return draw(); }
|
|
431
463
|
if (k === 'sgo') return schedIt(schedOf(R.sch));
|
|
432
464
|
if (k === 'soff') return schedIt('off');
|
|
433
|
-
if (k === 'more') { R.pop = R.pop === 'more' ? null : 'more'; return draw(); }
|
|
434
465
|
if (k === 'share') { if (R.pop !== 'share') openShare(); else { R.pop = null; draw(); } return; }
|
|
435
466
|
if (k === 'prev' || k === 'next') { R.i += k === 'next' ? 1 : -1; return draw(); }
|
|
436
467
|
if (k === 'go') { R.i = +v; return draw(); }
|
|
437
468
|
if (k === 'md') { R.pop = null; saveMd(); return draw(); }
|
|
438
469
|
if (k === 'pdf' || k === 'print') { R.pop = null; draw(); return printIt(); }
|
|
439
|
-
if (k === 'present') { R.pop = null;
|
|
470
|
+
if (k === 'present') { R.pop = null; return presentIt(); }
|
|
440
471
|
if (k === 'issue') { R.conf = !R.conf; R.ask = ''; R.issueErr = ''; R.pop = null; draw(); if (R.conf) readChecks(); return; }
|
|
441
472
|
if (k === 'issueno') { R.conf = false; R.issueErr = ''; return draw(); }
|
|
442
473
|
if (k === 'issueok') return issueIt();
|
|
@@ -621,6 +652,12 @@ function liveAct(a, v) {
|
|
|
621
652
|
}
|
|
622
653
|
|
|
623
654
|
/* ── share (Link | Send a file): POST /api/shares makes a copy of the file as it is now ── */
|
|
655
|
+
/** The open links of this cycle, for the summary ("Not shared yet.", "Shared: 1 link open, 3 views."): { links, views }, or null unread. */
|
|
656
|
+
export const sharesOf = (list, rel) => { const base = String(rel || '').split('/').pop(), mine = (list || []).filter((x) => x.name === base || x.name === rel); return { links: mine.length, views: mine.reduce((n, x) => n + (+x.views || 0), 0) }; };
|
|
657
|
+
async function readShares() {
|
|
658
|
+
const me = R, l = await Promise.resolve(pmGet('/api/shares')).catch(() => null);
|
|
659
|
+
if (R === me) R.shares = l && l.ok ? sharesOf(l.shares, R.row.path) : null;
|
|
660
|
+
}
|
|
624
661
|
async function openShare() {
|
|
625
662
|
const me = R;
|
|
626
663
|
R.pop = 'share'; R.shr = { tab: 'link', pw: true, pass: R.shr && R.shr.pass ? R.shr.pass : '', days: 7, made: null, err: '', busy: false, list: (R.shr && R.shr.list) || [], off: null, copied: '' };
|
|
@@ -641,7 +678,7 @@ async function shareAct(k, v) {
|
|
|
641
678
|
if (k === 'shoff') {
|
|
642
679
|
if (S.off !== v) { S.off = v; return draw(); }
|
|
643
680
|
const r = await pmPost('/api/shares/off', { id: v }); if (R !== me) return;
|
|
644
|
-
S.off = null; if (r && r.ok) S.list = S.list.filter((x) => x.id !== v); else S.err = (r && r.error) || 'The link could not be turned off.';
|
|
681
|
+
S.off = null; if (r && r.ok) { S.list = S.list.filter((x) => x.id !== v); R.shares = sharesOf(S.list, R.row.path); } else S.err = (r && r.error) || 'The link could not be turned off.';
|
|
645
682
|
return draw();
|
|
646
683
|
}
|
|
647
684
|
if (k === 'shsend') { try { await navigator.share({ files: [new File([R.text || ''], fileName(), { type: 'text/markdown' })], title: R.name }); R.pop = null; draw(); } catch { /* the PM closed the share sheet */ } return; }
|
|
@@ -653,7 +690,7 @@ async function shareAct(k, v) {
|
|
|
653
690
|
S.busy = false;
|
|
654
691
|
if (!r || !r.ok) { S.err = (r && r.error) || 'The link could not be made.'; return draw(); }
|
|
655
692
|
S.made = { url: r.url, ends: r.ends, pass: S.pw ? String(S.pass).trim() : '' };
|
|
656
|
-
const l = await pmGet('/api/shares'); if (R !== me) return; if (l && l.ok) S.list = l.shares || [];
|
|
693
|
+
const l = await pmGet('/api/shares'); if (R !== me) return; if (l && l.ok) { S.list = l.shares || []; R.shares = sharesOf(S.list, R.row.path); }
|
|
657
694
|
return draw();
|
|
658
695
|
}
|
|
659
696
|
if (k === 'shcopy') {
|
|
@@ -734,7 +771,22 @@ function printIt() {
|
|
|
734
771
|
w.focus(); setTimeout(() => { try { w.print(); } catch { /* the PM prints from the window */ } }, 300);
|
|
735
772
|
}
|
|
736
773
|
|
|
737
|
-
/* ── Present
|
|
774
|
+
/* ── Present ── */
|
|
775
|
+
/** Present (canvas note xvPresent): the one presenter window for every kind, premium-mtg-present.js. Slides present as a deck and a page as a
|
|
776
|
+
* document, from the cycle's file. The audience window opens inside the press, before anything waits, as the browser asks. A cycle drawn to
|
|
777
|
+
* its saved design is HTML the presenter cannot read yet, so it, and a presenter that does not start, use the full-screen view below. */
|
|
778
|
+
function presentIt() {
|
|
779
|
+
const me = R;
|
|
780
|
+
if (R.cyc || !R.W || R.err) return present(true);
|
|
781
|
+
if (typeof MP.presentMaterial === 'function') {
|
|
782
|
+
const win = typeof MP.openAudience === 'function' ? MP.openAudience() : null;
|
|
783
|
+
const mat = { kind: R.view === 'deck' ? 'pmos-deck' : 'report', ref: R.row.path, title: R.name, ws: R.ws };
|
|
784
|
+
return Promise.resolve(MP.presentMaterial({ mats: [mat], start: 0, ws: R.ws, meeting: { title: R.name }, win })).catch(() => null).then((r) => { if (R === me && (!r || !r.ok)) present(true); });
|
|
785
|
+
}
|
|
786
|
+
if (typeof MP.presentDeck === 'function') return Promise.resolve(MP.presentDeck({ ws: R.ws, path: R.row.path, title: R.name, meeting: { title: R.name } })).catch(() => null).then((r) => { if (R === me && (!r || !r.ok)) present(true); });
|
|
787
|
+
return present(true);
|
|
788
|
+
}
|
|
789
|
+
/* the full-screen view: the current slide on the whole screen (RpPhone Present; the strip and the hint of MtPresent) */
|
|
738
790
|
function present(on) {
|
|
739
791
|
let p = document.getElementById('vzPres');
|
|
740
792
|
if (!on) { if (!p) return; p.remove(); if (document.fullscreenElement) document.exitFullscreen().catch(() => {}); if (R) draw(); const b = bodyEl() && bodyEl().querySelector('[data-r="present"]'); if (b) b.focus(); return; }
|
|
@@ -755,6 +807,8 @@ function present(on) {
|
|
|
755
807
|
p.innerHTML = presentHtml({ name: R.name, i, n: L.length, slide: slideCard(L[i]), blank: R.blank });
|
|
756
808
|
fit(p); p.focus();
|
|
757
809
|
}
|
|
810
|
+
/* a popover ⋯ opened closes on Escape wherever the focus is (the ⋯ menu has gone by then, so the focus may be on the header) */
|
|
811
|
+
if (typeof document !== 'undefined') document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && R && R.pop && !R.edit && bodyEl() && !e.defaultPrevented) { e.preventDefault(); R.pop = null; draw(); } });
|
|
758
812
|
if (typeof document !== 'undefined') document.addEventListener('fullscreenchange', () => { if (!document.fullscreenElement && document.getElementById('vzPres')) present(false); });
|
|
759
813
|
|
|
760
814
|
/* ── reading the cycle ── */
|
|
@@ -776,8 +830,9 @@ export async function openReport(row, hand = {}) {
|
|
|
776
830
|
if (R) present(false);
|
|
777
831
|
const me = R = { row, ws: hand.ws || '', id: c.cadence, name: hand.name || row.name || c.cadence || 'Report', audience: hand.audience || '', issued: row.state === 'issued', archived: !!row.archived,
|
|
778
832
|
text: '', err: '', W: null, view: 'deck', tab: 'report', BF: null, bfRaw: null, bfMsg: '', LV: null, blank: false, i: 0, cyc: null, setup: undefined, pop: null, conf: false, checks: null, issueErr: '', busy: false, ask: '', askErr: '', edit: false, msg: null,
|
|
779
|
-
sch: schedPick(null), schErr: '', shr: null, hand, cycles: (hand.cycles || []).slice(), onIssue: hand.onIssue || null, onChange: hand.onChange || null, vid: 'report:' + row.path };
|
|
780
|
-
const head = () => ({ id: me.vid, kind: 'Report' + (me.audience ? ' · ' + me.audience : ''), title: me.name, icon: 'report', full: true, url: viewUrl(row, me.ws),
|
|
833
|
+
sch: schedPick(null), schErr: '', shr: null, shares: null, more: [], hand, cycles: (hand.cycles || []).slice(), onIssue: hand.onIssue || null, onChange: hand.onChange || null, vid: 'report:' + row.path };
|
|
834
|
+
const head = me.head = () => ({ id: me.vid, kind: 'Report' + (me.audience ? ' · ' + me.audience : ''), title: me.name, icon: me.view === 'doc' ? 'doc' : 'report', full: true, url: viewUrl(row, me.ws), more: me.more,
|
|
835
|
+
render: (b) => { syncMore(); b.innerHTML = panelHtml(); wire(b); }, onClose: () => { if (R === me && !me.reopen) { present(false); R = null; } } });
|
|
781
836
|
vOpen(head());
|
|
782
837
|
try { R.text = await textOf('/api/doc?' + q({ ws: R.ws, path: row.path })); R.W = wordsOf(R.text, R.name); if (!hand.name && R.W.title) R.name = R.W.title; } catch (x) { R.err = String((x && x.message) || x); R.W = { title: R.name, sections: [] }; }
|
|
783
838
|
if (R !== me) return me;
|
|
@@ -786,7 +841,7 @@ export async function openReport(row, hand = {}) {
|
|
|
786
841
|
if (R !== me) return me;
|
|
787
842
|
if (d && d.ws) R.ws = d.ws;
|
|
788
843
|
}
|
|
789
|
-
await Promise.all([readCycle(), readSetup()]);
|
|
844
|
+
await Promise.all([readCycle(), readSetup(), readShares()]);
|
|
790
845
|
if (R !== me) return me;
|
|
791
846
|
readBrief(); // the Brief tab's count shows at once
|
|
792
847
|
if (vCur() && vCur().id === me.vid && (vCur().title !== me.name || me.audience)) { me.reopen = true; vOpen(head()); me.reopen = false; } // the name and audience are known now
|