moon_taffy

MoonBit port of the Rust crate taffy (v0.5.x)

layout
flexbox
css
moon add Milky2018/moon_taffy@0.5.3
Download zip
Author
Version
0.5.3
License
Apache-2.0
Last updated
last month
Downloads
15K
README

#Milky2018/moon_taffy

MoonBit port of the Rust crate taffy (UI layout engine).

  • Upstream pinned: taffy v0.5.2 (see UPSTREAM.md)
  • Current status: generated upstream layout tests and top-level compatibility tests are ported and passing in MoonBit.
  • Public API: import the focused packages directly: geometry, style, style_helpers, and tree.

#Quick start

///|
test {
let taffy : @Milky2018/moon_taffy/tree.TaffyTree[Unit] = @Milky2018/moon_taffy/tree.TaffyTree()
let child = taffy.new_leaf(@Milky2018/moon_taffy/style.Style::default())
let root = taffy.new_with_children(
@Milky2018/moon_taffy/style.Style::default().with_size(
@Milky2018/moon_taffy/geometry.Size(
width=@Milky2018/moon_taffy/style_helpers.length(100.0),
height=@Milky2018/moon_taffy/style_helpers.length(100.0),
),
),
[child],
)
taffy.compute_layout(root, @Milky2018/moon_taffy/geometry.Size::max_content())
let layout = taffy.layout(root)
assert_eq(layout.size.width, 100.0)
assert_eq(layout.size.height, 100.0)
}

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io