AFAIK at the moment the only solution is to distribute the source code alongside with the library. If IDEA knew the source file locations it would navigate to those instead of decompiling the kjsm files.
In case of gradle there is a standard way and kotlin plugin should detect sources automatically.
In case of NPM there is no standard way of distributing the sources. For example, if you are using
create-kotlin-react-app the sources are not downloaded unfortunately. You could configure a custom sources location in IDEA, but that’s not super convenient.
We are aware there should be a way to distribute documentation without open sourcing the code. Unfortunately there is no working solution at the moment (AFAIK).