I was looking for something similar some time ago and this might help you too.
https://dev.to/pulljosh/how-to-load-html-css-and-js-code-into-an-iframe-2blc#solution-blob-urls
Used together with an import map it should allow rendering the assets transparently in the browser.