SPL Meter 0.3.0: bring the tiles to the interface rules

Rebasing onto main landed rules 5 to 11, which this module predates and
broke in three places.

Rule 5 — no explanatory text in a tile's gear: the Banding and Smoothing
fields each carried a paragraph. The Banding one said something true and
worth knowing, that below roughly 200 Hz the window length limits real
resolution however fine the setting, so it moves to the source where the
band plan is built rather than being lost. Option labels shortened with it.

Rule 11 — one control per action: the spectrogram offered its axis both as
a gear field and as a title-bar button. The button stays, since that is
what was asked for, and the field is gone. The setting still persists with
the tile; saveInstanceSettings keeps keys that no schema declares.

Rule 9 — title-bar controls are icons: the axis button was drawing a "⇆"
as a label. It is an inline SVG now, with the tooltip carrying the words
and naming the current direction rather than the action.

Rule 8 also asks that a tile can switch off what it draws, so the readout
gained a Caption toggle and both graphs gained Labels.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Waters Church
2026-09-17 16:00:17 -04:00
co-authored by Claude Opus 5
parent 543795f9fd
commit 44fd0b10ba
3 changed files with 35 additions and 36 deletions
+11 -20
View File
@@ -48,10 +48,10 @@ function averagingField() {
return {
type: 'select', label: 'Averaging', default: 'fast',
options: [
{ value: 'fast', label: 'Fast — 125 ms' },
{ value: 'slow', label: 'Slow — 1 s' },
{ value: 'inf', label: 'Inf — since reset' },
{ value: 'none', label: 'None — no averaging' },
{ value: 'fast', label: 'Fast · 125 ms' },
{ value: 'slow', label: 'Slow · 1 s' },
{ value: 'inf', label: 'Inf · since reset' },
{ value: 'none', label: 'None' },
],
};
}
@@ -63,9 +63,6 @@ function averagingField() {
*/
const BANDING_FIELD = {
type: 'select', label: 'Banding', default: '3',
help: 'Finer bandings need a wide tile to be worth drawing, and below '
+ 'roughly 200 Hz the window length limits real resolution however fine '
+ 'this is set.',
options: [
{ value: '3', label: '1/3 octave' },
{ value: '6', label: '1/6 octave' },
@@ -193,11 +190,12 @@ module.exports = {
type: 'select', label: 'Show', default: 'level',
options: [
{ value: 'level', label: 'Level' },
{ value: 'leq1m', label: 'Leq, last minute' },
{ value: 'leq10m', label: 'Leq, last 10 minutes' },
{ value: 'peakC', label: 'Peak, C-weighted' },
{ value: 'leq1m', label: 'Leq 1 min' },
{ value: 'leq10m', label: 'Leq 10 min' },
{ value: 'peakC', label: 'Peak C' },
],
},
caption: { type: 'switch', label: 'Caption', default: true },
warnAt: { type: 'number', label: 'Amber above', group: 'Thresholds', default: 95 },
alarmAt: { type: 'number', label: 'Red above', group: 'Thresholds', default: 100 },
},
@@ -222,15 +220,14 @@ module.exports = {
banding: BANDING_FIELD,
smoothing: {
type: 'select', label: 'Smoothing', default: 'medium',
help: 'How hard the bars are damped between frames. Cosmetic only — '
+ 'it changes the animation, never the measurement.',
options: [
{ value: 'off', label: 'Off — every frame as measured' },
{ value: 'off', label: 'Off' },
{ value: 'light', label: 'Light' },
{ value: 'medium', label: 'Medium' },
{ value: 'heavy', label: 'Heavy' },
],
},
labels: { type: 'switch', label: 'Labels', default: true },
gridlines: { type: 'switch', label: 'Gridlines', default: false },
},
},
@@ -240,13 +237,7 @@ module.exports = {
instanceSchema: {
channel: CHANNEL_FIELD,
banding: BANDING_FIELD,
axis: {
type: 'select', label: 'Time runs', default: 'x',
options: [
{ value: 'x', label: 'Left to right' },
{ value: 'y', label: 'Top to bottom' },
],
},
labels: { type: 'switch', label: 'Labels', default: true },
gridlines: { type: 'switch', label: 'Gridlines', default: false },
},
},