create-pmos 0.417.0 → 0.418.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-programs-test.js +68 -1
- package/workspace/briefing-premium-board-test.js +21 -19
- package/workspace/changelog.json +12 -0
- package/workspace/guide/workflows.md +1 -0
- package/workspace/lib/engine/boards.js +7 -2
- package/workspace/lib/initiative-chat.js +1 -1
- package/workspace/lib/initiative-premium.js +2 -1
- package/workspace/lib/routes-boards.js +36 -6
- package/workspace/lib/task-cli.js +27 -3
- package/workspace/lib/task-items.js +5 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-acts.js +3 -2
- package/workspace/public/pm/bd-scroll.js +164 -0
- package/workspace/public/pm/bd-span.js +151 -188
- package/workspace/public/pm/bd-stages.js +3 -25
- package/workspace/public/pm/cozy-board.css +92 -71
- package/workspace/public/pm/home-app.js +2 -0
- package/workspace/public/pm/home-data.js +17 -4
- package/workspace/public/pm/home-ini-model.js +5 -1
- package/workspace/public/pm/home-ini.js +4 -2
- package/workspace/public/pm/home-list.js +3 -3
- package/workspace/public/pm/home-task.js +4 -1
- package/workspace/public/pm/ini-view-model.js +4 -2
- package/workspace/public/pm/premium-board.js +48 -37
- package/workspace/public/pm/premium-vw-item.js +5 -2
- package/workspace/public/pm/task-card.js +12 -0
- package/workspace/public/premium-board.html +3 -2
- package/workspace/server.js +3 -0
- package/workspace/task-card-test.js +7 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/* pm/bd-scroll.js — the timeline's sideways scroll (feedback batch 7, timeline spans C: TsCOpen, TsCDesk, TsCPhone, TsCPhoneBack, TsCEdges,
|
|
2
|
+
* TsCGrill). pm/bd-span.js draws a track wider than the screen from Quarter on; this module moves it and keeps what sits at its edges true.
|
|
3
|
+
* · open: today sits 25% of the way in, on every span. Switching span keeps the date in the middle in the middle, or keeps today in place
|
|
4
|
+
* when it is in view. A redraw (a filter, the panel) keeps the place the same way. The scroll position is not remembered across visits.
|
|
5
|
+
* · scroll: trackpad, Shift + wheel, a drag on empty track (a drag that starts on a bar or a name still opens it), ← → by half a screen,
|
|
6
|
+
* T for today, a swipe on a phone. The name column stays pinned (CSS: position sticky).
|
|
7
|
+
* · Today: in view, the pill on the today line. Off screen, the back button beside "Initiative" (on the axis edge on a phone) with its arrow
|
|
8
|
+
* pointing the way back; a press scrolls back to today.
|
|
9
|
+
* · edge tabs: a row whose marks are all behind the view shows its left tab, all ahead its right tab; a program's next milestone past the
|
|
10
|
+
* view waits on the right. A press scrolls the bar into view.
|
|
11
|
+
* · the first column on screen carries the year; the fades show only on the side where there is more; the scroller names its range for
|
|
12
|
+
* a screen reader ("Timeline, Jan 2027 to Dec 2027").
|
|
13
|
+
* · reveal(key): Find scrolls an off-screen bar into view and tints its row for a moment.
|
|
14
|
+
* Sprint does not scroll (data-fixed). */
|
|
15
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
16
|
+
const monthYear = (d) => MON[d.getMonth()] + ' ' + d.getFullYear();
|
|
17
|
+
|
|
18
|
+
let cur = null; // the timeline on screen: { el, sc, from, to, tw, nw, span }
|
|
19
|
+
let keep = null; // its place before a redraw: { span, mid, todayAt }
|
|
20
|
+
let ro = null;
|
|
21
|
+
|
|
22
|
+
/** The place of the timeline on screen, kept for the next draw. */
|
|
23
|
+
function capture() {
|
|
24
|
+
if (!cur || !cur.el.isConnected || cur.fixed) return null;
|
|
25
|
+
const v = view(), now = +cur.el.dataset.now, tx = xOf(now);
|
|
26
|
+
return { span: cur.span, mid: dateAt(v.l + v.w / 2), todayAt: tx >= v.l && tx <= v.l + v.w ? (tx - v.l) / v.w : null };
|
|
27
|
+
}
|
|
28
|
+
/** Leaving the timeline: the next visit opens at today again. */
|
|
29
|
+
export function forget() { keep = null; cur = null; }
|
|
30
|
+
|
|
31
|
+
const xOf = (ms) => ((ms - cur.from) / (cur.to - cur.from)) * cur.tw;
|
|
32
|
+
const dateAt = (x) => cur.from + (x / cur.tw) * (cur.to - cur.from);
|
|
33
|
+
function view() { return { l: cur.sc.scrollLeft, w: Math.max(1, cur.sc.clientWidth - cur.nw) }; }
|
|
34
|
+
function scrollToX(x, smooth) { cur.sc.scrollTo({ left: Math.max(0, x), behavior: smooth ? 'smooth' : 'auto' }); }
|
|
35
|
+
/** Today 25% of the way in (TsCOpen). */
|
|
36
|
+
function toToday(smooth) { const v = view(); scrollToX(xOf(+cur.el.dataset.now) - v.w * 0.25, smooth); }
|
|
37
|
+
|
|
38
|
+
/** The track's width for the screen it is on: one screen holds the span's columns. */
|
|
39
|
+
function size() {
|
|
40
|
+
const ratio = +cur.el.dataset.ratio || 1, w = Math.max(1, cur.sc.clientWidth - cur.nw);
|
|
41
|
+
cur.tw = Math.round(w * ratio);
|
|
42
|
+
cur.sc.style.setProperty('--tw', cur.tw + 'px');
|
|
43
|
+
cur.sc.style.setProperty('--vw', cur.sc.clientWidth + 'px');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Wire the timeline just drawn in `host`. A different span than before opens where the rules say (see the head of this file). */
|
|
47
|
+
export function mount(host) {
|
|
48
|
+
const before = keep || capture();
|
|
49
|
+
keep = null;
|
|
50
|
+
if (ro) { ro.disconnect(); ro = null; }
|
|
51
|
+
const el = host && host.querySelector('.tg-s');
|
|
52
|
+
if (!el) { cur = null; return; }
|
|
53
|
+
const sc = el.querySelector('.tg-sc'), nameCell = el.querySelector('.tg-h > .tg-n');
|
|
54
|
+
cur = { el, sc, from: +el.dataset.from, to: +el.dataset.to, span: el.dataset.span, fixed: el.hasAttribute('data-fixed'), nw: nameCell ? nameCell.getBoundingClientRect().width : 0, tw: 0 };
|
|
55
|
+
size();
|
|
56
|
+
if (!cur.fixed) {
|
|
57
|
+
if (!before || before.span === 'sprint') toToday(false);
|
|
58
|
+
else if (before.todayAt != null) { const v = view(); scrollToX(xOf(+el.dataset.now) - v.w * before.todayAt); }
|
|
59
|
+
else { const v = view(); scrollToX(xOf(before.mid) - v.w / 2); }
|
|
60
|
+
}
|
|
61
|
+
sc.addEventListener('scroll', schedule, { passive: true });
|
|
62
|
+
sc.addEventListener('keydown', onKey);
|
|
63
|
+
sc.addEventListener('pointerdown', onDown);
|
|
64
|
+
el.addEventListener('click', onClick, true);
|
|
65
|
+
ro = new ResizeObserver(() => { if (!cur || cur.el !== el) return; const v = view(), mid = dateAt(v.l + v.w / 2); cur.nw = nameCell ? nameCell.getBoundingClientRect().width : 0; size(); scrollToX(xOf(mid) - view().w / 2); update(); });
|
|
66
|
+
ro.observe(sc);
|
|
67
|
+
update();
|
|
68
|
+
}
|
|
69
|
+
/** Before the page redraws the board: keep the timeline's place (a span switch, a filter, the panel). */
|
|
70
|
+
export function hold() { keep = capture(); }
|
|
71
|
+
|
|
72
|
+
let raf = 0;
|
|
73
|
+
function schedule() { if (!raf) raf = requestAnimationFrame(() => { raf = 0; if (cur && cur.el.isConnected) update(); }); }
|
|
74
|
+
|
|
75
|
+
function update() {
|
|
76
|
+
const v = view(), el = cur.el, max = cur.sc.scrollWidth - cur.sc.clientWidth;
|
|
77
|
+
el.classList.toggle('more-l', !cur.fixed && v.l > 1);
|
|
78
|
+
el.classList.toggle('more-r', !cur.fixed && v.l < max - 1);
|
|
79
|
+
cur.sc.setAttribute('aria-label', 'Timeline, ' + monthYear(new Date(dateAt(v.l))) + ' to ' + monthYear(new Date(dateAt(v.l + v.w))) + (cur.fixed ? '' : '. Left and right arrows move half a screen, T goes to today'));
|
|
80
|
+
// Today: the pill on the line in view, else the back button with its arrow pointing the way
|
|
81
|
+
const tx = xOf(+el.dataset.now), back = el.querySelector('.tg-tback'), off = tx < v.l ? 'l' : tx > v.l + v.w ? 'r' : '';
|
|
82
|
+
if (back) { back.hidden = !off || cur.fixed; back.classList.toggle('l', off === 'l'); back.classList.toggle('r', off === 'r'); }
|
|
83
|
+
// the first column on screen carries the year (TsCGrill 10)
|
|
84
|
+
const ticks = [...el.querySelectorAll('.tg-h .tg-p > span[data-y], .tgq-h .tg-p > span[data-y]')];
|
|
85
|
+
let first = null;
|
|
86
|
+
for (const t of ticks) { if (t.offsetLeft <= v.l + 2) first = t; else break; }
|
|
87
|
+
if (!first) first = ticks[0] || null;
|
|
88
|
+
for (const t of ticks) {
|
|
89
|
+
const pin = t === first && !cur.fixed, s = t.querySelector('small');
|
|
90
|
+
if (t.classList.contains('pin') !== pin || pin) {
|
|
91
|
+
t.classList.toggle('pin', pin);
|
|
92
|
+
if (s && !t.hasAttribute('data-plain')) { if (!('sub' in t.dataset)) t.dataset.sub = s.textContent; s.textContent = pin ? [t.dataset.base, t.dataset.y].filter(Boolean).join(' · ') : t.dataset.sub; }
|
|
93
|
+
const next = ticks[ticks.indexOf(t) + 1], room = (next ? next.offsetLeft : cur.tw) - t.offsetLeft - t.offsetWidth;
|
|
94
|
+
t.style.transform = pin && v.l > t.offsetLeft ? `translateX(${Math.max(0, Math.min(v.l - t.offsetLeft, room))}px)` : '';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// edge tabs (TsCDesk, TsCEdges 1): one per side at most, at the edge of the view
|
|
98
|
+
for (const b of el.querySelectorAll('.tg-edge')) {
|
|
99
|
+
let show = false;
|
|
100
|
+
if (b.dataset.edge === 'm') {
|
|
101
|
+
const ms = JSON.parse(b.dataset.ms || '[]'), next = ms.find(([p]) => (p / 100) * cur.tw > v.l + v.w);
|
|
102
|
+
show = !!next; if (next) { b.querySelector('span').textContent = next[1]; b.dataset.go = next[0]; b.setAttribute('aria-label', 'Next program milestone: ' + next[1] + '. Scroll to it'); }
|
|
103
|
+
} else {
|
|
104
|
+
const a = (+b.dataset.a / 100) * cur.tw, z = (+b.dataset.b / 100) * cur.tw;
|
|
105
|
+
show = b.dataset.edge === 'l' ? z < v.l - 4 : a > v.l + v.w + 4;
|
|
106
|
+
}
|
|
107
|
+
b.hidden = !show || cur.fixed; b.tabIndex = show ? 0 : -1;
|
|
108
|
+
if (show) b.style.left = b.dataset.edge === 'l' ? v.l + 6 + 'px' : v.l + v.w - 6 + 'px';
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Scroll a stretch of the track into view: centred, or its near end in view when it is wider than the screen. */
|
|
113
|
+
function bring(a, b, side) {
|
|
114
|
+
const v = view();
|
|
115
|
+
if (b - a < v.w * 0.9) scrollToX((a + b) / 2 - v.w / 2, true);
|
|
116
|
+
else scrollToX(side === 'l' ? b - v.w * 0.85 : a - v.w * 0.15, true);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function onClick(e) {
|
|
120
|
+
if (dragged) { e.preventDefault(); e.stopPropagation(); dragged = false; return; }
|
|
121
|
+
const t = e.target.closest('.tg-tback, .tg-edge'); if (!t || !cur) return;
|
|
122
|
+
e.preventDefault(); e.stopPropagation();
|
|
123
|
+
if (t.classList.contains('tg-tback')) { toToday(true); return; }
|
|
124
|
+
if (t.dataset.edge === 'm') { const x = (+t.dataset.go / 100) * cur.tw; bring(x, x, 'r'); return; }
|
|
125
|
+
bring((+t.dataset.a / 100) * cur.tw, (+t.dataset.b / 100) * cur.tw, t.dataset.edge);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function onKey(e) {
|
|
129
|
+
if (!cur || cur.fixed || e.altKey || e.ctrlKey || e.metaKey || /^(INPUT|TEXTAREA|SELECT)$/.test(e.target.tagName)) return;
|
|
130
|
+
const v = view();
|
|
131
|
+
if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') { e.preventDefault(); scrollToX(v.l + (e.key === 'ArrowLeft' ? -1 : 1) * v.w / 2, true); }
|
|
132
|
+
else if (e.key === 't' || e.key === 'T') { e.preventDefault(); toToday(true); }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// a drag on empty track scrolls (a mouse; touch and a trackpad scroll natively). A drag that starts on a bar, a name or a button does not.
|
|
136
|
+
let drag = null, dragged = false;
|
|
137
|
+
function onDown(e) {
|
|
138
|
+
if (!cur || cur.fixed || e.button !== 0 || e.pointerType !== 'mouse' || e.target.closest('button, a, .tg-bar, .tg-n, .tgq-n, .bd-prdb, .tg-psb')) return;
|
|
139
|
+
drag = { x: e.clientX, l: cur.sc.scrollLeft, id: e.pointerId }; dragged = false;
|
|
140
|
+
window.addEventListener('pointermove', onMove);
|
|
141
|
+
window.addEventListener('pointerup', onUp, { once: true });
|
|
142
|
+
}
|
|
143
|
+
function onMove(e) {
|
|
144
|
+
if (!drag || !cur) return;
|
|
145
|
+
const dx = e.clientX - drag.x;
|
|
146
|
+
if (!dragged && Math.abs(dx) < 4) return;
|
|
147
|
+
if (!dragged) { dragged = true; cur.el.classList.add('dragging'); }
|
|
148
|
+
cur.sc.scrollLeft = drag.l - dx;
|
|
149
|
+
}
|
|
150
|
+
function onUp() { window.removeEventListener('pointermove', onMove); drag = null; if (cur) cur.el.classList.remove('dragging'); setTimeout(() => { dragged = false; }, 0); }
|
|
151
|
+
|
|
152
|
+
/** Find (TsCEdges 4): scroll the row's bar into view when it is off screen, and tint the row for a moment. */
|
|
153
|
+
export function reveal(key) {
|
|
154
|
+
if (!cur || !cur.el.isConnected) return;
|
|
155
|
+
const row = [...cur.el.querySelectorAll('[data-row]')].find((r) => r.dataset.row === key); if (!row) return;
|
|
156
|
+
const p = row.querySelector('.tg-p[data-a]');
|
|
157
|
+
if (p && !cur.fixed) {
|
|
158
|
+
const a = (+p.dataset.a / 100) * cur.tw, b = (+p.dataset.b / 100) * cur.tw, v = view();
|
|
159
|
+
if (b < v.l || a > v.l + v.w) bring(a, b, b < v.l ? 'l' : 'r');
|
|
160
|
+
}
|
|
161
|
+
row.scrollIntoView({ block: 'nearest' });
|
|
162
|
+
row.classList.remove('tint'); void row.offsetWidth; row.classList.add('tint');
|
|
163
|
+
setTimeout(() => row.classList.remove('tint'), 1600);
|
|
164
|
+
}
|