Dashboard: resize modules by mouse, overlays, link groups and colours in levels; read-only switch on phones
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ea9fa32bc
commit
b82a6b90c6
8 files changed
+183
-60
No files matched your search
@@ -51,8 +51,10 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
|
||||
the curve is the app's own windowed sinc. Files: `Device.upload_fir` (`0x5B` name, `0x4E` packets of 12 floats). The DSP
|
||||
can't send coefficients back, so the curve of a file only exists in the session (`S.firCoef`).
|
||||
* **Dashboard** (`static/dashboard.js`, stored as `dashboard` in `config.json`, API `/api/dashboard`, `clean_dashboard`) –
|
||||
grid of 12 columns, modules in `DASH_MODULES` with `body(m, d)`. Must stay read-only: no `setParam` or POST to a device
|
||||
grid of 12 columns and rows of 40 px, modules in `DASH_MODULES` with `body(m, d)` and `min`/`max` `[columns, rows]`. Must stay read-only: no `setParam` or POST to a device
|
||||
there, browsing (channel, band) is session state (`dashBrowse`). A new module type also goes into `DASH_TYPES` in `server.py`.
|
||||
* **Read-only switch** (`S.guard`, `viewOnly()` in `app.js`) – web UI on phones and touch devices starts read-only, reusing
|
||||
the swallowing of the app lock. A safety catch per browser tab only: not stored, the server doesn't know it. Mute all stays.
|
||||
* **Network search** – `App.scan_network` probes the local /24 networks on TCP 9761 (handshake + device info),
|
||||
skipping DSPs this app is connected to.
|
||||
* **Copy settings / mute all** – `App.copy_settings` (`POST /api/copy`, groups level/filters/eq/dynamics/routing) and
|
||||
|
||||
@@ -29,8 +29,9 @@ Control both devices at the same time from your phone, tablet or computer – ov
|
||||
* **Several devices at once** – pick the DSP from the drop-down at the top (small dots show the status of the others);
|
||||
the model is detected automatically
|
||||
* **Dashboard** – your own overview page: drag modules onto it (DSP overview, levels, faders, frequency response with
|
||||
clickable EQ bands, channel, limiter, routing, delay, FIR, notes), choose their width and DSP. It only looks and never
|
||||
changes a DSP; the layout is stored in the config
|
||||
clickable EQ bands and overlays, channel, limiter, routing, delay, FIR, notes), move them by the title, resize them by
|
||||
the arrows, choose their DSP. It only looks and never changes a DSP; the layout is stored in the config
|
||||
* **Read-only switch** – on phones and tablets the web UI starts read-only; a small switch at the top allows changes
|
||||
* **Mixer** – faders, mute and live meters for all inputs and outputs, limiter LED on every output (status read
|
||||
from the DSP)
|
||||
* **Channel** – name, gain, delay, polarity, high/low pass, 8/9-band PEQ with a draggable curve; the curve shows
|
||||
|
||||
@@ -158,10 +158,10 @@ def clean_dashboard(data) -> dict | None:
|
||||
src = m.get("cfg") if isinstance(m.get("cfg"), dict) else {}
|
||||
cfg = {"device": str(src.get("device") or "")[:64], "title": str(src.get("title") or "")[:40],
|
||||
"kind": "out" if src.get("kind") == "out" else "in", "idx": int(_num(src.get("idx"), 0, 15, 0)),
|
||||
"text": str(src.get("text") or "")[:2000]}
|
||||
w = int(_num(m.get("w"), 3, 12, 4))
|
||||
"text": str(src.get("text") or "")[:2000],
|
||||
"overlays": [str(o) for o in src.get("overlays") or [] if re.fullmatch(r"(in|out)\d{1,2}", str(o))][:16]}
|
||||
modules.append({"id": re.sub(r"[^\w-]", "", str(m.get("id") or ""))[:32] or uuid.uuid4().hex[:8], "type": m["type"],
|
||||
"w": w if w in (3, 4, 6, 8, 12) else 4, "cfg": cfg})
|
||||
"w": int(_num(m.get("w"), 2, 12, 4)), "h": int(_num(m.get("h"), 0, 20, 0)), "cfg": cfg})
|
||||
return {"modules": modules}
|
||||
|
||||
|
||||
|
||||
+26
-5
@@ -803,8 +803,8 @@ async function presetFileDialog(d) {
|
||||
"active state – stored presets (U01 …) stay unchanged.", { name: q(d.state.preset_name || "—") })),
|
||||
last ? h("p", { class: "dlg-text" }, t("A backup is made automatically before every import. Last backup: {last}.", { last })) : null),
|
||||
actions: [{ label: t("Close") },
|
||||
...(last && !S.locked ? [{ label: t("Undo import"), value: () => "undo" }] : []),
|
||||
...(S.locked ? [] : [{ label: t("Import…"), value: () => "import" }]),
|
||||
...(last && !viewOnly() ? [{ label: t("Undo import"), value: () => "undo" }] : []),
|
||||
...(viewOnly() ? [] : [{ label: t("Import…"), value: () => "import" }]),
|
||||
{ label: t("Export"), primary: true, value: () => "export" }],
|
||||
});
|
||||
try {
|
||||
@@ -2481,10 +2481,28 @@ new ResizeObserver(() => document.documentElement.style.setProperty("--sb", $("#
|
||||
|
||||
// ------------------------------------------------------------------ lock (desktop app window: look, don't touch)
|
||||
|
||||
// Phones and tablets on the web UI start read-only, so nothing changes by touching it by accident.
|
||||
// Only a safety catch in this browser tab: it is not stored and the server knows nothing about it.
|
||||
const viewOnly = () => !!S.locked || !!S.guard;
|
||||
function showGuard() {
|
||||
const b = $("#btn-guard"), used = !S.isApp && S.guardUsed;
|
||||
b.hidden = !used;
|
||||
b.setAttribute("aria-checked", String(!S.guard));
|
||||
b.classList.toggle("on", !S.guard);
|
||||
b.title = S.guard ? t("Read-only – tap to edit") : t("Editing – tap for read-only");
|
||||
b.setAttribute("aria-label", b.title);
|
||||
b.replaceChildren(h("span", { class: "guardlab" }, S.guard ? t("View") : t("Edit")), h("span", { class: "guardtrack" }, h("i")));
|
||||
document.body.classList.toggle("locked", viewOnly());
|
||||
}
|
||||
$("#btn-guard").addEventListener("click", () => {
|
||||
S.guard = !S.guard; showGuard(); render();
|
||||
toast(S.guard ? t("Read-only") : t("Edit mode – changes go to the DSP"));
|
||||
});
|
||||
|
||||
function showLock() {
|
||||
const b = $("#btn-lock");
|
||||
b.hidden = !S.isApp;
|
||||
document.body.classList.toggle("locked", !!S.locked);
|
||||
document.body.classList.toggle("locked", viewOnly());
|
||||
b.classList.toggle("on", !!S.locked);
|
||||
b.title = S.locked ? t("Locked – click to unlock") : t("Lock (view only)");
|
||||
b.setAttribute("aria-label", b.title);
|
||||
@@ -2516,14 +2534,14 @@ $("#btn-lock").addEventListener("click", async () => {
|
||||
const VIEW_OK = ".chsel, .nav, .strip-head, .xout, .band, #btn-muteall, [data-view-ok]";
|
||||
for (const type of ["pointerdown", "mousedown", "click", "dblclick", "keydown", "wheel"]) {
|
||||
document.addEventListener(type, e => {
|
||||
if (!S.locked || !(e.target instanceof Element)) return;
|
||||
if (!viewOnly() || !(e.target instanceof Element)) return;
|
||||
const tgt = e.target;
|
||||
if (!tgt.closest("#main, #statusbar") || tgt.closest(VIEW_OK)) return;
|
||||
if (type === "wheel" && !tgt.closest(".fader, input, select")) return; // page scrolling stays
|
||||
if (type === "keydown" && !tgt.closest("button, input, select, textarea, .fader, [tabindex]")) return;
|
||||
if (type === "pointerdown" && !tgt.closest("button, input, select, textarea, .fader, canvas, a")) return;
|
||||
e.preventDefault(); e.stopPropagation();
|
||||
if (type === "click" && Date.now() - (S.lockToast || 0) > 1500) { S.lockToast = Date.now(); toast(t("Locked – unlock at the top right to make changes")); }
|
||||
if (type === "click" && Date.now() - (S.lockToast || 0) > 1500) { S.lockToast = Date.now(); toast(S.locked ? t("Locked – unlock at the top right to make changes") : t("Read-only – switch to edit at the top")); }
|
||||
}, { capture: true, passive: false });
|
||||
}
|
||||
|
||||
@@ -2694,6 +2712,9 @@ async function startApp() {
|
||||
if (store.get("dsp.lang") === a.lang) return location.reload();
|
||||
}
|
||||
S.locked = !!a.locked;
|
||||
S.guardUsed = !S.isApp && matchMedia("(max-width: 759px), (pointer: coarse)").matches;
|
||||
S.guard = S.guardUsed;
|
||||
showGuard();
|
||||
showLock();
|
||||
showMuteAll();
|
||||
if (S.isApp) S.remote = await api("GET", "/api/remote");
|
||||
|
||||
+87
-33
@@ -3,7 +3,7 @@
|
||||
// Dashboard: an overview page built from modules, stored by the server as `dashboard` in config.json.
|
||||
// Every module only looks: nothing here changes a DSP. Browsing (channel, EQ band) stays in this session.
|
||||
|
||||
const DASH_WIDTHS = [3, 4, 6, 8, 12];
|
||||
const DASH_ROW = 40; // grid row + gap in px, see .dash
|
||||
const DASH_DEFAULT = () => [
|
||||
{ type: "status", w: 4 }, { type: "meters", w: 8 },
|
||||
{ type: "curve", w: 8 }, { type: "mixer", w: 4 },
|
||||
@@ -57,7 +57,7 @@ function dashChannelNav(m, d, s) {
|
||||
|
||||
const DASH_MODULES = {
|
||||
status: {
|
||||
title: () => t("DSP overview"), w: 4, global: true,
|
||||
title: () => t("DSP overview"), w: 4, min: [3, 3], max: [12, 14], h: () => 2 + Math.ceil(dashDevs().length * 1.2), global: true,
|
||||
icon: '<rect x="3" y="4" width="18" height="6" rx="1.5"/><rect x="3" y="14" width="18" height="6" rx="1.5"/><path d="M7 7h.01M7 17h.01"/>',
|
||||
body() {
|
||||
const list = dashDevs();
|
||||
@@ -70,17 +70,18 @@ const DASH_MODULES = {
|
||||
},
|
||||
},
|
||||
meters: {
|
||||
title: () => t("Levels"), w: 8,
|
||||
title: () => t("Levels"), w: 8, min: [3, 5], max: [12, 14], h: 7,
|
||||
icon: '<path d="M5 20V10M10 20V4M15 20v-7M20 20V8"/>',
|
||||
body(m, d) {
|
||||
const col = (k, i) => h("div", { class: "dm" + (chans(d, k)[i].mute ? " muted" : ""), title: chTitle(d, k, i) },
|
||||
const col = (k, i) => h("div", { class: "dm" + (chans(d, k)[i].mute ? " muted" : ""), title: chTitle(d, k, i), style: `${ccStyle(d, k, i)};grid-column:${i + 1}` },
|
||||
ledMeter(d.id, k, i), k === "out" ? limLed(d.id, i) : h("span", { class: "limled ph", "aria-hidden": "true" }), h("small", {}, chLabel(k, i).replace("Out ", "").replace("In ", "")));
|
||||
const group = (k, label) => h("div", { class: "dmgroup", style: `flex-grow:${chans(d, k).length}` }, h("div", { class: "sub" }, label), h("div", { class: "dms" }, chans(d, k).map((_, i) => col(k, i))));
|
||||
return h("div", { class: "dmeters" }, group("in", t("Inputs")), group("out", t("Outputs")));
|
||||
const group = (k, label) => h("div", { class: "dmgroup", style: `flex-grow:${chans(d, k).length}` }, h("div", { class: "sub" }, label), h("div", { class: "dms", style: `--n:${chans(d, k).length}` }, linkBands(d, k), chans(d, k).map((_, i) => col(k, i))));
|
||||
const bands = linkedGroups(d, "in").length + linkedGroups(d, "out").length > 0;
|
||||
return h("div", { class: "dmeters" + (bands ? " hasbands" : "") }, group("in", t("Inputs")), group("out", t("Outputs")));
|
||||
},
|
||||
},
|
||||
mixer: {
|
||||
title: () => t("Faders"), w: 4,
|
||||
title: () => t("Faders"), w: 4, min: [3, 4], max: [8, 14], h: d => (d && d.state ? 2 + Math.ceil(dashChannels(d).length * 0.8) : 5),
|
||||
icon: '<path d="M6 3v18M12 3v18M18 3v18"/><rect x="3.5" y="13" width="5" height="3" rx="1"/><rect x="9.5" y="7" width="5" height="3" rx="1"/><rect x="15.5" y="10" width="5" height="3" rx="1"/>',
|
||||
body(m, d) {
|
||||
const row = (k, i) => {
|
||||
@@ -88,29 +89,33 @@ const DASH_MODULES = {
|
||||
return h("div", { class: "drow dgain" + (ch.mute ? " muted" : ""), style: ccStyle(d, k, i) },
|
||||
h("span", { class: "dlab" }, chLabel(k, i)),
|
||||
h("span", { class: "dbar" }, h("i", { style: `width:${ch.gain / 4}%` }), h("u")),
|
||||
h("span", { class: "dval" }, ch.mute ? "MUTE" : `${sign(gainDb(ch.gain))}`));
|
||||
h("span", { class: "dval" }, ch.mute ? "MUTE" : `${sign(gainDb(ch.gain))} dB`));
|
||||
};
|
||||
return h("div", { class: "dlist" }, chans(d, "in").map((_, i) => row("in", i)), h("hr"), chans(d, "out").map((_, i) => row("out", i)));
|
||||
},
|
||||
},
|
||||
curve: {
|
||||
title: () => t("Frequency response"), w: 8,
|
||||
title: () => t("Frequency response"), w: 8, min: [4, 7], max: [12, 16], h: 9,
|
||||
icon: '<path d="M2 14c3 0 3-7 6-7s3 10 6 10 3-6 6-6h2"/>',
|
||||
body(m, d) {
|
||||
const s = dashSel(m, d), ch = chans(d, s.kind)[s.idx];
|
||||
if (s.band >= ch.peq.length) s.band = 0;
|
||||
const canvas = h("canvas", { class: "dcurve" });
|
||||
const draw = () => drawCurve(canvas, ch, s.band, { mode: "mag", overlays: [] });
|
||||
requestAnimationFrame(draw);
|
||||
const shown = (m.cfg.overlays || []).map(key => {
|
||||
const k = key.startsWith("in") ? "in" : "out", i = +key.replace(/\D/g, "");
|
||||
return i < chans(d, k).length && !(k === s.kind && i === s.idx) ? { k, i, ch: chans(d, k)[i], color: chColor(d, k, i) } : null;
|
||||
}).filter(Boolean);
|
||||
requestAnimationFrame(() => drawCurve(canvas, ch, s.band, { mode: "mag", overlays: shown }));
|
||||
const b = ch.peq[s.band];
|
||||
return [dashChannelNav(m, d, s), canvas,
|
||||
shown.length ? h("div", { class: "dlegend" }, shown.map(o => h("span", {}, h("i", { style: `background:${o.color}` }), chLabel(o.k, o.i)))) : null,
|
||||
h("div", { class: "dbands" }, ch.peq.map((bb, i) => h("button", { class: "dband" + (i === s.band ? " on" : "") + (bb.bypass ? " off" : "") + (bb.gain !== 120 ? " act" : ""), "data-view-ok": "",
|
||||
onclick: () => { s.band = i; render(); } }, h("b", {}, i + 1), h("small", {}, fmtHzShort(freqHz(bb.freq)))))),
|
||||
h("p", { class: "info dbandinfo" }, `${PEQ_TYPES[b.type]} · ${SPEC.freq.fmt(b.freq)} · ${sign((b.gain - 120) / 10)} dB · Q ${Q_TABLE[b.q]}${b.bypass ? " · Bypass" : ""}`)];
|
||||
},
|
||||
},
|
||||
channel: {
|
||||
title: () => t("Channel"), w: 4,
|
||||
title: () => t("Channel"), w: 4, min: [3, 6], max: [8, 12], h: 9,
|
||||
icon: '<circle cx="12" cy="12" r="8"/><path d="M12 8v4l3 2"/>',
|
||||
body(m, d) {
|
||||
const s = dashSel(m, d), ch = chans(d, s.kind)[s.idx];
|
||||
@@ -129,7 +134,7 @@ const DASH_MODULES = {
|
||||
},
|
||||
},
|
||||
limiter: {
|
||||
title: () => "Limiter", w: 4,
|
||||
title: () => "Limiter", w: 4, min: [3, 3], max: [8, 12], h: d => (d && d.state ? 2 + Math.ceil(chans(d, "out").length * 0.8) : 5),
|
||||
icon: '<path d="M2 7h20" stroke-dasharray="2.5 2.5"/><path d="M2 14c2 0 3-7 5-7h3c2 0 3 11 6 11s3-5 6-5"/>',
|
||||
body(m, d) {
|
||||
return h("div", { class: "dlist" }, chans(d, "out").map((ch, o) => {
|
||||
@@ -141,7 +146,7 @@ const DASH_MODULES = {
|
||||
},
|
||||
},
|
||||
routing: {
|
||||
title: () => "Routing", w: 4,
|
||||
title: () => "Routing", w: 4, min: [3, 3], max: [8, 12], h: d => (d && d.state ? 2 + Math.ceil((chans(d, "out").length + 1) * 0.5) : 5),
|
||||
icon: '<path d="M4 6h16M4 12h16M4 18h16M8 3v18M16 3v18"/>',
|
||||
body(m, d) {
|
||||
const ins = chans(d, "in");
|
||||
@@ -152,7 +157,7 @@ const DASH_MODULES = {
|
||||
},
|
||||
},
|
||||
delays: {
|
||||
title: () => "Delay", w: 4,
|
||||
title: () => "Delay", w: 4, min: [3, 3], max: [8, 14], h: d => (d && d.state ? 2 + Math.ceil(dashChannels(d).length * 0.8) : 5),
|
||||
icon: '<circle cx="12" cy="13" r="8"/><path d="M12 9v4l2 2M9 2h6"/>',
|
||||
body(m, d) {
|
||||
const row = (k, i) => {
|
||||
@@ -163,7 +168,7 @@ const DASH_MODULES = {
|
||||
},
|
||||
},
|
||||
fir: {
|
||||
title: () => t("FIR filters"), w: 4, only: () => dashDevs().some(d => d.fir),
|
||||
title: () => t("FIR filters"), w: 4, min: [3, 3], max: [8, 12], h: 5, only: () => dashDevs().some(d => d.fir),
|
||||
icon: '<path d="M2 12h3l2-7 3 14 3-11 2 6 2-3 1 1h4"/>',
|
||||
body(m, d) {
|
||||
if (!d.fir) return h("p", { class: "info dempty" }, t("{name} has no FIR filters.", { name: d.name }));
|
||||
@@ -179,7 +184,7 @@ const DASH_MODULES = {
|
||||
},
|
||||
},
|
||||
notes: {
|
||||
title: () => t("Notes"), w: 4, global: true,
|
||||
title: () => t("Notes"), w: 4, min: [2, 2], max: [12, 14], h: 4, global: true,
|
||||
icon: '<path d="M5 3h14v18H5zM9 8h6M9 12h6M9 16h3"/>',
|
||||
body(m) { return m.cfg.text ? h("p", { class: "dnote" }, m.cfg.text) : h("p", { class: "info dempty" }, t("Empty – add text in the module settings.")); },
|
||||
},
|
||||
@@ -202,14 +207,28 @@ async function dashSettings(m) {
|
||||
const title = h("input", { type: "text", maxlength: 40, value: m.cfg.title || "", placeholder: def.title() });
|
||||
const dev_ = def.global ? null : h("select", {}, dashDevs().map(x => h("option", { value: x.id, selected: x === d }, x.name)));
|
||||
const text = m.type === "notes" ? h("textarea", { rows: 6, maxlength: 2000 }, m.cfg.text || "") : null;
|
||||
// channels drawn over the curve: fixed per module, whichever channel is being looked at
|
||||
const overlays = new Set(m.cfg.overlays || []);
|
||||
const overlayBox = m.type === "curve" ? h("div", { class: "doverlays" }) : null;
|
||||
const fillOverlays = () => {
|
||||
const x = S.devices[dev_.value];
|
||||
if (!x || !x.state) return overlayBox.replaceChildren(h("p", { class: "info" }, t("{name} is not connected.", { name: x ? x.name : "DSP" })));
|
||||
overlayBox.replaceChildren(...dashChannels(x).map(([k, i]) => {
|
||||
const key = k + i, box = h("input", { type: "checkbox", checked: overlays.has(key), onchange: () => (box.checked ? overlays.add(key) : overlays.delete(key)) });
|
||||
return h("label", { class: "chk", style: `--c:${chColor(x, k, i)}` }, box, h("i"), chLabel(k, i));
|
||||
}));
|
||||
};
|
||||
if (overlayBox) { fillOverlays(); dev_.addEventListener("change", fillOverlays); }
|
||||
const res = await modal({ title: def.title(),
|
||||
body: h("div", { class: "form dform" }, h("label", { class: "full" }, t("Title"), title),
|
||||
dev_ ? h("label", { class: "full" }, "DSP", dev_) : null, text ? h("label", { class: "full" }, t("Text"), text) : null),
|
||||
dev_ ? h("label", { class: "full" }, "DSP", dev_) : null, text ? h("label", { class: "full" }, t("Text"), text) : null,
|
||||
overlayBox ? h("div", { class: "full" }, h("div", { class: "sub" }, t("Show on top of the curve")), overlayBox) : null),
|
||||
actions: [{ label: t("Cancel") }, { label: t("Save"), primary: true, value: () => true }] });
|
||||
if (!res) return;
|
||||
m.cfg = { ...m.cfg, title: title.value.trim() };
|
||||
if (dev_) m.cfg.device = dev_.value;
|
||||
if (text) m.cfg.text = text.value;
|
||||
if (overlayBox) m.cfg.overlays = [...overlays];
|
||||
dashBrowse.delete(m.id);
|
||||
dashSave(); render();
|
||||
}
|
||||
@@ -222,8 +241,8 @@ function dashDrag(ev, source, el) {
|
||||
const start = () => {
|
||||
S.busy = true;
|
||||
grid = $("#main .dash");
|
||||
const w = source.mod ? source.mod.w : DASH_MODULES[source.type].w;
|
||||
ph = h("div", { class: `dmod dph w${w}` });
|
||||
const size = source.mod || { type: source.type, w: DASH_MODULES[source.type].w, cfg: {} };
|
||||
ph = h("div", { class: "dmod dph", style: dashSizeStyle(size.w, dashHeight(size, source.mod ? dashDev(size) : dashDevs()[0])) });
|
||||
const r = el.getBoundingClientRect();
|
||||
ghost = (source.mod ? el.closest(".dmod") : el).cloneNode(true);
|
||||
ghost.classList.add("dghost");
|
||||
@@ -275,6 +294,36 @@ function dashPalette() {
|
||||
|
||||
// ------------------------------------------------------------------ page
|
||||
|
||||
const dashSizeStyle = (w, rows) => `--w:${w};--wt:${w < 6 ? 6 : 12};--h:${rows}`;
|
||||
const dashLimit = (m, axis, v) => clamp(v, DASH_MODULES[m.type].min[axis], DASH_MODULES[m.type].max[axis]);
|
||||
// rows: chosen by the user, or what the module needs on this DSP
|
||||
function dashHeight(m, d) {
|
||||
const def = DASH_MODULES[m.type];
|
||||
return dashLimit(m, 1, m.h || (typeof def.h === "function" ? def.h(d) : def.h));
|
||||
}
|
||||
|
||||
function dashResizeStart(ev, m, el, axes) {
|
||||
ev.preventDefault(); ev.stopPropagation();
|
||||
const grid = $("#main .dash"), col = (grid.clientWidth + 10) / 12, sx = ev.clientX, sy = ev.clientY;
|
||||
const w0 = m.w, h0 = dashHeight(m, dashDev(m));
|
||||
let w = w0, rows = h0;
|
||||
S.busy = true;
|
||||
document.body.classList.add("dresizing");
|
||||
const move = e => {
|
||||
if (axes.includes("w")) w = dashLimit(m, 0, w0 + Math.round((e.clientX - sx) / col));
|
||||
if (axes.includes("h")) rows = dashLimit(m, 1, h0 + Math.round((e.clientY - sy) / DASH_ROW));
|
||||
el.setAttribute("style", dashSizeStyle(w, rows));
|
||||
};
|
||||
const end = () => {
|
||||
window.removeEventListener("pointermove", move); window.removeEventListener("pointerup", end); window.removeEventListener("pointercancel", end);
|
||||
document.body.classList.remove("dresizing");
|
||||
S.busy = false;
|
||||
if (w !== w0 || rows !== h0) { m.w = w; m.h = rows; dashSave(); }
|
||||
render();
|
||||
};
|
||||
window.addEventListener("pointermove", move); window.addEventListener("pointerup", end); window.addEventListener("pointercancel", end);
|
||||
}
|
||||
|
||||
function dashModule(m) {
|
||||
const def = DASH_MODULES[m.type];
|
||||
if (!def) return null;
|
||||
@@ -287,32 +336,37 @@ function dashModule(m) {
|
||||
body = h("p", { class: "info dempty" }, t("This module can't show this DSP."));
|
||||
}
|
||||
const controls = dashEdit ? (() => {
|
||||
const steps = DASH_WIDTHS, at = Math.max(0, steps.indexOf(m.w));
|
||||
const size = dir => { m.w = steps[clamp(at + dir, 0, steps.length - 1)]; dashSave(); render(); };
|
||||
const grip = h("button", { class: "small dgrip", title: t("Drag to move"), "aria-label": t("Drag to move") }, "⠿");
|
||||
grip.addEventListener("pointerdown", e => dashDrag(e, { mod: m }, grip));
|
||||
return h("div", { class: "dctl" }, grip,
|
||||
h("button", { class: "small", disabled: at === 0, "aria-label": t("Narrower"), title: t("Narrower"), onclick: () => size(-1) }, "−"),
|
||||
h("button", { class: "small", disabled: at === steps.length - 1, "aria-label": t("Wider"), title: t("Wider"), onclick: () => size(1) }, "+"),
|
||||
return h("div", { class: "dctl" },
|
||||
h("button", { class: "small", "aria-label": t("Module settings"), title: t("Module settings"), onclick: () => dashSettings(m) }, "⚙"),
|
||||
h("button", { class: "small danger", "aria-label": t("Remove"), title: t("Remove"), onclick: () => {
|
||||
dashMods().splice(dashMods().indexOf(m), 1); dashSave(); render();
|
||||
} }, "×"));
|
||||
})() : null;
|
||||
return h("section", { class: `card dmod w${m.w} dt-${m.type}` },
|
||||
h("h3", {}, svgIcon(def.icon), h("span", { class: "grow dtitle" }, m.cfg.title || def.title()),
|
||||
d && dashDevs().length > 1 ? h("small", { class: "ddev" }, d.name) : null, controls),
|
||||
body);
|
||||
const head = h("h3", { title: dashEdit ? t("Drag to move") : null }, svgIcon(def.icon), h("span", { class: "grow dtitle" }, m.cfg.title || def.title()),
|
||||
d && dashDevs().length > 1 ? h("small", { class: "ddev" }, d.name) : null, controls);
|
||||
const el = h("section", { class: `card dmod dt-${m.type}`, style: dashSizeStyle(m.w, dashHeight(m, d)) },
|
||||
head, h("div", { class: "dbody" }, body));
|
||||
if (dashEdit) {
|
||||
head.addEventListener("pointerdown", e => { if (!e.target.closest("button")) dashDrag(e, { mod: m }, head); });
|
||||
const handle = (axes, cls, arrow, label) => {
|
||||
const g = h("span", { class: "dgrab " + cls, title: label }, arrow);
|
||||
g.addEventListener("pointerdown", e => dashResizeStart(e, m, el, axes));
|
||||
return g;
|
||||
};
|
||||
el.append(handle("w", "de", "↔", t("Drag to resize")), handle("h", "ds", "↕", t("Drag to resize")), handle("wh", "dse", "↘", t("Drag to resize")));
|
||||
}
|
||||
return el;
|
||||
}
|
||||
|
||||
function viewDash() {
|
||||
if (viewOnly()) dashEdit = false;
|
||||
const mods = dashMods();
|
||||
return [
|
||||
h("div", { class: "dhead" }, h("h2", {}, "Dashboard"),
|
||||
S.locked ? null : h("button", { class: dashEdit ? "on" : "", onclick: () => { dashEdit = !dashEdit; render(); } }, dashEdit ? t("Done") : t("Customise"))),
|
||||
viewOnly() ? null : h("button", { class: dashEdit ? "on" : "", onclick: () => { dashEdit = !dashEdit; render(); } }, dashEdit ? t("Done") : t("Customise"))),
|
||||
dashEdit ? dashPalette() : null,
|
||||
mods.length ? h("div", { class: "dash" + (dashEdit ? " editing" : "") }, mods.map(dashModule))
|
||||
: h("div", { class: "dash" + (dashEdit ? " editing" : "") }, h("div", { class: "dmod w12 dblank" }, t("Nothing here yet – press “Customise” and add modules."))),
|
||||
: h("div", { class: "dash" + (dashEdit ? " editing" : "") }, h("div", { class: "dmod dblank", style: dashSizeStyle(12, 4) }, t("Nothing here yet – press “Customise” and add modules."))),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -574,6 +574,13 @@ const DE = {
|
||||
"Done": "Fertig",
|
||||
"Customise": "Anpassen",
|
||||
"Nothing here yet – press “Customise” and add modules.": "Noch nichts da – „Anpassen“ drücken und Module hinzufügen.",
|
||||
"Show on top of the curve": "Über der Kurve anzeigen",
|
||||
"Drag to resize": "Zum Ändern der Größe ziehen",
|
||||
"Read-only – tap to edit": "Nur ansehen – antippen zum Bearbeiten",
|
||||
"Editing – tap for read-only": "Bearbeiten – antippen für Nur ansehen",
|
||||
"Read-only": "Nur ansehen",
|
||||
"Edit mode – changes go to the DSP": "Bearbeiten – Änderungen gehen an den DSP",
|
||||
"Read-only – switch to edit at the top": "Nur ansehen – oben auf Bearbeiten umschalten",
|
||||
};
|
||||
|
||||
const DE_PATTERNS = [
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<button data-view="test"><svg viewBox="0 0 24 24"><path d="M4 9v6h4l5 4V5L8 9z"/><path d="M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12"/></svg><span data-t="Audio test">Audio test</span><span class="short" data-t="Test">Test</span></button>
|
||||
</nav>
|
||||
<button id="btn-muteall" class="icon" aria-label="Mute all" title="Mute all"></button>
|
||||
<button id="btn-guard" class="guard" hidden role="switch"></button>
|
||||
<button id="btn-lock" class="icon" hidden aria-label="Lock" title="Lock"></button>
|
||||
<button id="btn-settings" class="icon" aria-label="Settings" title="Settings" data-t-label="Settings">
|
||||
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></svg>
|
||||
|
||||
+53
-16
@@ -770,18 +770,34 @@ canvas.fircurve { display: block; width: 100%; height: 240px; background: var(--
|
||||
/* ---- dashboard */
|
||||
.dhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 10px; }
|
||||
.dhead h2 { margin: 0; font-size: 20px; }
|
||||
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: dense; gap: 10px; align-items: stretch; }
|
||||
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 30px; grid-auto-flow: dense; gap: 10px; align-items: stretch; }
|
||||
.dmod { min-width: 0; display: flex; flex-direction: column; }
|
||||
.dmod[hidden] { display: none; }
|
||||
.w3 { grid-column: span 3; } .w4 { grid-column: span 4; } .w6 { grid-column: span 6; } .w8 { grid-column: span 8; } .w12 { grid-column: span 12; }
|
||||
@media (max-width: 1100px) { .w3, .w4 { grid-column: span 6; } .w6, .w8 { grid-column: span 12; } }
|
||||
@media (max-width: 759px) { .dmod.w3, .dmod.w4, .dmod.w6, .dmod.w8 { grid-column: span 12; } .dhelp { display: none; } }
|
||||
.dmod { position: relative; grid-column: span var(--w); grid-row: span var(--h); }
|
||||
.dbody { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; scrollbar-width: thin; }
|
||||
@media (max-width: 1100px) { .dmod { grid-column: span var(--wt); } }
|
||||
/* phones: one column, as high as the content */
|
||||
@media (max-width: 759px) {
|
||||
.dash { grid-auto-rows: auto; }
|
||||
.dmod { grid-column: span 12; grid-row: auto; }
|
||||
.dhelp, .dgrab { display: none; }
|
||||
.dm .led { flex: none !important; height: 130px !important; }
|
||||
canvas.dcurve { flex: none !important; height: 170px !important; }
|
||||
}
|
||||
.dmod > h3 svg { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
||||
.dtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
|
||||
.ddev { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; }
|
||||
.dctl { display: flex; gap: 3px; flex: none; }
|
||||
.dctl button { min-height: 26px; min-width: 26px; padding: 0 6px; text-transform: none; letter-spacing: 0; }
|
||||
.dgrip { cursor: grab; touch-action: none; }
|
||||
.dash.editing .dmod > h3 { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
|
||||
.dgrab { position: absolute; z-index: 2; display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px;
|
||||
font-size: 12px; line-height: 1; color: var(--text); background: var(--panel3); border: 1px solid var(--line2); touch-action: none; user-select: none; -webkit-user-select: none; }
|
||||
.dgrab:hover { background: var(--accent2); border-color: var(--accent); color: #fff; }
|
||||
.de { right: -7px; top: 50%; margin-top: -10px; cursor: ew-resize; }
|
||||
.ds { bottom: -7px; left: 50%; margin-left: -10px; cursor: ns-resize; }
|
||||
.dse { right: -7px; bottom: -7px; cursor: nwse-resize; }
|
||||
body.dresizing { user-select: none; -webkit-user-select: none; }
|
||||
.dresizing .dmod { transition: none; }
|
||||
.dash.editing .dmod { border-style: dashed; border-color: var(--line2, #3a4250); }
|
||||
.dempty { margin: auto; text-align: center; padding: 16px 4px; }
|
||||
.dblank { padding: 40px 12px; text-align: center; color: var(--dim); }
|
||||
@@ -805,29 +821,42 @@ body.ddragging { user-select: none; -webkit-user-select: none; cursor: grabbing;
|
||||
.dtag.mute { color: #fff; background: var(--mute); }
|
||||
.dlab { flex: none; min-width: 3.1em; color: var(--dim); font-size: 12px; }
|
||||
.dsub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 12px; }
|
||||
.dval { flex: none; min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px; }
|
||||
.dval { flex: none; min-width: 4.6em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px; }
|
||||
.dbar { --cc: var(--accent); flex: 1; position: relative; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; min-width: 30px; }
|
||||
.dbar i { position: absolute; inset: 0 auto 0 0; background: var(--cc); opacity: .85; }
|
||||
.dbar u { position: absolute; left: 70%; top: 0; bottom: 0; width: 1px; background: #ffffff66; }
|
||||
.dgain.muted .dbar i { background: var(--dim); opacity: .4; }
|
||||
.dgain.muted .dval { color: #f87171; font-size: 10px; }
|
||||
.drow.zero { opacity: .5; }
|
||||
.dmeters { flex: 1; display: flex; gap: 18px; flex-wrap: wrap; }
|
||||
.dmeters { flex: 1; min-height: 0; display: flex; gap: 14px; }
|
||||
.dmgroup { flex: 1 1 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
|
||||
.dmgroup .sub { margin: 0; }
|
||||
.dms { display: flex; gap: 6px; }
|
||||
.dm { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 20px; flex: 1 1 0; max-width: 60px; }
|
||||
.dm .led { height: 150px; }
|
||||
.dm small { color: var(--dim); font-size: 11px; }
|
||||
.dmgroup .sub { flex: none !important; margin: 0; }
|
||||
.dms { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: 0 minmax(0, 1fr); gap: 0 4px; }
|
||||
.dmeters.hasbands .dms { grid-template-rows: 22px minmax(0, 1fr); }
|
||||
.dms > .dm { grid-row: 2; }
|
||||
.dms .lkband { height: 8px; margin: 0 5px 3px; border-width: 1.5px; border-radius: 7px 7px 0 0; }
|
||||
.dms .lkband::before, .dms .lkband::after { width: 4px; height: 4px; bottom: -2px; }
|
||||
.dms .lkband::before { left: -3px; } .dms .lkband::after { right: -3px; }
|
||||
.dms .lkband .lkname { padding: 0 5px; font-size: 9px; letter-spacing: .04em; gap: 3px; max-width: calc(100% + 6px); }
|
||||
.dms .lkband .lkname svg { width: 9px; height: 9px; }
|
||||
.dms .lkband.single { margin: 0 3px 3px; }
|
||||
.dm { --cc: var(--warn); display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; min-height: 0; }
|
||||
.dm .led { flex: 1 1 0; height: auto; min-height: 0; padding: 0; }
|
||||
.dm small { color: var(--cc); font-size: 11px; font-weight: 700; }
|
||||
.dm.muted .led { opacity: .35; }
|
||||
.dm .limled { width: 18px; height: 4px; min-height: 4px; margin: 0; font-size: 0; }
|
||||
.dnav { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
|
||||
.dnav { flex: none; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
|
||||
.dnav button { min-height: 28px; min-width: 32px; padding: 0 8px; font-size: 16px; line-height: 1; }
|
||||
.dnavname { flex: 1; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--dim); }
|
||||
.dnavname b { color: var(--text); }
|
||||
canvas.dcurve { display: block; width: 100%; height: 170px; background: var(--bg2); border-radius: 8px; }
|
||||
.dmod.w12 canvas.dcurve, .dmod.w8 canvas.dcurve { height: 200px; }
|
||||
.dbands { display: flex; gap: 3px; margin-top: 6px; overflow-x: auto; }
|
||||
canvas.dcurve { display: block; width: 100%; flex: 1 1 0; min-height: 70px; background: var(--bg2); border-radius: 8px; }
|
||||
.dlegend { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 5px; font-size: 11px; color: var(--dim); }
|
||||
.dlegend span { display: inline-flex; align-items: center; gap: 4px; }
|
||||
.dlegend i { width: 10px; height: 3px; border-radius: 2px; }
|
||||
.doverlays { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 6px; }
|
||||
.doverlays label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
|
||||
.doverlays i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
|
||||
.dbands { flex: none; display: flex; gap: 3px; margin-top: 6px; overflow-x: auto; }
|
||||
.dband { flex: 1 0 34px; flex-direction: column; gap: 0; min-height: 34px; padding: 2px; font-weight: 400; background: var(--panel2); }
|
||||
.dband b { font-size: 12px; }
|
||||
.dband small { color: var(--dim); font-size: 10px; }
|
||||
@@ -848,3 +877,11 @@ canvas.dcurve { display: block; width: 100%; height: 170px; background: var(--bg
|
||||
.dmatrix i.on { background: var(--c); box-shadow: 0 0 6px var(--c); }
|
||||
.dnote { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }
|
||||
.dform textarea { width: 100%; resize: vertical; min-height: 110px; font: inherit; }
|
||||
/* ---- read-only switch (phones, tablets) */
|
||||
.guard { flex: none; gap: 6px; min-height: 34px; padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--dim); background: var(--panel2); }
|
||||
.guardtrack { position: relative; width: 28px; height: 16px; border-radius: 8px; background: var(--line2); transition: background .15s; }
|
||||
.guardtrack i { position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .15s; }
|
||||
.guard.on { color: #fff; border-color: var(--accent); }
|
||||
.guard.on .guardtrack { background: var(--accent); }
|
||||
.guard.on .guardtrack i { left: 14px; }
|
||||
body.locked #main input[type=range] { pointer-events: none; }
|
||||
Reference in new issue
Block a user