clavarium 0.2.170-beta.1 → 0.2.171-beta.1

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.170-beta.1",
3
+ "version": "0.2.171-beta.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.170-beta.1",
9
+ "version": "0.2.171-beta.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
13
13
  "@xterm/xterm": "^6.0.0",
14
14
  "clavarium-binder": "0.1.61-next.1",
15
15
  "clavarium-docket": "0.1.2-next.2",
16
- "clavarium-parley": "0.17.77-next.1",
16
+ "clavarium-parley": "0.17.82-next.1",
17
17
  "clavarium-tether": "0.1.0-next.55",
18
18
  "mammoth": "1.13.0",
19
19
  "mermaid": "11.17.2",
@@ -787,9 +787,9 @@
787
787
  }
788
788
  },
789
789
  "node_modules/clavarium-parley": {
790
- "version": "0.17.77-next.1",
791
- "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.77-next.1.tgz",
792
- "integrity": "sha512-mT6JxoADZLdPrHyN5hhV9unXsy+dmcWURGzK7m6aiFRcWaJCBCfrqv4fo0rwMi96pIlYws7Dke49jo8KJwpsSg==",
790
+ "version": "0.17.82-next.1",
791
+ "resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.82-next.1.tgz",
792
+ "integrity": "sha512-wCH7ajkmqfxY2qnY9zuaqdppd1C5rAiiFXH2IWcVYIpzuvnhjD2ac6lgVM3tJsfg6RsUBoBZVC9poLVeHpCwjg==",
793
793
  "license": "MIT",
794
794
  "bin": {
795
795
  "parley": "bin/parley.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.170-beta.1",
3
+ "version": "0.2.171-beta.1",
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.",
@@ -46,7 +46,7 @@
46
46
  "@xterm/xterm": "^6.0.0",
47
47
  "clavarium-binder": "0.1.61-next.1",
48
48
  "clavarium-docket": "0.1.2-next.2",
49
- "clavarium-parley": "0.17.77-next.1",
49
+ "clavarium-parley": "0.17.82-next.1",
50
50
  "clavarium-tether": "0.1.0-next.55",
51
51
  "mammoth": "1.13.0",
52
52
  "mermaid": "11.17.2",
package/server/rooms.mjs CHANGED
@@ -29,6 +29,9 @@ export const THINKING_MS = 10 * 60_000;
29
29
  const KINDS = ['person', 'ai', 'box'];
30
30
  const nameOf = (v) => String(v ?? '').replace(/\s+/g, ' ').trim().slice(0, ROOM_NAME_MAX);
31
31
 
32
+ /* A sign as the cards draw it (web/kit.js hueOf, initialOf): the same name, the same letter and colour. */
33
+ export const lookOf = (name) => { const text = String(name ?? ''); let h = 0; for (const ch of text) h = (h * 31 + ch.codePointAt(0)) >>> 0; return { initial: ([...text.trim()][0] ?? '?').toUpperCase(), hue: h % 360 }; };
34
+
32
35
  export class Rooms {
33
36
  #file; #dir; #say; #rooms; #conversations; #boxes; #now; #speak; #hops = new Map(); #thinking = new Map();
34
37
  /* file: a JsonFile of the rooms; dir: where their threads are; say(name, text, extra): a message written in a
@@ -48,8 +51,11 @@ export class Rooms {
48
51
  const boxes = new Map(this.#boxes().map((b) => [b.id, b]));
49
52
  /* An AI is named as its chat names it (the name the owner gave it in its chat settings), else its title, else its name. */
50
53
  const convs = new Map(this.#conversations().map((c) => [c.name, c.chatName || c.title || c.name]));
54
+ /* Its sign (06-11): an AI by its conversation's card (letter and colour of its title), anyone else by its name. */
55
+ const titles = new Map(this.#conversations().map((c) => [c.name, c.title || c.name]));
51
56
  return room.members.filter((m) => (m.kind === 'ai' ? convs.has(m.ref) : m.kind === 'box' ? boxes.has(m.ref) : true))
52
- .map((m) => ({ id: m.id, kind: m.kind, name: m.kind === 'box' ? (boxes.get(m.ref)?.name ?? m.name) : m.kind === 'ai' ? convs.get(m.ref) : m.name, ref: m.ref, ...(m.id === room.host ? { host: true } : {}) }));
57
+ .map((m) => { const name = m.kind === 'box' ? (boxes.get(m.ref)?.name ?? m.name) : m.kind === 'ai' ? convs.get(m.ref) : m.name;
58
+ return { id: m.id, kind: m.kind, name, ref: m.ref, look: lookOf(m.kind === 'ai' ? titles.get(m.ref) : name), ...(m.id === room.host ? { host: true } : {}) }; });
53
59
  }
54
60
  #think(room, member, on) { const m = this.#thinking.get(room) ?? new Map(); if (on) m.set(member, Date.now()); else m.delete(member); this.#thinking.set(room, m); }
55
61
  has(id) { return this.#all().some((r) => r.id === id); }
@@ -119,7 +125,7 @@ export class Rooms {
119
125
  /* ITS THREAD, as a screen reads it (Parley's read, the members' names of the moment). */
120
126
  read(id, options) {
121
127
  const room = this.#find(id); const t = this.#thread(room.id); const members = this.#shown(room);
122
- t.setSpeakers(members.map((m) => ({ id: m.id, name: m.name, kind: m.kind })));
128
+ t.setSpeakers(members.map((m) => ({ id: m.id, name: m.name, kind: m.kind, look: m.look })));
123
129
  const read = t.read(options);
124
130
  /* A member named in a text (@{id}): its name of the moment, on the screen. */
125
131
  const named = (text) => String(text ?? '').replace(/@\{([0-9a-f-]{36})\}/g, (whole, mid) => { const m = members.find((x) => x.id === mid); return m ? `@${m.name}` : whole; });
@@ -138,14 +144,16 @@ export class Rooms {
138
144
  const t = this.#thread(room.id);
139
145
  this.#hops.set(room.id, 0);
140
146
  /* The owner is the room's own side (no name over their words, as in any chat); anyone else is named. */
141
- const now = t.say(text, undefined, [], who.ref === 'owner' ? {} : { by: { id: who.id, name: who.name, kind: who.kind } });
147
+ const now = t.say(text, undefined, [], who.ref === 'owner' ? {} : { by: { id: who.id, name: who.name, kind: who.kind, look: who.look } });
142
148
  const said = now.messages.at(-1);
143
149
  const named = (Array.isArray(to) ? to : []).map((x) => members.find((m) => m.id === x && m.kind === 'ai')).filter(Boolean);
144
150
  const host = members.find((m) => m.id === room.host);
145
151
  for (const ai of named.length ? named : host ? [host] : []) {
146
152
  this.#think(room.id, ai.id, true);
147
- await this.#say(ai.ref, said.text, { by: { id: who.id, name: who.name, kind: who.kind }, room: { id: room.id, name: room.name, message: said.id } });
153
+ await this.#say(ai.ref, said.text, { by: { id: who.id, name: who.name, kind: who.kind, look: who.look }, room: { id: room.id, name: room.name, message: said.id } });
148
154
  }
155
+ /* Handed to its AIs: read, as a conversation's agent would say it (06-11: the clock stayed on every message). */
156
+ try { t.seen?.(); } catch { /* an older Parley */ }
149
157
  return this.read(id);
150
158
  }
151
159
 
@@ -178,18 +186,18 @@ export class Rooms {
178
186
  /* Handed on as it is: the message itself, by who said it; the room's thread keeps no copy. */
179
187
  const forwarded = find(entry.forward);
180
188
  if (forwarded) {
181
- const from = forwarded.by ? { id: forwarded.by.id, name: forwarded.by.name, kind: forwarded.by.kind ?? 'person' } : { id: members.find((m) => m.kind === 'person')?.id ?? 'owner', name: members.find((m) => m.kind === 'person')?.name ?? 'Owner', kind: 'person' };
189
+ const from = forwarded.by ? { id: forwarded.by.id, name: forwarded.by.name, kind: forwarded.by.kind ?? 'person', ...(forwarded.by.look ? { look: forwarded.by.look } : {}) } : { id: members.find((m) => m.kind === 'person')?.id ?? 'owner', name: members.find((m) => m.kind === 'person')?.name ?? 'Owner', kind: 'person' };
182
190
  for (const ai of ais) handOver(ai, forwarded.text, from, forwarded.id);
183
191
  if (!String(entry.text ?? '').trim()) return forwarded.id;
184
192
  }
185
193
  if (!String(entry.text ?? '').trim()) return null;
186
194
  /* @Name of a member, exactly: kept as its id (the screen says its name of the moment). */
187
195
  const text = String(entry.text).replace(/@([^\s@{][^@\n]{0,40}?)(?=[\s,.;:!?)]|$)/g, (whole, name) => { const m = members.find((x) => x.name.toLowerCase() === name.toLowerCase()); return m ? `@{${m.id}}` : whole; });
188
- const id = t.relay({ text, by: { id: me.id, name: me.name, kind: 'ai' }, to, re, kind: kind === 'doing' ? 'doing' : 'say' });
196
+ const id = t.relay({ text, by: { id: me.id, name: me.name, kind: 'ai', look: me.look }, to, re, kind: kind === 'doing' ? 'doing' : 'say' });
189
197
  /* The boxes it is sent to say it aloud (#281): its words, a member named by its name, never an id. */
190
198
  const boxes = to.map((x) => members.find((m) => m.id === x && m.kind === 'box')).filter(Boolean).map((m) => m.ref);
191
199
  if (boxes.length) { const aloud = text.replace(/@\{([0-9a-f-]{36})\}/g, (w, mid) => members.find((x) => x.id === mid)?.name ?? ''); try { this.#speak(`room:${room.id}`, aloud, boxes, { doing: kind === 'doing', asked: kind === 'ask' }); } catch { /* the boxes' */ } }
192
- if (!forwarded && kind !== 'doing') for (const ai of ais) handOver(ai, text, { id: me.id, name: me.name, kind: 'ai' }, id);
200
+ if (!forwarded && kind !== 'doing') for (const ai of ais) handOver(ai, text, { id: me.id, name: me.name, kind: 'ai', look: me.look }, id);
193
201
  return id;
194
202
  }
195
203
 
@@ -198,7 +206,7 @@ export class Rooms {
198
206
  const shown = list.map((r) => ({ ...r, members: this.#shown(r) }));
199
207
  for (const c of this.#conversations()) {
200
208
  const mine = shown.filter((r) => r.members.some((m) => m.kind === 'ai' && m.ref === c.name))
201
- .map((r) => ({ id: r.id, name: r.name, members: r.members.map((m) => ({ id: m.id, name: m.name, kind: m.kind })) }));
209
+ .map((r) => ({ id: r.id, name: r.name, members: r.members.map((m) => ({ id: m.id, name: m.name, kind: m.kind, look: m.look })) }));
202
210
  try { this.#rooms(c.name, mine); } catch { /* its folder is not there yet */ }
203
211
  }
204
212
  }
@@ -37,6 +37,8 @@ export const SETTINGS_WORDS_FR = {
37
37
  'set-na-will': 'Sera relié à {name}', 'set-na-level': 'Ce qu\'il pourra faire', 'set-na-read': 'Lecture', 'set-na-write': 'Écriture',
38
38
  'set-na-made': '{name} créé', 'set-na-made-to': '{name} créé et relié à {to}', 'set-na-another': 'En créer un autre', 'set-na-done': 'Terminé',
39
39
  'set-na-create': 'Créer', 'set-na-new-key': '+ Nouvelle clé…',
40
+ /* The top bar's way back (06-11, kit.js TopBar). */
41
+ 'set-back': 'Retour', 'set-back-convs': 'Conversations',
40
42
  'set-na-k-folder': 'Dossier', 'set-na-k-git': 'Dépôt git', 'set-na-k-mailbox': 'Boîte mail', 'set-na-k-agenda': 'Agenda',
41
43
  'set-na-k-contacts': 'Contacts', 'set-na-k-secret': 'Secret', 'set-na-k-list': 'Classeur',
42
44
  /* Step 4: a voice box and a device, two more kinds of the same box. */
package/web/app.js CHANGED
@@ -408,24 +408,43 @@
408
408
  /* ---------- the list of conversations, folded away or not ---------- */
409
409
  /* One click hides it and the terminal takes the room; one click brings
410
410
  it back. Kept on this device. */
411
- /* THE TOP BAR, ONE COMPONENT (03-11): every page has the conversation's bar -- the button that shows or hides the
412
- list on its left, a state's dot when there is one, its title, and on its right what that page offers (a
413
- conversation: Chat, Terminal, Assets, Binders, its settings; a room: its settings; the others: their own
414
- controls). Built once here from each page's top line: the same element, the same looks, the same place. */
415
- function topBar(top, { state = null } = {}) {
416
- const bar = document.createElement('header'); bar.className = ['topbar', ...[...top.classList].filter((c) => c !== 'panel-top')].join(' ');
417
- const fold = document.createElement('button'); fold.type = 'button'; fold.className = 'fold-here'; fold.title = 'Hide or show the list of conversations';
418
- fold.addEventListener('click', () => $('fold').click());
419
- bar.append(fold);
420
- if (state) { const dot = document.createElement('span'); dot.className = 'bar-state'; dot.id = state; dot.setAttribute('aria-hidden', 'true'); bar.append(dot); }
421
- const title = top.querySelector(':scope > b'); if (title) bar.append(title);
422
- const right = document.createElement('div'); right.className = 'bar-right';
423
- right.append(...[...top.childNodes].filter((n) => n.nodeType === 1));
424
- bar.append(right);
411
+ /* THE TOP BAR, ONE COMPONENT (03-11; 06-11: kit.js TopBar, the same visual everywhere): every page of the right
412
+ pane has the same bar -- the button that shows or hides the list on its left, a state's dot when there is one,
413
+ its title (a line under it when there is one), and on its right what that page offers. Two variants: 'main',
414
+ a conversation or a room (its views, its gear; its "‹" on a narrow screen), and 'sub', a page of its own or
415
+ inside one (its way back, last on the right). Built from each page's own elements: their ids, their gestures. */
416
+ const backSaid = (label) => ({ Back: 'set-back', Conversations: 'set-back-convs' })[label] ?? null;
417
+ function topBar(top, { variant = 'sub', state = null, title = top.querySelector(':scope > b'), sub = null, actions = null } = {}) {
418
+ const close = top.querySelector(':scope > .place-back');
419
+ const label = close ? close.textContent.replace(/^\s*‹\s*/, '').trim() : '';
420
+ const bar = KIT.TopBar({
421
+ variant, fold: true, onFold: () => $('fold').click(), state, title, sub,
422
+ back: close ? { element: close, label, said: backSaid(label) } : null,
423
+ actions: actions ?? [...top.children].filter((n) => n !== title && n !== close),
424
+ cls: [...top.classList].filter((c) => c !== 'panel-top').join(' '),
425
+ });
425
426
  top.replaceWith(bar);
426
427
  return bar;
427
428
  }
428
- for (const top of [...document.querySelectorAll('#places .sheet > .panel-top')]) topBar(top, top.parentElement.id === 'salon' ? { state: 'salon-state' } : {});
429
+ /* A conversation's bar (its page, or a device's: no list to fold; its state in words and its own controls on the right). */
430
+ {
431
+ const old = document.getElementById('room')?.querySelector(':scope > header');
432
+ if (old) old.replaceWith(DEVICE
433
+ ? KIT.TopBar({ variant: 'main', title: $('name'), actions: [...old.children].filter((n) => n.id !== 'name') })
434
+ : KIT.TopBar({ variant: 'main', fold: $('fold'), back: { element: $('back'), label: 'Conversations' }, state: $('state'), title: $('name'), actions: [$('views')] }));
435
+ }
436
+ /* A room (the device page has none): its dot, its name, under it who speaks now and who is in it; its settings
437
+ in the same group of views a conversation's settings sit in; its way back, "‹", as a conversation's (kit: 'main'). */
438
+ if (document.getElementById('salon')) {
439
+ const top = $('salon').querySelector(':scope > .panel-top');
440
+ const t = $('salon-title'); const name = document.createElement('span'); name.id = 'salon-name'; name.textContent = t.textContent; t.replaceChildren(name);
441
+ const live = document.createElement('small'); live.id = 'salon-live'; live.className = 'salon-live'; live.hidden = true;
442
+ const views = document.createElement('div'); views.className = 'views'; views.setAttribute('role', 'group'); views.setAttribute('aria-label', 'Room'); views.append($('salon-settings'));
443
+ const strip = $('salon').querySelector('.salon-bar');
444
+ topBar(top, { variant: 'main', state: { id: 'salon-state' }, sub: [live, $('salon-who')], actions: [views] });
445
+ strip?.remove();
446
+ }
447
+ for (const top of [...document.querySelectorAll('#places .sheet > .panel-top')]) topBar(top, top.parentElement.id === 'salon-new' ? { state: { id: 'salon-new-state' } } : {});
429
448
  /* A SEARCH ATOP A SETTINGS PAGE (05-11): one field in its top bar; what is typed keeps only the chapters (or
430
449
  blocks) whose title or rows say it, opened; the headings left with nothing are hidden. Emptied, all comes back
431
450
  as it was. The server's Settings, a conversation's, and any sheet given the same shape. */
@@ -460,11 +479,6 @@
460
479
  field.addEventListener('keydown', (e) => { if (e.key === 'Escape' && field.value) { e.stopPropagation(); field.value = ''; field.dispatchEvent(new Event('input')); } });
461
480
  };
462
481
  for (const id of ['settings', 'panel']) settingsSearch($(id));
463
- /* A room's title: its name, and under it who speaks now (salonLive). */
464
- /* The device page (/c/) has no rooms sheet (05-11: it stopped app.js there, the page stuck on connecting). */
465
- if ($('salon')) { const t = $('salon-title'); const name = document.createElement('span'); name.id = 'salon-name'; name.textContent = t.textContent; const live = document.createElement('small'); live.id = 'salon-live'; live.className = 'salon-live'; live.hidden = true; t.replaceChildren(name, live); }
466
- /* A room's settings: on its bar's right, in the same group of views a conversation's settings sit in. */
467
- if ($('salon')) { const views = document.createElement('div'); views.className = 'views'; views.setAttribute('role', 'group'); views.setAttribute('aria-label', 'Room'); views.append($('salon-settings')); $('salon').querySelector('.topbar .bar-right')?.prepend(views); }
468
482
  const applyFold = (folded) => {
469
483
  app.dataset.list = folded ? 'folded' : 'open';
470
484
  for (const f of [$('fold'), ...document.querySelectorAll('.fold-here')]) {
@@ -1277,7 +1291,8 @@
1277
1291
  if (c.group) b.dataset.group = c.group;
1278
1292
  /* Ready, but its tool not there yet: it still reads as under way. */
1279
1293
  if (holds(c)) b.dataset.busy = 'true';
1280
- if (c.name === current) b.setAttribute('aria-current', 'true');
1294
+ /* The one open: never a conversation while a room is (06-11: the conversation left before stayed marked). */
1295
+ if (c.name === current && !roomOpenNow()) b.setAttribute('aria-current', 'true');
1281
1296
  if (c.title) b.title = c.name;
1282
1297
  if (c.hidden === true) b.dataset.hidden = 'true';
1283
1298
  if (c.asleep) b.dataset.asleep = 'true';
@@ -5330,6 +5345,8 @@
5330
5345
  const r = rooms.find((x) => x.id === id); if (!r) return;
5331
5346
  enterPlace('salon', push);
5332
5347
  salonLeft(); salonId = id;
5348
+ /* The list marks this room, and no conversation, at once. */
5349
+ paint();
5333
5350
  $('salon-name').textContent = r.name;
5334
5351
  salonLive(thinkingOf(r));
5335
5352
  $('salon-who').replaceChildren(memberChips(r.members), el('span', 'hint', `${countOf(r.members)} \u25BE`));
@@ -5432,6 +5449,8 @@
5432
5449
  salonEditing = editing;
5433
5450
  enterPlace('salon-new', push);
5434
5451
  $('salon-new-title').textContent = editing ? editing.name : 'New room';
5452
+ /* Its settings say its state as the room's bar does; a room to be made has none yet. */
5453
+ const dot = $('salon-new-state'); if (dot) { dot.hidden = !editing; dot.dataset.state = thinkingOf(editing).length ? 'work' : 'ok'; }
5435
5454
  $('salon-new-create').textContent = editing ? 'Save' : 'Create';
5436
5455
  $('salon-new-remove-card').hidden = $('salon-new-advanced-head').hidden = !editing;
5437
5456
  $('salon-new-remove').hidden = false; $('salon-new-remove-card').querySelector('.confirm')?.remove();
@@ -6349,6 +6368,7 @@
6349
6368
  uiSaid): an element marked data-said="key" keeps its English as the fallback. */
6350
6369
  function saySettings() {
6351
6370
  for (const e of document.querySelectorAll('[data-said]')) { e.dataset.en ??= e.textContent; e.textContent = uiSaid(e.dataset.said, e.dataset.en); }
6371
+ for (const e of document.querySelectorAll('[data-said-label]')) { e.dataset.enLabel ??= e.getAttribute('aria-label') ?? ''; const w = uiSaid(e.dataset.saidLabel, e.dataset.enLabel); e.setAttribute('aria-label', w); e.title = w; }
6352
6372
  for (const b of document.querySelectorAll('button.tip-btn')) b.setAttribute('aria-label', uiSaid('set-why', 'Why'));
6353
6373
  const s = document.querySelector('#settings .settings-search'); if (s) s.placeholder = uiSaid('set-search', 'Search');
6354
6374
  const p = document.querySelector('#panel .settings-search'); if (p) p.placeholder = uiSaid('set-search', 'Search');
package/web/kit.js CHANGED
@@ -15,6 +15,8 @@
15
15
  * NewAsset ONE BOX to make an asset (05-11, step 3): kinds, the kind's form, one ending;
16
16
  * opened with a context (a conversation it will be attached to). A voice box and
17
17
  * a device are two of its kinds too (step 4).
18
+ * TopBar THE BAR atop every page of the right-hand pane, two variants: `main` (a conversation, a room:
19
+ * its views on the right) and `sub` (a page of its own or inside one: a way back on the right)
18
20
  * ShareDonut who takes a whole (memory, a disk): a small donut, its slices from shareSlices, the main
19
21
  * figure in its middle; ShareKey, a slice's swatch beside its row in the list
20
22
  *
@@ -269,6 +271,64 @@
269
271
  return root;
270
272
  }
271
273
 
274
+ /* THE TOP BAR (06-11, the owner: « un ou deux composants réutilisables, le même visuel au final »): one bar
275
+ atop every page of the right-hand pane -- a conversation, a room, their settings, Assets, Access, Settings,
276
+ the deck, a new conversation. The same height, padding, type and places everywhere:
277
+ [fold «] [‹ back, main: a narrow screen's] [dot] [title / its one small line under it] .... [actions] [‹ Back, sub]
278
+ variant 'main': a conversation or a room (its views: tabs, its gear); 'sub': a page (a way back, last).
279
+ fold true (a new « button, `onFold`) or the page's own element; null: none (a device's page).
280
+ back { element?, id?, label, said? } (`said`: the page's key for its words, kept on the label).
281
+ state { id?, state?, label? } (a dot drawn here) or the page's own element; null: no state, no dot.
282
+ title words, or the page's element (its id kept); `sub`: words or elements, one line under it.
283
+ actions elements on its right. `cls`: the page's own classes. Ids and listeners of what it is given stay. */
284
+ const addClass = (e, cls) => { e.className = [...new Set(`${e.className ?? ''} ${cls}`.split(/\s+/).filter(Boolean))].join(' '); return e; };
285
+ function TopBar({ variant = 'main', fold = null, onFold = null, back = null, state = null, title = '', sub = null, actions = [], cls = '' } = {}) {
286
+ const v = variant === 'sub' ? 'sub' : 'main';
287
+ const bar = node('header', `topbar kit-topbar${cls ? ` ${cls}` : ''}`); bar.dataset.variant = v;
288
+ if (fold) {
289
+ const f = fold === true ? node('button', 'fold-here', '«') : fold;
290
+ if (fold === true) {
291
+ f.type = 'button'; f.title = say('kit-fold', 'Hide or show the list of conversations');
292
+ f.setAttribute('aria-label', say('kit-fold-hide', 'Hide the list of conversations')); f.setAttribute('aria-pressed', 'false');
293
+ if (onFold) f.addEventListener('click', () => onFold());
294
+ }
295
+ bar.append(addClass(f, 'topbar-fold'));
296
+ }
297
+ let backButton = null;
298
+ if (back) {
299
+ const label = back.label ?? say('kit-back', 'Back');
300
+ backButton = back.element ?? node('button'); backButton.type = 'button';
301
+ if (back.id) backButton.id = back.id;
302
+ if (v === 'main') {
303
+ /* A conversation's or a room's way back: its sign alone, on a narrow screen (wide: the list is there). */
304
+ backButton.className = 'topbar-lead-back'; backButton.textContent = '‹';
305
+ backButton.setAttribute('aria-label', label); backButton.title = label;
306
+ if (back.said) backButton.dataset.saidLabel = back.said;
307
+ bar.append(backButton);
308
+ } else {
309
+ backButton.className = 'as-link place-back topbar-back';
310
+ const words = node('span', 'topbar-back-label', label); if (back.said) words.dataset.said = back.said;
311
+ backButton.replaceChildren('‹ ', words);
312
+ }
313
+ }
314
+ if (state) {
315
+ const dot = state.tagName ? state : node('span', 'bar-state');
316
+ if (dot !== state) { if (state.id) dot.id = state.id; dot.dataset.state = stateOf(state.state ?? 'ok'); dot.setAttribute('aria-hidden', 'true'); if (state.label) dot.title = state.label; }
317
+ bar.append(addClass(dot, 'topbar-dot'));
318
+ }
319
+ const head = node('span', 'topbar-title');
320
+ const name = typeof title === 'string' ? node('b', '', title) : title;
321
+ if (name) head.append(addClass(name, 'topbar-name'));
322
+ const subs = (Array.isArray(sub) ? sub : [sub]).filter((x) => x !== null && x !== undefined && x !== '');
323
+ if (subs.length) { const line = node('span', 'topbar-sub'); line.append(...subs.map((x) => (typeof x === 'string' ? node('small', '', x) : x))); head.append(line); }
324
+ bar.append(head);
325
+ const right = node('div', 'bar-right');
326
+ right.append(...actions.filter(Boolean));
327
+ if (backButton && v === 'sub') right.append(backButton);
328
+ bar.append(right);
329
+ return bar;
330
+ }
331
+
272
332
  /* WHO TAKES IT (06-11): one whole -- a server's memory or a disk -- split by who takes it: each machine
273
333
  (the largest first, at most `max`, the rest folded into "Others"), the rest of the system, and what is
274
334
  free. `parts` [{ key, label, mb }]. A machine keeps its colour while the page lives (`slots`, shared by
@@ -335,6 +395,6 @@
335
395
  shareSlices, ShareDonut, ShareKey,
336
396
  STATES, STATE_WORDS, stateOf, hueOf, initialOf,
337
397
  setWords(fn) { if (typeof fn === 'function') words = fn; },
338
- StatusDot, Avatar, Chips, Switch, Segmented, InlineConfirm, ConvCard, StepFlow, SecretPicker, NewAsset,
398
+ StatusDot, Avatar, Chips, Switch, Segmented, InlineConfirm, ConvCard, StepFlow, SecretPicker, NewAsset, TopBar,
339
399
  };
340
400
  })();
package/web/style.css CHANGED
@@ -1133,7 +1133,6 @@ button.inline:hover { color: var(--brass-ink); }
1133
1133
  html:not([data-door="device"]) #room > header { flex-wrap: nowrap; }
1134
1134
  html:not([data-door="device"]) #room > header #state { flex: 0 0 auto; width: 10px; height: 10px; overflow: hidden; font-size: 0; color: transparent; }
1135
1135
  html:not([data-door="device"]) #room > header #state::before { width: 10px; height: 10px; margin: 0; vertical-align: top; }
1136
- html:not([data-door="device"]) #room > header b#name { flex: 1 1 auto; min-width: 0; font-size: 1rem; }
1137
1136
  .views { display: inline-flex; flex: 0 0 auto; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
1138
1137
  .views button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--ink2); border-radius: 7px; padding: 5px 11px; }
1139
1138
  .views button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
@@ -1391,8 +1390,7 @@ select.pill { appearance: auto; }
1391
1390
  .rv-tree { position: static; max-height: none; }
1392
1391
  }
1393
1392
  @media (max-width: 700px) {
1394
- html:not([data-door="device"]) #room > header { min-height: 44px; padding-block: 3px; }
1395
- html:not([data-door="device"]) #room > header .views button, html:not([data-door="device"]) #room > header #folders, html:not([data-door="device"]) #room > header #back { min-height: 36px; height: 36px; padding: 0 9px; }
1393
+ html:not([data-door="device"]) #room > header .views button, html:not([data-door="device"]) #room > header #folders, html:not([data-door="device"]) #room > header .topbar-lead-back { min-height: 36px; height: 36px; }
1396
1394
  .views { padding: 2px; }
1397
1395
  }
1398
1396
  #copy-close, #files-close, #preview-close { font-size: 1.375rem; line-height: 1; min-width: 40px; padding: 4px 10px; }
@@ -2105,7 +2103,7 @@ details.commit > pre { margin: 6px 0 0 1.6em; white-space: pre-wrap; overflow-wr
2105
2103
  /* ON A TOUCH SCREEN THE SMALL CONTROLS TOO TAKE A FINGERTIP (last, above the rules that make them small):
2106
2104
  the back arrow and «, the round "+", a box to tick and its line, an "i" that opens more, "Show more" under Recent. */
2107
2105
  @media (pointer: coarse) {
2108
- html:not([data-door="device"]) #room > header :is(#back, #fold) { min-width: 40px; }
2106
+ header.topbar > :is(.topbar-fold, .topbar-lead-back) { width: 40px; height: 40px; }
2109
2107
  button.as-add { width: 36px; height: 36px; }
2110
2108
  :is(input[type=checkbox], input[type=radio]):not(.binder *) { width: 20px; height: 20px; }
2111
2109
  .ts-row input[type=checkbox] { width: 24px; height: 24px; }
@@ -2395,28 +2393,48 @@ button.salon-welcome-btn[aria-pressed="true"] { color: var(--brass-ink); border-
2395
2393
  .nc-card > .salon-members-tools { padding-bottom: 4px; }
2396
2394
  .nc-card > .salon-host-box + *, .nc-card > .salon-member-list + * { border-top: 0; }
2397
2395
  /* The list's button on each page of its own (03-11), as the conversation's. */
2398
- /* THE TOP BAR of every page (03-11): the conversation's header, the same element and looks (header {...} above). */
2399
- header.topbar { flex-shrink: 0; }
2400
- /* A place's top bar stays at the top while its page scrolls (05-11), as a conversation's does: the sheet scrolls,
2401
- so the bar sticks to its top edge, over its padding. */
2402
- .sheet > header.topbar { position: sticky; top: -14px; z-index: 5; margin-top: -14px; padding-top: 14px; background: var(--panel); }
2403
- header.topbar > .fold-here { font-size: 1rem; line-height: 1; padding: 4px 9px; flex: none; }
2404
- @media (max-width: 700px) { header.topbar > .fold-here { display: none; } }
2405
- header.topbar > b { flex: 1 1 auto; font-size: 1rem; }
2406
- header.topbar > .bar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
2407
- header.topbar .bar-state { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
2396
+ /* THE TOP BAR of every page (03-11; 06-11: kit.js TopBar, one look everywhere): a conversation's, a room's, their
2397
+ settings', Assets', Access', Settings', the deck's, a new conversation's -- the same height, padding, type, button
2398
+ and places. 'main' (a conversation, a room) has its views on the right; 'sub' (a page) its way back, last. */
2399
+ header.topbar { flex-shrink: 0; flex-wrap: nowrap; gap: 8px; box-sizing: border-box; height: 52px; min-height: 52px; padding: 0 12px; background: var(--bar); border-bottom: 1px solid var(--line); }
2400
+ header.topbar > :is(.topbar-fold, .topbar-lead-back) { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; padding: 0; font-size: 1.125rem; line-height: 1; background: transparent; color: var(--ink2); border: 1px solid var(--line); border-radius: 8px; }
2401
+ header.topbar > :is(.topbar-fold, .topbar-lead-back):hover { color: var(--ink); border-color: var(--ink2); }
2402
+ header.topbar > .topbar-lead-back[hidden] { display: none; }
2403
+ @media (max-width: 700px) { header.topbar > .topbar-fold { display: none; } }
2404
+ @media (min-width: 701px) { header.topbar > .topbar-lead-back { display: none; } }
2405
+ header.topbar .bar-state, html:not([data-door="device"]) header.topbar #state { width: 10px; height: 10px; border-radius: 50%; flex: none; }
2406
+ header.topbar .bar-state { background: var(--ok); }
2407
+ header.topbar .bar-state[hidden] { display: none; }
2408
2408
  /* A room one of whose AIs speaks now: its dot as a conversation's at work, the words under its name. */
2409
2409
  header.topbar .bar-state[data-state="work"] { background: var(--brass); animation: breathe 1.7s ease-in-out infinite; }
2410
- #salon-title { display: flex; flex-direction: column; min-width: 0; }
2410
+ header.topbar > .topbar-title { display: flex; flex-direction: column; justify-content: center; flex: 1 1 auto; min-width: 0; line-height: 1.25; }
2411
+ header.topbar .topbar-name { display: block; flex: none; min-width: 0; max-width: 100%; font-size: 1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2412
+ header.topbar .topbar-sub { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: .75rem; font-weight: 400; color: var(--ink2); overflow: hidden; white-space: nowrap; }
2413
+ header.topbar .topbar-sub > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
2414
+ header.topbar .topbar-sub [hidden] { display: none; }
2415
+ header.topbar > .bar-right { display: flex; align-items: center; gap: 6px; flex: 0 1 auto; flex-wrap: nowrap; min-width: 0; margin-left: auto; }
2416
+ header.topbar .topbar-back { flex: none; min-height: 36px; white-space: nowrap; }
2417
+ header.topbar .views .icon-btn { width: auto; height: auto; }
2418
+ /* Its views (tabs, gear): one height in every bar. */
2419
+ header.topbar .views button { height: 32px; min-height: 32px; padding-block: 0; }
2420
+ @media (max-width: 700px) { header.topbar { height: 48px; min-height: 48px; padding: 0 8px; gap: 6px; } }
2421
+ /* A device's page (/c/): the same bar, its own controls may take a second line on a narrow screen (its menu "..."). */
2422
+ html[data-door="device"] header.topbar { height: auto; }
2423
+ /* A place's top bar stays at the top while its page scrolls (05-11), edge to edge over the page's own margins.
2424
+ (A page with a bar starts at its bar: no margin above it, so it sticks where it rests.) */
2425
+ :is(.sheet, #newconv, #salon-new):has(> header.topbar) { padding-top: 0; }
2426
+ .sheet > header.topbar { position: sticky; top: 0; z-index: 5; margin: 0 -14px 4px; }
2427
+ .sheet.as-place > header.topbar { margin: 0; }
2428
+ :is(#newconv, #salon-new) > header.topbar { margin: 0 -20px 4px; }
2429
+ @media (max-width: 700px) { #newconv > header.topbar { margin: 0 -16px 4px; } }
2430
+ /* A room: its name, who speaks now and who is in it on the line under it (a button that opens the list). */
2411
2431
  #salon-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2412
2432
  .salon-live { font-size: .75rem; font-weight: 400; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
2413
2433
  .salon-live[hidden] { display: none; }
2414
- header.topbar .views .icon-btn { width: auto; height: auto; }
2415
- /* Pages with margins of their own: their bar goes edge to edge, as a conversation's. */
2416
- #places .sheet:not(.as-place) > header.topbar { margin: -14px -14px 4px; }
2417
- #newconv > header.topbar { margin: -14px -20px 4px; }
2418
- #salon-new > header.topbar { margin: -14px -20px 4px; }
2419
- @media (max-width: 700px) { #newconv > header.topbar { margin: -12px -16px 4px; } }
2434
+ header.topbar .topbar-sub .salon-who { display: inline-flex; align-items: center; gap: 6px; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--ink2); font: inherit; cursor: pointer; }
2435
+ header.topbar .topbar-sub .salon-who:hover { color: var(--ink); }
2436
+ header.topbar .topbar-sub .salon-chip { width: 15px; height: 15px; margin-left: -4px; border-width: 1px; font-size: .5625rem; }
2437
+ header.topbar .topbar-sub .salon-chip:first-child { margin-left: 0; }
2420
2438
  /* A room's row in the list (03-11): a conversation's row, with a small sign of a room before its name (Lucide « users »). */
2421
2439
  .room-sign { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; background: var(--ink2);
2422
2440
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E") center / contain no-repeat;