MCPcopy Index your code
hub / github.com/DioxusLabs/blitz

github.com/DioxusLabs/blitz @anyrender-v0.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release anyrender-v0.2.0 ↗ · + Follow
1,140 symbols 2,543 edges 107 files 139 documented · 12% updated today★ 3,72359 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Blitz

A radically modular HTML/CSS rendering engine

Build Status Crates.io Docs Crates.io License dependency status

Talk to us in: the #native channel in the Dioxus Discord

Status

Blitz is currently in a pre-alpha state. It already has a very capable renderer, but there are also still many bugs and missing features. We are actively working on bringing into a usable state but we would not yet recommend building apps with it.

Check out the roadmap issue for more details.

Screenshot

screenshot

Note: This repo contains a new version of Blitz (v0.2+) which uses Stylo. The source code for the old version (v0.1) is still available on the legacy branch but is not under active development.

Trying it out

  1. Clone this repo
  2. Run an example:
    • cargo run --release --example todomvc
    • cargo run --release --example google
  3. Or our "browser" package:
    • cargo run --release --package readme ./README.md
    • cargo run --release --package readme https://news.ycombinator.com

Other examples available.

Goals

Blitz is designed to render HTML and CSS - we don't want to support the entirety of browser features (or at least we want to make all such "extra" features opt-in). In our opinion, the browser is bloated for the basic usecase of rendering HTML/CSS.

We do intend to support:

  • Modern HTML layout (flexbox, grid, table, block, inline, absolute/fixed, etc).
  • Advanced CSS (complex selectors, media queries, css variables)
  • HTML Form controls
  • Accessibility using AccessKit
  • Extensibility via custom widgets

Notably we don't provide features like webrtc, websockets, bluetooth, localstorage, etc. In a native app, much of this functionality can be fulfilled using regular Rust crates and doesn't need to be coupled with the renderer.

We don't yet have Blitz bindings for other languages (JavaScript, Python, etc) but would accept contributions along those lines.

Architecture

Blitz consists of a core DOM abstraction; several modular pieces which provide additional functionality like networking, rendering, windows, and state management; and two high-level wrappers that support rendering either a Dioxus application or HTML with a simplified API.

These pieces can be combined together to make a cohesive web engine.

High-level "wrapper" crates

  • blitz - An HTML/markdown frontend that can render an HTML string. This is useful for previewing HTML and/or markdown files but currently lacks interactivity.

Uses: blitz-dom, blitz-html, blitz-shell, blitz-renderer-vello - dioxus-native - A Dioxus frontend that can render a Dioxus VirtualDom. This has full interactivity support via Dioxus's event handling.

Uses: blitz-dom, dioxus-core, blitz-shell, blitz-renderer-vello

Both wrappers can optionally use blitz-net to fetch sub-resources.

Modular Components

Core crates

  • blitz-dom - The core DOM abstraction that includes style resolution, layout and event handling (but not parsing, rendering or system integration).

Uses: Stylo (CSS parsing/resolution), Taffy (box-level layout), Parley (text layout) - blitz-traits - Minimal base crate containing types and traits to allow the other crates to interoperate without depending on each other

Additional crates

  • blitz-net - Networking that can fetch resources over http, from the file-system or from encoded data URIs.

Uses: reqwest (HTTP client) - blitz-paint - Translates a blitz-dom tree into anyrender draw commands.

Uses: anyrender (2D drawing abstraction) - blitz-html - Adds HTML parsing to blitz-dom

Uses: html5ever (HTML parsing) and xml5ever (XHTML parsing) - blitz-shell - A shell that allows Blitz to render to a window (integrates a Winit event loop, AccessKit, Muda etc).

Uses: winit (windowing/input), accesskit (accessibility), muda (system menus)

Anyrender crates

Temporarily hosted in the Blitz repository while they mature/stabilise, these will be spun out into their own repo when ready.

  • anyrender - A 2D drawing abstraction suitable for rendering web content.
  • anyrender_svg - Translates SVGs into anyrender drawing commands.

Uses: usvg (SVG) - anyrender_vello - A Vello/WGPU backend for anyrender

Uses: vello + wgpu for rendering - anyrender_vello_cpu - A vello_cpu/softbuffer backend for anyrender

Uses: vello_cpu + softbuffer for rendering

License

This project is dual licensed under the Apache 2.0 and MIT licenses.

The stylo_taffy crate is ADDITIONALLY licensed under MPL 2.0 (so it is triple licensed under Apache 2.0, MIT, and MPL 2.0 licenses) for easier interop with the Servo project.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Blitz by you, shall be dual licensed as Apache 2.0 and MIT (and MPL 2.0 if submitted to the stylo_taffy crate), without any additional terms or conditions.

Extension points exported contracts — how you extend this code

NetCallback (Interface)
A type which accepts the parsed result of a network request and sends it back to the Document (or does arbitrary things [5 …
packages/blitz-traits/src/net.rs
WindowRenderer (Interface)
Abstraction for rendering a scene to a window [3 implementers]
packages/anyrender/src/lib.rs
BuildBezpath (Interface)
Makes it easier to insert objects into a bezpath without having to do checks Mostly because I consider the vello api sli [1 …
packages/blitz-paint/src/multicolor_rounded_rect.rs
Document (Interface)
(no doc) [2 implementers]
packages/blitz-dom/src/document.rs
CustomPaintSource (Interface)
(no doc) [1 implementers]
packages/anyrender_vello/src/custom_paint_source.rs
NetHandler (Interface)
A type that parses raw bytes from a network request into a Data and then calls the NetCallack with the result. [4 implementers]
packages/blitz-traits/src/net.rs
ImageRenderer (Interface)
Abstraction for rendering a scene to an image buffer [2 implementers]
packages/anyrender/src/lib.rs
ToColorColor (Interface)
(no doc) [1 implementers]
packages/blitz-paint/src/color.rs

Core symbols most depended-on inside this repo

clone
called by 122
packages/blitz-dom/src/node.rs
as_ref
called by 67
packages/blitz-dom/src/document.rs
attr
called by 47
packages/blitz-dom/src/node.rs
primary_styles
called by 30
packages/blitz-dom/src/node.rs
element_data
called by 27
packages/blitz-dom/src/node.rs
resolve
called by 26
packages/blitz-dom/src/document.rs
fill
called by 23
packages/anyrender_vello/src/scene.rs
get
called by 21
packages/blitz-dom/src/stylo.rs

Shape

Method 740
Function 227
Class 112
Enum 43
Interface 18

Languages

Rust100%

Modules by API surface

packages/blitz-dom/src/stylo.rs111 symbols
packages/blitz-dom/src/document.rs94 symbols
packages/blitz-dom/src/node.rs91 symbols
packages/mini-dxn/src/events.rs39 symbols
packages/blitz-dom/src/mutator.rs39 symbols
packages/stylo_taffy/src/wrapper.rs37 symbols
packages/stylo_taffy/src/convert.rs29 symbols
packages/mini-dxn/src/mutation_writer.rs29 symbols
packages/blitz-paint/src/multicolor_rounded_rect.rs27 symbols
packages/blitz-dom/src/layout/mod.rs26 symbols
packages/blitz-traits/src/events.rs24 symbols
packages/blitz-html/src/html_sink.rs23 symbols

For agents

$ claude mcp add blitz \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact