Skip to content

Releases: npow/cssbox

v0.1.0

13 Feb 01:05

Choose a tag to compare

First release. Compute CSS layout without a browser.

Highlights

  • Take HTML/CSS or a styled node tree as input, get exact (x, y, width, height) coordinates out
  • Block, inline, float, positioning, flexbox, grid, and table layout
  • Zero required dependencies, no_std compatible core
  • Plug in your own font metrics via the TextMeasure trait

Quick start

Add cssbox-core = "0.1" to your Cargo.toml, then:

  use cssbox_dom::computed::html_to_box_tree;
  use cssbox_core::geometry::Size;
  use cssbox_core::layout::{compute_layout, FixedWidthTextMeasure};

  let tree = html_to_box_tree(r#"<div style="display: flex">
      <div style="flex: 1; height: 100px"></div>
      <div style="flex: 2; height: 100px"></div>
  </div>"#);

  let result = compute_layout(&tree, &FixedWidthTextMeasure, Size::new(800.0, 600.0));

What's next

  • Improve WPT pass rates across all layout modes
  • Real-world text shaping integration examples
  • Performance benchmarks and optimization

Full Changelog: https://github.com/npow/cssbox/commits/v0.1.0