I've been using OpenJSCAD (demo at http://openjscad.org/) for small parts and really like it. With some work it could probably do what you describe but as far as I can tell no one is using it that way.
It would be cool if there was an ecosystem of OpenJSCAD parts that you could import as javascript modules.