clavarium 0.2.317-next.1 → 0.2.319-next.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.
- package/npm-shrinkwrap.json +6 -6
- package/package.json +2 -2
- package/server/main.mjs +1 -0
- package/web/app.js +79 -96
- package/web/device.html +1 -0
- package/web/index.html +1 -0
- package/web/kit.js +152 -0
- package/web/style.css +65 -33
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.319-next.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "clavarium",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.319-next.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.60-next.1",
|
|
15
15
|
"clavarium-docket": "0.1.2-next.2",
|
|
16
|
-
"clavarium-parley": "0.17.
|
|
16
|
+
"clavarium-parley": "0.17.67-next.1",
|
|
17
17
|
"clavarium-tether": "0.1.0-next.49",
|
|
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.
|
|
791
|
-
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.
|
|
792
|
-
"integrity": "sha512-
|
|
790
|
+
"version": "0.17.67-next.1",
|
|
791
|
+
"resolved": "https://registry.npmjs.org/clavarium-parley/-/clavarium-parley-0.17.67-next.1.tgz",
|
|
792
|
+
"integrity": "sha512-6dQaElIA0BJi8ruT6uS8k+eRstjnBqVbwKLWZxsJwH6PVtr1CVQ7/9KzUuKabc5+PN+v8oBFFE8iZh4HHYq3qQ==",
|
|
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.
|
|
3
|
+
"version": "0.2.319-next.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.60-next.1",
|
|
48
48
|
"clavarium-docket": "0.1.2-next.2",
|
|
49
|
-
"clavarium-parley": "0.17.
|
|
49
|
+
"clavarium-parley": "0.17.67-next.1",
|
|
50
50
|
"clavarium-tether": "0.1.0-next.49",
|
|
51
51
|
"mammoth": "1.13.0",
|
|
52
52
|
"mermaid": "11.17.2",
|
package/server/main.mjs
CHANGED
|
@@ -101,6 +101,7 @@ export const FILES = {
|
|
|
101
101
|
'/icons.js': ['web/icons.js', 'text/javascript; charset=utf-8'],
|
|
102
102
|
'/links.js': ['web/links.js', 'text/javascript; charset=utf-8'],
|
|
103
103
|
'/features.js': ['web/features.js', 'text/javascript; charset=utf-8'],
|
|
104
|
+
'/kit.js': ['web/kit.js', 'text/javascript; charset=utf-8'],
|
|
104
105
|
'/gitgraph.js': ['web/gitgraph.js', 'text/javascript; charset=utf-8'],
|
|
105
106
|
/* The page shown while an update stops this server (app.js goes to it); the front serves the same file while it is down. */
|
|
106
107
|
'/maintenance.html': [MAINTENANCE, 'text/html; charset=utf-8'],
|
package/web/app.js
CHANGED
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
/* A paired device gets the same page with less in it, and asks its own
|
|
19
19
|
door: see server/door.mjs. */
|
|
20
20
|
const DEVICE = document.documentElement.dataset.door === 'device';
|
|
21
|
+
/* THE KIT (kit.js): the pieces every screen shares -- the state's point, the conversation's card... */
|
|
22
|
+
const KIT = window.clavariumKit;
|
|
21
23
|
/* On a paired device, every request names the pairing it speaks for:
|
|
22
24
|
the address is completed once the device has signed in. */
|
|
23
25
|
let API = DEVICE ? '/c/api' : '/api';
|
|
@@ -1147,11 +1149,11 @@
|
|
|
1147
1149
|
: (holds(c) || ['building', 'restarting', 'moving'].includes(c.phase)) ? 'busy' : 'online');
|
|
1148
1150
|
const agentState = (c) => (c.asleep ? 'sleep' : (talkNeeds(c) || c.answerer?.needs) ? 'wait'
|
|
1149
1151
|
: c.talk?.state === 'working' ? 'work' : c.talk?.state === 'done' ? 'done' : 'idle');
|
|
1150
|
-
const STATE_WORDS =
|
|
1152
|
+
const STATE_WORDS = KIT.STATE_WORDS;
|
|
1151
1153
|
const rollup = (c) => { const m = machineState(c); const a = agentState(c);
|
|
1152
1154
|
return (m === 'off' ? 'sleep' : m === 'problem' ? 'problem' : a === 'wait' ? 'wait' : a === 'work' ? 'work' : m === 'busy' ? 'busy' : 'ok'); };
|
|
1153
|
-
const statePoint = (state) =>
|
|
1154
|
-
const STATE_ORDER =
|
|
1155
|
+
const statePoint = (state) => KIT.StatusDot({ state });
|
|
1156
|
+
const STATE_ORDER = KIT.STATES;
|
|
1155
1157
|
function stateSummary(list) {
|
|
1156
1158
|
const count = Object.fromEntries(STATE_ORDER.map((k) => [k, 0]));
|
|
1157
1159
|
for (const c of list) count[rollup(c)] += 1;
|
|
@@ -1238,49 +1240,48 @@
|
|
|
1238
1240
|
if (d.toDateString() === y.toDateString()) return 'yesterday';
|
|
1239
1241
|
return now - d < 6 * 86_400_000 ? d.toLocaleDateString([], { weekday: 'short' }) : d.toLocaleDateString([], { day: 'numeric', month: 'short' });
|
|
1240
1242
|
};
|
|
1243
|
+
/* ONE CONVERSATION, as the kit draws it everywhere (kit.js ConvCard): what is known of it, said once --
|
|
1244
|
+
its name, its point, what it does now, its last words and when, its chips. `told`: its last words and
|
|
1245
|
+
when (a row of Needs you or Recent; a card). */
|
|
1246
|
+
const agentWho = (c) => [c.chatName, c.toolLabel ?? c.tool].filter(Boolean).join(' \u00b7 ');
|
|
1247
|
+
function convModel(c, told = false) {
|
|
1248
|
+
/* Under way: the step the panel shows, in its words (the tool named once). */
|
|
1249
|
+
const under = c.progress && ['building', 'restarting', 'ready'].includes(c.phase) ? stepNow(c.progress, c.toolLabel) : '';
|
|
1250
|
+
/* What it is doing, when it says something: its tool is not named on every row. */
|
|
1251
|
+
const now = under || (holds(c) && c.phase !== 'building' ? (c.progress.kind === 'build' ? 'starting' : 'restarting') : c.phase === 'ready' ? (c.asleep ? 'asleep, wakes when opened' : '') : c.phase === 'building' ? (c.step ?? 'building') : c.phase === 'moving' ? 'moving its work' : c.phase === 'restarting' ? 'restarting' : 'failed');
|
|
1252
|
+
/* The line of its tool only when it says something: under way, asleep, failed -- not "Claude Code" again and again. */
|
|
1253
|
+
const plain = c.phase === 'ready' && !c.asleep && !under && !holds(c);
|
|
1254
|
+
const chips = [];
|
|
1255
|
+
/* Found by a search while hidden: said. */
|
|
1256
|
+
if (c.hidden === true && query) chips.push({ text: 'hidden', cls: 'shared-mark', tone: 'note' });
|
|
1257
|
+
/* Several models answer its simple questions; or they stopped, and it waits for its owner. */
|
|
1258
|
+
const waking = (c.wakeups?.items ?? []).filter((w) => w.on).length;
|
|
1259
|
+
if (waking > 0) chips.push({ text: `${waking} wake-up${waking > 1 ? 's' : ''}`, cls: 'shared-mark', tone: 'note' });
|
|
1260
|
+
/* It talks through the app, and asks or waits for its owner there. */
|
|
1261
|
+
if (!c.asleep && talkNeeds(c)) chips.push({ text: c.talk.waiting > 0 ? 'asks you' : 'waits for you', cls: 'needs-mark', tone: 'need' });
|
|
1262
|
+
if (c.answerer?.on) { const needs = c.answerer.needs && !c.asleep; chips.push({ text: needs ? 'asks for you' : 'answered in your place', cls: needs ? 'needs-mark' : 'shared-mark', tone: needs ? 'need' : 'note' }); }
|
|
1263
|
+
/* Where else it speaks: its rooms, its voice boxes (said on a card). */
|
|
1264
|
+
for (const r of roomsNow()) if (r.members?.some((m) => m.kind === 'ai' && m.ref === c.name)) chips.push({ text: r.name, icon: 'room', wide: true });
|
|
1265
|
+
for (const b of boxesNow()) if (b.conversation === c.name) chips.push({ text: b.name, icon: 'box', wide: true });
|
|
1266
|
+
/* Its last message. The agent is the usual speaker, so its name is left off (just the words); only
|
|
1267
|
+
the person's own last word is marked "You:", which tells you it is your move. */
|
|
1268
|
+
const last = told && c.talk?.lastText ? (c.talk.lastFrom === 'person' ? `You: ${c.talk.lastText}` : c.talk.lastText) : '';
|
|
1269
|
+
const state = rollup(c);
|
|
1270
|
+
return { title: shownName(c), state, stateLabel: STATE_WORDS[state], avatar: { name: shownName(c) }, when: told ? whenWords(activityOf(c)) : '', last, now: plain ? '' : now, who: agentWho(c), chips };
|
|
1271
|
+
}
|
|
1241
1272
|
/* `copy`: a row of Needs you or Recent, beside its place in its group: it is not moved by hand.
|
|
1242
1273
|
`told`: it says what was said last, and when (a copy always; the one list when there is no group). */
|
|
1243
1274
|
function itemButton(c, copy = false, told = copy) {
|
|
1244
|
-
const b =
|
|
1245
|
-
b.
|
|
1275
|
+
const b = KIT.ConvCard(convModel(c, told), { size: 'row', cls: copy ? 'item copy' : 'item' });
|
|
1276
|
+
b.dataset.phase = c.phase; b.dataset.name = c.name;
|
|
1246
1277
|
if (c.group) b.dataset.group = c.group;
|
|
1247
1278
|
/* Ready, but its tool not there yet: it still reads as under way. */
|
|
1248
1279
|
if (holds(c)) b.dataset.busy = 'true';
|
|
1249
1280
|
if (c.name === current) b.setAttribute('aria-current', 'true');
|
|
1250
|
-
const title = document.createElement('b');
|
|
1251
|
-
title.append(shownName(c));
|
|
1252
1281
|
if (c.title) b.title = c.name;
|
|
1253
1282
|
if (c.hidden === true) b.dataset.hidden = 'true';
|
|
1254
|
-
const sub = document.createElement('small');
|
|
1255
|
-
/* Under way: the step the panel shows, in its words (the tool named once). */
|
|
1256
|
-
const under = c.progress && ['building', 'restarting', 'ready'].includes(c.phase) ? stepNow(c.progress, c.toolLabel) : '';
|
|
1257
|
-
/* What it is doing, when it says something: its tool is not named on every row. */
|
|
1258
|
-
sub.textContent = under || (holds(c) && c.phase !== 'building' ? (c.progress.kind === 'build' ? 'starting' : 'restarting') : c.phase === 'ready' ? (c.asleep ? 'asleep, wakes when opened' : '') : c.phase === 'building' ? (c.step ?? 'building') : c.phase === 'moving' ? 'moving its work' : c.phase === 'restarting' ? 'restarting' : 'failed');
|
|
1259
1283
|
if (c.asleep) b.dataset.asleep = 'true';
|
|
1260
|
-
|
|
1261
|
-
const plain = c.phase === 'ready' && !c.asleep && !under && !holds(c);
|
|
1262
|
-
if (told) {
|
|
1263
|
-
/* In words, not a symbol: what a tap on it will do. */
|
|
1264
|
-
/* Beside its name, never in it: the name reads (and is read) as it is. */
|
|
1265
|
-
const when = document.createElement('small'); when.className = 'when'; when.textContent = whenWords(activityOf(c));
|
|
1266
|
-
b.append(title);
|
|
1267
|
-
/* Its last message, and who said it: so it reads as the last message, not as a subject. */
|
|
1268
|
-
/* Its last message. The agent is the usual speaker, so its name is left off (just the words); only
|
|
1269
|
-
the person's own last word is marked "You:", which tells you it is your move. */
|
|
1270
|
-
if (c.talk?.lastText) { const last = document.createElement('small'); last.className = 'last'; last.textContent = c.talk.lastFrom === 'person' ? `You: ${c.talk.lastText}` : c.talk.lastText; b.append(last); }
|
|
1271
|
-
if (!plain) b.append(sub);
|
|
1272
|
-
b.append(when); b.dataset.when = 'true';
|
|
1273
|
-
} else b.append(title, ...(plain ? [] : [sub]));
|
|
1274
|
-
/* Its state: one point, on the right. */
|
|
1275
|
-
const point = statePoint(rollup(c)); point.title = STATE_WORDS[point.dataset.state]; b.append(point);
|
|
1276
|
-
/* Found by a search while hidden: said. */
|
|
1277
|
-
if (c.hidden === true && query) { const mark = document.createElement('small'); mark.className = 'shared-mark'; mark.textContent = 'hidden'; b.append(mark); }
|
|
1278
|
-
/* Several models answer its simple questions; or they stopped, and it waits for its owner. */
|
|
1279
|
-
const waking = (c.wakeups?.items ?? []).filter((w) => w.on).length;
|
|
1280
|
-
if (waking > 0) { const mark = document.createElement('small'); mark.className = 'shared-mark'; mark.textContent = `${waking} wake-up${waking > 1 ? 's' : ''}`; b.append(mark); }
|
|
1281
|
-
/* It talks through the app, and asks or waits for its owner there. */
|
|
1282
|
-
if (!c.asleep && talkNeeds(c)) { const mark = document.createElement('small'); mark.className = 'needs-mark'; mark.textContent = c.talk.waiting > 0 ? 'asks you' : 'waits for you'; b.append(mark); }
|
|
1283
|
-
if (c.answerer?.on) { const needs = c.answerer.needs && !c.asleep; const mark = document.createElement('small'); mark.className = needs ? 'needs-mark' : 'shared-mark'; mark.textContent = needs ? 'asks for you' : 'answered in your place'; b.append(mark); }
|
|
1284
|
+
if (told) b.dataset.when = 'true';
|
|
1284
1285
|
/* Who else holds it is said in its Access, not in the list (where it said the same on every row). */
|
|
1285
1286
|
b.addEventListener('click', () => select(c.name, { step: true }));
|
|
1286
1287
|
return b;
|
|
@@ -1292,6 +1293,8 @@
|
|
|
1292
1293
|
/* A ROOM IN THE LIST (03-11): like a conversation's row -- its name, its last words, when -- a room's chips before it. */
|
|
1293
1294
|
/* The rooms known, even before their part of this page has run (a list painted early). */
|
|
1294
1295
|
const roomsNow = () => { try { return Array.isArray(rooms) ? rooms : []; } catch { return []; } };
|
|
1296
|
+
/* The voice boxes known (read with the deck and a room's settings): the chips of whom they speak for. */
|
|
1297
|
+
const boxesNow = () => { try { return Array.isArray(boxesKnown) ? boxesKnown : []; } catch { return []; } };
|
|
1295
1298
|
const roomOpenNow = () => { try { return place === 'salon' ? salonId : ''; } catch { return ''; } };
|
|
1296
1299
|
/* Words of the screen's language (Parley's texts, /api/talk/words) once read; English till then. */
|
|
1297
1300
|
const uiSaid = (key, fallback, vars = {}) => {
|
|
@@ -1304,23 +1307,29 @@
|
|
|
1304
1307
|
/* ROOMS ONLY (a filter of the list): kept on this device. */
|
|
1305
1308
|
let roomsOnly = false;
|
|
1306
1309
|
try { roomsOnly = localStorage.getItem('clavarium-list-show') === 'rooms'; } catch { /* a private window */ }
|
|
1310
|
+
/* A ROOM, drawn as a conversation (kit.js ConvCard): its sign for an initial, its last words or who speaks,
|
|
1311
|
+
when; its point: new words waiting (the colour of what waits for you), else at work while one speaks, else fine. */
|
|
1312
|
+
function roomModel(r) {
|
|
1313
|
+
const who = thinkingOf(r);
|
|
1314
|
+
const sign = document.createElement('span'); sign.className = 'room-sign';
|
|
1315
|
+
const state = r.unread > 0 ? 'wait' : who.length ? 'work' : 'ok';
|
|
1316
|
+
const chips = [];
|
|
1317
|
+
if (r.unread > 0) chips.push({ text: r.unread > 99 ? '99+' : String(r.unread), tone: 'count', title: `${r.unread} new` });
|
|
1318
|
+
for (const b of boxesNow()) if (b.conversation === `room:${r.id}`) chips.push({ text: b.name, icon: 'box', wide: true });
|
|
1319
|
+
return {
|
|
1320
|
+
title: r.name, state, stateLabel: r.unread > 0 ? `${r.unread} new` : who.length ? speaking(who) : 'Room', avatar: { name: r.name, glyph: sign },
|
|
1321
|
+
last: who.length || r.last ? (who.length ? speaking(who) : `${r.last.by ? `${r.last.by}: ` : ''}${r.last.text}`) : '',
|
|
1322
|
+
when: r.last ? whenWords(Date.parse(r.last.at)) : '',
|
|
1323
|
+
now: r.last || who.length ? '' : `Room \u00b7 ${countOf(r.members ?? [])}`,
|
|
1324
|
+
chips,
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1307
1327
|
function roomItem(r) {
|
|
1308
|
-
/* The same row as a conversation's (03-11: « de même nature »)
|
|
1309
|
-
|
|
1310
|
-
const b = document.createElement('button'); b.type = 'button'; b.className = 'item room-item'; b.dataset.room = r.id;
|
|
1311
|
-
const title = document.createElement('b');
|
|
1312
|
-
const sign = document.createElement('span'); sign.className = 'room-sign'; sign.setAttribute('aria-hidden', 'true');
|
|
1313
|
-
title.append(sign, r.name);
|
|
1314
|
-
b.append(title);
|
|
1328
|
+
/* The same row as a conversation's (03-11: « de même nature »), told apart by its room sign. */
|
|
1329
|
+
const b = KIT.ConvCard(roomModel(r), { size: 'row', cls: 'item room-item' }); b.dataset.room = r.id;
|
|
1315
1330
|
/* One of its AIs speaking now: said instead of its last message (a conversation at work: its dot, gold). */
|
|
1316
|
-
|
|
1317
|
-
if (
|
|
1318
|
-
if (r.last || who.length) {
|
|
1319
|
-
const last = document.createElement('small'); last.className = 'last'; last.textContent = who.length ? speaking(who) : `${r.last.by ? `${r.last.by}: ` : ''}${r.last.text}`; b.append(last);
|
|
1320
|
-
if (r.last) { const when = document.createElement('small'); when.className = 'when'; when.textContent = whenWords(Date.parse(r.last.at)); b.append(when); b.dataset.when = 'true'; }
|
|
1321
|
-
} else { const sub = document.createElement('small'); sub.textContent = `Room \u00b7 ${r.members.filter((m) => m.kind === 'ai').length} AIs`; b.append(sub); }
|
|
1322
|
-
/* Its dot: new words in it waiting (the colour of what waits for you), else at work while one speaks, else ready. */
|
|
1323
|
-
const point = statePoint(r.unread > 0 ? 'wait' : who.length ? 'work' : 'ready'); point.title = r.unread > 0 ? `${r.unread} new` : who.length ? speaking(who) : 'Room'; b.append(point);
|
|
1331
|
+
if (thinkingOf(r).length) b.dataset.live = 'true';
|
|
1332
|
+
if (r.last) b.dataset.when = 'true';
|
|
1324
1333
|
if (r.id === roomOpenNow()) b.setAttribute('aria-current', 'true');
|
|
1325
1334
|
b.addEventListener('click', () => { void openSalon(r.id); });
|
|
1326
1335
|
return b;
|
|
@@ -5288,51 +5297,29 @@
|
|
|
5288
5297
|
}
|
|
5289
5298
|
async function openAssets() { await openAssetsPlace(); }
|
|
5290
5299
|
/* ---------- the conversations as cards (02-11) ---------- */
|
|
5291
|
-
/* ONE CONVERSATION AS A CARD
|
|
5292
|
-
(its colours drawn from its name, its initial), its agent and its tool, its last word. Reusable: any
|
|
5293
|
-
page that shows conversations as things to pick or move takes it. `onOpen(c)`. */
|
|
5300
|
+
/* ONE CONVERSATION AS A CARD (the home deck): the kit's card, its last words and when, its rooms and boxes. `onOpen(c)`. */
|
|
5294
5301
|
function convCard(c, onOpen) {
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
const card = el('button', 'conv-card'); card.type = 'button'; card.dataset.name = c.name;
|
|
5298
|
-
const state = c.asleep ? 'asleep' : c.talk?.state === 'waiting' || (c.talk?.waiting ?? 0) > 0 ? 'waits' : c.phase === 'ready' ? 'ready' : 'busy';
|
|
5299
|
-
const plate = el('span', 'conv-card-plate'); const dot = el('span', 'conv-card-dot'); dot.dataset.state = state;
|
|
5300
|
-
plate.append(dot, el('b', '', shownName(c)));
|
|
5301
|
-
const art = el('span', 'conv-card-art'); art.style.setProperty('--h', String(hue));
|
|
5302
|
-
art.append(el('span', 'conv-card-initial', (shownName(c).trim()[0] ?? '?').toUpperCase()));
|
|
5303
|
-
const kind = el('span', 'conv-card-type', [c.chatName, c.toolLabel ?? c.tool].filter(Boolean).join(' · '));
|
|
5304
|
-
const text = el('span', 'conv-card-text');
|
|
5305
|
-
if (c.talk?.lastText) text.append(el('i', '', c.talk.lastText));
|
|
5306
|
-
text.append(el('small', '', c.asleep ? 'Asleep' : state === 'waits' ? 'Waits for you' : c.talk?.lastAt ? cardAgo(c.talk.lastAt) : c.phase === 'ready' ? 'Ready' : (c.step || c.phase || '')));
|
|
5307
|
-
card.append(plate, art, kind, text);
|
|
5308
|
-
card.setAttribute('aria-label', `${shownName(c)}, ${kind.textContent}`);
|
|
5309
|
-
card.addEventListener('click', () => onOpen(c));
|
|
5302
|
+
const card = KIT.ConvCard(convModel(c, true), { size: 'card', cls: 'conv-card', onOpen: () => onOpen(c) });
|
|
5303
|
+
card.dataset.name = c.name;
|
|
5310
5304
|
return card;
|
|
5311
5305
|
}
|
|
5312
|
-
const cardAgo = (at) => { const s = Math.max(0, (Date.now() - Date.parse(at)) / 1000); return s < 90 ? 'Just now' : s < 5400 ? `${Math.round(s / 60)} min ago` : s < 129600 ? `${Math.round(s / 3600)} h ago` : `${Math.round(s / 86400)} days ago`; };
|
|
5313
5306
|
/* ---------- ROOMS (#268): one thread for several AIs, the person and boxes ---------- */
|
|
5314
5307
|
let rooms = [];
|
|
5308
|
+
let boxesKnown = [];
|
|
5309
|
+
const loadBoxes = async () => { if (DEVICE) return boxesKnown; try { const r = await fetch(`${API}/boxes`); if (r.ok) { const got = await r.json(); boxesKnown = Array.isArray(got) ? got : []; } } catch { /* kept as known */ } return boxesKnown; };
|
|
5315
5310
|
const loadRooms = async () => { try { const r = await fetch(`${API}/rooms`); rooms = r.ok ? await r.json() : []; } catch { rooms = []; } return rooms; };
|
|
5316
|
-
const huePick =
|
|
5311
|
+
const huePick = KIT.hueOf;
|
|
5317
5312
|
/* Its members as small chips, each by its shape: a person round, an AI a rounded square, a box an outline. */
|
|
5318
5313
|
const memberChips = (members, max = 7) => {
|
|
5319
5314
|
const stack = el('span', 'salon-stack');
|
|
5320
|
-
for (const m of members.slice(0, max)) { const i = el('i', `salon-chip salon-chip-${m.kind}`, m.kind === 'box' ? '' : (m.name
|
|
5315
|
+
for (const m of members.slice(0, max)) { const i = el('i', `salon-chip salon-chip-${m.kind}`, m.kind === 'box' ? '' : KIT.initialOf(m.name)); if (m.kind !== 'box') i.style.setProperty('--h', String(huePick(m.name))); i.title = m.name; stack.append(i); }
|
|
5321
5316
|
return stack;
|
|
5322
5317
|
};
|
|
5323
5318
|
const countOf = (members) => { const n = (k) => members.filter((m) => m.kind === k).length; const say = (k, one, many) => (n(k) ? `${n(k)} ${n(k) > 1 ? many : one}` : ''); return [say('person', 'person', 'people'), say('ai', 'AI', 'AIs'), say('box', 'box', 'boxes')].filter(Boolean).join(' \u00b7 '); };
|
|
5324
|
-
/* A ROOM AS A CARD:
|
|
5319
|
+
/* A ROOM AS A CARD: the kit's card, as a conversation's (a card behind it says it holds several). */
|
|
5325
5320
|
function roomCard(r) {
|
|
5326
|
-
const card =
|
|
5327
|
-
|
|
5328
|
-
plate.append(dot, el('b', '', r.name));
|
|
5329
|
-
/* What came since it was last opened (#282). */
|
|
5330
|
-
if (r.unread > 0) { const n = el('span', 'salon-unread', String(r.unread > 99 ? '99+' : r.unread)); n.setAttribute('aria-label', `${r.unread} new`); plate.append(n); dot.dataset.state = 'waits'; }
|
|
5331
|
-
const art = el('span', 'conv-card-art'); art.style.setProperty('--h', String(huePick(r.name)));
|
|
5332
|
-
art.append(el('span', 'conv-card-initial', '\u2302'), memberChips(r.members));
|
|
5333
|
-
card.append(plate, art, el('span', 'conv-card-type', `Room \u00b7 ${countOf(r.members)}`), el('span', 'conv-card-text'));
|
|
5334
|
-
card.setAttribute('aria-label', `${r.name}, room`);
|
|
5335
|
-
card.addEventListener('click', () => { void openSalon(r.id); });
|
|
5321
|
+
const card = KIT.ConvCard(roomModel(r), { size: 'card', cls: 'conv-card conv-card-room', onOpen: () => { void openSalon(r.id); } });
|
|
5322
|
+
card.dataset.room = r.id;
|
|
5336
5323
|
return card;
|
|
5337
5324
|
}
|
|
5338
5325
|
let salonThread = null; let salonId = ''; let salonTimer = null;
|
|
@@ -5364,8 +5351,7 @@
|
|
|
5364
5351
|
/* Who was given a message and has not answered yet (#282): « Hugo réfléchit… ». */
|
|
5365
5352
|
const who = thinkingOf(d);
|
|
5366
5353
|
$('salon-thinking').hidden = who.length === 0;
|
|
5367
|
-
$('salon-thinking').replaceChildren(
|
|
5368
|
-
$('salon-thinking').firstChild.dataset.state = 'work';
|
|
5354
|
+
$('salon-thinking').replaceChildren(KIT.StatusDot({ state: 'work' }), document.createTextNode(who.length > 1 ? uiSaid('room-thinking-many', '{names} are thinking\u2026', { names: who.join(', ') }) : uiSaid('room-thinking', '{name} is thinking\u2026', { name: who[0] ?? '' })));
|
|
5369
5355
|
/* Its bar says it too, as its row in the list: its dot at work, « Cuisine parle… » under its name. */
|
|
5370
5356
|
salonLive(who);
|
|
5371
5357
|
const known = rooms.find((x) => x.id === id);
|
|
@@ -5389,31 +5375,27 @@
|
|
|
5389
5375
|
room or not) and « Welcomes »; a search; a row dragged into the box above welcomes too. Boxes: the same rows,
|
|
5390
5376
|
with a switch only. `editing`: the room, or null for a new one. */
|
|
5391
5377
|
let salonIn = new Set(); let salonHost = ''; let salonBoxes = new Set(); let salonEditing = null; let salonBoxList = [];
|
|
5392
|
-
|
|
5393
|
-
const salonWho = (c) => [c.chatName, c.toolLabel ?? c.tool].filter(Boolean).join(' \u00b7 ') || 'AI';
|
|
5378
|
+
/* Every conversation as a member: the kit's card, its size `member`, its gestures (Welcomes, in the room) at its end. */
|
|
5394
5379
|
function paintSalonMembers() {
|
|
5395
5380
|
const hostC = conversations.find((c) => c.name === salonHost);
|
|
5396
5381
|
const box = $('salon-new-host'); box.replaceChildren();
|
|
5397
|
-
if (hostC)
|
|
5382
|
+
if (hostC) box.append(KIT.ConvCard({ ...convModel(hostC), now: 'answers, or hands the message on' }, { size: 'member', cls: 'salon-host-what' }));
|
|
5398
5383
|
else box.append(el('small', 'hint', 'Pick one below: « Welcomes »'));
|
|
5399
5384
|
const q = $('salon-new-search').value.trim().toLowerCase();
|
|
5400
5385
|
const rows = conversations.filter((c) => !q || `${shownName(c)} ${c.chatName ?? ''}`.toLowerCase().includes(q)).sort((a, b) => Number(salonIn.has(b.name)) - Number(salonIn.has(a.name)));
|
|
5401
5386
|
$('salon-new-ais').replaceChildren(...rows.map((c) => {
|
|
5402
|
-
const row = el('div', 'salon-member-row'); row.setAttribute('role', 'listitem'); row.draggable = true; row.dataset.name = c.name;
|
|
5403
|
-
const what = el('span', 'salon-member-what'); what.append(el('b', '', shownName(c)), el('small', '', salonWho(c)));
|
|
5404
5387
|
const welcome = el('button', 'salon-welcome-btn', 'Welcomes'); welcome.type = 'button'; welcome.setAttribute('aria-pressed', String(c.name === salonHost)); welcome.setAttribute('aria-label', `${shownName(c)} welcomes the room`);
|
|
5405
5388
|
welcome.addEventListener('click', () => { salonIn.add(c.name); salonHost = c.name; paintSalonMembers(); });
|
|
5406
|
-
const sw =
|
|
5407
|
-
|
|
5408
|
-
row.
|
|
5389
|
+
const sw = KIT.Switch({ on: salonIn.has(c.name), label: `${shownName(c)} in the room`, onChange: (on) => { if (!on) { salonIn.delete(c.name); if (salonHost === c.name) salonHost = [...salonIn][0] ?? ''; } else { salonIn.add(c.name); if (!salonHost) salonHost = c.name; } paintSalonMembers(); } });
|
|
5390
|
+
const row = KIT.ConvCard(convModel(c), { size: 'member', cls: 'salon-member-row', actions: [welcome, sw] });
|
|
5391
|
+
row.setAttribute('role', 'listitem'); row.draggable = true; row.dataset.name = c.name;
|
|
5409
5392
|
return row;
|
|
5410
5393
|
}));
|
|
5411
5394
|
$('salon-new-count').textContent = `\u00b7 ${salonIn.size} in the room`;
|
|
5412
5395
|
$('salon-new-boxes').replaceChildren(...salonBoxList.map((b) => {
|
|
5413
5396
|
const row = el('div', 'salon-member-row'); row.setAttribute('role', 'listitem');
|
|
5414
5397
|
const what = el('span', 'salon-member-what'); what.append(el('b', '', b.name), el('small', '', b.place || 'Voice box'));
|
|
5415
|
-
const sw =
|
|
5416
|
-
sw.addEventListener('click', () => { if (salonBoxes.has(b.id)) salonBoxes.delete(b.id); else salonBoxes.add(b.id); paintSalonMembers(); });
|
|
5398
|
+
const sw = KIT.Switch({ on: salonBoxes.has(b.id), label: `${b.name} in the room`, onChange: (on) => { if (on) salonBoxes.add(b.id); else salonBoxes.delete(b.id); paintSalonMembers(); } });
|
|
5417
5399
|
row.append(what, sw);
|
|
5418
5400
|
return row;
|
|
5419
5401
|
}));
|
|
@@ -5437,6 +5419,7 @@
|
|
|
5437
5419
|
salonHost = editing?.members.find((m) => m.host)?.ref ?? '';
|
|
5438
5420
|
salonBoxes = new Set(editing ? editing.members.filter((m) => m.kind === 'box').map((m) => m.ref) : []);
|
|
5439
5421
|
try { const x = await fetch(`${API}/boxes`); salonBoxList = x.ok ? await x.json() : []; } catch { salonBoxList = []; }
|
|
5422
|
+
if (Array.isArray(salonBoxList)) boxesKnown = salonBoxList; else salonBoxList = [];
|
|
5440
5423
|
$('salon-new-boxes-card').hidden = $('salon-new-voice-head').hidden = salonBoxList.length === 0;
|
|
5441
5424
|
paintSalonMembers();
|
|
5442
5425
|
$('salon-new-name').focus();
|
|
@@ -5524,7 +5507,7 @@
|
|
|
5524
5507
|
paint();
|
|
5525
5508
|
$('deck-cards').hidden = list.length === 0; $('deck-empty').hidden = list.length > 0;
|
|
5526
5509
|
void paintDeckFeatures(list.length);
|
|
5527
|
-
await loadRooms(); paint();
|
|
5510
|
+
await Promise.all([loadRooms(), loadBoxes()]); paint();
|
|
5528
5511
|
}
|
|
5529
5512
|
/* FEATURES (features.js): the welcome in place of "No conversation yet" until it is passed; then the
|
|
5530
5513
|
next step over the cards. */
|
package/web/device.html
CHANGED
|
@@ -144,6 +144,7 @@
|
|
|
144
144
|
<script src="vendor/xterm.js"></script>
|
|
145
145
|
<script src="vendor/fit.js"></script>
|
|
146
146
|
<script src="device.js"></script>
|
|
147
|
+
<script src="kit.js"></script>
|
|
147
148
|
<script src="app.js"></script>
|
|
148
149
|
<script type="module" src="voice.js"></script>
|
|
149
150
|
<script type="module" src="icons.js"></script>
|
package/web/index.html
CHANGED
|
@@ -1332,6 +1332,7 @@
|
|
|
1332
1332
|
<script src="/gitgraph.js"></script>
|
|
1333
1333
|
<script src="/links.js"></script>
|
|
1334
1334
|
<script src="/features.js"></script>
|
|
1335
|
+
<script src="/kit.js"></script>
|
|
1335
1336
|
<script src="/app.js"></script>
|
|
1336
1337
|
<script type="module" src="/voice.js"></script>
|
|
1337
1338
|
<script type="module" src="/icons.js"></script>
|
package/web/kit.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/* THE KIT (05-11): the small pieces every screen shares, one implementation each -- a screen is only a
|
|
2
|
+
* frame that places them (05-11: the kit, then the conversation card).
|
|
3
|
+
*
|
|
4
|
+
* StatusDot the point of a state: problem · wait · work · busy · ok · sleep (the list's six)
|
|
5
|
+
* Avatar an initial on a colour drawn from the name (always the same for the same name)
|
|
6
|
+
* Chips small pills: what waits, its room, its boxes, a mark
|
|
7
|
+
* Switch yes / no (role=switch, aria-checked)
|
|
8
|
+
* Segmented one of a few (pressed buttons, aria-pressed)
|
|
9
|
+
* InlineConfirm confirm in place of the button: Keep, then the action
|
|
10
|
+
* ConvCard ONE CONVERSATION, three sizes: `row` (the list, Recent), `card` (the home deck),
|
|
11
|
+
* `member` (a room's members, and the one that welcomes it). Same dot, name, line
|
|
12
|
+
* of what it does now, chips; each place adds its own gestures (`actions`).
|
|
13
|
+
*
|
|
14
|
+
* No framework: each piece is a function that returns an element. Words: English here; the page
|
|
15
|
+
* hands its own (`setWords`, app.js `uiSaid`) for the few the kit says by itself.
|
|
16
|
+
* Loaded before app.js (index.html, device.html): window.clavariumKit. */
|
|
17
|
+
(() => {
|
|
18
|
+
/* THE STATES, worst first (the order a folded group sums them in). */
|
|
19
|
+
const STATES = ['problem', 'wait', 'work', 'busy', 'ok', 'sleep'];
|
|
20
|
+
const STATE_WORDS = { problem: 'a problem', wait: 'waits for you', work: 'at work', busy: 'busy', ok: 'fine', sleep: 'asleep' };
|
|
21
|
+
/* Older names some places used for the same states: one vocabulary from now on. */
|
|
22
|
+
const ALIASES = { ready: 'ok', online: 'ok', idle: 'ok', done: 'ok', waits: 'wait', waiting: 'wait', working: 'work', asleep: 'sleep', off: 'sleep', failed: 'problem', bad: 'problem' };
|
|
23
|
+
const stateOf = (s) => (STATES.includes(s) ? s : ALIASES[s] ?? 'ok');
|
|
24
|
+
|
|
25
|
+
let words = (key, fallback) => fallback;
|
|
26
|
+
const say = (key, fallback) => { try { const w = words(key, fallback); return typeof w === 'string' && w ? w : fallback; } catch { return fallback; } };
|
|
27
|
+
|
|
28
|
+
/* A colour of its own, from its name: the same name, the same colour, on every screen. */
|
|
29
|
+
const hueOf = (text) => { let h = 0; for (const ch of String(text ?? '')) h = (h * 31 + ch.codePointAt(0)) >>> 0; return h % 360; };
|
|
30
|
+
const initialOf = (name) => ([...String(name ?? '').trim()][0] ?? '?').toUpperCase();
|
|
31
|
+
|
|
32
|
+
const node = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text !== undefined && text !== null) e.textContent = String(text); return e; };
|
|
33
|
+
|
|
34
|
+
function StatusDot({ state = 'ok', label = '' } = {}) {
|
|
35
|
+
const d = node('span', 'state-dot'); d.dataset.state = stateOf(state);
|
|
36
|
+
if (label) d.title = label;
|
|
37
|
+
return d;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* `glyph`: an element drawn in place of the initial (a room's sign). */
|
|
41
|
+
function Avatar({ name = '', glyph = null, hue } = {}) {
|
|
42
|
+
const a = node('span', 'kit-av'); a.setAttribute('aria-hidden', 'true');
|
|
43
|
+
a.style.setProperty('--h', String(hue ?? hueOf(name)));
|
|
44
|
+
if (glyph) a.append(glyph); else a.textContent = initialOf(name);
|
|
45
|
+
return a;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* A chip: { text, cls?, tone?: 'need' | 'note', icon?: 'room' | 'box', title? }. Empty: nothing. */
|
|
49
|
+
function Chips(list = []) {
|
|
50
|
+
const shown = list.filter((c) => c && c.text !== undefined && c.text !== '');
|
|
51
|
+
if (!shown.length) return null;
|
|
52
|
+
const box = node('span', 'kit-chips');
|
|
53
|
+
for (const c of shown) {
|
|
54
|
+
const chip = node('small', `kit-chip${c.cls ? ` ${c.cls}` : ''}`);
|
|
55
|
+
if (c.tone) chip.dataset.tone = c.tone;
|
|
56
|
+
if (c.icon) { const i = node('span', `kit-chip-ic kit-ic-${c.icon}`); i.setAttribute('aria-hidden', 'true'); chip.append(i); }
|
|
57
|
+
chip.append(String(c.text));
|
|
58
|
+
if (c.title) chip.title = c.title;
|
|
59
|
+
box.append(chip);
|
|
60
|
+
}
|
|
61
|
+
return box;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Yes / no. `onChange(on)`; the page paints again, or calls `.set(on)`. */
|
|
65
|
+
function Switch({ on = false, label = '', onChange = () => {}, disabled = false } = {}) {
|
|
66
|
+
const b = node('button', 'kit-switch'); b.type = 'button';
|
|
67
|
+
b.setAttribute('role', 'switch'); b.setAttribute('aria-checked', String(Boolean(on)));
|
|
68
|
+
if (label) b.setAttribute('aria-label', label);
|
|
69
|
+
if (disabled) b.disabled = true;
|
|
70
|
+
b.set = (v) => b.setAttribute('aria-checked', String(Boolean(v)));
|
|
71
|
+
b.addEventListener('click', () => { const next = b.getAttribute('aria-checked') !== 'true'; b.set(next); onChange(next); });
|
|
72
|
+
return b;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* One of a few: `options` [{ value, label }], the chosen one pressed. `onChange(value)`. */
|
|
76
|
+
function Segmented({ options = [], value, label = '', onChange = () => {} } = {}) {
|
|
77
|
+
const g = node('div', 'kit-seg'); g.setAttribute('role', 'group');
|
|
78
|
+
if (label) g.setAttribute('aria-label', label);
|
|
79
|
+
const buttons = options.map((o) => {
|
|
80
|
+
const b = node('button', '', o.label ?? o.value); b.type = 'button'; b.dataset.value = String(o.value);
|
|
81
|
+
b.addEventListener('click', () => { g.set(o.value); onChange(o.value); });
|
|
82
|
+
return b;
|
|
83
|
+
});
|
|
84
|
+
g.set = (v) => { for (const b of buttons) b.setAttribute('aria-pressed', String(b.dataset.value === String(v))); };
|
|
85
|
+
g.append(...buttons); g.set(value);
|
|
86
|
+
return g;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Confirm in place of `button`: the question, Keep (focused), then the action. Escape keeps.
|
|
90
|
+
Returns { close }. `onYes()` may be async; the action stays pressed till it is done. */
|
|
91
|
+
function InlineConfirm(button, { question = '', yes = 'Remove', keep, danger = true, onYes = () => {} } = {}) {
|
|
92
|
+
const ask = node('span', 'kit-confirm'); ask.setAttribute('role', 'alertdialog');
|
|
93
|
+
if (question) ask.append(node('span', 'kit-confirm-q', question));
|
|
94
|
+
const k = node('button', '', keep ?? say('kit-keep', 'Keep')); k.type = 'button';
|
|
95
|
+
const y = node('button', danger ? 'danger' : 'primary', yes); y.type = 'button';
|
|
96
|
+
ask.append(k, y);
|
|
97
|
+
const close = () => { if (ask.isConnected) { ask.replaceWith(button); button.focus?.(); } };
|
|
98
|
+
k.addEventListener('click', close);
|
|
99
|
+
ask.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.preventDefault(); close(); } });
|
|
100
|
+
y.addEventListener('click', async () => { y.disabled = k.disabled = true; try { await onYes(); } finally { y.disabled = k.disabled = false; } });
|
|
101
|
+
button.replaceWith(ask); k.focus?.();
|
|
102
|
+
return { close, element: ask };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* ONE CONVERSATION (or a room, drawn the same). `m`, what the page knows of it, said once:
|
|
106
|
+
title its free name state, stateLabel its point
|
|
107
|
+
avatar { name, glyph?, hue? } when when it was last used ('' : none)
|
|
108
|
+
last its last words ('' : none) now what it does now ('' : nothing to say)
|
|
109
|
+
who its assistant · its tool chips [{ text, cls?, tone?, icon?, wide? }]
|
|
110
|
+
`size`: 'row' | 'card' | 'member'. A `wide` chip (its room, its boxes) is said on a card only; a
|
|
111
|
+
member says only what waits for you (tone 'need' or 'count').
|
|
112
|
+
`tag`: 'button' (opens it: `onOpen`) or 'div' (a member: its gestures are `actions`). `cls`: the
|
|
113
|
+
page's own classes, kept for its rules and tests. */
|
|
114
|
+
function ConvCard(m, { size = 'row', tag, cls = '', onOpen = null, actions = [] } = {}) {
|
|
115
|
+
const t = tag ?? (size === 'member' ? 'div' : 'button');
|
|
116
|
+
const root = node(t, `kit-conv kit-conv-${size}${cls ? ` ${cls}` : ''}`);
|
|
117
|
+
if (t === 'button') root.type = 'button';
|
|
118
|
+
const state = stateOf(m.state);
|
|
119
|
+
root.append(Avatar(m.avatar ?? { name: m.title }), StatusDot({ state, label: m.stateLabel ?? STATE_WORDS[state] }));
|
|
120
|
+
const main = node('span', 'kit-conv-main');
|
|
121
|
+
const head = node('span', 'kit-conv-head');
|
|
122
|
+
head.append(node('b', '', m.title ?? ''));
|
|
123
|
+
if (m.when) head.append(node('small', 'when', m.when));
|
|
124
|
+
main.append(head);
|
|
125
|
+
const lines = [];
|
|
126
|
+
if (size === 'row') {
|
|
127
|
+
if (m.last) lines.push(node('small', 'last', m.last));
|
|
128
|
+
if (m.now) lines.push(node('small', 'kit-conv-now', m.now));
|
|
129
|
+
} else if (size === 'card') {
|
|
130
|
+
if (m.last) lines.push(node('small', 'last', m.last));
|
|
131
|
+
const what = [m.now, m.who].filter(Boolean).join(' · ');
|
|
132
|
+
if (what) lines.push(node('small', 'kit-conv-now', what));
|
|
133
|
+
} else {
|
|
134
|
+
const what = [m.who, m.now].filter(Boolean).join(' · ');
|
|
135
|
+
if (what) lines.push(node('small', 'kit-conv-now', what));
|
|
136
|
+
}
|
|
137
|
+
main.append(...lines);
|
|
138
|
+
/* Its chips by place: all on a card; a row leaves out the wide ones; a member only what waits for you. */
|
|
139
|
+
const chips = Chips((m.chips ?? []).filter((c) => c && (size === 'card' || (size === 'row' ? !c.wide : c.tone === 'need' || c.tone === 'count'))));
|
|
140
|
+
if (chips) main.append(chips);
|
|
141
|
+
root.append(main);
|
|
142
|
+
if (actions.length) { const acts = node('span', 'kit-conv-acts'); acts.append(...actions.filter(Boolean)); root.append(acts); }
|
|
143
|
+
if (onOpen && t === 'button') root.addEventListener('click', () => onOpen());
|
|
144
|
+
return root;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
window.clavariumKit = {
|
|
148
|
+
STATES, STATE_WORDS, stateOf, hueOf, initialOf,
|
|
149
|
+
setWords(fn) { if (typeof fn === 'function') words = fn; },
|
|
150
|
+
StatusDot, Avatar, Chips, Switch, Segmented, InlineConfirm, ConvCard,
|
|
151
|
+
};
|
|
152
|
+
})();
|
package/web/style.css
CHANGED
|
@@ -43,26 +43,24 @@ button:focus-visible, input:focus-visible { outline: 2px solid var(--brass); out
|
|
|
43
43
|
.item[aria-current="true"] { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass); }
|
|
44
44
|
.item b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
45
45
|
.item small { color: var(--ink2); }
|
|
46
|
-
/* ITS STATE, one point
|
|
46
|
+
/* ITS STATE, one point (the kit's StatusDot, kit.js), its colour the worst that
|
|
47
47
|
applies: a machine problem (red), the agent waits for you (blue), the agent
|
|
48
48
|
at work (gold, pulsing), the machine busy (amber, pulsing), fine (green),
|
|
49
49
|
asleep (a hollow ring). The same point, same colours, sums a folded group. */
|
|
50
|
-
.item { position: relative;
|
|
50
|
+
.item { position: relative; }
|
|
51
51
|
.state-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; box-sizing: border-box; background: var(--ok); }
|
|
52
52
|
.state-dot[data-state="problem"] { background: var(--danger); }
|
|
53
53
|
.state-dot[data-state="wait"] { background: var(--wait); }
|
|
54
54
|
.state-dot[data-state="work"] { background: var(--brass); }
|
|
55
55
|
.state-dot[data-state="busy"] { background: var(--ink2); }
|
|
56
56
|
.state-dot[data-state="sleep"] { background: transparent; border: 1.5px solid var(--ink2); }
|
|
57
|
-
.item > .state-dot { position: absolute; right: 10px; top: 13px; }
|
|
58
|
-
.item > .state-dot[data-state="work"], .item > .state-dot[data-state="busy"] { animation: breathe 1.7s ease-in-out infinite; }
|
|
59
57
|
/* Folded: up to four points, how its conversations are. */
|
|
60
58
|
.state-sum { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
|
|
61
59
|
/* Unfolded: it comes in gently, once. */
|
|
62
60
|
.unfolding { animation: unfold .18s ease-out; }
|
|
63
61
|
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }
|
|
64
62
|
@keyframes breathe { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(.85); } }
|
|
65
|
-
@media (prefers-reduced-motion: reduce) { .
|
|
63
|
+
@media (prefers-reduced-motion: reduce) { .kit-conv > .state-dot, header.topbar .bar-state, .unfolding { animation: none !important; } }
|
|
66
64
|
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
67
65
|
.choices button[aria-checked="true"] { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 14%, transparent); }
|
|
68
66
|
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
@@ -325,7 +323,6 @@ footer button.careful { border-style: dashed; color: var(--ink2); }
|
|
|
325
323
|
.given-row > span:first-child { flex: 1 1 160px; min-width: 0; }
|
|
326
324
|
.thing { border-top: 1px solid var(--line); padding: 6px 0; }
|
|
327
325
|
.thing > summary { cursor: pointer; font-weight: 600; min-height: 40px; display: flex; align-items: center; }
|
|
328
|
-
.item .shared-mark { display: block; color: var(--brass-ink); }
|
|
329
326
|
/* A sheet is open on a small screen: the keys of the terminal are not for it, and would take half the
|
|
330
327
|
screen from it. On a wide screen they stay: taking them away would resize the terminal under the
|
|
331
328
|
sheet each time, and the tool would redraw for nothing (a test caught the screen moving). */
|
|
@@ -1446,10 +1443,6 @@ select.pill { appearance: auto; }
|
|
|
1446
1443
|
/* THE LIST: Needs you, Recent (copies, with what was said last and when), then the groups. */
|
|
1447
1444
|
.list-head { margin: 10px 2px 2px; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink2); }
|
|
1448
1445
|
.list-head:first-child { margin-top: 2px; }
|
|
1449
|
-
.item[data-when] { position: relative; }
|
|
1450
|
-
.item[data-when] > b { padding-right: 5em; }
|
|
1451
|
-
.item .when { position: absolute; top: 9px; right: 26px; max-width: 5em; overflow: hidden; white-space: nowrap; font-weight: 400; color: var(--ink2); }
|
|
1452
|
-
.item .last { display: block; color: var(--ink); opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1453
1446
|
.more-recent { align-self: center; display: inline-flex; align-items: center; gap: 4px; padding: 2px 14px; border-radius: 999px; text-decoration: none; color: var(--ink2); }
|
|
1454
1447
|
.more-recent:hover { color: var(--ink); background: var(--bar); }
|
|
1455
1448
|
.more-chevron { font-size: 1.125rem; line-height: 1; }
|
|
@@ -2257,18 +2250,8 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
|
|
|
2257
2250
|
#list-title { cursor: pointer; }
|
|
2258
2251
|
#deck { overflow-y: auto; }
|
|
2259
2252
|
.deck { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; padding: 14px 16px 24px; }
|
|
2260
|
-
.conv-card { position: relative;
|
|
2253
|
+
.conv-card { position: relative; min-height: 120px; display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: linear-gradient(160deg, var(--bar), var(--panel)); color: var(--ink); text-align: left; font: inherit; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); cursor: pointer; transition: transform .15s, border-color .15s; }
|
|
2261
2254
|
.conv-card:hover, .conv-card:focus-visible { transform: translateY(-3px); border-color: var(--brass); }
|
|
2262
|
-
.conv-card-plate { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); min-width: 0; }
|
|
2263
|
-
.conv-card-plate b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; }
|
|
2264
|
-
.conv-card-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ink2); }
|
|
2265
|
-
.conv-card-dot[data-state="ready"] { background: var(--ok); } .conv-card-dot[data-state="waits"] { background: var(--wait); } .conv-card-dot[data-state="busy"] { background: var(--ink2); }
|
|
2266
|
-
.conv-card-dot[data-state="asleep"] { background: transparent; border: 1.5px solid var(--ink2); } .conv-card-dot[data-state="problem"] { background: var(--danger); }
|
|
2267
|
-
.conv-card-art { flex: 1.2; min-height: 0; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: linear-gradient(135deg, hsl(var(--h) 38% 30%), hsl(calc(var(--h) + 40) 42% 14%)); }
|
|
2268
|
-
.conv-card-initial { font: 600 2.4rem/1 var(--sans); color: rgba(255, 255, 255, .82); }
|
|
2269
|
-
.conv-card-type { font-size: .75rem; color: var(--ink2); padding: 2px 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2270
|
-
.conv-card-text { flex: .9; min-height: 0; display: flex; flex-direction: column; gap: 3px; padding: 2px 6px; font-size: .75rem; color: var(--ink2); overflow: hidden; }
|
|
2271
|
-
.conv-card-text i { font-style: normal; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
2272
2255
|
.conv-card-new { align-items: center; justify-content: center; border-style: dashed; border-width: 1.5px; background: transparent; box-shadow: none; color: var(--ink2); }
|
|
2273
2256
|
.conv-card-plus { font-size: 2.6rem; line-height: 1; color: var(--brass); }
|
|
2274
2257
|
.deck-empty { text-align: center; padding: 48px 16px; color: var(--ink2); }
|
|
@@ -2298,8 +2281,6 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
|
|
|
2298
2281
|
|
|
2299
2282
|
/* ROOMS (#268): a room's card is a conversation's, a little thicker (a card behind it), its members' chips on its picture. */
|
|
2300
2283
|
.conv-card-room { box-shadow: 6px 6px 0 -1px var(--panel), 6px 6px 0 0 var(--line), 0 6px 18px rgba(0, 0, 0, .18); }
|
|
2301
|
-
.conv-card-room .conv-card-art { position: relative; }
|
|
2302
|
-
.conv-card-room .salon-stack { position: absolute; left: 6px; bottom: 6px; }
|
|
2303
2284
|
.salon-stack { display: inline-flex; }
|
|
2304
2285
|
.salon-chip { width: 20px; height: 20px; margin-left: -6px; display: grid; place-items: center; border: 2px solid var(--panel); font: 600 .6875rem/1 var(--sans); font-style: normal; color: #fff; background: hsl(var(--h, 210) 40% 38%); }
|
|
2305
2286
|
.salon-chip:first-child { margin-left: 0; }
|
|
@@ -2317,7 +2298,6 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
|
|
|
2317
2298
|
.salon-host { font-size: .6875rem; color: var(--ink2); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
|
|
2318
2299
|
#salon-thread { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 14px 12px; --parley-bg: var(--bg); --parley-text: var(--ink); --parley-dim: var(--ink2); --parley-line: var(--line); --parley-agent: var(--panel); --parley-person: var(--bar); --parley-ask: var(--brass-ink); --parley-wait: var(--wait); --parley-ok: var(--ok); --parley-action: var(--brass-ink); --parley-on-action: var(--on-brass); --parley-live: var(--danger); }
|
|
2319
2300
|
|
|
2320
|
-
.salon-unread { font-size: .6875rem; font-weight: 600; min-width: 1.5em; text-align: center; padding: 0 5px; border-radius: 999px; background: var(--wait); color: var(--bg); }
|
|
2321
2301
|
.salon-thinking { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0 14px 8px; font-size: .75rem; color: var(--ink2); order: 2; }
|
|
2322
2302
|
#salon-new { display: flex; flex-direction: column; }
|
|
2323
2303
|
#salon-new[hidden] { display: none; }
|
|
@@ -2338,10 +2318,9 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
|
|
|
2338
2318
|
/* A ROOM'S MEMBERS (03-11): the one that welcomes in a box of its own; every conversation on a row, its switch. */
|
|
2339
2319
|
.salon-host-box { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; border: 1px solid var(--brass); border-radius: 10px; background: color-mix(in srgb, var(--brass) 10%, var(--panel)); transition: background .15s; }
|
|
2340
2320
|
.salon-host-box.over { background: color-mix(in srgb, var(--brass) 22%, var(--panel)); }
|
|
2341
|
-
.salon-
|
|
2342
|
-
.salon-
|
|
2343
|
-
.salon-
|
|
2344
|
-
.salon-av { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; flex: none; color: #fff; font: 600 .8125rem/1 var(--sans); background: hsl(var(--h, 210) 40% 38%); }
|
|
2321
|
+
.salon-member-what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
2322
|
+
.salon-member-what b { font-weight: 600; font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2323
|
+
.salon-member-what small { color: var(--ink2); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2345
2324
|
.salon-members-tools input { width: 100%; }
|
|
2346
2325
|
.salon-member-list { display: flex; flex-direction: column; max-height: 22rem; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 0 !important; }
|
|
2347
2326
|
.salon-member-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 48px; border-top: 1px solid var(--line); }
|
|
@@ -2349,11 +2328,6 @@ body.as-dragging #assets-rows .as-row { touch-action: none; }
|
|
|
2349
2328
|
.salon-member-row[draggable="true"] { cursor: grab; }
|
|
2350
2329
|
button.salon-welcome-btn { border-radius: 999px; padding: 4px 10px; font-size: .75rem; min-height: 32px; background: transparent; color: var(--ink2); }
|
|
2351
2330
|
button.salon-welcome-btn[aria-pressed="true"] { color: var(--brass-ink); border-color: var(--brass); background: color-mix(in srgb, var(--brass) 14%, transparent); }
|
|
2352
|
-
button.salon-switch { position: relative; width: 40px; height: 24px; min-height: 0; flex: none; padding: 0; border-radius: 999px; background: var(--bg); }
|
|
2353
|
-
button.salon-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink2); transition: left .15s, background .15s; }
|
|
2354
|
-
button.salon-switch[aria-checked="true"] { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 25%, var(--bg)); }
|
|
2355
|
-
button.salon-switch[aria-checked="true"]::after { left: 18px; background: var(--ok); }
|
|
2356
|
-
@media (max-width: 700px) { button.salon-switch { min-height: 0; } }
|
|
2357
2331
|
.nc-card > .salon-host-box, .nc-card > .salon-member-list { margin: 4px 16px 12px; }
|
|
2358
2332
|
.nc-card > .salon-host-box { padding: 8px 12px; }
|
|
2359
2333
|
.nc-card > .salon-members-tools { padding-bottom: 4px; }
|
|
@@ -2643,3 +2617,61 @@ header.topbar .views .icon-btn { width: auto; height: auto; }
|
|
|
2643
2617
|
/* A room's settings: the same group names as every settings page (05-11). */
|
|
2644
2618
|
#salon-new .room-group { margin: 6px 4px -6px; font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
|
|
2645
2619
|
#salon-new .room-group[hidden] { display: none; }
|
|
2620
|
+
|
|
2621
|
+
/* ======================================================================================================
|
|
2622
|
+
KIT (05-11, web/kit.js): the pieces every screen shares, one style each. A screen places them; it
|
|
2623
|
+
does not draw them again. Only the charter's tokens here.
|
|
2624
|
+
====================================================================================================== */
|
|
2625
|
+
/* AVATAR: an initial on the colour of its name. */
|
|
2626
|
+
.kit-av { width: var(--kc-av, 28px); height: var(--kc-av, 28px); border-radius: 7px; display: grid; place-items: center; flex: none; color: #fff; font: 600 calc(var(--kc-av, 28px) * .46)/1 var(--sans); background: hsl(var(--h, 210) 40% 38%); }
|
|
2627
|
+
.kit-av .room-sign { width: 58%; height: 58%; margin: 0; vertical-align: 0; background: #fff; }
|
|
2628
|
+
/* CHIPS: small pills -- what waits (count, need), a note, its room, its boxes. */
|
|
2629
|
+
.kit-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; min-width: 0; }
|
|
2630
|
+
.kit-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 0 7px; border: 1px solid var(--line); border-radius: 999px; font-size: .6875rem; font-weight: 400; line-height: 1.6; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2631
|
+
.kit-chip[data-tone="note"] { color: var(--brass-ink); }
|
|
2632
|
+
.kit-chip[data-tone="need"] { color: var(--brass-ink); border-color: var(--brass); font-weight: 600; }
|
|
2633
|
+
.kit-chip[data-tone="count"] { min-width: 1.6em; justify-content: center; font-weight: 600; border-color: var(--wait); background: var(--wait); color: var(--bg); }
|
|
2634
|
+
.kit-chip-ic { width: 11px; height: 11px; flex: none; background: currentColor; -webkit-mask: var(--kit-ic) center / contain no-repeat; mask: var(--kit-ic) center / contain no-repeat; }
|
|
2635
|
+
.kit-ic-room { --kit-ic: 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"); }
|
|
2636
|
+
.kit-ic-box { --kit-ic: 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%3Crect x='6' y='2.5' width='12' height='19' rx='3'/%3E%3Ccircle cx='12' cy='14.5' r='3.2'/%3E%3C/svg%3E"); }
|
|
2637
|
+
/* SWITCH: yes / no. */
|
|
2638
|
+
button.kit-switch { position: relative; width: 40px; height: 24px; min-height: 0 !important; flex: none; padding: 0; border-radius: 999px; background: var(--bg); }
|
|
2639
|
+
button.kit-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink2); transition: left .15s, background .15s; }
|
|
2640
|
+
button.kit-switch[aria-checked="true"] { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 25%, var(--bg)); }
|
|
2641
|
+
button.kit-switch[aria-checked="true"]::after { left: 18px; background: var(--ok); }
|
|
2642
|
+
/* SEGMENTED: one of a few, the chosen one pressed. */
|
|
2643
|
+
.kit-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
|
|
2644
|
+
.kit-seg > button { border: 0; border-radius: 0; background: transparent; color: var(--ink2); }
|
|
2645
|
+
.kit-seg > button + button { border-left: 1px solid var(--line); }
|
|
2646
|
+
.kit-seg > button[aria-pressed="true"] { color: var(--brass-ink); background: color-mix(in srgb, var(--brass) 14%, transparent); }
|
|
2647
|
+
/* INLINE CONFIRM: in place of its button, Keep first. */
|
|
2648
|
+
.kit-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
2649
|
+
.kit-confirm-q { color: var(--ink); }
|
|
2650
|
+
/* THE CONVERSATION CARD: its avatar with its point on the corner, its name, what it does now, its chips;
|
|
2651
|
+
the gestures of its place at its end. Sizes: row (the list), card (the deck), member (a room's). */
|
|
2652
|
+
.kit-conv { --kc-av: 28px; --kc-ring: var(--bar); position: relative; display: grid; grid-template-columns: var(--kc-av) minmax(0, 1fr) auto; column-gap: 10px; align-items: start; text-align: left; color: var(--ink); min-width: 0; }
|
|
2653
|
+
.kit-conv > .kit-av { grid-column: 1; grid-row: 1; }
|
|
2654
|
+
.kit-conv > .state-dot { grid-column: 1; grid-row: 1; justify-self: end; margin: calc(var(--kc-av) - 7px) -3px 0 0; box-shadow: 0 0 0 2px var(--kc-ring); }
|
|
2655
|
+
.kit-conv > .state-dot[data-state="sleep"] { background: var(--kc-ring); }
|
|
2656
|
+
.kit-conv > .state-dot[data-state="work"], .kit-conv > .state-dot[data-state="busy"] { animation: breathe 1.7s ease-in-out infinite; }
|
|
2657
|
+
.kit-conv-main { grid-column: 2; grid-row: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
|
|
2658
|
+
.kit-conv-head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
|
|
2659
|
+
.kit-conv-head > b { flex: 1; min-width: 0; display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2660
|
+
.kit-conv-head > .when { flex: none; max-width: 6em; overflow: hidden; white-space: nowrap; font-size: .75rem; font-weight: 400; color: var(--ink2); }
|
|
2661
|
+
.kit-conv-main > small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); }
|
|
2662
|
+
.kit-conv-main > .last { color: var(--ink); opacity: .85; }
|
|
2663
|
+
.kit-conv-acts { grid-column: 3; grid-row: 1; align-self: center; display: flex; align-items: center; gap: 8px; }
|
|
2664
|
+
.kit-conv-row { align-items: center; padding: 8px 10px; }
|
|
2665
|
+
.kit-conv-card { --kc-av: 36px; --kc-ring: var(--panel); display: grid; grid-template-columns: var(--kc-av) minmax(0, 1fr); align-content: start; row-gap: 6px; min-height: 120px; }
|
|
2666
|
+
.kit-conv-card .kit-conv-main { display: contents; }
|
|
2667
|
+
.kit-conv-card .kit-conv-head { grid-column: 2; grid-row: 1; align-self: center; flex-direction: column; align-items: stretch; gap: 0; }
|
|
2668
|
+
.kit-conv-card .kit-conv-main > :not(.kit-conv-head) { grid-column: 1 / -1; }
|
|
2669
|
+
.kit-conv-card .kit-conv-main > small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); font-size: .8125rem; }
|
|
2670
|
+
.kit-conv-card .kit-conv-main > .last { color: var(--ink); opacity: .9; }
|
|
2671
|
+
.kit-conv-card .kit-conv-main > .last { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
|
|
2672
|
+
.kit-conv-card .kit-conv-head > b { font-size: .9375rem; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; line-height: 1.25; }
|
|
2673
|
+
.kit-conv-member { --kc-ring: var(--panel); align-items: center; padding: 8px 12px; }
|
|
2674
|
+
.kit-conv-member .kit-conv-head > b { font-size: .8125rem; }
|
|
2675
|
+
.kit-conv-member .kit-conv-main > small { font-size: .75rem; }
|
|
2676
|
+
.salon-host-box > .kit-conv-member { flex: 1; padding: 0; --kc-ring: color-mix(in srgb, var(--brass) 10%, var(--panel)); }
|
|
2677
|
+
@media (max-width: 520px) { .kit-conv-card { --kc-av: 30px; column-gap: 8px; padding: 10px; } }
|