yoga-layout

An embeddable and performant flexbox layout engine with bindings for multiple languages

MIT 20 个版本
安装
npm install yoga-layout
yarn add yoga-layout
pnpm add yoga-layout
bun add yoga-layout
README

yoga-layout

This package provides prebuilt WebAssembly bindings for the Yoga layout engine.

See more at https://yogalayout.dev

Usage

import {Yoga, Align} from 'yoga-layout';

const node = Yoga.Node.create();
node.setAlignContent(Align.Center);

Objects created by Yoga.<>.create() are not automatically garbage collected and should be freed once they are no longer in use.

// Free a config
config.free();

// Free a tree of Nodes
node.freeRecursive();

// Free a single Node
node.free();

Requirements

yoga-layout requires a toolchain that supports ES Modules and top-level await.

If top-level-await is not supported, use the yoga-layout/load entry point instead. This requires to load yoga manually:

import {loadYoga, Align} from 'yoga-layout/load';

const node = (await loadYoga).Node.create();
node.setAlignContent(Align.Center);
版本列表
3.2.1 2024-12-13
3.2.0 2024-12-02
3.1.0 2024-06-23
3.0.4 2024-04-17
3.0.3 2024-04-09
3.0.2 2024-03-13
3.0.1 2024-03-13
3.0.0 2024-03-06
2.0.1 2023-11-01
2.0.0-beta.2 2023-07-13
2.0.0-beta.1 2023-06-29
2.0.0 2023-07-27
1.9.3 2018-02-15
1.9.2 2018-02-15
1.9.0 2018-01-19
1.8.0 2017-12-06
1.6.0 2017-07-13
1.5.0 2017-05-10
1.2.0 2017-02-24
1.0.1 2017-01-28