Names for link groups, shown as coloured brackets above the mixer strips

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-02 00:05:55 +01:00
1 parent 83548c9620
commit 4b33fc2665
7 files changed
+97 -14

No files matched your search

+47 -8
View File
@@ -154,9 +154,12 @@ function linkInfo(d, kind, i) { // {group, color} if the channel is linked, el
const gs = linkedGroups(d, kind), n = gs.findIndex(g => g.includes(i));
return n < 0 ? null : { group: gs[n], color: LINK_COLORS[n % LINK_COLORS.length] };
}
// group names are kept by the app, keyed by the members (a changed group starts without a name)
const linkKey = (kind, g) => `${kind}:${g.join(",")}`;
const linkName = (d, kind, g) => (d.linknames || {})[linkKey(kind, g)] || "";
const linkBadge = (d, kind, i) => {
const l = linkInfo(d, kind, i);
return l ? h("span", { class: "lnk", style: `--lc:${l.color}`, title: t("Linked: ") + l.group.map(j => chLabel(kind, j)).join(" + ") },
return l ? h("span", { class: "lnk", style: `--lc:${custColor(d, kind, i) || l.color}`, title: t("Linked: ") + l.group.map(j => chLabel(kind, j)).join(" + ") },
svgIcon(ICON.link)) : null;
};
// polarity inverted ("Phase Ø" in the channel view)
@@ -884,7 +887,7 @@ function strip(d, kind, i) {
const ch = chans(d, kind)[i];
const db = h("button", { class: "db" + (ch.gain === 280 ? " z" : ""), title: t("Enter value") }, sign(gainDb(ch.gain)));
const showDb = v => { db.textContent = sign(gainDb(v)); db.classList.toggle("z", v === 280); };
const el = h("div", { class: `strip ${kind}` + (ch.mute ? " muted" : "") + (custColor(d, kind, i) ? " tinted" : ""), style: ccStyle(d, kind, i) });
const el = h("div", { class: `strip ${kind}` + (ch.mute ? " muted" : "") + (custColor(d, kind, i) ? " tinted" : ""), style: `${ccStyle(d, kind, i)};grid-column:${i + 1}` });
const f = fader({ min: 0, max: 400, value: ch.gain, zero: 280, ticks: GAIN_TICKS, label: `${chLabel(kind, i)} Gain`,
cap: () => gainCap(dev(), kind, i), limit: maxGain(d, kind, i),
onInput: v => { showDb(v); setParam(kind, i, "gain", v); } });
@@ -905,10 +908,29 @@ function strip(d, kind, i) {
return el;
}
// bracket over a run of neighbouring strips of one link group (a group with gaps gets one per run)
function linkBands(d, kind) {
const bands = [];
linkedGroups(d, kind).forEach(g => {
const color = custColor(d, kind, g[0]) || linkInfo(d, kind, g[0]).color, name = linkName(d, kind, g);
const title = (name ? name + " · " : "") + g.map(j => chLabel(kind, j)).join(" + ");
g.forEach((j, n) => {
if (n && g[n - 1] === j - 1) return;
let len = 1;
while (g.includes(j + len)) len++;
bands.push(h("div", { class: "lkband" + (len === 1 ? " single" : ""), style: `--lc:${color};grid-column:${j + 1} / span ${len}`, title },
h("span", { class: "lkname" + (name ? "" : " anon") }, svgIcon(ICON.link), name ? h("b", {}, name) : null)));
});
});
return bands;
}
function viewMixer(d) {
const group = (kind, title) => h("section", { class: "mgroup", style: `flex-grow:${chans(d, kind).length}` },
h("h4", {}, title), h("div", { class: "strips" }, chans(d, kind).map((_, i) => strip(d, kind, i))));
return [h("div", { class: "mixer" }, group("in", t("Inputs")), group("out", t("Outputs"))),
h("h4", {}, title), h("div", { class: "strips", style: `--n:${chans(d, kind).length}` },
linkBands(d, kind), chans(d, kind).map((_, i) => strip(d, kind, i))));
const bands = linkedGroups(d, "in").length + linkedGroups(d, "out").length > 0;
return [h("div", { class: "mixer" + (bands ? " hasbands" : "") }, group("in", t("Inputs")), group("out", t("Outputs"))),
h("p", { class: "info hint" }, t("Drag a fader by its knob · snaps at 0 dB · double-tap the knob = 0 dB · tap the dB value to type one · tap the name = edit channel"))];
}
@@ -1354,12 +1376,28 @@ async function saveLinks(d, kind, groups, msg) {
S.linkBusy = false; S.linkSel[kind] = []; render();
}
function linkNameInput(d, kind, g) {
const input = h("input", { type: "text", class: "lkname-in", maxlength: 16, value: linkName(d, kind, g),
placeholder: t("Group name"), "aria-label": t("Group name"), autocomplete: "off", spellcheck: "false", enterkeyhint: "done" });
const save = async () => {
const v = input.value.trim();
if (v === linkName(dev(), kind, g)) return;
const next = { ...(dev().linknames || {}) };
if (v) next[linkKey(kind, g)] = v; else delete next[linkKey(kind, g)];
try { await api("POST", `/api/devices/${d.id}/linknames`, { linknames: next }); toast(v ? t("Group name saved") : t("Group name removed")); }
catch (e) { toast(t("Error: ") + trMsg(e.message)); }
};
input.addEventListener("change", save);
input.addEventListener("keydown", e => { if (e.key === "Enter") input.blur(); });
return input;
}
function linkCard(d, kind) {
const list = chans(d, kind), linked = linkedGroups(d, kind);
const sel = S.linkSel[kind] = S.linkSel[kind].filter(i => i < list.length && !linkInfo(d, kind, i));
const btns = list.map((ch, i) => {
const l = linkInfo(d, kind, i), on = sel.includes(i);
return h("button", { class: "lkch" + (on ? " sel" : "") + (l ? " taken" : ""), style: l ? `--lc:${l.color}` : "", "aria-pressed": String(on),
return h("button", { class: "lkch" + (on ? " sel" : "") + (l ? " taken" : ""), style: l ? `--lc:${custColor(d, kind, i) || l.color}` : "", "aria-pressed": String(on),
title: l ? t("Already linked – unlink the group first") : "", disabled: S.linkBusy || !!l, onclick: () => { S.linkSel[kind] = on ? sel.filter(j => j !== i) : [...sel, i].sort((a, b) => a - b); render(); } },
h("b", {}, chLabel(kind, i)), h("small", {}, ch.name || "\u00a0"),
h("span", { class: "lkmark" }, l ? svgIcon(ICON.link) : null));
@@ -1379,9 +1417,10 @@ function linkCard(d, kind) {
h("span", { class: "grow info" }, sel.length < 2 ? t("Tap at least two channels") : t("{n} channels selected", { n: sel.length })),
h("button", { class: "on", disabled: sel.length < 2 || S.linkBusy, onclick: link }, t("Link"))),
linked.length ? h("div", { class: "lkgroups" }, linked.map((g, n) =>
h("div", { class: "row lkgroup", style: `--lc:${LINK_COLORS[n % LINK_COLORS.length]}` },
svgIcon(ICON.link), h("span", { class: "grow" }, g.map(i => chLabel(kind, i)).join(" + ")),
h("button", { class: "small", disabled: S.linkBusy, onclick: () => unlink(g) }, t("Unlink")))))
h("div", { class: "lkgroup", style: `--lc:${custColor(d, kind, g[0]) || LINK_COLORS[n % LINK_COLORS.length]}` },
h("div", { class: "row" }, svgIcon(ICON.link), h("span", { class: "grow lkmembers" }, g.map(i => chLabel(kind, i)).join(" + ")),
h("button", { class: "small", disabled: S.linkBusy, onclick: () => unlink(g) }, t("Unlink"))),
linkNameInput(d, kind, g))))
: h("p", { class: "info" }, t("No channels linked.")));
}
+3
View File
@@ -501,6 +501,9 @@ const DE = {
"Above the max level of {lim} – press Apply twice to set it anyway.": "Über dem max. Pegel von {lim} – zum Setzen trotzdem zweimal Übernehmen drücken.",
"Max level: {lim}": "Max. Pegel: {lim}",
"Set anyway": "Trotzdem setzen",
"Group name": "Gruppenname",
"Group name saved": "Gruppenname gespeichert",
"Group name removed": "Gruppenname entfernt",
};
const DE_PATTERNS = [
+24 -2
View File
@@ -190,7 +190,28 @@ input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius:
.mixer { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.mgroup { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.mgroup h4 { margin: 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 600; }
.strips { display: flex; gap: 6px; }
/* strips sit in row 2 of a grid; row 1 holds the brackets of link groups (spanning their strips) */
.strips { display: grid; grid-template-columns: repeat(var(--n), 92px); grid-template-rows: 0 auto; gap: 0 6px; }
.mixer.hasbands .strips { grid-template-rows: 30px auto; }
.strips > .strip { grid-row: 2; }
.lkband { --lc: var(--warn); grid-row: 1; position: relative; align-self: end; height: 13px; margin: 0 14px 5px;
border: 2px solid var(--lc); border-bottom: 0; border-radius: 14px 14px 0 0;
filter: drop-shadow(0 0 5px color-mix(in srgb, var(--lc) 55%, transparent)); }
.lkband::before, .lkband::after { content: ""; position: absolute; bottom: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--lc); }
.lkband::before { left: -4px; } .lkband::after { right: -4px; }
.lkband.single { margin: 0 16px 5px; }
.lkband.single .lkname { max-width: calc(100% + 30px); padding: 1px 7px; }
.lkname { position: absolute; left: 50%; top: -1px; transform: translate(-50%, -50%); max-width: calc(100% - 20px);
display: flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; white-space: nowrap;
background: var(--bg); border: 1px solid color-mix(in srgb, var(--lc) 60%, transparent); color: var(--lc);
font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.lkname b { overflow: hidden; text-overflow: ellipsis; font-weight: inherit; }
.lkname svg { flex: none; width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.lkname.anon { padding: 2px 6px; }
.lkgroup { display: flex; flex-direction: column; gap: 6px; padding-right: 8px; }
.lkgroup > .row { flex-wrap: nowrap; }
.lkgroup .lkmembers { min-width: 0; font-weight: 600; }
.lkgroup .lkname-in { width: 100%; height: 34px; padding: 4px 10px; font-size: 13px; }
.strip { --cc: var(--warn); flex: none; width: 92px; background: linear-gradient(var(--panel), var(--bg2)); border: 1px solid var(--line);
border-radius: var(--radius); padding: 0 6px 8px; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
scroll-snap-align: start; position: relative; overflow: hidden; }
@@ -209,7 +230,8 @@ button.mute.on { background: var(--mute); border-color: #f87171; color: #fff; bo
.strip.muted { background: linear-gradient(#1f1517, var(--bg2)); }
@media (min-width: 1200px) {
.mgroup { flex-shrink: 1; flex-basis: 0; }
.strip { flex: 1 1 92px; max-width: 128px; }
.strips { grid-template-columns: repeat(var(--n), minmax(92px, 128px)); }
.strip { width: auto; max-width: 128px; }
}
/* ------------------------------------------------------------- channel view */