diff --git a/static/dashboard.js b/static/dashboard.js index 17505db..6153fa5 100644 --- a/static/dashboard.js +++ b/static/dashboard.js @@ -55,20 +55,27 @@ function dashChannelNav(m, d, s) { h("button", { class: "small", "data-view-ok": "", "aria-label": t("Next channel"), onclick: () => go(1) }, "›")); } -// link groups in the level meters: a thin line with a small name (the mixer has the big brackets) +// link groups in the level meters: the channel numbers of a group sit on one pill, the name below it function dashGroups(d, kind) { const out = []; 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(i => chLabel(kind, i)).join(" + "); g.forEach((j, n) => { if (n && g[n - 1] === j - 1) return; let len = 1; while (g.includes(j + len)) len++; - out.push(h("div", { class: "dgrp", style: `--lc:${color};--len:${len};grid-column:${j + 1} / span ${len}`, title: (name ? name + " · " : "") + g.map(i => chLabel(kind, i)).join(" + ") }, len > 1 ? name : "")); // a single meter has no room for the name + const area = `--lc:${color};grid-column:${j + 1} / span ${len}`; + out.push(h("div", { class: "dgrp", style: area, title })); + if (name && len > 1) out.push(h("div", { class: "dgrpname", style: area, title }, name)); // a single meter has no room for it }); }); return out; } +const dashLabelColor = (d, k, i) => { + const l = linkInfo(d, k, i); + return l ? custColor(d, k, i) || l.color : custColor(d, k, i) || (k === "in" ? IN_COLORS[i] : "var(--warn)"); +}; const DASH_MODULES = { status: { @@ -88,11 +95,12 @@ const DASH_MODULES = { title: () => t("Levels"), w: 8, min: [3, 5], max: [12, 14], h: 7, icon: '', body(m, d) { - 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", style: `--n:${chans(d, k).length}` }, dashGroups(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"))); + const col = (k, i) => h("div", { class: "dm" + (chans(d, k)[i].mute ? " muted" : ""), title: chTitle(d, k, i), style: `grid-column:${i + 1}` }, + ledMeter(d.id, k, i), k === "out" ? limLed(d.id, i) : h("span", { class: "limled ph", "aria-hidden": "true" })); + const numberOf = (k, i) => h("small", { class: "dmlab", style: `color:${dashLabelColor(d, k, i)};grid-column:${i + 1}` }, 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", style: `--n:${chans(d, k).length}` }, chans(d, k).map((_, i) => col(k, i)), dashGroups(d, k), chans(d, k).map((_, i) => numberOf(k, i)))); + const named = ["in", "out"].some(k => linkedGroups(d, k).some(g => linkName(d, k, g))); + return h("div", { class: "dmeters" + (named ? " hasnames" : "") }, group("in", t("Inputs")), group("out", t("Outputs"))); }, }, mixer: { diff --git a/static/style.css b/static/style.css index dd4a5f7..1c6116a 100644 --- a/static/style.css +++ b/static/style.css @@ -831,14 +831,14 @@ body.ddragging { user-select: none; -webkit-user-select: none; cursor: grabbing; .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 { 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: 18px minmax(0, 1fr); } -.dms > .dm { grid-row: 2; } -.dgrp { grid-row: 1; align-self: end; min-width: 0; margin: 0 calc(((100% + 4px) / var(--len) - 16px) / 2) 4px; padding-bottom: 1px; border-bottom: 2px solid var(--lc); color: var(--lc); - font-size: 9px; line-height: 11px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } -.dm { --cc: var(--warn); display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; min-height: 0; } +.dms { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) 18px 0; gap: 0 4px; } +.dmeters.hasnames .dms { grid-template-rows: minmax(0, 1fr) 18px 14px; } +.dms > .dm { grid-row: 1; margin-bottom: 4px; } +.dgrp { grid-row: 2; border-radius: 9px; background: color-mix(in srgb, var(--lc) 18%, transparent); } +.dgrpname { grid-row: 3; align-self: end; min-width: 0; color: var(--lc); font-size: 10px; line-height: 12px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.dmlab { grid-row: 2; position: relative; align-self: center; text-align: center; font-size: 11px; font-weight: 700; line-height: 18px; } +.dm { 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 { flex: none; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }