create-pmos 0.657.0 → 0.659.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.
@@ -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 screen 1600 px or wider a press shows the record at the right (all fields, the first lines, where it is linked from, its editions);
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 { COLUMNS, FAMILIES, GROUPS, STATES, view, counts, passes, matches, aboutText, stateText, dayText, when, noteOf, hiddenText } from './library-model.js';
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) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[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: 1600px)').matches;
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 'Every kind';
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 ? 'Any state' : S.states[0] + (S.states.length > 1 ? ` +${S.states.length - 1}` : ''));
82
+ const stateLabel = () => (!S.states.length ? 'State: all' : S.states[0] + (S.states.length > 1 ? ` +${S.states.length - 1}` : ''));
78
83
  function drawFilters() {
79
- filters.innerHTML = chip('lbKind', kindLabel(), S.kinds.length > 0)
80
- + scopeChipHtml(S.P, S.sel, { id: 'lbScope', groups: scopeGroups() })
81
- + chip('lbState', stateLabel(), S.states.length > 0);
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 table ── */
176
- const head = () => `<thead><tr><th scope="col" class="ic"><span class="vh">Kind of item</span></th>${COLUMNS.map((c) => `<th scope="col">${c}</th>`).join('')}</tr></thead>`;
177
- const SPAN = COLUMNS.length + 1;
178
- function nameCell(x, extra = '') {
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 `<td class="n lb-nm"><span class="pm-row"><input class="pm-input" id="lbNameIn" value="${esc(x.name)}" aria-label="The note's name" maxlength="120" />`
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></td>`;
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 ? `<button type="button" class="pm-btn pm-star lb-sp" data-lb-name="${esc(x.id)}" aria-label="PMOS named this note. Keep the name or rename it" title="PMOS named this note: keep or rename">${svg(SPARK)}</button>` : '';
185
- return `<td class="n"><span class="lb-nw"><button type="button" class="lb-nb" data-lb-open>${esc(x.name)}</button>${spark}${extra}</span></td>`;
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 aboutCell(x) {
188
- const a = aboutText(x);
189
- if (!a && x.kind === 'meeting' && x.suggest) {
190
- return `<td class="c"><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></td>`;
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 `<td class="c" title="${esc(a)}">${esc(a)}</td>`;
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
- return `<tr class="lb-i${sub ? ' sub' : ''}${S.pick === x.id ? ' sel' : ''}" data-lb-i="${i}" aria-label="${esc(label)}">`
201
- + `<td class="ic">${svg(ICON[x.kind] || ICON.doc)}</td>${nameCell(same ? { ...x, name: x.kindText } : x, older)}`
202
- + `<td class="c">${same ? '' : esc(x.kindText)}</td><td class="c">${esc(x.product || '')}</td>${shelf ? '<td class="c"></td>' : aboutCell(x)}`
203
- + `<td class="c">${esc(x.by || '')}</td><td class="c q">${esc(stateText(r))}</td>`
204
- + `<td class="c">${esc(dayText(when(x)))}</td></tr>`;
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
- let h = `<tr class="lb-i lb-ck"><td class="ic">${svg(ICON.checks)}</td>`
210
- + `<td class="n"><span class="lb-nw"><button type="button" class="lb-nb" data-lb-ck="${esc(r.key)}" aria-expanded="${open}">Checks · ${r.checks.length}</button></span></td>`
211
- + `<td class="c">${esc([...new Set(r.checks.map((x) => x.kindText))].join(', '))}</td><td class="c">${esc(a.product || '')}</td>`
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 tableHtml(groups) {
218
- let h = `<div class="pm-block list lb-blk"><table class="pm-table lb-t" aria-label="Library">${head()}<tbody>`;
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 += `<tr class="lb-g lb-s"><th scope="rowgroup" colspan="${SPAN}"><button type="button" class="pm-group" 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></th></tr>`;
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 += `<tr class="lb-g"><th scope="rowgroup" colspan="${SPAN}"><div class="pm-group">${esc(g.label)}${S.group === 'work' ? ` <em>${g.n}</em>` : ''}</div></th></tr>`;
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) { h += checksHtml(r); continue; }
227
- h += rowHtml(r, S.shown.length, false, shelf); S.shown.push(r.x);
228
- if (r.older.length && S.ed.has(r.x.id)) for (const o of r.older) { h += rowHtml({ x: o, older: [] }, S.shown.length, true, shelf); S.shown.push(o); }
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 + '</tbody></table></div>';
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 = `<section class="pm-block list lb-m" aria-label="${titled.length ? 'Also about this' : 'About this'}"><div class="head"><h2 class="pm-h">${titled.length ? 'Also about this' : 'About this'}</h2><span class="pm-meta">${list.length}</span></div>`
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><span class="lb-ps">${bolded(r.passage || '', r.idea, r.words)}</span></span></div>`;
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></section>';
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 record preview (≥ 1600 px) ── */
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="pm-meta lb-mi">${svg(ICON[x.kind] || ICON.doc)}</span><h2 class="pm-h">${esc(x.name)}</h2>`
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 preview" title="Close">${svg(X)}</button></div>`
294
- + `<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)}${field('State', stateText({ x, older }))}`
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-h-sm">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>' : '')
297
- + (p && p.from && p.from.length ? `<h3 class="pm-h-sm">Linked from</h3><ul>${p.from.map((f) => `<li>${esc(f.title)}</li>`).join('')}</ul>` : '')
298
- + (older.length ? `<h3 class="pm-h-sm">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>` : '');
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((w) => w && w !== 'Every kind');
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 = tableHtml(V.groups);
344
+ } else h = rowsHtml(V.groups);
323
345
  const titled = S.shown.map((x) => x.id);
324
- body.innerHTML = h + meaningHtml(titled);
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 === '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(); } }); }
384
+ else if (b.id === 'lbGroup') openMenu('lbGroup', groupMenu, groupPress, 'lb-gm');
361
385
  };
362
- $('lbTune').onclick = () => openMenu('lbTune', groupMenu, groupPress, 'lb-gm');
363
- hid.onclick = async (e) => {
364
- if (!e.target.closest('[data-lb-all]')) return;
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,9 +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 · Events</title>
8
- <!-- Events (slice 6 of the six-place navigation, initiative events-place; board 2, StEvPlan): everything with a date in one page with no views.
9
- Left: Late, Today, Coming up and the later delivery milestones as one line. Right, in one grey box: the small month and Show. It reads
10
- GET /api/events-place; the page is drawn from the PMOS design system (Komorebi: pm-ds on the page panel, brand, charts and komorebi sheets); the page code is pm/cozy-events.js and its markup pm/cozy-events-view.js. -->
8
+ <!-- Events (initiative events-place; rebuilt from the design system's blocks by events-ds-page, board EventsDS on Exploring 3): everything
9
+ with a date in one page. Main + side. The top line is the path, the product chip, then Search, + and More. Main: Late, Today (a Timeline)
10
+ and Coming up, each a block. Side: the Calendar block and Show. It reads GET /api/events-place; the page is drawn from the PMOS design
11
+ system (Komorebi: pm-ds on the page panel, brand, charts and komorebi sheets); the page code is pm/cozy-events.js and its markup
12
+ pm/cozy-events-view.js. -->
11
13
  <link rel="preload" href="/vendor/plus-jakarta-sans-var.woff2" as="font" type="font/woff2" crossorigin />
12
14
  <link rel="stylesheet" href="/pm/brand.css" />
13
15
  <link rel="stylesheet" href="/pm/charts.css" />
@@ -18,10 +20,21 @@
18
20
  <body class="cz evp-page">
19
21
  <main class="cz-panel stage evp pm-ds" id="stage">
20
22
  <div class="evp-hd">
21
- <h1 class="title">Events</h1>
23
+ <nav class="pm-path" aria-label="Path"><h1 class="evp-h1"><b>Events</b></h1></nav>
22
24
  <div class="evp-scope" id="evpScope"></div>
23
- <p class="evp-dayf pm-chip" id="evpDay" hidden>Only <b></b><button type="button" class="evp-ib pm-btn" data-evp-clear aria-label="Show every day" title="Show every day"><svg class="pm-ic" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button></p>
24
- <button type="button" class="evp-ib evp-add pm-btn primary" data-evp-add aria-label="Add your own date" title="Add your own date"><svg class="pm-ic" aria-hidden="true" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><path d="M12 5v14M5 12h14"/></svg></button>
25
+ <p class="evp-dayf pm-chip" id="evpDay" hidden>Only <b></b><button type="button" class="evp-ib pm-btn" data-evp-clear aria-label="Show every day" title="Show every day"><svg class="pm-ic" aria-hidden="true" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M6 6l12 12M18 6L6 18"/></svg></button></p>
26
+ <span class="evp-sp"></span>
27
+ <button type="button" class="evp-ib pm-btn" data-evp-search aria-label="Search" title="Search"><svg class="pm-ic" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM21 21l-5-5"/></svg></button>
28
+ <button type="button" class="evp-ib evp-add pm-btn" data-evp-add aria-label="Add your own date" title="Add your own date"><svg class="pm-ic" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M5 12h14"/></svg></button>
29
+ <span class="evp-mw">
30
+ <button type="button" class="evp-ib pm-btn" data-evp-more aria-haspopup="menu" aria-expanded="false" aria-controls="evpMenu" aria-label="More" title="More"><svg class="pm-ic" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h.01M12 12h.01M19 12h.01"/></svg></button>
31
+ <div class="evp-menu pm-menu" id="evpMenu" role="menu" aria-label="More" hidden>
32
+ <button type="button" role="menuitem" data-evp-view="month"><svg class="pm-ic" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 5.5h16v14H4zM4 10h16M8.5 3.5v4M15.5 3.5v4"/></svg>The month</button>
33
+ <button type="button" role="menuitem" data-evp-view="week"><svg class="pm-ic" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4 5.5h16v14H4zM4 10h16M10 10v9.5M14 10v9.5"/></svg>The week</button>
34
+ <button type="button" role="menuitem" data-evp-showall><svg class="pm-ic" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z"/></svg>Show every date</button>
35
+ <button type="button" role="menuitem" data-evp-connect><svg class="pm-ic" aria-hidden="true" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M9 7V3M15 7V3M6 7h12v5a6 6 0 0 1-12 0zM12 18v3"/></svg>Connectors</button>
36
+ </div>
37
+ </span>
25
38
  </div>
26
39
  <div class="evp-grid">
27
40
  <div class="evp-left">
@@ -34,10 +47,9 @@
34
47
  <div id="evpHid"></div>
35
48
  <div id="evpList" aria-live="polite"><p class="evp-quiet pm-meta" role="status">Reading the dates.</p></div>
36
49
  </div>
37
- <aside class="evp-side pm-block flat" aria-label="The month">
50
+ <aside class="evp-side" aria-label="The month">
38
51
  <div id="evpMonth"></div>
39
52
  <div id="evpShow"></div>
40
- <p class="evp-hint pm-meta">Press a type to hide it or show it. Press a day to see only that day. Press the month to open the full calendar.</p>
41
53
  </aside>
42
54
  </div>
43
55
  <div class="evp-toast pm-toast" id="toast" role="status" aria-live="polite"></div>
@@ -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, Library round 2). A catalogue of everything that was made, from
9
- every product: Name, Kind, Product, About, By, State, Updated. One filter row (Kind, product/program/project, State), the search field (a
10
- title match at once, the items about it by meaning under it), the tune button (Group by New, Work, Kind or Product) and the + (PMOS adds a
11
- file, a link or a document). A press opens the item in the one popup (pm/cozy-popup.js) with the chat about it; on a screen 1600 px or wider
12
- the first press shows the record at the right. It reads GET /api/library-items (lib/routes-library.js). -->
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, blocks List (the catalogue, as a
22
- Table block) and Detail (the record at the right). The filter chips and their menus stay the shared picker (pm/cozy-pick.css) that the
23
- product, program and project chip beside them uses. -->
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
- <span class="lb-fl" id="lbFilters" role="group" aria-label="Filters"></span>
29
- <label class="lb-find"><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M11 4.5a6.5 6.5 0 1 0 0 13a6.5 6.5 0 1 0 0-13M16 16l4 4"/></svg><span class="vh">Find in Library</span><input id="lbQ" type="search" autocomplete="off" spellcheck="false" placeholder="Find in Library" /></label>
30
- <span class="lb-cw lb-cwr"><button type="button" class="pm-btn lb-tune" id="lbTune" aria-haspopup="menu" aria-expanded="false" aria-label="Group by" title="Group by"><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 7h10M18 7h2M4 17h4M12 17h8M16 5v4M10 15v4"/></svg></button></span>
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">