I gotta make a dissertation and there is a possibility that I can use Dioxus in some way, which is super cool. But a key thing is that I have to make something completely on my own.
I showed to professor all of the 7 platforms Dioxus has. He said that the topic is good, if I can, for example make a new module/platform. But there is an obvious problem with this: what this platform is for? Pretty much everything already is covered (even the TUI!). I mean, I can in theory just recreate a TUI platform from scratch, but this can be one of the backup plans.
I remembered that there is https://dioxuslabs.com/awesome and there is even a renderer category! And the suddenly an idea popped into my head: what if I make a library/renderer, that allows you to render screenshots/screen state directly in Wasm and then included directly in a Typst document. For this I need to know some basic stuff like:
- Can a Dioxus rsx page rendering (to an SVG/PNG/JPEG) be accomplished fully in Wasm? With some tools? Or is the best thing I have is a headless browser (like a Python Selenium or Splinter) with Wasm support?
- What are the ways to manipulate input (keyboard and mouse)?
The way I see it: I compile a normal Dioxus Web app that produces Wasm file and some assets. Ideally I would embed all the assets in the Wasm. Then I would call a Wasm program, that can receive the Wasm file created withdx build -r(including or also separately all the asset files). That program will then render the page and created the needed state. Lastly, it will save the rendered page with the state to an image and return the raw image. Then I simply would callimage.decode(raw_image, format: "...")in Typst and that's it. I included a Dioxus app screenshot without any intermediate files and tools (everything is in-memory). Typst can run Wasm modules directly, so that Wasm program would ideally be called from Typst code. BTW, do we have some "image renderer"?
Would love to hear some ideas on this.