create-pmos 0.713.0 → 0.715.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 +45 -39
- package/payload/KIT-VERSION +1 -1
- package/payload/design-system/ui/interactions.md +8 -0
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +44 -0
- package/workspace/design-system/ui/interactions.md +8 -0
- package/workspace/guide/breakdown.md +11 -0
- package/workspace/guide/layout.md +19 -0
- package/workspace/lib/backlog.js +3 -1
- package/workspace/lib/board-premium.js +1 -1
- package/workspace/lib/engine/boards.js +9 -2
- package/workspace/lib/moments.js +41 -3
- package/workspace/lib/routes-boards.js +19 -5
- package/workspace/lib/routes-moments.js +1 -1
- package/workspace/lib/task-store.js +1 -1
- package/workspace/lib/use-log.js +27 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-doc-test.js +2 -0
- package/workspace/public/pm/action-keys.js +234 -0
- package/workspace/public/pm/bd-backlog-ds.js +9 -3
- package/workspace/public/pm/bd-backlog.js +20 -1
- package/workspace/public/pm/bd-pop-ds.js +6 -1
- package/workspace/public/pm/bd-work-ds.css +1 -1
- package/workspace/public/pm/cozy-ev.css +8 -0
- package/workspace/public/pm/cozy-nav.js +2 -0
- package/workspace/public/pm/cozy-pop-work.js +38 -0
- package/workspace/public/pm/ini-view-model.js +1 -1
- package/workspace/public/pm/inline-fields.js +64 -0
- package/workspace/public/pm/page-chat.js +16 -0
- package/workspace/public/pm/pop-work-model.js +1 -1
- package/workspace/public/pm/premium-insights.js +2 -2
- package/workspace/public/pm/quiet-place.js +15 -2
- package/workspace/public/pm/state-blocks.js +31 -0
- package/workspace/public/pm/use-log.js +9 -0
- package/workspace/test-lists/action-keys.json +9 -0
- package/workspace/test-lists/inline-sprint-priority.json +9 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/* pm/action-keys.js — one key each for the five actions people take most (bet A477, initiative action-keys).
|
|
2
|
+
*
|
|
3
|
+
* y Yes to what PMOS proposes o Open the item s Move it to the next sprint p Park it z Undo ? the list of keys
|
|
4
|
+
*
|
|
5
|
+
* A key presses the button the item ALREADY has: it adds no action and no route, so every page and every product built with PMOS gets it
|
|
6
|
+
* without wiring. The item is what the pointer is over, or what has focus, whichever moved last. Its button is found by its words
|
|
7
|
+
* (aria-label, then title, then text), in the item and its parents up to the list, section or dialog that holds it, never across the page,
|
|
8
|
+
* so `y` on one row never says Yes to the next row's proposal. Undo also takes the newest Toast's Undo, from anywhere.
|
|
9
|
+
*
|
|
10
|
+
* Hover explains: a button that has a key gets aria-keyshortcuts and its key in its tooltip ("Open the PRD (O)").
|
|
11
|
+
* The hint steps back once learned (bet A480): after LEARNED_AT presses of a key that acted, in this browser, that key's buttons keep
|
|
12
|
+
* aria-keyshortcuts (a screen reader still says it) but their tooltip loses the key. The ? list always shows every key. The counts are
|
|
13
|
+
* five numbers in localStorage (LEARNED_KEY), no text; with no storage every hint stays.
|
|
14
|
+
* Keys do nothing while typing, in a terminal, with Ctrl, Cmd or Alt, on a held key, or when the page already used the key.
|
|
15
|
+
* Each press is counted on this computer only (pm/use-log.js noteUse: `key-<action>` or `key-miss`, no text, no value).
|
|
16
|
+
*
|
|
17
|
+
* startActionKeys(doc) called once by the menu (pm/cozy-nav.js mountNav), which every page mounts; a second call does nothing
|
|
18
|
+
* actOf(words) PURE: 'approve' | 'open' | 'sprint' | 'park' | 'undo' | ''
|
|
19
|
+
* keyAct(e) PURE: the action a key event asks for, 'sheet' for ?, or null
|
|
20
|
+
* targetOf(act, here, doc) the button (or, for open, the row) the key presses, or null
|
|
21
|
+
* hint(el, learned?) put the key on a button's tooltip once (aria-keyshortcuts only, when its action is in `learned`)
|
|
22
|
+
* unhint(el) take the key back off a tooltip, keep aria-keyshortcuts
|
|
23
|
+
* learnedActs(store?) the Set of actions pressed LEARNED_AT times or more · countUse(act, store?) one more; true on the press that learns it
|
|
24
|
+
* sheetHtml(here) PURE: the ? list's markup; here = Set of the actions with something to act on */
|
|
25
|
+
import { noteUse } from './use-log.js';
|
|
26
|
+
|
|
27
|
+
export const KEYS = [
|
|
28
|
+
{ key: 'y', act: 'approve', say: 'Yes to what PMOS proposes' },
|
|
29
|
+
{ key: 'o', act: 'open', say: 'Open the item' },
|
|
30
|
+
{ key: 's', act: 'sprint', say: 'Move it to the next sprint' },
|
|
31
|
+
{ key: 'p', act: 'park', say: 'Park it' },
|
|
32
|
+
{ key: 'z', act: 'undo', say: 'Undo' },
|
|
33
|
+
];
|
|
34
|
+
const ACT_OF_KEY = Object.fromEntries(KEYS.map((k) => [k.key, k.act]));
|
|
35
|
+
const KEY_OF_ACT = Object.fromEntries(KEYS.map((k) => [k.act, k.key]));
|
|
36
|
+
// order matters: "Undo: open it again" is Undo, "Yes, open it" is Yes
|
|
37
|
+
const RULES = [
|
|
38
|
+
['undo', /^undo\b/i],
|
|
39
|
+
['approve', /^(yes|approve|accept)\b/i],
|
|
40
|
+
['sprint', /\bnext sprint\b/i],
|
|
41
|
+
['park', /^(park|put (it )?on hold|hold it|hold)\b/i],
|
|
42
|
+
['open', /^open\b/i],
|
|
43
|
+
];
|
|
44
|
+
export const PRESS = 'button, a[href], [role="button"], [role="menuitem"]';
|
|
45
|
+
const ROW = '[role="row"], [role="option"], [role="listitem"], .pm-li, li, tr, [data-open]';
|
|
46
|
+
// the item ends where its list, section or dialog starts: a key never reaches into another item
|
|
47
|
+
const STOP = 'body, main, [role="main"], section, [role="region"], dialog, [role="dialog"], nav, ul, ol, table, [role="list"], [role="listbox"], [role="grid"], [role="table"], [role="tree"]';
|
|
48
|
+
const TOAST = '.pm-toast, [data-c3-toast], .toast, [role="status"], [role="alert"]';
|
|
49
|
+
const TYPING = 'input, textarea, select, [contenteditable=""], [contenteditable="true"], [role="textbox"]';
|
|
50
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
|
51
|
+
export const LEARNED_AT = 3;
|
|
52
|
+
export const LEARNED_KEY = 'pmos.actionKeys.used';
|
|
53
|
+
const local = () => { try { return typeof localStorage !== 'undefined' ? localStorage : null; } catch { return null; } };
|
|
54
|
+
function counts(store) {
|
|
55
|
+
try {
|
|
56
|
+
const o = JSON.parse((store && store.getItem(LEARNED_KEY)) || '{}');
|
|
57
|
+
return Object.fromEntries(Object.keys(KEY_OF_ACT).map((a) => [a, Number.isFinite(o && o[a]) ? o[a] : 0]));
|
|
58
|
+
} catch { return null; }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The actions this person has pressed LEARNED_AT times or more in this browser. Empty when nothing is kept. */
|
|
62
|
+
export function learnedActs(store = local()) {
|
|
63
|
+
const c = counts(store);
|
|
64
|
+
return new Set(c ? Object.keys(c).filter((a) => c[a] >= LEARNED_AT) : []);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** One more use of `act`. True only on the press that reaches LEARNED_AT (the hint steps back now). */
|
|
68
|
+
export function countUse(act, store = local()) {
|
|
69
|
+
if (!KEY_OF_ACT[act] || !store) return false;
|
|
70
|
+
const c = counts(store);
|
|
71
|
+
if (!c) return false;
|
|
72
|
+
c[act] += 1;
|
|
73
|
+
try { store.setItem(LEARNED_KEY, JSON.stringify(c)); } catch { return false; }
|
|
74
|
+
return c[act] === LEARNED_AT;
|
|
75
|
+
}
|
|
76
|
+
const say = (s) => { try { console.info('[action-keys] ' + s); } catch { /* no console */ } };
|
|
77
|
+
|
|
78
|
+
/** The words a control is known by: aria-label, then title (without a key already added), then its text. */
|
|
79
|
+
export function wordsOf(el) {
|
|
80
|
+
if (!el || !el.getAttribute) return '';
|
|
81
|
+
const w = el.getAttribute('aria-label') || String(el.getAttribute('title') || '').replace(/\s*\([A-Z?]\)$/, '') || el.textContent || '';
|
|
82
|
+
return String(w).replace(/\s+/g, ' ').trim();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** PURE: the action some words name, or ''. */
|
|
86
|
+
export function actOf(words) {
|
|
87
|
+
const w = String(words || '').trim();
|
|
88
|
+
if (!w) return '';
|
|
89
|
+
for (const [act, re] of RULES) if (re.test(w)) return act;
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** PURE: the action a key event asks for ('sheet' for ?), or null when the key is not ours to take. */
|
|
94
|
+
export function keyAct(e) {
|
|
95
|
+
if (!e || e.defaultPrevented || e.repeat || e.ctrlKey || e.metaKey || e.altKey) return null;
|
|
96
|
+
const t = e.target;
|
|
97
|
+
if (t && t.closest && (t.closest(TYPING) || t.closest('.xterm'))) return null;
|
|
98
|
+
if (t && t.isContentEditable) return null;
|
|
99
|
+
if (e.key === '?') return 'sheet';
|
|
100
|
+
return ACT_OF_KEY[e.key] || null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const usable = (el) => {
|
|
104
|
+
if (!el || el.disabled || (el.getAttribute && (el.getAttribute('aria-disabled') === 'true' || el.hasAttribute('hidden')))) return false;
|
|
105
|
+
if (el.closest && el.closest('[hidden], [inert]')) return false;
|
|
106
|
+
return typeof el.getClientRects !== 'function' || el.getClientRects().length > 0; // display:none has no box
|
|
107
|
+
};
|
|
108
|
+
const matches = (el, sel) => !!(el && el.matches && el.matches(sel));
|
|
109
|
+
const pressesIn = (scope, act) => [...(matches(scope, PRESS) ? [scope] : []), ...(scope.querySelectorAll ? scope.querySelectorAll(PRESS) : [])]
|
|
110
|
+
.filter((c) => actOf(wordsOf(c)) === act && usable(c));
|
|
111
|
+
|
|
112
|
+
/** The button (or, for open, the row) a key presses for the item at `here`, or null. */
|
|
113
|
+
export function targetOf(act, here, doc = typeof document !== 'undefined' ? document : null) {
|
|
114
|
+
if (!KEY_OF_ACT[act]) return null;
|
|
115
|
+
let row = null;
|
|
116
|
+
for (let s = here && here.nodeType === 3 ? here.parentElement : here; s && !matches(s, STOP); s = s.parentElement) {
|
|
117
|
+
const c = pressesIn(s, act)[0];
|
|
118
|
+
if (c) return c;
|
|
119
|
+
if (!row && matches(s, ROW)) row = s;
|
|
120
|
+
}
|
|
121
|
+
if (act === 'undo' && doc && doc.querySelectorAll) { // the newest Toast's Undo, from anywhere on the page
|
|
122
|
+
const all = [...doc.querySelectorAll(TOAST)].flatMap((t) => pressesIn(t, 'undo'));
|
|
123
|
+
if (all.length) return all[all.length - 1];
|
|
124
|
+
}
|
|
125
|
+
if (act === 'open' && row && usable(row)) return row; // a row opens when it is pressed
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** The actions with something to act on anywhere on this page (the ? list marks the others). */
|
|
130
|
+
export function actsHere(doc) {
|
|
131
|
+
const out = new Set();
|
|
132
|
+
if (!doc || !doc.querySelectorAll) return out;
|
|
133
|
+
for (const c of doc.querySelectorAll(PRESS)) { const a = actOf(wordsOf(c)); if (a && usable(c)) out.add(a); }
|
|
134
|
+
if (doc.querySelector && doc.querySelector(ROW)) out.add('open');
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Put the key on a button's tooltip once: "Open the PRD (O)". A button with no key is left alone.
|
|
139
|
+
* A learned action gets aria-keyshortcuts only: its tooltip stays as it was. */
|
|
140
|
+
export function hint(el, learned = new Set()) {
|
|
141
|
+
if (!el || !el.getAttribute || el.getAttribute('aria-keyshortcuts')) return false;
|
|
142
|
+
const act = actOf(wordsOf(el));
|
|
143
|
+
const k = KEY_OF_ACT[act];
|
|
144
|
+
if (!k) return false;
|
|
145
|
+
el.setAttribute('aria-keyshortcuts', k);
|
|
146
|
+
if (learned.has(act)) return true;
|
|
147
|
+
const t = el.getAttribute('title') || el.getAttribute('aria-label') || '';
|
|
148
|
+
if (t) el.setAttribute('title', t + ' (' + k.toUpperCase() + ')');
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Take the key back off a tooltip ("Open the PRD (O)" → "Open the PRD"); aria-keyshortcuts stays. */
|
|
153
|
+
export function unhint(el) {
|
|
154
|
+
const t = el && el.getAttribute ? el.getAttribute('title') : null;
|
|
155
|
+
if (!t || !/\s\([A-Z?]\)$/.test(t)) return false;
|
|
156
|
+
el.setAttribute('title', t.replace(/\s\([A-Z?]\)$/, ''));
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const X = '<svg aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 6l12 12M18 6L6 18"/></svg>';
|
|
161
|
+
|
|
162
|
+
/** PURE: the ? list. here = Set of the actions with something to act on on this page. */
|
|
163
|
+
export function sheetHtml(here = new Set()) {
|
|
164
|
+
const row = (k, words, on = true) => `<li class="pm-row"><kbd class="pm-kbd">${esc(k)}</kbd><span>${esc(words)}</span>${on ? '' : '<span class="pm-meta">Not on this page</span>'}</li>`;
|
|
165
|
+
return `<div class="pm-row"><h2 class="pm-h-sm" id="akTitle">Keys</h2>`
|
|
166
|
+
+ `<button type="button" class="pm-btn" data-ak-close aria-label="Close" title="Close">${X}</button></div>`
|
|
167
|
+
+ '<p class="pm-meta">Point at an item, or tab to it, then press its key.</p>'
|
|
168
|
+
+ `<ul>${KEYS.map((k) => row(k.key.toUpperCase(), k.say, here.has(k.act))).join('')}${row('?', 'This list')}</ul>`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
let started = false;
|
|
172
|
+
const S = { pointer: null, pointerT: 0, focusT: 0, sheet: null, learned: null };
|
|
173
|
+
const learnedNow = () => (S.learned || (S.learned = learnedActs()));
|
|
174
|
+
|
|
175
|
+
function hereOf(doc) {
|
|
176
|
+
const a = doc.activeElement;
|
|
177
|
+
const focused = a && a !== doc.body && a !== doc.documentElement ? a : null;
|
|
178
|
+
return focused && (S.focusT >= S.pointerT || !S.pointer || !S.pointer.isConnected) ? focused : (S.pointer && S.pointer.isConnected ? S.pointer : focused);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function sheet(doc, show) {
|
|
182
|
+
if (S.sheet && S.sheet.open) { S.sheet.close(); if (show !== true) return; }
|
|
183
|
+
if (show === false) return;
|
|
184
|
+
let d = S.sheet;
|
|
185
|
+
if (!d || !d.isConnected) {
|
|
186
|
+
d = doc.createElement('dialog');
|
|
187
|
+
d.className = 'pm-ds ev-keys'; // its look is in cozy-ev.css, which the menu adds to every page
|
|
188
|
+
d.setAttribute('aria-labelledby', 'akTitle');
|
|
189
|
+
doc.body.appendChild(d);
|
|
190
|
+
S.sheet = d;
|
|
191
|
+
}
|
|
192
|
+
d.innerHTML = sheetHtml(actsHere(doc));
|
|
193
|
+
if (typeof d.showModal === 'function') d.showModal(); else d.setAttribute('open', '');
|
|
194
|
+
say('list opened');
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function startActionKeys(doc = typeof document !== 'undefined' ? document : null) {
|
|
198
|
+
if (started || !doc || !doc.addEventListener) return false;
|
|
199
|
+
started = true;
|
|
200
|
+
// Close, or a press on the backdrop, closes the ? list (delegated from the document, like every other part)
|
|
201
|
+
if (doc.defaultView) doc.defaultView.addEventListener('click', (e) => {
|
|
202
|
+
const d = S.sheet;
|
|
203
|
+
if (d && d.open && (e.target === d || (e.target && e.target.closest && e.target.closest('[data-ak-close]')))) d.close();
|
|
204
|
+
});
|
|
205
|
+
doc.addEventListener('pointerover', (e) => {
|
|
206
|
+
S.pointer = e.target; S.pointerT = Date.now();
|
|
207
|
+
const c = e.target && e.target.closest ? e.target.closest(PRESS) : null;
|
|
208
|
+
if (c) hint(c, learnedNow());
|
|
209
|
+
}, { passive: true });
|
|
210
|
+
doc.addEventListener('focusin', (e) => {
|
|
211
|
+
S.focusT = Date.now();
|
|
212
|
+
if (e.target && e.target.closest) { const c = e.target.closest(PRESS); if (c) hint(c, learnedNow()); }
|
|
213
|
+
});
|
|
214
|
+
// the bubble phase, so a page's own key (j, k, x, t, a dialog's Esc) runs first and wins
|
|
215
|
+
doc.addEventListener('keydown', (e) => {
|
|
216
|
+
const act = keyAct(e);
|
|
217
|
+
if (!act) return;
|
|
218
|
+
if (act === 'sheet') { e.preventDefault(); sheet(doc); return; }
|
|
219
|
+
if (S.sheet && S.sheet.open) return; // the list is open: only Esc and ? act
|
|
220
|
+
const el = targetOf(act, hereOf(doc), doc);
|
|
221
|
+
if (!el) { noteUse('key-miss'); say(act + ': nothing here to act on'); return; }
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
hint(el, learnedNow());
|
|
224
|
+
el.click();
|
|
225
|
+
noteUse('key-' + act);
|
|
226
|
+
say(act);
|
|
227
|
+
if (countUse(act)) { // learned now: this key's hints step back on this page too
|
|
228
|
+
learnedNow().add(act);
|
|
229
|
+
for (const b of doc.querySelectorAll('[aria-keyshortcuts="' + KEY_OF_ACT[act] + '"]')) unhint(b);
|
|
230
|
+
say('hint stepped back: ' + act);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
@@ -10,10 +10,12 @@
|
|
|
10
10
|
* Groups follow their best-ranked row; "No initiative yet" goes last. A row's number is its place in that one list.
|
|
11
11
|
*/
|
|
12
12
|
import { sugHtml } from './bd-stands.js';
|
|
13
|
+
import { canEdit } from './inline-fields.js'; // a task's sprint and priority, set in the row (initiative inline-sprint-priority)
|
|
13
14
|
|
|
14
15
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
15
16
|
const SV = (d, n = 16) => `<svg class="pm-ic" width="${n}" height="${n}" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
16
|
-
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', grip: 'M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01', down: 'M7 10l5 5 5-5'
|
|
17
|
+
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', grip: 'M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01', down: 'M7 10l5 5 5-5',
|
|
18
|
+
sprint: 'M4 12h11M11 8l4 4-4 4M19 6v12', flag: 'M6 21V4M6 4h11l-2 4 2 4H6' };
|
|
17
19
|
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
18
20
|
const DAY = 864e5;
|
|
19
21
|
const dayNum = (d) => { const t = Date.parse(String(d || '').slice(0, 10) + 'T00:00:00Z'); return Number.isFinite(t) ? Math.round(t / DAY) : null; };
|
|
@@ -169,8 +171,12 @@ function rowHtml(t, o, drag) {
|
|
|
169
171
|
const state = ps ? `<span class="pm-badge${ps.tone === 'late' ? ' alert' : ' blue'}" title="${esc(ps.title || ps.text)}">${esc(ps.text)}</span>` : `<span class="pm-badge${ready ? ' blue' : ''}">${ready ? 'Ready' : 'Needs detail'}</span>`;
|
|
170
172
|
const src = t.key ? `<span class="pm-meta code">${esc(t.key)}</span>` : '<span class="pm-chip">Not in Jira</span>';
|
|
171
173
|
const n = o.rank ? o.rank.get(t.id) : null;
|
|
174
|
+
// Sprint and Priority in the row (inline-sprint-priority): an open PMOS task only, when the page wires them (o.inline); a set priority shows
|
|
175
|
+
const ib = (attr, label, d) => `<button type="button" class="pm-btn" ${attr}="${esc(u)}" aria-haspopup="menu" aria-label="${esc(label)}" title="${esc(label)}">${SV(d, 14)}</button>`;
|
|
176
|
+
const inl = o.inline && canEdit(t) ? ib('data-bk-sprint', 'Sprint', I.sprint) + ib('data-bk-prio', 'Priority: ' + (t.priority || 'none'), I.flag) : '';
|
|
177
|
+
const prio = t.priority && t.src !== 'jira' ? ` <span class="pm-badge" title="Priority">${esc(t.priority)}</span>` : '';
|
|
172
178
|
return `<tr class="wk-br${ck ? ' sel' : ''}" data-bk="${esc(u)}" data-bkid="${esc(t.id)}"${drag ? ' draggable="true"' : ''}>`
|
|
173
179
|
+ `<td class="wk-rk"><span class="pm-row">${drag ? `<span class="wk-grip" aria-hidden="true">${SV(I.grip, 14)}</span>` : ''}<input type="checkbox" class="wk-ck" data-bkck="${esc(u)}" aria-label="Tick ${esc(t.title)}"${ck ? ' checked' : ''}><span class="pm-meta">${n != null ? n + 1 : ''}</span></span></td>`
|
|
174
|
-
+ `<td><button type="button" class="wk-tt" data-bkopen="${esc(u)}" title="${esc(t.title)}">${esc(t.title)}</button>${idle != null && idle >= SAY_FROM ? ` <span class="pm-badge">${idle} days untouched</span>` : ''}${t.late ? ` <span class="pm-badge alert">${plural(t.late, 'day late', 'days late')}</span>` : ''}</td>`
|
|
175
|
-
+ `<td>${who}</td><td>${state}</td><td>${src}</td><td><span class="pm-meta code">${t.touched ? dayText(t.touched) : ''}</span></td><td class="wk-ac">${o.act ? o.act(t) : ''}</td></tr>`;
|
|
180
|
+
+ `<td><button type="button" class="wk-tt" data-bkopen="${esc(u)}" title="${esc(t.title)}">${esc(t.title)}</button>${prio}${idle != null && idle >= SAY_FROM ? ` <span class="pm-badge">${idle} days untouched</span>` : ''}${t.late ? ` <span class="pm-badge alert">${plural(t.late, 'day late', 'days late')}</span>` : ''}</td>`
|
|
181
|
+
+ `<td>${who}</td><td>${state}</td><td>${src}</td><td><span class="pm-meta code">${t.touched ? dayText(t.touched) : ''}</span></td><td class="wk-ac">${inl}${o.act ? o.act(t) : ''}</td></tr>`;
|
|
176
182
|
}
|
|
@@ -18,6 +18,7 @@ import { inView, nextShown, moreHtml, totalOf, logMore, findRows } from './list-
|
|
|
18
18
|
import { productName } from './scope-chip.js'; // the product's display name ("IDPF"), never its folder id
|
|
19
19
|
import * as SP from './bd-sprint.js';
|
|
20
20
|
import * as WS from './work-select.js'; // the bulk move with one Undo, shared with the initiative popup and This sprint (WorkBulkDS)
|
|
21
|
+
import * as IF from './inline-fields.js'; // a task's sprint and priority, set in the row (initiative inline-sprint-priority)
|
|
21
22
|
import * as BD from './bd-backlog-ds.js'; // the Backlog from the system's parts (WorkBacklogDS) // the sprint overview while "This sprint" is on (initiative sprint-overview)
|
|
22
23
|
|
|
23
24
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
@@ -200,7 +201,7 @@ function drawBk() {
|
|
|
200
201
|
+ BD.standsHtml(B, { today: DATA.today, next: DATA.next, pull: pullFor(order) })
|
|
201
202
|
+ BD.tableHtml(order, { tab: BV.tab, group: BV.group, menu: BMENU, today: DATA.today, rank, sel: SEL, picking: host.classList.contains('picking'),
|
|
202
203
|
act: (t) => actHtml(t, BM.groupOf(t, partB())), stateOf: (t) => { if (!t.agent) return null; const x = BM.stateOf(t); return { text: x.text, tone: x.tone, title: x.text + (x.note ? ' · ' + x.note : '') }; },
|
|
203
|
-
groupsPmos: pmosGroups, said: showing + said, mode });
|
|
204
|
+
groupsPmos: pmosGroups, said: showing + said, mode, inline: true });
|
|
204
205
|
drawBar();
|
|
205
206
|
}
|
|
206
207
|
const saveBv = () => put('pmos.work.backlog', BV);
|
|
@@ -212,6 +213,14 @@ async function bkPress(e) {
|
|
|
212
213
|
if (hit('data-bkgroup')) { BMENU = !BMENU; draw(); const n = host.querySelector('[data-bkgrp][aria-checked="true"]'); if (BMENU && n) n.focus(); return true; }
|
|
213
214
|
if ((b = hit('data-bkgrp'))) { BV.group = b.dataset.bkgrp; BMENU = false; saveBv(); draw(); const n = host.querySelector('[data-bkgroup]'); if (n) n.focus(); return true; }
|
|
214
215
|
if (BMENU) { BMENU = false; draw(); }
|
|
216
|
+
// Sprint and Priority in the row (inline-sprint-priority): each pick saves through editMany, whose line carries the Undo
|
|
217
|
+
if ((b = hit('data-bk-sprint'))) { const t = taskOf(b.dataset.bkSprint); if (t) sprintPick(b, t); return true; }
|
|
218
|
+
if ((b = hit('data-bk-prio'))) {
|
|
219
|
+
const t = taskOf(b.dataset.bkPrio); if (!t) return true;
|
|
220
|
+
const L = IF.priorityItems(t.priority || '');
|
|
221
|
+
pickPop(b, 'Priority', L.map((p) => [p.v || '-', p.label + (p.on ? ' (now)' : '')]), async (v) => { const p = v === '-' ? '' : v; if (p === (t.priority || '')) return; await editMany([t], { priority: p }, p || 'No priority'); });
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
215
224
|
if ((b = hit('data-bktune'))) { if (pop && pop.classList.contains('bk-tune')) closePop(); else tune(b); return true; }
|
|
216
225
|
if ((b = hit('data-bksug'))) {
|
|
217
226
|
const p = pullFor(ORDER); if (!p) return true;
|
|
@@ -473,6 +482,16 @@ function datePop(at, pick) {
|
|
|
473
482
|
pop.addEventListener('click', (e) => { if (e.target.closest('[data-ok]') && inp.value) { closePop(); pick(inp.value); } });
|
|
474
483
|
pop.addEventListener('keydown', (e) => { if (e.key === 'Escape') { closePop(); at.focus(); } });
|
|
475
484
|
}
|
|
485
|
+
/** The Sprint list of a row (inline-sprint-priority): the active sprints and the next one, as the tracker holds them, with their days. */
|
|
486
|
+
function sprintPick(at, t) {
|
|
487
|
+
const all = (DATA.now || []).filter((s) => s.ws === t.ws && s.board === t.board).map((s) => ({ ...s, state: 'active' }))
|
|
488
|
+
.concat(DATA.next && (DATA.hist || []).length <= 1 ? [{ ...DATA.next, state: 'future' }] : []); // the next sprint is read for one board only
|
|
489
|
+
const L = IF.sprintItems({ start: t.start || '', end: t.due || '' }, IF.sprintChoices(all, DATA.today));
|
|
490
|
+
pickPop(at, 'Sprint', L.map((s, i) => [String(i), s.label + ' · ' + s.dates + (s.on ? ' (now)' : '')]), async (v) => {
|
|
491
|
+
const s = L[+v]; if (!s || s.on) return;
|
|
492
|
+
await editMany([t], IF.sprintPatch(t, s), 'Into ' + s.label);
|
|
493
|
+
});
|
|
494
|
+
}
|
|
476
495
|
/** ⋯ on a row PMOS works on (design check 1 g): Stop, and Give to a person (PMOS stops, then the person has it). */
|
|
477
496
|
function rowMenu(at, t) {
|
|
478
497
|
pickPop(at, 'PMOS is working on it', [['stop', 'Stop'], ['person', 'Give to a person']], async (k) => {
|
|
@@ -21,6 +21,8 @@ export const I = {
|
|
|
21
21
|
dia: 'M12 4l8 8-8 8-8-8z', doc: 'M7 3h7l4 4v14H7zM14 3v4h4M9.5 12h6M9.5 16h6', deck: 'M4 5h16v11H4zM12 16v4M8 20h8', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1',
|
|
22
22
|
proto: 'M4 5h16v12H4zM9 21h6M12 17v4', right: 'M10 7l5 5-5 5', down: 'M7 10l5 5 5-5', jira: 'M12 3l9 9-9 9-9-9zM12 8l4 4-4 4-4-4z',
|
|
23
23
|
who: 'M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM5 20a7 7 0 0 1 14 0', cal: 'M5 6h14v14H5zM5 10h14M9 4v4M15 4v4', stage: 'M5 7h14M5 12h10M5 17h6',
|
|
24
|
+
// the row's Sprint and Priority (initiative inline-sprint-priority): a run of days, a flag
|
|
25
|
+
sprint: 'M4 12h11M11 8l4 4-4 4M19 6v12', flag: 'M6 21V4M6 4h11l-2 4 2 4H6',
|
|
24
26
|
};
|
|
25
27
|
import * as WT from './work-tree.js'; // subtasks and the epic check (initiative work-subtasks)
|
|
26
28
|
import { barHtml as selBar } from './work-select.js'; // the bulk bar (WorkBulkDS)
|
|
@@ -170,7 +172,8 @@ export function listHtml(rows, W, o = {}) {
|
|
|
170
172
|
}
|
|
171
173
|
const sel = o.sel || new Set();
|
|
172
174
|
const li = (x) => {
|
|
173
|
-
|
|
175
|
+
// a priority set in the row (inline-sprint-priority) says itself first; none, nothing
|
|
176
|
+
const sub = x.jsub ? [x.who && x.who !== 'You' ? x.who : '', x.date].filter(Boolean).join(' · ') : [x.priority || '', x.date, x.who && x.who !== 'You' ? x.who : ''].filter(Boolean).join(' · ');
|
|
174
177
|
// the tick (WorkStatesDS 3): marks it done, with Undo; a done task and a Jira ticket show their state only
|
|
175
178
|
const box = x.done ? `<span class="pwd-ck dn" aria-label="Done" role="img">${SV(I.ok, 14)}</span>`
|
|
176
179
|
: o.ro || x.jira ? `<span class="pwd-ck" aria-hidden="true">${SV(x.ms ? I.dia : I.box, 14)}</span>`
|
|
@@ -182,6 +185,8 @@ export function listHtml(rows, W, o = {}) {
|
|
|
182
185
|
+ (x.jira || x.done ? '' : ab(`data-pw-who="${esc(x.uid)}" aria-haspopup="menu"`, 'Who: ' + (x.who || 'no one'), I.who))
|
|
183
186
|
+ (x.done ? '' : ab(`data-pw-date="${esc(x.uid)}" aria-haspopup="dialog"`, x.date ? (x.ms ? 'Date: ' : 'Due: ') + x.date : 'Set a date', I.cal))
|
|
184
187
|
+ (x.jira ? '' : ab(`data-pw-stage="${esc(x.uid)}" aria-haspopup="menu"`, 'Stage', I.stage))
|
|
188
|
+
// Sprint and Priority (inline-sprint-priority): an open PMOS task only; Jira keeps its tickets' own
|
|
189
|
+
+ (x.jira || x.done ? '' : ab(`data-pw-sprint="${esc(x.uid)}" aria-haspopup="menu"`, 'Sprint', I.sprint) + ab(`data-pw-prio="${esc(x.uid)}" aria-haspopup="menu"`, 'Priority: ' + (x.priority || 'none'), I.flag))
|
|
185
190
|
+ ab(`data-pw-row-more="${esc(x.uid)}" aria-haspopup="menu"`, 'More for ' + x.title, I.more) + '</span>';
|
|
186
191
|
// a parent (WorkSubtasksDS): the fold chevron, "n of m done" with its bar; children indent one step per level, up to three
|
|
187
192
|
const chev = x.kids ? `<button type="button" class="pwd-chev" data-pw-sub="${esc(x.uid)}" aria-expanded="${!!x.open}" aria-label="${esc((x.open ? 'Fold ' : 'Open ') + x.title)}">${SV(x.open ? I.down : I.right, 14)}</button>` : (x.depth || (o.nested && !x.depth) ? '<span class="pwd-chev sp" aria-hidden="true"></span>' : '');
|
|
@@ -151,7 +151,7 @@ body.bd-page.bk-on [id="bkBody"] { display: flex; flex-direction: column; gap: v
|
|
|
151
151
|
.wk-bkt .wk-tt { all: unset; cursor: pointer; font-weight: var(--fw-strong); }
|
|
152
152
|
.wk-bkt .wk-tt:hover { text-decoration: underline; }
|
|
153
153
|
.wk-bkt .wk-tt:focus-visible { box-shadow: var(--glow); border-radius: var(--radius-sm); }
|
|
154
|
-
.wk-bkt th.wk-ac, .wk-bkt td.wk-ac { width: 1%; text-align: right; }
|
|
154
|
+
.wk-bkt th.wk-ac, .wk-bkt td.wk-ac { width: 1%; text-align: right; white-space: nowrap; }
|
|
155
155
|
.wk-bkt tr.drag td { opacity: .5; }
|
|
156
156
|
.wk-bkt tr.drop td { box-shadow: inset 0 2px 0 var(--blue); }
|
|
157
157
|
.wk-bkt tr.wk-g td { padding: 0; }
|
|
@@ -413,6 +413,9 @@
|
|
|
413
413
|
/* a quiet place (pm/quiet-place.js, onboarding B3 ObA4Gradual): one honest line instead of empty tables, until its moment comes */
|
|
414
414
|
.qp-on > :not(.qp-line) { display: none !important; }
|
|
415
415
|
.qp-line { margin: 18vh auto 0; max-width: 520px; padding: 0 var(--space-16); text-align: center; font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink2); line-height: 1.5; }
|
|
416
|
+
.qp-line > p { margin: 0; }
|
|
417
|
+
/* its one next step (initiative empty-page-next-action): the Komorebi Suggestion part, under the line, left-aligned inside */
|
|
418
|
+
.qp-line .pm-state-next, .ins-empty .pm-state-next { display: inline-flex; margin-top: var(--space-16); text-align: left; font-weight: var(--fw-regular); }
|
|
416
419
|
/* Settings › Claude › How Claude decides and Lessons (boards AwG, AwG2): a lesson says what went wrong in amber, what changed in blue */
|
|
417
420
|
.cz .ev-lead { margin: 0 0 var(--space-4); }
|
|
418
421
|
.cz .ev-ls { display: flex; flex-direction: column; gap: 2px; }
|
|
@@ -539,3 +542,8 @@
|
|
|
539
542
|
.ev-st.pm-ds svg.ev-gbar .bg { fill: var(--well); }
|
|
540
543
|
.ev-st.pm-ds svg.ev-gbar .fg { fill: var(--leaf); }
|
|
541
544
|
|
|
545
|
+
/* ── the ? list of action keys (pm/action-keys.js, bet A477): a Komorebi sheet over the page; its parts are pm-h-sm, pm-row, pm-kbd, pm-meta, pm-btn.
|
|
546
|
+
* It takes the width of its rows, never wider than the window less space-16 a side, and its head and list are reached through those parts. ── */
|
|
547
|
+
.ev-keys.pm-ds { border: 0; border-radius: var(--radius-card); background: var(--card); color: var(--ink); box-shadow: var(--lift); padding: var(--space-24); width: fit-content; max-width: calc(100% - var(--space-32)); }
|
|
548
|
+
.ev-keys.pm-ds > .pm-row { justify-content: space-between; }
|
|
549
|
+
.ev-keys.pm-ds > ul { list-style: none; margin: var(--space-16) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-8); }
|
|
@@ -44,6 +44,7 @@ import { mountToastFaces, loadPrefs } from './cozy-adler.js';
|
|
|
44
44
|
import './draft-keep.js'; // forms-keep-drafts: every text box on every page keeps a draft until sent, saved or cleared
|
|
45
45
|
import { pmPost } from './http.js'; // Adler (batch 16 item 2): every toast carries his S face; Settings > Adler is read once
|
|
46
46
|
import { startUseLog } from './use-log.js'; // bet A466: every page mounts the menu, so the menu starts the local use log (this computer only)
|
|
47
|
+
import { startActionKeys } from './action-keys.js'; // bet A477: y o s p z act on the item under the pointer, ? lists the keys
|
|
47
48
|
|
|
48
49
|
/* The six places (slice 1). A place shows once it has an href: Events, Library and Routine get theirs when their slice ships. Until then
|
|
49
50
|
* Today is today.html (slice 5; Home before it), Work is the Board and Goals is premium-goals.html (slice 9; Intelligence before it); the keys stay the pages' own (home, board, insights). */
|
|
@@ -200,6 +201,7 @@ export function mountNav(here, doc = document, opts = {}) {
|
|
|
200
201
|
doc.body.appendChild(w);
|
|
201
202
|
mountToastFaces(doc); loadPrefs();
|
|
202
203
|
startUseLog(doc);
|
|
204
|
+
startActionKeys(doc);
|
|
203
205
|
const fab = w.querySelector('#czFab'), menu = w.querySelector('#czMenu'), scrim = w.querySelector('#czScrim');
|
|
204
206
|
const draw = () => {
|
|
205
207
|
N.rail = railOn();
|
|
@@ -29,6 +29,7 @@ const { localToday } = DP;
|
|
|
29
29
|
import * as AK from './artefact-kind.js';
|
|
30
30
|
import * as WT from './work-tree.js'; // subtasks, the epic check and its fix (initiative work-subtasks)
|
|
31
31
|
import * as SEL from './work-select.js'; // select several rows and move them together (WorkBulkDS)
|
|
32
|
+
import * as IF from './inline-fields.js'; // a task's sprint and priority, set in the row (initiative inline-sprint-priority)
|
|
32
33
|
import * as PD from './bd-pop-ds.js'; // the popup on a computer, built from the design system's blocks (initiative work-ds-popup) // 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)
|
|
33
34
|
|
|
34
35
|
const CSS = new URL('./cozy-pop-work.css', import.meta.url).href, DSCSS = new URL('./bd-pop-ds.css', import.meta.url).href;
|
|
@@ -660,6 +661,8 @@ export function wire(body, h0, x0) {
|
|
|
660
661
|
if (d.pwGroupDrop) { const dd = dropped(); dd.add('group:' + c.id + ':' + d.pwGroupDrop); store.set(DROP, [...dd].slice(-200)); redraw(); return; }
|
|
661
662
|
if (d.pwWho) { whoMenu(b, d.pwWho, c, h, x); return; }
|
|
662
663
|
if (d.pwStage) { stageMenu(b, d.pwStage, c, h, x); return; }
|
|
664
|
+
if (d.pwSprint) { sprintMenu(b, d.pwSprint, c, h, x); return; }
|
|
665
|
+
if (d.pwPrio) { prioMenu(b, d.pwPrio, c, h, x); return; }
|
|
663
666
|
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; }
|
|
664
667
|
if (d.pwFact) { fact(d.pwFact, b, c, h); return; }
|
|
665
668
|
if (d.pwStatus) { statusMenu(b, d.pwStatus, h, c); return; }
|
|
@@ -1161,6 +1164,41 @@ function stageMenu(btn, uid, c, h, x) {
|
|
|
1161
1164
|
h.move(uid, { to: s.key, from: cur, name: s.name });
|
|
1162
1165
|
}, { menu: true, label: 'Stage', focus: '[aria-checked="true"]' });
|
|
1163
1166
|
}
|
|
1167
|
+
/* Sprint and Priority (initiative inline-sprint-priority): each pick saves at once through POST /api/boards/tasks/edit, and its Undo sends the
|
|
1168
|
+
* answer's `from` back. Sprint lists the board's open sprints (GET /api/boards/sprints, as the tracker holds them) and gives the task the
|
|
1169
|
+
* sprint's days; a Jira ticket has neither button (Jira keeps its own). The pop list closes on Esc (pm/hi-pop.js). */
|
|
1170
|
+
const SPRINTS = new Map(); // ws|board → the open sprints, read once per popup page
|
|
1171
|
+
async function sprintMenu(btn, uid, c, h, x) {
|
|
1172
|
+
const row = c.W.rows.find((r) => r.uid === uid) || {};
|
|
1173
|
+
const o = (x && x.o && x.o()) || {}, w = h.where ? h.where() : {}, ws = w.ws || o.ws, board = w.board || o.board, k = ws + '|' + board;
|
|
1174
|
+
if (!SPRINTS.has(k)) {
|
|
1175
|
+
const r = await pmGet('/api/boards/sprints?ws=' + encodeURIComponent(ws || '') + '&board=' + encodeURIComponent(board || '')).catch(() => null);
|
|
1176
|
+
SPRINTS.set(k, r && r.ok !== false ? r.sprints || [] : []);
|
|
1177
|
+
}
|
|
1178
|
+
const L = IF.sprintItems(row, IF.sprintChoices(SPRINTS.get(k), c.W.today));
|
|
1179
|
+
openPop(btn, 'pw-sprint', L.map((s, i) => `<button type="button" class="hi-mi" role="menuitemradio" aria-checked="${s.on}" data-i="${i}">${esc(s.label)} <span class="hi-small">${esc(s.dates)}</span></button>`).join('')
|
|
1180
|
+
|| '<p class="hi-small">No open sprint has dates yet. When the tracker has one, it shows here.</p>', async (b) => {
|
|
1181
|
+
const s = L[+b.dataset.i]; closePop(); if (!s || s.on) return;
|
|
1182
|
+
await editRow(uid, IF.sprintPatch(row, s), IF.saySprint(row.title, s), c, h, x, 'sprint');
|
|
1183
|
+
}, { menu: true, label: 'Sprint', focus: '[aria-checked="true"]' });
|
|
1184
|
+
}
|
|
1185
|
+
function prioMenu(btn, uid, c, h, x) {
|
|
1186
|
+
const row = c.W.rows.find((r) => r.uid === uid) || {};
|
|
1187
|
+
const L = IF.priorityItems(row.priority || '');
|
|
1188
|
+
openPop(btn, 'pw-prio', L.map((p, i) => `<button type="button" class="hi-mi" role="menuitemradio" aria-checked="${p.on}" data-i="${i}">${esc(p.label)}</button>`).join(''), async (b) => {
|
|
1189
|
+
const p = L[+b.dataset.i]; closePop(); if (!p || p.on) return;
|
|
1190
|
+
await editRow(uid, { priority: p.v }, IF.sayPriority(row.title, p.v), c, h, x, 'priority');
|
|
1191
|
+
}, { menu: true, label: 'Priority', focus: '[aria-checked="true"]' });
|
|
1192
|
+
}
|
|
1193
|
+
async function editRow(uid, patch, words, c, h, x, field) {
|
|
1194
|
+
const o = (x && x.o && x.o()) || {}, w = h.where ? h.where() : {}, ws = w.ws || o.ws, board = w.board || o.board;
|
|
1195
|
+
const say = (m) => (h.toast ? h.toast(m) : undoToast(m));
|
|
1196
|
+
const r = await pmPost('/api/boards/tasks/edit', { ws, board, task: uid, ...patch }).catch(() => null);
|
|
1197
|
+
if (!r || r.ok === false) { say((r && r.error) || 'The ' + field + ' was not changed.'); return; }
|
|
1198
|
+
const back = {}; for (const k of Object.keys(patch)) if (k !== 'sprint') back[k] = r.from && r.from[k] != null ? r.from[k] : '';
|
|
1199
|
+
undoToast(words, async () => { const u = await pmPost('/api/boards/tasks/edit', { ws, board, task: uid, ...back }).catch(() => null); if (!u || u.ok === false) say((u && u.error) || 'The undo did not land.'); if (h.reload) await h.reload(); });
|
|
1200
|
+
if (h.reload) await h.reload();
|
|
1201
|
+
}
|
|
1164
1202
|
/* "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
|
|
1165
1203
|
* ticket view. On close the row is lit for a moment. */
|
|
1166
1204
|
async function openSmall(uid, c, h, x, body, bt) {
|
|
@@ -146,7 +146,7 @@ function rowOf(k0, today, J = null) {
|
|
|
146
146
|
jkey: J ? J.key : '', jst: J ? String(J.raw || J.status || '') : '', jmove: J && J.move ? J.move : null, _k: k0, _t: today, // jmove: a move asked in PMOS (lib/jira-moves.js)
|
|
147
147
|
// subtasks and the Jira chip and epic check (initiative work-subtasks): the parent task; the ticket's link, epic (undefined: not read),
|
|
148
148
|
// assignee, type and sub-tasks, from the sprint read (J) or the read of the ticket the task names (k0.jira, lib/board-premium.js jiraOf)
|
|
149
|
-
parent: k0.parent || '', ...jiraFields(J, k0.jira) };
|
|
149
|
+
parent: k0.parent || '', ...jiraFields(J, k0.jira), ...(k0.priority && !J ? { priority: k0.priority } : {}) }; // priority: set in the row (inline-sprint-priority)
|
|
150
150
|
}
|
|
151
151
|
function jiraFields(J, R) {
|
|
152
152
|
if (!J && !R) return {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* pm/inline-fields.js — a task's sprint and priority, set in the row (initiative inline-sprint-priority, idea A469).
|
|
2
|
+
* PURE: no DOM, no request, no clock (the caller passes today). The initiative popup (pm/bd-pop-ds.js, wired in pm/cozy-pop-work.js) and
|
|
3
|
+
* Work › Backlog (pm/bd-backlog-ds.js, wired in pm/bd-backlog.js) draw the two buttons and their lists from here.
|
|
4
|
+
*
|
|
5
|
+
* canEdit(row) → bool an open PMOS task: not done, not a Jira ticket (Jira keeps its own sprint and priority)
|
|
6
|
+
* sprintChoices(sprints, today) → [choice] the open sprints with dates: active first, then coming, by start day; ended, closed or
|
|
7
|
+
* undated ones left out; one per name. choice: { name, label, start, end, state, dates }
|
|
8
|
+
* sprintOf(task, choices) → choice | null the sprint whose days hold the task's due day (its start, with no due)
|
|
9
|
+
* sprintItems(task, choices) → [{ ...choice, on }] the Sprint list, the one the task is in ticked
|
|
10
|
+
* sprintPatch(task, choice) → { start?, due, sprint } what POST /api/boards/tasks/edit takes: the sprint's days (a milestone: the last day only)
|
|
11
|
+
* priorityItems(cur) → [{ v, label, on }] P1, P2, P3 and No priority ('')
|
|
12
|
+
* saySprint(title, choice) · sayPriority(title, v) the one line said after a pick (with Undo)
|
|
13
|
+
*
|
|
14
|
+
* A pick saves at once through POST /api/boards/tasks/edit, whose answer `from` is the Undo. Nothing is written to Jira. */
|
|
15
|
+
|
|
16
|
+
export const PRIORITIES = Object.freeze(['P1', 'P2', 'P3']);
|
|
17
|
+
const MON3 = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
18
|
+
const day = (v) => (typeof v === 'string' && /^\d{4}-\d{2}-\d{2}/.test(v) ? v.slice(0, 10) : '');
|
|
19
|
+
const short = (d) => { const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(d); return m ? Number(m[3]) + ' ' + MON3[Number(m[2]) - 1] : d; };
|
|
20
|
+
/** "IDPF Sprint 119" → "Sprint 119"; a name with no sprint number stays as it is (lib/sprint-now.js labelOf). */
|
|
21
|
+
const labelOf = (name) => { const m = /(sprint\s*\d+)\s*$/i.exec(String(name || '')); return m ? m[1].replace(/^s/, 'S') : String(name || ''); };
|
|
22
|
+
|
|
23
|
+
/** An open PMOS task: the row of the initiative popup ({ kind, done, jira }) or of the Backlog ({ src, state }). */
|
|
24
|
+
export function canEdit(r) {
|
|
25
|
+
if (!r || r.jira || r.src === 'jira' || r.done) return false;
|
|
26
|
+
if (r.kind === 'stage' || r.kind === 'Epic') return false;
|
|
27
|
+
return !['Done', "Won't do", 'Archived'].includes(r.state || r.status || '');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function sprintChoices(sprints, today) {
|
|
31
|
+
const t = day(today), seen = new Set(), out = [];
|
|
32
|
+
for (const s of Array.isArray(sprints) ? sprints : []) {
|
|
33
|
+
if (!s || !s.name || seen.has(String(s.name))) continue;
|
|
34
|
+
const start = day(s.start), end = day(s.end), state = String(s.state || '');
|
|
35
|
+
if (!start || !end || state === 'closed' || (t && end < t)) continue;
|
|
36
|
+
seen.add(String(s.name));
|
|
37
|
+
out.push({ name: String(s.name), label: s.label || labelOf(s.name), start, end, state, dates: short(start) + ' – ' + short(end) });
|
|
38
|
+
}
|
|
39
|
+
return out.sort((a, b) => (a.state === 'active' ? 0 : 1) - (b.state === 'active' ? 0 : 1) || a.start.localeCompare(b.start) || a.name.localeCompare(b.name));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function sprintOf(task, choices) {
|
|
43
|
+
const d = day(task && (task.end || task.due)) || day(task && task.start);
|
|
44
|
+
if (!d) return null;
|
|
45
|
+
return (choices || []).find((s) => s.start <= d && d <= s.end) || null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function sprintItems(task, choices) {
|
|
49
|
+
const cur = sprintOf(task, choices);
|
|
50
|
+
return (choices || []).map((s) => ({ ...s, on: !!cur && cur.name === s.name }));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function sprintPatch(task, s) {
|
|
54
|
+
const ms = !!(task && (task.ms || task.milestone));
|
|
55
|
+
return ms ? { due: s.end, sprint: s.name } : { start: s.start, due: s.end, sprint: s.name };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function priorityItems(cur) {
|
|
59
|
+
const c = PRIORITIES.includes(cur) ? cur : '';
|
|
60
|
+
return PRIORITIES.map((v) => ({ v, label: v, on: v === c })).concat([{ v: '', label: 'No priority', on: !c }]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const saySprint = (title, s) => `In ${(s && (s.label || s.name)) || 'the sprint'}: ${title || 'the task'}.`;
|
|
64
|
+
export const sayPriority = (title, v) => `${v || 'No priority'}: ${title || 'the task'}.`;
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* (the same chat with the scope filled in), and Settings › Workflows' New workflow opens here too, so there is no second chat column.
|
|
9
9
|
*
|
|
10
10
|
* openCos({ here, ws? }) → true the chief-of-staff chat; here: the page's words for the chip ("Board · Atlas"), '' for none
|
|
11
|
+
* ask(text, { ws?, here? }) → true the chief-of-staff chat with `text` written in its box, NOT sent: the person reads it and sends it
|
|
12
|
+
* (a waiting page's next step, state-blocks.js next; initiative empty-page-next-action)
|
|
11
13
|
* openTarget(t, o) → true any chat target (home-chat.js mountChat open), o: { title, url }; while the popup shows, its chat
|
|
12
14
|
* box() → { el, chat } the chat for the popup's right side (cozy-popup.js)
|
|
13
15
|
*
|
|
@@ -99,6 +101,20 @@ export async function openCos(o = {}) {
|
|
|
99
101
|
if (!isPhone()) { const P = await import('./cozy-popup.js'); return P.openCos(cosTarget(o.here, o.ws)); }
|
|
100
102
|
return openTarget(cosTarget(o.here, o.ws), { title: 'Ask PMOS', url: '/premium.html' });
|
|
101
103
|
}
|
|
104
|
+
export async function ask(text, o = {}) {
|
|
105
|
+
const here = o.here != null ? String(o.here) : String((typeof document !== 'undefined' && document.title) || '').replace(/\s*[·|–-]\s*PMOS\s*$/i, '').trim();
|
|
106
|
+
await openCos({ here, ws: o.ws });
|
|
107
|
+
let n = 0;
|
|
108
|
+
const t = setInterval(() => {
|
|
109
|
+
const b = document.querySelector('.pc-chat textarea');
|
|
110
|
+
if (!b && ++n <= 40) return;
|
|
111
|
+
clearInterval(t);
|
|
112
|
+
if (!b) return;
|
|
113
|
+
b.value = String(text || ''); b.dispatchEvent(new Event('input', { bubbles: true })); b.focus();
|
|
114
|
+
try { b.setSelectionRange(b.value.length, b.value.length); } catch { /* not a text box */ }
|
|
115
|
+
}, 50);
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
102
118
|
const isPhone = () => typeof innerWidth === 'number' && innerWidth <= 760;
|
|
103
119
|
/** The chat itself for the popup (cozy-popup.js): mounted once, the same element and conversation reader as the chat panel. */
|
|
104
120
|
export async function box() {
|
|
@@ -299,7 +299,7 @@ function taskRow(x, t) {
|
|
|
299
299
|
prog: /progress|review/i.test(st), wont: !!x.wont || st === "Won't do",
|
|
300
300
|
// subtasks and Jira (initiative work-subtasks): the parent, the chip's key and link, the epic as read, the assignee, a Jira sub-task
|
|
301
301
|
parent: x.parent || '', ckey: x.ckey || x.jkey || '', jurl: x.jurl || '', ...(x.jepic !== undefined ? { jepic: x.jepic, jepicName: x.jepicName || '' } : {}), jassignee: x.jassignee || '', jtype: x.jtype || '',
|
|
302
|
-
...(x.jsub ? { jsub: true } : {}), ...(x.jsubOf ? { jsubOf: x.jsubOf } : {}) };
|
|
302
|
+
...(x.jsub ? { jsub: true } : {}), ...(x.jsubOf ? { jsubOf: x.jsubOf } : {}), ...(x.priority ? { priority: x.priority } : {}) };
|
|
303
303
|
}
|
|
304
304
|
/** The tasks of every stage, nested (initiative work-subtasks): the read Jira sub-tasks join as rows under their ticket, and a task that names
|
|
305
305
|
* a sub-task's key with no parent of its own sits under its ticket's row. → { T: Map uid → node, isChild(x), rx(x) (a parent with its roll-up) } */
|
|
@@ -35,7 +35,7 @@ import * as GW from './grill-words.js'; // Grill and Forecast screens (canvas
|
|
|
35
35
|
import * as PK from './cozy-pick.js'; // the one product picker Home, Board and Insights share (batch 12 item 5)
|
|
36
36
|
import { openReport } from './premium-report-read.js';
|
|
37
37
|
import { mountNav } from './cozy-nav.js';
|
|
38
|
-
import { quietPlace, quietLine } from './quiet-place.js'; // onboarding B3: before a goal is kept Intelligence shows one line; reports before a week of movement
|
|
38
|
+
import { quietPlace, quietLine, quietNext } from './quiet-place.js'; // onboarding B3: before a goal is kept Intelligence shows one line; reports before a week of movement
|
|
39
39
|
import { mountLivePill } from './cozy-live-pill.js';
|
|
40
40
|
import { mountPanels } from './cozy-panels.js';
|
|
41
41
|
import * as IM from './impact.js'; // Your impact's ✦ line (batch 16 item 7): a key result your work moved
|
|
@@ -2195,7 +2195,7 @@ function drawList() {
|
|
|
2195
2195
|
// U3: no "Needs you N" heading; the rows and their ✓ are the signal, and the count belongs to Your move on Home (zero is silence)
|
|
2196
2196
|
const needs = nNeed ? `<div class="ins-nlist" id="repNeeds" role="list" aria-label="Waiting for you">${waits.map(needRowHtml).join('')}${waitAsks.map(askNeedHtml).join('')}</div>` : '';
|
|
2197
2197
|
const table = rest.length + restAsks.length ? `<div class="ins-sec"><h3>Yours</h3><span class="q">${rest.length + restAsks.length}</span></div><div class="ins-rtbl" id="repAsks">${head3}<div role="list">${rest.map(repRowHtml).join('')}${restAsks.map(askRowHtml).join('')}</div></div>`
|
|
2198
|
-
: !empty && !needs ? (quietLine('reports') ? `<div class="ins-empty"><b>${esc(quietLine('reports'))}</b
|
|
2198
|
+
: !empty && !needs ? (quietLine('reports') ? `<div class="ins-empty"><b>${esc(quietLine('reports'))}</b>${quietNext('reports')}</div>` : '<div class="ins-empty"><b>No report is set up and no report file is on record.</b> Reports are made in Home.</div>') : '';
|
|
2199
2199
|
const dd = savedDash().length ? null : draftedDash();
|
|
2200
2200
|
const dashBlock = `<div class="ins-sec"><h3>Dashboards</h3><span class="q">${dashes.length && !dd ? dashes.length + ' · a dashboard is a saved view of Goals' : dd ? '1 drafted · ' + esc(dd.name) : 'none saved · select rows, then Save'}</span></div><div class="ins-dgrid" role="list">${dd ? draftedCard(dd) : ''}${dashes.map(dashCard).join('')}</div>`;
|
|
2201
2201
|
$('#repBody').innerHTML = `${needs}${oneNote()}${libFolds(LIB.L) || '<div id="readyLib"></div>'}<div id="listRows" aria-label="Dashboards and reports">${fbox}${empty}${table}${dashBlock}</div>`;
|