diegomura / react-pdf

📄 Create PDF files using React
https://react-pdf.org
MIT License
14.64k stars 1.16k forks source link

Switch to Taffy for layout #2542

Open thecodrr opened 7 months ago

thecodrr commented 7 months ago

Yoga is fine but it only supports Flex layout whereas Taffy has now added support for Flex, Block & Grid layouts with more on their TODO list. I think react-pdf will greatly benefit from the migration.

diegomura commented 7 months ago

Interesting. Thanks for posting this. Didn't know about Taffy. I see it's written in rust. Is there a wasm port published somewhere so I can test?

thecodrr commented 7 months ago

@nicoburns is working on a WASM build here: https://github.com/DioxusLabs/taffy/pull/394/

diegomura commented 7 months ago

Will try to be on the loop and try it out once available

nicoburns commented 7 months ago

Currently working out how best to package/publishing as a module is the blocker for this. Does react-pdf need to run it's layout (so Yoga/Taffy) in both node and browsers? And if so, how are you abstracting away the differences? Rollup?

diegomura commented 7 months ago

Thanks for reaching out @nicoburns ! Yes, we run it in both node and browser. Particularly yoga does not need any abstraction to run in both, but several packages of this repo do, and we use rollup for building different versions for each platform