feat(transactions): update cuelume; bring back improved volume user setting

This commit is contained in:
Herculino Trotta
2026-09-13 01:24:37 -03:00
parent 82211567d0
commit a2ee0b4ae6
9 changed files with 102 additions and 8 deletions
+4 -4
View File
@@ -25,7 +25,7 @@
"chart.js": "^4.5.1",
"chartjs-chart-sankey": "^0.14.3",
"chartjs-plugin-zoom": "^2.2.0",
"cuelume": "^0.1.2",
"cuelume": "^0.2.2",
"daisyui": "5.5.20",
"htmx.org": "^2.0.10",
"hyperscript.org": "^0.9.91",
@@ -1319,9 +1319,9 @@
}
},
"node_modules/cuelume": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/cuelume/-/cuelume-0.1.2.tgz",
"integrity": "sha512-VxL0k9l1fyKGot3VKM+wm5Xd2K75fVeBHdNTrR1EHiqKRtD6S5Dxy/vY7hwl9gXp3QT/TIywFXUos77n39YZVQ==",
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/cuelume/-/cuelume-0.2.2.tgz",
"integrity": "sha512-TiNzJRjhddjC4jy4M7sv63V/86VaFhdIs6iHUCrc4CKhqypaxRBv1aedCBGebrz/cO7nroPkEfqHe/P7fOE2GQ==",
"license": "MIT"
},
"node_modules/daisyui": {
+1 -1
View File
@@ -32,7 +32,7 @@
"chart.js": "^4.5.1",
"chartjs-chart-sankey": "^0.14.3",
"chartjs-plugin-zoom": "^2.2.0",
"cuelume": "^0.1.2",
"cuelume": "^0.2.2",
"daisyui": "5.5.20",
"htmx.org": "^2.0.10",
"hyperscript.org": "^0.9.91",
+8 -1
View File
@@ -1,4 +1,11 @@
import { play } from "cuelume";
window.playSound = play;
// User volume is stored as 0-10 (0 = muted); cuelume expects a 0-1 gain.
// Loudness is perceived logarithmically, so a linear mapping makes adjacent
// steps sound nearly identical. Squaring spreads them out (10 → 0dB, 5 → -12dB, 1 → -40dB).
// Pass `volume` to override the user's saved volume (e.g. to preview a new value).
window.playSound = (name, volume) => {
volume ??= JSON.parse(document.getElementById("volume")?.textContent ?? "10");
play(name, { volume: (volume / 10) ** 2 });
};