Merge branch 'feature/hub-radio-redesign' into unify/skills-20261114
# Conflicts: # orchestrator/templates/panels.js # tests/test_hub_home.py
This commit is contained in:
commit
1c8e5845ac
19 files changed
+2119
-228
No files matched your search
@@ -59,9 +59,9 @@ h1 { margin: 0; font-size: var(--fs-lg); font-weight: 680; letter-spacing: -.01e
|
||||
.badge.urgent { background: var(--accent); color: var(--on-accent); }
|
||||
.badge.alarm { background: var(--alarm); color: #fff; }
|
||||
.tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
|
||||
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-5); background: var(--alarm); color: #fff; font-weight: 650; }
|
||||
.banner { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-5); background: var(--alarm); color: #fff; font-weight: 650; }
|
||||
.banner[hidden] { display: none; }
|
||||
.banner .text { flex: 1; margin: 0; }
|
||||
.banner .text { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.banner .btn { border-color: rgb(255 255 255 / 70%); background: transparent; color: #fff; }
|
||||
.menu { position: relative; }
|
||||
.menu > summary { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); font-weight: 580; cursor: pointer; list-style: none; }
|
||||
@@ -212,6 +212,7 @@ body.pane .shell { display: flex; flex: 1; flex-direction: column; min-height: 0
|
||||
body.pane main { flex: 1; min-height: 0; overflow: auto; }
|
||||
body.fit .shell, body.fit main, body.fit .graph, body.fit .stage-card, body.fit .stage { display: flex; flex: 1; flex-direction: column; min-height: 0; }
|
||||
body.fit main { padding-bottom: var(--sp-5); }
|
||||
body.fit .stage > .empty { min-height: 0; overflow: auto; }
|
||||
body.fit .stage svg, body.fit .stage canvas.space, body.fit .graph3d { flex: 1; height: auto; min-height: 0; max-height: none; }
|
||||
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 6px 10px 4px; color: var(--muted); font-size: var(--fs-sm); }
|
||||
.legend span { display: inline-flex; align-items: center; gap: 6px; }
|
||||
|
||||
@@ -79,35 +79,18 @@
|
||||
spotDom.toggle.setAttribute("aria-expanded", String(open));
|
||||
window.requestAnimationFrame(refresh3d);
|
||||
if (open) {
|
||||
spotDom.text.focus();
|
||||
spotDom.speak.text.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function toggleGear() {
|
||||
const open = spotDom.gearBox.hidden;
|
||||
spotDom.gearBox.replaceChildren(...(open ? [radioFilters()] : []));
|
||||
spotDom.gearBox.hidden = !open;
|
||||
spotDom.gear.setAttribute("aria-expanded", String(open));
|
||||
window.requestAnimationFrame(refresh3d);
|
||||
}
|
||||
|
||||
function radioSpot() {
|
||||
const {form, recipient, text} = composerForm();
|
||||
const gearBox = h("div", {class: "radio-gear", id: "radio-gear", hidden: true});
|
||||
const gear = iconBtn("bi-funnel", "Read aloud", "btn small ghost spot-toggle", toggleGear, "Read aloud: the classes and agents the radio sounds for");
|
||||
gear.setAttribute("aria-expanded", "false");
|
||||
gear.setAttribute("aria-controls", "radio-gear");
|
||||
const [, label, , hint] = actionOf("clear-mayday");
|
||||
const clear = iconBtn("bi-life-preserver", label, "btn small danger", () => confirmAct("clear-mayday", []), hint);
|
||||
const {face, log, station} = radioSide();
|
||||
const panel = h("section", {class: "card radio-spot", id: "radio-spot", "aria-label": "Radio", hidden: !ui.spot},
|
||||
h("div", {class: "spot-head"}, h("h3", {class: "group-title"}, "Radio"), h("span", {class: "spacer"}), gear, clear), face, gearBox,
|
||||
h("div", {class: "spot-body"}, h("div", {class: "radio-side"}, form, station), log));
|
||||
const {bar, speak, grid} = radioBody(true);
|
||||
const panel = h("section", {class: "card radio-spot", id: "radio-spot", "data-panel": "radio", "aria-label": "Radio", hidden: !ui.spot}, bar.root, grid);
|
||||
const toggle = document.getElementById("radio-open");
|
||||
toggle.setAttribute("aria-expanded", String(ui.spot));
|
||||
toggle.addEventListener("click", () => openSpot(!ui.spot));
|
||||
document.getElementById("spot-host").replaceChildren(panel);
|
||||
spotDom = {panel, toggle, gear, gearBox, text, clear, recipient, names: ""};
|
||||
spotDom = {panel, toggle, speak};
|
||||
}
|
||||
|
||||
function openRadio() {
|
||||
@@ -115,13 +98,8 @@
|
||||
}
|
||||
|
||||
function drawSpot() {
|
||||
spotDom.clear.disabled = !state.silence;
|
||||
const names = agentNames();
|
||||
if (JSON.stringify(names) !== spotDom.names) {
|
||||
spotDom.names = JSON.stringify(names);
|
||||
const chosen = spotDom.recipient.value;
|
||||
spotDom.recipient.replaceChildren(...names.map((name) => h("option", {value: name, selected: name === chosen}, name)));
|
||||
}
|
||||
drawBars();
|
||||
drawSpeak();
|
||||
}
|
||||
|
||||
function agentsToolbar() {
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
document.getElementById("palette-open").addEventListener("click", openPalette);
|
||||
document.getElementById("settings-open").addEventListener("click", settingsSheet);
|
||||
document.getElementById("bubbles-toggle").addEventListener("click", toggleBubbles);
|
||||
document.addEventListener("click", (event) => closeMenus(event.target instanceof Element ? event.target.closest("details.menu") : null));
|
||||
document.addEventListener("click", (event) => closeMenus(event.target instanceof Element ? event.target.closest(MENUS) : null));
|
||||
document.addEventListener("scroll", placeStations, {capture: true, passive: true});
|
||||
document.addEventListener("fullscreenchange", () => {
|
||||
if (!document.fullscreenElement) {
|
||||
document.body.classList.remove("leitstand");
|
||||
@@ -36,6 +37,7 @@
|
||||
window.addEventListener("resize", redrawSky);
|
||||
window.addEventListener("resize", refresh3d);
|
||||
window.addEventListener("resize", placePopup);
|
||||
window.addEventListener("resize", placeStations);
|
||||
skyPanel();
|
||||
radioSpot();
|
||||
radio.element = radioElement();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
mayday: "MAYDAY: all agents pause writing steps until you cancel it.",
|
||||
};
|
||||
const VOICE_POLL = 700;
|
||||
const composer = {voice: "", recorder: null, timer: 0, started: 0};
|
||||
const composer = {live: null};
|
||||
|
||||
function confirmMayday() {
|
||||
return window.confirm("Send a mayday to all? All agents pause writing steps until you cancel it.");
|
||||
@@ -36,10 +36,25 @@
|
||||
}
|
||||
|
||||
function attachVoice(parts, note) {
|
||||
composer.voice = note;
|
||||
parts.voice = note;
|
||||
parts.attach.checked = false;
|
||||
parts.replay.hidden = !note;
|
||||
parts.replay.replaceChildren(...(note ? [icon("bi-soundwave"), h("span", {class: "muted"}, "Voice message"), voiceReplay(note), h("label", {class: "check"}, parts.attach, "Attach recording"), iconBtn("bi-trash", "Remove recording", "btn small ghost", () => attachVoice(parts, ""))] : []));
|
||||
const audio = note ? voiceReplay(note) : null;
|
||||
parts.replay.replaceChildren(...(note ? [icon("bi-soundwave"), h("span", {class: "muted voice-words"}, "Voice message"), audio, playToggle(audio), h("label", {class: "check"}, parts.attach, h("span", {}, "Attach", h("span", {class: "voice-words"}, " recording"))), iconBtn("bi-trash", "Remove recording", "btn small ghost", () => attachVoice(parts, ""))] : []));
|
||||
}
|
||||
|
||||
function playToggle(audio) {
|
||||
const button = iconBtn("bi-play-fill", "Play voice message", "btn small ghost voice-play", () => (audio.paused ? audio.play().catch((error) => toast("Playback failed", [String(error)], false)) : audio.pause()));
|
||||
const show = () => {
|
||||
const label = audio.paused ? "Play voice message" : "Pause voice message";
|
||||
button.setAttribute("aria-label", label);
|
||||
button.title = label;
|
||||
button.querySelector("use").setAttribute("href", audio.paused ? "#bi-play-fill" : "#bi-pause-fill");
|
||||
};
|
||||
for (const kind of ["play", "pause", "ended"]) {
|
||||
audio.addEventListener(kind, show);
|
||||
}
|
||||
return button;
|
||||
}
|
||||
|
||||
async function heardNote(note) {
|
||||
@@ -92,13 +107,20 @@
|
||||
parts.record.replaceChildren(icon(on ? "bi-stop-fill" : "bi-record-circle"), on ? "Stop" : "Record");
|
||||
}
|
||||
|
||||
function stopRecording() {
|
||||
if (composer.recorder && composer.recorder.state === "recording") {
|
||||
composer.recorder.stop();
|
||||
function stopRecording(parts) {
|
||||
if (parts && parts.recorder && parts.recorder.state === "recording") {
|
||||
parts.recorder.stop();
|
||||
}
|
||||
}
|
||||
|
||||
function freeMicrophone(parts) {
|
||||
if (composer.live && composer.live !== parts) {
|
||||
stopRecording(composer.live);
|
||||
}
|
||||
}
|
||||
|
||||
async function startRecording(parts) {
|
||||
freeMicrophone(parts);
|
||||
let media = null;
|
||||
try {
|
||||
media = await navigator.mediaDevices.getUserMedia({audio: {channelCount: 1, echoCancellation: true, noiseSuppression: true}});
|
||||
@@ -115,19 +137,24 @@
|
||||
});
|
||||
recorder.addEventListener("stop", () => {
|
||||
media.getTracks().forEach((track) => track.stop());
|
||||
window.clearInterval(composer.timer);
|
||||
composer.recorder = null;
|
||||
window.clearInterval(parts.timer);
|
||||
parts.recorder = null;
|
||||
if (composer.live === parts) {
|
||||
composer.live = null;
|
||||
}
|
||||
recordLabel(parts, false);
|
||||
keepRecording(new Blob(chunks, {type: recorder.mimeType}), parts);
|
||||
}, {once: true});
|
||||
Object.assign(composer, {recorder, started: Date.now()});
|
||||
freeMicrophone(parts);
|
||||
Object.assign(parts, {recorder, started: Date.now()});
|
||||
composer.live = parts;
|
||||
recorder.start();
|
||||
recordLabel(parts, true);
|
||||
composer.timer = window.setInterval(() => {
|
||||
const seconds = Math.floor((Date.now() - composer.started) / 1000);
|
||||
parts.timer = window.setInterval(() => {
|
||||
const seconds = Math.floor((Date.now() - parts.started) / 1000);
|
||||
parts.status.textContent = `Recording ${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")} of at most ${state.speech.seconds} s`;
|
||||
if (seconds >= state.speech.seconds) {
|
||||
stopRecording();
|
||||
stopRecording(parts);
|
||||
}
|
||||
}, 250);
|
||||
}
|
||||
@@ -136,33 +163,31 @@
|
||||
const channel = h("select", {class: "field"}, CHANNELS.map(([id, label]) => h("option", {value: id}, label)));
|
||||
const recipient = h("select", {class: "field"});
|
||||
const toField = h("label", {}, "To", recipient);
|
||||
const text = h("textarea", {"aria-label": "Message", placeholder: "Message to the agents …", maxlength: 20000, on: {input: (event) => {
|
||||
ui.draft = event.target.value;
|
||||
}}});
|
||||
text.value = ui.draft;
|
||||
const text = h("textarea", {"aria-label": "Message", placeholder: "Message to the agents …", maxlength: 20000});
|
||||
const replay = h("div", {class: "voice-note", hidden: true});
|
||||
const hint = h("p", {class: "muted"});
|
||||
const hint = h("span", {class: "muted composer-hint"});
|
||||
const status = h("span", {class: "muted composer-status", "aria-live": "polite"});
|
||||
const record = h("button", {type: "button", class: "btn small", "aria-pressed": "false", title: "Record: one click starts, another stops; the hub transcribes, you check the text before sending"});
|
||||
const submit = h("button", {type: "submit", class: "btn primary ptt", title: "PTT: push to transmit the message; your passkey signs it"}, icon("bi-broadcast-pin"), "PTT");
|
||||
const attach = h("input", {type: "checkbox", title: "Attach recording: the agents get the path of the sound file; otherwise only the checked text goes out"});
|
||||
const parts = {record, status, text, replay, attach};
|
||||
const parts = {record, status, text, replay, attach, voice: "", recorder: null, timer: 0, started: 0};
|
||||
recordLabel(parts, false);
|
||||
const gap = micGap();
|
||||
if (gap) {
|
||||
record.disabled = true;
|
||||
record.title = `Record: ${gap}`;
|
||||
}
|
||||
record.addEventListener("click", () => (composer.recorder ? stopRecording() : startRecording(parts)));
|
||||
record.addEventListener("click", () => (parts.recorder ? stopRecording(parts) : startRecording(parts)));
|
||||
const sync = () => {
|
||||
const direct = TO_ONE.some(([id]) => id === channel.value);
|
||||
toField.hidden = !direct;
|
||||
hint.textContent = `${CHANNEL_HINTS[channel.value]} Your passkey signs every message.`;
|
||||
channel.title = hint.textContent;
|
||||
};
|
||||
channel.addEventListener("change", sync);
|
||||
sync();
|
||||
const form = h("form", {class: "composer"}, h("div", {class: "composer-grid"}, h("label", {}, "Channel", channel), toField), text, replay, hint,
|
||||
h("div", {class: "actions"}, record, status, h("span", {class: "spacer"}), submit));
|
||||
const form = h("form", {class: "composer"}, h("div", {class: "composer-grid"}, h("label", {}, "Channel", channel), toField), text, replay,
|
||||
h("div", {class: "actions"}, record, status, hint, submit));
|
||||
form.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
const direct = TO_ONE.some(([id]) => id === channel.value);
|
||||
@@ -174,14 +199,13 @@
|
||||
return;
|
||||
}
|
||||
submit.disabled = true;
|
||||
if (await radioSend({to: direct ? recipient.value : "*", text: text.value, upload: "", cls: channel.value, voice: attach.checked ? composer.voice : ""})) {
|
||||
if (await radioSend({to: direct ? recipient.value : "*", text: text.value, upload: "", cls: channel.value, voice: attach.checked ? parts.voice : ""})) {
|
||||
text.value = "";
|
||||
ui.draft = "";
|
||||
status.textContent = "";
|
||||
attachVoice(parts, "");
|
||||
}
|
||||
submit.disabled = false;
|
||||
});
|
||||
attachVoice(parts, composer.voice);
|
||||
return {form, recipient, text};
|
||||
attachVoice(parts, "");
|
||||
return {form, recipient, text, channel};
|
||||
}
|
||||
@@ -137,10 +137,16 @@
|
||||
return button;
|
||||
}
|
||||
|
||||
const MENUS = "details.menu, details.radio-station";
|
||||
|
||||
function closeMenus(keep) {
|
||||
for (const menu of document.querySelectorAll("details.menu[open]")) {
|
||||
if (menu !== keep) {
|
||||
for (const menu of document.querySelectorAll(MENUS)) {
|
||||
if (menu.open && menu !== keep) {
|
||||
const inside = menu.contains(document.activeElement);
|
||||
menu.open = false;
|
||||
if (inside) {
|
||||
menu.querySelector("summary").focus({preventScroll: true});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
const HOME_PATH = "home.pins";
|
||||
const HOME_FETCH = 3000;
|
||||
const HOME_MESSAGE = 30000;
|
||||
const HOME_RADIO = 12;
|
||||
const HOME_MARKS = [['section[aria-label="Radio log"]', "radio-log"], ['section[aria-label="Recently sent"]', "radio-log"]];
|
||||
const HOME_MARKS = [['section[aria-label="Recently sent"]', "radio-log"]];
|
||||
const homeView = {dom: null, pins: [], tiles: new Map(), hosts: new Map(), messages: new Map(), drag: null, mark: () => null, touched: false, fetched: {}};
|
||||
const homeStore = Panels.store(typeof ViewStore === "object" && ViewStore ? ViewStore : Panels.memory(), HOME_PATH);
|
||||
const homePins = () => homeView.pins;
|
||||
@@ -58,12 +57,10 @@
|
||||
return entry ? h("ol", {class: "feed"}, eventRow(entry)) : null;
|
||||
}
|
||||
|
||||
function homeRadio() {
|
||||
const rows = state.radio.slice(-HOME_RADIO).reverse();
|
||||
return rows.length ? h("ul", {class: "mini"}, rows.map((row) => h("li", {},
|
||||
h("div", {class: "row"}, klass(row.class), when(row.ts)),
|
||||
h("span", {class: "muted"}, `${dash(row.from)} → ${targetsOf(row)}`),
|
||||
h("span", {}, short(row.text))))) : h("p", {class: "muted"}, "No radio in the chosen time range yet.");
|
||||
function homeRadio(id) {
|
||||
const host = homeView.hosts.get(id) || radioPart(id);
|
||||
homeView.hosts.set(id, host);
|
||||
return host;
|
||||
}
|
||||
|
||||
function homeTree(draw) {
|
||||
@@ -147,7 +144,10 @@
|
||||
}
|
||||
|
||||
Panels.panel("stream", "Stream", homeStream);
|
||||
Panels.panel("radio-log", "Radio log", homeRadio);
|
||||
Panels.panel("radio-log", "Radio log", () => homeRadio("radio-log"), "", [6, 5]);
|
||||
Panels.panel("radio", "Radio", () => homeRadio("radio"), "", [12, 7]);
|
||||
Panels.panel("radio-device", "Radio: device", () => homeRadio("radio-device"), "", [6, 6]);
|
||||
Panels.panel("radio-speak", "Radio: speak", () => homeRadio("radio-speak"), "", [6, 5]);
|
||||
Panels.panel("agents/orbit", "Agents: Orbit", homeOrbit);
|
||||
Panels.panel("agents/chord", "Agents: Chord", () => chord());
|
||||
Panels.panel("agents/swimlane", "Agents: Swimlane", () => swimlane());
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
};
|
||||
const TAB_LABELS = {sent: ["bi-arrow-up-right", "Sent", "Sent: what you transmitted"], received: ["bi-arrow-down-left", "Received", "Received: radio to you or to all"], all: ["bi-journal-text", "All", "All: every radio row the hub logs"]};
|
||||
const CHIP_LABELS = {class: "Class", from: "Sender", to: "Recipient", agent: "Agent"};
|
||||
let radioDom = null;
|
||||
const COPIED = 1600;
|
||||
const FOLDED_READERS = 3;
|
||||
const radioParts = {bars: [], devices: [], logs: [], speaks: []};
|
||||
const liveParts = (kind) => radioParts[kind].filter((part) => part.root.isConnected);
|
||||
|
||||
function voiceReplay(note) {
|
||||
return typeof note === "string" && NOTE_ID.test(note) ? h("audio", {class: "voice-replay", controls: true, preload: "none", src: `/api/voice/${note}.wav`, "aria-label": "Play voice message"}) : null;
|
||||
@@ -48,43 +51,51 @@
|
||||
action);
|
||||
}
|
||||
|
||||
function nowPlaying() {
|
||||
const stream = settings.streams[radio.index];
|
||||
if (!stream || !radio.state) {
|
||||
return null;
|
||||
}
|
||||
const [kind, label] = stationState(stream, radio.index);
|
||||
return h("span", {class: "pill station-now", "data-tone": STATION_TONES[kind], title: `${stream.name}: ${label}`}, label);
|
||||
}
|
||||
|
||||
function drawStations() {
|
||||
if (!radioDom) {
|
||||
return;
|
||||
}
|
||||
const sig = JSON.stringify([settings.streams, radio.index, radio.state, radio.note, radio.pick, Math.floor(Date.now() / 60000)]);
|
||||
if (sig === radioDom.stationsSig) {
|
||||
return;
|
||||
for (const part of liveParts("devices")) {
|
||||
if (sig === part.stationsSig) {
|
||||
continue;
|
||||
}
|
||||
part.stationsSig = sig;
|
||||
part.now.replaceChildren(...[nowPlaying()].filter(Boolean));
|
||||
part.stations.replaceChildren(...(settings.streams.length
|
||||
? settings.streams.map(stationRow)
|
||||
: [h("li", {class: "muted"}, "No station yet: add one with Edit stations.")]));
|
||||
}
|
||||
radioDom.stationsSig = sig;
|
||||
radioDom.stations.replaceChildren(...(settings.streams.length
|
||||
? settings.streams.map(stationRow)
|
||||
: [h("li", {class: "muted"}, "No station yet: add one with Edit stations.")]));
|
||||
}
|
||||
|
||||
function drawDisplay() {
|
||||
if (!radioDom) {
|
||||
return;
|
||||
}
|
||||
const {lamp, cls, mode, cpu} = radioDom.face;
|
||||
const now = speech.current;
|
||||
const newest = state.radio[state.radio.length - 1];
|
||||
const shown = now ? now.cls : newest ? newest.class : "";
|
||||
const gate = state.speech.gate;
|
||||
const playing = Boolean(now && speech.source);
|
||||
const sent = Boolean(playing && now.sent);
|
||||
lamp.dataset.lit = String(playing);
|
||||
lamp.dataset.tx = String(sent);
|
||||
lamp.textContent = sent ? "TX" : "RX";
|
||||
lamp.setAttribute("aria-label", playing ? `${sent ? "TX" : "RX"}: sound plays` : "RX: no sound");
|
||||
lamp.title = lamp.getAttribute("aria-label");
|
||||
cls.textContent = shown ? CLASSES[shown] || shown : "–";
|
||||
mode.textContent = MODE_LABELS[radioSet.mode][1];
|
||||
cpu.textContent = gate.cpu === null ? "CPU ?" : `CPU ${Math.round(gate.cpu)} %`;
|
||||
cpu.dataset.open = String(gate.open);
|
||||
cpu.title = gate.cpu === null
|
||||
? `No host CPU sample of the last two minutes: the hub renders no new speech line, threshold ${gate.threshold} %`
|
||||
: `Host CPU ${fixed(gate.cpu)} %: new speech renders below ${gate.threshold} %${gate.open ? "" : ", so the radio plays the burst"}`;
|
||||
for (const part of liveParts("devices")) {
|
||||
const {lamp, cls, mode, cpu} = part.face;
|
||||
lamp.dataset.lit = String(playing);
|
||||
lamp.dataset.tx = String(sent);
|
||||
lamp.textContent = sent ? "TX" : "RX";
|
||||
lamp.setAttribute("aria-label", playing ? `${sent ? "TX" : "RX"}: sound plays` : "RX: no sound");
|
||||
lamp.title = lamp.getAttribute("aria-label");
|
||||
cls.textContent = shown ? CLASSES[shown] || shown : "–";
|
||||
mode.textContent = MODE_LABELS[radioSet.mode][1];
|
||||
cpu.textContent = gate.cpu === null ? "CPU ?" : `CPU ${Math.round(gate.cpu)} %`;
|
||||
cpu.dataset.open = String(gate.open);
|
||||
cpu.title = gate.cpu === null
|
||||
? `No host CPU sample of the last two minutes: the hub renders no new speech line, threshold ${gate.threshold} %`
|
||||
: `Host CPU ${fixed(gate.cpu)} %: new speech renders below ${gate.threshold} %${gate.open ? "" : ", so the radio plays the burst"}`;
|
||||
}
|
||||
}
|
||||
|
||||
function drawSpeaker() {
|
||||
@@ -92,17 +103,17 @@
|
||||
for (const art of document.querySelectorAll(".avatar[data-face]")) {
|
||||
art.classList.toggle("speaking", Boolean(now && art.dataset.face === now.who));
|
||||
}
|
||||
if (radioDom) {
|
||||
const {caption} = radioDom.face;
|
||||
for (const part of liveParts("devices")) {
|
||||
const {caption} = part.face;
|
||||
caption.hidden = !now;
|
||||
caption.replaceChildren(...(now ? [
|
||||
h("span", {class: "speaker-face"}, face(now.who, false)),
|
||||
h("strong", {}, `${nameOf(now.who)} speaking`),
|
||||
h("strong", {}, nameOf(now.who), h("span", {class: "caption-verb"}, " speaking")),
|
||||
h("span", {class: "caption-line", title: now.line}, now.line),
|
||||
iconBtn("bi-stop-fill", "Stop speaking", "btn small ghost", cancelSpeech),
|
||||
] : []));
|
||||
drawDisplay();
|
||||
}
|
||||
drawDisplay();
|
||||
if (ui.screen === "agents" && (ui.views.agents === "orbit" || ui.views.agents === "chord")) {
|
||||
stage();
|
||||
}
|
||||
@@ -115,17 +126,17 @@
|
||||
value.textContent = event.target.value;
|
||||
change(Number(event.target.value));
|
||||
}}});
|
||||
return {input, value, row: h("label", {class: "knob-row", title: hint}, h("span", {class: "knob-label", title: label}, label), input, value)};
|
||||
return {input, value, row: h("div", {class: "knob-row", title: hint}, h("span", {class: "knob-label", title: label}, label), input, value)};
|
||||
}
|
||||
|
||||
function toneKnob(id, label) {
|
||||
const toggle = h("button", {type: "button", class: "btn small ghost icon-only", "aria-pressed": "false", ...named(`${label} tone`), on: {click: () => {
|
||||
const toggle = h("button", {type: "button", class: "btn small ghost icon-only knob-toggle", "aria-pressed": "false", ...named(`${label} tone`), on: {click: () => {
|
||||
keepRadio({sounds: {...radioSet.sounds, [id]: {...radioSet.sounds[id], on: !radioSet.sounds[id].on}}});
|
||||
}}});
|
||||
const level = knob(label, `${label}: tone volume; speech and the burst of these rows play at it`, {min: 0, max: 1, step: 0.05}, (volume) => {
|
||||
keepRadio({sounds: {...radioSet.sounds, [id]: {...radioSet.sounds[id], volume}}});
|
||||
});
|
||||
const test = iconBtn("bi-play-fill", `Test ${label}`, "btn small ghost", () => play(id, loudness(id)), `Test: play the ${label} tone`);
|
||||
const test = iconBtn("bi-play-fill", `Test ${label}`, "btn small ghost knob-test", () => play(id, loudness(id)), `Test: play the ${label} tone`);
|
||||
level.row.prepend(toggle);
|
||||
level.row.append(test);
|
||||
return {id, toggle, level};
|
||||
@@ -145,13 +156,12 @@
|
||||
threshold.value.textContent = `${value} %`;
|
||||
});
|
||||
threshold.input.addEventListener("change", (event) => setThreshold(Number(event.target.value)));
|
||||
const check = iconBtn("bi-broadcast", "Radio check", "btn small ghost", () => say({steps: [{kind: "speech", text: state.speech.sample}], voice: state.speech.operator, tone: "direct", cls: "newsletter", who: HUMAN, sent: true, line: "radio check"}), "Radio check: hear the operator's voice once");
|
||||
const check = iconBtn("bi-broadcast", "Radio check", "btn small ghost radio-check", () => say({steps: [{kind: "speech", text: state.speech.sample}], voice: state.speech.operator, tone: "direct", cls: "newsletter", who: HUMAN, sent: true, line: "radio check"}), "Radio check: hear the operator's voice once");
|
||||
check.disabled = !state.speech.tts;
|
||||
radioDom.knobs = {tones, squelch, threshold, check};
|
||||
return [...tones.map((tone) => tone.level.row), squelch.row, threshold.row, h("div", {class: "knob-row"}, check)];
|
||||
return {tones, squelch, threshold, check, rows: [...tones.map((tone) => tone.level.row), squelch.row, threshold.row]};
|
||||
}
|
||||
|
||||
function faceplate() {
|
||||
function faceplate(part) {
|
||||
const lamp = h("span", {class: "radio-lamp", role: "img", "data-lit": "false", "data-tx": "false"}, "RX");
|
||||
const field = (name) => h("span", {class: "radio-field", "data-field": name});
|
||||
const [cls, mode, cpu] = [field("class"), field("mode"), field("cpu")];
|
||||
@@ -163,9 +173,112 @@
|
||||
context();
|
||||
}}}, icon(name), label);
|
||||
}));
|
||||
radioDom.face = {lamp, cls, mode, cpu, caption, modes};
|
||||
part.face = {lamp, cls, mode, cpu, caption, modes};
|
||||
part.knobs = knobs();
|
||||
const display = h("div", {class: "radio-display", role: "group", "aria-label": "Display"}, lamp, cls, mode, cpu);
|
||||
return h("div", {class: "radio-face", role: "group", "aria-label": "Radio set"}, display, caption, modes, h("div", {class: "radio-knobs", role: "group", "aria-label": "Knobs"}, knobs()));
|
||||
return h("div", {class: "radio-face", role: "group", "aria-label": "Radio set"}, display, caption, modes, part.knobs.check,
|
||||
h("div", {class: "radio-knobs", role: "group", "aria-label": "Knobs"}, part.knobs.rows));
|
||||
}
|
||||
|
||||
function toggleGear(part) {
|
||||
const open = part.box.hidden;
|
||||
part.box.replaceChildren(...(open ? [radioFilters()] : []));
|
||||
part.box.hidden = !open;
|
||||
part.gear.setAttribute("aria-expanded", String(open));
|
||||
window.requestAnimationFrame(refresh3d);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} spot whether the bar heads the radio spot.
|
||||
* @returns {object} the bar part: root, gear, its box and the Cancel mayday button.
|
||||
*/
|
||||
function radioBar(spot) {
|
||||
const part = {box: h("div", {class: "radio-gear", id: spot ? "radio-gear" : null, hidden: true})};
|
||||
part.gear = iconBtn("bi-funnel", "Read aloud", "btn small ghost spot-toggle", () => toggleGear(part), "Read aloud: the classes and agents the radio sounds for");
|
||||
part.gear.setAttribute("aria-expanded", "false");
|
||||
if (spot) {
|
||||
part.gear.setAttribute("aria-controls", "radio-gear");
|
||||
}
|
||||
const [, label, , hint] = actionOf("clear-mayday");
|
||||
part.clear = iconBtn("bi-life-preserver", label, "btn small danger", () => confirmAct("clear-mayday", []), hint);
|
||||
part.clear.disabled = !state.silence;
|
||||
part.root = h("div", {class: "spot-bar", "data-star-slot": ""}, h("div", {class: "spot-head"}, spot ? h("h3", {class: "group-title"}, "Radio") : null, h("span", {class: "spacer"}), part.gear, part.clear), part.box);
|
||||
radioParts.bars.push(part);
|
||||
return part;
|
||||
}
|
||||
|
||||
function drawBars() {
|
||||
for (const part of liveParts("bars")) {
|
||||
part.clear.disabled = !state.silence;
|
||||
}
|
||||
}
|
||||
|
||||
function cardHead(title, ...tools) {
|
||||
return h("div", {class: "radio-card-head", "data-star-slot": ""}, h("h3", {class: "group-title"}, title), tools);
|
||||
}
|
||||
|
||||
function stationFold(part) {
|
||||
part.stations = h("ul", {class: "stations", "aria-label": "Stations"});
|
||||
part.now = h("span", {class: "station-now-box"});
|
||||
return h("details", {class: "radio-station", on: {toggle: (event) => placeStation(event.currentTarget)}},
|
||||
h("summary", {title: "Internet radio: the stations, their schedule and Play or Stop"}, caret(), h("h3", {class: "group-title"}, "Internet radio"), part.now),
|
||||
h("div", {class: "station-body"}, h("div", {class: "station-tools"}, btn("Edit stations", "btn small ghost", stationsSheet)), part.stations));
|
||||
}
|
||||
|
||||
function placeStation(fold) {
|
||||
if (!fold.open) {
|
||||
return;
|
||||
}
|
||||
const edge = fold.getBoundingClientRect();
|
||||
let [top, bottom] = [0, window.innerHeight];
|
||||
for (let node = fold.parentElement; node && node !== document.documentElement; node = node.parentElement) {
|
||||
const look = getComputedStyle(node);
|
||||
if (look.overflowX !== "visible" || look.overflowY !== "visible") {
|
||||
const clip = node.getBoundingClientRect();
|
||||
[top, bottom] = [Math.max(top, clip.top), Math.min(bottom, clip.bottom)];
|
||||
}
|
||||
}
|
||||
const [above, below] = [Math.floor(edge.top - top), Math.floor(bottom - edge.bottom)];
|
||||
fold.style.removeProperty("--room");
|
||||
const up = above >= fold.querySelector(".station-body").offsetHeight || above >= below;
|
||||
fold.dataset.side = up ? "up" : "down";
|
||||
fold.style.setProperty("--room", `${Math.max(0, up ? above : below)}px`);
|
||||
}
|
||||
|
||||
function placeStations(event) {
|
||||
for (const fold of document.querySelectorAll("details.radio-station[open]")) {
|
||||
if (!(event && event.target instanceof Node && fold.contains(event.target))) {
|
||||
placeStation(fold);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function deviceCard() {
|
||||
const part = {stationsSig: ""};
|
||||
const face = faceplate(part);
|
||||
part.root = h("section", {class: "radio-card radio-device", "data-panel": "radio-device", "aria-label": "Device"}, cardHead("Device"), face, stationFold(part));
|
||||
radioParts.devices.push(part);
|
||||
return part;
|
||||
}
|
||||
|
||||
function speakCard() {
|
||||
const {form, recipient, text, channel} = composerForm();
|
||||
const part = {recipient, text, channel, names: ""};
|
||||
part.root = h("section", {class: "radio-card radio-speak", "data-panel": "radio-speak", "aria-label": "Speak"}, cardHead("Speak"), form);
|
||||
radioParts.speaks.push(part);
|
||||
return part;
|
||||
}
|
||||
|
||||
function drawSpeak() {
|
||||
const names = agentNames();
|
||||
const sig = JSON.stringify(names);
|
||||
for (const part of liveParts("speaks")) {
|
||||
if (sig !== part.names) {
|
||||
part.names = sig;
|
||||
const chosen = part.recipient.value;
|
||||
part.recipient.replaceChildren(...names.map((name) => h("option", {value: name, selected: name === chosen}, name)), ...(chosen && !names.includes(chosen) ? [h("option", {value: chosen, selected: true}, chosen)] : []));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function radioFilters() {
|
||||
@@ -185,8 +298,10 @@
|
||||
}
|
||||
|
||||
function redrawFilters() {
|
||||
if (spotDom && !spotDom.gearBox.hidden) {
|
||||
spotDom.gearBox.replaceChildren(radioFilters());
|
||||
for (const part of liveParts("bars")) {
|
||||
if (!part.box.hidden) {
|
||||
part.box.replaceChildren(radioFilters());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,103 +309,284 @@
|
||||
keepRadio({log: {...radioSet.log, ...change}});
|
||||
}
|
||||
|
||||
function chipSelect(name, values) {
|
||||
const chosen = radioSet.log.chips[name];
|
||||
function chipSelect(name) {
|
||||
const label = CHIP_LABELS[name];
|
||||
const select = h("select", {class: "field", "aria-label": label, title: `${label}: filter the log`, on: {change: (event) => keepLog({chips: {...radioSet.log.chips, [name]: event.target.value}})}});
|
||||
return h("label", {class: "chip-select", "data-chip": name, "data-active": "false"}, select);
|
||||
}
|
||||
|
||||
function fillChip(chip, values) {
|
||||
const name = chip.dataset.chip;
|
||||
const chosen = radioSet.log.chips[name];
|
||||
const options = [...new Set([...values, ...(chosen ? [chosen] : [])])];
|
||||
const select = h("select", {class: "field", "aria-label": label, title: `${label}: filter the log`, on: {change: (event) => keepLog({chips: {...radioSet.log.chips, [name]: event.target.value}})}},
|
||||
h("option", {value: ""}, `${label}: any`), options.map((value) => h("option", {value, selected: value === chosen}, name === "class" ? CLASSES[value] || value : value)));
|
||||
return h("label", {class: "chip-select", "data-chip": name, "data-active": String(Boolean(chosen))}, select);
|
||||
const select = chip.querySelector("select");
|
||||
const sig = JSON.stringify([options, chosen || ""]);
|
||||
if (select.sig !== sig) {
|
||||
select.sig = sig;
|
||||
select.replaceChildren(h("option", {value: ""}, `${CHIP_LABELS[name]}: any`), ...options.map((value) => h("option", {value, selected: value === chosen}, name === "class" ? CLASSES[value] || value : value)));
|
||||
}
|
||||
setAttr(chip, "data-active", String(Boolean(chosen)));
|
||||
}
|
||||
|
||||
function setAttr(node, name, value) {
|
||||
if (node.getAttribute(name) !== value) {
|
||||
node.setAttribute(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
function setText(node, value) {
|
||||
if (node.textContent !== value) {
|
||||
node.textContent = value;
|
||||
}
|
||||
}
|
||||
|
||||
function firstLine(text) {
|
||||
return text.split("\n").map((part) => part.trim()).find(Boolean) || "";
|
||||
}
|
||||
|
||||
function logLine(row) {
|
||||
const message = row.sent ? row : RadioSet.ledgerOf(row, state.messages);
|
||||
const sent = Boolean(message);
|
||||
const [name, label] = sent ? ["bi-arrow-up-right", "Sent"] : ["bi-arrow-down-left", "Received"];
|
||||
const first = row.text.split("\n").map((part) => part.trim()).find(Boolean) || "";
|
||||
return h("li", {class: "radio-row", "data-dir": sent ? "sent" : "received", "data-class": row.class},
|
||||
h("details", {}, h("summary", {},
|
||||
const first = firstLine(row.text);
|
||||
const line = h("li", {class: "radio-row", "data-key": row.key, "data-dir": sent ? "sent" : "received", "data-class": row.class, "data-ts": row.ts, on: {click: (event) => openRadioRow(event.currentTarget.row, event.currentTarget)}},
|
||||
h("button", {type: "button", class: "radio-pick", "aria-haspopup": "dialog", title: first},
|
||||
when(row.ts),
|
||||
h("span", {class: "radio-dir", role: "img", ...named(label)}, icon(name)),
|
||||
klass(row.class),
|
||||
h("span", {class: "radio-route"}, `${row.from} → ${targetsOf(row)}`),
|
||||
h("span", {class: "radio-line", title: first}, first)),
|
||||
h("span", {class: "radio-line"}, first)),
|
||||
foldedReaders(row));
|
||||
line.row = row;
|
||||
return line;
|
||||
}
|
||||
|
||||
function keepLine(kept, fresh) {
|
||||
kept.row = fresh.row;
|
||||
if (kept.outerHTML === fresh.outerHTML) {
|
||||
return kept;
|
||||
}
|
||||
for (const name of ["data-dir", "data-class"]) {
|
||||
setAttr(kept, name, fresh.getAttribute(name));
|
||||
}
|
||||
const [pick, twin] = [kept.querySelector(".radio-pick"), fresh.querySelector(".radio-pick")];
|
||||
setAttr(pick, "title", twin.getAttribute("title"));
|
||||
pick.replaceChildren(...twin.childNodes);
|
||||
for (const node of [...kept.children].filter((child) => child !== pick)) {
|
||||
node.remove();
|
||||
}
|
||||
kept.append(...[...fresh.children].filter((child) => child !== twin));
|
||||
return kept;
|
||||
}
|
||||
|
||||
function patchList(list, lines) {
|
||||
const before = [...list.children];
|
||||
const focused = before.find((node) => node.contains(document.activeElement)) || null;
|
||||
const old = new Map(before.filter((node) => node.dataset.key).map((node) => [node.dataset.key, node]));
|
||||
const wanted = lines.map((line) => {
|
||||
const kept = old.get(line.dataset.key);
|
||||
old.delete(line.dataset.key);
|
||||
return kept ? keepLine(kept, line) : line;
|
||||
});
|
||||
const keep = new Set(wanted);
|
||||
for (const node of before.filter((child) => !keep.has(child))) {
|
||||
node.remove();
|
||||
}
|
||||
wanted.forEach((node, index) => {
|
||||
if (list.children[index] !== node) {
|
||||
list.insertBefore(node, list.children[index] || null);
|
||||
}
|
||||
});
|
||||
if (focused && !focused.isConnected) {
|
||||
const at = before.indexOf(focused);
|
||||
const near = before.filter((node) => node.isConnected && node.querySelector(".radio-pick")).sort((a, b) => Math.abs(before.indexOf(a) - at) - Math.abs(before.indexOf(b) - at))[0];
|
||||
(near ? near.querySelector(".radio-pick") : list).focus({preventScroll: true});
|
||||
}
|
||||
}
|
||||
|
||||
function foldedReaders(row) {
|
||||
const strip = readerRow(row);
|
||||
const {shown, hidden} = Receipts.strip(row);
|
||||
const rest = shown.length + hidden.length - FOLDED_READERS;
|
||||
if (strip && rest > 0) {
|
||||
strip.append(h("span", {class: "readers-more readers-fold", role: "img", ...named(`${rest} more readers`, [...shown, ...hidden].slice(FOLDED_READERS).map(readLabel).join("\n"))}, `+${rest}`));
|
||||
}
|
||||
return strip;
|
||||
}
|
||||
|
||||
function readerLine(reader) {
|
||||
const known = reader.read !== null && reader.read !== undefined;
|
||||
return h("li", {class: "popup-reader", "data-session": reader.session, "data-acked": String(reader.acked)},
|
||||
face(people()[reader.session] ? reader.session : reader.name, false),
|
||||
h("strong", {}, reader.name),
|
||||
h("span", {class: "muted"}, known ? `read ${reader.approximate ? "about " : ""}${absolute.format(stampOf(reader.read))}` : "read, time unknown"),
|
||||
reader.acked ? pill("acknowledged", "ok") : null);
|
||||
}
|
||||
|
||||
function copyText(text) {
|
||||
const said = h("span", {class: "radio-said", role: "status", "aria-live": "polite"});
|
||||
const button = h("button", {type: "button", class: "btn small radio-copy", ...named("Copy", "Copy: the full message to the clipboard")}, icon("bi-clipboard"), h("span", {}, "Copy"));
|
||||
const show = (name, word, done, note) => {
|
||||
button.replaceChildren(icon(name), h("span", {}, word));
|
||||
button.setAttribute("aria-label", word);
|
||||
button.dataset.copied = done;
|
||||
said.textContent = note;
|
||||
};
|
||||
button.addEventListener("click", async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
show("bi-clipboard-check", "Copied", "true", "Copied: the full message is on the clipboard");
|
||||
} catch {
|
||||
show("bi-x-circle", "Not copied", "false", "Not copied: the browser refused the clipboard");
|
||||
}
|
||||
window.setTimeout(() => show("bi-clipboard", "Copy", "", ""), COPIED);
|
||||
});
|
||||
return [button, said];
|
||||
}
|
||||
|
||||
function replyTarget(list) {
|
||||
const home = list ? list.closest(".radio-home") : null;
|
||||
if (!home) {
|
||||
return spotDom.speak;
|
||||
}
|
||||
const homes = liveParts("speaks").filter((part) => part.root.closest(".radio-home"));
|
||||
return homes.find((part) => home.contains(part.root)) || homes.find((part) => part.root.closest(".radio-home-radio-speak")) || homes[0] || spotDom.speak;
|
||||
}
|
||||
|
||||
function replyTo(row, list) {
|
||||
const who = row.from === HUMAN && row.to.length ? row.to[0] : row.from;
|
||||
const part = replyTarget(list);
|
||||
closePopup();
|
||||
if (part === spotDom.speak) {
|
||||
openSpot(true);
|
||||
}
|
||||
part.channel.value = "post";
|
||||
part.channel.dispatchEvent(new Event("change", {bubbles: true}));
|
||||
if (![...part.recipient.options].some((option) => option.value === who)) {
|
||||
part.recipient.append(h("option", {value: who}, who));
|
||||
}
|
||||
part.recipient.value = who;
|
||||
part.text.focus();
|
||||
}
|
||||
|
||||
function openRadioRow(row, li) {
|
||||
const message = row.sent ? row : RadioSet.ledgerOf(row, state.messages);
|
||||
const {shown, hidden} = Receipts.strip(row);
|
||||
const readers = [...shown, ...hidden];
|
||||
const list = li.closest("ul");
|
||||
const anchor = () => (list ? [...list.querySelectorAll(".radio-row")].find((item) => item.dataset.key === row.key) || null : null);
|
||||
openPopup(`Radio message from ${row.from}`, [
|
||||
popupHead(klass(row.class), `${row.from} → ${targetsOf(row)}`),
|
||||
meta([["Sender", row.from], ["Recipient", targetsOf(row)], ["Class", CLASSES[row.class] || row.class], ["Time", absolute.format(stampOf(row.ts))]]),
|
||||
h("pre", {class: "radio-full"}, row.text),
|
||||
voiceReplay(message ? message.voice : null)),
|
||||
readerRow(row));
|
||||
voiceReplay(message ? message.voice : null),
|
||||
h("div", {class: "actions radio-actions"},
|
||||
h("button", {type: "button", class: "btn small primary radio-reply", ...named("Reply", "Reply: a post to the sender in the speak card"), on: {click: () => replyTo(row, list)}}, icon("bi-reply"), "Reply"),
|
||||
copyText(row.text)),
|
||||
h("h3", {}, readers.length ? `Read by ${readers.length}` : "Read by nobody yet"),
|
||||
readers.length ? h("ul", {class: "popup-readers"}, readers.map(readerLine)) : null,
|
||||
].filter(Boolean), anchor);
|
||||
}
|
||||
|
||||
function drawLog() {
|
||||
const dom = radioDom.log;
|
||||
const entry = radioSet.log;
|
||||
const sig = JSON.stringify([state.radio.length, state.radio.length ? state.radio[state.radio.length - 1].ts : 0, state.messages.length, Receipts.signature(state.radio), Receipts.signature(state.messages), entry, Math.floor(Date.now() / 60000)]);
|
||||
if (sig === dom.sig) {
|
||||
return;
|
||||
for (const dom of liveParts("logs")) {
|
||||
if (sig !== dom.sig) {
|
||||
dom.sig = sig;
|
||||
drawLogPart(dom, entry);
|
||||
}
|
||||
}
|
||||
dom.sig = sig;
|
||||
}
|
||||
|
||||
function drawLogPart(dom, entry) {
|
||||
const counts = RadioSet.counts(state.radio, HUMAN, state.messages);
|
||||
dom.tabs.replaceChildren(...RadioSet.TABS.map((tab) => {
|
||||
const [name, label, hint] = TAB_LABELS[tab];
|
||||
return h("button", {type: "button", role: "tab", "data-tab": tab, "aria-selected": String(tab === entry.tab), title: hint, on: {click: () => keepLog({tab})}},
|
||||
icon(name), label, h("span", {class: "count", "aria-label": `${counts[tab]} rows`}, String(counts[tab])));
|
||||
}));
|
||||
for (const button of dom.tabs.children) {
|
||||
const {tab} = button.dataset;
|
||||
const count = button.querySelector(".count");
|
||||
setAttr(button, "aria-selected", String(tab === entry.tab));
|
||||
setAttr(count, "aria-label", `${counts[tab]} rows`);
|
||||
setText(count, String(counts[tab]));
|
||||
}
|
||||
const choices = RadioSet.choices(state.radio);
|
||||
dom.chips.replaceChildren(...RadioSet.CHIPS.map((name) => chipSelect(name, choices[name])));
|
||||
for (const chip of dom.chips.children) {
|
||||
fillChip(chip, choices[chip.dataset.chip]);
|
||||
}
|
||||
if (document.activeElement !== dom.search && dom.search.value !== entry.q) {
|
||||
dom.search.value = entry.q;
|
||||
}
|
||||
const rows = RadioSet.logRows(state.radio, entry, HUMAN, state.messages);
|
||||
dom.list.replaceChildren(...(rows.length ? rows.map(logLine) : [h("li", {class: "muted"}, state.radio.length ? "No radio row matches the tab, the chips and the search." : "No radio in the chosen time range yet.")]));
|
||||
patchList(dom.list, rows.length ? rows.map(logLine) : [h("li", {class: "muted"}, state.radio.length ? "No radio row matches the tab, the chips and the search." : "No radio in the chosen time range yet.")]);
|
||||
}
|
||||
|
||||
function radioLog() {
|
||||
const tabs = h("div", {class: "radio-tabs", role: "tablist", "aria-label": "Log"});
|
||||
const chips = h("div", {class: "radio-chips", role: "group", "aria-label": "Log filters"});
|
||||
function historyCard() {
|
||||
const tabs = h("div", {class: "radio-tabs", role: "tablist", "aria-label": "Log"}, RadioSet.TABS.map((tab) => {
|
||||
const [name, label, hint] = TAB_LABELS[tab];
|
||||
return h("button", {type: "button", role: "tab", "data-tab": tab, "aria-selected": "false", title: hint, on: {click: () => keepLog({tab})}}, icon(name), label, h("span", {class: "count"}));
|
||||
}));
|
||||
const chips = h("div", {class: "radio-chips", role: "group", "aria-label": "Log filters"}, RadioSet.CHIPS.map(chipSelect));
|
||||
const search = h("input", {type: "search", class: "field", placeholder: "Search the log …", maxlength: 200, ...named("Search the log"), on: {input: (event) => keepLog({q: event.target.value})}});
|
||||
const clear = iconBtn("bi-x-circle", "Clear filters", "btn small ghost", () => keepRadio({log: RadioSet.cleared(radioSet.log)}), "Clear filters: every chip and the search");
|
||||
const list = h("ul", {class: "radio-log", "aria-label": "Radio log"});
|
||||
radioDom.log = {tabs, chips, search, list, sig: ""};
|
||||
return h("section", {class: "radio-logbox", "aria-label": "Radio log"}, tabs, h("div", {class: "radio-filters"}, chips, search, clear), list);
|
||||
const list = h("ul", {class: "radio-log", tabindex: "-1", "aria-label": "Radio log"});
|
||||
const part = {tabs, chips, search, list, sig: ""};
|
||||
part.root = h("section", {class: "radio-card radio-logbox", "data-panel": "radio-log", "aria-label": "Radio log"}, cardHead("History", tabs, search), h("div", {class: "radio-filters"}, chips, clear), list);
|
||||
radioParts.logs.push(part);
|
||||
return part;
|
||||
}
|
||||
|
||||
function drawRadioSet() {
|
||||
if (!radioDom) {
|
||||
return;
|
||||
for (const part of liveParts("devices")) {
|
||||
for (const button of part.face.modes.querySelectorAll("button[data-mode]")) {
|
||||
button.setAttribute("aria-pressed", String(button.dataset.mode === radioSet.mode));
|
||||
}
|
||||
const {tones, squelch, threshold} = part.knobs;
|
||||
for (const {id, toggle, level} of tones) {
|
||||
const sound = radioSet.sounds[id];
|
||||
toggle.setAttribute("aria-pressed", String(sound.on));
|
||||
toggle.replaceChildren(icon(sound.on ? "bi-bell" : "bi-bell-slash"));
|
||||
toggle.title = `${toggle.getAttribute("aria-label")}: ${sound.on ? "on, a press mutes it" : "off, a press turns it on"}`;
|
||||
level.input.value = String(sound.volume);
|
||||
level.value.textContent = sound.volume.toFixed(2);
|
||||
}
|
||||
squelch.input.value = String(radioSet.squelch);
|
||||
squelch.value.textContent = radioSet.squelch.toFixed(2);
|
||||
threshold.input.value = String(settings.speech.threshold);
|
||||
threshold.value.textContent = `${settings.speech.threshold} %`;
|
||||
}
|
||||
for (const button of radioDom.face.modes.querySelectorAll("button[data-mode]")) {
|
||||
button.setAttribute("aria-pressed", String(button.dataset.mode === radioSet.mode));
|
||||
}
|
||||
const {tones, squelch, threshold} = radioDom.knobs;
|
||||
for (const {id, toggle, level} of tones) {
|
||||
const sound = radioSet.sounds[id];
|
||||
toggle.setAttribute("aria-pressed", String(sound.on));
|
||||
toggle.replaceChildren(icon(sound.on ? "bi-bell" : "bi-bell-slash"));
|
||||
toggle.title = `${toggle.getAttribute("aria-label")}: ${sound.on ? "on, a press mutes it" : "off, a press turns it on"}`;
|
||||
level.input.value = String(sound.volume);
|
||||
level.value.textContent = sound.volume.toFixed(2);
|
||||
}
|
||||
squelch.input.value = String(radioSet.squelch);
|
||||
squelch.value.textContent = radioSet.squelch.toFixed(2);
|
||||
threshold.input.value = String(settings.speech.threshold);
|
||||
threshold.value.textContent = `${settings.speech.threshold} %`;
|
||||
drawDisplay();
|
||||
drawLog();
|
||||
}
|
||||
|
||||
function drawRadio() {
|
||||
if (!radioDom) {
|
||||
return;
|
||||
}
|
||||
drawRadioSet();
|
||||
drawStations();
|
||||
drawSpeak();
|
||||
drawBars();
|
||||
}
|
||||
|
||||
function radioSide() {
|
||||
const stations = h("ul", {class: "stations", "aria-label": "Stations"});
|
||||
radioDom = {stations, stationsSig: ""};
|
||||
const face = faceplate();
|
||||
const log = radioLog();
|
||||
const station = h("section", {class: "radio-station", "aria-label": "Internet radio"}, h("div", {class: "card-head"}, h("h3", {class: "group-title"}, "Internet radio"), btn("Edit stations", "btn small ghost", stationsSheet)), stations);
|
||||
/**
|
||||
* @param {boolean} spot whether the body fills the radio spot rather than a Home tile.
|
||||
* @returns {object} its bar, device, speak and history parts and the grid holding the three cards.
|
||||
*/
|
||||
function radioBody(spot) {
|
||||
const bar = radioBar(spot);
|
||||
const device = deviceCard();
|
||||
const speak = speakCard();
|
||||
const history = historyCard();
|
||||
window.setTimeout(drawRadio, 0);
|
||||
return {face, log, station};
|
||||
return {bar, device, speak, history, grid: h("div", {class: "radio-grid"}, device.root, h("div", {class: "radio-column"}, speak.root, history.root))};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} id the Home panel id: radio, radio-device, radio-speak or radio-log.
|
||||
* @returns {Element} a second live instance of that part for a Home tile, without ids and without stars of its own.
|
||||
*/
|
||||
function radioPart(id) {
|
||||
const body = id === "radio" ? radioBody(false) : null;
|
||||
const made = body ? [body.bar.root, body.grid] : {"radio-device": deviceCard, "radio-speak": speakCard, "radio-log": historyCard}[id]().root;
|
||||
const root = h("div", {class: `radio-home radio-home-${id}`}, made);
|
||||
root.querySelectorAll("[data-panel]").forEach((node) => node.removeAttribute("data-panel"));
|
||||
root.querySelectorAll("[data-star-slot]").forEach((node) => node.removeAttribute("data-star-slot"));
|
||||
window.setTimeout(drawRadio, 0);
|
||||
return root;
|
||||
}
|
||||
@@ -105,8 +105,12 @@
|
||||
}
|
||||
const banner = document.getElementById("mayday");
|
||||
const silence = state.silence;
|
||||
banner.hidden = !silence;
|
||||
banner.replaceChildren(...(silence ? [h("p", {class: "text"}, `MAYDAY · ${dash(silence.by)}: ${silence.text}`), iconBtn("bi-x-octagon", "cancel", "btn small", () => confirmAct("clear-mayday", []), "cancel: end the mayday (radio.py clear)")] : []));
|
||||
const alarm = silence ? `MAYDAY · ${dash(silence.by)}: ${silence.text}` : "";
|
||||
if (banner.alarm !== alarm) {
|
||||
banner.alarm = alarm;
|
||||
banner.hidden = !silence;
|
||||
banner.replaceChildren(...(silence ? [h("p", {class: "text", title: alarm}, alarm), iconBtn("bi-x-octagon", "cancel", "btn small", () => confirmAct("clear-mayday", []), "cancel: end the mayday (radio.py clear)")] : []));
|
||||
}
|
||||
document.title = `${state.badges.tasks ? `(${state.badges.tasks}) ` : ""}Agent Orchestrator`;
|
||||
window.setTimeout(measure, 0);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
let state = JSON.parse(document.getElementById("state").textContent);
|
||||
const KINDS = Object.entries(state.kinds);
|
||||
const ui = {screen: "stream", views: {agents: "orbit", artifacts: "tree", tasks: "list"}, preset: DAY, from: null, to: null, asOf: null, playing: false, busy: false, offline: false, agent: null, order: null, draft: "", spot: false, nightOff: new Set(), cursor: 0, selected: new Set(), snoozed: false, review: null, file: 0};
|
||||
const ui = {screen: "stream", views: {agents: "orbit", artifacts: "tree", tasks: "list"}, preset: DAY, from: null, to: null, asOf: null, playing: false, busy: false, offline: false, agent: null, order: null, spot: false, nightOff: new Set(), cursor: 0, selected: new Set(), snoozed: false, review: null, file: 0};
|
||||
const filter = {view: "fuer-dich", saved: "", kinds: new Set(state.views["fuer-dich"].kinds), waiting: true, q: "", agent: "", session: "", sub: "", parts: new Set(PARTS.map(([id]) => id))};
|
||||
const stream = {key: null, events: [], entries: [], last: 0, sessions: {}, busy: false, again: false, dom: null, error: ""};
|
||||
const tree = {data: null, model: null, busy: false, q: "", open: new Set(), dom: null};
|
||||
|
||||
@@ -73,9 +73,10 @@ const Panels = (() => {
|
||||
* @param title - the tile title.
|
||||
* @param render - (size) => Node, size being {w, h} in grid cells.
|
||||
* @param group - optional name of a group of which Home holds one pin at most, such as the 3D views.
|
||||
* @param size - optional [w, h] in grid cells a new pin of the panel gets; SIZES.panel when left out.
|
||||
*/
|
||||
function panel(id, title, render, group) {
|
||||
panels.set(id, {title, render, group: group || ""});
|
||||
function panel(id, title, render, group, size) {
|
||||
panels.set(id, {title, render, group: group || "", size: size || SIZES.panel});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +147,7 @@ const Panels = (() => {
|
||||
if (holder) {
|
||||
return {pins, refused: "group", holder};
|
||||
}
|
||||
const [w, h] = kind === PANEL ? SIZES.panel : SIZES.item;
|
||||
const [w, h] = kind === PANEL ? (panels.get(id) || {size: SIZES.panel}).size : SIZES.item;
|
||||
return {pins: [...pins, plain(view) ? {kind, id, w, h, view} : {kind, id, w, h}], refused: "", holder: null};
|
||||
}
|
||||
|
||||
|
||||
@@ -103,14 +103,28 @@ const RadioSet = (() => {
|
||||
}
|
||||
|
||||
function sentRows(messages, human) {
|
||||
return messages.map((message) => ({ts: message.created_ts, from: human, to: message.to === "*" ? [] : [message.to], class: message.class || "post", text: message.text, voice: message.voice, sent: true, readers: message.readers, acks: message.acks}));
|
||||
return messages.map((message) => ({ts: message.created_ts, from: human, to: message.to === "*" ? [] : [message.to], class: message.class || "post", text: message.text, voice: message.voice, sent: true, id: message.id, readers: message.readers, acks: message.acks}));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array<object>} rows radio rows in arrival order, or sent rows of the ledger.
|
||||
* @returns {Array<object>} copies of the rows, each with a key unique in the list and stable while rows arrive: the ledger id of a sent row, else time, sender and the occurrence index among rows of the same time and sender.
|
||||
*/
|
||||
function keyed(rows) {
|
||||
const seen = new Map();
|
||||
return rows.map((row) => {
|
||||
const base = row.sent ? `sent ${row.id}` : `${row.ts} ${row.from}`;
|
||||
const index = seen.get(base) || 0;
|
||||
seen.set(base, index + 1);
|
||||
return {...row, key: `${base} ${index}`};
|
||||
});
|
||||
}
|
||||
|
||||
function tabRows(rows, tab, human, messages) {
|
||||
if (tab === "sent") {
|
||||
return sentRows(messages, human);
|
||||
return keyed(sentRows(messages, human));
|
||||
}
|
||||
return rows.filter((row) => tab === "all" || toAll(row) || row.to.includes(human));
|
||||
return keyed(rows).filter((row) => tab === "all" || toAll(row) || row.to.includes(human));
|
||||
}
|
||||
|
||||
function matches(row, entry) {
|
||||
@@ -128,7 +142,7 @@ const RadioSet = (() => {
|
||||
* @param {object} entry the log part of the radio set: tab, chips and q.
|
||||
* @param {string} human the operator's name.
|
||||
* @param {Array<object>} messages the hub's message ledger; Sent lists it, not radio rows that only claim the operator's name.
|
||||
* @returns {Array<object>} the rows of the tab that every chip and the search match, newest first.
|
||||
* @returns {Array<object>} keyed copies of the rows of the tab that every chip and the search match, newest first.
|
||||
*/
|
||||
function logRows(rows, entry, human, messages) {
|
||||
return tabRows(rows, entry.tab, human, messages).filter((row) => matches(row, entry)).sort((a, b) => b.ts - a.ts);
|
||||
|
||||
@@ -43,7 +43,7 @@ svg .presence-dot { fill: var(--panel); stroke: currentColor; stroke-width: 1; }
|
||||
.presence .glyph { animation: none; }
|
||||
}
|
||||
.stations { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
|
||||
.station { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-2); min-width: 0; padding: 3px 3px 3px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--sunken); }
|
||||
.station { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-2); min-width: 0; padding: 3px 3px 3px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
|
||||
.station-name, .station-when { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.station-name { font-weight: 600; }
|
||||
.station-when { color: var(--muted); font-size: var(--fs-sm); }
|
||||
@@ -55,71 +55,186 @@ svg .presence-dot { fill: var(--panel); stroke: currentColor; stroke-width: 1; }
|
||||
.station-when { display: none; }
|
||||
}
|
||||
.spot-toggle[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
|
||||
.radio-spot { display: grid; gap: var(--sp-3); max-height: 46vh; margin-bottom: var(--sp-4); overflow: auto; }
|
||||
.radio-spot, .radio-home { container: radio / inline-size; min-width: 0; }
|
||||
.radio-spot { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-4); padding: var(--sp-3); }
|
||||
.radio-spot[hidden], .radio-gear[hidden] { display: none; }
|
||||
body.fit .spot-host { display: flex; flex: 0 1 auto; flex-direction: column; min-height: 0; }
|
||||
body.fit .radio-spot { flex: 0 1 auto; min-height: 0; }
|
||||
.radio-side { display: grid; gap: var(--sp-3); align-content: start; min-width: 0; }
|
||||
.spot-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
|
||||
body.fit .spot-host { flex: none; }
|
||||
.spot-bar { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
|
||||
.spot-head { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
|
||||
.night-picks { display: flex; flex-wrap: wrap; gap: 4px var(--sp-3); max-width: 420px; max-height: 30vh; overflow: auto; }
|
||||
.night-picks:empty { display: none; }
|
||||
.agent-night { align-items: center; margin: 0 0 var(--sp-2); }
|
||||
.spot-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: var(--sp-4); align-items: start; }
|
||||
.radio-gear { min-width: 0; }
|
||||
.composer { display: grid; gap: var(--sp-2); }
|
||||
.spot-bar { position: relative; }
|
||||
.radio-gear { position: absolute; top: calc(100% + var(--sp-1)); right: 0; z-index: 12; width: min(36rem, 100%); min-width: 0; padding: var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--glass-card); box-shadow: var(--shadow-lift); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
|
||||
.radio-grid { display: grid; grid-template-columns: clamp(22rem, 100% - 34rem - var(--sp-3), 26rem) minmax(0, 1fr); gap: var(--sp-3); min-width: 0; }
|
||||
.radio-column { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; min-height: 0; }
|
||||
.radio-card { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--sunken); }
|
||||
.radio-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; min-height: 30px; }
|
||||
.radio-card-head .group-title { margin-inline-end: var(--sp-2); }
|
||||
.composer { display: grid; gap: var(--sp-2); min-width: 0; }
|
||||
.composer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--sp-2) var(--sp-3); }
|
||||
.composer-grid label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: var(--fs-sm); }
|
||||
.composer-grid label { display: grid; grid-template-columns: 4.5em minmax(0, 1fr); align-items: center; gap: var(--sp-2); min-width: 0; color: var(--muted); font-size: var(--fs-sm); }
|
||||
.composer-grid .field { width: 100%; min-width: 0; }
|
||||
.composer textarea { min-height: 64px; }
|
||||
.composer [hidden] { display: none; }
|
||||
.composer .actions { margin-top: 0; }
|
||||
.composer .actions { flex-wrap: wrap; align-items: center; margin-top: 0; }
|
||||
.composer-hint { flex: 1 1 14em; min-width: 0; margin: 0; font-size: var(--fs-xs); }
|
||||
.composer .ptt { margin-inline-start: auto; }
|
||||
.composer-status { min-width: 0; overflow-wrap: anywhere; }
|
||||
.voice-note { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
|
||||
.voice-replay { max-width: 100%; height: 34px; }
|
||||
.mini .voice-replay, .bubble .voice-replay, .radio-row .voice-replay { width: 100%; }
|
||||
.radio-face { display: grid; gap: var(--sp-2); min-width: 0; padding: var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--sunken); }
|
||||
.radio-display { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); min-width: 0; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-family: var(--mono); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
|
||||
.voice-note .voice-play { display: none; }
|
||||
.mini .voice-replay, .bubble .voice-replay, .radio-row .voice-replay, .popup-box .voice-replay { width: 100%; }
|
||||
.radio-face { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-2); min-width: 0; }
|
||||
.radio-face > * { grid-column: 1 / -1; }
|
||||
.radio-face > .radio-modes { grid-column: 1; justify-self: start; }
|
||||
.radio-face > .radio-check { grid-column: 2; align-self: center; }
|
||||
.radio-display { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); min-width: 0; padding: 5px var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-family: var(--mono); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
|
||||
.radio-field { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.radio-field[data-field="class"] { font-weight: 700; }
|
||||
.radio-field[data-field="cpu"] { margin-inline-start: auto; }
|
||||
.radio-field[data-field="cpu"][data-open="false"] { color: var(--warn); }
|
||||
.radio-lamp { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: 999px; background: var(--neutral-soft); color: var(--muted); font-weight: 700; line-height: 20px; }
|
||||
.radio-lamp::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .5; }
|
||||
.radio-lamp[data-lit="true"] { background: var(--ok-soft); color: var(--ok); }
|
||||
.radio-lamp[data-lit="true"][data-tx="true"] { background: var(--bad-soft); color: var(--bad); }
|
||||
.radio-lamp[data-lit="true"]::before { opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
|
||||
.radio-modes { flex-wrap: wrap; justify-self: start; max-width: 100%; }
|
||||
.radio-modes { flex-wrap: wrap; max-width: 100%; }
|
||||
.radio-modes button { display: inline-flex; align-items: center; gap: 6px; }
|
||||
.radio-knobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: var(--sp-1) var(--sp-4); }
|
||||
.knob-row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; color: var(--muted); font-size: var(--fs-sm); }
|
||||
.knob-label { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.knob { flex: 1 1 80px; min-width: 60px; accent-color: var(--accent); }
|
||||
.knob-value { flex: none; min-width: 3.5em; font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
|
||||
.radio-knobs { display: grid; grid-template-columns: 30px minmax(0, max-content) minmax(3rem, 1fr) 3.2em 30px; align-items: center; gap: 2px var(--sp-2); min-width: 0; }
|
||||
.knob-row { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; min-width: 0; min-height: 28px; color: var(--muted); font-size: var(--fs-sm); }
|
||||
.knob-toggle { grid-column: 1; }
|
||||
.knob-label { grid-column: 2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.knob { grid-column: 3; width: 100%; min-width: 0; margin: 0; accent-color: var(--accent); }
|
||||
.knob-value { grid-column: 4; font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
|
||||
.knob-test { grid-column: 5; }
|
||||
.radio-read { display: grid; gap: var(--sp-2); }
|
||||
.radio-read .chips { margin-bottom: 0; }
|
||||
.radio-station { position: relative; min-width: 0; padding-top: var(--sp-2); border-top: 1px solid var(--line); }
|
||||
.radio-station > summary { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; min-height: 30px; cursor: pointer; list-style: none; }
|
||||
.radio-station > summary::-webkit-details-marker { display: none; }
|
||||
.radio-station > summary .caret { flex: none; color: var(--muted); transform: rotate(-90deg); transition: transform .15s; }
|
||||
.radio-station[open] > summary .caret { transform: none; }
|
||||
.station-now-box { display: inline-flex; min-width: 0; margin-inline-start: auto; }
|
||||
.station-body { position: absolute; inset-inline: 0; bottom: 100%; z-index: 3; display: grid; gap: var(--sp-2); max-height: min(12rem, 28vh, var(--room, 100vh)); padding: var(--sp-2); overflow: hidden auto; overscroll-behavior: contain; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--glass-card); box-shadow: var(--shadow-lift); scrollbar-width: thin; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
|
||||
.radio-station[data-side="down"] > .station-body { top: 100%; bottom: auto; }
|
||||
.station-tools { display: flex; justify-content: flex-end; }
|
||||
.ptt { min-width: 96px; justify-content: center; }
|
||||
.radio-logbox { display: grid; gap: var(--sp-2); align-content: start; min-width: 0; }
|
||||
.radio-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); justify-self: start; max-width: 100%; }
|
||||
.radio-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: var(--fs-sm); font-weight: 580; cursor: pointer; }
|
||||
.radio-tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
|
||||
.radio-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
|
||||
.radio-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
|
||||
.chip-select .field { max-width: 180px; padding: 3px 8px; border-radius: 999px; font-size: var(--fs-sm); }
|
||||
.radio-tabs { display: flex; flex-wrap: wrap; gap: 2px; max-width: 100%; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
|
||||
.radio-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: var(--fs-sm); font-weight: 580; cursor: pointer; }
|
||||
.radio-tabs button[aria-selected="true"] { background: var(--sunken); color: var(--text); box-shadow: var(--shadow); }
|
||||
.radio-filters { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
||||
.radio-chips { display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: 6px; min-width: 0; }
|
||||
.chip-select { min-width: 0; }
|
||||
.chip-select .field { max-width: 160px; padding: 3px 8px; border-radius: 999px; font-size: var(--fs-sm); }
|
||||
.chip-select[data-active="true"] .field { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
|
||||
.radio-filters input[type="search"] { flex: 1 1 140px; min-width: 0; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); }
|
||||
.radio-log { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
|
||||
.radio-row details { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--sunken); }
|
||||
.radio-row summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-2); min-width: 0; padding: 5px 8px; font-size: var(--fs-sm); cursor: pointer; list-style: none; }
|
||||
.radio-row summary::-webkit-details-marker { display: none; }
|
||||
.radio-logbox input[type="search"] { flex: 1 1 0; min-width: 5rem; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); }
|
||||
.radio-logbox { flex: 1 1 auto; min-height: 0; container: history / inline-size; }
|
||||
.radio-log { display: grid; flex: 1 1 0; align-content: start; gap: 4px; height: 0; min-height: clamp(6.5rem, 30vh - 7rem, 24rem); margin: 0; padding: 0 2px 0 0; overflow: hidden auto; overscroll-behavior: contain; list-style: none; scrollbar-width: thin; scroll-margin-top: var(--head); }
|
||||
.radio-log, .radio-device, .radio-speak, .shell > main { scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
|
||||
.radio-row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; height: 32px; padding-inline-end: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font-size: var(--fs-sm); cursor: pointer; }
|
||||
.radio-row:hover, .radio-row.picked { border-color: var(--line-strong); }
|
||||
.radio-row.picked { box-shadow: inset 3px 0 0 var(--accent); }
|
||||
.radio-pick { display: flex; flex: 1 1 auto; align-items: center; gap: var(--sp-2); min-width: 0; height: 100%; padding: 0 0 0 8px; overflow: hidden; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; font: inherit; line-height: 20px; text-align: left; white-space: nowrap; cursor: pointer; }
|
||||
.radio-pick > * { flex: none; }
|
||||
.radio-row time { color: var(--muted); font-variant-numeric: tabular-nums; }
|
||||
.radio-dir { display: inline-flex; color: var(--muted); }
|
||||
.radio-row[data-dir="sent"] .radio-dir { color: var(--accent); }
|
||||
.radio-route { font-weight: 600; overflow-wrap: anywhere; }
|
||||
.radio-line { flex: 1 1 160px; min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
|
||||
.radio-full { margin: 0; padding: 6px 10px 8px; border-top: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm); }
|
||||
@media (min-width: 641px) {
|
||||
.knob-label { flex: none; }
|
||||
.radio-pick > .radio-route { flex: 0 1 auto; min-width: 2em; max-width: 40%; overflow: hidden; font-weight: 600; text-overflow: ellipsis; }
|
||||
.radio-pick > .radio-line { flex: 1 1 0; min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
|
||||
.radio-row .readers { flex: none; flex-wrap: nowrap; gap: 0; margin: 0; padding-inline-start: 4px; }
|
||||
.radio-row .reader + .reader, .radio-row .reader + .readers-more { margin-inline-start: -7px; }
|
||||
.radio-row .reader .avatar { width: 20px; height: 20px; box-shadow: 0 0 0 1.5px var(--panel); }
|
||||
.radio-row .readers-more { position: relative; line-height: 18px; box-shadow: 0 0 0 1.5px var(--panel); }
|
||||
.radio-row .readers-fold { display: none; }
|
||||
.radio-full { margin: 0; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--sunken); white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm); }
|
||||
.popup-readers { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
|
||||
.popup-reader { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--sp-2); min-width: 0; font-size: var(--fs-sm); }
|
||||
.radio-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end; }
|
||||
.radio-copy[data-copied="true"] { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); color: var(--ok); }
|
||||
.radio-copy[data-copied="false"] { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); color: var(--bad); }
|
||||
.radio-said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
||||
.radio-home { display: flex; flex-direction: column; gap: var(--sp-2); height: 100%; }
|
||||
.radio-home > * { flex: none; }
|
||||
.radio-home > .radio-grid { flex: 1 1 0; min-height: 0; grid-template-rows: minmax(0, 1fr); }
|
||||
.radio-home > .radio-card { flex: 1 1 0; min-height: 0; }
|
||||
.radio-home .radio-log { min-height: 0; }
|
||||
@container radio (max-width: 52rem) {
|
||||
.radio-grid { grid-template-columns: minmax(0, 1fr); }
|
||||
.radio-home-radio > .radio-grid { flex: none; grid-template-rows: none; }
|
||||
.radio-home-radio .radio-log { flex: none; height: auto; overflow: visible; }
|
||||
}
|
||||
@container history (max-width: 34rem) {
|
||||
.radio-row, .radio-pick { gap: 4px; }
|
||||
.radio-pick { padding-inline-start: 6px; }
|
||||
.radio-pick > time { flex: 0 1 auto; min-width: 0; overflow: hidden; font-size: var(--fs-xs); text-overflow: ellipsis; }
|
||||
.radio-pick > .pill { padding: 0 6px; }
|
||||
.radio-pick > .radio-route { max-width: 30%; }
|
||||
.radio-pick > .radio-line { min-width: 4em; }
|
||||
.radio-row .reader:nth-child(n + 4), .radio-row .readers-more:not(.readers-fold) { display: none; }
|
||||
.radio-row .readers-fold { display: block; }
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
body:not(.fit) .radio-spot { max-height: none; }
|
||||
.radio-log { max-height: calc(100dvh - var(--head) - var(--sp-3)); overflow-y: auto; overscroll-behavior: contain; scroll-margin-top: var(--head); }
|
||||
.radio-row summary { gap: 0 var(--sp-2); padding: 3px 8px; line-height: 1.3; }
|
||||
.radio-spot { padding: var(--sp-2); }
|
||||
}
|
||||
@media (width < 48rem), (height < 45rem), (width < 80rem) and (height < 46.5rem), (width < 61rem) and (height < 61rem) {
|
||||
.radio-spot .radio-log { flex: none; height: auto; min-height: 0; max-height: calc(100dvh - var(--head) - var(--sp-3)); }
|
||||
body:is(.fit, .pane) .spot-host:has(> .radio-spot:not([hidden])) + main { min-height: calc(100dvh - var(--head) - var(--sp-4)); }
|
||||
}
|
||||
@media (min-width: 80rem) and (min-height: 45rem), (min-width: 61rem) and (min-height: 46.5rem), (min-width: 48rem) and (min-height: 61rem) {
|
||||
.radio-spot:not([hidden]) { grid-template-columns: clamp(22rem, 100% - 34rem - var(--sp-3), 26rem) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: var(--sp-2) var(--sp-3); max-height: 46vh; margin-bottom: var(--sp-2); padding: var(--sp-2) var(--sp-3); }
|
||||
.radio-spot > .radio-grid { display: contents; }
|
||||
.radio-spot > .spot-bar { grid-area: 1 / 2; }
|
||||
.radio-spot .radio-device { grid-area: 1 / 1 / 3; }
|
||||
.radio-spot .radio-column { grid-area: 2 / 2; gap: var(--sp-2); }
|
||||
.radio-spot .radio-speak { flex: none; }
|
||||
.radio-spot .radio-log { min-height: 4.25rem; }
|
||||
.radio-spot .composer { grid-template-columns: auto minmax(0, 1fr); }
|
||||
.radio-spot .composer > * { grid-column: 1 / -1; }
|
||||
.radio-spot .composer > .voice-note:not([hidden]) { grid-column: 1; }
|
||||
.radio-spot .composer > .voice-note:not([hidden]) + .actions { grid-column: 2; }
|
||||
}
|
||||
@media (min-width: 80rem) and (45rem <= height <= 66rem), (min-width: 61rem) and (46.5rem <= height <= 66rem), (min-width: 48rem) and (61rem <= height <= 66rem), (min-width: 48rem) and (width < 56rem) and (min-height: 61rem) {
|
||||
body.fit .shell:has(> .spot-host > .radio-spot:not([hidden])) { padding-bottom: var(--sp-4); }
|
||||
body.fit .spot-host:has(> .radio-spot:not([hidden])) + main { padding-block: var(--sp-3); }
|
||||
.radio-spot:not([hidden]) { gap: 4px var(--sp-3); margin-bottom: 4px; padding-block: 4px; }
|
||||
.radio-spot .radio-column { gap: 4px; }
|
||||
.radio-spot .radio-card { gap: 4px; padding: 4px var(--sp-2); }
|
||||
.radio-spot .radio-card-head { min-height: 24px; }
|
||||
.radio-spot .radio-card-head > .star, .radio-spot .knob-row .btn, .radio-spot .radio-check, .radio-spot .radio-filters .btn { padding-block: 2px; }
|
||||
.radio-spot .radio-device { display: grid; grid-template-columns: auto auto minmax(0, max-content) minmax(0, 1fr) auto auto; align-content: start; gap: 4px var(--sp-2); }
|
||||
.radio-spot .radio-device > :is(.radio-card-head, .radio-face) { display: contents; }
|
||||
.radio-spot .radio-device > .radio-card-head > .group-title { grid-area: 1 / 1; margin: 0; }
|
||||
.radio-spot .radio-device > .radio-card-head > .star { grid-area: 1 / 6; }
|
||||
.radio-spot .radio-display { display: grid; grid-area: 1 / 2 / 2 / 6; grid-template-columns: subgrid; align-items: center; padding-block: 1px; }
|
||||
.radio-spot .radio-caption { z-index: 1; grid-area: 1 / 3 / 2 / 5; gap: 4px; min-height: 0; padding: 0 4px; background-color: var(--sunken); background-image: linear-gradient(var(--ok-soft), var(--ok-soft)); }
|
||||
.radio-spot .radio-caption strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
||||
.radio-spot .radio-caption .caption-line { flex: 1 0 4rem; }
|
||||
.radio-spot .radio-caption .avatar { width: 20px; height: 20px; }
|
||||
.radio-spot .radio-caption .btn { padding: 4px; }
|
||||
.radio-spot .radio-modes { grid-area: 2 / 1 / 3 / 6; justify-self: start; padding: 1px; }
|
||||
.radio-spot .radio-modes button { padding-block: 2px; }
|
||||
.radio-spot .radio-check { grid-area: 2 / 6; }
|
||||
.radio-spot .radio-knobs { grid-area: 3 / 1 / 4 / -1; row-gap: 0; }
|
||||
.radio-spot .knob-row { min-height: 24px; }
|
||||
.radio-spot .radio-device > .radio-station { grid-column: 1 / -1; padding-top: 4px; }
|
||||
.radio-spot .radio-station > summary { min-height: 24px; }
|
||||
.radio-spot .radio-speak { flex-flow: row wrap; align-items: center; gap: 2px var(--sp-2); }
|
||||
.radio-spot .radio-speak > :is(.radio-card-head, .composer), .radio-spot .radio-speak .composer > .actions { display: contents; }
|
||||
.radio-spot .radio-speak::before { content: ""; order: 3; flex-basis: 100%; }
|
||||
.radio-spot .radio-speak .composer-grid { order: 1; flex: 1 1 0; }
|
||||
.radio-spot .radio-speak .composer-grid .field { padding-block: 2px; }
|
||||
.radio-spot .radio-speak .star { margin-inline-start: 0; }
|
||||
.radio-spot .radio-speak textarea { order: 4; flex: 1 1 7rem; height: 32px; min-height: 32px; }
|
||||
.radio-spot .radio-speak .composer-hint { display: none; }
|
||||
.radio-spot .radio-speak .actions > * { order: 5; }
|
||||
.radio-spot .radio-speak .composer-status { flex: 1 1 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.radio-spot .radio-speak .voice-note { order: 4; flex: 0 1 auto; flex-wrap: nowrap; gap: 4px; min-width: 0; }
|
||||
.radio-spot .radio-speak .voice-note .btn { padding-block: 4px; }
|
||||
.radio-spot .radio-speak .voice-replay { display: none; }
|
||||
.radio-spot .radio-speak .voice-note .voice-play { display: inline-flex; }
|
||||
.radio-spot .radio-speak .voice-words, .radio-spot .caption-verb { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
||||
.radio-spot .radio-tabs { padding: 1px; }
|
||||
.radio-spot .radio-tabs button { padding-block: 1px; }
|
||||
.radio-spot .radio-logbox :is(.radio-filters .field, input[type="search"]) { padding-block: 1px; }
|
||||
}
|
||||
Reference in new issue
Block a user