create-pmos 0.658.0 → 0.660.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 +20 -14
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +19 -0
- package/workspace/guide/cli.md +7 -0
- package/workspace/guide/layout.md +4 -4
- package/workspace/lib/design-cli.js +115 -0
- package/workspace/lib/design-drift.js +406 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-library.css +48 -69
- package/workspace/public/pm/premium-library.js +95 -63
- package/workspace/public/premium-library.html +15 -11
- package/workspace/test-lists/design-drift-guard.json +5 -0
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
* (pm/scope-chip.js, the same control as on Events and Work) and the State chip, each with its counts; when a filter hides rows one grey
|
|
6
6
|
* line says how many, with Show all. The tune button groups the rows by New (default), Work (program and initiative shelves, the work in its
|
|
7
7
|
* order), Kind or Product. Editions fold under the newest; grouped by New, an initiative's gate records fold into one "Checks · N" row.
|
|
8
|
+
* Built from Komorebi blocks (library-ds-page, board LibraryDS): the top line is the Path, the product, program and project chip, + and More
|
|
9
|
+
* (Show all, Read the Library again); the search Input with its / key; the Kind, State and Group chips; one List block of ListRows (kind
|
|
10
|
+
* icon, name, a why line, the state Badge), with the part's group heads and folds. With a search the block heads "Names with …", then
|
|
11
|
+
* "Also about this" by meaning.
|
|
8
12
|
* A note with no title shows the name PMOS gave it with ✦ until the PM accepts or renames it; a note with no work offers ✦ the work it
|
|
9
13
|
* talks about. Finding is the main job: the search field always shows (/ puts the cursor in it); a title match is instant, and the items
|
|
10
14
|
* about the question by meaning arrive under it ("Also about this · 6", lib/library-find.js), each with its passage and the idea in bold.
|
|
11
|
-
* On a
|
|
15
|
+
* On a desk (1200 px or wider) a press shows the record at the right as a Detail block (all fields, the first lines, where it is linked from, its editions);
|
|
12
16
|
* a second press or Enter opens it in the one popup with the chat about it (pm/library-open.js). A link opens a new tab.
|
|
13
17
|
* Writes only what the PM accepts: a note's name (POST /api/notes/save) and a note's work (POST /api/notes/link). The group and the Kind
|
|
14
18
|
* and State filters are remembered on this device (localStorage 'pmos.lib.view'). The + asks PMOS to add a file, a link or a document. */
|
|
@@ -21,7 +25,7 @@ import './cozy-popup.js'; // the one popup: window.czOpenChat for the rail's c
|
|
|
21
25
|
import { readPick } from './cozy-pick.js';
|
|
22
26
|
import * as SC from './scope-chip.js';
|
|
23
27
|
const { scopeChipHtml, openScope, matches: scopeMatches, narrowed, scopeWords, whenNames } = SC;
|
|
24
|
-
import {
|
|
28
|
+
import { FAMILIES, GROUPS, STATES, view, counts, passes, matches, aboutText, stateText, dayText, when, noteOf, hiddenText } from './library-model.js';
|
|
25
29
|
import { openItem } from './library-open.js';
|
|
26
30
|
|
|
27
31
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
@@ -33,6 +37,7 @@ const ICON = {
|
|
|
33
37
|
proto: 'M4 5h16v12H4zM9 20h6',
|
|
34
38
|
checks: 'M4 6.5l2 2 3.5-3.5M4 13.5l2 2 3.5-3.5M13 7h7M13 14h7M13 19h7',
|
|
35
39
|
};
|
|
40
|
+
const PEN = 'M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17zM13.5 6.5l3 3', CLEAR = 'M4 6h16M7 12h10M10 18h4', RELOAD = 'M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5';
|
|
36
41
|
const CHEV_D = 'M6 9l6 6 6-6', CHEV_R = 'M9 6l6 6-6 6', TICK = 'M5 12.5l4.5 4.5L19 7.5', X = 'M6 6l12 12M18 6L6 18', PART = 'M7 12h10';
|
|
37
42
|
const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', OPEN = 'M14 4h6v6M20 4l-9 9M18 14v5H5V6h5';
|
|
38
43
|
const store = { get(k) { try { return JSON.parse(localStorage.getItem(k) || 'null'); } catch { return null; } }, set(k, v) { try { localStorage.setItem(k, JSON.stringify(v)); } catch { /* a private window */ } } };
|
|
@@ -46,13 +51,13 @@ const S = {
|
|
|
46
51
|
shown: [],
|
|
47
52
|
};
|
|
48
53
|
const remember = () => store.set('pmos.lib.view', { kinds: S.kinds, states: S.states, group: S.group });
|
|
49
|
-
const wide = () => typeof matchMedia === 'function' && matchMedia('(min-width:
|
|
54
|
+
const wide = () => typeof matchMedia === 'function' && matchMedia('(min-width: 1200px)').matches;
|
|
50
55
|
|
|
51
56
|
mountNav('library', document, { scope: () => ({ name: 'Library', hits: (q) => libHits(q) }) });
|
|
52
57
|
mountLivePill();
|
|
53
58
|
|
|
54
59
|
const $ = (id) => document.getElementById(id);
|
|
55
|
-
const filters = $('lbFilters'), body = $('lbBody'), note = $('lbNote'), qBox = $('lbQ'), hid = $('lbHid'), pv = $('lbPv');
|
|
60
|
+
const filters = $('lbFilters'), scopeW = $('lbScopeW'), body = $('lbBody'), note = $('lbNote'), qBox = $('lbQ'), hid = $('lbHid'), pv = $('lbPv');
|
|
56
61
|
|
|
57
62
|
/* ── the filters ── */
|
|
58
63
|
const F = () => ({ kinds: S.kinds, states: S.states, scope: (tokens) => scopeMatches(tokens, S.P, S.sel) });
|
|
@@ -68,17 +73,18 @@ function scopeGroups() {
|
|
|
68
73
|
projects: [...byIni.values()].sort((a, b) => a.name.localeCompare(b.name)),
|
|
69
74
|
};
|
|
70
75
|
}
|
|
71
|
-
const chip = (id, label, on, n) => `<span class="lb-cw"><button type="button" class="ppk-chip lb-chip${on ? ' on' : ''}" id="${id}" aria-haspopup="menu" aria-expanded="false"><span class="ppk-all ppk-nmc">${esc(label)}${n ? ` <em>${n}</em>` : ''}</span>${svg(CHEV_D)}</button></span>`;
|
|
72
|
-
function kindLabel() {
|
|
73
|
-
if (!S.kinds.length) return '
|
|
76
|
+
const chip = (id, label, on, n, cls = '') => `<span class="lb-cw${cls}"><button type="button" class="ppk-chip lb-chip${on ? ' on' : ''}" id="${id}" aria-haspopup="menu" aria-expanded="false"><span class="ppk-all ppk-nmc">${esc(label)}${n ? ` <em>${n}</em>` : ''}</span>${svg(CHEV_D)}</button></span>`;
|
|
77
|
+
function kindLabel(n) {
|
|
78
|
+
if (!S.kinds.length) return 'Kind: all' + (n ? ' ' + n : '');
|
|
74
79
|
const names = S.kinds.map((k) => (k.startsWith('f:') ? (FAMILIES.find(([f]) => 'f:' + f === k) || [, k.slice(2)])[1] : k.slice(2)));
|
|
75
80
|
return names[0] + (names.length > 1 ? ` +${names.length - 1}` : '');
|
|
76
81
|
}
|
|
77
|
-
const stateLabel = () => (!S.states.length ? '
|
|
82
|
+
const stateLabel = () => (!S.states.length ? 'State: all' : S.states[0] + (S.states.length > 1 ? ` +${S.states.length - 1}` : ''));
|
|
78
83
|
function drawFilters() {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
+ chip('
|
|
84
|
+
const n = (S.items || []).filter((x) => passes(x, { states: S.states, scope: F().scope })).length;
|
|
85
|
+
filters.innerHTML = chip('lbKind', kindLabel(n), S.kinds.length > 0) + chip('lbState', stateLabel(), S.states.length > 0)
|
|
86
|
+
+ '<span class="sp"></span>' + chip('lbGroup', 'Group: ' + (GROUPS.find(([k]) => k === S.group) || [, 'New'])[1], false, 0, ' lb-cwr');
|
|
87
|
+
scopeW.innerHTML = scopeChipHtml(S.P, S.sel, { id: 'lbScope', groups: scopeGroups() });
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
/* ── a menu under a chip: one at a time (the Kind, State and Group by menus; the scope chip has its own) ── */
|
|
@@ -104,7 +110,7 @@ function openMenu(id, draw, press, cls = '') {
|
|
|
104
110
|
closeMenu();
|
|
105
111
|
const c = $(id); if (!c) return;
|
|
106
112
|
const el = document.createElement('div');
|
|
107
|
-
el.className = 'ppk-menu lb-menu ' + cls; el.setAttribute('role', 'menu'); el.setAttribute('data-esc-layer', '');
|
|
113
|
+
el.className = (/\bpm-menu\b/.test(cls) ? '' : 'ppk-menu ') + 'lb-menu ' + cls; el.setAttribute('role', 'menu'); el.setAttribute('data-esc-layer', '');
|
|
108
114
|
// the menu stands under its chip inside the chip's own wrapper (CSS places it; nothing is written into a style)
|
|
109
115
|
(c.closest('.lb-cw') || document.body).append(el);
|
|
110
116
|
menu = { id, el, draw, press };
|
|
@@ -172,24 +178,33 @@ function statePress(b) {
|
|
|
172
178
|
const groupMenu = () => `<p class="scp-h" role="presentation">Group by</p><div class="pm-tabs lb-pl" role="radiogroup" aria-label="Group by">${GROUPS.map(([k, n]) => `<button type="button" role="radio" aria-checked="${k === S.group}" class="pm-tab" data-lg="${k}">${esc(n)}</button>`).join('')}</div>`;
|
|
173
179
|
function groupPress(b) { if (!b.dataset.lg) return false; S.group = b.dataset.lg; remember(); draw(); return `[data-lg="${S.group}"]`; }
|
|
174
180
|
|
|
175
|
-
/* ── the
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
181
|
+
/* ── the list: one List block of ListRows (kind icon, name, a why line, the state Badge) ── */
|
|
182
|
+
const multi = () => new Set((S.items || []).map((x) => x.product).filter(Boolean)).size > 1;
|
|
183
|
+
function badge(r) {
|
|
184
|
+
const x = r.x, t = stateText(r);
|
|
185
|
+
if (!t || (x.state === 'Final' && t === 'Final')) return ''; // Final is the usual state: zero is silence
|
|
186
|
+
return `<span class="pm-badge${x.state === 'Issued' ? ' blue' : ''}">${esc(t)}</span>`;
|
|
187
|
+
}
|
|
188
|
+
function whyOf(x, shelf) {
|
|
189
|
+
if (x.named) return `Note with no title · PMOS named it from what it says · ${dayText(when(x))}`;
|
|
190
|
+
return [x.kindText, multi() ? x.product : '', shelf ? '' : aboutText(x), x.by, dayText(when(x))].filter(Boolean).join(' · ');
|
|
191
|
+
}
|
|
192
|
+
function nameHtml(x, older) {
|
|
179
193
|
if (S.naming === x.id) {
|
|
180
|
-
return `<
|
|
194
|
+
return `<span class="pm-row lb-nm"><input class="pm-input" id="lbNameIn" value="${esc(x.name)}" aria-label="The note's name" maxlength="120" />`
|
|
181
195
|
+ `<button type="button" class="pm-btn" data-lb-name-ok aria-label="Keep this name" title="Keep this name">${svg(TICK)}</button>`
|
|
182
|
-
+ `<button type="button" class="pm-btn" data-lb-name-no aria-label="Cancel" title="Cancel">${svg(X)}</button></span
|
|
196
|
+
+ `<button type="button" class="pm-btn" data-lb-name-no aria-label="Cancel" title="Cancel">${svg(X)}</button></span>`;
|
|
183
197
|
}
|
|
184
|
-
const spark = x.named ? `<
|
|
185
|
-
return `<
|
|
198
|
+
const spark = x.named ? `<span class="pm-star lb-sp" title="PMOS named this note">${svg(SPARK)}</span>` : '';
|
|
199
|
+
return `<span class="lb-nw">${spark}<button type="button" class="t lb-nb" data-lb-open>${esc(x.name)}</button>${older}</span>`;
|
|
186
200
|
}
|
|
187
|
-
function
|
|
188
|
-
|
|
189
|
-
if (
|
|
190
|
-
return `<
|
|
201
|
+
function actsHtml(x) {
|
|
202
|
+
// a pending question stays in sight: keep or rename PMOS's name; link the work PMOS thinks a note is about
|
|
203
|
+
if (x.named && S.naming !== x.id) {
|
|
204
|
+
return `<span class="lb-acts"><button type="button" class="pm-btn" data-lb-keep="${esc(x.id)}" aria-label="Keep the name PMOS gave it" title="Keep this name">${svg(TICK)}</button>`
|
|
205
|
+
+ `<button type="button" class="pm-btn" data-lb-name="${esc(x.id)}" aria-label="Rename the note" title="Rename">${svg(PEN)}</button></span>`;
|
|
191
206
|
}
|
|
192
|
-
return
|
|
207
|
+
return '';
|
|
193
208
|
}
|
|
194
209
|
function rowHtml(r, i, sub = false, shelf = '') {
|
|
195
210
|
const x = r.x;
|
|
@@ -197,39 +212,45 @@ function rowHtml(r, i, sub = false, shelf = '') {
|
|
|
197
212
|
const same = !!shelf && (bare(x.name) === bare(shelf) || (bare(shelf).length >= 4 && bare(x.name).startsWith(bare(shelf))));
|
|
198
213
|
const older = r.older && r.older.length ? `<button type="button" class="pm-chip lb-old" data-lb-ed="${esc(x.id)}" aria-expanded="${S.ed.has(x.id)}">${r.older.length} earlier</button>` : '';
|
|
199
214
|
const label = `${x.name}${x.state ? ', ' + x.state : ''}. ${x.kindText}${aboutText(x) ? '. About ' + aboutText(x) : ''}${x.open && x.open.url ? '. Opens in a new tab' : ''}`;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
215
|
+
const shown = same ? { ...x, name: x.kindText, named: false } : x;
|
|
216
|
+
let why = esc(whyOf(shown, shelf));
|
|
217
|
+
if (!aboutText(x) && x.kind === 'meeting' && x.suggest) {
|
|
218
|
+
why += ` · <button type="button" class="lb-sg" data-lb-link="${esc(x.id)}" title="PMOS suggests: this note is about ${esc(x.suggest.title)}. Press to link it">${svg(SPARK, 'pm-star')}<span>${esc(x.suggest.title)}?</span></button>`;
|
|
219
|
+
}
|
|
220
|
+
return `<div class="pm-li lb-i${sub ? ' nest' : ''}${S.pick === x.id ? ' now' : ''}" role="listitem" data-lb-i="${i}" aria-label="${esc(label)}">`
|
|
221
|
+
+ `<span class="pm-meta lb-mi">${svg(ICON[x.kind] || ICON.doc)}</span>`
|
|
222
|
+
+ `<span class="txt">${nameHtml(shown, older)}<span class="w">${why}</span></span>${badge(r)}${actsHtml(x)}</div>`;
|
|
205
223
|
}
|
|
206
224
|
function checksHtml(r) {
|
|
207
225
|
const open = S.ck.has(r.key), a = r.about || {};
|
|
208
226
|
const newest = r.checks.reduce((m, x) => (String(when(x)) > String(when(m)) ? x : m), r.checks[0]);
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
+ `<
|
|
212
|
-
+ `<td class="c">${esc([a.programTitle, a.title].filter(Boolean).join(' › '))}</td><td class="c">PMOS</td><td class="c"></td>`
|
|
213
|
-
+ `<td class="c">${esc(dayText(when(newest)))}</td></tr>`;
|
|
227
|
+
const why = [[...new Set(r.checks.map((x) => x.kindText))].join(', '), multi() ? a.product : '', [a.programTitle, a.title].filter(Boolean).join(' › '), 'PMOS', dayText(when(newest))].filter(Boolean).join(' · ');
|
|
228
|
+
let h = `<div class="pm-li lb-i lb-ck" role="listitem"><span class="pm-meta lb-mi">${svg(ICON.checks)}</span>`
|
|
229
|
+
+ `<span class="txt"><span class="lb-nw"><button type="button" class="t lb-nb" data-lb-ck="${esc(r.key)}" aria-expanded="${open}">Checks · ${r.checks.length}</button></span><span class="w">${esc(why)}</span></span></div>`;
|
|
214
230
|
if (open) for (const x of r.checks) { h += rowHtml({ x, older: [] }, S.shown.length, true); S.shown.push(x); }
|
|
215
231
|
return h;
|
|
216
232
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
233
|
+
function rowsHtml(groups) {
|
|
234
|
+
// with a search, grouped by New, the names that match stand as one list (the head says what they match)
|
|
235
|
+
const flat = !!S.q && S.group === 'new';
|
|
236
|
+
let h = '';
|
|
219
237
|
for (const g of groups) {
|
|
220
238
|
if (g.level === 2) {
|
|
221
|
-
h += `<
|
|
239
|
+
h += `<button type="button" class="pm-group lb-s" data-lb-fold="${esc(g.key)}" aria-expanded="${!g.folded}">${svg(g.folded ? CHEV_R : CHEV_D)}<b>${esc(g.label)}</b><em>${g.n}</em></button>`;
|
|
222
240
|
if (g.folded) continue;
|
|
223
|
-
} else h += `<
|
|
241
|
+
} else if (!flat) h += `<div class="pm-group" role="presentation">${esc(g.label)}${S.group === 'work' ? ` <em>${g.n}</em>` : ''}</div>`;
|
|
224
242
|
const shelf = g.level === 2 && g.key !== 'w:none' ? g.label : '';
|
|
243
|
+
let rows = '';
|
|
225
244
|
for (const r of g.rows) {
|
|
226
|
-
if (r.checks) {
|
|
227
|
-
|
|
228
|
-
if (r.older.length && S.ed.has(r.x.id)) for (const o of r.older) {
|
|
245
|
+
if (r.checks) { rows += checksHtml(r); continue; }
|
|
246
|
+
rows += rowHtml(r, S.shown.length, false, shelf); S.shown.push(r.x);
|
|
247
|
+
if (r.older.length && S.ed.has(r.x.id)) for (const o of r.older) { rows += rowHtml({ x: o, older: [] }, S.shown.length, true, shelf); S.shown.push(o); }
|
|
229
248
|
}
|
|
249
|
+
h += `<div class="rows" role="list">${rows}</div>`;
|
|
230
250
|
}
|
|
231
|
-
return h
|
|
251
|
+
return h;
|
|
232
252
|
}
|
|
253
|
+
const headHtml = (title, meta) => `<div class="head"><h2 class="pm-h-sm">${title}</h2><span class="pm-meta">${esc(meta)}</span><span class="sp"></span></div>`;
|
|
233
254
|
|
|
234
255
|
/* ── search by meaning ── */
|
|
235
256
|
const bare = (s) => String(s || '').toLowerCase().replace(/…$/, '').replace(/[^a-z0-9]+/g, ' ').trim();
|
|
@@ -248,14 +269,14 @@ function meaningHtml(titled) {
|
|
|
248
269
|
const list = (M.results || []).map((r) => ({ ...r, x: byId.get(r.id) })).filter((r) => r.x && !seen.has(r.id) && passes(r.x, F()));
|
|
249
270
|
const line = M.busy ? 'PMOS is reading them for meaning…' : !M.ranked && M.why ? 'Ranked by shared words: ' + M.why + '.' : '';
|
|
250
271
|
if (!list.length) return M.busy && !M.results ? `<p class="pm-meta lb-mq">${esc(line || 'PMOS is reading for meaning…')}</p>` : '';
|
|
251
|
-
let h = `<
|
|
272
|
+
let h = `<div class="lb-m" role="group" aria-label="${titled.length ? 'Also about this' : 'About this'}">${headHtml(titled.length ? 'Also about this' : 'About this', 'by meaning · ' + list.length)}`
|
|
252
273
|
+ `${line ? `<p class="pm-meta lb-mq">${esc(line)}</p>` : ''}<div class="rows" role="list">`;
|
|
253
274
|
for (const r of list) {
|
|
254
275
|
const x = r.x, i = S.shown.length; S.shown.push(x);
|
|
255
|
-
h += `<div class="pm-li lb-mr" role="listitem" data-lb-i="${i}"><span class="pm-meta lb-mi">${svg(ICON[x.kind] || ICON.doc)}</span><span class="txt"><button type="button" class="t lb-nb" data-lb-open>${esc(x.name)}</button>`
|
|
256
|
-
+ `<span class="w">${esc([x.kindText, x.product, aboutText(x)].filter(Boolean).join(' · '))}</span
|
|
276
|
+
h += `<div class="pm-li lb-mr${S.pick === x.id ? ' now' : ''}" role="listitem" data-lb-i="${i}"><span class="pm-meta lb-mi">${svg(ICON[x.kind] || ICON.doc)}</span><span class="txt"><button type="button" class="t lb-nb" data-lb-open>${esc(x.name)}</button>`
|
|
277
|
+
+ `<span class="w">${esc([x.kindText, multi() ? x.product : '', aboutText(x), dayText(when(x))].filter(Boolean).join(' · '))}</span>${r.passage ? `<span class="lb-ps">“${bolded(r.passage, r.idea, r.words)}”</span>` : ''}</span></div>`;
|
|
257
278
|
}
|
|
258
|
-
return h + '</div></
|
|
279
|
+
return h + '</div></div>';
|
|
259
280
|
}
|
|
260
281
|
let findT = null, findN = 0;
|
|
261
282
|
function findByMeaning() {
|
|
@@ -279,7 +300,7 @@ function findByMeaning() {
|
|
|
279
300
|
}, 450);
|
|
280
301
|
}
|
|
281
302
|
|
|
282
|
-
/* ── the
|
|
303
|
+
/* ── the open item: a Detail block at the right (a desk, ≥ 1200 px) ── */
|
|
283
304
|
function field(k, v) { return v ? `<dt>${esc(k)}</dt><dd>${esc(v)}</dd>` : ''; }
|
|
284
305
|
async function drawPreview() {
|
|
285
306
|
const x = S.pick && (S.items || []).find((i) => i.id === S.pick);
|
|
@@ -288,14 +309,15 @@ async function drawPreview() {
|
|
|
288
309
|
const older = (S.items || []).filter((o) => o.ed && o.ed === x.ed && o.id !== x.id).sort((a, b) => (b.v || 0) - (a.v || 0) || String(when(b)).localeCompare(String(when(a))));
|
|
289
310
|
const p = x.open && x.open.doc ? S.peek.get(x.id) : null;
|
|
290
311
|
const lines = x.kind === 'meeting' ? x.gist || [] : p && p.head ? p.head : [];
|
|
291
|
-
pv.innerHTML = `<div class="head"><span class="
|
|
292
|
-
+ `<button type="button" class="pm-btn" data-lb-pv-open aria-label="Open ${esc(x.name)}" title="Open">${svg(OPEN)}</button>`
|
|
293
|
-
+ `<button type="button" class="pm-btn" data-lb-pv-close aria-label="Close the
|
|
294
|
-
+ `<
|
|
312
|
+
pv.innerHTML = `<div class="head"><span class="lb-mi">${svg(ICON[x.kind] || ICON.doc)}</span><h2 class="pm-h">${esc(x.name)}</h2>`
|
|
313
|
+
+ `<button type="button" class="pm-btn" data-lb-pv-open aria-label="Open ${esc(x.name)}, with the chat about it" title="Open, with the chat about it">${svg(OPEN)}</button>`
|
|
314
|
+
+ `<button type="button" class="pm-btn" data-lb-pv-close aria-label="Close the record" title="Close">${svg(X)}</button></div>`
|
|
315
|
+
+ `<p class="pm-meta lb-pvh">Press again or Enter to open it as the full popup</p>`
|
|
316
|
+
+ `<dl class="pm-field">${field('Kind', x.kindText)}${field('Product', x.product)}${field('About', aboutText(x) || (x.about && x.about.title))}${field('By', x.by)}${stateText({ x, older }) ? `<dt>State</dt><dd><span class="pm-badge${x.state === 'Issued' ? ' blue' : ''}">${esc(stateText({ x, older }))}</span></dd>` : ''}`
|
|
295
317
|
+ `${field(x.kind === 'meeting' ? 'Held' : 'Updated', dayText(when(x)))}${field('Came out of it', x.came)}${field('Title', x.sub)}${field('File', x.path)}</dl>`
|
|
296
|
-
+ (lines.length ? `<h3 class="pm-
|
|
297
|
-
+ (p && p.from && p.from.length ? `<h3 class="pm-
|
|
298
|
-
+ (older.length ? `<h3 class="pm-
|
|
318
|
+
+ (lines.length ? `<h3 class="pm-meta lb-pvk">First lines</h3><div class="lb-pvl">${lines.map((l) => `<p>${esc(l)}</p>`).join('')}</div>` : x.open && x.open.doc && !p ? '<p class="pm-meta">Reading the first lines…</p>' : '')
|
|
319
|
+
+ (p && p.from && p.from.length ? `<h3 class="pm-meta lb-pvk">Linked from</h3><ul>${p.from.map((f) => `<li>${esc(f.title)}</li>`).join('')}</ul>` : '')
|
|
320
|
+
+ (older.length ? `<h3 class="pm-meta lb-pvk">Editions</h3><ul>${older.map((o) => `<li><button type="button" class="lb-nb" data-lb-pv-ed="${esc(o.id)}">${esc(o.name)}${o.v ? ' · v' + o.v : ''}</button> <span class="pm-meta">${esc(dayText(when(o)))}</span></li>`).join('')}</ul>` : '');
|
|
299
321
|
if (x.open && x.open.doc && !p) {
|
|
300
322
|
const r = await pmGet('/api/library-items/peek?ws=' + encodeURIComponent(x.open.doc.ws) + '&path=' + encodeURIComponent(x.open.doc.path)).catch(() => null);
|
|
301
323
|
S.peek.set(x.id, r && r.ok ? r : { head: [], from: [] });
|
|
@@ -312,16 +334,18 @@ function draw() {
|
|
|
312
334
|
S.shown = [];
|
|
313
335
|
const filtered = S.kinds.length || S.states.length || narrowed(S.P, S.sel);
|
|
314
336
|
if (filtered && V.hidden) {
|
|
315
|
-
const words = [kindLabel(), S.states.join(', '), narrowed(S.P, S.sel) ? scopeWords(S.P, S.sel, scopeGroups()) : ''].filter(
|
|
337
|
+
const words = [S.kinds.length ? kindLabel() : '', S.states.join(', '), narrowed(S.P, S.sel) ? scopeWords(S.P, S.sel, scopeGroups()) : ''].filter(Boolean);
|
|
316
338
|
hid.innerHTML = `${esc(words.length ? 'Showing ' + words.join(' · ') + ' only. ' : '')}${esc(hiddenText(V.hidden))} <button type="button" data-lb-all>Show all</button>`;
|
|
317
339
|
} else hid.innerHTML = '';
|
|
318
340
|
let h = '';
|
|
319
341
|
if (!V.groups.length) {
|
|
320
342
|
// zero is silence: one quiet line, no empty table
|
|
321
343
|
h = S.q && S.meaning && S.meaning.q === S.q && (S.meaning.busy || (S.meaning.results || []).length) ? '' : `<p class="pm-meta lb-none">${esc(S.q ? 'No title in the Library matches "' + S.q + '".' : filtered ? 'Nothing here fits the filters.' : 'Nothing was made yet. Documents, meeting notes and prototypes show here as they are made.')}</p>`;
|
|
322
|
-
} else h =
|
|
344
|
+
} else h = rowsHtml(V.groups);
|
|
323
345
|
const titled = S.shown.map((x) => x.id);
|
|
324
|
-
|
|
346
|
+
const m = meaningHtml(titled);
|
|
347
|
+
const head = S.q && V.groups.length ? headHtml(`Names with “${esc(S.q)}”`, String(titled.length)) : '';
|
|
348
|
+
body.innerHTML = V.groups.length || /lb-m"/.test(m) ? `<section class="pm-block list lb-blk" aria-label="Library">${head}${h}${m}</section>` : h + m;
|
|
325
349
|
note.textContent = noteOf(S.q, S.group);
|
|
326
350
|
if (S.naming) { const i = $('lbNameIn'); if (i) { i.focus(); i.select(); } }
|
|
327
351
|
if (S.pick) drawPreview();
|
|
@@ -357,15 +381,22 @@ filters.onclick = (e) => {
|
|
|
357
381
|
const b = e.target.closest('button'); if (!b) return;
|
|
358
382
|
if (b.id === 'lbKind') openMenu('lbKind', kindMenu, kindPress);
|
|
359
383
|
else if (b.id === 'lbState') openMenu('lbState', stateMenu, statePress);
|
|
360
|
-
else if (b.id === '
|
|
384
|
+
else if (b.id === 'lbGroup') openMenu('lbGroup', groupMenu, groupPress, 'lb-gm');
|
|
361
385
|
};
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (
|
|
386
|
+
scopeW.onclick = (e) => {
|
|
387
|
+
const b = e.target.closest('button'); if (!b) return;
|
|
388
|
+
if (b.id === 'lbScope') { closeMenu(); openScope(b, { P: S.P, groups: scopeGroups(), sel: S.sel, unit: 'items', onApply: async (next) => { S.sel = { programs: next.programs, projects: next.projects }; S.P = (await readPick().catch(() => null)) || S.P; draw(); } }); }
|
|
389
|
+
};
|
|
390
|
+
async function showAll() {
|
|
365
391
|
S.kinds = []; S.states = []; S.sel = { programs: [], projects: [] }; remember();
|
|
366
392
|
if (S.P && S.P.products && S.P.products.some((p) => !p.on)) { const { savePick } = await import('./cozy-pick.js'); await savePick(S.P.products.map((p) => p.ws)); }
|
|
367
393
|
draw();
|
|
368
|
-
}
|
|
394
|
+
}
|
|
395
|
+
hid.onclick = (e) => { if (e.target.closest('[data-lb-all]')) showAll(); };
|
|
396
|
+
// More: what the top line does not show (Show all clears every filter; Read again fetches the Library now)
|
|
397
|
+
const moreMenu = () => `<button type="button" role="menuitem" data-lm="all">${svg(CLEAR)}Show all</button><button type="button" role="menuitem" data-lm="load">${svg(RELOAD)}Read the Library again</button>`;
|
|
398
|
+
function morePress(b) { if (!b.dataset.lm) return false; closeMenu(); if (b.dataset.lm === 'all') showAll(); else load(); return false; }
|
|
399
|
+
$('lbMore').onclick = () => openMenu('lbMore', moreMenu, morePress, 'pm-menu lb-mm');
|
|
369
400
|
addEventListener('pp:changed', (e) => { if (e.detail && e.detail.products) { S.P = e.detail; draw(); } });
|
|
370
401
|
function press(x) {
|
|
371
402
|
if (!x) return;
|
|
@@ -391,6 +422,7 @@ body.onclick = async (e) => {
|
|
|
391
422
|
if ((b = t.closest('[data-lb-ed]'))) { const k = b.dataset.lbEd; if (S.ed.has(k)) S.ed.delete(k); else S.ed.add(k); draw(); return; }
|
|
392
423
|
if ((b = t.closest('[data-lb-ck]'))) { const k = b.dataset.lbCk; if (S.ck.has(k)) S.ck.delete(k); else S.ck.add(k); draw(); return; }
|
|
393
424
|
if ((b = t.closest('[data-lb-name]'))) { S.naming = b.dataset.lbName; draw(); return; }
|
|
425
|
+
if ((b = t.closest('[data-lb-keep]'))) { const x = (S.items || []).find((i) => i.id === b.dataset.lbKeep); if (x) saveName(x.id, x.name); return; }
|
|
394
426
|
if (t.closest('[data-lb-name-ok]')) { const i = $('lbNameIn'); saveName(S.naming, i ? i.value : ''); return; }
|
|
395
427
|
if (t.closest('[data-lb-name-no]')) { S.naming = null; draw(); return; }
|
|
396
428
|
if (t.closest('#lbNameIn')) return;
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
<meta name="pmos-nonce" content="" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
7
7
|
<title>PMOS · Library</title>
|
|
8
|
-
<!-- Library (initiative library-place; slice 7 of the six-place navigation
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
the
|
|
8
|
+
<!-- Library (initiative library-place; slice 7 of the six-place navigation; rebuilt from Komorebi blocks in library-ds-page). Everything
|
|
9
|
+
that was made, from every product. The top line: the path, the product, program and project chip, + (PMOS adds a file, a link or a
|
|
10
|
+
document) and More. The search Input is always shown (/ focuses it): names that match first, then "Also about this" by meaning. The Kind
|
|
11
|
+
and State chips (with counts) and Group (New, Work, Kind or Product). A press shows the Detail at the right; a second press or Enter opens
|
|
12
|
+
the item in the one popup (pm/cozy-popup.js) with the chat about it. It reads GET /api/library-items (lib/routes-library.js). -->
|
|
13
13
|
<link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
|
|
14
14
|
<link rel="stylesheet" href="/pm/cozy.css" />
|
|
15
15
|
<link rel="stylesheet" href="/pm/cozy-pick.css" />
|
|
@@ -18,18 +18,22 @@
|
|
|
18
18
|
<link rel="stylesheet" href="/pm/komorebi.css" />
|
|
19
19
|
<link rel="stylesheet" href="/pm/cozy-library.css" />
|
|
20
20
|
</head>
|
|
21
|
-
<!-- Drawn with the PMOS design system (Komorebi, workspace/design-system/ui/): layout Main + open item
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
<!-- Drawn with the PMOS design system (Komorebi, workspace/design-system/ui/), board LibraryDS on Exploring 3: layout Main + open item.
|
|
22
|
+
Main: the top line (Path, the scope chip, icon buttons), the search Input with its key, the filter chips, and one List block of ListRows
|
|
23
|
+
(group heads, folds, the meaning passages). The open item: a Detail block (pm-field). The chips and their menus are the shared picker
|
|
24
|
+
(pm/cozy-pick.css), the same as the product, program and project chip. -->
|
|
24
25
|
<body class="cz pm-ds lb-page">
|
|
25
26
|
<main class="stage cz-panel lb" id="stage">
|
|
26
27
|
<h1 class="vh">Library</h1>
|
|
27
28
|
<div class="lb-bar">
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
<span class="
|
|
29
|
+
<nav class="pm-path" aria-label="Path"><b>Library</b></nav>
|
|
30
|
+
<span class="lb-sc" id="lbScopeW"></span>
|
|
31
|
+
<span class="sp"></span>
|
|
31
32
|
<button type="button" class="pm-btn lb-add" id="lbAdd" aria-label="Add a file, a link or a new document" title="Add a file, a link or a new document"><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button>
|
|
33
|
+
<span class="lb-cw lb-cwr"><button type="button" class="pm-btn" id="lbMore" aria-haspopup="menu" aria-expanded="false" aria-label="More" title="More"><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12h.01M12 12h.01M19 12h.01"/></svg></button></span>
|
|
32
34
|
</div>
|
|
35
|
+
<div class="pm-row lb-find"><input class="pm-input" id="lbQ" type="search" autocomplete="off" spellcheck="false" placeholder="Find in Library" aria-label="Find in Library" /><span class="pm-kbd" aria-hidden="true">/</span></div>
|
|
36
|
+
<div class="pm-row lb-fl" id="lbFilters" role="group" aria-label="Filters"></div>
|
|
33
37
|
<p class="pm-meta lb-hid" id="lbHid" aria-live="polite"></p>
|
|
34
38
|
<div class="lb-wrap">
|
|
35
39
|
<div class="lb-main">
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "design-drift-guard: the design drift guard. Which pages are built from the product's design system and which drift from it, read from git only: the measure and compare (lib/design-drift.js), pmos design drift (lib/design-cli.js), on a scratch git repository. No server, no network, no model.",
|
|
3
|
+
"modules": ["design-drift.test.js"],
|
|
4
|
+
"seconds": { "design-drift.test.js": 3 }
|
|
5
|
+
}
|