Back in the good old days, things like these could be added through plugins, instead of requiring everything to go through the browser manufacturer.
Plugins were removed mostly due to security issues (and also maintainability and portability worries), but nowadays that could be avoided by using WASM (see also https://hacks.mozilla.org/2020/02/securing-firefox-with-weba...).
Have a look at WASM decoder JXL.js: https://github.com/niutech/jxl.js