create-pmos 0.783.0 → 0.785.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 +70 -78
- package/payload/AGENTS.md +160 -0
- package/payload/KIT-VERSION +1 -1
- package/payload/design-system/ui/components/Badge/README.md +2 -2
- package/payload/design-system/ui/components/Glyph/README.md +28 -0
- package/payload/design-system/ui/components/bundle.css +3 -0
- 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/bin/card-catalog-gen.js +22 -0
- package/workspace/board-columns-test.js +2 -2
- package/workspace/briefing-premium-insights-test.js +5 -4
- package/workspace/calm-timeline-test.js +4 -3
- package/workspace/changelog.json +69 -10
- package/workspace/design-system/ui/components/Badge/README.md +2 -2
- package/workspace/design-system/ui/components/Glyph/README.md +28 -0
- package/workspace/design-system/ui/components/bundle.css +3 -0
- package/workspace/guide/claude-proposes.md +1 -0
- package/workspace/guide/cli.md +8 -0
- package/workspace/guide/home.md +4 -3
- package/workspace/guide/index.md +2 -2
- package/workspace/guide/layout.md +16 -2
- package/workspace/lib/briefing-premium-agent.js +3 -0
- package/workspace/lib/card-catalog-gen.js +123 -0
- package/workspace/lib/cos-chat.js +1 -0
- package/workspace/lib/declined-asks.js +177 -0
- package/workspace/lib/declined-cli.js +87 -0
- package/workspace/lib/goal-chat.js +1 -0
- package/workspace/lib/initiative-chat.js +1 -0
- package/workspace/lib/jira-status.js +11 -2
- package/workspace/lib/live-events.js +99 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/program-chat.js +1 -0
- package/workspace/lib/proposals.js +13 -2
- package/workspace/lib/report-chat.js +1 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-live-rows.js +30 -0
- package/workspace/lib/routes-proposals.js +31 -3
- package/workspace/lib/routes-slash.js +142 -2
- package/workspace/lib/routes-task-links.js +1 -1
- package/workspace/lib/scope-cuts.js +138 -0
- package/workspace/lib/task-cli.js +5 -3
- package/workspace/lib/workflow-chat.js +1 -0
- package/workspace/okr-goals-ui-test.js +3 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-cols.js +3 -1
- package/workspace/public/pm/bd-span.js +13 -7
- package/workspace/public/pm/bd-views.js +6 -3
- package/workspace/public/pm/bd-work-ds.css +1 -0
- package/workspace/public/pm/bd-work.js +15 -2
- package/workspace/public/pm/cozy-board.css +3 -0
- package/workspace/public/pm/cozy-insights.css +3 -4
- package/workspace/public/pm/ds-bridge.css +12 -0
- package/workspace/public/pm/goal-forecast.js +7 -4
- package/workspace/public/pm/home-app.js +5 -3
- package/workspace/public/pm/ini-props.js +4 -3
- package/workspace/public/pm/komorebi.css +1 -0
- package/workspace/public/pm/live-edit.js +34 -3
- package/workspace/public/pm/live-feed.js +42 -0
- package/workspace/public/pm/okr-list.js +5 -2
- package/workspace/public/pm/premium-board.js +2 -0
- package/workspace/public/pm/premium-insights.js +10 -4
- package/workspace/public/pm/premium-vw-doc.css +5 -0
- package/workspace/public/pm/premium-vw-doc.js +11 -31
- package/workspace/public/pm/premium-vw-file.js +13 -8
- package/workspace/public/pm/premium-vw-guide.css +9 -0
- package/workspace/public/pm/premium-vw-guide.js +20 -17
- package/workspace/public/pm/reading-view.js +44 -0
- package/workspace/public/pm/state-glyph.js +135 -0
- package/workspace/skills/jira-sync.skill +4 -3
- package/workspace/task-milestones-test.js +2 -2
- package/workspace/test-lists/a2ui-chat-rules.json +9 -0
- package/workspace/test-lists/a2ui-live-rows.json +9 -0
- package/workspace/test-lists/declined-asks.json +9 -0
- package/workspace/test-lists/scope-cuts-save-date.json +5 -0
- package/workspace/test-lists/state-glyph.json +5 -0
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* handlers: pm/premium-board.js wires the presses (pressOf and apply say what a press means; wireDrag does the menu's drag). */
|
|
18
18
|
import { stageOfRow, stagesOfRow, wfOf, catOfRow, posOf } from './bd-wf.js';
|
|
19
19
|
import { stageName as oneStageName } from './stage-chip.js';
|
|
20
|
+
import { stateGlyph } from './state-glyph.js';
|
|
20
21
|
|
|
21
22
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
22
23
|
const SV = (d, n) => `<svg viewBox="0 0 24 24"${n ? ` width="${n}" height="${n}"` : ''} aria-hidden="true"><path d="${d}"/></svg>`;
|
|
@@ -127,9 +128,21 @@ export function dateOf(r, now = new Date()) {
|
|
|
127
128
|
if (r.closed || r.status === 'done') return { text, tone: '', note: '' };
|
|
128
129
|
if (over > 0) return { text, tone: 'late', note: over + ' ' + plural(over, 'day', 'days') + ' late', over };
|
|
129
130
|
// a date still ahead is never "late" (design check of the shared copy, 2026-11-19): a row the reading calls late, with its date to come, is at risk
|
|
130
|
-
|
|
131
|
+
// the state word is the row's glyph now (state-glyphs): the Date cell keeps only the fact
|
|
132
|
+
if (r.status === 'at risk' || r.status === 'late') return { text, tone: 'risk', note: '' };
|
|
131
133
|
return { text, tone: '', note: '' };
|
|
132
134
|
}
|
|
135
|
+
/** The row's state for its glyph (state-glyphs): done, late, at risk, on hold, no signal, or on track with its share done. → { state, why, progress } */
|
|
136
|
+
export function rowState(r, now = new Date()) {
|
|
137
|
+
if (r.closed || r.status === 'done' || catOfRow(r) === 'done') return { state: 'done', why: '', progress: 1 };
|
|
138
|
+
const d = dateOf(r, now), n = nextOf(r);
|
|
139
|
+
if (d.tone === 'late') return { state: 'late', why: (n && n.name ? n.name + ', ' : '') + d.note, progress: 0 };
|
|
140
|
+
if (d.tone === 'risk') return { state: 'risk', why: n ? (n.name ? n.name + ' ' : 'Due ') + d.text : '', progress: 0 };
|
|
141
|
+
if (r.status === 'on hold' || r.status === 'blocked') return { state: 'wait', why: '', progress: 0 };
|
|
142
|
+
if (r.status === 'no signal') return { state: 'none', why: 'nothing read yet', progress: 0 };
|
|
143
|
+
const p = r.track && r.track.prog, progress = p && p.total > 0 ? p.done / p.total : 0;
|
|
144
|
+
return { state: 'on', why: p && p.total > 0 ? `${p.done} of ${p.total} done` : '', progress };
|
|
145
|
+
}
|
|
133
146
|
|
|
134
147
|
/* ── stages ──────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
135
148
|
const norm = (s) => String(s || '').trim().toLowerCase();
|
|
@@ -408,7 +421,7 @@ export function listHtml(rows, o = {}) {
|
|
|
408
421
|
+ `<div class="wk-tw"><table class="pm-table wk${tl ? ' has-x' : ''}" aria-label="Initiatives"><colgroup><col class="c-title">${keys.map((k) => `<col class="c-${k}">`).join('')}${tl ? '<col class="c-x">' : ''}</colgroup>`
|
|
409
422
|
+ `<thead><tr>${sortHd('title', 'Initiative')}${keys.map((k) => sortHd(k, byK[k].n)).join('')}${tlHead}</tr></thead><tbody>`;
|
|
410
423
|
const row = (r) => `<tr class="wk-i${o.sel === r.key ? ' sel' : ''}${CARD === r.key ? ' hov' : ''}${isClosed(r) ? ' cl' : ''}" tabindex="0" data-key="${esc(r.key)}" aria-label="${esc(r.title + (keys.length ? ', ' + words(r, keys, oo) : ''))}">`
|
|
411
|
-
+ `<td class="n">${esc(r.title)}</td>${keys.map((k) => cellHtml(r, k, oo)).join('')}`
|
|
424
|
+
+ `<td class="n">${((g) => stateGlyph(g.state, { why: g.why, progress: g.progress, cls: 'wk-sg' }))(rowState(r, now))}${esc(r.title)}</td>${keys.map((k) => cellHtml(r, k, oo)).join('')}`
|
|
412
425
|
+ (tl ? `<td class="wk-x" data-wkbar="${esc(r.key)}"><div class="wk-bw pm-gt">${grid}${o.bar ? o.bar(r, W) : barHtml(r, W, { now })}</div>${CARD === r.key ? cardHtml(r, W, now) : ''}</td>` : '') + '</tr>';
|
|
413
426
|
const all = o.order ? o.order(rows) : rows, base = all.filter((r) => !isClosed(r)), shut = all.filter(isClosed), G = groupsOf(base, v.group, oo);
|
|
414
427
|
const gline = (inner) => `<tr class="wk-g"><td colspan="${ncol}"><div class="pm-group">${inner}</div></td></tr>`;
|
|
@@ -1617,3 +1617,6 @@ html.ro body.wk-on .bd-hd { display: none; } /* find and tune moved to the top
|
|
|
1617
1617
|
.bd-sigs .bd-sign { display: block; color: var(--cz-ink2); }
|
|
1618
1618
|
/* Work's Ask PMOS icon (bug 2026-11-23, initiative work-ask-chat) is a computer's: a phone's top bar is one row, and its Ask PMOS is in the menu */
|
|
1619
1619
|
@media (max-width: 760px) { .bd-hd .bd-ask { display: none; } }
|
|
1620
|
+
/* the state glyph at the end of a Timeline bar (state-glyphs): after the end label, or alone at the bar's end */
|
|
1621
|
+
.tg-endl .tg-sg { margin-left: 6px; vertical-align: -1px; }
|
|
1622
|
+
.tg-sgw { position: absolute; top: 50%; transform: translate(8px, -50%); line-height: 0; z-index: 3; }
|
|
@@ -130,7 +130,7 @@ body.cz { padding: 0; }
|
|
|
130
130
|
.ins-ini { display: flex; align-items: center; gap: var(--space-8); font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--muted); min-width: 0; text-decoration: none; border-radius: var(--radius-md); line-height: var(--lh-label); }
|
|
131
131
|
@media (hover: hover) { .ins-ini:hover .n { text-decoration: underline; } }
|
|
132
132
|
.ins-ini .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
|
|
133
|
-
.ins-ini .pm-badge { margin-left: auto; }
|
|
133
|
+
.ins-ini .pm-badge, .ins-ini > .pm-meta { margin-left: auto; } /* a fact at the row end; the state is the glyph before the title (state-glyphs) */
|
|
134
134
|
.ins-trk { display: inline-flex; align-items: center; gap: 3px; flex: none; }
|
|
135
135
|
.ins-trk i { width: 6px; height: 6px; border-radius: 50%; background: var(--well); display: block; }
|
|
136
136
|
.ins-trk i.p { background: var(--muted); }
|
|
@@ -661,7 +661,7 @@ body.ins-trv #goalTbl { border: 0; background: none; border-radius: 0; overflow:
|
|
|
661
661
|
.okr-t b { font-size: var(--fs-row); font-weight: var(--fw-strong); line-height: 1.3; color: var(--ink); }
|
|
662
662
|
.okr-t .note { font-size: var(--fs-meta); color: var(--muted); line-height: var(--lh-meta); }
|
|
663
663
|
.okr-none { margin: 0; padding: 14px var(--space-16); color: var(--muted); font-size: var(--fs-body); line-height: var(--lh-body); }
|
|
664
|
-
.okr-dot {
|
|
664
|
+
.okr-dot { margin-top: 5px; } /* the state glyph (state-glyphs) sizes itself */
|
|
665
665
|
.cz-dot.hollow { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
|
|
666
666
|
.okr-av { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-badge); font-weight: var(--fw-strong); background: var(--well); color: var(--ink); line-height: var(--lh-badge); }
|
|
667
667
|
.okr-av.none { background: transparent; border: 2px dashed var(--muted); box-sizing: border-box; }
|
|
@@ -723,8 +723,7 @@ body.ins-trv #goalTbl { border: 0; background: none; border-radius: 0; overflow:
|
|
|
723
723
|
.okr-pl { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
|
724
724
|
.okr-plt { flex: 1; min-width: 0; }
|
|
725
725
|
.okr-pld { display: inline-flex; gap: var(--space-4); flex: none; }
|
|
726
|
-
.okr-pld .okr-dot { margin-top: 0;
|
|
727
|
-
@media (prefers-reduced-motion: reduce) { .okr-dot.m-crit::after { animation: none; } }
|
|
726
|
+
.okr-pld .okr-dot { margin-top: 0; }
|
|
728
727
|
textarea.ins-dri { height: auto; padding: 6px var(--space-8); font-weight: var(--fw-regular); resize: vertical; }
|
|
729
728
|
/* ── goals made clear (batch 18 item 11, 11-B; frames Gc*): the drafts table, the check panel, first readings, failed and held ── */
|
|
730
729
|
.ins-dr .gc-tbl + .okr-card { margin-top: var(--space-12); }
|
|
@@ -21,3 +21,15 @@
|
|
|
21
21
|
:root body.pm-ds :focus-visible { outline: none; box-shadow: var(--glow); }
|
|
22
22
|
/* the ground follows the clock (pm/day-tint.js, bet A339): after the first paint, a change of part moves slowly */
|
|
23
23
|
:root[data-daytint-ease] body.pm-ds { transition: background-color var(--duration-light) var(--ease-drift); }
|
|
24
|
+
|
|
25
|
+
/* the state glyph (pm/state-glyph.js, initiative state-glyphs): its shape, the one pulse of Needs you, and the phone press-and-hold sheet.
|
|
26
|
+
* The seven --state-* colours are design-system tokens (ui/components/bundle.css); these rules sit here, the sheet every page loads, so
|
|
27
|
+
* the design system sent to a prototype run stays under its size cap. */
|
|
28
|
+
.pm-glyph{display:inline-flex;flex:none;align-items:center;justify-content:center;vertical-align:-2px;line-height:0}
|
|
29
|
+
.pm-glyph svg{display:block;overflow:visible}
|
|
30
|
+
.pm-glyph[data-state="you"] .pm-glyph-dot{transform-box:fill-box;transform-origin:center;animation:pm-glyph-pulse 1.2s var(--ease-out) 1}
|
|
31
|
+
@keyframes pm-glyph-pulse{0%{transform:scale(1)}40%{transform:scale(1.35)}100%{transform:scale(1)}}
|
|
32
|
+
.pm-glyph-sheet{position:fixed;left:12px;right:12px;bottom:12px;z-index:60;background:var(--card);color:var(--ink);border-radius:var(--radius-card);box-shadow:var(--lift);padding:14px 16px}
|
|
33
|
+
.pm-glyph-sheet-h{display:flex;align-items:center;gap:8px;font-weight:var(--fw-strong)}
|
|
34
|
+
.pm-glyph-sheet p{margin:4px 0 0;font-size:var(--fs-meta);line-height:20px;color:var(--muted)}
|
|
35
|
+
@media (prefers-reduced-motion:reduce){.pm-glyph[data-state="you"] .pm-glyph-dot{animation:none}}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The data is g.forecast on /api/insights-premium (lib/forecast.js, one straight-line method): { state, likely, low, high, by, asOf, source,
|
|
3
3
|
* driftFrom, weeks, why, baseline, offer }. This module is pure HTML; premium-insights.js draws it in the goal Viewer and wires the presses.
|
|
4
4
|
*
|
|
5
|
-
* stateHtml(g, o) the state line: a
|
|
5
|
+
* stateHtml(g, o) the state line: a state glyph (On track, At risk, Late, No signal) and its words. '' when there is no forecast
|
|
6
6
|
* chartLayer(g, x, y) what the goal chart adds: the range band, the dashed likely path and the shaded readings a baseline leaves out
|
|
7
7
|
* legendHtml(g) under the chart: history, likely, range, and "Projected, not promised"
|
|
8
8
|
* baselineHtml(g, o) the ✓ that keeps a baseline ("Without the reading of 14 Sep, the range is 2 to 4%"), or the kept one with its ×
|
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
* o: { md(ms) → "Oct 8", day(iso) → ms, unit(v) → "3.1%", next: "The next reading comes from Jira on Nov 3.", source, ws, rid, dismissed }
|
|
12
12
|
* What-if lines (FcViewer's "Simulated, not the plan") are not drawn: no what-if proposal is filed on a goal yet. */
|
|
13
13
|
|
|
14
|
+
import { stateGlyph } from './state-glyph.js';
|
|
15
|
+
|
|
14
16
|
const RANGED = new Set(['on-track', 'at-risk', 'will-miss', 'held']);
|
|
15
|
-
|
|
17
|
+
// the forecast's state as a glyph (state-glyphs): the shape and its label, the words beside it stay the facts
|
|
18
|
+
const TAG = { 'on-track': ['on', ''], 'at-risk': ['risk', ''], 'will-miss': ['late', 'will miss the target'], held: ['none', 'readings paused'], 'too-early': ['none', 'too early to forecast'] };
|
|
16
19
|
const e = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
17
20
|
const n1 = (v) => String(Math.round(v * 10) / 10);
|
|
18
21
|
const ICON = {
|
|
@@ -34,7 +37,7 @@ export function rangeTxt(lo, hi, unit) {
|
|
|
34
37
|
export function stateHtml(g, o) {
|
|
35
38
|
const F = g && g.forecast;
|
|
36
39
|
if (!F || !TAG[F.state]) return '';
|
|
37
|
-
const [
|
|
40
|
+
const [state, why] = TAG[F.state];
|
|
38
41
|
let say = '', act = '';
|
|
39
42
|
if (F.state === 'too-early') {
|
|
40
43
|
const n = (g.series || []).length, wk = Math.floor(F.weeks || 0);
|
|
@@ -47,7 +50,7 @@ export function stateHtml(g, o) {
|
|
|
47
50
|
} else {
|
|
48
51
|
say = 'Likely ' + o.unit(+n1(F.likely)) + ', range ' + rangeTxt(F.low, F.high, o.unit) + '.' + (F.driftFrom ? ' Was on track on ' + o.md(o.day(F.driftFrom)) + '.' : '');
|
|
49
52
|
}
|
|
50
|
-
return `<div class="fc-state"
|
|
53
|
+
return `<div class="fc-state">${stateGlyph(state, { why, size: 16, progress: state === 'on' ? 1 : 0 })}<span class="fc-say">${e(say)}</span>${act}</div>`;
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
/** The spans a kept baseline leaves out, else the ones the offer would leave out: shaded on the chart so the ✓ is read against them. */
|
|
@@ -83,6 +83,7 @@ import * as PV from './prog-page.js'; // the product page is the one program a
|
|
|
83
83
|
import { initiativeRename, taskRename } from './rename-press.js'; // tap the title to rename (canvas RnATask, RnASaved) // the pinned recording row above it (XvARecHome)
|
|
84
84
|
import * as SWN from './cozy-status-when.js'; // a stage move asks when it really happened (round 3 follow-up of point 18)
|
|
85
85
|
import * as CC from './change-cues.js'; // idea A313: a short cue on a row that is done, before the list draws again
|
|
86
|
+
import { stateGlyph } from './state-glyph.js'; // a state is a shape, not a word (state-glyphs)
|
|
86
87
|
|
|
87
88
|
const $ = (s, r = document) => r.querySelector(s);
|
|
88
89
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
@@ -851,9 +852,10 @@ function headOf(id) {
|
|
|
851
852
|
}
|
|
852
853
|
/* An item's mark (AgInitAgents, AgInitStalled): done ✓, the PM's ring, the working agent's avatar, an empty grey circle for a step that is
|
|
853
854
|
* next, ! for a risk, J for Jira. Its tag: You; Working (a plain word), or Stuck (an outlined pill) when the initiative is stalled; Next. */
|
|
854
|
-
|
|
855
|
+
// done, at risk and no signal are the shared state glyph (state-glyphs); the state word they had as a tag goes
|
|
856
|
+
const markHtml = (k, role) => (k === 'done' || k === 'risk' || k === 'none' ? stateGlyph(k, { size: 18, cls: 'hm-mk-g' }) : k === 'jira' ? '<span class="hm-mk jira" aria-hidden="true">J</span>'
|
|
855
857
|
: k === 'agent' && role ? avHtml(role, 20, 'hm-mk-av') : `<span class="hm-mk ${esc(k)}" aria-hidden="true"></span>`);
|
|
856
|
-
const TAG = { you: 'You', agent: 'Working', wait: 'Next', jira: 'Jira'
|
|
858
|
+
const TAG = { you: 'You', agent: 'Working', wait: 'Next', jira: 'Jira' };
|
|
857
859
|
const itemHtml = (x, o = {}) => {
|
|
858
860
|
const k = x.kind === 'agent' && !o.role && !o.stalled ? 'wait' : x.kind; // an agent step with no agent at work on it waits: it is next
|
|
859
861
|
const tag = k === 'agent' && o.stalled ? 'Stuck' : TAG[k];
|
|
@@ -1253,7 +1255,7 @@ async function fillGoals(b, ws) {
|
|
|
1253
1255
|
const L = r && r.ok ? OKL.productLine(r) : null, line = b.querySelector('[data-okr-line]'), dots = b.querySelector('[data-okr-dots]');
|
|
1254
1256
|
if (!line) return;
|
|
1255
1257
|
line.textContent = L ? L.text : 'Open them in Intelligence';
|
|
1256
|
-
if (dots) dots.innerHTML = L ? L.dots.map((d) => OKL.dotHtml(d)).join('') : '';
|
|
1258
|
+
if (dots) dots.innerHTML = L ? L.dots.map((d) => OKL.dotHtml(d, '', 10)).join('') : '';
|
|
1257
1259
|
}
|
|
1258
1260
|
/** The product's page in the Viewer (HbCProduct): Goals, the KRs and budgets with what is at risk, and This week, the weekly update and the
|
|
1259
1261
|
* metrics review. A press opens that one; ← comes back to the page. */
|
|
@@ -32,7 +32,7 @@ const I = {
|
|
|
32
32
|
check: 'M5 12l5 5 9-10', x: 'M6 6l12 12M18 6L6 18', down: 'M6 9l6 6 6-6', up: 'M6 15l6-6 6 6', stop: 'M7 7h10v10H7z',
|
|
33
33
|
doc: 'M7 3h7l5 5v13H7zM14 3v5h5', tasks: 'M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01', stage: 'M5 21V4M5 4h12l-2 4 2 4H5',
|
|
34
34
|
link: 'M10 14a4 4 0 0 0 5.66 0l3-3a4 4 0 0 0-5.66-5.66l-1 1M14 10a4 4 0 0 0-5.66 0l-3 3a4 4 0 0 0 5.66 5.66l1-1',
|
|
35
|
-
cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', done: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M8 12l3 3 5-6', name: 'M4 20h4L19 9l-4-4L4 16zM13 7l4 4',
|
|
35
|
+
cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', cut: 'M9 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0M9 18a3 3 0 1 1-6 0 3 3 0 0 1 6 0M20 4 8.12 15.88M14.47 14.48 20 20M8.12 8.12 12 12', done: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M8 12l3 3 5-6', name: 'M4 20h4L19 9l-4-4L4 16zM13 7l4 4',
|
|
36
36
|
goal: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M12 7a5 5 0 1 0 0 10 5 5 0 0 0 0-10M12 11a1 1 0 1 0 0 2 1 1 0 0 0 0-2',
|
|
37
37
|
ask: 'M4 5h16v11H9l-5 4z', maybe: 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6M12 17h.01', keep: 'M5 12l5 5 9-10', ignore: 'M5 12h14',
|
|
38
38
|
};
|
|
@@ -42,7 +42,7 @@ const md = (iso) => { const m = DAY.exec(String(iso || '')); return m ? MON[+m[2
|
|
|
42
42
|
const span = (a, b) => (a && b && a !== b ? md(a) + ' – ' + md(b) : md(a || b));
|
|
43
43
|
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
44
44
|
const clip = (s, n) => { s = String(s || ''); return s.length > n ? s.slice(0, n - 1) + '…' : s; };
|
|
45
|
-
const GROUP = { live: 'PMOS will show it', build: 'Pull request', harness: 'Change the factory harness', description: 'Description', outcome: 'Expected outcome', prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it', found: 'Found elsewhere', dates: 'Dates', status: 'Looks done', names: 'Names', links: 'Links', grill: 'PMOS grilled it' };
|
|
45
|
+
const GROUP = { live: 'PMOS will show it', build: 'Pull request', harness: 'Change the factory harness', description: 'Description', outcome: 'Expected outcome', prototyped: 'PMOS prototyped it', improved: 'PMOS improved it', scanned: 'PMOS scanned for it', found: 'Found elsewhere', dates: 'Dates', scope: 'Cut to keep the date', status: 'Looks done', names: 'Names', links: 'Links', grill: 'PMOS grilled it' };
|
|
46
46
|
|
|
47
47
|
/* ── the chip and the live look ── */
|
|
48
48
|
export function chipOf(p) {
|
|
@@ -111,7 +111,7 @@ const titleOf = (p) => {
|
|
|
111
111
|
return '';
|
|
112
112
|
};
|
|
113
113
|
const iconOf = (p) => (p.group === 'description' ? I.doc : p.group === 'outcome' ? I.goal : p.group === 'found' ? (p.type === 'stage' ? I.stage : p.type === 'docs' ? I.doc : p.type === 'tasks' ? I.tasks : p.type === 'link' ? I.link : I.maybe)
|
|
114
|
-
: p.group === 'dates' ? I.cal : p.group === 'status' ? I.done : p.group === 'names' ? I.name : I.link);
|
|
114
|
+
: p.group === 'dates' ? I.cal : p.group === 'scope' ? I.cut : p.group === 'status' ? I.done : p.group === 'names' ? I.name : I.link);
|
|
115
115
|
const ib = (attr, label, icon, cls = '') => `<button type="button" class="pp-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(icon, 16, 2.2)}</button>`;
|
|
116
116
|
function itemHtml(p, x) {
|
|
117
117
|
let t = '', m = '';
|
|
@@ -121,6 +121,7 @@ function itemHtml(p, x) {
|
|
|
121
121
|
else if (p.type === 'tasks') { t = (x.wbs && !String(x.title || '').startsWith(x.wbs) ? x.wbs + ' ' : '') + (x.title || x.jira || ''); m = [x.jira ? 'Jira epic ' + x.jira : '', x.stage, span(x.start, x.due), x.owner].filter(Boolean).join(' · '); }
|
|
122
122
|
else { t = x.title; m = x.other ? 'In ' + x.other.title : x.why || ''; }
|
|
123
123
|
} else if (p.group === 'dates') { t = x.title || x.task; m = (x.from && x.from.due ? md(x.from.due) + ' → ' : '') + span(x.to && x.to.start, x.to && x.to.due) + (x.jira ? ' · Jira: a drafted comment' : '') + (x.ms ? ' · ◇ a promise' : ''); }
|
|
124
|
+
else if (p.group === 'scope') { t = x.title || x.task; m = [x.finish ? 'Ends ' + md(x.finish) : '', x.waits ? 'waits on ' + x.waits : '', 'moves to ' + span(x.to && x.to.start, x.to && x.to.due), x.cost === 'prd' ? 'the PRD names it' : '', x.jira ? 'Jira: a drafted comment' : ''].filter(Boolean).join(' · '); }
|
|
124
125
|
else if (p.group === 'status') { t = x.title || taskTitle(p.ini, x.task); m = x.jira ? 'Jira: a drafted comment' : ''; }
|
|
125
126
|
else if (p.group === 'outcome') { t = x.title; m = x.due ? 'Check on ' + md(x.due) : ''; }
|
|
126
127
|
else if (p.group === 'description') { t = (p.data && p.data.text) || x.title; m = p.type === 'enrich' && p.data && p.data.from ? 'Now: ' + clip(p.data.from, 120) : ''; }
|
|
@@ -221,6 +221,7 @@
|
|
|
221
221
|
@media (prefers-reduced-motion:reduce) {
|
|
222
222
|
.pm-ds .pm-chart path.line, .pm-ds .pm-li.gone, .pm-ds .pm-tip{transition:none}
|
|
223
223
|
}
|
|
224
|
+
.pm-ds{--state-on:var(--leaf);--state-risk:var(--alert);--state-late:var(--alert);--state-you:var(--blue);--state-wait:var(--muted);--state-none:var(--muted);--state-done:var(--leaf)}
|
|
224
225
|
.pm-ds .pm-tip{left:var(--pm-tip-x,0);top:var(--pm-tip-y,0)}
|
|
225
226
|
.pm-ds .pm-leg i.pm-sw-blue{background:var(--blue)}
|
|
226
227
|
.pm-ds .pm-leg i.pm-sw-leaf{background:var(--leaf)}
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
* source({ model, redraw }) a page's data (a root, or a list of roots) and the draw that shows it; returns the call that removes it.
|
|
17
17
|
* view(el, redraw) an open view drawn from those sources (the popup body, the big Work breakdown); dropped once el leaves the page.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* remote(ops) a change made elsewhere (the chat, another tab): put on every copy and drawn at once (pm/live-feed.js)
|
|
20
|
+
*
|
|
21
|
+
* Pure apart from the redraw calls, install() and the live-feed start: no DOM reads, so live-edit.test.js runs it in Node.
|
|
20
22
|
*/
|
|
21
23
|
|
|
22
24
|
/** The write's field → the names a page's copy of a task uses for it (the Board's rows say status and end; Home's and the Backlog's say
|
|
@@ -204,6 +206,30 @@ export function paint(views = true) {
|
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
|
|
209
|
+
/** A change made somewhere else: by the chat (the server's live stream, pm/live-feed.js) or by a press in another tab of this browser.
|
|
210
|
+
* It is put on every copy the pages hold and drawn at once, like a press here, but nothing waits for an answer: the next read holds it
|
|
211
|
+
* anyway. Returns how many copies changed. */
|
|
212
|
+
export function remote(ops) {
|
|
213
|
+
const list = (Array.isArray(ops) ? ops : [ops]).filter((op) => op && typeof op === 'object' && (op.id || op.ini));
|
|
214
|
+
let n = 0;
|
|
215
|
+
for (const op of list) n += apply(op).length;
|
|
216
|
+
if (n) paint();
|
|
217
|
+
return n;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// a press that landed here shows in this browser's other tabs at once (bet A458); a stand-in row for a new task stays in this tab
|
|
221
|
+
let CHANNEL = null;
|
|
222
|
+
function share(ops) {
|
|
223
|
+
try {
|
|
224
|
+
if (!CHANNEL && typeof BroadcastChannel === 'function' && typeof window !== 'undefined') {
|
|
225
|
+
CHANNEL = new BroadcastChannel('pmos-live');
|
|
226
|
+
CHANNEL.onmessage = (m) => { if (m && m.data && Array.isArray(m.data.ops)) remote(m.data.ops); };
|
|
227
|
+
}
|
|
228
|
+
const out = ops.filter((op) => op.kind === 'patch' || op.kind === 'remove');
|
|
229
|
+
if (CHANNEL && out.length) CHANNEL.postMessage({ ops: out });
|
|
230
|
+
} catch { /* the other tabs read it on their next read */ }
|
|
231
|
+
}
|
|
232
|
+
|
|
207
233
|
/** A write is about to be sent. null when it is not a task write. */
|
|
208
234
|
export function begin(path, body) {
|
|
209
235
|
const ops = opsOf(path, body);
|
|
@@ -212,7 +238,8 @@ export function begin(path, body) {
|
|
|
212
238
|
const steps = ops.flatMap((op) => apply(op));
|
|
213
239
|
if (steps.length) paint();
|
|
214
240
|
return {
|
|
215
|
-
|
|
241
|
+
ops,
|
|
242
|
+
ok(at) { const t = at || Date.now(); for (const [, e] of entries) e.saved = t; share(ops); },
|
|
216
243
|
fail() {
|
|
217
244
|
for (const [k] of entries) PENDING.delete(k);
|
|
218
245
|
// only a copy still showing this change goes back: a newer read or a newer change is left as it is
|
|
@@ -278,7 +305,11 @@ export function install(g = globalThis) {
|
|
|
278
305
|
g.fetch = watched;
|
|
279
306
|
return true;
|
|
280
307
|
}
|
|
281
|
-
if (typeof window !== 'undefined' && typeof document !== 'undefined')
|
|
308
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
309
|
+
install(window);
|
|
310
|
+
// the chat's changes and the other tabs' presses arrive here too (bet A458); the stream is the one request this module starts
|
|
311
|
+
import('./live-feed.js').then((m) => m.start(window)).catch(() => { /* the turn-end read still draws them */ });
|
|
312
|
+
}
|
|
282
313
|
|
|
283
314
|
export function source(s) { SOURCES.add(s); return () => SOURCES.delete(s); }
|
|
284
315
|
export function view(el, redraw) { VIEWS.set(el, redraw); return () => { if (VIEWS.get(el) === redraw) VIEWS.delete(el); }; }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* pm/live-feed.js — a change the chat makes shows on the open page at once, on that one row (bet A458, path-level live updates; job #1750).
|
|
2
|
+
*
|
|
3
|
+
* `pmos task add|set|state|remove` (lib/task-cli.js) writes one event per changed field; the server streams them (GET /api/live-rows,
|
|
4
|
+
* lib/routes-live-rows.js). Each event is put on the rows the page already holds (live-edit.js remote()), so Today, Work and an open
|
|
5
|
+
* popup move the row with no list read again. The window event 'pmos:action' { kind, id, field, value, undo, remote: true } follows
|
|
6
|
+
* each one, the same event the card buttons send (pm/action-run.js), so a card that listens follows a chat change too.
|
|
7
|
+
*
|
|
8
|
+
* opOf(ev) the live-edit op of one event, or null: { kind: 'patch', id, fields } | { kind: 'remove', id } | { kind: 'add', ini, row }
|
|
9
|
+
* start(g) open the stream once per page; the browser opens it again by itself after a drop
|
|
10
|
+
*
|
|
11
|
+
* The chat's turn-end read (cz:chat-turn) is unchanged: it still catches every write this stream does not carry. */
|
|
12
|
+
import { remote, FIELDS } from './live-edit.js';
|
|
13
|
+
|
|
14
|
+
export function opOf(ev) {
|
|
15
|
+
if (!ev || typeof ev !== 'object' || ev.kind !== 'task' || typeof ev.id !== 'string' || !ev.id) return null;
|
|
16
|
+
if (ev.field === 'removed') return { kind: 'remove', id: ev.id };
|
|
17
|
+
if (ev.field === 'added') {
|
|
18
|
+
const v = ev.value && typeof ev.value === 'object' ? ev.value : null;
|
|
19
|
+
if (!v || typeof v.initiative !== 'string' || !v.initiative || typeof v.title !== 'string') return null;
|
|
20
|
+
const { initiative, ...rest } = v;
|
|
21
|
+
return { kind: 'add', ini: initiative, row: { uid: ev.id, ...rest } };
|
|
22
|
+
}
|
|
23
|
+
if (!Object.prototype.hasOwnProperty.call(FIELDS, ev.field) || ev.field === 'title') return null;
|
|
24
|
+
return { kind: 'patch', id: ev.id, fields: { [ev.field]: ev.field === 'state' ? String(ev.value) : ev.value === null ? '' : ev.value } };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let started = false;
|
|
28
|
+
export function start(g = globalThis) {
|
|
29
|
+
if (started || !g || typeof g.EventSource !== 'function') return false;
|
|
30
|
+
started = true;
|
|
31
|
+
let es;
|
|
32
|
+
try { es = new g.EventSource('/api/live-rows'); } catch { started = false; return false; }
|
|
33
|
+
es.onmessage = (m) => {
|
|
34
|
+
let ev = null;
|
|
35
|
+
try { ev = JSON.parse(m.data); } catch { return; }
|
|
36
|
+
const op = opOf(ev);
|
|
37
|
+
if (!op) return;
|
|
38
|
+
remote(op);
|
|
39
|
+
try { g.dispatchEvent(new g.CustomEvent('pmos:action', { detail: { kind: ev.kind, id: ev.id, field: ev.field, value: ev.value, undo: !!ev.undo, remote: true } })); } catch { /* no listener needs it */ }
|
|
40
|
+
};
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* THE RULE (as the other premium models): a number, a dot or an age is made only from a field of a record. A goal with no reading has a hollow dot
|
|
16
16
|
* and no status. Initiative delivery status never sets a dot. */
|
|
17
17
|
|
|
18
|
+
import { stateGlyph } from './state-glyph.js';
|
|
18
19
|
export const DAY = 864e5;
|
|
19
20
|
const WD = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
20
21
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
@@ -61,7 +62,9 @@ function budgetDot(b) {
|
|
|
61
62
|
/** The dot's class on .cz-dot (cozy.css): a broken limit pulses (m-crit), the one time a dot moves. */
|
|
62
63
|
export const DOT_CLS = { on: 'ok', behind: 'risk', close: 'risk', broken: 'red m-crit', none: 'hollow', q: 'q' };
|
|
63
64
|
export const DOT_SAY = { on: 'On its line', behind: 'Behind its line', close: 'Close to its limit', broken: 'Over its limit', none: 'No reading yet', q: 'No line to judge it by' };
|
|
64
|
-
|
|
65
|
+
/** A goal's state as the shared glyph (state-glyphs): the shape says the state, the words above are its why. */
|
|
66
|
+
export const DOT_STATE = { on: 'on', behind: 'risk', close: 'risk', broken: 'late', none: 'none', q: 'none' };
|
|
67
|
+
export const dotHtml = (d, cls = '', size = 14) => stateGlyph(DOT_STATE[d] || 'none', { why: DOT_SAY[d] || '', size, progress: 1, cls: 'okr-dot' + (cls ? ' ' + cls : '') });
|
|
65
68
|
|
|
66
69
|
/* ── the row's second line ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
67
70
|
/** How old the latest reading is: "today", "yesterday", the weekday within the week, else "12 days old". A reading past its cadence is stale. */
|
|
@@ -250,4 +253,4 @@ export function productLine(S) {
|
|
|
250
253
|
const text = S.line || [S.on ? S.on + ' on ' + (S.on === 1 ? 'its' : 'their') + ' line' : '', bad[0] || '', bad.length > 1 ? (bad.length - 1) + ' more need' + (bad.length === 2 ? 's' : '') + ' you' : '', none ? none + ' not read yet' : ''].filter(Boolean).join(' · ');
|
|
251
254
|
return { text, dots: S.dots.map((d) => d.dot) };
|
|
252
255
|
}
|
|
253
|
-
export const productLineHtml = (L) => `<span class="okr-pl"><span class="okr-plt">${esc(L.text)}</span><span class="okr-pld" aria-hidden="true">${L.dots.map((d) => dotHtml(d)).join('')}</span></span>`;
|
|
256
|
+
export const productLineHtml = (L) => `<span class="okr-pl"><span class="okr-plt">${esc(L.text)}</span><span class="okr-pld" aria-hidden="true">${L.dots.map((d) => dotHtml(d, '', 10)).join('')}</span></span>`;
|
|
@@ -73,6 +73,8 @@ import * as LS from './load-shapes.js'; // the skeleton and the slow-case line
|
|
|
73
73
|
import * as STRAT from './bd-strategy.js'; // the product's strategy in five lines above the initiatives (bet A458)
|
|
74
74
|
import * as PRIN from './bd-principles.js'; // the product's principles drafted from its decisions, below the strategy (bet A352)
|
|
75
75
|
import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
|
|
76
|
+
import { pressHold } from './state-glyph.js'; // a state is a shape, not a word (state-glyphs)
|
|
77
|
+
pressHold(typeof document !== 'undefined' ? document.body : null); // on a phone, press and hold a state glyph for its word and why (state-glyphs)
|
|
76
78
|
|
|
77
79
|
const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUPING_KEY = 'pmos.board.grouping';
|
|
78
80
|
let M = null; // the model
|
|
@@ -48,9 +48,11 @@ import * as IP2 from './ins-pane.js'; // Intelligence as the first panel (pane
|
|
|
48
48
|
import * as KO from './komorebi.js'; // the design system's Chart behaviour: hover tip, keys, press a point (North Star, intelligence-ds-page)
|
|
49
49
|
import * as GC from './goals-clear.js';
|
|
50
50
|
import * as LAB from './cozy-lab-ins.js'; // Intelligence › Lab (idle lab B+C, canvas I1 IlBC): what fits no initiative, the week's background record, next time
|
|
51
|
+
import { stateGlyph, pressHold } from './state-glyph.js'; // a state is a shape, not a word (state-glyphs)
|
|
51
52
|
import * as FCV from './goal-forecast.js'; // a goal's forecast in its Viewer (FcViewer, FcPhone): the state line, the range band, the baseline ✓ // goals made clear (batch 18 item 11, 11-B): the drafts table, the check panel, first readings, failed and held
|
|
52
53
|
import { provenStatus } from './status-proof.js'; // T3: an initiative's status word renders only with its source and read time
|
|
53
54
|
import * as POP from './cozy-popup.js'; // the one popup (slice 2 of the six-place navigation): an initiative opens in it with Ask PMOS beside it
|
|
55
|
+
pressHold(typeof document !== 'undefined' ? document.body : null); // on a phone, press and hold a state glyph for its word and why (state-glyphs)
|
|
54
56
|
/* An initiative's link (a goal's "Moved by", the outcomes table, a step) opens the initiative in the one popup on a desk, read the way the
|
|
55
57
|
* Viewer reads it (premium-vw-item.js), with Ask PMOS about it on the right. ⌘/Ctrl-click, a middle click and a phone keep the link. */
|
|
56
58
|
document.addEventListener('click', (e) => {
|
|
@@ -902,7 +904,10 @@ function movePill(r) {
|
|
|
902
904
|
if (d !== null && d >= 0 && d <= 14) return ['q', 'Ships in ' + d + ' days'];
|
|
903
905
|
return { late: ['late', 'Late'], 'at risk': ['risk', 'At risk'], 'on hold': ['q', 'On hold'], 'on track': ['q', 'On track'] }[ps] || null;
|
|
904
906
|
}
|
|
905
|
-
|
|
907
|
+
// the pill's state words become the glyph (state-glyphs); a fact ("3 days over", "No owner", "Ships in 4 days") stays as text
|
|
908
|
+
const PILL_STATE = { Late: 'late', 'At risk': 'risk', 'On hold': 'wait', 'On track': 'on', Done: 'done', Stopped: 'none' };
|
|
909
|
+
const pillGlyph = (p) => { const st = PILL_STATE[p[1]] || (p[0] === 'late' ? 'late' : p[0] === 'risk' ? 'risk' : ''); return { g: st ? stateGlyph(st, { why: PILL_STATE[p[1]] ? '' : p[1], progress: 1 }) : '', fact: PILL_STATE[p[1]] ? '' : p[1] }; };
|
|
910
|
+
const initRow = (r, pill = true) => { const p = pill ? movePill(r) : null, x = p ? pillGlyph(p) : { g: '', fact: '' }; return `<a class="ins-ini" href="${iniHref(r.id)}">${trackHtml(r)}${x.g}<span class="n">${esc(r.title)}</span>${x.fact ? `<span class="pm-badge ${p[0]}">${esc(x.fact)}</span>` : ''}</a>`; };
|
|
906
911
|
const TONE_BAR = { ok: 'var(--cz-dot-ok)', late: 'var(--cz-dot-late)', red: 'var(--cz-dot-red)', q: 'var(--cz-dot-q)', risk: 'var(--cz-dot-risk)' };
|
|
907
912
|
/** Done or not: its steps as a checklist; Stay within: the readings over a green band that marks the budget, with no forecast. */
|
|
908
913
|
const stepsHtml = (g) => `<div class="ins-steps">${(g.steps || []).map((s) => `<span class="${s.done ? 'on' : ''}"><i class="ins-cb${s.done ? ' on' : ''}">${s.done ? SV(I.chk, 3) : ''}</i>${esc(s.text)}</span>`).join('')}</div>`;
|
|
@@ -969,7 +974,7 @@ function paceHtml(g) {
|
|
|
969
974
|
* g.forecast comes from lib/forecast.js through /api/insights-premium; without it the row keeps the pace above. Too early draws no bar (zero is
|
|
970
975
|
* silence); held dims the bar and never extends it. */
|
|
971
976
|
const FC_WORD = { 'on-track': ['ok', 'On track'], 'at-risk': ['risk', 'At risk'], 'will-miss': ['red', 'Will miss'], 'too-early': ['q', 'Too early'], held: ['q', 'Held'] };
|
|
972
|
-
const
|
|
977
|
+
const FC_STATE = { 'on-track': 'on', 'at-risk': 'risk', 'will-miss': 'late', 'too-early': 'none', held: 'none' }; // the forecast's state as a glyph (state-glyphs)
|
|
973
978
|
const fcV = (g, v) => unitV(g, Math.round(v * 10) / 10);
|
|
974
979
|
function forecastHtml(g) {
|
|
975
980
|
const F = g.forecast, w = F && FC_WORD[F.state];
|
|
@@ -990,7 +995,7 @@ function forecastHtml(g) {
|
|
|
990
995
|
const note = F.state === 'too-early' ? 'Needs 3 weeks of readings' + (wk ? ', ' + wk + ' so far' : '')
|
|
991
996
|
: F.state === 'held' ? (F.asOf ? src + 'last read ' + md(Date.parse(F.asOf)) : 'Not read lately') + '. Range held'
|
|
992
997
|
: fcV(g, F.low) + ' to ' + fcV(g, F.high) + (F.driftFrom ? '. Was on track on ' + md(Date.parse(F.driftFrom)) : '');
|
|
993
|
-
return `<div class="pace" role="cell"
|
|
998
|
+
return `<div class="pace" role="cell">${stateGlyph(FC_STATE[F.state] || 'none', { why: w[1], progress: 1 })}${bar}<div class="note">${esc(note)}</div></div>`;
|
|
994
999
|
}
|
|
995
1000
|
/** What happened to a goal's last reading, said once under its number: "not read Mon 16 Nov", "1 reading held". */
|
|
996
1001
|
const gcSay = (g) => (g.failed ? 'not read ' + GC.dayTxt(g.failed.at) : (g.held || []).length ? ((g.held.length === 1 ? '1 reading' : g.held.length + ' readings') + ' held') : '');
|
|
@@ -1199,6 +1204,7 @@ function budgetsHtml(D) {
|
|
|
1199
1204
|
return '<div class="ins-grp" role="row"><span role="cell">Health budgets</span> <span class="q">always on, judged every week</span></div>' + B.map(budgetRow).join('');
|
|
1200
1205
|
}
|
|
1201
1206
|
/* the phone (Iq8Phone): one card per goal, its status at the top right, its value, its so-far, its bar and the first initiative that moves it */
|
|
1207
|
+
const CARD_STATE = { 'Not read': 'none', Held: 'none', Behind: 'late', Ahead: 'on', 'On track': 'on' }; // the phone card's state, as a glyph before its title (state-glyphs)
|
|
1202
1208
|
function cardPill(g) {
|
|
1203
1209
|
if (g.failed) return ['risk', 'Not read'];
|
|
1204
1210
|
if ((g.held || []).length) return ['risk', 'Held'];
|
|
@@ -1219,7 +1225,7 @@ function drawCards(G, okr = false) {
|
|
|
1219
1225
|
function cardOf(g) {
|
|
1220
1226
|
const p = cardPill(g), tg = g.targetTxt ? (g.type === 'Count' ? 'of ' : 'target ') + g.targetTxt + (g.byAt ? ' by ' + md(day(g.byAt)) : '') : 'no target', first = GC.firstOf(g);
|
|
1221
1227
|
const gr = first ? `<span class="note">${esc(GC.firstMeta(g).split(' · ').slice(1).join(' · '))}</span>` : isBlocks(g) ? blocksHtml(g, 190, false) : g.type === 'Stay within' && g.series.length && g.target !== null ? bandSvg(g.series, g.target, g.limit !== 'floor', g.tone, g.title, 190, 30) : g.key ? sparkHtml(g, 190, 30) : '';
|
|
1222
|
-
return `<div class="ins-card" role="listitem" data-goal="${esc(g.id)}" tabindex="0" aria-label="${esc(g.title)}"><div class="ins-ch"
|
|
1228
|
+
return `<div class="ins-card" role="listitem" data-goal="${esc(g.id)}" tabindex="0" aria-label="${esc(g.title)}"><div class="ins-ch">${p ? stateGlyph(CARD_STATE[p[1]] || 'none', { why: p[1], progress: 1 }) : ''}<b>${g.krTok ? `<span class="ins-krt">${esc(g.krTok)}</span>` : ''}${esc(g.title)}</b></div>`
|
|
1223
1229
|
+ `<div class="ins-cs"><span class="pm-badge q ins-type">${esc(g.type)}</span><span class="note">${esc(tg)}</span></div>`
|
|
1224
1230
|
+ `<div class="ins-cv"><b>${esc(nowOf(g))}</b><span class="ins-cg">${gr}</span></div>${first || gcSay(g) ? '' : barHtml(g, ' ins-wide')}`
|
|
1225
1231
|
+ (g.moves[0] ? `<div class="ins-c1">${initRow(g.moves[0], false)}</div>` : '') + '</div>' + (PF ? '' : draftsFor(g.id).map(drHtml).join(''));
|
|
@@ -318,3 +318,8 @@ 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 page with no Contents (one section or none) gives its column back: the column stays at the reading measure, centred. */
|
|
322
|
+
@media (min-width: 1101px){
|
|
323
|
+
.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
|
+
.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
|
+
}
|
|
@@ -13,8 +13,8 @@ import { vwOpen, vwStyle, vwConfirm } from './premium-viewer.js';
|
|
|
13
13
|
import { $, $$, esc, toast, AI, CHECK } from './premium-shell.js';
|
|
14
14
|
import { editBody, acceptBody, rejectBody, askBody, askLine, relationsOf, copyKindOf, copyView, proposalsModel } from './premium-doc-edit.js';
|
|
15
15
|
import { bodyHtml, pageHead, propHtml, splitDoc, overlay, overlayLine, mergeEdit, readMinutes, dayOf, PANELS, signOffOf } from './premium-vw-doc-model.js';
|
|
16
|
-
import { adler } from './cozy-adler.js';
|
|
17
|
-
import {
|
|
16
|
+
import { adler } from './cozy-adler.js'; // the sign-off under a page the agent drafted (batch 17 item 4-A, canvas AdH4)
|
|
17
|
+
import { readingPageHtml, wireReading } from './reading-view.js'; // the Reading layout (reading-layouts, A334)
|
|
18
18
|
|
|
19
19
|
const I = (d) => `<svg class="i" viewBox="0 0 24 24" aria-hidden="true">${d}</svg>`;
|
|
20
20
|
const IC = {
|
|
@@ -275,7 +275,6 @@ function makePage(d, ctx) {
|
|
|
275
275
|
/* ── the Reading layout (reading-layouts, A334; board ReadingDS): read mode with no agent edit open. Contents at left follows the scroll; the
|
|
276
276
|
* title and meta strip (who drafted ✦, who checked, for whom); In short; one section per heading, each folds and the open state is kept per
|
|
277
277
|
* document; comments in the margin beside their section, and no margin when there are none. Edit, Markdown and an agent's edit keep their page. */
|
|
278
|
-
const store = { get: (k) => { try { return localStorage.getItem(k); } catch { return null; } }, set: (k, val) => { try { localStorage.setItem(k, val); } catch { /* a private window */ } } };
|
|
279
278
|
function metaHtml(R) {
|
|
280
279
|
const revs = (P.log && P.log.revisions) || [], last = revs[revs.length - 1], m = R.meta, bits = [];
|
|
281
280
|
if (m.drafted) bits.push(`${m.drafted.by === 'PMOS' ? `<span class="rd-ai" aria-hidden="true">${AI}</span>PMOS drafted it` : `${esc(m.drafted.by)} wrote it`}${m.drafted.at ? ' ' + esc(dayOf(m.drafted.at)) : ''}`);
|
|
@@ -286,34 +285,15 @@ function makePage(d, ctx) {
|
|
|
286
285
|
return `<p class="rd-meta cfby">${bits.join(' · ')}</p>`;
|
|
287
286
|
}
|
|
288
287
|
function readingHtml(h, p) {
|
|
289
|
-
const R = readingOf(P.text, { title: h.title || String(d.path).split('/').pop(), revisions: (P.log && P.log.revisions) || [], comments: ctx.comments ? ctx.comments() : [] });
|
|
290
|
-
const folds = foldsOf(store.get(foldKey(d.path)));
|
|
291
288
|
const unsaved = P.work != null && P.work !== P.text ? `<p class="vwmut vwline" role="status">You have changes that are not saved yet. Edit shows them again.${P.stale ? ' The chat changed the file since. Cancel there shows the new text.' : ''}</p>` : '';
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
+ (h.props.length ? `<details class="rd-props"><summary>Properties · ${h.props.length}</summary><table class="cfpr" aria-label="Properties">${h.props.map(([k, val]) => `<tr><th scope="row">${esc(k)}</th><td>${propHtml(k, val)}</td></tr>`).join('')}</table></details>` : '') + '</header>'
|
|
301
|
-
+ `<article class="cf rd-doc"><div class="cfb">`
|
|
302
|
-
+ (R.inShort ? `<section class="rd-short" id="rd-in-short" aria-label="In short"><p class="rd-lab">In short</p>${md(R.inShort)}</section>` : '')
|
|
303
|
-
+ `${R.lead ? md(R.lead) : ''}${secs || (R.lead ? '' : '<p class="vwmut">The file has no text yet.</p>')}</div>`
|
|
304
|
-
+ `<footer class="cff"><span>${v() ? 'v' + v() : ''}</span><span class="gap"></span><code>${esc(d.path)}</code></footer></article>`
|
|
305
|
-
+ signHtml() + sideHtml() + `</div>${margin}</div>`;
|
|
306
|
-
}
|
|
307
|
-
/** Wire the Reading layout: a fold is kept per document; Contents jumps to a section (opening it) and follows the scroll. */
|
|
308
|
-
function wireReading() {
|
|
309
|
-
const box = $('.rd', el); if (!box) return;
|
|
310
|
-
$$('.rd-sec', box).forEach((x) => x.addEventListener('toggle', () => store.set(foldKey(d.path), foldsWith(store.get(foldKey(d.path)), x.dataset.rd, x.open))));
|
|
311
|
-
const nav = $('.pm-contents', box); if (!nav) return;
|
|
312
|
-
const mark = (id) => $$('[data-rdto]', nav).forEach((a) => a.setAttribute('aria-current', String(a.dataset.rdto === id)));
|
|
313
|
-
nav.onclick = (e) => { const a = e.target.closest('[data-rdto]'); if (!a) return; e.preventDefault(); const t = box.querySelector('#' + CSS.escape(a.dataset.rdto)); if (!t) return; if (t.tagName === 'DETAILS') t.open = true; t.scrollIntoView({ block: 'start', behavior: 'smooth' }); mark(a.dataset.rdto); };
|
|
314
|
-
if (typeof IntersectionObserver !== 'function') return;
|
|
315
|
-
const io = new IntersectionObserver((es) => { const top = es.filter((x) => x.isIntersecting).sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top)[0]; if (top) mark(top.target.id); }, { root: el, rootMargin: '0px 0px -70% 0px' });
|
|
316
|
-
$$('#rd-in-short, .rd-sec', box).forEach((x) => io.observe(x));
|
|
289
|
+
return readingPageHtml(P.text, {
|
|
290
|
+
path: d.path, title: h.title || String(d.path).split('/').pop(), revisions: (P.log && P.log.revisions) || [], comments: ctx.comments ? ctx.comments() : [],
|
|
291
|
+
head: toolsHtml(p), above: moreBar() + unsaved, meta: metaHtml,
|
|
292
|
+
extraHead: (h.labels.length ? `<div class="cflb">${h.labels.map((l) => `<span>${esc(l)}</span>`).join('')}</div>` : '')
|
|
293
|
+
+ (h.props.length ? `<details class="rd-props"><summary>Properties · ${h.props.length}</summary><table class="cfpr" aria-label="Properties">${h.props.map(([k, val]) => `<tr><th scope="row">${esc(k)}</th><td>${propHtml(k, val)}</td></tr>`).join('')}</table></details>` : ''),
|
|
294
|
+
foot: `<footer class="cff"><span>${v() ? 'v' + v() : ''}</span><span class="gap"></span><code>${esc(d.path)}</code></footer>`,
|
|
295
|
+
below: signHtml() + sideHtml(),
|
|
296
|
+
});
|
|
317
297
|
}
|
|
318
298
|
function pageHtml() {
|
|
319
299
|
if (P.err) return `<p class="vwempty">${esc(P.err)}</p>`;
|
|
@@ -349,7 +329,7 @@ function makePage(d, ctx) {
|
|
|
349
329
|
const reading = P.mode === 'read' && !ctx.host && P.text != null && !P.err && !openProp();
|
|
350
330
|
el.innerHTML = `<div class="vwdoc${reading ? ' rdw' : ''}">${pageHtml()}</div>`;
|
|
351
331
|
el.scrollTop = keepScroll;
|
|
352
|
-
if (reading) wireReading(); else if (P.mode === 'read') tocOf();
|
|
332
|
+
if (reading) wireReading(el, el, d.path); else if (P.mode === 'read') tocOf();
|
|
353
333
|
if (P.mode === 'edit') startEdit();
|
|
354
334
|
}
|
|
355
335
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
11
11
|
import { bodyHtml, pageHead, splitDoc, readMinutes } from './premium-vw-doc-model.js';
|
|
12
12
|
import { needsReader, drawPdf } from './premium-vw-pdf.js';
|
|
13
|
+
import { readingPageHtml, wireReading } from './reading-view.js'; // a markdown file reads in the Reading layout (reading-layouts)
|
|
13
14
|
|
|
14
15
|
const CHECK_MS = 2500;
|
|
15
16
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
@@ -45,12 +46,12 @@ export function downloadsOf(f) {
|
|
|
45
46
|
const DL_ICON = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 4v11M7 10l5 5 5-5M5 20h14"/></svg>';
|
|
46
47
|
const SH_ICON = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 15V4M8 8l4-4 4 4M6 12v7h12v-7"/></svg>';
|
|
47
48
|
/** The title row: the name, and the download icon when the file was read. */
|
|
48
|
-
function
|
|
49
|
+
function actsHtml(f) {
|
|
49
50
|
const n = downloadsOf(f).length;
|
|
50
|
-
|
|
51
|
+
return n ? `<div class="vwacts"><button type="button" class="vwib" data-fdl aria-label="Download${n > 1 ? '…' : ''}" title="Download"${n > 1 ? ' aria-haspopup="menu" aria-expanded="false"' : ''}>${DL_ICON}</button>`
|
|
51
52
|
+ `<button type="button" class="vwib" data-fsh aria-label="Share…" title="Share" aria-haspopup="dialog" aria-expanded="false">${SH_ICON}</button></div>` : '';
|
|
52
|
-
return `<header class="cfh vwfh"><h1 class="cft">${esc(title)}</h1>${dl}</header>`;
|
|
53
53
|
}
|
|
54
|
+
function headHtml(f, title) { return `<header class="cfh vwfh"><h1 class="cft">${esc(title)}</h1>${actsHtml(f)}</header>`; }
|
|
54
55
|
/** The MIME type the original is saved with. */
|
|
55
56
|
export function mimeOf(f) { return isHtml(f) ? 'text/html' : f.kind === 'markdown' ? 'text/markdown' : 'text/plain'; }
|
|
56
57
|
/** A file as one standalone page, for the print frame and for a share link's copy (premium-viewer-share D3, S2): an .html file as it is, markdown as a
|
|
@@ -108,11 +109,14 @@ export function fileHtml(f, view = 'page') {
|
|
|
108
109
|
+ `<footer class="cff"><span>Read-only · PDF</span><span class="gap"></span><code>${esc(f.abs || f.rel)}</code></footer></article></div>`;
|
|
109
110
|
const foot = `<footer class="cff"><span>Read-only · ${readMinutes(f.text)} min read</span><span class="gap"></span><code>${esc(f.abs || f.rel)}</code></footer>`;
|
|
110
111
|
if (f.kind === 'markdown') {
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
return `<div class="vwdoc
|
|
114
|
-
+ (
|
|
115
|
-
|
|
112
|
+
// the Reading layout (reading-layouts, A334): a text file reads like every document; Download and Share sit in the head row
|
|
113
|
+
const h = pageHead(f.text);
|
|
114
|
+
return `<div class="vwdoc rdw">` + readingPageHtml(f.text, {
|
|
115
|
+
path: 'file:' + (f.abs || f.rel || f.path), title: h.title || f.name, head: `<span class="gap"></span>${actsHtml(f)}`,
|
|
116
|
+
meta: () => `<p class="rd-meta cfby">Read-only · ${readMinutes(f.text)} min read</p>`,
|
|
117
|
+
extraHead: h.labels.length ? `<div class="cflb">${h.labels.map((l) => `<span>${esc(l)}</span>`).join('')}</div>` : '',
|
|
118
|
+
foot: `<footer class="cff"><span>Read-only</span><span class="gap"></span><code>${esc(f.abs || f.rel)}</code></footer>`,
|
|
119
|
+
}) + '</div>';
|
|
116
120
|
}
|
|
117
121
|
const ext = (/\.([A-Za-z0-9]+)$/.exec(f.name || '') || [])[1] || 'text';
|
|
118
122
|
if (isHtml(f)) {
|
|
@@ -142,6 +146,7 @@ export function openChatFile(p, ctx = {}) {
|
|
|
142
146
|
// the download icon: one format saves at once; more open a menu under the icon (Escape or a press elsewhere closes it)
|
|
143
147
|
const wire = (el) => {
|
|
144
148
|
const r = el.querySelector('.vwpdfr[data-pdf-src]'); if (r) drawPdf(r, r.dataset.pdfSrc);
|
|
149
|
+
wireReading(el, el, 'file:' + (st.f.abs || st.f.rel || st.f.path));
|
|
145
150
|
el.onclick = (e) => {
|
|
146
151
|
const d = e.target.closest('[data-fdl]');
|
|
147
152
|
if (d) { const opts = downloadsOf(st.f); if (opts.length === 1) download(st.f, opts[0].fmt); else dlMenu(d, opts); return; }
|