yoga-wasm
is a build of Facebook's Yoga
Flexbox layout engine, for JavaScript and WebAssembly.
It is a drop in replacement for the yoga-layout
NPM package.
# npm
npm install --save yoga-wasm
# yarn
yarn add yoga-wasm
You should be able to use yoga-wasm
in the same way you would normally use yoga-layout
:
import * as yoga from "yoga-wasm";
const node = yoga.Node.create();
node.setMaxWidth(100);
node.calculateLayout(100, 100, yoga.DIRECTION_LTR);
yoga-dom
is another attempt to port Yoga to JS with WebAssembly. I leaned heavily on
viankakrisna's embind
bindings when porting the latest version of Yoga's bindings from nbind
to embind
.
Open a PR or file an issue!