create-pmos 0.617.0 → 0.619.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 +33 -27
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-initiative-test.js +2 -1
- package/workspace/changelog.json +32 -0
- package/workspace/guide/layout.md +13 -6
- package/workspace/lib/board-premium.js +1 -0
- package/workspace/lib/board-trail.js +3 -1
- package/workspace/lib/core-docs.js +1 -1
- package/workspace/lib/engine/boards.js +2 -2
- package/workspace/lib/okr-goals.js +2 -1
- package/workspace/lib/routes-boards.js +20 -4
- package/workspace/lib/status-when.js +15 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +1 -0
- package/workspace/public/pm/bd-work.css +5 -4
- package/workspace/public/pm/cozy-day-pick.css +9 -8
- package/workspace/public/pm/cozy-home.css +54 -2
- package/workspace/public/pm/cozy-pop-work.css +29 -0
- package/workspace/public/pm/cozy-pop-work.js +157 -14
- package/workspace/public/pm/cozy-popup.css +6 -1
- package/workspace/public/pm/cozy-popup.js +26 -7
- package/workspace/public/pm/cozy-status-when.js +17 -2
- package/workspace/public/pm/cozy-task-pop.css +34 -0
- package/workspace/public/pm/cozy-task-pop.js +199 -0
- package/workspace/public/pm/home-app.js +7 -1
- package/workspace/public/pm/home-chat.js +13 -7
- package/workspace/public/pm/home-data.js +31 -1
- package/workspace/public/pm/home-ini.js +8 -1
- package/workspace/public/pm/page-chat.js +1 -1
- package/workspace/public/pm/premium-board.js +18 -4
- package/workspace/test-lists/chat-turns.json +9 -0
|
@@ -225,3 +225,32 @@ button.pw-fv .grey { color: var(--cz-ink3); }
|
|
|
225
225
|
/* round 3 item 11b: the task a Today row opened, lit until another task is opened */
|
|
226
226
|
.pw-kr.lit { background: var(--cz-bluebg); box-shadow: inset 3px 0 0 var(--cz-blue); }
|
|
227
227
|
.pw-kr.lit .pw-tt { font-weight: var(--fw-strong); }
|
|
228
|
+
/* Work breakdown as one row of stages and one list of tasks (round 3 point 22): the stages are chips on the initiative's own bar; the tasks are
|
|
229
|
+
* the Backlog's own list (pm/bd-backlog.css), this initiative's only */
|
|
230
|
+
.pw-one .pw-stgs { min-height: 44px; }
|
|
231
|
+
.pw-one .pw-stgs .pw-it { overflow: visible; }
|
|
232
|
+
.pw-scs { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 0; }
|
|
233
|
+
.pw-sc { display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 999px; background: var(--cz-well); padding: 3px 10px 3px 6px; font: inherit; font-size: var(--fs-meta); color: var(--cz-ink2); cursor: pointer; white-space: nowrap; }
|
|
234
|
+
.pw-sc .pw-n { min-width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--cz-card); font-size: var(--fs-badge); color: var(--cz-ink3); }
|
|
235
|
+
.pw-sc:hover { color: var(--cz-ink); }
|
|
236
|
+
.pw-sc.dn { color: var(--cz-ink3); }
|
|
237
|
+
.pw-sc.now { background: var(--cz-blue-soft, var(--cz-well)); color: var(--cz-ink); font-weight: var(--fw-strong); box-shadow: 0 0 0 1px var(--cz-blue) inset; }
|
|
238
|
+
.pw-sc.late .pw-n { background: var(--cz-latebg); color: var(--cz-late); }
|
|
239
|
+
.pw-sc:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
|
|
240
|
+
.pw-one .pw-tl { position: relative; min-height: 32px; }
|
|
241
|
+
.pw-tasks { margin-top: 14px; }
|
|
242
|
+
.pw-lh { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
|
|
243
|
+
.pw-lh h4 { margin: 0; flex: 1; font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
244
|
+
.pw-lh .pw-lk { display: inline-flex; align-items: center; gap: 2px; }
|
|
245
|
+
.pw-ltx { margin: 6px 2px; color: var(--cz-ink3); font-size: var(--fs-row); }
|
|
246
|
+
.pw-bk .bk-emb { border-radius: 14px; background: var(--cz-card); box-shadow: 0 0 0 1px var(--cz-hair); }
|
|
247
|
+
.hi-pop.pw-stc .hi-h3 { margin: 0 0 4px; }
|
|
248
|
+
.hi-pop.pw-stc .hi-small { margin: 0 0 2px; }
|
|
249
|
+
.hi-pop.pw-stc .warn { color: var(--cz-late); }
|
|
250
|
+
.pw-bk .bk-r.lit { background: var(--cz-bluebg); box-shadow: inset 3px 0 0 var(--cz-blue); }
|
|
251
|
+
.hi-pop .pw-stch { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
|
|
252
|
+
.hi-pop .pw-stch .hi-h3 { margin: 0; }
|
|
253
|
+
.hi-pop .pw-stch .pw-ib.solid { width: 32px; height: 32px; }
|
|
254
|
+
.hi-pop .pw-stch .pw-ib.solid:disabled { opacity: .45; cursor: default; }
|
|
255
|
+
.hi-pop.pw-stc .pw-when { margin: 4px 0 8px; }
|
|
256
|
+
.pw-sc .pw-n svg { display: block; }
|
|
@@ -25,6 +25,7 @@ import * as ED from './ini-edit.js';
|
|
|
25
25
|
import * as SW from './cozy-status-when.js'; // When did this happen? after a status pick (round 3 point 18)
|
|
26
26
|
import * as DP from './cozy-day-pick.js'; // the app's own day field, "15 Oct 2026"
|
|
27
27
|
const { localToday } = DP;
|
|
28
|
+
import { rowBar } from './bd-span.js'; // the stages row: the Board's own bar (round 3 point 22)
|
|
28
29
|
import * as AK from './artefact-kind.js'; // the Kind of a file and one row per kind (round 3 point 16), shared with the Library // the rename and its Undo, the same write as the old List (batch 18 item 16)
|
|
29
30
|
|
|
30
31
|
const CSS = new URL('./cozy-pop-work.css', import.meta.url).href;
|
|
@@ -56,6 +57,9 @@ const stOf = (id) => {
|
|
|
56
57
|
const looseKeep = (id, on) => { const L = (store.get(LOOSE, []) || []).filter((x) => x !== id); if (on) L.push(id); store.set(LOOSE, L.slice(-200)); };
|
|
57
58
|
/** The task a Today row opened (round 3 item 11b): its stage opens and its row is lit until another task is focused. '' clears it. */
|
|
58
59
|
export function focus(id, uid) { stOf(String(id)).focus = uid ? String(uid) : ''; }
|
|
60
|
+
/** A Today task row (popup round 3 point 20g): once the initiative popup draws, the small task popup opens on top at that task. */
|
|
61
|
+
let OPEN_ON_DRAW = null;
|
|
62
|
+
export function openOnDraw(id, uid) { OPEN_ON_DRAW = id && uid ? { id: String(id), uid: String(uid), at: Date.now() } : null; }
|
|
59
63
|
const ITEMS = new Map(); // initiative id → the Library's rows | null while reading | false when the route is not there
|
|
60
64
|
const ib = (attr, label, d, cls = '') => `<button type="button" class="pw-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(d)}</button>`;
|
|
61
65
|
|
|
@@ -111,6 +115,28 @@ function productName(p, ws) {
|
|
|
111
115
|
return n && !M.idShaped(n) ? n : '';
|
|
112
116
|
}
|
|
113
117
|
|
|
118
|
+
/* the initiative's tasks as one list (round 3 point 22): the Backlog's own list and grouping (pm/bd-backlog.js listHtml / bindList), read from
|
|
119
|
+
* GET /api/backlog once per product. Until that module is on the page, or while the route answers nothing, the stages keep their tasks as before. */
|
|
120
|
+
let BK = null, bkRedraw = null;
|
|
121
|
+
import('./bd-backlog.js').then((m) => { BK = m && typeof m.listHtml === 'function' && typeof m.bindList === 'function' ? m : false; if (BK && bkRedraw) bkRedraw(); }).catch(() => { BK = false; });
|
|
122
|
+
const BKT = new Map(); // ws|board → tasks | null while reading | false when the route is not there
|
|
123
|
+
function bkTasks(ws, board) {
|
|
124
|
+
if (!BK || !board) return false;
|
|
125
|
+
const k = (ws || '') + '|' + board;
|
|
126
|
+
if (!BKT.has(k)) {
|
|
127
|
+
BKT.set(k, null);
|
|
128
|
+
pmGet('/api/backlog?ws=' + encodeURIComponent(ws || '') + '&board=' + encodeURIComponent(board))
|
|
129
|
+
.then((x) => {
|
|
130
|
+
if (x && x.ok && Array.isArray(x.tasks)) { BKT.set(k, x.tasks); if (bkRedraw) bkRedraw(); }
|
|
131
|
+
else if (x && x.pending) { BKT.delete(k); setTimeout(() => { if (bkRedraw) bkRedraw(); }, 1500); }
|
|
132
|
+
else BKT.set(k, false);
|
|
133
|
+
}).catch(() => BKT.set(k, false));
|
|
134
|
+
}
|
|
135
|
+
return BKT.get(k);
|
|
136
|
+
}
|
|
137
|
+
const bkReread = (ws, board) => { BKT.delete((ws || '') + '|' + (board || '')); };
|
|
138
|
+
const BKFOLD = new Map(); // initiative id → { fold, more } as the PM left the list
|
|
139
|
+
|
|
114
140
|
/* ── the parts ── */
|
|
115
141
|
/* the Overview explains the initiative (round 3 point 10): Problem, Goal, Done when from its own records, one status line, PMOS suggests, then
|
|
116
142
|
* Details › for the grid. A line with no source says so in grey with a ✦ offer; nothing is invented. */
|
|
@@ -205,7 +231,44 @@ function rowHtml(x, W, C, sugRows) {
|
|
|
205
231
|
return `<div class="pw-tr pw-kr${x.done ? ' done' : ''}${x.lit ? ' lit' : ''}" role="row" data-pw-row="${esc(x.uid)}" data-pw-sec="${esc(x.sec)}"><span class="pw-it"><i class="pw-bul${x.ms ? ' ms' : ''}" aria-hidden="true"></i>${title}${ib(`data-pw-open="${esc(x.uid)}"`, 'Open the task', P.open, 'xs hov')}${ib(`data-pw-row-more="${esc(x.uid)}" aria-haspopup="menu"`, 'More for ' + x.title, P.more, 'xs hov')}</span>${stc}${dtc}${tl}</div>`
|
|
206
232
|
+ (s ? `<div class="pw-tr pw-sugrow" role="row"><span class="pw-it">${sugLine(s, true)}</span></div>` : '');
|
|
207
233
|
}
|
|
208
|
-
|
|
234
|
+
/* Work breakdown, round 3 point 22 (Wawan: "Stage not apply to task, it only apply to initiative"): the stages are ONE row of the initiative's
|
|
235
|
+
* own steps with the Board's own bar on the timeline; press a stage for its card (its dates, and the move, which asks when it happened). The
|
|
236
|
+
* tasks are ONE list under it: the Backlog's columns and groups, this initiative's tasks only. A task's old stage stays in its record; it is
|
|
237
|
+
* only not shown. "Open in Backlog" opens Work › Backlog. */
|
|
238
|
+
const stagesOf = (W) => W.rows.filter((x) => x.kind === 'stage' && x.key !== '');
|
|
239
|
+
function stagesRowHtml(W, C, r) {
|
|
240
|
+
const st = stagesOf(W);
|
|
241
|
+
const chips = st.map((x) => `<button type="button" class="pw-sc${x.tone === 'now' ? ' now' : ''}${x.tone === 'dn' ? ' dn' : ''}${x.late ? ' late' : ''}" data-pw-stage="${esc(x.key)}" aria-haspopup="dialog" aria-label="${esc(x.name + (x.tone === 'now' ? ', the stage now' : x.tone === 'dn' ? ', done' : '') + (x.late ? ', late' : '') + '. Open its card')}"><span class="pw-n">${x.tone === 'dn' ? SVG(P.check, 11, 2.4) : esc(x.n)}</span>${esc(x.name)}</button>`).join('');
|
|
242
|
+
let bar = '';
|
|
243
|
+
if (C.tl) {
|
|
244
|
+
const a = Date.parse(W.span.a), b = Date.parse(W.span.b), X = (d) => ((+new Date(d) - a) / Math.max(864e5, b - a)) * 100;
|
|
245
|
+
try { bar = rowBar(r, X, new Date(), { mode: 'all', label: false, pxPct: 4 }); } catch { bar = ''; }
|
|
246
|
+
if (!bar) bar = st.map((x) => barHtml(x, W)).join('');
|
|
247
|
+
bar = `<div class="pw-tl">${bar}${W.tx != null ? `<i class="pw-now" style="left:${W.tx.toFixed(2)}%"></i>` : ''}</div>`;
|
|
248
|
+
}
|
|
249
|
+
return `<div class="pw-tr pw-stgs" role="row"><span class="pw-it"><span class="pw-scs" role="group" aria-label="Stages">${chips}</span></span>${C.status ? '<span></span>' : ''}${C.date ? '<span></span>' : ''}${bar}</div>`;
|
|
250
|
+
}
|
|
251
|
+
function oneListHtml(W, C, mode, full, S, o, r) {
|
|
252
|
+
const tasks = bkTasks(o.ws, o.board);
|
|
253
|
+
const L = Array.isArray(tasks) ? BK.listHtml(tasks, { ini: o.id, cols: ['jira', 'epic', 'who', 'due', 'state'], ...(BKFOLD.get(o.id) || {}) }) : '';
|
|
254
|
+
const spanB = C.tl ? `<button type="button" class="pw-span" data-pw-span aria-haspopup="menu" aria-label="${esc('Span of the timeline: ' + (M.MODES.find((m) => m[0] === mode) || M.MODES[5])[1])}">${esc((M.MODES.find((m) => m[0] === mode) || M.MODES[5])[1])}${SVG(P.down, 12)}</button>` : '';
|
|
255
|
+
const tools = `<span class="pw-tools">${spanB}${ib(`data-pw-big aria-pressed="${!!full}"`, full ? 'Back to the initiative' : 'Give the work breakdown the whole popup', full ? P.in : P.full)}${ib('data-pw-tune="wbs" aria-haspopup="menu"', 'Show or hide columns', P.tune)}</span>`;
|
|
256
|
+
const empty = tasks === null ? '<p class="pw-ltx">Reading the tasks…</p>' : '<p class="pw-ltx">No tasks yet.</p>';
|
|
257
|
+
const head = `<div class="pw-lh"><h4>Tasks</h4><button type="button" class="pw-lk" data-pw-backlog>Open in Backlog${SVG(P.right, 14)}</button></div>`;
|
|
258
|
+
if (full && C.tl && o.bars && o.bars.length) {
|
|
259
|
+
// expanded: the same tasks with their dates and bars on the one timeline; the grouped list is the default view
|
|
260
|
+
const rows = o.bars.map((x) => rowHtml({ ...x, sec: '' }, W, C, new Map())).join('');
|
|
261
|
+
const T = `<div class="pw-card pw-wbs${C.status ? '' : ' nost'}${C.date ? '' : ' nodt'}" role="table" aria-label="Tasks"${tlStyle()}>${headCells(C, W, mode, 'Task')}${rows}</div>`;
|
|
262
|
+
return `<section class="pw-sec" aria-label="Work breakdown"><div class="pw-sech">${tools}</div>`
|
|
263
|
+
+ `<div class="pw-card pw-wbs pw-one nost nodt" role="table" aria-label="Stages"${tlStyle()}>${gripHtml()}${headCells({ ...C, status: false, date: false }, W, mode, 'Stages')}${stagesRowHtml(W, { ...C, status: false, date: false }, r)}</div>`
|
|
264
|
+
+ `<div class="pw-tasks">${head}${T}</div></section>`;
|
|
265
|
+
}
|
|
266
|
+
return `<section class="pw-sec" aria-label="Work breakdown">${full ? `<div class="pw-sech">${tools}</div>` : `<div class="pw-sech"><h3>Work breakdown</h3>${tools}</div>`}`
|
|
267
|
+
+ `<div class="pw-card pw-wbs pw-one${C.tl ? '' : ' notl'} nost nodt" role="table" aria-label="Stages"${tlStyle()}>${C.tl ? gripHtml() : ''}${headCells({ ...C, status: false, date: false }, W, mode, 'Stages')}${stagesRowHtml(W, { ...C, status: false, date: false }, r)}</div>`
|
|
268
|
+
+ `<div class="pw-tasks">${head}<div class="pw-bk" data-pw-bk>${L || empty}</div></div></section>`;
|
|
269
|
+
}
|
|
270
|
+
function breakdownHtml(W, C, mode, full, S, o, r) {
|
|
271
|
+
if (BK && o && o.board && bkTasks(o.ws, o.board) !== false) return oneListHtml(W, C, mode, full, S, o, r);
|
|
209
272
|
const sugRows = W.rowSuggests, ms = !!(S && S.msAdd);
|
|
210
273
|
// the add row (round 3 point 2): "◇" beside it makes the next one a milestone; typing "◇ " first does the same
|
|
211
274
|
const add = (key, name) => `<div class="pw-tr pw-add" role="row"><span class="pw-it"><label class="pw-addf">${SVG(P.plus, 14)}<input data-pw-add="${esc(key)}" data-pw-add-name="${esc(name)}" placeholder="${ms ? 'Add a milestone' : 'Add a task'}" aria-label="${esc((ms ? 'Add a milestone to ' : 'Add a task to ') + name)}" maxlength="200" autocomplete="off"></label>`
|
|
@@ -238,7 +301,7 @@ function artefactsHtml(rows, C, add = true, o = {}) {
|
|
|
238
301
|
const a = g.cur, k = scope + '|' + g.kind, open = ARTOPEN.has(k), vt = AK.versionText(g);
|
|
239
302
|
const ver = vt && g.earlier.length ? `<button type="button" class="pw-ver" data-pw-ver="${esc(k)}" aria-expanded="${open}">${esc(vt)}${SVG(open ? P.down : P.right, 12)}</button>` : esc(vt);
|
|
240
303
|
const row = `<div class="pw-ar${a.missing ? ' miss' : ''}" role="row"><span role="cell" class="pw-ak">${esc(g.kind)}</span><span role="cell">${nameCell(a)}</span><span role="cell" class="pw-av">${ver}</span>`
|
|
241
|
-
+ (C.when ? `<span role="cell"
|
|
304
|
+
+ (C.when ? (a.missing ? `<span role="cell" class="warn" title="${esc(a.missing)}">${esc(String(a.missing).split(' · ')[0])}</span>` : `<span role="cell">${esc(a.when || '')}</span>`) : '') + '</div>';
|
|
242
305
|
const more = open ? g.earlier.map((e) => `<div class="pw-ar pw-ear" role="row"><span role="cell"></span><span role="cell">${nameCell(e)}</span><span role="cell" class="pw-av">${e.title && AK.versionOf(e.title) ? 'v' + AK.versionOf(e.title) : ''}</span>${C.when ? `<span role="cell">${esc(e.when || '')}</span>` : ''}</div>`).join('') : '';
|
|
243
306
|
return row + more;
|
|
244
307
|
}).join('');
|
|
@@ -254,14 +317,21 @@ const keyOf = (v, o) => String((o && o.id) || (v && (v.id || v.key)) || '');
|
|
|
254
317
|
function model(r, v, o) {
|
|
255
318
|
const id = keyOf(v, o), S = stOf(id), it = ITEMS.get(id);
|
|
256
319
|
const g = o.goal || goalOf(o.ws, o.board, r.anchor || v.anchor);
|
|
257
|
-
const W = M.workOf(r, v, { ...o, goal: M.idShaped(g) ? '' : g, product: productName(o.product, o.ws), art: artOf(id, o.ws), open: S.open, shut: S.shut, doneOpen: S.doneOpen, moreOpen: S.moreOpen, farOpen: S.farOpen, focus: S.focus, mode: store.get(SPAN, 'full'), items: it || [], dropped: dropped() });
|
|
320
|
+
const W = M.workOf(r, v, { ...o, goal: M.idShaped(g) ? '' : g, product: productName(o.product, o.ws), art: artOf(id, o.ws), open: S.open, shut: S.shut, doneOpen: S.doneOpen, moreOpen: S.moreOpen, farOpen: S.farOpen || !!(BK && o.board), focus: S.focus, mode: store.get(SPAN, 'full'), items: it || [], dropped: dropped() });
|
|
258
321
|
const mk = M.marksOf(W.span, W.today); W.tx = mk.today;
|
|
259
322
|
return { W, S, id };
|
|
260
323
|
}
|
|
261
324
|
export function html(r, v, o = {}) {
|
|
262
325
|
const { W, S } = model(r, v, o), C = cols(), mode = store.get(SPAN, 'full');
|
|
263
|
-
|
|
264
|
-
|
|
326
|
+
const bo = { ws: o.ws, board: o.board, id: keyOf(v, o) };
|
|
327
|
+
// the expanded one list keeps each task's bar on the timeline (design check): every stage open, read for its task rows only
|
|
328
|
+
if (S.big && BK && o.board) {
|
|
329
|
+
const keys = new Set(W.rows.filter((x) => x.kind === 'stage').map((x) => x.key).concat(''));
|
|
330
|
+
const W2 = M.workOf(r, v, { ...o, goal: '', product: productName(o.product, o.ws), art: [], open: keys, shut: new Set(), doneOpen: new Set(), moreOpen: keys, farOpen: true, mode, items: ITEMS.get(bo.id) || [], dropped: dropped() });
|
|
331
|
+
bo.bars = W2.rows.filter((x) => x.kind === 'task' && !x.done).sort((a, b) => String(a.end || '9999').localeCompare(String(b.end || '9999')));
|
|
332
|
+
}
|
|
333
|
+
if (S.big) return `<div class="pw" data-pw-big-on>${breakdownHtml(W, C, mode, true, S, bo, r)}</div>`;
|
|
334
|
+
return `<div class="pw">${overviewHtml(W, S, keyOf(v, o))}${breakdownHtml(W, C, mode, false, S, bo, r)}${artefactsHtml(W.artefacts, C, true, { scope: keyOf(v, o), recPath: v.prd && (v.prd.path || v.prd) })}</div>`;
|
|
265
335
|
}
|
|
266
336
|
|
|
267
337
|
/* ── the suggestion as its own page (board 22) ── */
|
|
@@ -347,13 +417,36 @@ export function wire(body, h0, x0) {
|
|
|
347
417
|
if (!body) return;
|
|
348
418
|
// 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
|
|
349
419
|
body.__pwh = ED.writes(h0); body.__pwx = x0;
|
|
350
|
-
{ const c = cur(); if (c) { readItems(c.id, (x0.o() || {}).ws, () => redraw()); if (c.S.top) body.scrollTop = c.S.top; }
|
|
420
|
+
{ const c = cur(); if (c) { readItems(c.id, (x0.o() || {}).ws, () => redraw()); if (c.S.top) body.scrollTop = c.S.top; }
|
|
421
|
+
const q = OPEN_ON_DRAW;
|
|
422
|
+
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); } }
|
|
351
423
|
if (body.__pw) return;
|
|
352
424
|
body.__pw = true;
|
|
353
425
|
function cur() { const x = body.__pwx, r = x && x.r(), v = x && x.v(); return r && v ? { r, v, ...model(r, v, x.o()) } : null; }
|
|
354
426
|
function redraw() { if (body.__pwh && body.__pwh.redraw) body.__pwh.redraw(); }
|
|
355
|
-
goalsRedraw = artRedraw = wsnRedraw = () => { if (body.isConnected && body.querySelector('.pw')) redraw(); };
|
|
427
|
+
goalsRedraw = artRedraw = wsnRedraw = bkRedraw = () => { if (body.isConnected && body.querySelector('.pw')) redraw(); };
|
|
356
428
|
wireGrip(body);
|
|
429
|
+
// the one list (round 3 point 22): each draw puts a new [data-pw-bk]; the Backlog's own presses are bound to it once
|
|
430
|
+
const bindBk = () => body.querySelectorAll('[data-pw-bk]').forEach((el) => {
|
|
431
|
+
if (el.__bk || !BK || !el.querySelector('.bk')) return;
|
|
432
|
+
el.__bk = true;
|
|
433
|
+
const c = cur(); if (!c) return;
|
|
434
|
+
// the task a Today row opened (round 3 item 11b) is lit in the one list too
|
|
435
|
+
if (c.S.focus) { const fr = el.querySelector(`[data-bkopen$="|${window.CSS.escape(c.S.focus)}"]`); if (fr) fr.closest('[role="row"]').classList.add('lit'); }
|
|
436
|
+
const o = (body.__pwx && body.__pwx.o()) || {}, h = body.__pwh || {}, w = h.where ? h.where() : {}, ws = w.ws || o.ws, board = w.board || o.board;
|
|
437
|
+
BK.bindList(el, {
|
|
438
|
+
post: pmPost,
|
|
439
|
+
say: (m, u) => (u ? undoToast(m, u) : h.toast ? h.toast(m) : undoToast(m)),
|
|
440
|
+
openTask: (t) => { if (t.src === 'jira') { if (h.openTask) h.openTask(t.key || t.id); else if (t.url) window.open(t.url, '_blank', 'noopener'); return; } const cc = cur(); if (cc) openSmall(t.id, cc, body.__pwh, body.__pwx, body, t); },
|
|
441
|
+
reload: async () => { bkReread(ws, board); if (body.__pwh && body.__pwh.reload) await body.__pwh.reload(); else redraw(); },
|
|
442
|
+
}, () => BKT.get((ws || '') + '|' + (board || '')) || []);
|
|
443
|
+
el.addEventListener('bk:redraw', (e) => {
|
|
444
|
+
const p = BKFOLD.get(c.id) || { fold: {}, more: new Set() }, d = e.detail || {};
|
|
445
|
+
BKFOLD.set(c.id, { fold: { ...p.fold, ...(d.fold || {}) }, more: new Set([...(p.more || []), ...(d.more || [])]) });
|
|
446
|
+
redraw();
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
bindBk(); new MutationObserver(bindBk).observe(body, { childList: true, subtree: true });
|
|
357
450
|
const live = (e) => !!body.__pwx && !!e.target.closest('.pw') && !e.target.closest('.pw-sp, [data-pw-level]');
|
|
358
451
|
body.addEventListener('scroll', () => { if (!body.querySelector(':scope > .pw, .pw:not(.pw-sp)')) return; const c = cur(); if (c) c.S.top = body.scrollTop; }, { passive: true });
|
|
359
452
|
body.addEventListener('click', async (e) => {
|
|
@@ -384,13 +477,15 @@ export function wire(body, h0, x0) {
|
|
|
384
477
|
if (d.pwChoice) { const [sid, k] = d.pwChoice.split('|'), s = findSug(W, sid), ch = s && s.choices && s.choices[+k]; if (ch && !sendToChat(ch.ask) && h.toast) h.toast('Open Ask PMOS to send this.'); return; }
|
|
385
478
|
if (d.pwMore != null) { S.moreOpen.add(d.pwMore); redraw(); return; }
|
|
386
479
|
if (d.pwVer) { if (ARTOPEN.has(d.pwVer)) ARTOPEN.delete(d.pwVer); else ARTOPEN.add(d.pwVer); redraw(); return; }
|
|
387
|
-
if (d.pwRowMore) { rowMenu(b, d.pwRowMore, c, h); return; }
|
|
388
|
-
if ('pwAddty' in d) { S.msAdd = !S.msAdd; const f = b.closest('.pw-add'), k = f && f.querySelector('[data-pw-add]') && f.querySelector('[data-pw-add]').dataset.pwAdd; redraw(); if (k != null) setTimeout(() => { const i = body.querySelector(`[data-pw-add="${CSS.escape(k)}"]`); if (i) i.focus(); }, 0); return; }
|
|
480
|
+
if (d.pwRowMore) { rowMenu(b, d.pwRowMore, c, h, body); return; }
|
|
481
|
+
if ('pwAddty' in d) { S.msAdd = !S.msAdd; const f = b.closest('.pw-add'), k = f && f.querySelector('[data-pw-add]') && f.querySelector('[data-pw-add]').dataset.pwAdd; redraw(); if (k != null) setTimeout(() => { const i = body.querySelector(`[data-pw-add="${window.CSS.escape(k)}"]`); if (i) i.focus(); }, 0); return; }
|
|
389
482
|
if (d.pwFact) { fact(d.pwFact, b, c, h); return; }
|
|
390
483
|
if (d.pwStatus) { statusMenu(b, d.pwStatus, h, c); return; }
|
|
391
484
|
if (d.pwDate) { dateMenu(b, d.pwDate, c, h); return; }
|
|
392
485
|
if (d.pwName) { rename(b, d.pwName, h); return; }
|
|
393
|
-
if (d.pwOpen) {
|
|
486
|
+
if (d.pwOpen) { openSmall(d.pwOpen, c, h, x, body); return; }
|
|
487
|
+
if (d.pwStage) { stageCard(b, d.pwStage, c, h, x); return; }
|
|
488
|
+
if ('pwBacklog' in d) { const o = x.o() || {}, w = h.where ? h.where() : {}, q = new URLSearchParams({ work: 'backlog' }); if (w.ws || o.ws) q.set('ws', w.ws || o.ws); if (o.id) q.set('ini', o.id); location.href = '/premium-board.html?' + q.toString(); return; }
|
|
394
489
|
if (d.cbMs != null) { msPop(b, d.cbMs, W, h); return; }
|
|
395
490
|
if (d.pwArt != null) { openArt(W.artefacts[+d.pwArt], h, x); return; }
|
|
396
491
|
if ('pwAddart' in d) { addArt(x, h); return; }
|
|
@@ -407,7 +502,7 @@ export function wire(body, h0, x0) {
|
|
|
407
502
|
if (!v) return;
|
|
408
503
|
await h.addTask(v, t, { section: sec, name: t.dataset.pwAddName, ...(ms ? { milestone: true } : {}) });
|
|
409
504
|
// Enter only adds the row; the field stays for the next one
|
|
410
|
-
setTimeout(() => { const f = body.querySelector(`[data-pw-add="${CSS.escape(sec)}"]`); if (f) { f.value = ''; f.focus(); } }, 0);
|
|
505
|
+
setTimeout(() => { const f = body.querySelector(`[data-pw-add="${window.CSS.escape(sec)}"]`); if (f) { f.value = ''; f.focus(); } }, 0);
|
|
411
506
|
}
|
|
412
507
|
});
|
|
413
508
|
}
|
|
@@ -517,7 +612,7 @@ function rename(btn, uid, h) {
|
|
|
517
612
|
e.preventDefault();
|
|
518
613
|
const row = inp.closest('[data-pw-row]'), sec = row ? row.dataset.pwSec : null;
|
|
519
614
|
inp.blur();
|
|
520
|
-
if (sec != null) setTimeout(() => { const f = document.querySelector(`.cz-pop [data-pw-add="${CSS.escape(sec)}"]`); if (f) f.focus(); }, 60);
|
|
615
|
+
if (sec != null) setTimeout(() => { const f = document.querySelector(`.cz-pop [data-pw-add="${window.CSS.escape(sec)}"]`); if (f) f.focus(); }, 60);
|
|
521
616
|
}
|
|
522
617
|
});
|
|
523
618
|
}
|
|
@@ -564,15 +659,63 @@ function dateMenu(btn, uid, c, h) {
|
|
|
564
659
|
DP.mountDay(due, { label: row.ms ? 'Date' : 'Due', value: row.end || row.start || '', open: !st, onPick: (v) => { closePop(); if (h.dates) h.dates(uid, { due: v }); } });
|
|
565
660
|
(st || due).querySelector('.dp-in')?.focus();
|
|
566
661
|
}
|
|
567
|
-
function rowMenu(btn, uid, c, h) {
|
|
662
|
+
function rowMenu(btn, uid, c, h, body) {
|
|
568
663
|
const row = c.W.rows.find((x) => x.uid === uid) || {};
|
|
569
664
|
openPop(btn, 'pw-rowm', `<button type="button" class="hi-mi" role="menuitem" data-k="kind">${SVG(row.ms ? P.box : P.dia, 14, 2)} ${row.ms ? 'Make it a task' : 'Make it a milestone'}</button>`
|
|
570
665
|
+ `<button type="button" class="hi-mi" role="menuitem" data-k="open">${SVG(P.open, 14)} Open the task</button>` + jiraNote(row), (b) => {
|
|
571
666
|
closePop();
|
|
572
667
|
if (b.dataset.k === 'kind') setKind(row, !row.ms, h);
|
|
573
|
-
else if (b.dataset.k === 'open'
|
|
668
|
+
else if (b.dataset.k === 'open') openSmall(uid, c, h, body.__pwx, body);
|
|
574
669
|
}, { menu: true, label: 'Task' });
|
|
575
670
|
}
|
|
671
|
+
/* "Open the task" opens the small task popup on top (round 3 point 20, pm/cozy-task-pop.js); ↑ ↓ step through this list. A Jira ticket keeps its
|
|
672
|
+
* ticket view. On close the row is lit for a moment. */
|
|
673
|
+
async function openSmall(uid, c, h, x, body, bt) {
|
|
674
|
+
const row = c.W.rows.find((r) => r.uid === uid) || {};
|
|
675
|
+
if (row.jira) { if (h.openTask) h.openTask(uid); return; }
|
|
676
|
+
const TP = await import('./cozy-task-pop.js');
|
|
677
|
+
const w = h.where ? h.where() : {}, o = (x && x.o && x.o()) || {};
|
|
678
|
+
const one = !!body.querySelector('[data-pw-bk] .bk');
|
|
679
|
+
const list = () => { if (one) return [...body.querySelectorAll('[data-pw-bk] [data-bkopen]')].map((e) => e.dataset.bkopen.split('|').pop()).filter((v) => { const t = (BKT.get((o.ws || '') + '|' + (o.board || '')) || []).find((q) => q.id === v); return !t || t.src !== 'jira'; }); const cc = body.__pwx && body.__pwx.r() ? model(body.__pwx.r(), body.__pwx.v(), body.__pwx.o()) : null; return ((cc && cc.W.rows) || c.W.rows).filter((r) => r.kind === 'task' && !r.jira).map((r) => r.uid); };
|
|
680
|
+
TP.openTask(uid, {
|
|
681
|
+
ws: w.ws || o.ws, board: w.board || o.board, ini: o.id, pmPost,
|
|
682
|
+
toast: (m, undo) => (undo ? undoToast(m, undo) : h.toast ? h.toast(m) : undoToast(m)),
|
|
683
|
+
list, iniTitle: () => ((x && x.v && x.v()) || {}).title || '',
|
|
684
|
+
row: (u) => { const r = c.W.rows.find((q) => q.uid === u) || (bt && bt.id === u ? { uid: bt.id, title: bt.title, status: bt.status || bt.state || '', start: bt.start || '', end: bt.due || '', ms: !!bt.milestone } : null); return r ? { uid: r.uid, title: r.title, status: r.status, start: r.start || '', end: r.end || '', milestone: !!r.ms, since: r.since || '', ini: o.id, board: w.board || o.board } : null; },
|
|
685
|
+
rename: h.rename ? (t, v) => h.rename(t.uid, v) : null,
|
|
686
|
+
onChange: () => { if (h.reload) h.reload(); },
|
|
687
|
+
onClose: (u) => { const r = body.querySelector(`[data-pw-row="${window.CSS.escape(u)}"]`) || body.querySelector(`[data-pw-bk] [data-bkopen$="|${window.CSS.escape(u)}"]`)?.closest('[role="row"]'); if (r) { r.classList.add('lit'); r.scrollIntoView({ block: 'nearest' }); setTimeout(() => r.classList.remove('lit'), 1600); } },
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
/* a stage's card (round 3 point 22): its dates and state; for another stage, the move to it, which asks when it happened (point 18) */
|
|
691
|
+
function stageCard(btn, key, c, h, x) {
|
|
692
|
+
const all = stagesOf(c.W), i = all.findIndex((r) => r.key === key), st = all[i]; if (!st) return;
|
|
693
|
+
const now = all.find((r) => r.tone === 'now'), o = x.o() || {}, v = x.v() || {};
|
|
694
|
+
const span = [st.start && M.dayText(st.start, c.W.today), st.end && M.dayText(st.end, c.W.today)].filter(Boolean).join(' – ');
|
|
695
|
+
// the stage's own facts only: a task has no stage (round 3 point 22), so no task count here
|
|
696
|
+
const facts = [st.status, span].filter(Boolean).map((t) => `<p class="hi-small">${esc(t)}</p>`).join('') + (st.late && st.date ? `<p class="hi-small warn">${esc(st.date)}</p>` : '');
|
|
697
|
+
// the action is the first line (design check): another stage → "Move to Plan"; the stage now → "Mark Discover done" (moves to the next one).
|
|
698
|
+
// The day question shows only after the press, and names the action.
|
|
699
|
+
const nx = st.tone === 'now' ? all[i + 1] : null;
|
|
700
|
+
const act = st.tone === 'now' ? (nx ? { to: nx.name, label: 'Mark ' + st.name + ' done', q: 'When was ' + st.name + ' done?', icon: P.check, said: st.name + ' done, moved to ' + nx.name } : null)
|
|
701
|
+
: { to: st.name, label: 'Move to ' + st.name, q: 'When did it move to ' + st.name + '?', icon: P.right, said: 'Moved to ' + st.name };
|
|
702
|
+
const head = `<div class="pw-stch"><p class="hi-h3">${esc(st.name)}</p>${act ? ib('data-mv', act.label, act.icon, 'solid') : ''}</div>`;
|
|
703
|
+
const el = openPop(btn, 'pw-stc', head + (act ? '<div class="pw-when" hidden></div>' : '') + facts, (b) => {
|
|
704
|
+
if (!('mv' in b.dataset) || !act) return;
|
|
705
|
+
const w = el.querySelector('.pw-when'); b.disabled = true; b.classList.add('on'); w.hidden = false;
|
|
706
|
+
SW.askWhen(w, { q: act.q, since: (x.r() || {}).acts?.movedOn || '', onPick: async (day) => {
|
|
707
|
+
closePop();
|
|
708
|
+
const wh = h.where ? h.where() : {}, base = { ws: wh.ws || o.ws, board: wh.board || o.board, id: o.id }, happened = day === localToday() ? null : day;
|
|
709
|
+
const res = await pmPost('/api/boards/move', { ...base, to: act.to, ...(happened ? { happened } : {}) }).catch(() => null);
|
|
710
|
+
if (!res || !res.ok) { if (h.toast) h.toast((res && res.error) || 'It did not move.'); return; }
|
|
711
|
+
const from = now && now.name;
|
|
712
|
+
const said = (v.title ? v.title + ' · ' : '') + SW.whenWords(act.said, happened);
|
|
713
|
+
if (!from) { if (h.toast) h.toast(said); } else undoToast(said, async () => { const u = await pmPost('/api/boards/move', { ...base, to: from, why: 'Undo' }).catch(() => null); if (!u || !u.ok) { if (h.toast) h.toast((u && u.error) || 'The undo did not land.'); } if (h.reload) await h.reload(); });
|
|
714
|
+
if (h.reload) await h.reload();
|
|
715
|
+
} });
|
|
716
|
+
w.querySelector('[data-sw]')?.focus();
|
|
717
|
+
}, { label: st.name, focus: '[data-mv]' });
|
|
718
|
+
}
|
|
576
719
|
function spanMenu(btn, redraw) {
|
|
577
720
|
const cur = store.get(SPAN, 'full');
|
|
578
721
|
openPop(btn, 'pw-span', M.MODES.map(([k, l]) => `<button type="button" class="hi-mi" role="menuitemradio" aria-checked="${k === cur}" data-sp="${k}">${esc(l)}</button>`).join(''), (b) => {
|
|
@@ -37,7 +37,10 @@ body.cz-pop-drag, body.cz-pop-drag * { cursor: col-resize !important; user-selec
|
|
|
37
37
|
background: var(--cz-well); font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
38
38
|
.cz-pop-t span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
39
39
|
.cz-pop-go:focus-visible, .cz-pop-t:focus-visible, .cz-pop-ib:focus-visible, .cz-pop-x:focus-visible, .cz-pop-sr:focus-visible, .cz-pop-f:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
40
|
-
.cz-pop-tw { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; }
|
|
40
|
+
.cz-pop-tw { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 0; }
|
|
41
|
+
/* the context line under the session (round 3 point 19a): one quiet line, cut with … */
|
|
42
|
+
.cz-pop-cx { flex: 1 0 100%; min-width: 0; padding-left: 10px; font-size: var(--fs-meta); color: var(--cz-ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
43
|
+
.cz-pop-mm { left: auto; right: 12px; width: 260px; }
|
|
41
44
|
.cz-pop-ib { all: unset; box-sizing: border-box; flex: none; cursor: pointer; width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; color: var(--cz-ink2); }
|
|
42
45
|
.cz-pop-ib:hover { background: var(--cz-well); color: var(--cz-ink); }
|
|
43
46
|
.cz-pop-chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
|
|
@@ -120,3 +123,5 @@ body.cz-pop-drag, body.cz-pop-drag * { cursor: col-resize !important; user-selec
|
|
|
120
123
|
body.cz-pop-on { overflow: hidden; }
|
|
121
124
|
/* the chat side starts with two plain grey lines, no mascot (board 23) */
|
|
122
125
|
.cz-pop .hm-empty-ad > :not(p) { display: none; }
|
|
126
|
+
/* the phone chat's stream in the popup's column (round 3 point 19b): PMOS's text from the column's 16 px margin, the PM's bubbles to the right */
|
|
127
|
+
.cz-pop .cz-pop-r .cz-pop-chat .hm-log { padding-left: 16px; padding-right: 16px; }
|
|
@@ -37,7 +37,7 @@ const I = {
|
|
|
37
37
|
chat: 'M5 6.5A2.5 2.5 0 0 1 7.5 4h9A2.5 2.5 0 0 1 19 6.5v7a2.5 2.5 0 0 1-2.5 2.5H11l-4 3.5V16h.5A2.5 2.5 0 0 1 5 13.5z',
|
|
38
38
|
hide: 'M4 5h16v14H4zM14.5 5v14M9 10l2 2-2 2', close: 'M6 6l12 12M18 6L6 18', down: 'M7 10l5 5 5-5', back: 'M15 6l-6 6 6 6',
|
|
39
39
|
plus: 'M12 5v14M5 12h14', list: 'M5 7h14M5 12h14M5 17h14', find: 'M11 4.5a6.5 6.5 0 1 0 0 13a6.5 6.5 0 1 0 0-13M16 16l4 4', flag: 'M5 21V4h11l-2 4 2 4H5',
|
|
40
|
-
side: 'M3.5 5h17v14h-17zM12 5v14',
|
|
40
|
+
side: 'M3.5 5h17v14h-17zM12 5v14', more: 'M5 12h.01M12 12h.01M19 12h.01',
|
|
41
41
|
};
|
|
42
42
|
const CLAUDE = { key: 'claude', name: 'PMOS', initial: 'P' };
|
|
43
43
|
const MIN_WORK = 480, MIN_CHAT = 320, DEF_CHAT = 460, DAY_MS = 864e5, POLL = 6000, UNDO = 6000, CHOOSER = 5;
|
|
@@ -78,7 +78,7 @@ function frame() {
|
|
|
78
78
|
+ '<div class="cz-pop-l"></div>'
|
|
79
79
|
+ '<div class="cz-pop-grip" role="separator" aria-orientation="vertical" tabindex="0" aria-label="Drag to change the width of the chat. Double-click to reset." title="Drag to change the width. Double-click to reset."><i></i></div>'
|
|
80
80
|
+ '<section class="cz-pop-r" aria-label="Ask PMOS">'
|
|
81
|
-
+ `<header class="cz-pop-hd"><span class="cz-pop-tile" aria-hidden="true">${svg(I.chat)}</span><div class="cz-pop-tw"></div>${ib('
|
|
81
|
+
+ `<header class="cz-pop-hd"><span class="cz-pop-tile" aria-hidden="true">${svg(I.chat)}</span><div class="cz-pop-tw"></div>${ib('more', 'More for the chat', I.more)}${ib('close', 'Close', I.close)}</header>`
|
|
82
82
|
+ '<div class="cz-pop-chat"></div><div class="cz-pop-all" hidden></div><div class="cz-pop-toast" role="status" hidden></div></section>'
|
|
83
83
|
+ `<div class="cz-pop-tools" hidden><button type="button" class="cz-pop-ask" data-pop="ask" aria-label="Show Ask PMOS" title="Ask PMOS (Ctrl J)">${svg(I.chat, 18)}<i class="cz-pop-dot" hidden></i></button>${ib('close', 'Close', I.close)}</div>`
|
|
84
84
|
+ '</div>';
|
|
@@ -297,8 +297,11 @@ function drawTitle() {
|
|
|
297
297
|
S.title.innerHTML = `<button type="button" class="cz-pop-ib" data-pop="unall" aria-label="Back to the session you were in" title="Back to the session you were in">${svg(I.back)}</button><b class="t-row">All sessions</b>`;
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
|
-
const r = curRow(), name = r ? r.name : 'Ask PMOS', on = !!S.menu;
|
|
301
|
-
|
|
300
|
+
const r = curRow(), name = r ? r.name : 'Ask PMOS', on = !!S.menu && S.menu.dataset.kind !== 'more';
|
|
301
|
+
// one quiet context line under the session (round 3 point 19a, the phone chat's line): what the chat is about, said once
|
|
302
|
+
const a = S.about, cx = a && a.title ? (a.kind === 'initiative' ? 'Initiative' : a.kind === 'program' ? 'Program' : 'About') + ' · ' + a.title : '';
|
|
303
|
+
S.title.innerHTML = `<button type="button" class="cz-pop-t" data-pop="pick" aria-haspopup="menu" aria-expanded="${on}" title="Change session" aria-label="${esc(name + '. Change session')}"><span>${esc(name)}</span>${svg(I.down, 16)}</button>`
|
|
304
|
+
+ (cx ? `<small class="cz-pop-cx" title="${esc(cx)}">${esc(cx)}</small>` : '');
|
|
302
305
|
}
|
|
303
306
|
/** The chat's last line: the state of the session shown and End session (board 7). Nothing when it is not live and busy. */
|
|
304
307
|
function stateLine() {
|
|
@@ -323,11 +326,26 @@ function openMenu() {
|
|
|
323
326
|
const f = m.querySelector('button'); if (f) f.focus();
|
|
324
327
|
setTimeout(() => document.addEventListener('pointerdown', away, true), 0);
|
|
325
328
|
}
|
|
326
|
-
|
|
329
|
+
/* ⋯ in the chat's header (round 3 point 19a: two icons, ⋯ and ✕): where work opens, hide the chat, the sessions, End session */
|
|
330
|
+
function openMore() {
|
|
331
|
+
closeMenu();
|
|
332
|
+
const r = curRow(), m = document.createElement('div');
|
|
333
|
+
m.className = 'cz-pop-m cz-pop-mm'; m.setAttribute('role', 'menu'); m.setAttribute('aria-label', 'More for the chat'); m.dataset.escLayer = '1'; m.dataset.kind = 'more';
|
|
334
|
+
m.innerHTML = `<button type="button" class="cz-pop-f" role="menuitem" data-pop="where">${svg(I.side, 16)}${beside() ? 'Open work in this popup' : 'Open work beside the page'}</button>`
|
|
335
|
+
+ `<button type="button" class="cz-pop-f" role="menuitem" data-pop="hide">${svg(I.hide, 16)}Hide the chat<span>Ctrl J</span></button>`
|
|
336
|
+
+ `<button type="button" class="cz-pop-f" role="menuitem" data-pop="pick">${svg(I.list, 16)}Sessions</button>`
|
|
337
|
+
+ (r && r.live ? `<hr><button type="button" class="cz-pop-f" role="menuitem" data-end="${esc(r.id)}">${svg(I.close, 16)}End session</button>` : '');
|
|
338
|
+
S.right.appendChild(m); S.menu = m;
|
|
339
|
+
const mb = S.card.querySelector('[data-pop="more"]'); if (mb) mb.setAttribute('aria-expanded', 'true');
|
|
340
|
+
const f = m.querySelector('button'); if (f) f.focus();
|
|
341
|
+
setTimeout(() => document.addEventListener('pointerdown', away, true), 0);
|
|
342
|
+
}
|
|
343
|
+
function away(e) { if (S.menu && !S.menu.contains(e.target) && !e.target.closest('[data-pop="pick"], [data-pop="more"]')) closeMenu(); }
|
|
327
344
|
function closeMenu() {
|
|
328
345
|
document.removeEventListener('pointerdown', away, true);
|
|
329
346
|
if (!S.menu) return;
|
|
330
347
|
S.menu.remove(); S.menu = null; drawTitle();
|
|
348
|
+
const mb = S.card && S.card.querySelector('[data-pop="more"]'); if (mb) mb.setAttribute('aria-expanded', 'false');
|
|
331
349
|
}
|
|
332
350
|
/** The full list: Now and Earlier, newest first, with a search box (board 23). */
|
|
333
351
|
function listHtml(where) {
|
|
@@ -410,10 +428,11 @@ function onClick(e) {
|
|
|
410
428
|
const b = e.target.closest('[data-pop]'); if (!b) return;
|
|
411
429
|
const a = b.dataset.pop;
|
|
412
430
|
if (a === 'close') close();
|
|
413
|
-
else if (a === '
|
|
431
|
+
else if (a === 'more') { if (S.menu && S.menu.dataset.kind === 'more') closeMenu(); else openMore(); }
|
|
432
|
+
else if (a === 'where') { closeMenu(); where(); }
|
|
414
433
|
else if (a === 'hide') { chatOn(false, 'press'); closeMenu(); const k = S.tools.querySelector('[data-pop="ask"]'); if (k) k.focus(); }
|
|
415
434
|
else if (a === 'ask') { chatOn(true, 'press'); if (S.chat && S.chat.focus) S.chat.focus(); }
|
|
416
|
-
else if (a === 'pick') { if (S.menu) closeMenu(); else { openMenu(); read(); } }
|
|
435
|
+
else if (a === 'pick') { if (S.menu && S.menu.dataset.kind !== 'more') closeMenu(); else { openMenu(); read(); } }
|
|
417
436
|
else if (a === 'new') newSession();
|
|
418
437
|
else if (a === 'all') showAll(true);
|
|
419
438
|
else if (a === 'unall') showAll(false);
|
|
@@ -7,8 +7,13 @@
|
|
|
7
7
|
* whenWords(state, happened, today) → the toast: "Done." on today, "Done on 14 Nov, noted today." on an earlier day
|
|
8
8
|
* askWhen(el, { today, since, onPick(iso) }) draws the line into el: When did this happen? [Today] [Yesterday] [Pick a date]. Today is
|
|
9
9
|
* preselected, so Enter saves it; Pick a date opens the app's own day field (pm/cozy-day-pick.js) inside the limits.
|
|
10
|
-
* Returns { save() } (saves the preselected day). Its presses stop at el.
|
|
10
|
+
* Returns { save() } (saves the preselected day). Its presses stop at el.
|
|
11
|
+
* localDay() → today on this computer, YYYY-MM-DD
|
|
12
|
+
* whenPop(anchor, { title, since, onPick(day) }) the same line in a small popover under anchor, for a move that has no menu of its own (a stage
|
|
13
|
+
* button); onPick gets null for today and the day for an earlier one. Escape or a press outside moves nothing. */
|
|
11
14
|
import { mountDay, localToday, dayText } from './cozy-day-pick.js';
|
|
15
|
+
import { openPop, closePop } from './hi-pop.js';
|
|
16
|
+
export const localDay = localToday; // today on this computer, for a caller that has no day field of its own
|
|
12
17
|
|
|
13
18
|
const ms = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
14
19
|
const iso = (n) => new Date(n).toISOString().slice(0, 10);
|
|
@@ -25,11 +30,13 @@ export function whenWords(state, happened, today = localToday()) {
|
|
|
25
30
|
const d = new Date(ms(happened)), y = d.getUTCFullYear() !== +String(today).slice(0, 4) ? ' ' + d.getUTCFullYear() : '';
|
|
26
31
|
return state + ' on ' + d.getUTCDate() + ' ' + MON[d.getUTCMonth()] + y + ', noted today.';
|
|
27
32
|
}
|
|
33
|
+
const esc0 = (s) => String(s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' })[c]);
|
|
34
|
+
/** o.q: the question, when the action it follows should be named ("When did it move to Plan?"); default "When did this happen?" */
|
|
28
35
|
export function askWhen(el, o = {}) {
|
|
29
36
|
const today = o.today || localToday(), L = whenLimits({ today, since: o.since });
|
|
30
37
|
const done = (v) => { if (o.onPick) o.onPick(v); };
|
|
31
38
|
el.classList.add('sw');
|
|
32
|
-
el.innerHTML = '<p class="sw-q" id="swQ">When did this happen
|
|
39
|
+
el.innerHTML = '<p class="sw-q" id="swQ">' + esc0(o.q || 'When did this happen?') + '</p><div class="sw-ch" role="group" aria-labelledby="swQ">'
|
|
33
40
|
+ '<button type="button" class="sw-b" data-sw="today" aria-pressed="true">Today</button>'
|
|
34
41
|
+ (L.yesterday ? '<button type="button" class="sw-b" data-sw="yday" aria-pressed="false">Yesterday</button>' : '')
|
|
35
42
|
+ (L.min === today ? '' : '<button type="button" class="sw-b" data-sw="pick" aria-pressed="false" aria-expanded="false">Pick a date</button>') + '</div><div class="sw-day"></div>';
|
|
@@ -46,3 +53,11 @@ export function askWhen(el, o = {}) {
|
|
|
46
53
|
el.addEventListener('keydown', (e) => { if (e.key === 'Enter' && !e.target.closest('button, input, .sw-day')) { e.preventDefault(); e.stopPropagation(); done(today); } });
|
|
47
54
|
return { save: () => done(today), limits: L, text: (v) => dayText(v) };
|
|
48
55
|
}
|
|
56
|
+
|
|
57
|
+
export function whenPop(anchor, o = {}) {
|
|
58
|
+
const today = localToday();
|
|
59
|
+
const el = openPop(anchor, 'sw-pop', (o.title ? '<p class="hi-h3">' + String(o.title).replace(/[&<>"']/g, (c) => '&#' + c.charCodeAt(0) + ';') + '</p>' : '') + '<div class="sw-host"></div>', () => {}, { label: o.title || 'When did this happen?' });
|
|
60
|
+
askWhen(el.querySelector('.sw-host'), { today, since: o.since || '', onPick: (day) => { closePop(); if (o.onPick) o.onPick(day && day !== today ? day : null); } });
|
|
61
|
+
const t = el.querySelector('[data-sw]'); if (t) setTimeout(() => t.focus(), 0);
|
|
62
|
+
return el;
|
|
63
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* pm/cozy-task-pop.css — the small task popup on top of the one popup (popup round 3 point 20; pm/cozy-task-pop.js). About 560 px wide, its height
|
|
2
|
+
* by content up to 80% of the window; the popup behind is dimmed a little. Above the popup (72), below the menus, pickers and toasts (90 and up).
|
|
3
|
+
* On a phone it is a full-height sheet from the bottom. Tokens: cozy.css. */
|
|
4
|
+
.ctp-scrim { position: fixed; inset: 0; z-index: 76; background: rgba(42, 46, 53, .16); }
|
|
5
|
+
.ctp { position: fixed; z-index: 77; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: 80vh; overflow: auto;
|
|
6
|
+
box-sizing: border-box; padding: 14px 18px 18px; border-radius: 20px; background: var(--cz-card); color: var(--cz-ink); font-family: var(--cz-sans); font-size: var(--fs-body);
|
|
7
|
+
line-height: var(--lh-body, 1.5); box-shadow: 0 28px 70px -24px rgba(42, 46, 53, .5), 0 0 0 1px var(--cz-hair); }
|
|
8
|
+
.ctp[aria-busy="true"] { min-height: 120px; }
|
|
9
|
+
.ctp-h { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
|
|
10
|
+
.ctp-kind { display: inline-flex; align-items: center; gap: 4px; flex: none; border: 0; border-radius: 999px; padding: 3px 9px 3px 7px; background: var(--cz-well); color: var(--cz-ink2);
|
|
11
|
+
font: inherit; font-size: var(--fs-meta); cursor: pointer; }
|
|
12
|
+
.ctp-kind:hover { color: var(--cz-ink); }
|
|
13
|
+
.ctp-kind:disabled { cursor: default; }
|
|
14
|
+
.ctp-t { flex: 1; min-width: 0; border: 0; background: none; padding: 2px 4px; margin: 0; text-align: left; font: inherit; font-size: var(--fs-section); font-weight: var(--fw-strong); color: var(--cz-ink);
|
|
15
|
+
border-radius: 8px; cursor: text; overflow-wrap: anywhere; }
|
|
16
|
+
button.ctp-t:hover { background: var(--cz-well); }
|
|
17
|
+
.ctp-ti { box-shadow: 0 0 0 1px var(--cz-hair) inset; background: var(--cz-card); }
|
|
18
|
+
.ctp-tools { display: flex; align-items: center; gap: 2px; flex: none; }
|
|
19
|
+
.ctp-ib { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 999px; background: none; color: var(--cz-ink2); cursor: pointer; }
|
|
20
|
+
.ctp-ib:hover { background: var(--cz-well); color: var(--cz-ink); }
|
|
21
|
+
.ctp-ib:disabled { opacity: .35; cursor: default; background: none; }
|
|
22
|
+
.ctp-ib:focus-visible, .ctp-kind:focus-visible, .ctp-t:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
|
|
23
|
+
.ctp-when { margin: 10px 4px 4px; }
|
|
24
|
+
.ctp .ctp-held { box-shadow: 0 0 0 2px var(--cz-blue) inset; border-radius: 999px; }
|
|
25
|
+
.ctp-wh { margin: 0 0 2px; font-size: var(--fs-meta); font-weight: var(--fw-strong); color: var(--cz-ink2); }
|
|
26
|
+
.ctp-none { margin: 8px 4px; color: var(--cz-ink2); }
|
|
27
|
+
.ctp-menu { position: absolute; z-index: 2; right: 30px; top: 34px; min-width: 190px; padding: 6px; display: grid; gap: 1px; border-radius: 12px; background: var(--cz-card);
|
|
28
|
+
box-shadow: 0 8px 28px rgba(42, 46, 53, .18), inset 0 0 0 1px var(--cz-hair); }
|
|
29
|
+
.ctp-menu button { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 7px 8px; border-radius: 7px; font: inherit; font-size: var(--fs-meta); color: var(--cz-ink); text-align: left; cursor: pointer; }
|
|
30
|
+
.ctp-menu button:hover, .ctp-menu button:focus-visible { background: var(--cz-well); outline: none; }
|
|
31
|
+
@media (max-width: 640px) {
|
|
32
|
+
.ctp { left: 0; right: 0; top: 0; bottom: 0; transform: none; width: auto; max-height: none; border-radius: 20px 20px 0 0; top: 24px; }
|
|
33
|
+
}
|
|
34
|
+
.ctp-when .sw { border-top: 0; margin-top: 0; padding-top: 0; }
|