clavarium 0.2.444-next.1 → 0.2.446-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 +2 -2
- package/package.json +1 -1
- package/web/app.js +115 -9
- package/web/index.html +1 -1
- package/web/kit.js +30 -1
- package/web/style.css +23 -0
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavarium",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.446-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.446-next.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/package.json
CHANGED
package/web/app.js
CHANGED
|
@@ -1801,6 +1801,13 @@
|
|
|
1801
1801
|
function openSearch() {
|
|
1802
1802
|
if (DEVICE) return;
|
|
1803
1803
|
/* Asked for: the keyboard comes with it, lock or not. */
|
|
1804
|
+
/* The list folded away (a pick folds it, 14-11): it comes back, or the field would be typed in out of sight. */
|
|
1805
|
+
/* At once, not slid: the slide ends by giving the terminal the keys, the search needs them. */
|
|
1806
|
+
if (listFolded && !narrow()) {
|
|
1807
|
+
listFolded = false;
|
|
1808
|
+
try { localStorage.setItem('clavarium-list', 'open'); } catch { /* a private window */ }
|
|
1809
|
+
applyFold(false); fit.fit?.();
|
|
1810
|
+
}
|
|
1804
1811
|
if (!$('search').hidden) { $('search-field').focus(); return; }
|
|
1805
1812
|
$('search').hidden = false; $('search-open').setAttribute('aria-expanded', 'true');
|
|
1806
1813
|
nav.push('search', () => closeSearch());
|
|
@@ -3099,12 +3106,22 @@
|
|
|
3099
3106
|
/* A CONVERSATION'S AT HAND: its machine's three tiles, from its health (memory, disk) and its last hour
|
|
3100
3107
|
(/api/history, read at most every 30 s). */
|
|
3101
3108
|
const convHandAt = { of: '', at: 0, h: null };
|
|
3109
|
+
/* Its tiles while they are read, at once as its settings open: never those of the one shown before. */
|
|
3110
|
+
function convHandLoading(here) {
|
|
3111
|
+
const box = $('panel-tiles');
|
|
3112
|
+
if (DEVICE || !here || here.asleep || here.phase !== 'ready') return;
|
|
3113
|
+
if (box.dataset.of === here.name && box.children.length) return;
|
|
3114
|
+
box.dataset.of = here.name; box.replaceChildren(...handTilesLoading()); box.hidden = false; KIT.loading(box);
|
|
3115
|
+
}
|
|
3102
3116
|
async function paintConvHand(here) {
|
|
3103
3117
|
const box = $('panel-tiles');
|
|
3104
3118
|
if (DEVICE || !here || here.asleep || here.phase !== 'ready') { box.hidden = true; return; }
|
|
3105
|
-
|
|
3119
|
+
convHandLoading(here);
|
|
3120
|
+
/* One reading at a time, awaited by every painting meanwhile: never tiles drawn without it while it comes. */
|
|
3121
|
+
if (convHandAt.of !== here.name || Date.now() - convHandAt.at > 30_000) { convHandAt.of = here.name; convHandAt.at = Date.now(); convHandAt.h = handHistory(here.name); }
|
|
3122
|
+
const h = await convHandAt.h;
|
|
3106
3123
|
if (current !== here.name) return;
|
|
3107
|
-
const
|
|
3124
|
+
const health = here.health;
|
|
3108
3125
|
const tiles = [];
|
|
3109
3126
|
const mem = health?.memory;
|
|
3110
3127
|
const memUsed = mem?.totalMb ? 100 - (mem.availableMb / mem.totalMb) * 100 : lastOf(h?.memory);
|
|
@@ -3116,6 +3133,7 @@
|
|
|
3116
3133
|
if (h) tiles.push(handTile(uiSaid('set-cpu', 'CPU'), cpu, uiSaid(here.cpus === 1 ? 'set-core' : 'set-cores', here.cpus === 1 ? '1 core' : '{n} cores', { n: here.cpus ?? 1 }), h.cpu, levelAt(cpu ?? 0)));
|
|
3117
3134
|
for (const t of tiles) t.addEventListener('click', () => { openChapter('machine')?.scrollIntoView({ block: 'start' }); });
|
|
3118
3135
|
box.replaceChildren(...tiles); box.hidden = tiles.length === 0;
|
|
3136
|
+
KIT.loading(box, false);
|
|
3119
3137
|
}
|
|
3120
3138
|
/* What each folded chapter of a conversation says: its state now. */
|
|
3121
3139
|
function paintConvStates(here) {
|
|
@@ -4338,10 +4356,15 @@
|
|
|
4338
4356
|
if (place !== 'conversations') leavePlace();
|
|
4339
4357
|
if (giving) { openGive(); return; }
|
|
4340
4358
|
goTab('settings');
|
|
4359
|
+
/* Shown at once with what is known (14-11): its rows do not come one by one while it is asked again. */
|
|
4360
|
+
if (!giving && $('panel').dataset.painted !== current) { $('panel').dataset.painted = current; void paintPanel().catch(() => {}); }
|
|
4361
|
+
if (!giving) { convHandLoading(conversations.find((x) => x.name === current)); curvesLoading($('machine-curves'), current); }
|
|
4341
4362
|
/* What it has may have changed from another screen: asked again before it is shown. */
|
|
4363
|
+
const tabShown = $('panel').dataset.tab;
|
|
4342
4364
|
await refresh();
|
|
4343
4365
|
await paintPanel();
|
|
4344
|
-
|
|
4366
|
+
/* A tab picked by hand while it was asked again is kept: it no longer jumps to Access under the finger. */
|
|
4367
|
+
if (atAccess && $('panel').dataset.tab === tabShown) openChapter('access');
|
|
4345
4368
|
}
|
|
4346
4369
|
$('folders').addEventListener('click', () => {
|
|
4347
4370
|
/* A tab chosen before on this device: that one. Never chosen: its Access chapter, as it always opened. */
|
|
@@ -7556,11 +7579,19 @@
|
|
|
7556
7579
|
for (const [i, v] of known) d += `${d ? 'L' : 'M'}${((i / n) * 100).toFixed(1)},${(22 - (v / 100) * 20).toFixed(1)}`;
|
|
7557
7580
|
const svg = svgEl('svg', { viewBox: '0 0 100 22', preserveAspectRatio: 'none', class: 'tile-spark', 'aria-hidden': 'true' });
|
|
7558
7581
|
svg.append(svgEl('path', { d, 'vector-effect': 'non-scaling-stroke' })); t.append(svg);
|
|
7559
|
-
}
|
|
7582
|
+
} else t.append(el('span', 'tile-spark'));
|
|
7560
7583
|
t.append(el('span', 'tile-sub', sub));
|
|
7561
7584
|
t.setAttribute('aria-label', `${label}: ${percent === null ? '—' : `${Math.round(percent)} %`}, ${sub}`);
|
|
7562
7585
|
return t;
|
|
7563
7586
|
}
|
|
7587
|
+
/* THE THREE TILES WHILE THEY ARE READ (14-11): their names, « … » where the figures go, bones for the bar and
|
|
7588
|
+
the line -- the size they will have, never a figure made up. */
|
|
7589
|
+
const handTilesLoading = () => [uiSaid('set-memory', 'Memory'), uiSaid('set-disk', 'Disk'), uiSaid('set-cpu', 'CPU')].map((label) => {
|
|
7590
|
+
const t = el('div', 'tile'); t.dataset.loading = '';
|
|
7591
|
+
const k = el('span', 'tile-k'); k.append(el('b', '', label), el('span', 'tile-n', '…'));
|
|
7592
|
+
t.append(k, KIT.Bone({ cls: 'tile-bar' }), KIT.Bone({ cls: 'tile-spark' }), el('span', 'tile-sub', '…'));
|
|
7593
|
+
return t;
|
|
7594
|
+
});
|
|
7564
7595
|
const lastOf = (values) => { for (let i = (values?.length ?? 0) - 1; i >= 0; i -= 1) if (values[i] !== null && values[i] !== undefined) return values[i]; return null; };
|
|
7565
7596
|
const handHistory = async (of) => (of ? fetch(`${API}/history?of=${encodeURIComponent(of)}&span=1h`).then((x) => (x.ok ? x.json() : null)).catch(() => null) : null);
|
|
7566
7597
|
/* A chip: a dot of its state and a word -- only when it says something. */
|
|
@@ -7568,6 +7599,16 @@
|
|
|
7568
7599
|
|
|
7569
7600
|
/* The server's: under the top bar of Settings. */
|
|
7570
7601
|
let lastServer = null;
|
|
7602
|
+
/* Shown at once as Settings opens, at its final size: the tiles and a chip still being read. */
|
|
7603
|
+
let handFactsRead = false;
|
|
7604
|
+
function settingsHandLoading() {
|
|
7605
|
+
if (DEVICE) return;
|
|
7606
|
+
$('settings-hand').hidden = false;
|
|
7607
|
+
const tiles = $('settings-tiles');
|
|
7608
|
+
if (!tiles.children.length) { tiles.replaceChildren(...handTilesLoading()); tiles.hidden = false; KIT.loading(tiles); }
|
|
7609
|
+
const facts = $('settings-facts');
|
|
7610
|
+
if (!facts.children.length) { handFactsRead = false; facts.replaceChildren(KIT.Bone({ cls: 'hand-chip' })); facts.hidden = false; KIT.loading(facts); }
|
|
7611
|
+
}
|
|
7571
7612
|
async function paintSettingsHand(r = lastServer) {
|
|
7572
7613
|
if (DEVICE) return;
|
|
7573
7614
|
lastServer = r;
|
|
@@ -7582,6 +7623,7 @@
|
|
|
7582
7623
|
if (h) { const most = Math.max(0, ...(h.cpu ?? []).filter((v) => v !== null)); tiles.push(handTile(uiSaid('set-cpu', 'CPU'), cpu, uiSaid('set-highest', 'highest {n} % in 1 h', { n: Math.round(most) }), h.cpu, levelAt(cpu ?? 0))); }
|
|
7583
7624
|
for (const t of tiles) t.addEventListener('click', go);
|
|
7584
7625
|
$('settings-tiles').replaceChildren(...tiles); $('settings-tiles').hidden = tiles.length === 0;
|
|
7626
|
+
KIT.loading($('settings-tiles'), false);
|
|
7585
7627
|
paintSettingsFacts();
|
|
7586
7628
|
}
|
|
7587
7629
|
/* Its chips: the version, a conversation that is not well, a voice box away. */
|
|
@@ -7592,14 +7634,17 @@
|
|
|
7592
7634
|
if (u?.installed) {
|
|
7593
7635
|
if (u.available) chips.push(handChip('warn', uiSaid('set-update-out', '{v} is out', { v: u.available.version ?? u.available }), () => { openChapter('s-updates')?.scrollIntoView({ block: 'start' }); }));
|
|
7594
7636
|
else if (u.version) chips.push(handChip('ok', uiSaid('set-up-to-date', 'Up to date · {v}', { v: u.version })));
|
|
7595
|
-
}
|
|
7637
|
+
} else if (u?.version) chips.push(handChip('ok', `Clavarium ${u.version}`));
|
|
7596
7638
|
if (handWifi?.using?.ssid) chips.push(handChip('ok', uiSaid('set-wifi-on', 'Wi-Fi · {name}', { name: handWifi.using.ssid })));
|
|
7597
7639
|
for (const c of conversations.filter((x) => (x.health?.problems ?? []).some((p) => p.level === 'warn' || p.level === 'bad'))) {
|
|
7598
7640
|
const bad = c.health.problems.some((p) => p.level === 'bad');
|
|
7599
7641
|
chips.push(handChip(bad ? 'bad' : 'warn', `${c.title || c.name} · ${uiSaid('set-not-well', 'not well')}`, () => select(c.name, { step: true })));
|
|
7600
7642
|
}
|
|
7601
7643
|
for (const b of (handBoxes ?? []).filter((x) => x.online === false)) chips.push(handChip('off', uiSaid('set-box-away', '{name} offline', { name: b.name })));
|
|
7644
|
+
/* Nothing to say yet, while some is still read: its bone stays (the row does not come and go). */
|
|
7645
|
+
if (!chips.length && !handFactsRead) return;
|
|
7602
7646
|
$('settings-facts').replaceChildren(...chips); $('settings-facts').hidden = chips.length === 0;
|
|
7647
|
+
KIT.loading($('settings-facts'), false);
|
|
7603
7648
|
}
|
|
7604
7649
|
let handBoxes = null;
|
|
7605
7650
|
$('hand-check').addEventListener('click', () => { const sheet = $('settings'); sheet.showTab?.('automatic'); openChapter('s-updates'); $('updates-check').click(); $('settings-updates-top').scrollIntoView({ block: 'start' }); });
|
|
@@ -7644,11 +7689,13 @@
|
|
|
7644
7689
|
const last = Array.isArray(events) ? events[0] : null;
|
|
7645
7690
|
if (last) chapterNow('s-events', `${agoSaid(last.at)} · ${String(last.text).slice(0, 60)}`);
|
|
7646
7691
|
handBoxes = await fetch(`${API}/boxes`).then((r) => (r.ok ? r.json() : null)).catch(() => null);
|
|
7692
|
+
handFactsRead = true;
|
|
7647
7693
|
paintSettingsFacts();
|
|
7648
7694
|
}
|
|
7649
7695
|
for (const d of document.querySelectorAll('#settings details.chapter')) d.addEventListener('toggle', () => { if (!d.open) void paintSettingsStates(); });
|
|
7650
7696
|
async function openSettings({ push = true } = {}) {
|
|
7651
7697
|
enterPlace('settings', push);
|
|
7698
|
+
settingsHandLoading(); serverLoading();
|
|
7652
7699
|
void paintSettingsFeatures().catch(() => {});
|
|
7653
7700
|
void paintAlerts().catch(() => {});
|
|
7654
7701
|
void paintWords().catch(() => {});
|
|
@@ -8168,6 +8215,7 @@
|
|
|
8168
8215
|
what can be done -- move the machines to it, mount it, prepare (erase) it -- or why not. */
|
|
8169
8216
|
async function paintMoveMachines() {
|
|
8170
8217
|
const size = (mb) => (mb >= 1024 * 1024 ? `${(mb / 1024 / 1024).toFixed(1)} TB` : GB(mb));
|
|
8218
|
+
listLoading($('move-machines-rows'), 'move-machines', 2);
|
|
8171
8219
|
const [p, m] = await Promise.all([fetch(`${API}/machines/disks`).then((r) => (r.ok ? r.json() : null)).catch(() => null), fetch(`${API}/machines/moving`).then((r) => (r.ok ? r.json() : null)).catch(() => null)]);
|
|
8172
8220
|
const old = await fetch(`${API}/machines/places`).then((r) => (r.ok ? r.json() : null)).catch(() => null);
|
|
8173
8221
|
const rows = $('move-machines-rows'); rows.replaceChildren();
|
|
@@ -8255,7 +8303,7 @@
|
|
|
8255
8303
|
}
|
|
8256
8304
|
if (!p.disks.some((d) => !d.system)) rows.append(el('p', 'hint', 'No other disk: plug one in (or add one to this server), then open this again.'));
|
|
8257
8305
|
}
|
|
8258
|
-
$('move-machines-box').addEventListener('toggle', () => { if ($('move-machines-box').open) void paintMoveMachines(); });
|
|
8306
|
+
$('move-machines-box').addEventListener('toggle', () => { if ($('move-machines-box').open) void paintMoveMachines().finally(() => KIT.loading($('move-machines-rows'), false, 'move-machines')); });
|
|
8259
8307
|
/* NETWORK: this server's Wi-Fi (server/wifi.mjs). The networks it sees, the one it is on, another
|
|
8260
8308
|
joined with its password, one it keeps forgotten. A join only STARTS a switch: the host goes back
|
|
8261
8309
|
to the network before by itself when the new one does not work within a minute -- this page may
|
|
@@ -8461,6 +8509,7 @@
|
|
|
8461
8509
|
let eventsShown = []; let eventsAsk = 0;
|
|
8462
8510
|
async function paintEvents({ more = false } = {}) {
|
|
8463
8511
|
const ask = ++eventsAsk;
|
|
8512
|
+
if (!more) listLoading($('events-list'), 'events', 6);
|
|
8464
8513
|
const before = more && eventsShown.length ? eventsShown.at(-1).at : '';
|
|
8465
8514
|
const q = new URLSearchParams({ kind: $('events-kind').value, q: $('events-q').value.trim(), limit: '100', ...(before ? { before } : {}) });
|
|
8466
8515
|
const got = await fetch(`${API}/events?${q}`).then((r) => (r.ok ? r.json() : null)).catch(() => null);
|
|
@@ -8485,6 +8534,7 @@
|
|
|
8485
8534
|
if (e.who && !e.text.includes(e.who)) li.append(el('span', 'event-who', e.who));
|
|
8486
8535
|
list.append(li);
|
|
8487
8536
|
}
|
|
8537
|
+
KIT.loading(list, false, 'events');
|
|
8488
8538
|
$('events-said').textContent = eventsShown.length ? '' : 'Nothing yet.';
|
|
8489
8539
|
$('events-more').hidden = got.length < 100;
|
|
8490
8540
|
}
|
|
@@ -8503,6 +8553,7 @@
|
|
|
8503
8553
|
async function paintJobsChapter() {
|
|
8504
8554
|
clearTimeout(jobsTimer);
|
|
8505
8555
|
if (!$('settings-jobs-top').open) return;
|
|
8556
|
+
listLoading($('jobs-list'), 'jobs', 2);
|
|
8506
8557
|
const got = await fetch(`${API}/jobs`).then((r) => (r.ok ? r.json() : null)).catch(() => null);
|
|
8507
8558
|
if (!got) { $('jobs-said').textContent = uiSaid('set-jobs-unread', 'Cannot be read just now'); return; }
|
|
8508
8559
|
const line = (j, result) => {
|
|
@@ -8521,7 +8572,7 @@
|
|
|
8521
8572
|
const parts = [];
|
|
8522
8573
|
if (got.running.length) parts.push(el('h3', '', uiSaid('set-jobs-running', 'Under way')), ...got.running.map((j) => line(j, 'running')));
|
|
8523
8574
|
if (got.done.length) parts.push(el('h3', '', uiSaid('set-jobs-today', 'Today')), ...got.done.map((j) => line(j, j.result === 'done' ? 'done' : 'failed')));
|
|
8524
|
-
$('jobs-list').replaceChildren(...parts);
|
|
8575
|
+
$('jobs-list').replaceChildren(...parts); KIT.loading($('jobs-list'), false, 'jobs');
|
|
8525
8576
|
$('jobs-said').textContent = parts.length ? '' : uiSaid('set-jobs-none', 'Nothing today');
|
|
8526
8577
|
if (got.running.length) jobsTimer = setTimeout(() => { void paintJobsChapter(); }, 5000);
|
|
8527
8578
|
}
|
|
@@ -8634,6 +8685,22 @@
|
|
|
8634
8685
|
if (r.marks?.length) box.append(el('small', 'hint curve-legend curve-legend-oom', `● ${r.marks.length === 1 ? 'a program was' : `${r.marks.length} times a program was`} stopped for lack of memory`));
|
|
8635
8686
|
return box;
|
|
8636
8687
|
}
|
|
8688
|
+
/* Its three curves while they are read (14-11): their names, « … », a bone where each line goes -- the size
|
|
8689
|
+
they will have; those of another machine are never left in sight meanwhile. The server's say its reserve. */
|
|
8690
|
+
function curvesLoading(box, of = box.dataset.of) {
|
|
8691
|
+
if (DEVICE || !of || box.dataset.drawn === of) return;
|
|
8692
|
+
box.dataset.drawn = of;
|
|
8693
|
+
box.querySelector('.curves-row').replaceChildren(...CURVES.map(([key, label]) => {
|
|
8694
|
+
const f = el('figure', 'curve'); f.dataset.measure = key; f.dataset.loading = '';
|
|
8695
|
+
const head = el('figcaption', 'curve-head'); head.append(el('b', '', label), el('span', 'curve-now', '…'), el('span', 'curve-max', ''));
|
|
8696
|
+
const plot = el('div', 'curve-plot'); plot.append(KIT.Bone());
|
|
8697
|
+
const foot = el('div', 'curve-foot'); foot.append(el('span', '', '\u00a0'));
|
|
8698
|
+
f.append(head, plot, foot);
|
|
8699
|
+
if (of === 'server' && key !== 'cpu') f.append(el('small', 'hint curve-legend', '\u00a0'));
|
|
8700
|
+
return f;
|
|
8701
|
+
}));
|
|
8702
|
+
box.hidden = false; KIT.loading(box);
|
|
8703
|
+
}
|
|
8637
8704
|
const curvesAt = new WeakMap();
|
|
8638
8705
|
async function paintCurves(box, { force = false } = {}) {
|
|
8639
8706
|
const of = box.dataset.of; if (!of) { box.hidden = true; return; }
|
|
@@ -8641,10 +8708,12 @@
|
|
|
8641
8708
|
const was = curvesAt.get(box);
|
|
8642
8709
|
if (!force && was && was.of === of && was.span === span && Date.now() - was.at < 30_000) return;
|
|
8643
8710
|
curvesAt.set(box, { of, span, at: Date.now() });
|
|
8711
|
+
curvesLoading(box, of);
|
|
8644
8712
|
const r = await fetch(`${API}/history?of=${encodeURIComponent(of)}&span=${span}`).then((x) => (x.ok ? x.json() : null)).catch(() => null);
|
|
8645
8713
|
if (box.dataset.of !== of) return;
|
|
8646
|
-
box.hidden = !r; if (!r) return;
|
|
8714
|
+
box.hidden = !r; if (!r) { delete box.dataset.drawn; curvesAt.delete(box); return; }
|
|
8647
8715
|
box.querySelector('.curves-row').replaceChildren(...CURVES.map(([key, label]) => drawCurve(r, key, label)));
|
|
8716
|
+
KIT.loading(box, false);
|
|
8648
8717
|
}
|
|
8649
8718
|
for (const box of document.querySelectorAll('.curves')) {
|
|
8650
8719
|
box.querySelector('.curves-span').addEventListener('click', (event) => {
|
|
@@ -8896,6 +8965,39 @@
|
|
|
8896
8965
|
addEventListener('resize', () => { clearTimeout(usageResize); usageResize = setTimeout(() => { const w = $('usage-plot').clientWidth; if (w !== usageWidth && $('settings-usage-top').open && $('usage').offsetParent !== null) paintUsageAll(); }, 80); });
|
|
8897
8966
|
/* Kept current while in sight: a new look a minute. */
|
|
8898
8967
|
setInterval(() => { if ($('settings-usage-top').open && $('usage').offsetParent !== null) void paintUsage(); }, 60_000);
|
|
8968
|
+
/* RESOURCES WHILE THEY ARE READ (14-11): a disk and the memory, at the size they had the last time on this
|
|
8969
|
+
device, bones in place of their bar, figures, donut and list -- never a figure made up. */
|
|
8970
|
+
const partsBones = (n) => { const b = el('div', 'server-parts-bones'); for (let i = 0; i < n; i += 1) b.append(KIT.Bone({ w: i % 3 === 0 ? '70%' : '55%' })); return b; };
|
|
8971
|
+
/* A list while it is read: a few bones, at the height it had the last time on this device. */
|
|
8972
|
+
function listLoading(box, key, n = 3) {
|
|
8973
|
+
if (box.children.length || box.getAttribute('aria-busy') === 'true') return;
|
|
8974
|
+
const b = el(box.tagName === 'OL' || box.tagName === 'UL' ? 'li' : 'div', 'list-bones');
|
|
8975
|
+
for (let i = 0; i < n; i += 1) b.append(KIT.Bone({ h: '1.4em', w: i % 2 ? '60%' : '80%' }));
|
|
8976
|
+
box.replaceChildren(b); KIT.loading(box, true, key);
|
|
8977
|
+
}
|
|
8978
|
+
function serverLoading() {
|
|
8979
|
+
if (DEVICE) return;
|
|
8980
|
+
curvesLoading($('server-curves'));
|
|
8981
|
+
const disks = $('server-disks');
|
|
8982
|
+
if (!disks.children.length) {
|
|
8983
|
+
const block = el('div', 'server-block'); block.dataset.loading = '';
|
|
8984
|
+
const head = el('div', 'server-head'); head.append(el('b', '', uiSaid('set-disk', 'Disk')), el('span', 'server-figures', '…'));
|
|
8985
|
+
const row = el('div', 'share-row'); row.append(KIT.Bone({ cls: 'share-donut' }), partsBones(5));
|
|
8986
|
+
block.append(head, KIT.Bone({ cls: 'server-meter' }), el('p', 'server-note', '…'), row);
|
|
8987
|
+
disks.replaceChildren(block); KIT.loading(disks, true, 'server-disks');
|
|
8988
|
+
}
|
|
8989
|
+
const mem = $('server-memory');
|
|
8990
|
+
if (mem.hidden && !$('server-memory-figures').textContent) {
|
|
8991
|
+
mem.hidden = false; mem.dataset.loading = '';
|
|
8992
|
+
$('server-memory-figures').textContent = '…'; $('server-memory-note').textContent = '…';
|
|
8993
|
+
$('server-memory-meter').classList.add('kit-bone');
|
|
8994
|
+
$('server-memory-share').replaceChildren(KIT.Bone({ cls: 'share-donut' }));
|
|
8995
|
+
$('server-memory-parts').replaceChildren(partsBones(4));
|
|
8996
|
+
KIT.loading(mem, true, 'server-memory');
|
|
8997
|
+
}
|
|
8998
|
+
/* The reserve's lines, said once read: their room kept meanwhile. */
|
|
8999
|
+
for (const id of ['reserve-now', 'promised-disk', 'promised-memory']) if (!$(id).textContent) { $(id).textContent = '…'; $(id).hidden = false; }
|
|
9000
|
+
}
|
|
8899
9001
|
async function paintServer() {
|
|
8900
9002
|
clearTimeout(serverTimer);
|
|
8901
9003
|
const r = await fetch(`${API}/server`).then((x) => (x.ok ? x.json() : null)).catch(() => null);
|
|
@@ -8922,7 +9024,7 @@
|
|
|
8922
9024
|
promised($('promised-memory'), r.promised?.memory, (mb, total) => `Memory given to running machines: ${mb} of ${total}.`);
|
|
8923
9025
|
$('server-unknown').hidden = r.known;
|
|
8924
9026
|
$('server-disks').hidden = !r.disk; $('server-memory').hidden = !r.memory;
|
|
8925
|
-
if (r.disk) paintDisks(r);
|
|
9027
|
+
if (r.disk) { paintDisks(r); KIT.loading($('server-disks'), false, 'server-disks'); }
|
|
8926
9028
|
if (r.memory) {
|
|
8927
9029
|
const mem = r.memory;
|
|
8928
9030
|
$('server-memory-figures').textContent = `${GB(mem.freeMb)} free of ${GB(mem.totalMb)}`;
|
|
@@ -8939,6 +9041,8 @@
|
|
|
8939
9041
|
...named.map(({ key, label, x }) => [label, x.sizeMb ? `uses ${GB(x.rssMb)} · given ${GB(x.sizeMb)}` : `uses ${GB(x.rssMb)}`, true, share.slot.get(key)]),
|
|
8940
9042
|
['The system and other programs', rest, false, 'rest'],
|
|
8941
9043
|
]);
|
|
9044
|
+
delete $('server-memory').dataset.loading; $('server-memory-meter').classList.remove('kit-bone');
|
|
9045
|
+
KIT.loading($('server-memory'), false, 'server-memory');
|
|
8942
9046
|
}
|
|
8943
9047
|
/* Still measuring: looked at again in a moment, while Settings is open. */
|
|
8944
9048
|
if ((r.measuring || !r.usage) && !$('settings').hidden) serverTimer = setTimeout(() => { void paintServer(); }, 4000);
|
|
@@ -8969,6 +9073,7 @@
|
|
|
8969
9073
|
async function paintMachines() {
|
|
8970
9074
|
clearTimeout(machinesTimer);
|
|
8971
9075
|
if (DEVICE) { $('settings-ch-machines').hidden = true; return; }
|
|
9076
|
+
listLoading($('machines-rows'), 'machines', 2);
|
|
8972
9077
|
const r = await fetch(`${API}/server/machines`).then((x) => (x.ok ? x.json() : null)).catch(() => null);
|
|
8973
9078
|
$('settings-ch-machines').hidden = !r;
|
|
8974
9079
|
if (!r) return;
|
|
@@ -8992,6 +9097,7 @@
|
|
|
8992
9097
|
row.append(what, acts);
|
|
8993
9098
|
rows.append(row);
|
|
8994
9099
|
}
|
|
9100
|
+
KIT.loading(rows, false, 'machines');
|
|
8995
9101
|
/* The machine manager: does it answer, since when not, waiting for its owner, the last restart. */
|
|
8996
9102
|
const g = r.manager;
|
|
8997
9103
|
const ml = $('manager-line');
|
package/web/index.html
CHANGED
|
@@ -1277,7 +1277,7 @@
|
|
|
1277
1277
|
<summary><span class="chapter-title" data-said="set-ch-s-updates">Updates</span><span class="chapter-about">Version and updates.</span></summary>
|
|
1278
1278
|
<div class="chapter-body">
|
|
1279
1279
|
<div id="updates" tabindex="-1">
|
|
1280
|
-
<div class="set-row updates-head"><div class="status-line" id="updates-line"><b id="updates-version"
|
|
1280
|
+
<div class="set-row updates-head"><div class="status-line" id="updates-line"><b id="updates-version">…</b><span id="updates-state" class="hint" role="status"></span></div><div class="set-control"><button type="button" id="updates-check">Check now</button></div></div>
|
|
1281
1281
|
<p id="updates-news" class="updates-news callout" hidden></p>
|
|
1282
1282
|
<div id="updates-relay" class="hint" hidden></div>
|
|
1283
1283
|
<div class="action-row" id="updates-offer" hidden><span class="hint" id="updates-retry-note" hidden></span><button type="button" id="updates-retry-no" hidden>Cancel</button><button type="button" id="updates-retry-yes" class="primary" hidden>Try again</button><button type="button" id="updates-apply" class="primary"></button></div>
|
package/web/kit.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* a device are two of its kinds too (step 4).
|
|
20
20
|
* TopBar THE BAR atop every page of the right-hand pane, two variants: `main` (a conversation, a room:
|
|
21
21
|
* its views on the right) and `sub` (a page of its own or inside one: a way back on the right)
|
|
22
|
+
* Bone, loading WHILE IT LOADS (14-11): bars in place of what is read, the area at its final size; then it fades in
|
|
22
23
|
* ShareDonut who takes a whole (memory, a disk): a small donut, its slices from shareSlices, the main
|
|
23
24
|
* figure in its middle; ShareKey, a slice's swatch beside its row in the list
|
|
24
25
|
* AssetIcon an asset's sign and colour, by its kind (one table, ASSET_ICONS)
|
|
@@ -429,6 +430,34 @@
|
|
|
429
430
|
return root;
|
|
430
431
|
}
|
|
431
432
|
|
|
433
|
+
/* ---------- WHILE IT LOADS (14-11): no area grows when what it shows arrives ----------
|
|
434
|
+
Bone: a quiet bar where a figure, a line or a chart will be, sized by the page's style (`cls`) or `w`/`h`;
|
|
435
|
+
it shimmers slowly (still under reduced motion). Never a figure made up meanwhile (no « 0 % »).
|
|
436
|
+
loading(box, true, key): the box says it is busy, and keeps the height it had the last time it was read on
|
|
437
|
+
this device (`key`: a size only, never a figure). loading(box, false, key): it lets go of that height,
|
|
438
|
+
remembers the new one, and what it shows fades in -- only when it was waiting (a refresh does not blink). */
|
|
439
|
+
function Bone({ cls = '', w = '', h = '' } = {}) {
|
|
440
|
+
const b = node('span', `kit-bone${cls ? ` ${cls}` : ''}`); b.setAttribute('aria-hidden', 'true');
|
|
441
|
+
if (w) b.style.width = w; if (h) b.style.height = h;
|
|
442
|
+
return b;
|
|
443
|
+
}
|
|
444
|
+
const SIZES = 'clavarium.sizes';
|
|
445
|
+
const sizesKept = () => { try { return JSON.parse(localStorage.getItem(SIZES) ?? '{}') ?? {}; } catch { return {}; } };
|
|
446
|
+
function loading(box, on = true, key = '') {
|
|
447
|
+
if (!box) return;
|
|
448
|
+
if (on) {
|
|
449
|
+
box.setAttribute('aria-busy', 'true');
|
|
450
|
+
const h = key ? Number(sizesKept()[key]) : 0;
|
|
451
|
+
if (h > 0) box.style.minHeight = `${h}px`;
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (box.getAttribute('aria-busy') !== 'true') return;
|
|
455
|
+
box.removeAttribute('aria-busy'); box.style.minHeight = '';
|
|
456
|
+
if (key && box.offsetHeight > 0) { const all = sizesKept(); all[key] = box.offsetHeight; try { localStorage.setItem(SIZES, JSON.stringify(all)); } catch { /* a private window */ } }
|
|
457
|
+
box.classList.remove('kit-settle'); void box.offsetWidth; box.classList.add('kit-settle');
|
|
458
|
+
box.addEventListener('animationend', () => box.classList.remove('kit-settle'), { once: true });
|
|
459
|
+
}
|
|
460
|
+
|
|
432
461
|
/* ---------- ASSETS (06-11, the unified assets, step 1: the pieces; the screens move to them in step 2) ---------- */
|
|
433
462
|
|
|
434
463
|
/* AN ASSET'S SIGN, by its kind: the icon set's name (Lucide, icons.js), or '' for one drawn here (a binder).
|
|
@@ -1102,7 +1131,7 @@
|
|
|
1102
1131
|
AssetIcon, AssetCard, Holders, MemberStack, memberStackModel, roomPatch, RightsBadge, RightsPicker, AssetList, assetListModel, deviceItems, AccessList, accessModel, AssetPanel, AssetDelete, AssetPicker, assetPickModel, RIGHT_SAME,
|
|
1103
1132
|
memberLevel, groupLevels, groupLevel, groupFanOut, skippedSaid, GroupChip,
|
|
1104
1133
|
ASSET_ICONS, ASSET_KINDS, RIGHTS, RIGHT_LEVELS, MCP_WORDS, rightsKey, rightsFor, rightOf, storedOf, lightest, rightWord,
|
|
1105
|
-
shareSlices, ShareDonut, ShareKey,
|
|
1134
|
+
shareSlices, ShareDonut, ShareKey, Bone, loading,
|
|
1106
1135
|
STATES, STATE_WORDS, stateOf, hueOf, initialOf, IDLE_MS, idleFor, idleWords, tidyList,
|
|
1107
1136
|
setWords(fn) { if (typeof fn === 'function') words = fn; },
|
|
1108
1137
|
StatusDot, Avatar, Chips, Switch, Segmented, InlineConfirm, ConvCard, StepFlow, SecretPicker, NewAsset, TopBar,
|
package/web/style.css
CHANGED
|
@@ -3151,3 +3151,26 @@ a.button[aria-disabled] { opacity: .5; pointer-events: none; }
|
|
|
3151
3151
|
.cm-toast[data-tone="ok"] > span { color: var(--ok); }
|
|
3152
3152
|
.cm-toast[data-tone="bad"] > span { color: var(--danger); }
|
|
3153
3153
|
.cm-toast button { flex: none; }
|
|
3154
|
+
/* WHILE IT LOADS (14-11, kit.js Bone, loading): quiet bars in place of what is read, the area at its final size;
|
|
3155
|
+
a slow shimmer, none under reduced motion; what arrives fades in. */
|
|
3156
|
+
/* Its own size only where the page's style gives none (:where weighs nothing): a bone in a tile's bar is that bar. */
|
|
3157
|
+
:where(.kit-bone) { display: block; height: .8em; border-radius: 4px; }
|
|
3158
|
+
.kit-bone.kit-bone { background-color: color-mix(in srgb, var(--ink2) 16%, transparent); }
|
|
3159
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
3160
|
+
.kit-bone.kit-bone { background-image: linear-gradient(90deg, transparent 0, color-mix(in srgb, var(--ink2) 14%, transparent) 50%, transparent 100%); background-size: 200% 100%; background-repeat: no-repeat; animation: kit-shimmer 1.6s ease-in-out infinite; }
|
|
3161
|
+
.kit-settle { animation: kit-settle .15s ease-out; }
|
|
3162
|
+
}
|
|
3163
|
+
@keyframes kit-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
|
|
3164
|
+
@keyframes kit-settle { from { opacity: 0; } }
|
|
3165
|
+
[aria-busy="true"] .tile, .tile[data-loading] { cursor: default; }
|
|
3166
|
+
.tile[data-loading] .tile-n, .tile[data-loading] .tile-sub, .curve[data-loading] .curve-now, .server-block[data-loading] .server-figures { color: var(--ink2); }
|
|
3167
|
+
/* A tile keeps the room of its small line even with none to draw, and of two lines of words on a phone. */
|
|
3168
|
+
span.tile-spark { display: block; height: 22px; }
|
|
3169
|
+
@media (max-width: 520px) { .hand-tiles .tile-sub { line-height: 1.3; min-height: 2.6em; } }
|
|
3170
|
+
.curve-plot > .kit-bone { height: 72px; margin-top: 4px; }
|
|
3171
|
+
.hand-chip.kit-bone { width: 9rem; height: 24px; border: 0; padding: 0; border-radius: 999px; }
|
|
3172
|
+
.hand-chip.kit-bone::before { content: none; }
|
|
3173
|
+
.server-meter.kit-bone { height: 10px; border: 0; }
|
|
3174
|
+
.share-donut.kit-bone { border-radius: 50%; }
|
|
3175
|
+
.server-parts-bones { display: grid; gap: 8px; flex: 1 1 auto; min-width: 0; padding-top: 4px; }
|
|
3176
|
+
.list-bones { display: grid; gap: 10px; padding: 8px 0; }
|