create-pmos 0.835.0 → 0.837.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 +90 -50
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +89 -4
- package/workspace/guide/breakdown.md +1 -1
- package/workspace/guide/cli.md +19 -0
- package/workspace/guide/layout.md +5 -1
- package/workspace/lib/built-vs-design-http.js +81 -0
- package/workspace/lib/built-vs-design.js +454 -0
- package/workspace/lib/deps-cli.js +47 -2
- package/workspace/lib/features.json +1 -0
- package/workspace/lib/first-hour.js +219 -0
- package/workspace/lib/needs-providers.js +1 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/prefs-sync.js +1 -0
- package/workspace/lib/review-cli.js +6 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-first-hour.js +37 -0
- package/workspace/lib/routes-pop-work.js +4 -1
- package/workspace/lib/routes-team-waits.js +39 -2
- package/workspace/lib/team-cli.js +24 -1
- package/workspace/lib/team-slips.js +160 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/ask-here-ctx.js +20 -2
- package/workspace/public/pm/ask-here.css +6 -1
- package/workspace/public/pm/ask-here.js +38 -25
- package/workspace/public/pm/bd-backlog.js +34 -5
- package/workspace/public/pm/built-vs-design.css +16 -0
- package/workspace/public/pm/built-vs-design.js +95 -0
- package/workspace/public/pm/cozy-events-view.js +1 -1
- package/workspace/public/pm/cozy-home.css +10 -0
- package/workspace/public/pm/cozy-pop-work.js +6 -4
- package/workspace/public/pm/cozy-today-view.js +4 -1
- package/workspace/public/pm/first-hour.js +78 -0
- package/workspace/public/pm/goals-ds.js +3 -2
- package/workspace/public/pm/home-chat.js +19 -3
- package/workspace/public/pm/ini-tasks.js +2 -2
- package/workspace/public/pm/page-chat.js +2 -1
- package/workspace/public/pm/premium-board.js +2 -0
- package/workspace/public/pm/team-slips.js +48 -0
- package/workspace/public/premium-board.html +1 -0
- package/workspace/test-lists/built-vs-design.json +9 -0
- package/workspace/test-lists/first-hour.json +9 -0
- package/workspace/test-lists/team-slips.json +9 -0
|
@@ -192,12 +192,30 @@ export function target(c) {
|
|
|
192
192
|
if (l === 'field') { if (c.field) facts.push(['Field', c.field]); if (c.at) facts.push(['Place', c.at]); facts.push(['Shows', c.value]); }
|
|
193
193
|
const subject = l === 'field' ? [c.field || c.at, c.value].filter(Boolean).join(': ') : '';
|
|
194
194
|
return {
|
|
195
|
-
id: c.record.id, kind: c.record.kind.replace(/\s+/g, '-'), title: c.record.title || c.record.id, subject,
|
|
195
|
+
id: c.record.id, kind: c.record.kind.replace(/\s+/g, '-'), title: c.record.title || c.record.id, subject, where: l === 'field' ? (c.field || c.at) : '',
|
|
196
196
|
say: 'The PM pressed ' + (l === 'field' ? (c.field || c.at || 'part') + ' of ' : '') + 'the ' + c.record.kind + ' "' + (c.record.title || c.record.id) + '" on ' + (c.page || 'this page') + '. Read that record with pmos before you answer.'
|
|
197
197
|
+ (c.record.kind === 'person' ? ' For a 1:1, run `pmos people prep "' + (c.record.title || c.record.id) + '"` and answer from its lines, with their sources.' : ''),
|
|
198
198
|
facts: facts.filter((f) => clean(f[1])),
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
+
/** Where the card sits (done test U1): beside the press, under it by 14 px, above it when there is no room below, always 8 px inside the
|
|
202
|
+
* window. size: { width, height } of the card; at: { x, y } of the press (the window's middle third when absent). → { left, top } */
|
|
203
|
+
export function placeAt(size, at, W, H) {
|
|
204
|
+
const w = Number(size && size.width) || 0, h = Number(size && size.height) || 0;
|
|
205
|
+
const x = at && Number.isFinite(at.x) ? at.x : W / 2, y = at && Number.isFinite(at.y) ? at.y : H / 3;
|
|
206
|
+
const left = Math.max(8, Math.min(x - 40, W - w - 8));
|
|
207
|
+
let top = y + 14;
|
|
208
|
+
if (top + h > H - 8) top = Math.max(8, y - h - 14);
|
|
209
|
+
return { left: Math.round(left), top: Math.round(top) };
|
|
210
|
+
}
|
|
211
|
+
/** Where a dragged card goes (Wawan 2026-11-25: "move this popup freely"): the pointer's place less where it was held, kept so at least
|
|
212
|
+
* 48 px of the card, and all of its top line, stay in the window. at: { x, y } of the card's top-left; size: { width, height }. */
|
|
213
|
+
export function dragTo(at, size, W, H) {
|
|
214
|
+
const w = Number(size && size.width) || 0;
|
|
215
|
+
const left = Math.min(Math.max(48 - w, Math.round(at.x)), W - 48);
|
|
216
|
+
const top = Math.min(Math.max(0, Math.round(at.y)), H - 48);
|
|
217
|
+
return { left, top };
|
|
218
|
+
}
|
|
201
219
|
/** The words for the chat when nothing narrower than a section or the page was pressed. */
|
|
202
220
|
export function hereWords(c) { return [c && c.page, c && c.section].filter(Boolean).join(' · '); }
|
|
203
221
|
|
|
@@ -296,7 +314,7 @@ export function nativeMenu(el, o = {}) {
|
|
|
296
314
|
/** The presses that open the Ask card (cozy-nav.js mountNav calls it once per page). A right-click outside nativeMenu's places opens it at
|
|
297
315
|
* the pointer; a phone's long-press (LONG_MS still, under MOVE_PX of movement) opens it as a sheet and eats the click that follows. The
|
|
298
316
|
* card's own module loads on the first press (load: () => import('./ask-here.js')), so a page that is never pressed pays nothing. */
|
|
299
|
-
export const LONG_MS =
|
|
317
|
+
export const LONG_MS = 500, MOVE_PX = 10;
|
|
300
318
|
/** Places where a press and hold already means something (pick rows, drag to order, tick a check): a long-press there is theirs. */
|
|
301
319
|
export const HOLDS = '[data-pw-row], [data-iv-edit][data-drag], [data-iv-check], .bk-i, [data-po-list] [data-po-id], .gl-tip';
|
|
302
320
|
export function wire(document, load) { // the page's own document (a test passes a stand-in)
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
.ah-card { position: fixed; left: var(--bd-ahx, 8px); top: var(--bd-ahy, 8px); z-index: 2147483000; width: 392px; max-width: calc(100vw - 16px); max-height: min(640px, calc(100vh - 16px)); display: flex; flex-direction: column;
|
|
5
5
|
background: var(--cz-card); color: var(--cz-ink); border-radius: 8px; box-shadow: var(--cz-lift), 0 0 0 1px var(--cz-hair);
|
|
6
6
|
font-family: var(--cz-sans); font-size: var(--fs-body); line-height: var(--lh-body); overflow: hidden; }
|
|
7
|
-
.ah-hd { display: flex; align-items: center; gap: 2px; padding: 10px 6px 6px 12px; }
|
|
7
|
+
.ah-hd { display: flex; align-items: center; gap: 2px; padding: 10px 6px 6px 12px; cursor: grab; touch-action: none; } /* hold the top line to move the card */
|
|
8
|
+
.ah-card.moving { user-select: none; } .ah-card.moving .ah-hd { cursor: grabbing; }
|
|
9
|
+
.ah-card.sheet .ah-hd { cursor: auto; }
|
|
10
|
+
/* a small card reads smaller than a page (Wawan 2026-11-25: "the font is too big"); the size the person picks in a chat's + menu wins */
|
|
11
|
+
html:not([data-chat-fs]) .ah-card { --chat-k: .87; }
|
|
8
12
|
.ah-crumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
|
|
9
13
|
.ah-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 10px; border-radius: 6px; background: var(--cz-well); font-size: var(--fs-meta);
|
|
10
14
|
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
@@ -17,6 +21,7 @@
|
|
|
17
21
|
.ah-icb[disabled] { opacity: .35; cursor: default; }
|
|
18
22
|
.ah-bd { padding: 2px 12px 8px; display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; }
|
|
19
23
|
.ah-sug { display: flex; flex-direction: column; gap: 2px; }
|
|
24
|
+
.ah-sug[hidden], .ah-do[hidden] { display: none; } /* gone once a question is asked (Wawan 2026-11-25) */
|
|
20
25
|
.ah-sug button { all: unset; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--cz-ink); font-size: var(--fs-body); }
|
|
21
26
|
.ah-sug button:focus-visible { outline: 2px solid var(--cz-blue); }
|
|
22
27
|
.ah-sug svg { color: var(--cz-ok); flex: none; }
|
|
@@ -79,6 +79,7 @@ export async function open(el, o = {}) {
|
|
|
79
79
|
sheet();
|
|
80
80
|
const ctx = C.resolve(el, { scope: scopeOf(el), page: pageWords() });
|
|
81
81
|
if (!ctx) return false;
|
|
82
|
+
S.moved = false;
|
|
82
83
|
S.ctx = ctx; S.el = el; S.ws = wsOf(el); S.row = undefined; S.key += 1; S.today = new Date().toISOString().slice(0, 10);
|
|
83
84
|
const card = document.createElement('section');
|
|
84
85
|
card.className = 'ah-card' + (o.sheet ? ' sheet' : '');
|
|
@@ -159,11 +160,11 @@ async function mountChat() {
|
|
|
159
160
|
holder.appendChild(el);
|
|
160
161
|
chat.open(await targetOf());
|
|
161
162
|
}
|
|
163
|
+
function hideSug(card) { for (const id of ['#ahSug', '#ahDo']) { const el = card && card.querySelector(id); if (el) el.hidden = true; } }
|
|
162
164
|
function ask(q) {
|
|
163
165
|
const holder = S.card && S.card.querySelector('#ahChat'); if (!holder) return;
|
|
164
166
|
holder.classList.remove('quiet');
|
|
165
|
-
|
|
166
|
-
const can = S.card.querySelector('#ahDo'); if (can) can.hidden = true;
|
|
167
|
+
hideSug(S.card);
|
|
167
168
|
const ta = holder.querySelector('textarea'), form = holder.querySelector('form.hm-box');
|
|
168
169
|
if (!ta || !form) return;
|
|
169
170
|
ta.value = q; ta.dispatchEvent(new Event('input', { bubbles: true }));
|
|
@@ -177,32 +178,44 @@ async function full() {
|
|
|
177
178
|
return M.openAbout(t);
|
|
178
179
|
}
|
|
179
180
|
function place(o) {
|
|
180
|
-
const card = S.card; if (!card || o.sheet) return;
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
let left = Math.min(Math.max(8, x - 40), W - r.width - 8), top = y + 14;
|
|
184
|
-
if (top + r.height > H - 8) top = Math.max(8, y - r.height - 14);
|
|
185
|
-
card.style.setProperty('--bd-ahx', Math.round(left) + 'px'); card.style.setProperty('--bd-ahy', Math.round(top) + 'px');
|
|
181
|
+
const card = S.card; if (!card || o.sheet || S.moved) return;
|
|
182
|
+
const { left, top } = C.placeAt(card.getBoundingClientRect(), o, innerWidth, innerHeight);
|
|
183
|
+
card.style.setProperty('--bd-ahx', left + 'px'); card.style.setProperty('--bd-ahy', top + 'px');
|
|
186
184
|
}
|
|
187
185
|
// one click listener on the document for every card (a card's own buttons are real <button>s; the listener only routes them)
|
|
188
186
|
let routed = false;
|
|
189
|
-
function wireCard() {
|
|
190
|
-
if (routed)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
187
|
+
function wireCard(card) {
|
|
188
|
+
if (!routed) {
|
|
189
|
+
routed = true;
|
|
190
|
+
document.addEventListener('click', async (e) => {
|
|
191
|
+
const c = S.card; if (!c || !e.target || !e.target.closest || !c.contains(e.target)) return;
|
|
192
|
+
const b = e.target.closest('button'); if (!b) return;
|
|
193
|
+
if (S.CU && S.CU.owns(b)) { e.preventDefault(); await S.CU.press(b); return; }
|
|
194
|
+
const a = b.getAttribute('data-ah');
|
|
195
|
+
if (a === 'x') { close(); return; }
|
|
196
|
+
if (a === 'full') { full(); return; }
|
|
197
|
+
if (a === 'up') { const w = C.widen(S.ctx); if (w) { S.ctx = w; S.row = undefined; S.key += 1; noteUse('ask-here-widen'); putChatBack(); draw(); } return; }
|
|
198
|
+
const q = b.getAttribute('data-ah-q'); if (q) { noteUse('ask-here-question'); ask(q); return; }
|
|
199
|
+
const d = b.getAttribute('data-ah-do'); if (d) { noteUse('ask-here-do'); ask(d); }
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
// every card gets its own Esc and press-outside (close() takes them off again): a second card closes on Esc like the first
|
|
203
|
+
card.addEventListener('submit', () => hideSug(card)); // a typed question too: the ✦ lines have done their part
|
|
204
|
+
card.addEventListener('input', (e) => { if (e.target && e.target.matches && e.target.matches('textarea')) { const h = card.querySelector('#ahChat'); if (h) h.classList.remove('quiet'); } });
|
|
205
|
+
const drag = (e) => {
|
|
206
|
+
const c = S.card; if (!c || c.classList.contains('sheet') || e.button !== 0 || !e.target.closest) return;
|
|
207
|
+
const hd = e.target.closest('.ah-hd'); if (!hd || !c.contains(hd) || e.target.closest('button')) return;
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
const r = c.getBoundingClientRect(), dx = e.clientX - r.left, dy = e.clientY - r.top;
|
|
210
|
+
c.classList.add('moving');
|
|
211
|
+
const mv = (m) => { const p = C.dragTo({ x: m.clientX - dx, y: m.clientY - dy }, r, innerWidth, innerHeight); S.moved = true; c.style.setProperty('--bd-ahx', p.left + 'px'); c.style.setProperty('--bd-ahy', p.top + 'px'); };
|
|
212
|
+
const up = () => { c.classList.remove('moving'); document.removeEventListener('pointermove', mv, true); document.removeEventListener('pointerup', up, true); };
|
|
213
|
+
document.addEventListener('pointermove', mv, true); document.addEventListener('pointerup', up, true);
|
|
214
|
+
};
|
|
215
|
+
document.addEventListener('pointerdown', drag, true);
|
|
203
216
|
const esc = (e) => { if (e.key === 'Escape' && S.card) { e.stopPropagation(); close(); } };
|
|
204
|
-
const outside = (e) => { if (S.card && !S.card.contains(e.target) && !e.target.closest('.cz-pop-card, .cz-vw, [data-esc-layer]')) close(); };
|
|
217
|
+
const outside = (e) => { if (S.card && !S.card.contains(e.target) && !(e.target.closest && e.target.closest('.cz-pop-card, .cz-vw, [data-esc-layer]'))) close(); };
|
|
205
218
|
window.addEventListener('keydown', esc, true);
|
|
206
|
-
setTimeout(() => document.addEventListener('pointerdown', outside, true), 0);
|
|
207
|
-
S.off = () => { window.removeEventListener('keydown', esc, true); document.removeEventListener('pointerdown', outside, true); };
|
|
219
|
+
const t = setTimeout(() => document.addEventListener('pointerdown', outside, true), 0);
|
|
220
|
+
S.off = () => { clearTimeout(t); document.removeEventListener('pointerdown', drag, true); window.removeEventListener('keydown', esc, true); document.removeEventListener('pointerdown', outside, true); };
|
|
208
221
|
}
|
|
@@ -21,8 +21,9 @@ import * as WS from './work-select.js'; // the bulk move with one Undo, shared
|
|
|
21
21
|
import * as IF from './inline-fields.js'; // a task's sprint and priority, set in the row (initiative inline-sprint-priority)
|
|
22
22
|
import * as LE from './live-edit.js'; // a task's status or days show at once in the list, before it is read again; a failed save is put back
|
|
23
23
|
import { noteUse } from './use-log.js'; // the sprint draft's presses, counted on this computer only (sprint-draft-capacity)
|
|
24
|
-
import { pmGet } from './http.js'; // Work › Factory and Work › Dependencies read through the page's own GET helper
|
|
24
|
+
import { pmGet, pmPost } from './http.js'; // Work › Factory and Work › Dependencies read through the page's own GET helper
|
|
25
25
|
import * as TWV from './team-waits.js'; // team-waits (A364): Work › Dependencies, the waits on other teams (GET /api/team-waits)
|
|
26
|
+
import * as TSV from './team-slips.js'; // team-slips (A15): Upstream on Work › Dependencies, other teams' slips (GET /api/team-slips)
|
|
26
27
|
import * as LV from './line-view.js'; // quiet-rows slice B: the Line tab, every initiative by station (GET /api/line)
|
|
27
28
|
import * as FV from './factory.js'; // Work › Factory (factory-page-ui): the stations and the work they make, from GET /api/factory
|
|
28
29
|
import * as LB from './list-balance.js'; // the balance meter under the Backlog header (bet A448, board BalanceDS) // quiet-rows slice B: the Line tab, every initiative by station (GET /api/line)
|
|
@@ -241,11 +242,13 @@ function factoryPress(e) {
|
|
|
241
242
|
return !!e.target.closest('.ff');
|
|
242
243
|
}
|
|
243
244
|
/* ── the Dependencies tab (team-waits, board BatchCodeDS panel 14) ── the pick's waits on other teams, from GET /api/team-waits ── */
|
|
244
|
-
const DP = { got: null, key: '', used: false, rows: [] };
|
|
245
|
+
const DP = { got: null, key: '', used: false, rows: [], slips: [], undo: null };
|
|
245
246
|
async function readDeps() {
|
|
246
247
|
const ws = [...new Set(A.scope().map((s) => s.ws || ''))];
|
|
247
|
-
const
|
|
248
|
-
|
|
248
|
+
const q = (w) => (w ? '?ws=' + encodeURIComponent(w) : '');
|
|
249
|
+
const got = await Promise.all(ws.map((w) => Promise.all([pmGet('/api/team-waits' + q(w)).catch(() => null), pmGet('/api/team-slips' + q(w)).catch(() => null)])));
|
|
250
|
+
return got.filter(([r]) => r && r.ok).map(([r, s]) => ({ ws: r.ws, today: r.today, waits: (r.waits || []).map((x) => ({ ...x, ws: r.ws })),
|
|
251
|
+
watching: s && s.ok ? s.watching || 0 : 0, slips: s && s.ok ? (s.slips || []).map((x) => ({ ...x, ws: r.ws })) : [] }));
|
|
249
252
|
}
|
|
250
253
|
function drawDeps() {
|
|
251
254
|
if (!host) return;
|
|
@@ -259,11 +262,37 @@ function drawDeps() {
|
|
|
259
262
|
const today = (DP.got[0] || {}).today || '';
|
|
260
263
|
const waits = DP.got.flatMap((g) => g.waits).sort((a, b) => String(a.since).localeCompare(String(b.since)));
|
|
261
264
|
DP.rows = TWV.rowsOf(waits, { today });
|
|
262
|
-
|
|
265
|
+
DP.slips = TSV.rowsOf(DP.got.flatMap((g) => g.slips || []));
|
|
266
|
+
const watching = DP.got.reduce((n, g) => n + (g.watching || 0), 0);
|
|
267
|
+
const undo = DP.undo ? `<p class="bk-wait" role="status">${TWV.esc(DP.undo.said)} <button type="button" class="pm-btn" data-ts-undo="1">Undo</button></p>` : '';
|
|
268
|
+
host.innerHTML = undo + TSV.slipsHtml(DP.slips, { watching }) + (TWV.waitsHtml(DP.rows) || '<p class="bk-wait">Nothing waits on another team.</p>');
|
|
269
|
+
}
|
|
270
|
+
/** A press on an Upstream slip (team-slips): ✦ shifts (opens the initiative) or chases (a mail draft); ✕ waves it off. The row goes, with Undo. */
|
|
271
|
+
function slipPress(e) {
|
|
272
|
+
const u = e.target.closest('[data-ts-undo]');
|
|
273
|
+
if (u) {
|
|
274
|
+
const was = DP.undo; DP.undo = null;
|
|
275
|
+
if (was) pmPost('/api/team-slips/undo', { ws: was.ws, key: was.key }).then(() => { DP.got = null; if (depsOn()) drawDeps(); });
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
const b = e.target.closest('[data-ts-go],[data-ts-skip]');
|
|
279
|
+
if (!b) return false;
|
|
280
|
+
const r = DP.slips[Number(b.dataset.tsGo !== undefined ? b.dataset.tsGo : b.dataset.tsSkip)];
|
|
281
|
+
if (!r) return true;
|
|
282
|
+
const how = b.dataset.tsGo !== undefined ? r.move : 'skip';
|
|
283
|
+
if (how === 'shift' && A && A.openIni && r.ini) A.openIni(r.ini, r.ws); // its owner moves the date there: PMOS writes no date
|
|
284
|
+
else if (how === 'chase') location.href = TSV.chaseDraft(r.chase).mailto;
|
|
285
|
+
console.info(`[team-slips] ${how} ${r.key}`);
|
|
286
|
+
pmPost('/api/team-slips/handle', { ws: r.ws, key: r.key, how }).then((x) => {
|
|
287
|
+
if (x && x.ok) DP.undo = { ws: r.ws, key: r.key, said: how === 'skip' ? `Waved off ${r.key}.` : `${r.act}: done.` };
|
|
288
|
+
DP.got = null; if (depsOn()) drawDeps();
|
|
289
|
+
});
|
|
290
|
+
return true;
|
|
263
291
|
}
|
|
264
292
|
/** A press in the Dependencies tab: Chase opens a draft in the PM's own mail app. PMOS sends nothing. true when it was one. */
|
|
265
293
|
function depsPress(e) {
|
|
266
294
|
if (!depsOn()) return false;
|
|
295
|
+
if (slipPress(e)) return true;
|
|
267
296
|
const b = e.target.closest('[data-tw-chase]');
|
|
268
297
|
if (!b) return false;
|
|
269
298
|
const r = DP.rows[Number(b.dataset.twChase)];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* built-vs-design.css — the work popup's Review block (pm/built-vs-design.js). Tokens only. */
|
|
2
|
+
.bvd-rv { display: flex; flex-direction: column; gap: var(--space-8); }
|
|
3
|
+
.bvd-rv + .bvd-rv { border-top: 1px solid var(--line); padding-top: var(--space-12); }
|
|
4
|
+
.bvd-hd { justify-content: space-between; }
|
|
5
|
+
.bvd-two { display: flex; gap: var(--space-8); }
|
|
6
|
+
.bvd-fig { flex: 1 1 0; min-width: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-4); }
|
|
7
|
+
.bvd-pic { position: relative; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--line); overflow: visible; background: var(--card); }
|
|
8
|
+
.bvd-pic img { display: block; width: 100%; height: auto; }
|
|
9
|
+
.bvd-marks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
|
|
10
|
+
.bvd-marks ellipse { fill: none; stroke: var(--alert); stroke-width: 2; vector-effect: non-scaling-stroke; }
|
|
11
|
+
.bvd-marks text { fill: var(--alert); font-size: var(--fs-label); font-weight: var(--fw-strong); }
|
|
12
|
+
.bvd-ring.sent ellipse { stroke: var(--muted); }
|
|
13
|
+
.bvd-ring.sent text { fill: var(--muted); }
|
|
14
|
+
.bvd-list { list-style: none; margin: 0; padding: 0; }
|
|
15
|
+
.bvd-n { color: var(--alert); font-weight: var(--fw-strong); min-width: 1.5em; }
|
|
16
|
+
@media (max-width: 760px) { .bvd-two { flex-direction: column; } }
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* pm/built-vs-design.js — the work popup's Review block: the built screen beside the design it came from (initiative built-vs-design, job
|
|
2
|
+
* #1903, idea A380; agreed board BatchDesignDS panel 17). The data is GET /api/built-vs-design (lib/built-vs-design-http.js); `pmos review`
|
|
3
|
+
* writes the same store, so a review the chat makes shows here on the next read.
|
|
4
|
+
*
|
|
5
|
+
* read(ini, ws, redraw) GET once per initiative (again after reset()); redraw() when a review came back
|
|
6
|
+
* reset() forget what was read (a chat turn may have written a review)
|
|
7
|
+
* html(ini, ws) PURE over what read() kept → the Review block, '' when there is no open review (zero is silence)
|
|
8
|
+
* blockHtml(reviews, ws) PURE → the block for these reviews
|
|
9
|
+
* press(b, h) → true when b is one of the block's buttons: ✓ Accept, ↩ Send back as a fix; each with Undo in h.toast
|
|
10
|
+
*
|
|
11
|
+
* Design and Built side by side; on Built, each difference is a numbered circle where it is; the numbered lines under them. Matching parts
|
|
12
|
+
* get no mark. Built from the system's parts (pm-block, pm-h-sm, pm-li, pm-btn, pm-meta); icon-only buttons with an aria-label. The UI says
|
|
13
|
+
* PMOS, never Claude. Each press notes the use-log control builtVsDesign (the health number). */
|
|
14
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
15
|
+
const SV = (d, w = 16) => `<svg class="pm-ic" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
16
|
+
const I = { ok: 'M5 12.5l4.5 4.5L19 7.5', back: 'M9 14L4 9l5-5M4 9h11a5 5 0 0 1 0 10h-3' };
|
|
17
|
+
const f01 = (v) => Math.max(0, Math.min(1, Number(v) || 0));
|
|
18
|
+
const SHOWN = 420;
|
|
19
|
+
const n1 = (v) => (Math.round(v * 10) / 10).toString();
|
|
20
|
+
|
|
21
|
+
const CSS = typeof document !== 'undefined' && typeof URL !== 'undefined' ? new URL('./built-vs-design.css', import.meta.url).href : '';
|
|
22
|
+
if (CSS && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
|
|
23
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const READ = new Map(); // initiative id → [review] | null while reading | false when there is none
|
|
27
|
+
const http = () => import('./http.js');
|
|
28
|
+
export function reset() { READ.clear(); }
|
|
29
|
+
export function read(ini, ws, redraw) {
|
|
30
|
+
if (!ini || READ.has(ini)) return;
|
|
31
|
+
READ.set(ini, null);
|
|
32
|
+
http().then(({ pmGet }) => pmGet('/api/built-vs-design?ini=' + encodeURIComponent(ini) + (ws ? '&ws=' + encodeURIComponent(ws) : '')))
|
|
33
|
+
.then((x) => { const L = x && x.ok && Array.isArray(x.reviews) && x.reviews.length ? x.reviews : false; READ.set(ini, L); if (L && redraw) redraw(); })
|
|
34
|
+
.catch(() => READ.set(ini, false));
|
|
35
|
+
}
|
|
36
|
+
export function html(ini, ws) { const L = READ.get(ini); return L ? blockHtml(L, ws) : ''; }
|
|
37
|
+
|
|
38
|
+
const shot = (ws, r, which) => '/api/built-vs-design/shot?' + new URLSearchParams({ ...(ws ? { ws } : {}), pair: r.id, which }).toString();
|
|
39
|
+
function reviewHtml(r, ws) {
|
|
40
|
+
const diffs = r.diffs || [];
|
|
41
|
+
// the circles are an SVG over the built screen in its own pixels (no inline style): an ellipse round each box (the box grown by √2, so the
|
|
42
|
+
// ellipse passes outside its corners) and its number at the top right
|
|
43
|
+
const W = Number(r.w) > 0 ? Number(r.w) : 1000, H = Number(r.h) > 0 ? Number(r.h) : 1000;
|
|
44
|
+
// the number keeps its type size: the screen is drawn about SHOWN px wide, so a wider screenshot scales its number up by W / SHOWN
|
|
45
|
+
const k = Math.max(1, W / SHOWN);
|
|
46
|
+
const marks = diffs.length ? `<svg class="bvd-marks" viewBox="0 0 ${W} ${H}" aria-hidden="true">${diffs.map((d) => {
|
|
47
|
+
const x = f01(d.x) * W, y = f01(d.y) * H, w = f01(d.w) * W, h = f01(d.h) * H, rx = Math.max(8, w * 0.71), ry = Math.max(8, h * 0.71);
|
|
48
|
+
return `<g class="bvd-ring${d.task ? ' sent' : ''}" data-n="${esc(d.n)}"><ellipse cx="${n1(x + w / 2)}" cy="${n1(y + h / 2)}" rx="${n1(rx)}" ry="${n1(ry)}"/><text transform="translate(${n1(x + w / 2 + rx * 0.72)} ${n1(y + h / 2 - ry * 0.72)}) scale(${n1(k)})">${esc(d.n)}</text></g>`;
|
|
49
|
+
}).join('')}</svg>` : '';
|
|
50
|
+
const pic = (which, label, extra) => `<figure class="bvd-fig"><figcaption class="pm-meta">${label}</figcaption><div class="bvd-pic"><img src="${esc(shot(ws, r, which))}" alt="${esc(label + ' of ' + r.screen)}" loading="lazy">${extra}</div></figure>`;
|
|
51
|
+
const list = diffs.length
|
|
52
|
+
? `<ol class="bvd-list" aria-label="Differences">${diffs.map((d) => `<li class="pm-li bvd-li"><span class="bvd-n" aria-hidden="true">${esc(d.n)}</span><span class="txt">${esc(d.words)}${d.task ? ' <span class="pm-meta">· sent back as a fix</span>' : ''}</span>`
|
|
53
|
+
+ `<button type="button" class="pm-btn ghost sm" data-bvd-fix="${esc(d.n)}" data-bvd-pair="${esc(r.id)}" data-bvd-ini="${esc(r.ini)}" data-bvd-undo="${d.task ? '1' : ''}" aria-label="${esc(d.task ? 'Take back the fix for difference ' + d.n : 'Send difference ' + d.n + ' back as a fix')}" title="${esc(d.task ? 'Take back the fix' : 'Send back as a fix')}" aria-pressed="${d.task ? 'true' : 'false'}">${SV(I.back, 14)}</button></li>`).join('')}</ol>`
|
|
54
|
+
+ (r.more ? `<p class="pm-meta">${esc(r.more === 1 ? '1 more difference, not circled.' : r.more + ' more differences, not circled.')}</p>` : '')
|
|
55
|
+
: '<p class="pm-meta">Matches its design.</p>';
|
|
56
|
+
const ok = `<button type="button" class="pm-btn primary sm" data-bvd-accept="${esc(r.id)}" data-bvd-ini="${esc(r.ini)}" aria-label="${esc('Accept the built ' + r.screen)}" title="Accept">${SV(I.ok, 14)}</button>`;
|
|
57
|
+
return `<div class="bvd-rv" data-bvd="${esc(r.id)}"><div class="pm-row bvd-hd"><b class="bvd-sc">${esc(r.screen)}</b>${ok}</div>`
|
|
58
|
+
+ `<div class="bvd-two">${pic('design', 'Design', '')}${pic('built', 'Built', marks)}</div>${list}</div>`;
|
|
59
|
+
}
|
|
60
|
+
export function blockHtml(reviews, ws) {
|
|
61
|
+
const L = (reviews || []).filter((r) => r && r.id);
|
|
62
|
+
if (!L.length) return '';
|
|
63
|
+
return `<section class="pm-block pwd-blk bvd" aria-label="Review"><h2 class="pm-h-sm">Review</h2>${L.map((r) => reviewHtml(r, ws)).join('')}</section>`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const where = (h) => (h && h.where ? h.where() || {} : {});
|
|
67
|
+
async function post(h, body) { const { pmPost } = await http(); return pmPost('/api/built-vs-design', { ws: where(h).ws, ...body }).catch(() => null); }
|
|
68
|
+
async function used() { try { (await import('./use-log.js')).noteUse('builtVsDesign'); } catch { /* a count, never a reason to fail */ } }
|
|
69
|
+
const say = (h, m, undo) => { if (h && h.toast) h.toast(m, undo); };
|
|
70
|
+
const again = (h, ini) => { READ.delete(ini); if (h && h.redraw) h.redraw(); };
|
|
71
|
+
/** A press on the block: true when it was one of its buttons. */
|
|
72
|
+
export function press(b, h) {
|
|
73
|
+
const d = b && b.dataset;
|
|
74
|
+
if (!d || (d.bvdAccept == null && d.bvdFix == null)) return false;
|
|
75
|
+
const ini = d.bvdIni;
|
|
76
|
+
b.disabled = true;
|
|
77
|
+
(async () => {
|
|
78
|
+
if (d.bvdAccept != null) {
|
|
79
|
+
const pair = d.bvdAccept, res = await post(h, { ini, pair, act: 'accept' });
|
|
80
|
+
if (!res || res.ok === false) { b.disabled = false; say(h, (res && res.error) || 'The review was not accepted.'); return; }
|
|
81
|
+
used(); again(h, ini);
|
|
82
|
+
say(h, 'Accepted.', async () => { const u = await post(h, { ini, pair, act: 'reopen' }); if (!u || u.ok === false) say(h, (u && u.error) || 'The undo did not land.'); again(h, ini); });
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const pair = d.bvdPair, n = Number(d.bvdFix), undo = d.bvdUndo === '1';
|
|
86
|
+
const res = await post(h, { ini, pair, n, act: undo ? 'unfix' : 'fix' });
|
|
87
|
+
if (!res || res.ok === false) { b.disabled = false; say(h, (res && res.error) || 'Nothing was changed.'); return; }
|
|
88
|
+
if (!undo) used();
|
|
89
|
+
again(h, ini); if (h && h.reload) h.reload();
|
|
90
|
+
say(h, undo ? 'The fix was taken back.' : 'Sent back: ' + (res.title || 'a fix task was added') + '.', undo ? undefined : async () => {
|
|
91
|
+
const u = await post(h, { ini, pair, n, act: 'unfix' }); if (!u || u.ok === false) say(h, (u && u.error) || 'The undo did not land.'); again(h, ini); if (h && h.reload) h.reload();
|
|
92
|
+
});
|
|
93
|
+
})();
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
@@ -199,7 +199,7 @@ export function todayHtml(rows, o = {}) {
|
|
|
199
199
|
const ev = (x) => {
|
|
200
200
|
const over = now && (x.until || x.time) < now;
|
|
201
201
|
const fixLine = !!x.suggest;
|
|
202
|
-
return `<div class="evp-tr${o.busy && o.busy.has(x.key) ? ' busy' : ''}" data-key="${esc(x.key)}" data-kind="${esc(x.kind)}" data-type="${esc(typeOf(x))}"><span class="evp-tm pm-meta">${esc(x.time || (x.kind === 'meeting' ? 'All day' : 'Due'))}</span>`
|
|
202
|
+
return `<div class="evp-tr${o.busy && o.busy.has(x.key) ? ' busy' : ''}" data-key="${esc(x.key)}" data-kind="${esc(x.kind)}" data-type="${esc(typeOf(x))}"${askOf(x)}><span class="evp-tm pm-meta">${esc(x.time || (x.kind === 'meeting' ? 'All day' : 'Due'))}</span>`
|
|
203
203
|
+ `<div class="evp-ev pm-ev${over ? ' over' : ''}${x.fixed ? ' fixed' : ''}">${markHtml(x)}${whatHtml(x, o, fixLine)}${actsHtml(x, o, fixLine)}</div></div>${srcHtml(x, o)}`;
|
|
204
204
|
};
|
|
205
205
|
const line = '<div class="evp-tr evp-nowl" aria-label="Now"><span class="evp-tm pm-meta">now</span><span class="evp-nl" aria-hidden="true"></span></div>';
|
|
@@ -171,6 +171,16 @@ body.cz-home { min-height: 100vh; overflow: hidden; }
|
|
|
171
171
|
/* with the Viewer closed the conversation and its box sit in a centred column about 880px wide (AgInitStalled); the reopen button stays at
|
|
172
172
|
* the top right, and where the column reaches it the log keeps its first line clear of it */
|
|
173
173
|
.hm-chat { container-type: inline-size; }
|
|
174
|
+
/* the chat's text size (pmos.chat.fs, the + menu): the chat's type roles scale from the system's own sizes; Normal is the system size */
|
|
175
|
+
.hm-chat, .ah-card { --fs-body: calc(var(--type-body) * var(--chat-k, 1)); --fs-row: calc(var(--type-body) * var(--chat-k, 1)); --fs-field: calc(16px * var(--chat-k, 1));
|
|
176
|
+
--fs-meta: calc(var(--type-small) * var(--chat-k, 1)); --fs-label: calc(var(--type-small) * var(--chat-k, 1)); --fs-badge: calc(var(--type-small) * var(--chat-k, 1)); }
|
|
177
|
+
html[data-chat-fs="s"] { --chat-k: .87; }
|
|
178
|
+
html[data-chat-fs="l"] { --chat-k: 1.13; }
|
|
179
|
+
.hm-fsz { display: flex; align-items: center; gap: 4px; padding: 6px 8px 4px; border-top: 1px solid var(--cz-hair); margin-top: 4px; }
|
|
180
|
+
.hm-fsz b { flex: 1; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink2); }
|
|
181
|
+
.hm-pmenu .hm-fsb { flex: none; width: 36px; height: 32px; background: none; color: var(--cz-ink); cursor: pointer; text-align: center; font-weight: var(--fw-strong); }
|
|
182
|
+
.hm-fsb.fs-s { font-size: var(--fs-meta); } .hm-fsb.fs-m { font-size: var(--fs-body); } .hm-fsb.fs-l { font-size: var(--fs-panel); }
|
|
183
|
+
.hm-fsb.on { background: var(--cz-okbg); box-shadow: inset 0 0 0 1px var(--cz-ok); }
|
|
174
184
|
@media (min-width: 761px) {
|
|
175
185
|
/* the log scrolls at the panel's edge, not at the column's (PM, 2026-10-27 "Bad layout": the scrollbar stood in the middle of the page);
|
|
176
186
|
* its content and the header line keep to the same centred column as the box */
|
|
@@ -38,6 +38,7 @@ import * as IF from './inline-fields.js'; // a task's sprint and priority, set
|
|
|
38
38
|
import * as SD from './star-draft.js'; // a ✦ draft runs as a PMOS background job and lands on its line (star-buttons-act-directly A7)
|
|
39
39
|
import * as CAP from './pop-cap.js'; // five actions at most: Ask PMOS and the toolbar's four, the rest under ⋯ (popup-cap, idea A498)
|
|
40
40
|
import { noteUse } from './use-log.js';
|
|
41
|
+
import * as BVD from './built-vs-design.js'; // the built screen beside its design, its circles, Accept and Send back (built-vs-design, A380)
|
|
41
42
|
import * as STMAP from './story-map.js'; // a new bet's story map with the Release 1 line (initiative story-map, A419)
|
|
42
43
|
import * as TLY from './three-layouts.js'; // three layouts for a new screen, pick one (initiative three-layouts, A317)
|
|
43
44
|
import * as PR from './print-pdf.js'; // Print or PDF under ⋯ (job #1911, A379)
|
|
@@ -108,7 +109,7 @@ export const resetItems = () => { ITEMS.clear(); CRIT.clear(); };
|
|
|
108
109
|
/* A chat turn may have written what the popup shows (initiative chat-saves-to-cards, Wawan 2026-11-23: the chat saved the case and the card
|
|
109
110
|
* kept saying no line is written): the popup's reads of one initiative (the case's artefacts, the Library's rows, the done test's criteria)
|
|
110
111
|
* were kept for the page's life, so they are read again after every chat turn, and when the page comes back into view. */
|
|
111
|
-
function rereadAll() { ART.clear(); ITEMS.clear(); CRIT.clear(); TLY.forget(); if (artRedraw) artRedraw(); }
|
|
112
|
+
function rereadAll() { ART.clear(); ITEMS.clear(); CRIT.clear(); BVD.reset(); TLY.forget(); if (artRedraw) artRedraw(); }
|
|
112
113
|
if (typeof document !== 'undefined' && document.addEventListener) {
|
|
113
114
|
document.addEventListener('cz:chat-turn', () => rereadAll());
|
|
114
115
|
document.addEventListener('visibilitychange', () => { if (document.visibilityState === 'visible') rereadAll(); });
|
|
@@ -454,7 +455,7 @@ function model(r, v0, o) {
|
|
|
454
455
|
}
|
|
455
456
|
export function html(r, v, o = {}) {
|
|
456
457
|
const { W, S } = model(r, v, o), C = cols(), mode = store.get(SPAN, 'full');
|
|
457
|
-
if (phone() && !RO) return phoneHtml(W, S, keyOf(v, o), v);
|
|
458
|
+
if (phone() && !RO) return phoneHtml(W, S, keyOf(v, o), v).replace('<form class="pw-pask"', BVD.html(keyOf(v, o), o.ws) + '<form class="pw-pask"');
|
|
458
459
|
if (S.big) return `<div class="pw" data-pw-big-on>${breakdownHtml(W, C, mode, true, S)}</div>`;
|
|
459
460
|
if (!RO && !phone()) return dsHtml(r, v, o, W, S, C, mode);
|
|
460
461
|
return `<div class="pw">${overviewHtml(W, S, keyOf(v, o))}${breakdownHtml(W, C, mode, false, S)}${artefactsHtml(W.artefacts, C, true, { scope: keyOf(v, o), recPath: v.prd && (v.prd.path || v.prd) })}</div>`;
|
|
@@ -501,7 +502,7 @@ function dsHtml(r, v, o, W, S, C, mode) {
|
|
|
501
502
|
const ppl = SMAP.blockFor(id, o.ws, () => { if (artRedraw) artRedraw(); });
|
|
502
503
|
// the story map (A419): a new bet's journey and its Release 1 line, above the breakdown; nothing when there is no map and the bet has tasks
|
|
503
504
|
const smap = STMAP.blockHtml({ id, ws: o.ws || '', title: W.title || '', tasks: stagesOf(r, v, { ...o, today: W.today, subAll: true }).filter((x) => x.kind === 'task').length });
|
|
504
|
-
return `<div class="pw pwd">${PD.overviewHtml(W, r, { oid: id, dropped: dropped(), open: ovOpen() })}${ppl}<div class="pwd-main">${PD.stagesHtml(st, W)}${lay}${smap}${crit}${wbs}</div></div>`;
|
|
505
|
+
return `<div class="pw pwd">${PD.overviewHtml(W, r, { oid: id, dropped: dropped(), open: ovOpen() })}${ppl}<div class="pwd-main">${PD.stagesHtml(st, W)}${lay}${smap}${crit}${BVD.html(id, o.ws)}${wbs}</div></div>`;
|
|
505
506
|
}
|
|
506
507
|
|
|
507
508
|
/** The grouping ✦ the PM said no to, for this initiative: 'group:<stage>'. */
|
|
@@ -912,7 +913,7 @@ export function wire(body, h0, x0) {
|
|
|
912
913
|
// the Viewer reuses its body for the next item: the presses read the item shown now from the body, so one set of listeners serves all
|
|
913
914
|
body.__pwh = ED.writes(h0); body.__pwx = x0;
|
|
914
915
|
{ const o = x0 && x0.o ? x0.o() || {} : {}; ASK_AT = o.id ? { id: String(o.id), ws: o.ws || '' } : null; }
|
|
915
|
-
{ const c = cur(); if (c) { readItems(c.id, (x0.o() || {}).ws, () => redraw()); readCrit(c.id, (x0.o() || {}).ws, () => redraw()); if (!RO && !phone()) TLY.read((x0.o() || {}).ws, c.id, () => redraw()); if (c.S.top) body.scrollTop = c.S.top; }
|
|
916
|
+
{ const c = cur(); if (c) { readItems(c.id, (x0.o() || {}).ws, () => redraw()); readCrit(c.id, (x0.o() || {}).ws, () => redraw()); if (!RO && !phone()) TLY.read((x0.o() || {}).ws, c.id, () => redraw()); if (!RO) BVD.read(c.id, (x0.o() || {}).ws, () => redraw()); if (c.S.top) body.scrollTop = c.S.top; }
|
|
916
917
|
const q = OPEN_ON_DRAW;
|
|
917
918
|
if (c && q && q.id === String(c.id) && Date.now() - q.at < 15000) { OPEN_ON_DRAW = null; setTimeout(() => { const c2 = cur(); if (c2) openSmall(q.uid, c2, body.__pwh, body.__pwx, body); }, 0); } }
|
|
918
919
|
if (body.__pw) return;
|
|
@@ -953,6 +954,7 @@ export function wire(body, h0, x0) {
|
|
|
953
954
|
if (b.disabled || !body.contains(b)) return;
|
|
954
955
|
const c = cur(); if (!c) return;
|
|
955
956
|
const h = body.__pwh, x = body.__pwx;
|
|
957
|
+
if (BVD.press(b, h)) return; // the Review block: ✓ Accept, ↩ Send back as a fix (built-vs-design)
|
|
956
958
|
const d = b.dataset, S = c.S, W = c.W;
|
|
957
959
|
if (d.pwv) { store.set(VIEW, d.pwv); redraw(); return; }
|
|
958
960
|
if ('pwOv' in d) { try { localStorage.setItem(OV, ovOpen() ? '0' : '1'); } catch { /* a private window */ } redraw(); return; }
|
|
@@ -28,7 +28,10 @@ export function setCapShown(ids) { if (Array.isArray(ids) && ids.length) CAP_SHO
|
|
|
28
28
|
/** What a right-click on a Today row names (initiative ask-anywhere): its initiative when it has one, else the row itself. */
|
|
29
29
|
function askOf(r) {
|
|
30
30
|
if (r.ini) return ` data-ask="initiative:${esc(r.ini)}" data-ask-title="${esc(r.work || r.ini)}"${r.ws ? ` data-ask-ws="${esc(r.ws)}"` : ''}`;
|
|
31
|
-
|
|
31
|
+
// a morning-brief call of a "needs you" item (call:n:<key>) opens that item's viewer: need:<key>, or the Weekly update's own viewer
|
|
32
|
+
// (update) for its row (home-app.js openRow). Name the item it opens, so the Ask card's chat is that item's own.
|
|
33
|
+
const k = String(r.key || ''), n = /^call:n:/.test(k) ? k.slice(7) : null, id = n === null ? k : n === 'update' ? 'update' : 'need:' + n;
|
|
34
|
+
return ` data-ask="today item:${esc(id)}" data-ask-title="${esc(r.title || r.text || '')}"`;
|
|
32
35
|
}
|
|
33
36
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
34
37
|
const svg = (d, w = 15, sw = 1.9) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* pm/first-hour.js — the first hour for a new engineer on Work, below Team skills (bet A55, initiative first-hour; board BatchMoreBDS panel 29,
|
|
2
|
+
* Team › Welcome).
|
|
3
|
+
*
|
|
4
|
+
* mount(host, { ws, single, say }) → draws the block into `host`; a Work page that shows several products at once shows none
|
|
5
|
+
*
|
|
6
|
+
* Built only from Komorebi parts: a list block (pm-block list, its head), one pm-li row per step with its state glyph (Done when opened, Needs
|
|
7
|
+
* you for the next one, No signal for the rest), a pm-said line with the opened step's detail, a ✦ pm-said suggestion with icon-only ✓ and ✕,
|
|
8
|
+
* and a pm-said line "<name> finished the welcome." with an icon-only ✕. It reads and writes GET and POST /api/team/welcome
|
|
9
|
+
* (lib/routes-first-hour.js) and nothing else. Every row carries data-ask, so Ask anywhere can answer about any step.
|
|
10
|
+
* · No welcome, no suggestion and no finished line: no block (zero is silence). A published page (?pack=) never draws it.
|
|
11
|
+
* Each step press notes firstHourOpen in the local use log (the bet's kill line). */
|
|
12
|
+
import { pmGet, pmPost } from './http.js';
|
|
13
|
+
import { noteUse } from './use-log.js';
|
|
14
|
+
import { stateGlyph } from './state-glyph.js';
|
|
15
|
+
|
|
16
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
17
|
+
const SV = (d, cls = 'pm-ic') => `<svg class="${cls}" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
18
|
+
const I = { star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', x: 'M6 6l12 12M18 6L6 18', ok: 'M5 12.5l4.5 4.5L19 7.5' };
|
|
19
|
+
const btn = (name, value, label, icon) => `<button type="button" class="pm-btn outline" name="${name}" value="${esc(value)}" aria-label="${esc(label)}" title="${esc(label)}">${SV(icon)}</button>`;
|
|
20
|
+
|
|
21
|
+
/** The block's markup. v = { welcomes, finished, suggest }, open = { who, step } (the step whose detail shows). Pure, so the test reads it. */
|
|
22
|
+
export function blockHtml(v, open = null) {
|
|
23
|
+
const welcomes = Array.isArray(v && v.welcomes) ? v.welcomes : [];
|
|
24
|
+
const finished = Array.isArray(v && v.finished) ? v.finished : [];
|
|
25
|
+
const suggest = v && v.suggest ? String(v.suggest) : '';
|
|
26
|
+
if (!welcomes.length && !finished.length && !suggest) return '';
|
|
27
|
+
const parts = [];
|
|
28
|
+
for (const w of welcomes) {
|
|
29
|
+
const next = (w.steps.find((s) => !s.done) || {}).key;
|
|
30
|
+
const rows = w.steps.map((s) => {
|
|
31
|
+
const state = s.done ? 'done' : s.key === next ? 'you' : 'none';
|
|
32
|
+
return `<button type="button" class="pm-li" name="firstHourOpen" value="${esc(s.key)}" data-who="${esc(w.who)}" data-ask="welcome:${esc(w.who)}:${esc(s.key)}">`
|
|
33
|
+
+ `${stateGlyph(state)}<span class="txt"><span class="t">${esc(s.n)} · ${esc(s.title)}</span><span class="w">${esc(s.what)}</span></span></button>`;
|
|
34
|
+
}).join('');
|
|
35
|
+
const shown = open && open.who === w.who ? w.steps.find((s) => s.key === open.step) : null;
|
|
36
|
+
const detail = shown ? `<p class="pm-said" data-welcome-detail="${esc(shown.key)}"><span>${esc(shown.detail)}</span></p>` : '';
|
|
37
|
+
parts.push(`<section class="pm-block list" aria-label="Welcome, ${esc(w.who)}"><div class="head"><h3 class="pm-h-sm">Welcome, ${esc(w.who)}</h3><span class="sp"></span>`
|
|
38
|
+
+ `<span class="pm-meta">${w.steps.length} steps</span></div><div class="rows">${rows}</div>${detail}</section>`);
|
|
39
|
+
}
|
|
40
|
+
for (const who of finished) {
|
|
41
|
+
parts.push(`<p class="pm-said" data-welcome-finished="${esc(who)}"><span>${esc(who)} finished the welcome.</span>${btn('firstHourSeen', who, 'Clear this line', I.x)}</p>`);
|
|
42
|
+
}
|
|
43
|
+
if (suggest) {
|
|
44
|
+
parts.push(`<p class="pm-said" data-welcome-suggest="${esc(suggest)}">${SV(I.star, 'pm-ic pm-star')}<span>${esc(suggest)} is new here. Start their first hour?</span>`
|
|
45
|
+
+ `${btn('firstHourStart', suggest, 'Start the welcome', I.ok)}${btn('firstHourSkip', suggest, 'Not now', I.x)}</p>`);
|
|
46
|
+
}
|
|
47
|
+
return parts.join('');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const published = () => typeof location !== 'undefined' && /[?&]pack=/.test(location.search || '');
|
|
51
|
+
|
|
52
|
+
/** Draw the block into `host` and wire its presses. */
|
|
53
|
+
export async function mount(host, opts = {}) {
|
|
54
|
+
if (!host) return;
|
|
55
|
+
const { ws = null, single = true, say = null } = opts;
|
|
56
|
+
if (!single || published()) { host.hidden = true; host.innerHTML = ''; return; }
|
|
57
|
+
const r = await pmGet('/api/team/welcome' + (ws ? '?ws=' + encodeURIComponent(ws) : '')).catch(() => null);
|
|
58
|
+
if (!r || !r.ok) { host.hidden = true; return; } // the block is an extra: a failed read leaves Work as it was
|
|
59
|
+
const html = blockHtml(r, host._open || null);
|
|
60
|
+
host.hidden = !html; host.innerHTML = html;
|
|
61
|
+
const post = (act, who, step) => pmPost('/api/team/welcome', { ws, act, who, step }).catch(() => null);
|
|
62
|
+
host.onclick = async (e) => {
|
|
63
|
+
const b = e.target.closest('button[name^="firstHour"]'); if (!b) return;
|
|
64
|
+
noteUse(b.name);
|
|
65
|
+
b.disabled = true;
|
|
66
|
+
const who = b.name === 'firstHourOpen' ? b.dataset.who : b.value;
|
|
67
|
+
const act = { firstHourOpen: 'open', firstHourSeen: 'seen', firstHourStart: 'start', firstHourSkip: 'skip' }[b.name];
|
|
68
|
+
const res = await post(act, who, act === 'open' ? b.value : null);
|
|
69
|
+
if (!res || !res.ok) { b.disabled = false; if (say) say((res && res.error) || 'Not saved.'); return; }
|
|
70
|
+
if (act === 'open') host._open = { who, step: b.value };
|
|
71
|
+
if (act === 'start' && say) say(`Welcome started for ${who}.`, async () => { await post('end', who); mount(host, opts); });
|
|
72
|
+
if (act === 'skip' && say) say('Suggestion skipped.');
|
|
73
|
+
mount(host, opts);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Draw the block again after a read of Work. */
|
|
78
|
+
export const refresh = (host, opts) => mount(host, opts);
|
|
@@ -169,10 +169,11 @@ export function tableHtml(p, o) {
|
|
|
169
169
|
left: (k) => `<td class="pm-meta">${esc(k.left)}</td>`,
|
|
170
170
|
levers: (k, ob, i) => `<td class="gl-lvs">${i === 0 ? ob.levers.map((l) => `<span><b>${esc(l.title)}</b> <span class="pm-meta${l.tone ? ' gl-al' : ''}">${esc(l.txt)}</span></span>`).join('') : ''}</td>`,
|
|
171
171
|
};
|
|
172
|
-
const group = (label, sub, extra = '') => `<tr class="gl-g"><td colspan="${n}"><div class="pm-group"><b>${esc(label)}</b><span>${esc(sub)}</span>${extra}</div></td></tr>`;
|
|
172
|
+
const group = (label, sub, extra = '', ask = '') => `<tr class="gl-g"${ask}><td colspan="${n}"><div class="pm-group"><b>${esc(label)}</b><span>${esc(sub)}</span>${extra}</div></td></tr>`;
|
|
173
173
|
let body = '';
|
|
174
174
|
for (const ob of T.objectives) {
|
|
175
|
-
|
|
175
|
+
// the objective is the record a right-click names (ask-anywhere)
|
|
176
|
+
body += group(ob.label + (ob.title ? ' · ' + ob.title : ''), noun(ob.krs.length, 'key result', 'key results'), '', ob.id ? ` data-ask="goal:${esc(ob.id)}" data-ask-title="${esc(ob.label + (ob.title ? ' · ' + ob.title : ''))}"` : '');
|
|
176
177
|
body += ob.krs.map((k, i) => `<tr><td class="gl-kr"><a href="#" class="gl-k" data-gl-ws="${esc(ws)}" data-gl-kr="${esc(k.key)}" title="${esc(k.sub)}">${esc(k.token)} · ${esc(k.title)}</a></td>`
|
|
177
178
|
+ cols.map(([c]) => cell[c](k, ob, i)).join('') + '</tr>').join('');
|
|
178
179
|
}
|
|
@@ -47,6 +47,18 @@ import { nextPromptUi } from './next-prompt-ui.js'; // the suggested next prom
|
|
|
47
47
|
import { cardsUi } from './chat-cards.js';
|
|
48
48
|
import { a2uiUi } from './a2ui-view.js'; // a2ui-inbound-render: another agent's A2UI v1.0 surface, drawn with PMOS's own parts; a press goes back as words // ask-cards-and-pickers: the rows an answer names, live, and a picker (canvas A2Cards, A2Ask)
|
|
49
49
|
import { runAction, routeOf } from './action-run.js';
|
|
50
|
+
|
|
51
|
+
/* The chat's text size, one for every chat (the person's choice, kept with their view choices: pmos.chat.fs, lib/prefs-sync.js). The page's
|
|
52
|
+
* <html data-chat-fs> sets it; cozy-home.css scales the chat's type roles from it. */
|
|
53
|
+
const FS = [['s', 'Small', 'A−'], ['m', 'Normal', 'A'], ['l', 'Large', 'A+']];
|
|
54
|
+
const FS_KEY = 'pmos.chat.fs';
|
|
55
|
+
export function chatFs() { try { const v = localStorage.getItem(FS_KEY); return FS.some((f) => f[0] === v) ? v : ''; } catch { return ''; } }
|
|
56
|
+
export function setChatFs(v) {
|
|
57
|
+
if (!FS.some((f) => f[0] === v)) return;
|
|
58
|
+
try { localStorage.setItem(FS_KEY, v); } catch { /* the size still shows on this page */ }
|
|
59
|
+
if (typeof document !== 'undefined') document.documentElement.dataset.chatFs = v;
|
|
60
|
+
}
|
|
61
|
+
if (typeof document !== 'undefined' && document.documentElement && chatFs()) document.documentElement.dataset.chatFs = chatFs();
|
|
50
62
|
import { tellCards } from './card-log.js'; // each answer's card list and each press to the local use log (card catalog rule 9, A511)
|
|
51
63
|
/* The views a chat opens go in the Viewer: on a page with no dialog the old viewer's views draw in the cozy card (premium-viewer.js). */
|
|
52
64
|
let REPORT_TAB = false; // a report tab was opened from a chat on this page: only then is premium-report-tab.js read at send
|
|
@@ -504,9 +516,12 @@ export function mountChat(el, host) {
|
|
|
504
516
|
// One box everywhere (testing fixes: a loose chat and an initiative's chat drew two different boxes): +, / and @ (in an initiative), the
|
|
505
517
|
// To: or In: chip, the mic and ↑ send. A loose session's "Link to an initiative" is in the + menu, and no hint line repeats under the box.
|
|
506
518
|
const link = sc.loose && t.sid ? '<button type="button" role="menuitem" data-hm-link><b>Link to an initiative</b><em>Move this chat under one</em></button>' : '';
|
|
507
|
-
|
|
508
|
-
const
|
|
509
|
-
|
|
519
|
+
// the chat's text size (Wawan 2026-11-25: "I can edit the font size on the chat, any chat"): three sizes in the + menu, kept for the person
|
|
520
|
+
const fsz = chatFs();
|
|
521
|
+
const size = '<span class="hm-fsz" role="group" aria-label="Text size"><b>Text size</b>' + FS.map(([k, n, a]) => `<button type="button" class="hm-fsb fs-${k}${fsz === k ? ' on' : ''}" data-hm-fs="${k}" aria-pressed="${fsz === k}" aria-label="${n} text" title="${n} text">${a}</button>`).join('') + '</span>';
|
|
522
|
+
const addOpen = !!C.addOpen;
|
|
523
|
+
const add = `<span class="hm-mw hm-addw"><button type="button" class="hm-tool" id="hmAdd" data-hm-add aria-haspopup="menu" aria-expanded="${addOpen}" aria-label="${t.key ? 'Attach a file, notes and more' : 'More'}" title="${t.key ? 'Attach a file' : 'More'}">${SVG(PLUS)}</button>`
|
|
524
|
+
+ `<span class="hm-pmenu hm-addm" role="menu" aria-label="Add"${addOpen ? ' data-esc-layer' : ' hidden'}>${attach}${notesBtn}${term}${link}${size}</span>${t.key ? '<input type="file" id="hmFile" multiple hidden>' : ''}</span>`;
|
|
510
525
|
const wait = C.conv && C.conv.ask && t.also ? `<button type="button" class="hm-chip" data-hm-also><i class="dot" aria-hidden="true"></i><span>1 more next step</span></button>` : '';
|
|
511
526
|
const to = t.to && !wait ? `<button type="button" class="hm-chip to" data-hm-to aria-label="Who reads this: ${esc(t.to.name)}. Change">${avHtml(t.to, 20)}<span>To: ${esc(t.to.name)}</span></button>` : '';
|
|
512
527
|
// chief-of-staff C5 (CsB): the soft "You are on …" chip of the chat over a page; × drops it (sc.drop), and the chip then reads Everything
|
|
@@ -632,6 +647,7 @@ export function mountChat(el, host) {
|
|
|
632
647
|
if (CU.owns(b)) { await CU.press(b); return; } // a row's button, a picker's choice, its ✓ or Undo (pm/chat-cards.js); any other button stays synchronous
|
|
633
648
|
const ic = b.closest('.hm-icard'), card = C.t && C.t.intro && C.t.intro.card;
|
|
634
649
|
if (ic && card && card.press) { if (await card.press(b)) draw(); return; }
|
|
650
|
+
if (d.hmFs) { setChatFs(d.hmFs); drawFoot({ role: role() }); return; } // the menu stays open: the size shows at once, and a second press is one step on
|
|
635
651
|
if ('hmMic' in d) { mic(); return; }
|
|
636
652
|
if (d.hmVer && C.t && C.t.ini) { import('./cozy-proto.js').then((M) => M.openVersion({ ws: C.t.ws, ini: C.t.ini, n: Number(d.hmVer) })).catch(() => {}); return; }
|
|
637
653
|
if (d.hmUnmark) { if (C.mark) C.mark[d.hmUnmark] = null; drawFoot({ role: role() }); return; }
|