source-map-explorer icon indicating copy to clipboard operation
source-map-explorer copied to clipboard

Output image

Open unindented opened this issue 9 years ago • 12 comments

It'd be useful to be able to output an image, preferrably SVG. I could generate it as part of my build, and include the image in my README.

unindented avatar Nov 16 '15 09:11 unindented

Interesting idea. Do you know of any SVG treemap libraries for node? On Mon, Nov 16, 2015 at 4:14 AM Daniel Perez Alvarez < [email protected]> wrote:

It'd be useful to be able to output an image, preferrably SVG. I could generate it as part of my build, and include the image in my README.

— Reply to this email directly or view it on GitHub https://github.com/danvk/source-map-explorer/issues/24.

danvk avatar Nov 16 '15 14:11 danvk

I'm wondering if you could get webtreemap to run on a virtual DOM inside a node process using jsdom...

People seem to be using that approach with d3: https://github.com/gregjopa/d3-server-side-demo

unindented avatar Nov 16 '15 14:11 unindented

Yeah, but then you'd have to convert the DOM to SVG as well. I'd be happy to look at a PR that implemented SVG output in some way.

danvk avatar Nov 16 '15 14:11 danvk

Ah, webtreemap doesn't output SVG... Would you be open to switching to d3 if I got it working?

unindented avatar Nov 16 '15 14:11 unindented

I'd be open to it. @martine, any thoughts?

danvk avatar Nov 16 '15 14:11 danvk

Just as an FYI, the current treemap is interactive. I wouldn't want to lose the interactivity if we moved to D3.

danvk avatar Nov 16 '15 15:11 danvk

Yup, understood. I may give it a whirl this weekend.

unindented avatar Nov 16 '15 16:11 unindented

Also FWIW, the webtreemap DOM is pretty simple. Converting it to SVG directly using jsdom might be easier.

danvk avatar Nov 16 '15 16:11 danvk

Ok, I'll look into that first.

unindented avatar Nov 16 '15 16:11 unindented

I wonder if you could use an SVG foreignObject with a canvas to render HTML: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Drawing_DOM_objects_into_a_canvas

On Mon, Nov 16, 2015 at 8:18 AM, Daniel Perez Alvarez < [email protected]> wrote:

Ok, I'll look into that first.

— Reply to this email directly or view it on GitHub https://github.com/danvk/source-map-explorer/issues/24#issuecomment-157085540 .

evmar avatar Nov 16 '15 16:11 evmar

@unindented Is there any outcome of your investigation?

cornips avatar Sep 29 '21 14:09 cornips

@cornips I never dedicated the time to get this working... 😢

unindented avatar Sep 29 '21 19:09 unindented