create-pmos 0.611.0 → 0.613.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 +105 -27
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/briefing-premium-calendar-2-test.js +3 -2
- package/workspace/briefing-premium-calendar-3-test.js +1 -1
- package/workspace/briefing-premium-calendar-test.js +1 -1
- package/workspace/briefing-premium-insights-test.js +1 -1
- package/workspace/briefing-premium-test.js +1 -1
- package/workspace/changelog.json +104 -0
- package/workspace/guide/layout.md +52 -18
- package/workspace/guide/programs.md +3 -3
- package/workspace/guide/routine.md +28 -13
- package/workspace/guide/settings-and-switches.md +1 -1
- package/workspace/lib/board-premium.js +12 -4
- package/workspace/lib/cos-chat.js +1 -0
- package/workspace/lib/doc-library.js +43 -12
- package/workspace/lib/doc-path.js +30 -0
- package/workspace/lib/engine/boards.js +4 -2
- package/workspace/lib/events-place.js +190 -38
- package/workspace/lib/events-stated.js +129 -0
- package/workspace/lib/initiative-chat.js +1 -0
- package/workspace/lib/insights-premium.js +13 -1
- package/workspace/lib/library-find.js +162 -0
- package/workspace/lib/library-items.js +196 -24
- package/workspace/lib/notes.js +3 -0
- package/workspace/lib/plan-items.js +17 -3
- package/workspace/lib/routes-artefacts.js +5 -2
- package/workspace/lib/routes-boards.js +6 -2
- package/workspace/lib/routes-doc-sheet.js +1 -0
- package/workspace/lib/routes-events-place.js +47 -10
- package/workspace/lib/routes-library.js +74 -8
- package/workspace/lib/routes-report-setups.js +13 -2
- package/workspace/lib/routine-reports.js +36 -4
- package/workspace/lib/status-when.js +36 -0
- package/workspace/lib/task-items.js +5 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-meet-test.js +2 -1
- package/workspace/premium-vw-notes-test.js +3 -2
- package/workspace/public/pm/artefact-kind.js +87 -0
- package/workspace/public/pm/bd-ini-panel.js +6 -6
- package/workspace/public/pm/bd-span.js +7 -1
- package/workspace/public/pm/bd-work.css +62 -0
- package/workspace/public/pm/bd-work.js +195 -68
- package/workspace/public/pm/cozy-bar.css +11 -0
- package/workspace/public/pm/cozy-bar.js +99 -0
- package/workspace/public/pm/cozy-day-pick.css +27 -0
- package/workspace/public/pm/cozy-day-pick.js +97 -0
- package/workspace/public/pm/cozy-ev.css +0 -4
- package/workspace/public/pm/cozy-events-view.js +165 -33
- package/workspace/public/pm/cozy-events.css +75 -3
- package/workspace/public/pm/cozy-events.js +86 -18
- package/workspace/public/pm/cozy-goals.css +172 -0
- package/workspace/public/pm/cozy-library.css +106 -17
- package/workspace/public/pm/cozy-nav.js +2 -3
- package/workspace/public/pm/cozy-pick.css +3 -0
- package/workspace/public/pm/cozy-pop-work.css +83 -24
- package/workspace/public/pm/cozy-pop-work.js +313 -72
- package/workspace/public/pm/cozy-popup.css +11 -2
- package/workspace/public/pm/cozy-popup.js +67 -9
- package/workspace/public/pm/cozy-routine-job.js +203 -0
- package/workspace/public/pm/cozy-routine-model.js +139 -31
- package/workspace/public/pm/cozy-routine-pop.js +164 -42
- package/workspace/public/pm/cozy-routine.css +61 -8
- package/workspace/public/pm/cozy-routine.js +207 -28
- package/workspace/public/pm/cozy-settings.js +1 -5
- package/workspace/public/pm/cozy-status-when.js +48 -0
- package/workspace/public/pm/cozy-viewer.js +19 -8
- package/workspace/public/pm/cozy-vw-mtg.css +39 -0
- package/workspace/public/pm/goals-model.js +205 -0
- package/workspace/public/pm/goals-open.js +124 -0
- package/workspace/public/pm/home-chat.js +4 -2
- package/workspace/public/pm/home-ini.js +8 -6
- package/workspace/public/pm/ini-edit.js +3 -1
- package/workspace/public/pm/ini-view-model.js +1 -1
- package/workspace/public/pm/library-model.js +170 -42
- package/workspace/public/pm/library-open.js +8 -5
- package/workspace/public/pm/page-chat.js +12 -2
- package/workspace/public/pm/pop-work-model.js +199 -41
- package/workspace/public/pm/premium-board.js +108 -43
- package/workspace/public/pm/premium-goals.js +213 -0
- package/workspace/public/pm/premium-library.js +376 -62
- package/workspace/public/pm/premium-shell.js +1 -1
- package/workspace/public/pm/premium-vw-mtg.js +79 -1
- package/workspace/public/pm/scope-chip.js +207 -0
- package/workspace/public/premium-events.html +3 -1
- package/workspace/public/premium-goals.html +37 -0
- package/workspace/public/premium-library.html +15 -7
- package/workspace/public/premium-routine.html +2 -0
- package/workspace/server.js +2 -1
- package/workspace/test-lists/doc-path.json +9 -0
- package/workspace/test-lists/goals-place.json +9 -0
- package/workspace/test-lists/status-when.json +9 -0
|
@@ -1,36 +1,79 @@
|
|
|
1
|
-
/* pm/library-model.js — the Library's
|
|
2
|
-
* StLibMeetings, StLibDocs on Exploring 2).
|
|
1
|
+
/* pm/library-model.js — the Library's catalogue, PURE (initiative library-place; slice 7 of the six-place navigation, Library round 2).
|
|
3
2
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
3
|
+
* A library keeps a catalogue, not a list by date: one record per item with the same fields, shelves where related items stand together,
|
|
4
|
+
* editions under one record, what is new, and a search on the record and the content. This module is that catalogue over the items of
|
|
5
|
+
* GET /api/library-items (lib/library-items.js ITEM).
|
|
6
|
+
*
|
|
7
|
+
* COLUMNS Name, Kind, Product, About, By, State, Updated
|
|
8
|
+
* FAMILIES · GROUPS · STATES the Kind chip's families, the Group by choices, the State chip's states
|
|
9
|
+
* aboutText(item) → "Program › Initiative"; the initiative leaves when it repeats the Name, and nothing when all of it does
|
|
10
|
+
* stateText(row) → "Final", "Draft · v3"
|
|
11
|
+
* passes(item, f) → whether the filters keep a row. f: { kinds: ['f:<family>' | 'k:<kind>'], states: [state], scope: (tokens) => bool }
|
|
12
|
+
* matches(item, q) → whether the words find the row by its record (name, kind, product, about, by, state)
|
|
13
|
+
* counts(items, f) → { families: {key: n}, kinds: {kind: n}, states: {state: n} }: each chip's counts under the other filters
|
|
14
|
+
* view(items, o) → { groups: [{ key, label, level, n, folded, rows }], shown, hidden }
|
|
15
|
+
* o: { q, f, group: 'new'|'work'|'kind'|'product', open: Set of keys the PM unfolded, shut: Set of keys the PM folded, now }
|
|
16
|
+
* A row: { x, older: [item] } (editions of one document fold under the newest, "v3 · 2 older"), or { checks: [item], key, about }
|
|
17
|
+
* (grouped by New, the gate records of one initiative fold into one "Checks · 3" row; a Kind filter that asks for them shows them singly)
|
|
18
|
+
* Grouped by Work, each program is a shelf and each initiative a shelf inside it; the items stand in the order of the work
|
|
19
|
+
* (brief, PRD, design, prototype, done test, meeting notes), one row per kind with the other files of that kind folded under the
|
|
20
|
+
* newest ("2 earlier"), and a shelf folds.
|
|
21
|
+
* hiddenText(n) → "418 hidden by the filters"
|
|
22
|
+
* groupOf(iso, now) · dayText(iso, now) · noteOf(q, group)
|
|
23
|
+
*/
|
|
13
24
|
|
|
14
|
-
export const
|
|
15
|
-
const
|
|
25
|
+
export const COLUMNS = ['Name', 'Kind', 'Product', 'About', 'By', 'State', 'Updated'];
|
|
26
|
+
export const FAMILIES = [['plans', 'Plans and specs'], ['briefs', 'Briefs'], ['meetings', 'Meeting notes'], ['protos', 'Prototypes and designs'], ['checks', 'Checks'], ['links', 'Links']];
|
|
27
|
+
export const GROUPS = [['new', 'New'], ['work', 'Work'], ['kind', 'Kind'], ['product', 'Product']];
|
|
28
|
+
export const STATES = ['Draft', 'Final', 'Issued'];
|
|
16
29
|
const MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
17
30
|
const DAY = 864e5;
|
|
18
31
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
const bare = (s) => String(s || '').toLowerCase().replace(/…$/, '').replace(/[^a-z0-9]+/g, ' ').trim();
|
|
33
|
+
const repeats = (a, name) => { const A = bare(a), N = bare(name); return !A || A === N || (A.length >= 4 && N.startsWith(A)); };
|
|
34
|
+
export function aboutText(x) {
|
|
35
|
+
const a = (x && x.about) || {};
|
|
36
|
+
const ini = repeats(a.title, x && x.name) ? '' : a.title || '';
|
|
37
|
+
const prog = a.programTitle && !repeats(a.programTitle, x && x.name) ? a.programTitle : '';
|
|
38
|
+
return [prog, ini].filter(Boolean).join(' › ');
|
|
26
39
|
}
|
|
27
|
-
export function
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
|
|
40
|
+
export function stateText(r) {
|
|
41
|
+
const x = r && (r.x || r);
|
|
42
|
+
if (!x || !x.state) return '';
|
|
43
|
+
// the edition: the version the item says, else its place among the editions folded under it (other files of its kind are not editions)
|
|
44
|
+
const v = x.v || (r.older && r.older.length && r.older.every((o) => o.ed && o.ed === x.ed) ? r.older.length + 1 : null);
|
|
45
|
+
return x.state + (v && v > 1 ? ' · v' + v : '');
|
|
31
46
|
}
|
|
32
|
-
export const
|
|
47
|
+
export const noteOf = (q, group) => (q ? '' : group === 'work'
|
|
48
|
+
? 'Each program and initiative is a shelf; inside, the work stands in its order. Press a shelf to fold it.'
|
|
49
|
+
: 'Everything that was made, the newest first. Press a row to open it in the popup, with the chat beside it. Reports are in Routine.');
|
|
33
50
|
|
|
51
|
+
/* ── filters ── */
|
|
52
|
+
const kindOn = (x, kinds) => !kinds || !kinds.length || kinds.includes('f:' + x.family) || kinds.includes('k:' + x.kindText);
|
|
53
|
+
const stateOn = (x, states) => !states || !states.length || states.includes(x.state);
|
|
54
|
+
export function passes(x, f = {}) {
|
|
55
|
+
return !!x && kindOn(x, f.kinds) && stateOn(x, f.states) && (!f.scope || f.scope(x.scope || []));
|
|
56
|
+
}
|
|
57
|
+
const norm = (s) => String(s || '').toLowerCase();
|
|
58
|
+
export function matches(x, q) {
|
|
59
|
+
const words = norm(q).split(/\s+/).filter(Boolean);
|
|
60
|
+
if (!words.length) return true;
|
|
61
|
+
const a = x.about || {};
|
|
62
|
+
const hay = norm([x.name, x.sub, x.kindText, x.state, x.by, x.came, x.product, a.title, a.programTitle].join(' '));
|
|
63
|
+
return words.every((w) => hay.includes(w));
|
|
64
|
+
}
|
|
65
|
+
export function counts(items, f = {}) {
|
|
66
|
+
const families = {}, kinds = {}, states = {};
|
|
67
|
+
for (const x of items || []) {
|
|
68
|
+
if (passes(x, { ...f, kinds: null })) { families[x.family] = (families[x.family] || 0) + 1; kinds[x.kindText] = (kinds[x.kindText] || 0) + 1; }
|
|
69
|
+
if (x.state && passes(x, { ...f, states: null })) states[x.state] = (states[x.state] || 0) + 1;
|
|
70
|
+
}
|
|
71
|
+
return { families, kinds, states };
|
|
72
|
+
}
|
|
73
|
+
/** Does the Kind filter ask for gate records (the Checks family, or one of its kinds)? */
|
|
74
|
+
const asksChecks = (kinds, items) => !!kinds && kinds.some((k) => k === 'f:checks' || (k.startsWith('k:') && (items || []).some((x) => x.gate && 'k:' + x.kindText === k)));
|
|
75
|
+
|
|
76
|
+
/* ── dates ── */
|
|
34
77
|
const t = (iso) => { const n = Date.parse(String(iso || '').length === 10 ? iso + 'T12:00:00' : iso); return Number.isFinite(n) ? n : null; };
|
|
35
78
|
export function groupOf(iso, now = Date.now()) {
|
|
36
79
|
const at = t(iso);
|
|
@@ -46,24 +89,109 @@ export function dayText(iso, now = Date.now()) {
|
|
|
46
89
|
const d = new Date(at), y = new Date(now).getFullYear();
|
|
47
90
|
return d.getDate() + ' ' + MONTHS[d.getMonth()].slice(0, 3) + (d.getFullYear() !== y ? ' ' + d.getFullYear() : '');
|
|
48
91
|
}
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
92
|
+
export const when = (x) => (x && (x.kind === 'meeting' && x.held ? x.held : x.updated)) || null;
|
|
93
|
+
const newest = (a, b) => (t(when(b)) || 0) - (t(when(a)) || 0) || String(a.name).localeCompare(String(b.name));
|
|
94
|
+
|
|
95
|
+
/* the order of the work inside a shelf (round 2, point 3) */
|
|
96
|
+
const WORK_ORDER = ['Anchor', 'Strategic brief', 'Design brief', 'Content brief', 'Spike brief', 'Pre-read', 'Prototype brief', 'Prototype', 'PRD', 'User stories',
|
|
97
|
+
'Spec', 'API spec', 'Design', 'Risk list', 'Done test', 'Rubric', 'Eval', 'Retro', 'Minutes', 'Meeting notes', 'Update note', 'Report'];
|
|
98
|
+
const workRank = (x) => { const i = WORK_ORDER.indexOf(x.kind === 'proto' ? 'Prototype' : x.kindText); return i < 0 ? WORK_ORDER.length - 0.5 : i; };
|
|
99
|
+
|
|
100
|
+
/** Fold the editions of one document under its newest (the highest version, else the newest date). */
|
|
101
|
+
function editions(list) {
|
|
102
|
+
const by = new Map(), out = [];
|
|
103
|
+
for (const x of list) {
|
|
104
|
+
if (!x.ed) { out.push({ x, older: [] }); continue; }
|
|
105
|
+
let r = by.get(x.ed);
|
|
106
|
+
if (!r) { r = { x, older: [] }; by.set(x.ed, r); out.push(r); continue; }
|
|
107
|
+
const better = (x.v || 0) > (r.x.v || 0) || ((x.v || 0) === (r.x.v || 0) && newest(x, r.x) < 0);
|
|
108
|
+
if (better) { r.older.push(r.x); r.x = x; } else r.older.push(x);
|
|
109
|
+
}
|
|
110
|
+
for (const r of out) r.older.sort((a, b) => (b.v || 0) - (a.v || 0) || newest(a, b));
|
|
111
|
+
return out;
|
|
55
112
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
if (!last || last.group !== g) { last = out.find((o) => o.group === g); if (!last) { last = { group: g, items: [] }; out.push(last); } }
|
|
66
|
-
last.items.push(x);
|
|
113
|
+
/** One row per Kind: the newest (the highest version, else the newest date) stands, the other files of that kind fold under it. */
|
|
114
|
+
export function perKind(rows) {
|
|
115
|
+
const by = new Map(), out = [];
|
|
116
|
+
for (const r of rows) {
|
|
117
|
+
const k = r.x.kindText || '';
|
|
118
|
+
const h = by.get(k);
|
|
119
|
+
if (!h) { const n = { x: r.x, older: r.older.slice() }; by.set(k, n); out.push(n); continue; }
|
|
120
|
+
const better = (r.x.v || 0) > (h.x.v || 0) || ((r.x.v || 0) === (h.x.v || 0) && newest(r.x, h.x) < 0);
|
|
121
|
+
if (better) { h.older.push(h.x, ...r.older); h.x = r.x; } else h.older.push(r.x, ...r.older);
|
|
67
122
|
}
|
|
123
|
+
for (const r of out) r.older.sort((a, b) => (b.v || 0) - (a.v || 0) || newest(a, b));
|
|
68
124
|
return out;
|
|
69
125
|
}
|
|
126
|
+
const iniKey = (x) => (x.about && x.about.ws && x.about.ini ? x.about.ws + '|' + x.about.ini : '');
|
|
127
|
+
|
|
128
|
+
export function view(items, { q = '', f = {}, group = 'new', open = new Set(), shut = new Set(), now = Date.now() } = {}) {
|
|
129
|
+
const all = items || [];
|
|
130
|
+
const base = all.filter((x) => matches(x, q));
|
|
131
|
+
const kept = base.filter((x) => passes(x, f));
|
|
132
|
+
const hidden = base.length - kept.length;
|
|
133
|
+
const single = !!String(q).trim() || asksChecks(f.kinds, all) || group !== 'new';
|
|
134
|
+
let rows = editions(kept.slice().sort(newest));
|
|
135
|
+
// grouped by New, an initiative's gate records stand as one "Checks · N" row at the date of the newest
|
|
136
|
+
if (!single) {
|
|
137
|
+
const checks = new Map(), out = [];
|
|
138
|
+
for (const r of rows) {
|
|
139
|
+
const k = r.x.gate ? iniKey(r.x) : '';
|
|
140
|
+
if (!k) { out.push(r); continue; }
|
|
141
|
+
let c = checks.get(k);
|
|
142
|
+
if (!c) { c = { checks: [], key: 'checks:' + k, about: r.x.about, x: null }; checks.set(k, c); out.push(c); }
|
|
143
|
+
c.checks.push(r.x, ...r.older);
|
|
144
|
+
}
|
|
145
|
+
// one gate record alone stands as itself: a fold of one hides nothing
|
|
146
|
+
rows = out.map((r) => (r.checks && r.checks.length === 1 ? { x: r.checks[0], older: [] } : r));
|
|
147
|
+
}
|
|
148
|
+
const at = (r) => (r.checks ? when(r.checks[0]) : when(r.x));
|
|
149
|
+
const groups = [];
|
|
150
|
+
const add = (key, label, level, list, foldable) => {
|
|
151
|
+
const folded = foldable ? (open.has(key) ? false : shut.has(key) ? true : level === 2 && groups.filter((g) => g.level === 2).length >= 3) : false;
|
|
152
|
+
groups.push({ key, label, level, n: list.reduce((s, r) => s + (r.checks ? r.checks.length : 1 + r.older.length), 0), folded, rows: list });
|
|
153
|
+
};
|
|
154
|
+
if (group === 'work') {
|
|
155
|
+
// program › initiative shelves, the most recently touched first; work with no program stands after, then what is not linked to work
|
|
156
|
+
const shelves = new Map();
|
|
157
|
+
for (const r of rows) {
|
|
158
|
+
const a = r.x.about || {};
|
|
159
|
+
const k = a.ini ? 'w:' + a.ws + '|' + a.ini : 'w:none';
|
|
160
|
+
let s = shelves.get(k);
|
|
161
|
+
if (!s) { s = { key: k, prog: a.program || '', progTitle: a.programTitle || '', label: a.ini ? a.title || a.ini : 'Not linked to work', list: [] }; shelves.set(k, s); }
|
|
162
|
+
s.list.push(r);
|
|
163
|
+
}
|
|
164
|
+
const S = [...shelves.values()];
|
|
165
|
+
// one initiative's shelf holds one row per kind (popup round 3, point 16i): the newest stands, the rest fold under it ("2 earlier")
|
|
166
|
+
for (const s of S) if (s.key !== 'w:none') s.list = perKind(s.list);
|
|
167
|
+
for (const s of S) { s.list.sort((a, b) => workRank(a.x) - workRank(b.x) || newest(a.x, b.x)); s.at = Math.max(...s.list.map((r) => t(at(r)) || 0)); }
|
|
168
|
+
const progs = new Map();
|
|
169
|
+
for (const s of S) {
|
|
170
|
+
const pk = s.key === 'w:none' ? '~none' : s.prog ? 'g:' + s.prog : '~solo';
|
|
171
|
+
if (!progs.has(pk)) progs.set(pk, { key: pk, label: s.progTitle || (pk === '~solo' ? 'Not in a program' : ''), list: [], at: 0 });
|
|
172
|
+
const p = progs.get(pk); p.list.push(s); p.at = Math.max(p.at, s.at);
|
|
173
|
+
}
|
|
174
|
+
const P = [...progs.values()].sort((a, b) => (a.key[0] === '~') - (b.key[0] === '~') || (a.key === '~none') - (b.key === '~none') || b.at - a.at);
|
|
175
|
+
for (const p of P) {
|
|
176
|
+
p.list.sort((a, b) => b.at - a.at);
|
|
177
|
+
if (p.label) groups.push({ key: p.key, label: p.label, level: 1, n: p.list.reduce((n, s) => n + s.list.reduce((m, r) => m + 1 + r.older.length, 0), 0), folded: false, rows: [] });
|
|
178
|
+
for (const s of p.list) add(s.key, s.label, 2, s.list, true);
|
|
179
|
+
}
|
|
180
|
+
} else if (group === 'kind' || group === 'product') {
|
|
181
|
+
const by = new Map();
|
|
182
|
+
for (const r of rows) {
|
|
183
|
+
const k = group === 'kind' ? r.x.family || 'plans' : r.x.product || '';
|
|
184
|
+
if (!by.has(k)) by.set(k, []);
|
|
185
|
+
by.get(k).push(r);
|
|
186
|
+
}
|
|
187
|
+
const order = group === 'kind' ? FAMILIES.map(([k]) => k).filter((k) => by.has(k)) : [...by.keys()].sort((a, b) => (!a) - (!b) || a.localeCompare(b));
|
|
188
|
+
for (const k of order) add('k:' + k, group === 'kind' ? (FAMILIES.find(([f]) => f === k) || [k, k])[1] : k || 'No product', 1, by.get(k), false);
|
|
189
|
+
} else {
|
|
190
|
+
const by = new Map();
|
|
191
|
+
for (const r of rows) { const g = groupOf(at(r), now); if (!by.has(g)) by.set(g, []); by.get(g).push(r); }
|
|
192
|
+
for (const g of [...by.keys()].sort((a, b) => rankNew(a) - rankNew(b))) add('n:' + g, g, 1, by.get(g), false);
|
|
193
|
+
}
|
|
194
|
+
return { groups, shown: kept.length, hidden };
|
|
195
|
+
}
|
|
196
|
+
const rankNew = (g) => (g === 'This week' ? 0 : g === 'Older' ? 2 : 1);
|
|
197
|
+
export const hiddenText = (n) => (n > 0 ? n + ' hidden by the filters' : '');
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
/* pm/library-open.js — open one thing that was made, in the one popup (initiative library-place, slice 7 of the six-place navigation).
|
|
2
2
|
* The thing is on the left, in the Viewer that already draws it; the chat on the right is about it (cozy-popup.js openWork → popNext).
|
|
3
3
|
*
|
|
4
|
-
* openItem(item)
|
|
4
|
+
* openItem(item, { from }?) item = GET /api/library-items ITEM (lib/library-items.js); the Library page passes from: 'Library'
|
|
5
5
|
* doc the document as its page (premium-vw-doc.js openDocPage)
|
|
6
6
|
* meeting the meeting notes card: who was there, the summary, decisions and tasks (premium-vw-open.js openMeeting)
|
|
7
7
|
* proto the design canvas of the prototype round (cozy-lab.js openCompare, which draws cozy-proto.js)
|
|
8
8
|
* link a new browser tab; nothing opens in PMOS
|
|
9
|
-
* aboutOf(item)
|
|
9
|
+
* aboutOf(item, from) → { id, kind, title, ws, from?, kindChip } what the chat beside it is about; from ('Library') and kindChip are
|
|
10
|
+
* what the popup's header draws: ←, "Library › name" and the small kind chip (cozy-viewer.js reads them from popNext)
|
|
10
11
|
* Slice 3's Artefacts table opens its rows with the same openItem. On a phone the Viewer opens as it does today (no popup). */
|
|
11
12
|
import * as POP from './cozy-popup.js';
|
|
12
13
|
|
|
13
14
|
const KIND = { doc: 'document', link: 'link', meeting: 'meeting', proto: 'prototype' };
|
|
14
|
-
|
|
15
|
+
const CHIP = { link: 'Link', meeting: 'Meeting notes', proto: 'Prototype' };
|
|
16
|
+
export const aboutOf = (x, from) => ({ id: String(x.id || '').replace(/[^A-Za-z0-9._:-]+/g, '-').slice(0, 100), kind: KIND[x.kind] || 'document', title: x.name || '', ws: (x.about && x.about.ws) || undefined,
|
|
17
|
+
...(from ? { from } : {}), kindChip: CHIP[x.kind] || x.kindText || 'Document' });
|
|
15
18
|
|
|
16
|
-
export function openItem(x) {
|
|
19
|
+
export function openItem(x, { from } = {}) {
|
|
17
20
|
if (!x || !x.open) return false;
|
|
18
21
|
const o = x.open;
|
|
19
22
|
if (o.url) { try { window.open(o.url, '_blank', 'noopener,noreferrer'); } catch { /* a blocked window: nothing opens */ } return true; }
|
|
@@ -29,6 +32,6 @@ export function openItem(x) {
|
|
|
29
32
|
LC.openCompare({ where: { ws: o.proto.ws, board: o.proto.board || '' }, id: o.proto.id });
|
|
30
33
|
}
|
|
31
34
|
};
|
|
32
|
-
POP.openWork({ about: aboutOf(x), open: () => { go().catch((e) => console.error(e)); } });
|
|
35
|
+
POP.openWork({ about: aboutOf(x, from), open: () => { go().catch((e) => console.error(e)); } });
|
|
33
36
|
return true;
|
|
34
37
|
}
|
|
@@ -60,7 +60,11 @@ function host() {
|
|
|
60
60
|
roles: () => [], seen: () => null, markSeen: () => {}, session: () => null, queued: () => [],
|
|
61
61
|
touch: (sid) => { if (sid) pmPost('/api/session/touch', { id: sid }).then(() => document.dispatchEvent(new CustomEvent('cz:live'))).catch(() => {}); },
|
|
62
62
|
// × on the "You are on …" chip drops the page: the chat reads Everything again (C5)
|
|
63
|
-
|
|
63
|
+
// × on the popup's "About …" chip (board 23): the chat is about nothing in particular, so it is the chat over everything
|
|
64
|
+
onScope: () => {
|
|
65
|
+
const c = (Q.chat && Q.chat.current && Q.chat.current()) || Q.t;
|
|
66
|
+
if (c && ((c.cos && c.here) || c.popAbout)) { Q.t = cosTarget('', c.ws); Q.chat.open(Q.t); }
|
|
67
|
+
},
|
|
64
68
|
onTo: () => {}, onLink: () => {},
|
|
65
69
|
workItem: () => toast('Make a work-item from Home, in the initiative’s own chat.'),
|
|
66
70
|
viewerClosed: () => false, reopenViewer: () => {}, desk: () => true, head: () => '',
|
|
@@ -77,11 +81,17 @@ const shownAt = () => VW.panels.list().find((p) => p.open && p.item && p.item.id
|
|
|
77
81
|
const GLOBE = 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M3 12h18M12 3c3 3 3 15 0 18M12 3c-3 3-3 15 0 18';
|
|
78
82
|
const PIN = 'M4 5h16v14H4z';
|
|
79
83
|
/** The chief-of-staff chat's target (lib/cos-chat.js): Home's own conversation; the chip says where the PM is, and context carries it. */
|
|
84
|
+
/** The popup's chat about a thing (board 23): the chip reads "In: <thing> ×", the one form every chat uses, and the chat starts with two plain grey lines. */
|
|
85
|
+
export function popTarget(it, ws) {
|
|
86
|
+
const T = targetOf(it, ws);
|
|
87
|
+
return { ...T, popAbout: true, scope: { text: 'In: ' + T.title, icon: PIN, drop: true }, placeholder: 'Ask or tell PMOS', empty: COS_EMPTY };
|
|
88
|
+
}
|
|
89
|
+
const COS_EMPTY = 'Ask anything about your work. I read it with PMOS and say where each answer came from.';
|
|
80
90
|
export function cosTarget(here, ws) {
|
|
81
91
|
const h = String(here || '').replace(/\s+/g, ' ').trim().slice(0, 80);
|
|
82
92
|
return { key: 'chat:main', ws: ws || undefined, title: 'Ask PMOS', about: 'Ask PMOS', role: CLAUDE, rich: false, cos: true, here: h,
|
|
83
93
|
scope: h ? { text: 'You are on ' + h, icon: PIN, drop: true } : { text: 'Everything', icon: GLOBE }, context: h || undefined,
|
|
84
|
-
placeholder: 'Ask or tell PMOS', empty:
|
|
94
|
+
placeholder: 'Ask or tell PMOS', empty: COS_EMPTY };
|
|
85
95
|
}
|
|
86
96
|
/** The chief-of-staff chat over this page (the menu's chat icon). here: "Board · Atlas"; × on the chip drops it. On a desk it opens in the
|
|
87
97
|
* one popup (cozy-popup.js, slice 2 of the six-place navigation) with the list of sessions beside it; a phone keeps the chat's sheet. */
|