clavarium 0.2.24-next.4 → 0.2.24-next.6

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.
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.24-next.4",
3
+ "version": "0.2.24-next.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.24-next.4",
9
+ "version": "0.2.24-next.6",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
13
13
  "@xterm/xterm": "^6.0.0",
14
- "clavarium-binder": "0.1.0-next.1",
15
- "clavarium-docket": "0.1.0",
16
- "clavarium-parley": "0.15.0-next.3",
14
+ "clavarium-binder": "0.1.1-next.3",
15
+ "clavarium-docket": "0.1.1",
16
+ "clavarium-parley": "0.15.0",
17
17
  "mermaid": "11.17.2",
18
18
  "node-pty": "^1.1.0",
19
19
  "pdfjs-dist": "6.4.299",
@@ -688,9 +688,9 @@
688
688
  }
689
689
  },
690
690
  "node_modules/clavarium-binder": {
691
- "version": "0.1.0-next.1",
692
- "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.0-next.1.tgz",
693
- "integrity": "sha512-bwqNIICb23royK8h+qI8NuOmMaZVop3lTSAfOC9cCxY0PmHLLfIMhsFqteL65miL64eTtJdTFJo2yYIZJWQTZQ==",
691
+ "version": "0.1.1-next.3",
692
+ "resolved": "https://registry.npmjs.org/clavarium-binder/-/clavarium-binder-0.1.1-next.3.tgz",
693
+ "integrity": "sha512-g7CUt18JMf+NPusP9NngVh9Q3cCtP3rtWUgVko6V2BZJREbAORfVOBdVb20kZhFhaTkXeHRcRKlKFU300wWHzw==",
694
694
  "license": "MIT",
695
695
  "bin": {
696
696
  "binder": "bin/binder.mjs",
@@ -701,9 +701,9 @@
701
701
  }
702
702
  },
703
703
  "node_modules/clavarium-docket": {
704
- "version": "0.1.0",
705
- "resolved": "https://registry.npmjs.org/clavarium-docket/-/clavarium-docket-0.1.0.tgz",
706
- "integrity": "sha512-lGZR16J8/fLxfGXVPhB2JFXCwHTZJsol4eLXXbBY8PFZz+T0/hzObPuFiK+dIrNnvLfuXTPyGFeIwI9/vyXa4Q==",
704
+ "version": "0.1.1",
705
+ "resolved": "https://registry.npmjs.org/clavarium-docket/-/clavarium-docket-0.1.1.tgz",
706
+ "integrity": "sha512-ssmnIfkBmOeKaHXBrL97qsaBp6Tc6OwX08WksQjpBGZx/QklwRvZqXgOYZ/Nk7Hk3HO0xXrJy5EyHbFcLVXfiA==",
707
707
  "license": "MIT",
708
708
  "bin": {
709
709
  "docket": "bin/docket.mjs",
@@ -714,9 +714,9 @@
714
714
  }
715
715
  },
716
716
  "node_modules/clavarium-parley": {
717
- "version": "0.15.0-next.3",
718
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.15.0-next.3.tgz",
719
- "integrity": "sha512-OxTa1hJlMRLKc/1UIVYvFCRAFcbPIsjD20MTCkStupdn8BzvAx6FfB7nV6lTvXEvVjIStqOBVfhctr8MS4aQ0g==",
717
+ "version": "0.15.0",
718
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.15.0.tgz",
719
+ "integrity": "sha512-PPU5EI+A28w1jq1hlm1SfYWa2v4flfINsfUmQvyzC2zg9L9jf9kkrr/3WhCJYrpg97kIZcp8fPz/DZdxPkUx1g==",
720
720
  "license": "MIT",
721
721
  "bin": {
722
722
  "parley": "bin/parley.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.24-next.4",
3
+ "version": "0.2.24-next.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
@@ -44,9 +44,9 @@
44
44
  "dependencies": {
45
45
  "@xterm/addon-fit": "^0.11.0",
46
46
  "@xterm/xterm": "^6.0.0",
47
- "clavarium-binder": "0.1.0-next.1",
48
- "clavarium-docket": "0.1.0",
49
- "clavarium-parley": "0.15.0-next.3",
47
+ "clavarium-binder": "0.1.1-next.3",
48
+ "clavarium-docket": "0.1.1",
49
+ "clavarium-parley": "0.15.0",
50
50
  "mermaid": "11.17.2",
51
51
  "node-pty": "^1.1.0",
52
52
  "pdfjs-dist": "6.4.299",
package/server/api.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
  *
3
3
  * GET /api/tools
4
4
  * GET /api/conversations
5
+ * each with lists: {lists, waiting} (binders.mjs given) or null
5
6
  * POST /api/conversations {name, tool, memoryMb?}
6
7
  * POST /api/conversations/<name>/sleep
7
8
  * POST /api/conversations/<name>/restart a clean stop (by force if it hangs), then a start
@@ -231,7 +232,8 @@ export async function handleApi(request, response, conversations, headers, resou
231
232
  if (request.method === 'GET') {
232
233
  if (pathname === '/api/tools') return send(200, conversations.tools()), true;
233
234
  if (pathname === '/api/conversations') {
234
- return send(200, conversations.list().map((c) => ({ ...c, resources: resources?.of(c.name) ?? [], secrets: secrets?.of(c.name) ?? [], answerer: answerer?.of(c.name) ?? null, wakeups: wakeups?.of(c.name) ?? null, health: health?.of(c.name) ?? null, talk: talk?.brief(c.name) ?? null }))), true;
235
+ const lists = binders?.given() ?? {};
236
+ return send(200, conversations.list().map((c) => ({ ...c, lists: lists[c.name] ?? null, resources: resources?.of(c.name) ?? [], secrets: secrets?.of(c.name) ?? [], answerer: answerer?.of(c.name) ?? null, wakeups: wakeups?.of(c.name) ?? null, health: health?.of(c.name) ?? null, talk: talk?.brief(c.name) ?? null }))), true;
235
237
  }
236
238
  if (pathname === '/api/resources' && resources) return send(200, resources.list()), true;
237
239
  if (pathname === '/api/shortcuts' && shortcuts) return send(200, shortcuts.list()), true;
@@ -7,7 +7,8 @@
7
7
  * machine: what a tool could write, it could rewrite. A tool asks through
8
8
  * its work folder's .binder (beside .parley and .docket), and is answered
9
9
  * there; who asks is said by the folder -- conversation:<name> -- never by
10
- * the ask. The owner changes it from the page (Lists).
10
+ * the ask. The owner changes it from the page: Assets > Lists, and a
11
+ * conversation's Lists tab (only the lists it was given).
11
12
  *
12
13
  * A TOOL SEES ONLY THE LISTS IT WAS GIVEN (read, or change), and never
13
14
  * approves: a gate (Batches: "Approved") is the owner's tick.
@@ -85,6 +86,19 @@ export class Binders {
85
86
  if (!persons.length) persons.push({ id: `person:${identity || 'owner'}`, kind: 'person', name: identity || 'Owner' });
86
87
  return [...persons, ...this.#conversations().map((name) => ({ id: `${AGENT}${name}`, kind: 'agent', name }))];
87
88
  }
89
+ /* What each conversation was given: { name: { lists, waiting } }, waiting being the
90
+ records of those lists that wait for a person's tick (a list with a gate, not approved). */
91
+ given() {
92
+ const keeper = { id: 'person:keeper', kind: 'person', name: 'keeper' };
93
+ const out = {};
94
+ for (const l of this.#keeper.store.lists(keeper)) {
95
+ const to = Object.keys(l.grants ?? {}).filter((id) => id.startsWith(AGENT));
96
+ if (l.archived || !to.length) continue;
97
+ const waiting = l.states.some((s) => s.gate) ? this.#keeper.store.list(l.id, keeper).records.filter((r) => !r.approved).length : 0;
98
+ for (const id of to) { const one = (out[id.slice(AGENT.length)] ??= { lists: 0, waiting: 0 }); one.lists++; one.waiting += waiting; }
99
+ }
100
+ return out;
101
+ }
88
102
  /* A number that moves with every change: the page reads again when it moved. */
89
103
  changes() { return this.#changes; }
90
104
  }
@@ -32,6 +32,9 @@ export const AGAIN_MS = 30 * 60_000;
32
32
  /* ...this many times at most (the first included); then its chat says so. */
33
33
  export const TOLD_MAX = 3;
34
34
 
35
+ /* One line in the chat: what was handled, cut short; the docket keeps it whole. */
36
+ const cut = (text, max) => { const s = String(text ?? '').replace(/\s+/g, ' ').trim(); return s.length > max ? `${s.slice(0, max - 1)}…` : s; };
37
+
35
38
  export class Dockets {
36
39
  #resources; #store; #say; #event; #alert; #idle; #awake; #chatOn; #now; #every; #zone;
37
40
  #listening = new Map(); #zoned = new Set(); #busy = false;
@@ -97,7 +100,7 @@ export class Dockets {
97
100
 
98
101
  /* What the tool did: said in its chat; a failure alerts its owner. */
99
102
  #heard(name, e) {
100
- if (e.type === 'acked' && e.ack.kind === 'done') this.#line(name, { kind: 'docket-done', text: `Handled: ${e.event.text}${e.ack.note ? ` -- ${e.ack.note}` : ''}`, topic: 'Handled', brief: e.event.text.slice(0, 60) });
103
+ if (e.type === 'acked' && e.ack.kind === 'done') this.#line(name, { kind: 'docket-done', text: `Handled: ${cut(e.event.text, 80)}${e.ack.note ? ` -- ${cut(e.ack.note, 120)}` : ''}`, topic: 'Handled', brief: e.event.text.slice(0, 60) });
101
104
  if (e.type === 'acked' && e.ack.kind === 'failed') {
102
105
  this.#line(name, { kind: 'docket-failed', text: `Could not be handled: ${e.event.text} -- ${e.ack.note}`, tone: 'warn', topic: 'Not handled' });
103
106
  try { this.#alert({ title: `${name}: could not be handled`, body: `${e.event.text}: ${e.ack.note}`, url: `/?c=${name}` }); } catch { /* as said */ }
@@ -568,7 +568,7 @@ export class GitKeeper {
568
568
  }
569
569
  try {
570
570
  const sent = await this.#review.push(r.name, body);
571
- if (!sent.already) this.#say(r.name, this.#attached(r.name), { kind: 'sent-by-hand', text: `Sent by hand to ${sent.branch} of ${r.name}: ${commitsOf(sent.commits)}${upTo(sent.head)}${sent.made ? ' (a new branch)' : ''}.`, topic: 'Sent', brief: sent.branch, actions: seeCommits(r.name, sent.head, sent.base, sent.commits) });
571
+ if (!sent.already) this.#say(r.name, this.#attached(r.name), { kind: 'sent-by-hand', text: `Sent by hand: ${r.name} → ${sent.branch}, ${commitsOf(sent.commits)}${sent.made ? ', a new branch' : ''}.`, topic: 'Sent', brief: sent.branch, actions: seeCommits(r.name, sent.head, sent.base, sent.commits) });
572
572
  return sent;
573
573
  } catch (error) {
574
574
  if (error instanceof GitFailure) this.#sendFailed(r.name, error, { branch: body?.target, head: body?.head });
@@ -682,7 +682,7 @@ export class GitKeeper {
682
682
  if (sent.already) { this.#log(name, { branch: b, head: tip.id, conversation, ok: true, what: `Already on the remote: ${b}.` }, { sent: true, by: conversation }); return true; }
683
683
  this.#log(name, { branch: b, head: tip.id, conversation, ok: true, what: `Sent automatically for ${conversation}: ${sent.commits} commit(s) to ${sent.branch}${sent.made ? ' (a new branch)' : ''}, ${checked}.${sent.note ? ` ${sent.note}` : ''}` }, { sent: true, by: conversation });
684
684
  if (alert) this.#tell(`${name}: sent to ${sent.branch}`, `${sent.commits} commit(s), automatically for ${conversation}, ${checked}.`);
685
- this.#say(name, [conversation], { kind: 'sent', text: `Sent to ${sent.branch} of ${name}: ${commitsOf(sent.commits)}${upTo(sent.head)}${sent.made ? ' (a new branch)' : ''}, ${checked}.`, topic: 'Sent', brief: sent.branch, actions: seeCommits(name, sent.head, sent.base, sent.commits) });
685
+ this.#say(name, [conversation], { kind: 'sent', text: `Sent: ${name} → ${sent.branch}, ${commitsOf(sent.commits)}${sent.made ? ', a new branch' : ''}${s.checks ? '' : ', no checks'}.`, topic: 'Sent', brief: sent.branch, actions: seeCommits(name, sent.head, sent.base, sent.commits) });
686
686
  return true;
687
687
  } catch (error) {
688
688
  const kind = error instanceof GitFailure ? error.kind : 'error';
package/server/talk.mjs CHANGED
@@ -148,7 +148,8 @@ export const EVENT_LEVELS = Object.freeze({
148
148
  /* New tools in its machine that its tool reads only when it starts: a restart recommended (main.mjs). */
149
149
  'tools-updated': 'news',
150
150
  /* Its docket (dockets.mjs): what it handled, what it could not, what it never did; a reminder it set itself. */
151
- 'docket-done': 'news',
151
+ /* What it handled is a trace by default: one line, in the detailed view; what failed or was never handled calls. */
152
+ 'docket-done': 'trace',
152
153
  'docket-failed': 'needs-you',
153
154
  'docket-unhandled': 'needs-you',
154
155
  'docket-reminder': 'trace',
package/web/app.js CHANGED
@@ -1613,6 +1613,7 @@
1613
1613
  /* THE BAR (G): Chat | Terminal | Assets N, then its settings. What was
1614
1614
  given to it is counted on "Assets", and shown there. */
1615
1615
  let assetsShown = false; let roomPick = '';
1616
+ let listsShown = false; let listsOf = ''; let listsView = null; /* its Lists tab: below */
1616
1617
  /* A secret near or past its expiry (secrets.mjs, WARN_DAYS): a dot on Assets, and on the
1617
1618
  Assets of a conversation that has it. Read with the list, at most once a minute. */
1618
1619
  let secretsKnown = []; let secretsReadAt = 0;
@@ -1633,6 +1634,12 @@
1633
1634
  if (Date.now() - secretsReadAt > 60_000) { secretsReadAt = Date.now(); void readSecretsNow().catch(() => {}); }
1634
1635
  /* Its title names each of them, with what it may do. */
1635
1636
  $('view-assets').title = c ? [...(c.offline === true ? ['offline'] : []), ...(c.resources ?? []).map((r) => `${r.name} - ${r.access}`), ...(c.secrets ?? [])].join(', ') || 'Nothing given yet' : '';
1637
+ /* Lists: a tab once it was given one; counted, what waits for the owner's tick. */
1638
+ const given = c?.lists ?? null;
1639
+ $('view-lists').hidden = !given?.lists;
1640
+ $('lists-count').textContent = given?.waiting ? String(given.waiting) : '';
1641
+ $('view-lists').title = given?.waiting ? `${given.waiting} to approve` : LISTS_WORD.its;
1642
+ if (listsShown && !given?.lists) leaveLists();
1636
1643
  paintViews();
1637
1644
  /* Drawn again only when what it was given changed (not at each look at the list). */
1638
1645
  const sig = JSON.stringify([current, c?.resources, c?.secrets, c?.work]);
@@ -1642,21 +1649,22 @@
1642
1649
  function paintViews() {
1643
1650
  if (DEVICE) return;
1644
1651
  const now = tabNow();
1645
- for (const [id, tab] of [['view-chat', 'chat'], ['view-terminal', 'terminal'], ['view-assets', 'assets'], ['folders', 'settings']]) $(id).setAttribute('aria-pressed', String(now === tab));
1652
+ for (const [id, tab] of [['view-chat', 'chat'], ['view-terminal', 'terminal'], ['view-assets', 'assets'], ['view-lists', 'lists'], ['folders', 'settings']]) $(id).setAttribute('aria-pressed', String(now === tab));
1646
1653
  }
1647
1654
  /* THE FOUR TABS: Chat, Terminal, Assets, Settings. The one it opened on
1648
1655
  takes no step; any other is one step (one only, whichever other tab is
1649
1656
  shown), and Back comes back to the first. Changing tab closes what was
1650
1657
  open in the one before, and anything over the screen. */
1651
1658
  let panelShown = false;
1652
- const tabNow = () => (assetsShown ? 'assets' : panelShown ? 'settings' : simple ? 'chat' : 'terminal');
1653
- const TAB_WORD = { chat: 'Chat', terminal: 'Terminal', assets: 'Assets', settings: 'Settings' };
1654
- function openPanelZone() { if (panelShown) return; panelShown = true; $('panel').hidden = false; paintViews(); }
1659
+ const tabNow = () => (assetsShown ? 'assets' : listsShown ? 'lists' : panelShown ? 'settings' : simple ? 'chat' : 'terminal');
1660
+ const TAB_WORD = { chat: 'Chat', terminal: 'Terminal', assets: 'Assets', get lists() { return LISTS_WORD.many; }, settings: 'Settings' };
1661
+ function openPanelZone() { closeRoomLists(); if (panelShown) return; panelShown = true; $('panel').hidden = false; paintViews(); }
1655
1662
  function closePanelZone() { if (!panelShown) return; panelShown = false; $('panel').hidden = true; $('attach-picker').hidden = true; paintViews(); }
1656
1663
  function showTab(which, pick) {
1657
1664
  if (which === 'assets') { closePanelZone(); void openRoomAssets(pick); return; }
1658
1665
  if (which === 'settings') { closeRoomAssets(); openPanelZone(); return; }
1659
- closeRoomAssets(); closePanelZone();
1666
+ if (which === 'lists') { closeRoomAssets(); closePanelZone(); void openRoomLists(); return; }
1667
+ closeRoomAssets(); closePanelZone(); closeRoomLists();
1660
1668
  if ((which === 'chat') !== simple) toggleSimple(); else { paintViews(); if (!simple) focusTerminal(); }
1661
1669
  }
1662
1670
  /* The tab it opened on: the one shown before any step of a tab, or the one a review came from. */
@@ -1683,7 +1691,7 @@
1683
1691
  function resetTabs() {
1684
1692
  if (!DEVICE) nav.cut(nav.first(['tab', 'asset', 'review', 'over']));
1685
1693
  else nav.cut(nav.first(['over']));
1686
- closeRoomAssets(); closePanelZone();
1694
+ closeRoomAssets(); closePanelZone(); closeRoomLists();
1687
1695
  $('files').hidden = $('copy').hidden = true;
1688
1696
  }
1689
1697
  /* Its settings closed for a question asked over its screen (a restart, a move). */
@@ -1691,6 +1699,23 @@
1691
1699
  $('view-chat').addEventListener('click', () => goTab('chat'));
1692
1700
  $('view-terminal').addEventListener('click', () => goTab('terminal'));
1693
1701
  $('view-assets').addEventListener('click', () => goTab('assets'));
1702
+ $('view-lists').addEventListener('click', () => goTab('lists'));
1703
+ /* ITS LISTS: Binder's screen, cut to the lists given to it (read or write). */
1704
+ async function openRoomLists() {
1705
+ if (DEVICE || !current) return;
1706
+ listsShown = true; $('clists').hidden = false; paintViews();
1707
+ if (listsView && listsOf === current) { void listsView.refresh(); return; }
1708
+ const name = current; listsOf = name;
1709
+ listsView = null;
1710
+ const view = await mountBinder($('clists-binder'), (l) => Boolean(l.grants?.[`conversation:${name}`]));
1711
+ if (listsOf === name) listsView = view;
1712
+ }
1713
+ function closeRoomLists() { if (!listsShown) return; listsShown = false; $('clists').hidden = true; paintViews(); }
1714
+ /* Its last list taken back: its first tab again. */
1715
+ function leaveLists() {
1716
+ /* Under a place (Assets, where it was taken back): changed in place, the place left open. */
1717
+ if (place !== 'conversations' || !nav.close('tab')) showTab(simple ? 'chat' : 'terminal');
1718
+ }
1694
1719
  /* ONE RULE: the left column is the platform, the bar is this conversation.
1695
1720
  Its Access chapter what THIS conversation has: attached folders,
1696
1721
  repositories and mailboxes, secrets handed to its tool,
@@ -3003,10 +3028,20 @@
3003
3028
  own (the bar's "Assets N"): what it was given, the same rows; a folder
3004
3029
  opened shows its files (the Files sheet, moved in), a repository its
3005
3030
  branches. On a phone, the list, then one asset with "All assets". */
3006
- const ASSET_KINDS = [['git', 'Git repositories', 'git-branch'], ['folder', 'Folders', 'folder'], ['mailbox', 'Mailboxes', 'mail'], ['secret', 'Secrets', 'key-round']];
3031
+ /* BINDER'S LISTS, AS THIS PAGE NAMES THEM: the one place for the word (Assets, a conversation's tab). */
3032
+ const LISTS_WORD = { many: 'Binders', one: 'Binder', a: 'a binder', its: 'Its binders' };
3033
+ $('view-lists-word').textContent = LISTS_WORD.many; $('listnew-head').textContent = `New ${LISTS_WORD.one.toLowerCase()}`;
3034
+ const ASSET_KINDS = [['git', 'Git repositories', 'git-branch'], ['folder', 'Folders', 'folder'], ['mailbox', 'Mailboxes', 'mail'], ['secret', 'Secrets', 'key-round'], ['list', LISTS_WORD.many, '']];
3007
3035
  const getJson = (path, fallback) => fetch(`${API}${path}`).then((r) => (r.ok ? r.json() : fallback)).catch(() => fallback);
3008
3036
  const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text !== undefined) e.textContent = text; return e; };
3009
- const kindIcon = (kind) => { const name = kind === 'send' ? 'arrow-up' : ASSET_KINDS.find((k) => k[0] === kind)?.[2]; const holder = el('span', 'as-ic'); holder.dataset.kind = kind; const svg = name ? window.clavariumIcons?.icon(name) : null; if (svg) holder.append(svg); return holder; };
3037
+ const kindIcon = (kind) => { const name = kind === 'send' ? 'arrow-up' : ASSET_KINDS.find((k) => k[0] === kind)?.[2]; const holder = el('span', 'as-ic'); holder.dataset.kind = kind; const svg = kind === 'list' ? listIcon() : name ? window.clavariumIcons?.icon(name) : null; if (svg) holder.append(svg); return holder; };
3038
+ /* A list (Binder's): the set has no such sign, so it is drawn here, in its style. */
3039
+ function listIcon() {
3040
+ const SVG = 'http://www.w3.org/2000/svg';
3041
+ const svg = document.createElementNS(SVG, 'svg'); svg.setAttribute('viewBox', '0 0 24 24'); svg.setAttribute('aria-hidden', 'true');
3042
+ for (const d of ['m3 17 2 2 4-4', 'm3 7 2 2 4-4', 'M13 6h8', 'M13 12h8', 'M13 18h8']) { const path = document.createElementNS(SVG, 'path'); path.setAttribute('d', d); svg.append(path); }
3043
+ return svg;
3044
+ }
3010
3045
  const roundPlus = (label, onclick) => { const b = el('button', 'as-add', '+'); b.type = 'button'; b.setAttribute('aria-label', label); b.title = label; b.addEventListener('click', onclick); return b; };
3011
3046
  /* The rows, by kind. items: [{key, kind, name, sub, badge, badgeTitle, tone}]. */
3012
3047
  function paintAsList(holder, items, { chosen, choose, add, empty }) {
@@ -3016,7 +3051,7 @@
3016
3051
  if (mine.length === 0 && !add) continue;
3017
3052
  const section = el('section', 'as-kind'); section.dataset.kind = kind;
3018
3053
  const head = el('div', 'as-kind-head'); head.append(el('h3', '', title));
3019
- if (add) head.append(roundPlus(`Add ${{ git: 'a repository', folder: 'a folder', mailbox: 'a mailbox', secret: 'a secret' }[kind]}`, () => add(kind)));
3054
+ if (add) head.append(roundPlus(`Add ${{ git: 'a repository', folder: 'a folder', mailbox: 'a mailbox', secret: 'a secret', list: LISTS_WORD.a }[kind]}`, () => add(kind)));
3020
3055
  section.append(head);
3021
3056
  if (mine.length === 0) section.append(el('p', 'hint as-none', 'None yet'));
3022
3057
  for (const item of mine) {
@@ -3564,6 +3599,7 @@
3564
3599
  $('copy').hidden = true;
3565
3600
  if (!$('files').classList.contains('embedded')) $('files').hidden = true;
3566
3601
  if (pick !== undefined) roomPick = pick;
3602
+ closeRoomLists();
3567
3603
  assetsShown = true; $('cassets').hidden = false; paintViews();
3568
3604
  await paintRoomAssets();
3569
3605
  }
@@ -3624,10 +3660,27 @@
3624
3660
  }
3625
3661
 
3626
3662
  /* ---- the server's ---- */
3627
- let assetOpen = ''; let assetsAdding = ''; let assetsQuery = ''; let remoteShown = ''; let remoteEditing = false;
3663
+ let assetOpen = ''; let assetsAdding = ''; let assetsQuery = ''; let remoteShown = ''; let remoteEditing = false; let listOpen = ''; let listsSig = '';
3664
+ /* A list given to a conversation, or taken back: a grant of Binder's. */
3665
+ const givenTo = (l) => Object.keys(l.grants ?? {}).filter((id) => id.startsWith('conversation:'));
3666
+ async function grantList(list, name, value) {
3667
+ $('assets-error').hidden = true;
3668
+ const done = await binderCall('grant', { list, to: `conversation:${name}`, access: value === 'none' ? null : value });
3669
+ if (!done.ok) { $('assets-error').textContent = done.text; $('assets-error').hidden = false; }
3670
+ await refresh();
3671
+ }
3672
+ /* A new list: Binder's templates, read once. */
3673
+ async function fillTemplates() {
3674
+ const pick = $('listnew-template');
3675
+ if (pick.options.length) return;
3676
+ const names = await binderCall('templates', {});
3677
+ if (!names.ok || pick.options.length) return;
3678
+ for (const [key, name] of Object.entries(names.data)) { const o = document.createElement('option'); o.value = key; o.textContent = name[binderLang()] ?? name.en; pick.append(o); }
3679
+ }
3628
3680
  async function paintAssets() {
3629
3681
  if (place !== 'assets' || DEVICE) return;
3630
- const [all, boxes, secrets, keys] = await Promise.all([getJson('/resources', []), getJson('/mailboxes', []), getJson('/secrets', []), getJson('/git-keys', []), readDevices()]);
3682
+ const [all, boxes, secrets, keys, lists] = await Promise.all([getJson('/resources', []), getJson('/mailboxes', []), getJson('/secrets', []), getJson('/git-keys', []), binderCall('lists', {}), readDevices()]);
3683
+ if (place !== 'assets') return;
3631
3684
  paintKeys(keys);
3632
3685
  markSecrets(secrets);
3633
3686
  const items = [];
@@ -3638,6 +3691,13 @@
3638
3691
  sub: kind === 'git' ? `${gitSub(r)}${viaText(r.via)}` : kind === 'mailbox' ? boxSub(box) : 'folder', tone: box?.failure ? 'bad' : '' });
3639
3692
  }
3640
3693
  for (const s2 of secrets) items.push({ key: `secret:${s2.name}`, kind: 'secret', name: s2.name, secret: s2, badge: String(s2.conversations.length), badgeTitle: `Used by ${s2.conversations.length} conversation${s2.conversations.length === 1 ? '' : 's'}`, badgeTone: 'count', ...secretItem(s2, 'name only') });
3694
+ /* Binder's lists: given to a conversation (read, write) in Binder itself. */
3695
+ const shownLists = lists.ok && Array.isArray(lists.data) ? lists.data.filter((l) => !l.archived) : [];
3696
+ listsSig = binderSig(lists.data);
3697
+ for (const l of shownLists) {
3698
+ const users = givenTo(l).length;
3699
+ items.push({ key: `list:${l.id}`, kind: 'list', name: l.title, list: l, badge: String(users), badgeTitle: `Used by ${users} conversation${users === 1 ? '' : 's'}`, badgeTone: 'count', sub: `${l.count} card${l.count === 1 ? '' : 's'}` });
3700
+ }
3641
3701
  const shown = assetsQuery ? items.filter((i) => i.name.includes(assetsQuery.toLowerCase()) || i.name.toLowerCase().includes(assetsQuery.toLowerCase())) : items;
3642
3702
  const chosen = assetsAdding ? null : items.find((i) => i.key === assetOpen) ?? null;
3643
3703
  $('assets-as').dataset.open = chosen || assetsAdding ? 'detail' : 'list';
@@ -3654,7 +3714,7 @@
3654
3714
  if (assetsAdding === 'choose') {
3655
3715
  detail.append(el('h3', '', 'New asset'));
3656
3716
  const kinds = el('div', 'as-kinds');
3657
- for (const [kind, word] of [['git', 'Git repository'], ['folder', 'Folder'], ['mailbox', 'Mailbox'], ['secret', 'Secret']]) {
3717
+ for (const [kind, word] of [['git', 'Git repository'], ['folder', 'Folder'], ['mailbox', 'Mailbox'], ['secret', 'Secret'], ['list', LISTS_WORD.one]]) {
3658
3718
  const b = el('button', '', word); b.type = 'button'; b.dataset.kind = kind;
3659
3719
  b.addEventListener('click', () => { assetsAdding = kind; void paintAssets(); });
3660
3720
  b.prepend(kindIcon(kind)); kinds.append(b);
@@ -3665,6 +3725,7 @@
3665
3725
  const form = $(`${assetsAdding}-box`); form.hidden = false;
3666
3726
  detail.append(form);
3667
3727
  if (assetsAdding === 'git') { fillKeyChoice(); showVia(); }
3728
+ if (assetsAdding === 'list') void fillTemplates();
3668
3729
  focusField(form.querySelector('input:not([type=radio])'));
3669
3730
  return;
3670
3731
  }
@@ -3673,6 +3734,7 @@
3673
3734
  const form = $(`${assetsAdding}-box`); form.hidden = false;
3674
3735
  detail.append(all2, form);
3675
3736
  if (assetsAdding === 'git') { fillKeyChoice(); showVia(); }
3737
+ if (assetsAdding === 'list') void fillTemplates();
3676
3738
  focusField(form.querySelector('input:not([type=radio])'));
3677
3739
  return;
3678
3740
  }
@@ -3704,7 +3766,7 @@
3704
3766
  }
3705
3767
  /* Used by: each conversation that has it, what it may do; "+" offers the others. */
3706
3768
  const options = chosen.kind === 'secret' ? [['off', 'Off'], ['use', 'Use']] : chosen.kind === 'mailbox' ? [['none', 'Off'], ['read', 'Read']] : [['none', 'Off'], ['read', 'Read'], ['write', 'Write']];
3707
- const has = (c) => (chosen.kind === 'secret' ? (chosen.secret.conversations.includes(c.name) ? 'use' : 'off') : r.attachments?.[c.name] ?? 'none');
3769
+ const has = (c) => (chosen.kind === 'secret' ? (chosen.secret.conversations.includes(c.name) ? 'use' : 'off') : chosen.kind === 'list' ? chosen.list.grants?.[`conversation:${c.name}`] ?? 'none' : r.attachments?.[c.name] ?? 'none');
3708
3770
  const using = ready.filter((c) => !['none', 'off'].includes(has(c)));
3709
3771
  const others = ready.filter((c) => ['none', 'off'].includes(has(c)));
3710
3772
  const users = el('div', 'as-users');
@@ -3713,6 +3775,7 @@
3713
3775
  const line = el('div', 'given-row'); line.dataset.conversation = c.name;
3714
3776
  line.append(el('span', '', shownName(c)), modes(options, has(c), async (value) => {
3715
3777
  if (chosen.kind === 'secret') await handTo(c.name, chosen.name, value === 'use', 'assets-error');
3778
+ else if (chosen.kind === 'list') await grantList(chosen.list.id, c.name, value);
3716
3779
  else await attachTo(c.name, chosen.name, value, 'assets-error');
3717
3780
  await paintAssets();
3718
3781
  }, `What ${c.name} may do with ${chosen.name}`));
@@ -3723,6 +3786,15 @@
3723
3786
  for (const c of others) picker.append(row(c));
3724
3787
  if (others.length === 0) picker.append(el('p', 'hint', ready.length ? 'Every conversation has it.' : 'No conversation is ready.'));
3725
3788
  detail.append(chapter('Used by', roundPlus('Give it to a conversation', () => { picker.hidden = !picker.hidden; })), users, picker);
3789
+ if (chosen.kind === 'list') {
3790
+ /* The list itself, Binder's screen, here: that list alone. */
3791
+ const open = el('button', '', listOpen === chosen.key ? 'Close' : 'Open'); open.type = 'button'; open.dataset.act = 'open-list';
3792
+ const holder = el('div', 'binder-holder as-binder');
3793
+ open.addEventListener('click', () => { listOpen = listOpen === chosen.key ? '' : chosen.key; void paintAssets(); });
3794
+ detail.append(chapter('Cards', open), holder);
3795
+ const id = chosen.list.id;
3796
+ if (listOpen === chosen.key) void mountBinder(holder, (l) => l.id === id, { onLists: (data) => { if (place === 'assets' && binderSig(data) !== listsSig) void paintAssets(); } });
3797
+ }
3726
3798
  if (chosen.kind === 'git') {
3727
3799
  const holder = el('div', 'as-git'); detail.append(holder);
3728
3800
  /* Settings: where it is sent, with what. */
@@ -3746,15 +3818,20 @@
3746
3818
  const remove = el('button', 'as-link danger-link', 'Delete...'); remove.type = 'button';
3747
3819
  const why = el('small', 'hint');
3748
3820
  const inUse = chosen.kind !== 'secret' && using.length > 0;
3821
+ const lost = { secret: 'Its value is lost for good.', list: 'Its cards are lost for good.' }[chosen.kind] ?? 'Its files are kept aside on the server.';
3749
3822
  if (inUse) { remove.disabled = true; why.textContent = ` used by ${using.length} conversation${using.length > 1 ? 's' : ''}: set ${using.length > 1 ? 'them' : 'it'} to Off first`; }
3750
3823
  remove.addEventListener('click', () => {
3751
- const sure = el('button', 'danger', chosen.kind === 'secret' ? `Yes, delete ${chosen.name}` : `Yes, remove ${chosen.name}`); sure.type = 'button';
3824
+ const sure = el('button', 'danger', chosen.kind === 'secret' || chosen.kind === 'list' ? `Yes, delete ${chosen.name}` : `Yes, remove ${chosen.name}`); sure.type = 'button';
3752
3825
  const keep = el('button', '', 'Keep'); keep.type = 'button';
3753
3826
  keep.addEventListener('click', () => { void paintAssets(); });
3754
3827
  const ask = el('div', 'callout bad confirm'); ask.setAttribute('role', 'alertdialog');
3755
- ask.append(el('span', '', chosen.kind === 'secret' ? 'Its value is lost for good.' : 'Its files are kept aside on the server.'), keep, sure);
3828
+ ask.append(el('span', '', lost), keep, sure);
3756
3829
  sure.addEventListener('click', async () => {
3757
- try { await post(chosen.kind === 'secret' ? `${API}/secrets/${chosen.name}/remove` : `${API}/resources/${chosen.name}/remove`); assetOpen = ''; }
3830
+ try {
3831
+ if (chosen.kind === 'list') { const done = await binderCall('delete-list', { list: chosen.list.id }); if (!done.ok) throw new Error(done.text); }
3832
+ else await post(chosen.kind === 'secret' ? `${API}/secrets/${chosen.name}/remove` : `${API}/resources/${chosen.name}/remove`);
3833
+ assetOpen = '';
3834
+ }
3758
3835
  catch (error) { $('assets-error').textContent = error.message; $('assets-error').hidden = false; }
3759
3836
  await paintAssets();
3760
3837
  });
@@ -3764,7 +3841,7 @@
3764
3841
  /* Given to a device: from here too (the map shows who has it). */
3765
3842
  const share = el('button', 'as-link', 'Share with a device...'); share.type = 'button';
3766
3843
  share.addEventListener('click', () => { void openCompose([[chosen.key, 'r']]); });
3767
- const foot = el('div', 'as-foot'); foot.append(...(chosen.kind === 'secret' ? [] : [share, el('br')]), remove, why);
3844
+ const foot = el('div', 'as-foot'); foot.append(...(chosen.kind === 'secret' || chosen.kind === 'list' ? [] : [share, el('br')]), remove, why);
3768
3845
  detail.append(foot);
3769
3846
  }
3770
3847
  /* From the map's "+" of Assets: the Assets page over the map, on "which kind"; Back, the map. */
@@ -3980,8 +4057,6 @@
3980
4057
  $('settings').hidden = which !== 'settings';
3981
4058
  $('assets').hidden = which !== 'assets';
3982
4059
  $('newconv').hidden = which !== 'new';
3983
- $('lists').hidden = which !== 'lists';
3984
- if (which === 'lists') void paintLists(); else stopLists();
3985
4060
  if (which !== 'access') composing = false;
3986
4061
  /* What the conversation had open (its tab) waits under the place, as it was. */
3987
4062
  if (which !== 'conversations') { for (const id of ['files', 'copy']) $(id).hidden = true; view('room'); }
@@ -4054,34 +4129,49 @@
4054
4129
  }
4055
4130
  /* `of`: the conversation it is filtered on ('' for none; left as it is when not given).
4056
4131
  `face`: on the devices tab, 'compose' keeps what openCompose prepared. */
4057
- /* LISTS: the binder, drawn by Binder (clavarium-binder) in its place; read again when it changed. */
4058
- let binderView = null; let binderPeople = []; let binderChanges = -1; let binderTimer = null;
4059
- function openListsPlace({ push = true } = {}) { if (DEVICE) return; if (place !== 'lists') enterPlace('lists', push); }
4060
- async function paintLists() {
4061
- const lang = /^fr\b/i.test(navigator.language ?? '') ? 'fr' : 'en';
4062
- const seen = await getJson('/binder/people', null);
4132
+ /* BINDER'S SCREEN (clavarium-binder), where a list is seen: one list of Assets opened, a
4133
+ conversation's Lists tab. Binder has no filter: the lists it is answered are cut here to
4134
+ those `keep` says. Every screen shown is read again when the lists changed. */
4135
+ let binderPeople = []; let binderChanges = -1; let binderTimer = null; let binderParts = null;
4136
+ const binderViews = new Set();
4137
+ function binderLang() { return /^fr\b/i.test(navigator.language ?? '') ? 'fr' : 'en'; }
4138
+ function binderCall(op, args) {
4139
+ return fetch(`${API}/binder`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ op, args }) })
4140
+ .then((r) => r.json()).catch(() => ({ ok: false, text: 'The server could not be reached.' }));
4141
+ }
4142
+ /* What a page drew from the lists, to know when they changed. */
4143
+ function binderSig(lists) { return JSON.stringify((Array.isArray(lists) ? lists : []).map((l) => [l.id, l.title, l.archived, l.count, l.grants])); }
4144
+ async function mountBinder(holder, keep, { onLists } = {}) {
4145
+ binderParts ??= Promise.all([import(new URL('vendor/binder-ui.js', new URL('/', location.href)).href), fetch(`/vendor/binder-${binderLang()}.json`).then((r) => r.json()).catch(() => ({}))]);
4146
+ const [[{ mount }, words], seen] = await Promise.all([binderParts, getJson('/binder/people', null)]);
4063
4147
  if (seen) { binderPeople = seen.people; binderChanges = seen.changes; }
4064
- if (!binderView) {
4065
- const [{ mount }, words] = await Promise.all([import(new URL('vendor/binder-ui.js', new URL('/', location.href)).href), fetch(`/vendor/binder-${lang}.json`).then((r) => r.json()).catch(() => ({}))]);
4066
- if (place !== 'lists' || binderView) return;
4067
- binderView = mount($('lists-binder'), {
4068
- words, lang, people: () => binderPeople,
4069
- call: (op, args) => fetch(`${API}/binder`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ op, args }) })
4070
- .then((r) => r.json()).catch(() => ({ ok: false, text: 'The server could not be reached.' })),
4071
- /* A message or a file attached opens where this page opens them; a conversation's own, by its path. */
4072
- openAttached: (a) => { if (a.kind === 'asset') void openAssetsPlace(a.ref); },
4073
- });
4074
- } else void binderView.refresh();
4075
- stopLists();
4148
+ if (!holder.isConnected) return null;
4149
+ const view = mount(holder, {
4150
+ words, lang: binderLang(), people: () => binderPeople,
4151
+ call: async (op, args) => {
4152
+ const r = await binderCall(op, args);
4153
+ if (op === 'lists' && r.ok && Array.isArray(r.data)) { onLists?.(r.data); r.data = r.data.filter(keep); }
4154
+ return r;
4155
+ },
4156
+ /* A thing attached opens where this page opens it. */
4157
+ openAttached: (a) => { if (a.kind === 'asset') void openAssetsPlace(a.ref); },
4158
+ });
4159
+ binderViews.add({ box: holder.firstElementChild, view });
4160
+ watchBinders();
4161
+ return view;
4162
+ }
4163
+ function watchBinders() {
4164
+ if (binderTimer) return;
4076
4165
  binderTimer = setInterval(async () => {
4077
- if (place !== 'lists' || document.hidden) return;
4166
+ for (const one of binderViews) if (!one.box?.isConnected) { one.view.destroy(); binderViews.delete(one); }
4167
+ if (binderViews.size === 0) { clearInterval(binderTimer); binderTimer = null; return; }
4168
+ if (document.hidden) return;
4078
4169
  const now = await getJson('/binder/people', null);
4079
4170
  if (!now) return;
4080
4171
  binderPeople = now.people;
4081
- if (now.changes !== binderChanges) { binderChanges = now.changes; void binderView?.refresh(); }
4172
+ if (now.changes !== binderChanges) { binderChanges = now.changes; for (const one of binderViews) void one.view.refresh(); }
4082
4173
  }, 4000);
4083
4174
  }
4084
- function stopLists() { if (binderTimer) clearInterval(binderTimer); binderTimer = null; }
4085
4175
  async function openAccessPage(tab = accessTab, { mode, of, face: shown = 'manage', push = true, pin } = {}) {
4086
4176
  if (DEVICE) return;
4087
4177
  /* Assets left Access: a conversation's own, or the server's. */
@@ -4116,17 +4206,14 @@
4116
4206
  if (/^[a-z]{1,20}$/.test(at)) openChapter(`s-${at}`)?.scrollIntoView({ block: 'start' });
4117
4207
  return;
4118
4208
  }
4119
- if (open === 'lists') { openListsPlace({ push: false }); return; }
4120
- /* Assets, a place of its own now (it was a tab of Access). */
4121
- if (open === 'assets' || (open === 'access' && q.get('tab') === 'assets')) { await openAssetsPlace(q.get('a') ?? undefined, { push: false }); return; }
4209
+ /* Assets, a place of its own now (it was a tab of Access); Lists, a kind of asset now. */
4210
+ if (open === 'assets' || open === 'lists' || (open === 'access' && q.get('tab') === 'assets')) { await openAssetsPlace(q.get('a') ?? undefined, { push: false }); return; }
4122
4211
  const former = FORMER[open === 'access' ? (q.get('tab') ?? 'map') : open];
4123
4212
  if (former) { await openAccessPage(former[0], { mode: former[1], of: q.get('for') ?? '', push: false }); return; }
4124
4213
  leftPlace(false);
4125
4214
  }
4126
4215
  nav.outside = () => { if (!DEVICE) void followAddress(); };
4127
4216
  $('nav-conversations').addEventListener('click', () => { leavePlace({ list: true }); });
4128
- $('nav-lists').addEventListener('click', () => openListsPlace());
4129
- $('lists-close').addEventListener('click', () => leavePlace());
4130
4217
  $('nav-access').addEventListener('click', () => { if (place !== 'access' || accessTab !== 'map' || mapMode !== 'map') void openAccessPage('map', { mode: 'map' }); });
4131
4218
  $('nav-assets').addEventListener('click', () => { if (place !== 'assets') void openAssetsPlace(); });
4132
4219
  $('map-new-device').addEventListener('click', () => { void openCompose(accessFor ? [[`conversation:${accessFor}`, partsFor(accessFor)]] : []); });
@@ -5522,6 +5609,14 @@
5522
5609
  button.disabled = false; button.textContent = 'Add';
5523
5610
  await paintAssets();
5524
5611
  });
5612
+ $('list-new').addEventListener('submit', async (event) => {
5613
+ event.preventDefault();
5614
+ $('assets-error').hidden = true;
5615
+ const made = await binderCall('create-list', { template: $('listnew-template').value, title: $('listnew-title').value.trim(), lang: binderLang() });
5616
+ if (made.ok) { $('listnew-title').value = ''; assetsAdding = ''; assetOpen = `list:${made.data.id}`; listOpen = assetOpen; remember(); }
5617
+ else { $('assets-error').textContent = made.text; $('assets-error').hidden = false; }
5618
+ await paintAssets();
5619
+ });
5525
5620
  $('folder-new').addEventListener('submit', async (event) => {
5526
5621
  event.preventDefault();
5527
5622
  $('assets-error').hidden = true;
package/web/index.html CHANGED
@@ -34,7 +34,6 @@
34
34
  <div id="list-resize" role="separator" aria-orientation="vertical" aria-label="Width of the list" title="Drag to widen or narrow the list; double click for its usual width" tabindex="0" hidden></div>
35
35
  <nav id="nav" aria-label="Places" hidden>
36
36
  <button type="button" id="nav-conversations" data-place="conversations" aria-current="page"><svg class="nav-ic" viewBox="0 0 24 24" aria-hidden="true" data-icon="message-square"><path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414 .586l-2.202 2.202A.71 .71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/></svg><span>Conversations</span></button>
37
- <button type="button" id="nav-lists" data-place="lists"><svg class="nav-ic" viewBox="0 0 24 24" aria-hidden="true" data-icon="list-checks"><path d="m3 17 2 2 4-4"/><path d="m3 7 2 2 4-4"/><path d="M13 6h8"/><path d="M13 12h8"/><path d="M13 18h8"/></svg><span>Lists</span></button>
38
37
  <button type="button" id="nav-assets" data-place="assets"><svg class="nav-ic" viewBox="0 0 24 24" aria-hidden="true" data-icon="layers"><path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/></svg><span>Assets</span></button>
39
38
  <button type="button" id="nav-access" data-place="access"><svg class="nav-ic" viewBox="0 0 24 24" aria-hidden="true" data-icon="waypoints"><path d="m10.586 5.414-5.172 5.172"/><path d="m18.586 13.414-5.172 5.172"/><path d="M6 12h12"/><circle cx="12" cy="20" r="2"/><circle cx="12" cy="4" r="2"/><circle cx="20" cy="12" r="2"/><circle cx="4" cy="12" r="2"/></svg><span>Access</span></button>
40
39
  <button type="button" id="nav-settings" data-place="settings"><svg class="nav-ic" viewBox="0 0 24 24" aria-hidden="true" data-icon="settings"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/></svg><span>Settings</span></button>
@@ -45,11 +44,12 @@
45
44
  <button type="button" id="fold" aria-label="Hide the list of conversations" aria-pressed="false" title="Hide or show the list of conversations">&laquo;</button>
46
45
  <span id="state" data-state="connecting" role="status">connecting</span>
47
46
  <b id="name"></b>
48
- <!-- THE BAR: its chat, its terminal, what it was given, its settings (G): four tabs. -->
47
+ <!-- THE BAR: its chat, its terminal, what it was given, its binders (once it has one), its settings (G). -->
49
48
  <div id="views" class="views" role="group" aria-label="What to see">
50
49
  <button type="button" id="view-chat" aria-pressed="false" title="Its chat"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414 .586l-2.202 2.202A.71 .71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/></svg><span>Chat</span></button>
51
50
  <button type="button" id="view-terminal" aria-pressed="false" title="Its terminal"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m7 11 2-2-2-2"/><path d="M11 13h4"/><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/></svg><span>Terminal</span></button>
52
51
  <button type="button" id="view-assets" aria-pressed="false" title="What it was given"><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/></svg><span>Assets</span><b id="assets-count" class="count"></b></button>
52
+ <button type="button" id="view-lists" aria-pressed="false" title="Its binders" hidden><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="m3 17 2 2 4-4"/><path d="m3 7 2 2 4-4"/><path d="M13 6h8"/><path d="M13 12h8"/><path d="M13 18h8"/></svg><span id="view-lists-word">Binders</span><b id="lists-count" class="count" title="Waiting for your approval"></b></button>
53
53
  <button type="button" id="folders" aria-pressed="false" aria-label="Settings" title="Settings of this conversation" hidden><svg class="ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/></svg><span class="sr">Settings</span></button>
54
54
  </div>
55
55
  </header>
@@ -107,6 +107,8 @@
107
107
  <div class="as-detail" id="cassets-detail"></div>
108
108
  </div>
109
109
  </div>
110
+ <!-- ITS LISTS: Binder's screen, only the lists given to it. -->
111
+ <div id="clists" class="sheet as-room" hidden><div id="clists-binder" class="binder-holder"></div></div>
110
112
  <div id="panel" class="sheet" hidden>
111
113
  <div class="panel-top"><b id="panel-title">This conversation</b></div>
112
114
  <p id="panel-error" class="error" role="alert" hidden></p>
@@ -440,11 +442,6 @@
440
442
  right: who uses it, its state, its settings. The forms that make
441
443
  one, and a repository's remote, wait in #assets-forms and are moved
442
444
  into the detail when asked for. -->
443
- <!-- LISTS: the binder (clavarium-binder), drawn by Binder itself in #lists-binder. -->
444
- <div id="lists" class="sheet as-place" hidden>
445
- <div class="panel-top"><b>Lists</b><button type="button" id="lists-close" class="as-link place-back">&lsaquo; Conversations</button></div>
446
- <div id="lists-binder"></div>
447
- </div>
448
445
  <div id="assets" class="sheet as-place" hidden>
449
446
  <div class="panel-top"><b>Assets</b><button type="button" id="assets-close" class="as-link place-back">&lsaquo; Conversations</button></div>
450
447
  <p id="assets-error" class="error" role="alert" hidden></p>
@@ -519,6 +516,14 @@
519
516
  <button type="submit" class="primary">Add</button></div>
520
517
  <p id="mailbox-error" class="error" role="alert" hidden></p>
521
518
  </form>
519
+ </div>
520
+ <div id="list-box" class="as-form" data-kind="list"><h3 id="listnew-head">New binder</h3>
521
+ <form id="list-new" autocomplete="off">
522
+ <label for="listnew-template">Template</label>
523
+ <select id="listnew-template" required></select>
524
+ <label for="listnew-title">Title</label>
525
+ <div class="row"><input id="listnew-title" maxlength="200" placeholder="Optional"><button type="submit" class="primary">Create</button></div>
526
+ </form>
522
527
  </div>
523
528
  <div id="secret-box" class="as-form" data-kind="secret"><h3>New secret</h3><p class="hint">A value goes in and is never shown again.</p>
524
529
  <form id="secret-new" autocomplete="off">
package/web/style.css CHANGED
@@ -1699,7 +1699,18 @@ span.callout.confirm { display: inline-flex; justify-content: flex-end; padding:
1699
1699
 
1700
1700
  /* Something asks for the person in this chapter (a callout, a warning): a dot on its title, and on its category. */
1701
1701
  details.chapter[data-attention] > summary .chapter-title::after, #settings-nav button[data-attention]::after, #nav-assets[data-attention] > span::after, #view-assets[data-attention] > span::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--warn); vertical-align: middle; }
1702
- /* LISTS: Binder's screen, in this page's colours. */
1703
- #lists-binder { display: flex; flex-direction: column; min-height: 0; overflow: auto; padding: 16px 16px 24px; }
1704
- #lists-binder .binder { --binder-bg: var(--bg); --binder-text: var(--ink); --binder-dim: var(--ink2); --binder-line: var(--line); --binder-panel: var(--panel);
1702
+ /* LISTS: Binder's screen, in this page's colours (above Binder's own dark ones, whatever the theme): a conversation's Lists tab, one list of Assets opened.
1703
+ Lists are made in Assets: Binder's own "+ New list" is not offered here. */
1704
+ .binder-holder { display: flex; flex-direction: column; min-height: 0; }
1705
+ #clists { padding: 0; }
1706
+ #clists-binder { overflow: auto; padding: 16px 16px 24px; }
1707
+ body .binder-holder .binder { --binder-bg: var(--bg); --binder-text: var(--ink); --binder-dim: var(--ink2); --binder-line: var(--line); --binder-panel: var(--panel);
1705
1708
  --binder-action: var(--brass); --binder-on-action: #1b1405; --binder-ok: var(--ok); --binder-ask: var(--warn); --binder-danger: var(--danger); }
1709
+ .binder-holder .binder-new-list, .binder-holder .binder-empty .binder-primary { display: none; }
1710
+ /* One list opened in Assets: no row of tabs for it alone. */
1711
+ .as-binder .binder-top { display: none; }
1712
+ .as-binder { margin-top: 8px; }
1713
+ /* A box to tick stays a box on a touch screen (buttons are 44px high there), a little larger. */
1714
+ @media (pointer: coarse) { .binder-holder .binder-tick { min-height: 0; width: 1.75rem; height: 1.75rem; } }
1715
+ /* On the tab, what waits for the owner's tick: the colour of what asks. */
1716
+ .views #lists-count { background: var(--brass); color: var(--on-brass, #1b1405); font-weight: 700; }