Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI
feat: add rust bindings
Preetham Pemmasani26a00d885643
diff --git a/.gitignore b/.gitignoreindex fc4d5e5..ff30b67 100644--- a/.gitignore+++ b/.gitignore@@ -3,6 +3,7 @@ build-ui/*.obj*.oreference/+**/target/# packagingdist/diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cbddc09..e6a6179 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,41 @@ All notable changes to **blenderui** (BUI). The format follows## [Unreleased]+### Added+- **Rust crates** (`bindings/rust/`): `blenderui-sys` (FFI over `BUI_kit.h`,+ builds the kit with CMake) and `blenderui`: gpui syntax (`Application`,+ `Render`, `Context`, `Entity`, `cx.listener`, ~1,300 `Styled` methods), all+ 113 HTML elements, CSS (stylesheets, selectors, cascade, 173 rendered+ properties), taffy layout (block, inline line boxes, flexbox, grid, tables),+ form controls as Blender widgets, headless rendering for tests. See+ [docs/rust.md](docs/rust.md).+- Kit canvas: per-item clip rectangles and text font flags, and+ `BK_canvas_add_item` (append without an id lookup) for immediate-mode hosts.+- **Parallel canvas rasterisation**: large display lists draw in horizontal+ bands on the Win32 thread pool, with pixels identical to serial drawing+ (`BUI_RASTER_THREADS` sets the thread count). New raster APIs back it:+ `BUI_raster_view`, `BUI_text_prepare`, `BUI_raster_text_run` and+ `BUI_text_generation`.+- `BK_window_request_frame` and the `on_frame` window callback: animation+ frames that rebuild right before the render. They are vsync-paced, and a+ frame that is already late doesn't wait for another vblank.+- The `opaque` node flag: the kit skips its region clear under an opaque root.+- The Rust crate gains `Window::request_animation_frame`, `set_vsync` and+ `presented_frames`, and `BUI_PROFILE=1` per-phase timings.+- `bindings/rust/bench`: blenderui vs gpui vs gpui-fast benchmark (FPS, CPU, GPU, RAM).++### Performance+- Fill-only rounded canvas rects use the span-filling rounded-rect routine+ (about 2.5× faster).+- Left-anchored canvas text is no longer measured before drawing.+- Rust crate: style sharing between identical elements, interned and typed+ CSS values, an indexed stylesheet, allocation-free text measuring.+ Animating 3000 elements went from 12 to about 33 fps (same session: gpui-fast 0.1.13 29.7 fps, gpui 0.2.2 22.8 fps).++### Changed+- The C sources build with MSVC (`/utf-8`, no `typeof` / `[[nodiscard]]`+ outside GCC and Clang).+## [0.1.0] - first release### Addeddiff --git a/CMakeLists.txt b/CMakeLists.txtindex dc1d0bd..9bd6527 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -32,7 +32,8 @@ set(CMAKE_CXX_STANDARD 20)set(CMAKE_CXX_STANDARD_REQUIRED ON)if(MSVC)- add_compile_options(/W3)+ add_compile_options(/W3 /utf-8)+ add_compile_definitions(_USE_MATH_DEFINES _CRT_SECURE_NO_WARNINGS) # M_PI*; POSIX nameselse()add_compile_options(-Wall -Wno-unused-parameter -Wno-missing-field-initializers)if(NOT BUI_WARNINGS_AS_ERRORS)diff --git a/README.md b/README.mdindex 430dd40..c30faa9 100644--- a/README.md+++ b/README.md@@ -14,9 +14,12 @@ the color wheel, Ctrl+Z on any edit and you can drive it three ways:(a common subset today).- **Blender components**: a native component library (`Panel`,`NumberSlider`, `ColorSwatch`, `TreeView`, `PieMenu` ...).+- **Rust, gpui syntax**: the `blenderui` crate. `div().flex().gap_2().child(...)`,+ `cx.listener`, `Render`, plus every HTML element and CSS (stylesheets,+ selectors, flexbox, grid, tables), with form controls as Blender widgets.-All three share one C runtime (`kit/`). Python builds the widget tree and-runs your callbacks. Layout, input, drawing and presenting stay in C.+All of them share one C runtime (`kit/`). Python (or Rust) builds the widget+tree and runs your callbacks. Input, widget drawing and presenting stay in C.```shpip install blenderui # on PyPI: https://pypi.org/project/blenderui/@@ -40,6 +43,7 @@ Right: an unmodified tkinter program (<code>examples/tk_unchanged_app.py</code>)- [tkinter syntax](#tkinter-syntax)- [Qt syntax](#qt-syntax)- [Blender components](#blender-components)+ - [Rust (gpui syntax, HTML and CSS)](#rust-gpui-syntax-html-and-css)- [How it works](#how-it-works)- [Performance](#performance)- [Roadmap: more languages and platforms](#roadmap-more-languages-and-platforms)@@ -73,7 +77,7 @@ Right: an unmodified tkinter program (<code>examples/tk_unchanged_app.py</code>)| Component library (`bui.components`) | ✅ Working | 45 Blender components, including editors (color ramp, curves) and templates || C++ / Qt render-sink backends | ✅ Working | For embedding BUI drawing into your own renderer ([INTEGRATION.md](INTEGRATION.md)) || Packaging (`pip install blenderui`) | ✅ Published | [`blenderui` 0.1.0 on PyPI](https://pypi.org/project/blenderui/): a prebuilt wheel for Windows / CPython 3.12, and a source package that other platforms compile on install (needs CMake and a C compiler). Prebuilt wheels for all platforms come from CI on the next tagged release ([docs/publishing.md](docs/publishing.md)) |-| **Rust port** (`blenderui` crate) | 🗺️ Planned (next) | `blenderui-sys` (bindgen over `BUI_kit.h`) plus a safe crate: owned node tree, closures for callbacks, `winit` windows. First item on the [roadmap](#roadmap-more-languages-and-platforms) |+| **Rust** (`blenderui` crate) | ✅ **Working** | gpui syntax (`Render`, `Context`, `Entity`, `cx.listener`, ~1,300 `Styled` methods) over **113/113 HTML elements** and CSS: **173 properties rendered** (+87 parsed without effect), CSS 2.1 screen properties 76/90 rendered (90/90 parsed), Flexbox 12/12, Grid 22/23. Layout by [taffy](https://github.com/DioxusLabs/taffy). Native window on Windows, headless rendering everywhere. Fastest in a 3000-element full-animation benchmark: 32.6 fps vs gpui-fast 29.7 and gpui 22.8, with about half their memory ([benchmark](bindings/rust/bench/README.md)). [docs/rust.md](docs/rust.md) || **egui integration** | 🗺️ Planned | BUI panels drawn inside egui (raster → `egui::TextureHandle`, input forwarded) and a Blender-styled `egui::Visuals` theme. Builds on the Rust crate || **WebAssembly build** | 🗺️ Planned | The kit compiled with Emscripten: the raster blits to `<canvas>` (damage rectangles only), DOM events feed `BK_press` / `BK_key` || **React** (`@blenderui/react`) | 🗺️ Planned | A JSX reconciler over the WASM build (`<Panel>`, `<NumberSlider>` ...); `@blenderui/web` for plain JS/TS, N-API for Node |@@ -228,6 +232,47 @@ App("Object", (420, 520),Component reference and Blender interaction details:**[docs/components.md](docs/components.md)**.+### Rust (gpui syntax, HTML and CSS)++```toml+[dependencies]+blenderui = { git = "https://github.com/ppmpreetham/BUI" } # needs CMake and a C compiler+```++```rust+use blenderui::prelude::*;++struct Counter { count: i32 }++impl Render for Counter {+ fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ div().flex().flex_col().gap_2().p_4()+ .child(h1().child(format!("Count: {}", self.count)))+ .child(p().child("Any ").child(b().child("HTML element")).child(", styled with ")+ .child(code().child(".css()")).child(" or a <style> sheet."))+ .child(button().child("Add one").on_click(cx.listener(|this, _, _, cx| {+ this.count += 1;+ cx.notify();+ })))+ .child(input().input_type("range").min(0.0).max(10.0)) // a Blender slider+ }+}++fn main() {+ Application::new().run(|cx: &mut App| {+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Counter { count: 0 }))+ .unwrap();+ });+}+```++<p align="center"><img src="docs/images/rust-showcase.png" width="560" alt="The Rust showcase example"></p>+<p align="center"><sub><code>bindings/rust/blenderui/examples/showcase.rs</code>: a stylesheet, grid cards with+gradients and shadows, Blender form widgets, a table, lists, <code><details></code> and <code><pre></code>.</sub></p>++Elements, the CSS that is supported, events and testing headless:+**[docs/rust.md](docs/rust.md)**.+## How it works```@@ -283,7 +328,7 @@ them needs Python.|---|---|---|| **Python**: tkinter, Qt, components | `bui.tksyntax`, `bui.qtsyntax`, `bui.components` | ✅ Done (Qt partial) || **C / C++** | `BUI_kit.h`, render sinks, Qt/QPainter backend | ✅ Done |-| **Rust** | `blenderui-sys` (bindgen over `BUI_kit.h`) and a safe `blenderui` crate: an owned node tree, closures for callbacks, `winit` windows | 🗺️ Planned |+| **Rust** | `blenderui-sys` (FFI over `BUI_kit.h`, builds the kit with CMake) and `blenderui`: gpui syntax, all HTML elements, CSS, taffy layout ([docs/rust.md](docs/rust.md)) | ✅ Done (native window on Windows; Linux/macOS render headless until their window hosts land) || **egui** | Two ways in: draw a BUI panel inside egui (raster to an `egui::TextureHandle`, with input forwarded), and a Blender-styled `egui::Visuals` theme | 🗺️ Planned || **WebAssembly** | Compile the kit with Emscripten. The raster blits to a `<canvas>` (`putImageData` of the damage rectangles only), and DOM pointer and keyboard events go to `BK_press` / `BK_key` | 🗺️ Planned || **React** | `@blenderui/react` on top of the WASM build: a reconciler that maps JSX to kit nodes (`<Panel>`, `<NumberSlider>` ...) | 🗺️ Planned |@@ -300,22 +345,6 @@ them needs Python.<details><summary>Intended API sketches (planned, not implemented yet)</summary>-Rust:--```rust-use blenderui::{App, Panel, NumberSlider, Checkbox, Button};--fn main() {- App::new("Tool", (360, 260))- .child(Panel::new("Object")- .child(NumberSlider::new("Size", 1.0).range(0.0, 10.0)- .on_change(|v| println!("size = {v}")))- .child(Checkbox::new("Smooth", true))- .child(Button::new("Apply").on_click(|| println!("apply"))))- .run();-}-```-egui:```rust@@ -344,7 +373,7 @@ export default function Properties() {</details>-Work order: the Rust crate first (it also unlocks egui and Bevy), then+Work order: the Rust crate is done (it also unlocks egui and Bevy); next isthe WebAssembly build (it unlocks React, JS/TS, Tauri and Electron), thennative Linux / macOS windows.@@ -380,6 +409,7 @@ python -m build # dist/blenderui-<version>.tar.gz and a whee| [docs/qt.md](docs/qt.md) | Qt-syntax guide: classes, signals, layouts, painting, timers, coverage and gaps || [docs/components.md](docs/components.md) | `bui.components` reference: layout, values, views, menus, color, editors, `App` || [docs/c-api.md](docs/c-api.md) | The C kit (`BUI_kit.h`): nodes, properties, events, windows |+| [docs/rust.md](docs/rust.md) | The Rust crate: gpui syntax, HTML elements, CSS coverage, events, headless testing || [docs/publishing.md](docs/publishing.md) | Packaging as `blenderui`, building wheels, CI, releasing to PyPI || [CHANGELOG.md](CHANGELOG.md) | Release notes || [SYNTAX_COVERAGE.md](SYNTAX_COVERAGE.md) | Member-by-member coverage tables for both syntax layers |@@ -395,6 +425,7 @@ Examples (`examples/`):| `qt_syntax_demo.py` | Qt syntax: layouts, form widgets, signals || `components_demo.py` | Every Blender component, in a properties-editor layout || `kit_hello.c` | The C kit from C: a slider and a button in a native window |+| `bindings/rust/blenderui/examples/showcase.rs` | Rust: HTML, a stylesheet, flex/grid, tables, Blender form widgets || `python_demo.py`, `svg_demo.c` | Low-level drawing into an SVG render sink |## Repository layout@@ -408,6 +439,7 @@ Examples (`examples/`):| `api/` | Stable C ABI for render-sink hosts (`bui_c_api.h`) || `bindings/python/` | `buipy` extension (`src/`) and the `bui` package: `tksyntax/`, `qtsyntax.py`, `components/`, `host.py` || `backends/qt/` | C++ Qt/QPainter render-sink backend |+| `bindings/rust/` | Cargo workspace: `blenderui-sys` (FFI, builds the kit with CMake) and `blenderui` (gpui syntax, HTML, CSS, taffy layout) || `bindings/python/blenderui/` | The `blenderui` import alias (the PyPI name) || `pyproject.toml`, `.github/workflows/` | PyPI packaging (scikit-build-core) and the wheel and release CI || `examples/`, `tools/` | Demos, the icon generator, the docs screenshot generator |@@ -427,6 +459,10 @@ ctest --test-dir build --output-on-failure| `buipy_tk_compat` | Nine tkinter programs run on stdlib tkinter **and** BUI; results must match || `buipy_tk_input` | tkinter widgets driven by real pointer and keyboard input through the kit |+Rust (`cd bindings/rust && cargo test`): CSS parsing and selectors, the HTML and CSS+coverage report (`cargo test --test parity -- --nocapture`), and headless windows+checking layout positions, painted pixels, clicks, `:hover` and Blender widgets.+## LicenseDerived from Blender sources: **GPL-2.0-or-later** (see `LICENSE` and the SPDXdiff --git a/bindings/rust/Cargo.lock b/bindings/rust/Cargo.locknew file mode 100644index 0000000..25ed81f--- /dev/null+++ b/bindings/rust/Cargo.lock@@ -0,0 +1,269 @@+# This file is automatically @generated by Cargo.+# It is not intended for manual editing.+version = 3++[[package]]+name = "adler2"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"++[[package]]+name = "arrayvec"+version = "0.7.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"++[[package]]+name = "autocfg"+version = "1.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"++[[package]]+name = "bitflags"+version = "1.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"++[[package]]+name = "blenderui"+version = "0.1.0"+dependencies = [+ "blenderui-sys",+ "paste",+ "png",+ "taffy",+]++[[package]]+name = "blenderui-sys"+version = "0.1.0"+dependencies = [+ "cmake",+]++[[package]]+name = "cc"+version = "1.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "375989decec1a0fa424442bed520fa12ede43a48475ce8c7417d2c69b32b5f6b"+dependencies = [+ "find-msvc-tools",+ "shlex",+]++[[package]]+name = "cfg-if"+version = "1.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"++[[package]]+name = "cmake"+version = "0.1.58"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"+dependencies = [+ "cc",+]++[[package]]+name = "crc32fast"+version = "1.5.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5f97d3416d5337d15c4b0d78c8c91df922ca143f57ec20e2d1c188333047ef04"+dependencies = [+ "cfg-if",+]++[[package]]+name = "fdeflate"+version = "0.3.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"+dependencies = [+ "simd-adler32",+]++[[package]]+name = "find-msvc-tools"+version = "0.1.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"++[[package]]+name = "flate2"+version = "1.1.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb"+dependencies = [+ "crc32fast",+ "miniz_oxide 0.9.1",+ "zlib-rs",+]++[[package]]+name = "grid"+version = "0.15.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "36119f3a540b086b4e436bb2b588cf98a68863470e0e880f4d0842f112a3183a"++[[package]]+name = "miniz_oxide"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"+dependencies = [+ "adler2",+ "simd-adler32",+]++[[package]]+name = "miniz_oxide"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"+dependencies = [+ "adler2",+ "simd-adler32",+]++[[package]]+name = "num-traits"+version = "0.2.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"+dependencies = [+ "autocfg",+]++[[package]]+name = "paste"+version = "1.0.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"++[[package]]+name = "png"+version = "0.17.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"+dependencies = [+ "bitflags",+ "crc32fast",+ "fdeflate",+ "flate2",+ "miniz_oxide 0.8.9",+]++[[package]]+name = "proc-macro2"+version = "1.0.107"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "quote"+version = "1.0.47"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"+dependencies = [+ "proc-macro2",+]++[[package]]+name = "serde"+version = "1.0.229"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"+dependencies = [+ "serde_core",+ "serde_derive",+]++[[package]]+name = "serde_core"+version = "1.0.229"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"+dependencies = [+ "serde_derive",+]++[[package]]+name = "serde_derive"+version = "1.0.229"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "shlex"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"++[[package]]+name = "simd-adler32"+version = "0.3.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"++[[package]]+name = "slotmap"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038"+dependencies = [+ "version_check",+]++[[package]]+name = "syn"+version = "3.0.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "taffy"+version = "0.6.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "136661daffcdfb128afb0d45a8f7e88078739196d64d7ffa47f8513f4a00a6d7"+dependencies = [+ "arrayvec",+ "grid",+ "num-traits",+ "serde",+ "slotmap",+]++[[package]]+name = "unicode-ident"+version = "1.0.27"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"++[[package]]+name = "version_check"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"++[[package]]+name = "zlib-rs"+version = "0.6.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"diff --git a/bindings/rust/Cargo.toml b/bindings/rust/Cargo.tomlnew file mode 100644index 0000000..ffda08c--- /dev/null+++ b/bindings/rust/Cargo.toml@@ -0,0 +1,11 @@+[workspace]+resolver = "2"+members = ["blenderui-sys", "blenderui"]+exclude = ["bench"]++[workspace.package]+version = "0.1.0"+edition = "2024"+license = "GPL-2.0-or-later"+repository = "https://github.com/ppmpreetham/BUI"+rust-version = "1.85"diff --git a/bindings/rust/bench/Cargo.lock b/bindings/rust/bench/Cargo.locknew file mode 100644index 0000000..6d14522--- /dev/null+++ b/bindings/rust/bench/Cargo.lock@@ -0,0 +1,9267 @@+# This file is automatically @generated by Cargo.+# It is not intended for manual editing.+version = 4++[[package]]+name = "accesskit"+version = "0.24.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3b7f7f85a7e5f68090000ed7622545829afd484d210358702ae4cb97dd0c320"+dependencies = [+ "enumn",+ "uuid",+]++[[package]]+name = "accesskit_consumer"+version = "0.38.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d10a236f96f87d70732e44520046785431ef01d5bcd6b041317bfadd2f88245"+dependencies = [+ "accesskit",+ "hashbrown 0.16.1",+]++[[package]]+name = "accesskit_macos"+version = "0.26.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ce02dc63b43f0c9296af9ac946312a2dc8814427d7a64d2d600971dac55b6076"+dependencies = [+ "accesskit",+ "accesskit_consumer",+ "hashbrown 0.16.1",+ "objc2 0.5.3",+ "objc2-app-kit 0.2.2",+ "objc2-foundation 0.2.2",+]++[[package]]+name = "accesskit_windows"+version = "0.34.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "106c2b961215864d1c2e703ee63269c25c4e80a577ffb2c1017b9c17dcdf83a1"+dependencies = [+ "accesskit",+ "accesskit_consumer",+ "hashbrown 0.16.1",+ "static_assertions",+ "windows 0.62.2",+ "windows-core 0.62.2",+]++[[package]]+name = "addr2line"+version = "0.27.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e567177890eb1617b1f774005b66b26b2377afd138a2ca37aae7d8f0c81429d4"+dependencies = [+ "gimli",+]++[[package]]+name = "adler2"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"++[[package]]+name = "aes"+version = "0.8.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"+dependencies = [+ "cfg-if",+ "cipher",+ "cpufeatures 0.2.17",+ "zeroize",+]++[[package]]+name = "ahash"+version = "0.8.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"+dependencies = [+ "cfg-if",+ "const-random",+ "once_cell",+ "version_check",+ "zerocopy",+]++[[package]]+name = "aho-corasick"+version = "1.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"+dependencies = [+ "memchr",+]++[[package]]+name = "aligned"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"+dependencies = [+ "as-slice",+]++[[package]]+name = "aligned-vec"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b"+dependencies = [+ "equator",+]++[[package]]+name = "allocator-api2"+version = "0.2.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"++[[package]]+name = "android_system_properties"+version = "0.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc"+dependencies = [+ "libc",+]++[[package]]+name = "anyhow"+version = "1.0.104"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"++[[package]]+name = "ar_archive_writer"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "73cd58deff2140a0a8eae87e417bd01db68a33e148aa93d1e8cd837e55e312b6"+dependencies = [+ "object 0.39.1",+]++[[package]]+name = "arbitrary"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed"++[[package]]+name = "arg_enum_proc_macro"+version = "0.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "arrayref"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb"++[[package]]+name = "arrayvec"+version = "0.7.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"++[[package]]+name = "as-raw-xcb-connection"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"++[[package]]+name = "as-slice"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"+dependencies = [+ "stable_deref_trait",+]++[[package]]+name = "ash"+version = "0.38.0+1.3.281"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f"+dependencies = [+ "libloading",+]++[[package]]+name = "ash-window"+version = "0.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "52bca67b61cb81e5553babde81b8211f713cb6db79766f80168f3e5f40ea6c82"+dependencies = [+ "ash",+ "raw-window-handle",+ "raw-window-metal 0.4.0",+]++[[package]]+name = "ashpd"+version = "0.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d2f3f79755c74fd155000314eb349864caa787c6592eace6c6882dad873d9c39"+dependencies = [+ "async-fs",+ "async-net",+ "enumflags2",+ "futures-channel",+ "futures-util",+ "rand 0.9.5",+ "serde",+ "serde_repr",+ "url",+ "wayland-backend",+ "wayland-client",+ "wayland-protocols 0.32.13",+ "zbus",+]++[[package]]+name = "ashpd"+version = "0.12.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "33a3c86f3fd70c0ffa500ed189abfa90b5a52398a45d5dc372fcc38ebeb7a645"+dependencies = [+ "async-fs",+ "async-net",+ "enumflags2",+ "futures-channel",+ "futures-util",+ "rand 0.9.5",+ "serde",+ "serde_repr",+ "url",+ "zbus",+]++[[package]]+name = "ashpd"+version = "0.13.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fb8421aaa9644a5faf26735f258b669b15f063313ef8f8e2bdb28912a1a6f111"+dependencies = [+ "enumflags2",+ "futures-util",+ "getrandom 0.4.3",+ "serde",+ "zbus",+]++[[package]]+name = "async-broadcast"+version = "0.7.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"+dependencies = [+ "event-listener 5.4.2",+ "event-listener-strategy",+ "futures-core",+ "pin-project-lite",+]++[[package]]+name = "async-channel"+version = "1.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35"+dependencies = [+ "concurrent-queue",+ "event-listener 2.5.3",+ "futures-core",+]++[[package]]+name = "async-channel"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"+dependencies = [+ "concurrent-queue",+ "event-listener-strategy",+ "futures-core",+ "pin-project-lite",+]++[[package]]+name = "async-compression"+version = "0.4.52"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ad47a740fb906fffdd891e8b6d5fde2511600f7bfaebd68939fa08a14999459"+dependencies = [+ "compression-codecs",+ "compression-core",+ "futures-io",+ "pin-project-lite",+]++[[package]]+name = "async-executor"+version = "1.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a"+dependencies = [+ "async-task",+ "concurrent-queue",+ "fastrand 2.5.0",+ "futures-lite 2.6.1",+ "pin-project-lite",+ "slab",+]++[[package]]+name = "async-fs"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5"+dependencies = [+ "async-lock",+ "blocking",+ "futures-lite 2.6.1",+]++[[package]]+name = "async-global-executor"+version = "2.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c"+dependencies = [+ "async-channel 2.5.0",+ "async-executor",+ "async-io",+ "async-lock",+ "blocking",+ "futures-lite 2.6.1",+ "once_cell",+]++[[package]]+name = "async-io"+version = "2.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc"+dependencies = [+ "autocfg",+ "cfg-if",+ "concurrent-queue",+ "futures-io",+ "futures-lite 2.6.1",+ "parking",+ "polling",+ "rustix 1.1.6",+ "slab",+ "windows-sys 0.61.2",+]++[[package]]+name = "async-lock"+version = "3.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0876700b0d007ad25d5508865a4259c3af9af6d296bf663a0d586d0bc3369f6f"+dependencies = [+ "event-listener 5.4.2",+ "event-listener-strategy",+ "pin-project-lite",+]++[[package]]+name = "async-net"+version = "2.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7"+dependencies = [+ "async-io",+ "blocking",+ "futures-lite 2.6.1",+]++[[package]]+name = "async-process"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75"+dependencies = [+ "async-channel 2.5.0",+ "async-io",+ "async-lock",+ "async-signal",+ "async-task",+ "blocking",+ "cfg-if",+ "event-listener 5.4.2",+ "futures-lite 2.6.1",+ "rustix 1.1.6",+]++[[package]]+name = "async-recursion"+version = "1.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "async-signal"+version = "0.2.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485"+dependencies = [+ "async-io",+ "async-lock",+ "atomic-waker",+ "cfg-if",+ "futures-core",+ "futures-io",+ "rustix 1.1.6",+ "signal-hook-registry",+ "slab",+ "windows-sys 0.61.2",+]++[[package]]+name = "async-std"+version = "1.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2c8e079a4ab67ae52b7403632e4618815d6db36d2a010cfe41b02c1b1578f93b"+dependencies = [+ "async-channel 1.9.0",+ "async-global-executor",+ "async-io",+ "async-lock",+ "async-process",+ "crossbeam-utils",+ "futures-channel",+ "futures-core",+ "futures-io",+ "futures-lite 2.6.1",+ "gloo-timers",+ "kv-log-macro",+ "log",+ "memchr",+ "once_cell",+ "pin-project-lite",+ "pin-utils",+ "slab",+ "wasm-bindgen-futures",+]++[[package]]+name = "async-task"+version = "4.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"++[[package]]+name = "async-trait"+version = "0.1.92"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "async_zip"+version = "0.0.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "00b9f7252833d5ed4b00aa9604b563529dd5e11de9c23615de2dcdf91eb87b52"+dependencies = [+ "async-compression",+ "crc32fast",+ "futures-lite 2.6.1",+ "pin-project",+ "thiserror 1.0.69",+]++[[package]]+name = "atomic"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba"++[[package]]+name = "atomic-waker"+version = "1.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"++[[package]]+name = "autocfg"+version = "1.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"++[[package]]+name = "av-scenechange"+version = "0.14.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394"+dependencies = [+ "aligned",+ "anyhow",+ "arg_enum_proc_macro",+ "arrayvec",+ "log",+ "num-rational",+ "num-traits",+ "pastey",+ "rayon",+ "thiserror 2.0.21",+ "v_frame",+ "y4m",+]++[[package]]+name = "av1-grain"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8"+dependencies = [+ "anyhow",+ "arrayvec",+ "log",+ "nom 8.0.0",+ "num-rational",+ "v_frame",+]++[[package]]+name = "avif-serialize"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38"+dependencies = [+ "arrayvec",+]++[[package]]+name = "backtrace"+version = "0.3.77"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "42f4220217f3288537b83684130f42fad43320b1c3b805f1910d683d52ded24f"+dependencies = [+ "addr2line",+ "cfg-if",+ "libc",+ "miniz_oxide 0.9.1",+ "object 0.40.0",+ "rustc-demangle",+ "windows-link 0.2.1",+]++[[package]]+name = "base64"+version = "0.22.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"++[[package]]+name = "bindgen"+version = "0.71.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3"+dependencies = [+ "bitflags 2.13.2",+ "cexpr",+ "clang-sys",+ "itertools 0.13.0",+ "log",+ "prettyplease",+ "proc-macro2",+ "quote",+ "regex",+ "rustc-hash 2.1.3",+ "shlex 1.3.0",+ "syn 2.0.119",+]++[[package]]+name = "bit-set"+version = "0.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"+dependencies = [+ "bit-vec 0.8.0",+]++[[package]]+name = "bit-set"+version = "0.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d"+dependencies = [+ "bit-vec 0.9.1",+]++[[package]]+name = "bit-vec"+version = "0.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"++[[package]]+name = "bit-vec"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51"++[[package]]+name = "bit_field"+version = "0.10.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"++[[package]]+name = "bitflags"+version = "1.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"++[[package]]+name = "bitflags"+version = "2.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"++[[package]]+name = "bitstream-io"+version = "4.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f"+dependencies = [+ "no_std_io2",+]++[[package]]+name = "blade-graphics"+version = "0.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e71cfb73b98eb9f58ee84048aa1bdf4e7497fd20c141b57523499fa066b48fed"+dependencies = [+ "ash",+ "ash-window",+ "bitflags 2.13.2",+ "bytemuck",+ "codespan-reporting 0.12.0",+ "glow 0.16.0",+ "gpu-alloc",+ "gpu-alloc-ash",+ "hidden-trait",+ "js-sys",+ "khronos-egl",+ "libloading",+ "log",+ "mint",+ "naga 25.0.1",+ "objc2 0.6.5",+ "objc2-app-kit 0.3.2",+ "objc2-core-foundation",+ "objc2-foundation 0.3.2",+ "objc2-metal 0.3.2",+ "objc2-quartz-core 0.3.2",+ "objc2-ui-kit",+ "once_cell",+ "raw-window-handle",+ "slab",+ "wasm-bindgen",+ "web-sys",+]++[[package]]+name = "blade-macros"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "27142319e2f4c264581067eaccb9f80acccdde60d8b4bf57cc50cd3152f109ca"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "blade-util"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3a6be3a82c001ba7a17b6f8e413ede5d1004e6047213f8efaf0ffc15b5c4904c"+dependencies = [+ "blade-graphics",+ "bytemuck",+ "log",+ "profiling",+]++[[package]]+name = "blenderui"+version = "0.1.0"+dependencies = [+ "blenderui-sys",+ "paste",+ "png 0.17.16",+ "taffy 0.6.3",+]++[[package]]+name = "blenderui-sys"+version = "0.1.0"+dependencies = [+ "cmake",+]++[[package]]+name = "block"+version = "0.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"++[[package]]+name = "block-buffer"+version = "0.10.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"+dependencies = [+ "generic-array",+]++[[package]]+name = "block-buffer"+version = "0.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa"+dependencies = [+ "hybrid-array",+]++[[package]]+name = "block-padding"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93"+dependencies = [+ "generic-array",+]++[[package]]+name = "block2"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"+dependencies = [+ "objc2 0.5.3",+]++[[package]]+name = "block2"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5"+dependencies = [+ "objc2 0.6.5",+]++[[package]]+name = "blocking"+version = "1.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa"+dependencies = [+ "async-channel 2.5.0",+ "async-task",+ "futures-io",+ "futures-lite 2.6.1",+ "piper",+]++[[package]]+name = "bstr"+version = "1.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6bb31b46c14244e20ee9984b11bf5c992b91fb6939fea616e3512c8baecdbe5f"+dependencies = [+ "memchr",+ "serde_core",+]++[[package]]+name = "bui-bench"+version = "0.1.0"+dependencies = [+ "blenderui",+]++[[package]]+name = "built"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9"++[[package]]+name = "bumpalo"+version = "3.20.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"++[[package]]+name = "bytemuck"+version = "1.25.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797"+dependencies = [+ "bytemuck_derive",+]++[[package]]+name = "bytemuck_derive"+version = "1.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "byteorder"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"++[[package]]+name = "byteorder-lite"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"++[[package]]+name = "bytes"+version = "1.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"++[[package]]+name = "calloop"+version = "0.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec"+dependencies = [+ "bitflags 2.13.2",+ "log",+ "polling",+ "rustix 0.38.44",+ "slab",+ "thiserror 1.0.69",+]++[[package]]+name = "calloop"+version = "0.14.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e"+dependencies = [+ "bitflags 2.13.2",+ "polling",+ "rustix 1.1.6",+ "tracing",+]++[[package]]+name = "calloop-wayland-source"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"+dependencies = [+ "calloop 0.13.0",+ "rustix 0.38.44",+ "wayland-backend",+ "wayland-client",+]++[[package]]+name = "cbc"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6"+dependencies = [+ "cipher",+]++[[package]]+name = "cbindgen"+version = "0.28.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff"+dependencies = [+ "heck 0.4.1",+ "indexmap",+ "log",+ "proc-macro2",+ "quote",+ "serde",+ "serde_json",+ "syn 2.0.119",+ "tempfile",+ "toml 0.8.23",+]++[[package]]+name = "cc"+version = "1.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "375989decec1a0fa424442bed520fa12ede43a48475ce8c7417d2c69b32b5f6b"+dependencies = [+ "find-msvc-tools",+ "jobserver",+ "libc",+ "shlex 2.0.1",+]++[[package]]+name = "cexpr"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"+dependencies = [+ "nom 7.1.3",+]++[[package]]+name = "cfg-if"+version = "1.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"++[[package]]+name = "cfg_aliases"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"++[[package]]+name = "cgl"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff"+dependencies = [+ "libc",+]++[[package]]+name = "chacha20"+version = "0.10.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"+dependencies = [+ "cfg-if",+ "cpufeatures 0.3.1",+ "rand_core 0.10.1",+]++[[package]]+name = "chrono"+version = "0.4.45"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"+dependencies = [+ "iana-time-zone",+ "js-sys",+ "num-traits",+ "serde",+ "wasm-bindgen",+ "windows-link 0.2.1",+]++[[package]]+name = "cipher"+version = "0.4.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"+dependencies = [+ "crypto-common 0.1.7",+ "inout",+ "zeroize",+]++[[package]]+name = "clang-sys"+version = "1.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"+dependencies = [+ "glob",+ "libc",+ "libloading",+]++[[package]]+name = "cmake"+version = "0.1.58"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678"+dependencies = [+ "cc",+]++[[package]]+name = "cocoa"+version = "0.25.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c"+dependencies = [+ "bitflags 1.3.2",+ "block",+ "cocoa-foundation 0.1.2",+ "core-foundation 0.9.4",+ "core-graphics 0.23.2",+ "foreign-types",+ "libc",+ "objc",+]++[[package]]+name = "cocoa"+version = "0.26.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f79398230a6e2c08f5c9760610eb6924b52aa9e7950a619602baba59dcbbdbb2"+dependencies = [+ "bitflags 2.13.2",+ "block",+ "cocoa-foundation 0.2.0",+ "core-foundation 0.10.0",+ "core-graphics 0.24.0",+ "foreign-types",+ "libc",+ "objc",+]++[[package]]+name = "cocoa-foundation"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7"+dependencies = [+ "bitflags 1.3.2",+ "block",+ "core-foundation 0.9.4",+ "core-graphics-types 0.1.3",+ "libc",+ "objc",+]++[[package]]+name = "cocoa-foundation"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e14045fb83be07b5acf1c0884b2180461635b433455fa35d1cd6f17f1450679d"+dependencies = [+ "bitflags 2.13.2",+ "block",+ "core-foundation 0.10.0",+ "core-graphics-types 0.2.0",+ "libc",+ "objc",+]++[[package]]+name = "codespan-reporting"+version = "0.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81"+dependencies = [+ "serde",+ "termcolor",+ "unicode-width",+]++[[package]]+name = "codespan-reporting"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681"+dependencies = [+ "serde",+ "termcolor",+ "unicode-width",+]++[[package]]+name = "color_quant"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"++[[package]]+name = "command-fds"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1b60b5124979fccd9addd89d8b97a1d6eebb4950694520c75ddd722535ea443f"+dependencies = [+ "nix 0.31.3",+ "thiserror 2.0.21",+]++[[package]]+name = "compression-codecs"+version = "0.4.47"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "84f840cff84d10085260e460023934d0af699e71212b09b2a41452e8bd9cda43"+dependencies = [+ "compression-core",+ "deflate64",+ "flate2",+ "memchr",+]++[[package]]+name = "compression-core"+version = "0.4.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2ebdda89edc534bf8d5dd2857562633b6495557e5846552ade994b99ed13c36a"++[[package]]+name = "concurrent-queue"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"+dependencies = [+ "crossbeam-utils",+]++[[package]]+name = "console_error_panic_hook"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"+dependencies = [+ "cfg-if",+ "wasm-bindgen",+]++[[package]]+name = "const-oid"+version = "0.10.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"++[[package]]+name = "const-random"+version = "0.1.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"+dependencies = [+ "const-random-macro",+]++[[package]]+name = "const-random-macro"+version = "0.1.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"+dependencies = [+ "getrandom 0.2.17",+ "once_cell",+ "tiny-keccak",+]++[[package]]+name = "convert_case"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"++[[package]]+name = "convert_case"+version = "0.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9"+dependencies = [+ "unicode-segmentation",+]++[[package]]+name = "core-foundation"+version = "0.9.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"+dependencies = [+ "core-foundation-sys",+ "libc",+]++[[package]]+name = "core-foundation"+version = "0.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63"+dependencies = [+ "core-foundation-sys",+ "libc",+]++[[package]]+name = "core-foundation-sys"+version = "0.8.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"++[[package]]+name = "core-graphics"+version = "0.23.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"+dependencies = [+ "bitflags 1.3.2",+ "core-foundation 0.9.4",+ "core-graphics-types 0.1.3",+ "foreign-types",+ "libc",+]++[[package]]+name = "core-graphics"+version = "0.24.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1"+dependencies = [+ "bitflags 2.13.2",+ "core-foundation 0.10.0",+ "core-graphics-types 0.2.0",+ "foreign-types",+ "libc",+]++[[package]]+name = "core-graphics-helmer-fork"+version = "0.24.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32eb7c354ae9f6d437a6039099ce7ecd049337a8109b23d73e48e8ffba8e9cd5"+dependencies = [+ "bitflags 2.13.2",+ "core-foundation 0.9.4",+ "core-graphics-types 0.1.3",+ "foreign-types",+ "libc",+]++[[package]]+name = "core-graphics-types"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"+dependencies = [+ "bitflags 1.3.2",+ "core-foundation 0.9.4",+ "libc",+]++[[package]]+name = "core-graphics-types"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"+dependencies = [+ "bitflags 2.13.2",+ "core-foundation 0.10.0",+ "libc",+]++[[package]]+name = "core-graphics2"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7e4583956b9806b69f73fcb23aee05eb3620efc282972f08f6a6db7504f8334d"+dependencies = [+ "bitflags 2.13.2",+ "block",+ "cfg-if",+ "core-foundation 0.10.0",+ "libc",+]++[[package]]+name = "core-text"+version = "21.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a593227b66cbd4007b2a050dfdd9e1d1318311409c8d600dc82ba1b15ca9c130"+dependencies = [+ "core-foundation 0.10.0",+ "core-graphics 0.24.0",+ "foreign-types",+ "libc",+]++[[package]]+name = "core-video"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d45e71d5be22206bed53c3c3cb99315fc4c3d31b8963808c6bc4538168c4f8ef"+dependencies = [+ "block",+ "core-foundation 0.10.0",+ "core-graphics2",+ "io-surface",+ "libc",+ "metal",+]++[[package]]+name = "core_detect"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48"++[[package]]+name = "core_maths"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30"+dependencies = [+ "libm",+]++[[package]]+name = "cosmic-text"+version = "0.14.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "da46a9d5a8905cc538a4a5bceb6a4510de7a51049c5588c0114efce102bcbbe8"+dependencies = [+ "bitflags 2.13.2",+ "fontdb 0.16.2",+ "log",+ "rangemap",+ "rustc-hash 1.1.0",+ "rustybuzz 0.14.1",+ "self_cell",+ "smol_str 0.2.2",+ "swash",+ "sys-locale",+ "ttf-parser 0.21.1",+ "unicode-bidi",+ "unicode-linebreak",+ "unicode-script",+ "unicode-segmentation",+]++[[package]]+name = "cosmic-text"+version = "0.19.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "be17b688510d934ce13f48a2beba700e11583e281e0fda99c22bb256a14eda73"+dependencies = [+ "bitflags 2.13.2",+ "fontdb 0.23.0",+ "harfrust",+ "linebender_resource_handle",+ "log",+ "rangemap",+ "rustc-hash 2.1.3",+ "self_cell",+ "skrifa 0.40.0",+ "smol_str 0.3.7",+ "swash",+ "sys-locale",+ "unicode-bidi",+ "unicode-linebreak",+ "unicode-script",+ "unicode-segmentation",+]++[[package]]+name = "cpufeatures"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"+dependencies = [+ "libc",+]++[[package]]+name = "cpufeatures"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566"+dependencies = [+ "libc",+]++[[package]]+name = "crc32fast"+version = "1.5.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5f97d3416d5337d15c4b0d78c8c91df922ca143f57ec20e2d1c188333047ef04"+dependencies = [+ "cfg-if",+]++[[package]]+name = "crossbeam-deque"+version = "0.8.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"+dependencies = [+ "crossbeam-epoch",+ "crossbeam-utils",+]++[[package]]+name = "crossbeam-epoch"+version = "0.9.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"+dependencies = [+ "crossbeam-utils",+]++[[package]]+name = "crossbeam-queue"+version = "0.3.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae"+dependencies = [+ "crossbeam-utils",+]++[[package]]+name = "crossbeam-utils"+version = "0.8.23"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"++[[package]]+name = "crunchy"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"++[[package]]+name = "crypto-common"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"+dependencies = [+ "generic-array",+ "rand_core 0.6.4",+ "typenum",+]++[[package]]+name = "crypto-common"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"+dependencies = [+ "hybrid-array",+]++[[package]]+name = "ctor"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ec09e802f5081de6157da9a75701d6c713d8dc3ba52571fd4bd25f412644e8a6"+dependencies = [+ "ctor-proc-macro",+ "dtor",+]++[[package]]+name = "ctor"+version = "1.0.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d"+dependencies = [+ "link-section",+ "linktime-proc-macro",+]++[[package]]+name = "ctor-proc-macro"+version = "0.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e2931af7e13dc045d8e9d26afccc6fa115d64e115c9c84b1166288b46f6782c2"++[[package]]+name = "data-url"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376"++[[package]]+name = "deflate64"+version = "0.1.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac6b926516df9c60bfa16e107b21086399f8285a44ca9711344b9e553c5146e2"++[[package]]+name = "deranged"+version = "0.5.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e"++[[package]]+name = "derive_more"+version = "0.99.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6edb4b64a43d977b8e99788fe3a04d483834fba1215a7e02caa415b626497f7f"+dependencies = [+ "convert_case 0.4.0",+ "proc-macro2",+ "quote",+ "rustc_version",+ "syn 2.0.119",+]++[[package]]+name = "derive_more"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134"+dependencies = [+ "derive_more-impl",+]++[[package]]+name = "derive_more-impl"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb"+dependencies = [+ "convert_case 0.10.0",+ "proc-macro2",+ "quote",+ "rustc_version",+ "syn 2.0.119",+]++[[package]]+name = "digest"+version = "0.10.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"+dependencies = [+ "block-buffer 0.10.4",+ "crypto-common 0.1.7",+ "subtle",+]++[[package]]+name = "digest"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"+dependencies = [+ "block-buffer 0.12.1",+ "const-oid",+ "crypto-common 0.2.2",+]++[[package]]+name = "dirs"+version = "4.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"+dependencies = [+ "dirs-sys 0.3.7",+]++[[package]]+name = "dirs"+version = "5.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225"+dependencies = [+ "dirs-sys 0.4.1",+]++[[package]]+name = "dirs-sys"+version = "0.3.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"+dependencies = [+ "libc",+ "redox_users",+ "winapi",+]++[[package]]+name = "dirs-sys"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c"+dependencies = [+ "libc",+ "option-ext",+ "redox_users",+ "windows-sys 0.48.0",+]++[[package]]+name = "dispatch"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"++[[package]]+name = "dispatch2"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.6.2",+ "objc2 0.6.5",+]++[[package]]+name = "displaydoc"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "dlib"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"+dependencies = [+ "libloading",+]++[[package]]+name = "document-features"+version = "0.2.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"+dependencies = [+ "litrs",+]++[[package]]+name = "downcast-rs"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"++[[package]]+name = "dtor"+version = "0.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "97cbdf2ad6846025e8e25df05171abfb30e3ababa12ee0a0e44b9bbe570633a8"+dependencies = [+ "dtor-proc-macro",+]++[[package]]+name = "dtor-proc-macro"+version = "0.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7454e41ff9012c00d53cf7f475c5e3afa3b91b7c90568495495e8d9bf47a1055"++[[package]]+name = "dunce"+version = "1.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813"++[[package]]+name = "dwrote"+version = "0.11.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9e1b35532432acc8b19ceed096e35dfa088d3ea037fe4f3c085f1f97f33b4d02"+dependencies = [+ "lazy_static",+ "libc",+ "winapi",+ "wio",+]++[[package]]+name = "dyn-clone"+version = "1.0.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"++[[package]]+name = "either"+version = "1.19.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"++[[package]]+name = "embed-resource"+version = "3.0.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6168487b5e7eb2673e6efe1200b1848016e436a6ca0b8031bf04bd9d493a249f"+dependencies = [+ "cc",+ "memchr",+ "rustc_version",+ "toml 1.1.8+spec-1.1.0",+ "vswhom",+ "winreg",+]++[[package]]+name = "encoding_rs"+version = "0.8.44"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "89253175e704ab869b04f9db224d38630e0211a53841a79181deae0889e169f5"+dependencies = [+ "cfg-if",+ "core_detect",+ "multiversion_no_op",+ "rustversion",+ "scopeguard",+ "simdutf8",+]++[[package]]+name = "endi"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"++[[package]]+name = "enumflags2"+version = "0.7.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef"+dependencies = [+ "enumflags2_derive",+ "serde",+]++[[package]]+name = "enumflags2_derive"+version = "0.7.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "enumn"+version = "0.1.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "equator"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc"+dependencies = [+ "equator-macro",+]++[[package]]+name = "equator-macro"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "equivalent"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"++[[package]]+name = "erased-serde"+version = "0.4.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e59b668157f32d3459d4bd634861a06ffa2503a461ca5f0916b9f0252605e66"+dependencies = [+ "serde",+ "serde_core",+ "typeid",+]++[[package]]+name = "errno"+version = "0.3.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"+dependencies = [+ "libc",+ "windows-sys 0.61.2",+]++[[package]]+name = "etagere"+version = "0.2.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc89bf99e5dc15954a60f707c1e09d7540e5cd9af85fa75caa0b510bc08c5342"+dependencies = [+ "euclid",+ "svg_fmt",+]++[[package]]+name = "euclid"+version = "0.22.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06"+dependencies = [+ "num-traits",+]++[[package]]+name = "event-listener"+version = "2.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"++[[package]]+name = "event-listener"+version = "5.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2"+dependencies = [+ "parking",+ "pin-project-lite",+]++[[package]]+name = "event-listener-strategy"+version = "0.5.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"+dependencies = [+ "event-listener 5.4.2",+ "pin-project-lite",+]++[[package]]+name = "exr"+version = "1.74.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "711fe42c9964295e01ee3fba3f9fe0e1d24b98886950d68efe81b1c76e21adf3"+dependencies = [+ "bit_field",+ "half",+ "lebe",+ "miniz_oxide 0.8.9",+ "num-complex",+ "pulp",+ "rayon-core",+ "smallvec",+ "zune-inflate",+]++[[package]]+name = "fastrand"+version = "1.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"+dependencies = [+ "instant",+]++[[package]]+name = "fastrand"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"++[[package]]+name = "fax"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a"++[[package]]+name = "fdeflate"+version = "0.3.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"+dependencies = [+ "simd-adler32",+]++[[package]]+name = "filedescriptor"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e40758ed24c9b2eeb76c35fb0aebc66c626084edd827e07e1552279814c6682d"+dependencies = [+ "libc",+ "thiserror 1.0.69",+ "winapi",+]++[[package]]+name = "filetime"+version = "0.2.29"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"+dependencies = [+ "cfg-if",+ "libc",+]++[[package]]+name = "find-msvc-tools"+version = "0.1.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"++[[package]]+name = "flate2"+version = "1.1.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb"+dependencies = [+ "crc32fast",+ "miniz_oxide 0.9.1",+ "zlib-rs",+]++[[package]]+name = "float-cmp"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"++[[package]]+name = "float-ord"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ce81f49ae8a0482e4c55ea62ebbd7e5a686af544c00b9d090bba3ff9be97b3d"++[[package]]+name = "float_next_after"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8"++[[package]]+name = "flume"+version = "0.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095"+dependencies = [+ "futures-core",+ "futures-sink",+ "nanorand",+ "spin 0.9.9",+]++[[package]]+name = "flume"+version = "0.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be"+dependencies = [+ "futures-core",+ "futures-sink",+ "spin 0.9.9",+]++[[package]]+name = "fnv"+version = "1.0.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"++[[package]]+name = "foldhash"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"++[[package]]+name = "foldhash"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"++[[package]]+name = "font-types"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5b38ad915f6dadd993ced50848a8291a543bd41ca62bc10740d5e64e2ab4cfd7"+dependencies = [+ "bytemuck",+]++[[package]]+name = "font-types"+version = "0.12.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d"+dependencies = [+ "bytemuck",+]++[[package]]+name = "fontconfig-parser"+version = "0.5.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bbc773e24e02d4ddd8395fd30dc147524273a83e54e0f312d986ea30de5f5646"+dependencies = [+ "roxmltree 0.20.0",+]++[[package]]+name = "fontdb"+version = "0.16.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b0299020c3ef3f60f526a4f64ab4a3d4ce116b1acbf24cdd22da0068e5d81dc3"+dependencies = [+ "fontconfig-parser",+ "log",+ "memmap2",+ "slotmap",+ "tinyvec",+ "ttf-parser 0.20.0",+]++[[package]]+name = "fontdb"+version = "0.23.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905"+dependencies = [+ "fontconfig-parser",+ "log",+ "memmap2",+ "slotmap",+ "tinyvec",+ "ttf-parser 0.25.1",+]++[[package]]+name = "foreign-types"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"+dependencies = [+ "foreign-types-macros",+ "foreign-types-shared",+]++[[package]]+name = "foreign-types-macros"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "foreign-types-shared"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"++[[package]]+name = "form_urlencoded"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"+dependencies = [+ "percent-encoding",+]++[[package]]+name = "freetype-sys"+version = "0.20.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0e7edc5b9669349acfda99533e9e0bcf26a51862ab43b08ee7745c55d28eb134"+dependencies = [+ "cc",+ "libc",+ "pkg-config",+]++[[package]]+name = "futf"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843"+dependencies = [+ "mac",+ "new_debug_unreachable",+]++[[package]]+name = "futures"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3"+dependencies = [+ "futures-channel",+ "futures-core",+ "futures-executor",+ "futures-io",+ "futures-sink",+ "futures-task",+ "futures-util",+]++[[package]]+name = "futures-channel"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4"+dependencies = [+ "futures-core",+ "futures-sink",+]++[[package]]+name = "futures-core"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"++[[package]]+name = "futures-executor"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432"+dependencies = [+ "futures-core",+ "futures-task",+ "futures-util",+]++[[package]]+name = "futures-io"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed"++[[package]]+name = "futures-lite"+version = "1.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"+dependencies = [+ "fastrand 1.9.0",+ "futures-core",+ "futures-io",+ "memchr",+ "parking",+ "pin-project-lite",+ "waker-fn",+]++[[package]]+name = "futures-lite"+version = "2.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"+dependencies = [+ "fastrand 2.5.0",+ "futures-core",+ "futures-io",+ "parking",+ "pin-project-lite",+]++[[package]]+name = "futures-macro"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "futures-sink"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d"++[[package]]+name = "futures-task"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"++[[package]]+name = "futures-util"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"+dependencies = [+ "futures-channel",+ "futures-core",+ "futures-io",+ "futures-macro",+ "futures-sink",+ "futures-task",+ "memchr",+ "pin-project-lite",+ "slab",+]++[[package]]+name = "generic-array"+version = "0.14.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"+dependencies = [+ "typenum",+ "version_check",+]++[[package]]+name = "gethostname"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8"+dependencies = [+ "rustix 1.1.6",+ "windows-link 0.2.1",+]++[[package]]+name = "getrandom"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"+dependencies = [+ "cfg-if",+ "js-sys",+ "libc",+ "wasi",+ "wasm-bindgen",+]++[[package]]+name = "getrandom"+version = "0.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"+dependencies = [+ "cfg-if",+ "js-sys",+ "libc",+ "r-efi 5.3.0",+ "wasip2",+ "wasm-bindgen",+]++[[package]]+name = "getrandom"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"+dependencies = [+ "cfg-if",+ "js-sys",+ "libc",+ "r-efi 6.0.0",+ "rand_core 0.10.1",+ "wasm-bindgen",+]++[[package]]+name = "gif"+version = "0.14.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159"+dependencies = [+ "color_quant",+ "weezl",+]++[[package]]+name = "gimli"+version = "0.34.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1033caf0b349c518623b5396bfb2cf0bddf44f0306d543a250e5743297aafd10"++[[package]]+name = "gl_generator"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d"+dependencies = [+ "khronos_api",+ "log",+ "xml-rs",+]++[[package]]+name = "glob"+version = "0.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"++[[package]]+name = "globset"+version = "0.4.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f98b0d85522dc0a824cfebbc9594ff4a9b289c568bea0370319dfbdf20ccdd2d"+dependencies = [+ "aho-corasick",+ "bstr",+ "log",+ "regex-automata",+ "regex-syntax",+]++[[package]]+name = "gloo-timers"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994"+dependencies = [+ "futures-channel",+ "futures-core",+ "js-sys",+ "wasm-bindgen",+]++[[package]]+name = "glow"+version = "0.16.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c5e5ea60d70410161c8bf5da3fdfeaa1c72ed2c15f8bbb9d19fe3a4fad085f08"+dependencies = [+ "js-sys",+ "slotmap",+ "wasm-bindgen",+ "web-sys",+]++[[package]]+name = "glow"+version = "0.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5"+dependencies = [+ "js-sys",+ "slotmap",+ "wasm-bindgen",+ "web-sys",+]++[[package]]+name = "glutin_wgl_sys"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e"+dependencies = [+ "gl_generator",+]++[[package]]+name = "gpu-alloc"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "45cf04b2726f02df5508c6de726acdc90cdf97ac771a9a0ffd8ba10a6e696bf9"+dependencies = [+ "bitflags 2.13.2",+ "gpu-alloc-types",+]++[[package]]+name = "gpu-alloc-ash"+version = "0.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "643756f08ef6def813c776199e4766596395a4c6530373c9a4374a64de2f53a1"+dependencies = [+ "ash",+ "gpu-alloc-types",+ "tinyvec",+]++[[package]]+name = "gpu-alloc-types"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b2bbed164dd10ed526c2e4fe3e721ca4a71c61730e5aafac6844b417b3227058"+dependencies = [+ "bitflags 2.13.2",+]++[[package]]+name = "gpu-allocator"+version = "0.28.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795"+dependencies = [+ "ash",+ "hashbrown 0.16.1",+ "log",+ "presser",+ "thiserror 2.0.21",+ "windows 0.62.2",+]++[[package]]+name = "gpui"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "979b45cfa6ec723b6f42330915a1b3769b930d02b2d505f9697f8ca602bee707"+dependencies = [+ "anyhow",+ "as-raw-xcb-connection",+ "ashpd 0.11.1",+ "async-task",+ "bindgen",+ "blade-graphics",+ "blade-macros",+ "blade-util",+ "block",+ "bytemuck",+ "calloop 0.13.0",+ "calloop-wayland-source",+ "cbindgen",+ "cocoa 0.26.0",+ "cocoa-foundation 0.2.0",+ "core-foundation 0.10.0",+ "core-foundation-sys",+ "core-graphics 0.24.0",+ "core-text",+ "core-video",+ "cosmic-text 0.14.2",+ "ctor 0.4.3",+ "derive_more 0.99.20",+ "embed-resource",+ "etagere",+ "filedescriptor",+ "flume 0.11.1",+ "foreign-types",+ "futures",+ "gpui-macros",+ "gpui_collections",+ "gpui_http_client",+ "gpui_media",+ "gpui_refineable",+ "gpui_semantic_version",+ "gpui_sum_tree",+ "gpui_util",+ "gpui_util_macros",+ "image",+ "inventory",+ "itertools 0.14.0",+ "libc",+ "log",+ "lyon",+ "metal",+ "naga 25.0.1",+ "num_cpus",+ "objc",+ "oo7 0.5.0",+ "open",+ "parking",+ "parking_lot",+ "pathfinder_geometry",+ "pin-project",+ "postage",+ "profiling",+ "rand 0.9.5",+ "raw-window-handle",+ "resvg 0.45.1",+ "schemars",+ "seahash",+ "serde",+ "serde_json",+ "slotmap",+ "smallvec",+ "smol",+ "stacksafe",+ "strum 0.27.2",+ "taffy 0.9.0",+ "thiserror 2.0.21",+ "usvg 0.45.1",+ "uuid",+ "waker-fn",+ "wayland-backend",+ "wayland-client",+ "wayland-cursor",+ "wayland-protocols 0.31.2",+ "wayland-protocols-plasma",+ "windows 0.61.3",+ "windows-core 0.61.2",+ "windows-numerics 0.2.0",+ "windows-registry 0.5.3",+ "x11-clipboard",+ "x11rb",+ "xkbcommon",+ "zed-font-kit",+ "zed-scap",+ "zed-xim",+]++[[package]]+name = "gpui-bench"+version = "0.1.0"+dependencies = [+ "gpui",+]++[[package]]+name = "gpui-fast"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ee67914f779fdcfce4c7f59f6ba8fa68f680bd137648b25a801cd5d9cb1b8ab"+dependencies = [+ "accesskit",+ "anyhow",+ "async-channel 2.5.0",+ "async-task",+ "backtrace",+ "bitflags 2.13.2",+ "chrono",+ "derive_more 2.1.1",+ "embed-resource",+ "etagere",+ "futures",+ "getrandom 0.3.4",+ "gpui-fast-macros",+ "gpui-pre-collections",+ "gpui-pre-http-client",+ "gpui-pre-refineable",+ "gpui-pre-scheduler",+ "gpui-pre-shared-string",+ "gpui-pre-sum-tree",+ "gpui-pre-util",+ "heapless",+ "icu_segmenter",+ "image",+ "inventory",+ "itertools 0.14.0",+ "libc",+ "log",+ "lyon",+ "num_cpus",+ "objc2-core-foundation",+ "objc2-core-video",+ "parking",+ "parking_lot",+ "pin-project",+ "pollster 0.4.0",+ "profiling",+ "rand 0.9.5",+ "raw-window-handle",+ "regex",+ "resvg 0.46.0",+ "schemars",+ "seahash",+ "serde",+ "serde_json",+ "slotmap",+ "smallvec",+ "spin 0.10.1",+ "strum 0.28.0",+ "taffy 0.15.0",+ "thiserror 2.0.21",+ "ttf-parser 0.25.1",+ "unicode-segmentation",+ "url",+ "usvg 0.46.0",+ "uuid",+ "waker-fn",+ "windows 0.62.2",+ "zed-scap",+]++[[package]]+name = "gpui-fast-apple"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6cdf402e4a795abb27cd9545a6b519f123f4f2b8050fc7f6e7e25e376f34867d"+dependencies = [+ "anyhow",+ "async-task",+ "block2 0.6.2",+ "cbindgen",+ "core-foundation 0.10.0",+ "core-foundation-sys",+ "core-graphics 0.24.0",+ "dispatch2",+ "etagere",+ "futures",+ "gpui-fast",+ "gpui-pre-collections",+ "gpui-pre-util",+ "image",+ "libc",+ "log",+ "mach2",+ "objc2 0.6.5",+ "objc2-core-foundation",+ "objc2-core-graphics",+ "objc2-core-video",+ "objc2-foundation 0.3.2",+ "objc2-metal 0.3.2",+ "objc2-quartz-core 0.3.2",+ "objc2-security",+ "parking_lot",+ "smallvec",+ "thiserror 2.0.21",+]++[[package]]+name = "gpui-fast-bench"+version = "0.1.0"+dependencies = [+ "gpui-fast",+ "gpui-fast-platform",+]++[[package]]+name = "gpui-fast-linux"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "59c465cccb420a54d2abc14af42ce82ecb1ea473b531ddbd299eb4e15ae2dd83"+dependencies = [+ "accesskit",+ "anyhow",+ "bytemuck",+ "calloop 0.14.5",+ "futures",+ "gpui-fast",+ "gpui-pre-collections",+ "gpui-pre-http-client",+ "gpui-pre-util",+ "libc",+ "log",+ "notify-rust",+ "oo7 0.6.0",+ "parking_lot",+ "raw-window-handle",+ "smallvec",+ "smol",+ "strum 0.28.0",+ "url",+ "uuid",+]++[[package]]+name = "gpui-fast-macos"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d809f618f836aff7fc654c00c3f6e64d41abd83713140998dd83e8ad6906b1e9"+dependencies = [+ "accesskit",+ "accesskit_macos",+ "anyhow",+ "block2 0.6.2",+ "core-foundation 0.10.0",+ "core-foundation-sys",+ "core-graphics 0.24.0",+ "ctor 1.0.13",+ "dispatch2",+ "foreign-types",+ "futures",+ "gpui-fast",+ "gpui-fast-apple",+ "gpui-pre-collections",+ "gpui-pre-scheduler",+ "gpui-pre-util",+ "image",+ "itertools 0.14.0",+ "log",+ "objc2 0.6.5",+ "objc2-app-kit 0.3.2",+ "objc2-core-graphics",+ "objc2-core-video",+ "objc2-foundation 0.3.2",+ "objc2-quartz-core 0.3.2",+ "objc2-uniform-type-identifiers",+ "objc2-user-notifications",+ "parking_lot",+ "raw-window-handle",+ "semver",+ "smallvec",+ "strum 0.28.0",+ "uuid",+]++[[package]]+name = "gpui-fast-macros"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "46724abd05d2c874cc31e1996bb862539c5735780dd363cb550469003a6e5140"+dependencies = [+ "heck 0.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "gpui-fast-platform"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eb75fcc655a819d87a75180f32528d26b869b421a53c5974046c6e2948c46ecf"+dependencies = [+ "anyhow",+ "console_error_panic_hook",+ "gpui-fast",+ "gpui-fast-linux",+ "gpui-fast-macos",+ "gpui-fast-web",+ "gpui-fast-windows",+ "gpui-pre-ios",+]++[[package]]+name = "gpui-fast-web"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f5194d398f801160d6be5660055a14b175aed9b2dbca348d56065d742b11dbd9"+dependencies = [+ "anyhow",+ "async-channel 2.5.0",+ "console_error_panic_hook",+ "futures",+ "gpui-fast",+ "gpui-fast-wgpu",+ "gpui-pre-http-client",+ "gpui-pre-scheduler",+ "js-sys",+ "log",+ "parking_lot",+ "raw-window-handle",+ "smallvec",+ "unicode-properties",+ "unicode-script",+ "unicode-segmentation",+ "uuid",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "wasm_thread",+ "web-sys",+ "web-time",+]++[[package]]+name = "gpui-fast-wgpu"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7a3be892e9d079745739d0e52e397fd43b61d215de4fd1477bb554a9bcf0c7e1"+dependencies = [+ "anyhow",+ "bytemuck",+ "cosmic-text 0.19.0",+ "etagere",+ "gpui-fast",+ "gpui-pre-collections",+ "gpui-pre-util",+ "itertools 0.14.0",+ "log",+ "parking_lot",+ "profiling",+ "raw-window-handle",+ "smallvec",+ "swash",+ "unicode-bidi",+ "unicode-segmentation",+ "web-sys",+ "wgpu",+]++[[package]]+name = "gpui-fast-windows"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "088654835f1408e1aaa79afcc316530461a14fa1c4e543d47b1881b6ced63f19"+dependencies = [+ "accesskit",+ "accesskit_windows",+ "anyhow",+ "dunce",+ "etagere",+ "futures",+ "gpui-fast",+ "gpui-pre-collections",+ "gpui-pre-scheduler",+ "gpui-pre-util",+ "image",+ "itertools 0.14.0",+ "log",+ "parking_lot",+ "rand 0.9.5",+ "raw-window-handle",+ "smallvec",+ "uuid",+ "windows 0.62.2",+ "windows-core 0.62.2",+ "windows-numerics 0.3.1",+ "windows-registry 0.6.1",+]++[[package]]+name = "gpui-macros"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bcb02dd63a2859714ac7b6b476937617c3c744157af1b49f7c904023a79039be"+dependencies = [+ "heck 0.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "gpui-pre"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9303c771abf2acff2a96d706f69d9a82088c4770173a07cce88f0002431d887d"+dependencies = [+ "accesskit",+ "anyhow",+ "async-channel 2.5.0",+ "async-task",+ "backtrace",+ "bitflags 2.13.2",+ "chrono",+ "derive_more 2.1.1",+ "etagere",+ "futures",+ "getrandom 0.3.4",+ "gpui-pre-collections",+ "gpui-pre-http-client",+ "gpui-pre-macros",+ "gpui-pre-refineable",+ "gpui-pre-scheduler",+ "gpui-pre-shared-string",+ "gpui-pre-sum-tree",+ "gpui-pre-util",+ "heapless",+ "icu_segmenter",+ "image",+ "inventory",+ "itertools 0.14.0",+ "libc",+ "log",+ "lyon",+ "num_cpus",+ "objc2-core-foundation",+ "objc2-core-video",+ "parking",+ "parking_lot",+ "pin-project",+ "pollster 0.4.0",+ "profiling",+ "rand 0.9.5",+ "raw-window-handle",+ "regex",+ "resvg 0.46.0",+ "schemars",+ "seahash",+ "serde",+ "serde_json",+ "slotmap",+ "smallvec",+ "spin 0.10.1",+ "strum 0.28.0",+ "taffy 0.15.0",+ "thiserror 2.0.21",+ "ttf-parser 0.25.1",+ "unicode-segmentation",+ "url",+ "usvg 0.46.0",+ "uuid",+ "waker-fn",+ "windows 0.62.2",+]++[[package]]+name = "gpui-pre-apple"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8c0bea8ffa563d3a1ada533e148bb55be7fb873c178979e889a3d1204f8e1b91"+dependencies = [+ "anyhow",+ "async-task",+ "block2 0.6.2",+ "cbindgen",+ "core-foundation 0.10.0",+ "core-foundation-sys",+ "core-graphics 0.24.0",+ "core-text",+ "dispatch2",+ "etagere",+ "futures",+ "gpui-pre",+ "gpui-pre-collections",+ "gpui-pre-util",+ "image",+ "libc",+ "log",+ "mach2",+ "objc2 0.6.5",+ "objc2-core-foundation",+ "objc2-core-graphics",+ "objc2-core-text",+ "objc2-core-video",+ "objc2-foundation 0.3.2",+ "objc2-metal 0.3.2",+ "objc2-quartz-core 0.3.2",+ "objc2-security",+ "parking_lot",+ "pathfinder_geometry",+ "smallvec",+ "thiserror 2.0.21",+ "zed-font-kit",+]++[[package]]+name = "gpui-pre-collections"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "06882d54d40681ae3b145af9ef8a4021c2bf9967cc0a9fcf0cc50f003bf3cdf3"+dependencies = [+ "gpui-pre-util",+ "indexmap",+ "rustc-hash 2.1.3",+]++[[package]]+name = "gpui-pre-derive-refineable"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3999591b50cfd74f1734baf97fe802cce5f282d60d85b908e3393d534fbd50fb"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "gpui-pre-http-client"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a00ff0e68341f52c5903182d7e2e2d7dc247d87b0d9947ce3564e453720347a0"+dependencies = [+ "anyhow",+ "bytes",+ "futures",+ "http",+ "http-body",+ "parking_lot",+ "serde",+ "serde_json",+ "serde_urlencoded",+ "url",+]++[[package]]+name = "gpui-pre-ios"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "326382c3b3f004617ac0f61338594c00f053b08b7875f3486ea0f221e9b20a75"+dependencies = [+ "anyhow",+ "block2 0.6.2",+ "futures",+ "gpui-pre",+ "gpui-pre-apple",+ "log",+ "objc2 0.6.5",+ "objc2-core-foundation",+ "objc2-foundation 0.3.2",+ "objc2-quartz-core 0.3.2",+ "objc2-ui-kit",+ "parking_lot",+ "raw-window-handle",+ "uuid",+]++[[package]]+name = "gpui-pre-macros"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee1c52959baa6834db3183e86affe70242ca90b4fc64ed2ae6dd689a799ce78e"+dependencies = [+ "heck 0.5.0",+ "proc-macro-crate",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "gpui-pre-refineable"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "097375d98fecafd6e00ec13c7711709cc6d827ccad385694ce9e2c2f570c02a5"+dependencies = [+ "gpui-pre-derive-refineable",+]++[[package]]+name = "gpui-pre-scheduler"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "93c3c9f76341cdf03801699d68876915b42d5858e80c52a141ebfc350358147b"+dependencies = [+ "async-task",+ "backtrace",+ "chrono",+ "flume 0.12.0",+ "futures",+ "parking_lot",+ "rand 0.9.5",+ "wasm_thread",+ "web-time",+]++[[package]]+name = "gpui-pre-shared-string"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "781aaf9a9c19e3367b94100c7b1a17283721766bc890909ce8aa34e8c5b1a99a"+dependencies = [+ "schemars",+ "serde",+ "smol_str 0.3.7",+]++[[package]]+name = "gpui-pre-sum-tree"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e0cb18765472fb2c64b7e6374f9a36f512ce25b1ccb3662fff51788564107eb3"+dependencies = [+ "gpui-pre-ztracing",+ "heapless",+ "rayon",+ "tracing",+]++[[package]]+name = "gpui-pre-util"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "49036ad9887034f8d6652b65761ee1c1fdbd7d66be33a6088245fae54dc643e3"+dependencies = [+ "anyhow",+ "log",+ "which 8.0.6",+]++[[package]]+name = "gpui-pre-ztracing"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ac9274f4fb36ce6bf128f9b48032196a3120cb858503af33ced6c21366cf2f7"+dependencies = [+ "gpui-pre-ztracing-macro",+ "tracing",+]++[[package]]+name = "gpui-pre-ztracing-macro"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "99b18b06f5026b3d312488eacfdddbe78f82b4bf32bb2d2bc3186e31e552b797"++[[package]]+name = "gpui_collections"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ae39dc6d3d201be97e4bc08d96dbef2bc5b5c3d5734e05786e8cc3043342351c"+dependencies = [+ "indexmap",+ "rustc-hash 2.1.3",+]++[[package]]+name = "gpui_derive_refineable"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "644de174341a87b3478bd65b66bca38af868bcf2b2e865700523734f83cfc664"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "gpui_http_client"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23822b0a6d2c5e6a42507980a0ab3848610ea908942c8ef98187f646f690335e"+dependencies = [+ "anyhow",+ "async-compression",+ "async-fs",+ "bytes",+ "derive_more 0.99.20",+ "futures",+ "gpui_util",+ "http",+ "http-body",+ "log",+ "parking_lot",+ "serde",+ "serde_json",+ "sha2 0.10.9",+ "tempfile",+ "url",+ "zed-async-tar",+ "zed-reqwest",+]++[[package]]+name = "gpui_media"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "05cb8912ae17371725132d2b7eec6797a255accc95d58ee5c1134b529810f14b"+dependencies = [+ "anyhow",+ "bindgen",+ "core-foundation 0.10.0",+ "core-video",+ "ctor 0.4.3",+ "foreign-types",+ "metal",+ "objc",+]++[[package]]+name = "gpui_perf"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f40a0961dcf598955130e867f4b731150a20546427b41b1a63767c1037a86d77"+dependencies = [+ "gpui_collections",+ "serde",+ "serde_json",+]++[[package]]+name = "gpui_refineable"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "258cb099254e9468181aee5614410fba61db4ae115fc1d51b4a0b985f60d6641"+dependencies = [+ "gpui_derive_refineable",+]++[[package]]+name = "gpui_semantic_version"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "201e45eff7b695528fb3af6560a534943fbc2db5323d755b9d198bd743948e35"+dependencies = [+ "anyhow",+ "serde",+]++[[package]]+name = "gpui_sum_tree"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e4f3bedd573fafafa13d1200b356c588cf094fb2786e3684bb3f5ea59b549fa9"+dependencies = [+ "arrayvec",+ "log",+ "rayon",+]++[[package]]+name = "gpui_util"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68faea25903ae524de9af83990b9aa51bcbc8dd085929ac0aea7fd41905e05c3"+dependencies = [+ "anyhow",+ "async-fs",+ "async_zip",+ "command-fds",+ "dirs 4.0.0",+ "dunce",+ "futures",+ "futures-lite 1.13.0",+ "globset",+ "gpui_collections",+ "itertools 0.14.0",+ "libc",+ "log",+ "nix 0.29.0",+ "regex",+ "rust-embed",+ "schemars",+ "serde",+ "serde_json",+ "serde_json_lenient",+ "shlex 1.3.0",+ "smol",+ "take-until",+ "tempfile",+ "tendril",+ "unicase",+ "walkdir",+ "which 6.0.3",+]++[[package]]+name = "gpui_util_macros"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2c28f65ef47fb97e21e82fd4dd75ccc2506eda010c846dc8054015ea234f1a22"+dependencies = [+ "gpui_perf",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "grid"+version = "0.15.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "36119f3a540b086b4e436bb2b588cf98a68863470e0e880f4d0842f112a3183a"++[[package]]+name = "grid"+version = "0.18.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "12101ecc8225ea6d675bc70263074eab6169079621c2186fe0c66590b2df9681"++[[package]]+name = "h2"+version = "0.4.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118"+dependencies = [+ "atomic-waker",+ "bytes",+ "fnv",+ "futures-core",+ "futures-sink",+ "http",+ "indexmap",+ "slab",+ "tokio",+ "tokio-util",+ "tracing",+]++[[package]]+name = "half"+version = "2.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"+dependencies = [+ "cfg-if",+ "crunchy",+ "num-traits",+ "zerocopy",+]++[[package]]+name = "harfrust"+version = "0.5.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9da2e5ae821f6e96664977bf974d6d6a2d6682f9ccee23e62ec1d134246845f9"+dependencies = [+ "bitflags 2.13.2",+ "bytemuck",+ "core_maths",+ "read-fonts 0.37.0",+ "smallvec",+]++[[package]]+name = "hash32"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"+dependencies = [+ "byteorder",+]++[[package]]+name = "hashbrown"+version = "0.14.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"++[[package]]+name = "hashbrown"+version = "0.15.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"+dependencies = [+ "foldhash 0.1.5",+]++[[package]]+name = "hashbrown"+version = "0.16.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"+dependencies = [+ "allocator-api2",+ "equivalent",+ "foldhash 0.2.0",+]++[[package]]+name = "hashbrown"+version = "0.17.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"+dependencies = [+ "foldhash 0.2.0",+]++[[package]]+name = "heapless"+version = "0.9.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "25ba4bd83f9415b58b4ed8dc5714c76e626a105be4646c02630ad730ad3b5aa4"+dependencies = [+ "hash32",+ "stable_deref_trait",+]++[[package]]+name = "heck"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"++[[package]]+name = "heck"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"++[[package]]+name = "hermit-abi"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284"++[[package]]+name = "hex"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"++[[package]]+name = "hexf-parse"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"++[[package]]+name = "hidden-trait"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68ed9e850438ac849bec07e7d09fbe9309cbd396a5988c30b010580ce08860df"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 1.0.109",+]++[[package]]+name = "hkdf"+version = "0.12.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"+dependencies = [+ "hmac",+]++[[package]]+name = "hmac"+version = "0.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"+dependencies = [+ "digest 0.10.7",+]++[[package]]+name = "home"+version = "0.5.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "http"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"+dependencies = [+ "bytes",+ "itoa",+]++[[package]]+name = "http-body"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"+dependencies = [+ "bytes",+ "http",+]++[[package]]+name = "http-body-util"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c"+dependencies = [+ "bytes",+ "futures-core",+ "http",+ "http-body",+ "pin-project-lite",+]++[[package]]+name = "httparse"+version = "1.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"++[[package]]+name = "hybrid-array"+version = "0.4.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17"+dependencies = [+ "typenum",+]++[[package]]+name = "hyper"+version = "1.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c"+dependencies = [+ "atomic-waker",+ "bytes",+ "futures-channel",+ "futures-core",+ "h2",+ "http",+ "http-body",+ "httparse",+ "itoa",+ "pin-project-lite",+ "smallvec",+ "tokio",+ "want",+]++[[package]]+name = "hyper-rustls"+version = "0.27.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53"+dependencies = [+ "http",+ "hyper",+ "hyper-util",+ "rustls",+ "rustls-native-certs",+ "tokio",+ "tokio-rustls",+ "tower-service",+]++[[package]]+name = "hyper-util"+version = "0.1.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff"+dependencies = [+ "bytes",+ "futures-channel",+ "futures-util",+ "http",+ "http-body",+ "httparse",+ "hyper",+ "libc",+ "pin-project-lite",+ "socket2",+ "tokio",+ "tower-service",+ "tracing",+]++[[package]]+name = "iana-time-zone"+version = "0.1.65"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"+dependencies = [+ "android_system_properties",+ "core-foundation-sys",+ "iana-time-zone-haiku",+ "js-sys",+ "log",+ "wasm-bindgen",+ "windows-core 0.62.2",+]++[[package]]+name = "iana-time-zone-haiku"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"+dependencies = [+ "cc",+]++[[package]]+name = "icu_collections"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd"+dependencies = [+ "displaydoc",+ "potential_utf",+ "utf8_iter",+ "yoke",+ "zerofrom",+ "zerovec",+]++[[package]]+name = "icu_locale_core"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0"+dependencies = [+ "displaydoc",+ "litemap",+ "serde",+ "tinystr",+ "writeable",+ "zerovec",+]++[[package]]+name = "icu_locale_fallback"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "406e9ae5b95d8aa37db6293405931b766a6172d1848daee22d70eb44aa78a43c"+dependencies = [+ "icu_locale_core",+ "icu_locale_fallback_data",+ "icu_provider",+ "potential_utf",+ "tinystr",+ "zerovec",+]++[[package]]+name = "icu_locale_fallback_data"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3632ebbd0c5c3637ba1a40bdf8288f2cb9d2268e73441a69d5fc73d7cfbaa87c"++[[package]]+name = "icu_normalizer"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599"+dependencies = [+ "icu_collections",+ "icu_normalizer_data",+ "icu_properties",+ "icu_provider",+ "smallvec",+ "zerovec",+]++[[package]]+name = "icu_normalizer_data"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc"++[[package]]+name = "icu_properties"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f"+dependencies = [+ "displaydoc",+ "icu_collections",+ "icu_locale_core",+ "icu_properties_data",+ "icu_provider",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "icu_properties_data"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf"++[[package]]+name = "icu_provider"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514"+dependencies = [+ "displaydoc",+ "icu_locale_core",+ "serde",+ "stable_deref_trait",+ "writeable",+ "yoke",+ "zerofrom",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "icu_segmenter"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "61b195dc605f81aa181bec9b3bd14e26cc71b903e4644f6af578ca9772c7a710"+dependencies = [+ "icu_collections",+ "icu_locale_fallback",+ "icu_provider",+ "icu_segmenter_data",+ "potential_utf",+ "smallvec",+ "utf8_iter",+ "zerotrie",+ "zerovec",+]++[[package]]+name = "icu_segmenter_data"+version = "2.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "913a7d294ad056474749152107309fdee3ec17d2482d1ab70fdc61a81c64b9a3"++[[package]]+name = "idna"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de"+dependencies = [+ "idna_adapter",+ "smallvec",+ "utf8_iter",+]++[[package]]+name = "idna_adapter"+version = "1.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714"+dependencies = [+ "icu_normalizer",+ "icu_properties",+]++[[package]]+name = "image"+version = "0.25.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"+dependencies = [+ "bytemuck",+ "byteorder-lite",+ "color_quant",+ "exr",+ "gif",+ "image-webp",+ "moxcms",+ "num-traits",+ "png 0.18.1",+ "qoi",+ "ravif",+ "rayon",+ "rgb",+ "tiff",+ "zune-core",+ "zune-jpeg",+]++[[package]]+name = "image-webp"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"+dependencies = [+ "byteorder-lite",+ "quick-error",+]++[[package]]+name = "imagesize"+version = "0.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "edcd27d72f2f071c64249075f42e205ff93c9a4c5f6c6da53e79ed9f9832c285"++[[package]]+name = "imagesize"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09e54e57b4c48b40f7aec75635392b12b3421fa26fe8b4332e63138ed278459c"++[[package]]+name = "imgref"+version = "1.12.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f"++[[package]]+name = "indexmap"+version = "2.14.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"+dependencies = [+ "equivalent",+ "hashbrown 0.17.1",+ "serde",+ "serde_core",+]++[[package]]+name = "inout"+version = "0.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"+dependencies = [+ "block-padding",+ "generic-array",+]++[[package]]+name = "instant"+version = "0.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"+dependencies = [+ "cfg-if",+]++[[package]]+name = "interpolate_name"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "inventory"+version = "0.3.25"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6928282826c822ad91bf1c9a1cb90a30ba1c26770749929b4656cd6be829cd7c"+dependencies = [+ "rustversion",+]++[[package]]+name = "io-surface"+version = "0.16.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "554b8c5d64ec09a3a520fe58e4d48a73e00ff32899cdcbe32a4877afd4968b8e"+dependencies = [+ "cgl",+ "core-foundation 0.10.0",+ "core-foundation-sys",+ "leaky-cow",+]++[[package]]+name = "ipnet"+version = "2.12.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0"++[[package]]+name = "is-docker"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"+dependencies = [+ "once_cell",+]++[[package]]+name = "is-wsl"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"+dependencies = [+ "is-docker",+ "once_cell",+]++[[package]]+name = "itertools"+version = "0.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"+dependencies = [+ "either",+]++[[package]]+name = "itertools"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"+dependencies = [+ "either",+]++[[package]]+name = "itoa"+version = "1.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"++[[package]]+name = "jni-sys"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258"+dependencies = [+ "jni-sys 0.4.1",+]++[[package]]+name = "jni-sys"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2"+dependencies = [+ "jni-sys-macros",+]++[[package]]+name = "jni-sys-macros"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264"+dependencies = [+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "jobserver"+version = "0.1.35"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"+dependencies = [+ "getrandom 0.4.3",+ "libc",+]++[[package]]+name = "js-sys"+version = "0.3.107"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a"+dependencies = [+ "cfg-if",+ "futures-util",+ "wasm-bindgen",+]++[[package]]+name = "khronos-egl"+version = "6.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"+dependencies = [+ "libc",+ "libloading",+ "pkg-config",+]++[[package]]+name = "khronos_api"+version = "3.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"++[[package]]+name = "kurbo"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c62026ae44756f8a599ba21140f350303d4f08dcdcc71b5ad9c9bb8128c13c62"+dependencies = [+ "arrayvec",+ "euclid",+ "smallvec",+]++[[package]]+name = "kurbo"+version = "0.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2"+dependencies = [+ "arrayvec",+ "euclid",+ "polycool",+ "smallvec",+]++[[package]]+name = "kv-log-macro"+version = "1.0.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"+dependencies = [+ "log",+]++[[package]]+name = "lazy_static"+version = "1.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"+dependencies = [+ "spin 0.9.9",+]++[[package]]+name = "leak"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bd100e01f1154f2908dfa7d02219aeab25d0b9c7fa955164192e3245255a0c73"++[[package]]+name = "leaky-cow"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "40a8225d44241fd324a8af2806ba635fc7c8a7e9a7de4d5cf3ef54e71f5926fc"+dependencies = [+ "leak",+]++[[package]]+name = "lebe"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"++[[package]]+name = "libc"+version = "0.2.191"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"++[[package]]+name = "libfuzzer-sys"+version = "0.4.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2"+dependencies = [+ "arbitrary",+ "cc",+]++[[package]]+name = "libloading"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"+dependencies = [+ "cfg-if",+ "windows-link 0.2.1",+]++[[package]]+name = "libm"+version = "0.2.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"++[[package]]+name = "libredox"+version = "0.1.25"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d"+dependencies = [+ "libc",+]++[[package]]+name = "linebender_resource_handle"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"++[[package]]+name = "link-section"+version = "0.19.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "39c29a617ce3df32c08497bdc1ab6e2376e0b17948ac166a2fbe5977c5954cd9"++[[package]]+name = "linktime-proc-macro"+version = "0.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7e57c38c1e860fd37c604281cdfb1dd2216977fd76a50f85ba2f388ef3219616"++[[package]]+name = "linux-raw-sys"+version = "0.4.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"++[[package]]+name = "linux-raw-sys"+version = "0.12.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"++[[package]]+name = "litemap"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae"++[[package]]+name = "litrs"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70"++[[package]]+name = "lock_api"+version = "0.4.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"+dependencies = [+ "scopeguard",+]++[[package]]+name = "log"+version = "0.4.35"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"+dependencies = [+ "serde_core",+ "value-bag",+]++[[package]]+name = "loop9"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062"+dependencies = [+ "imgref",+]++[[package]]+name = "lru-slab"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4050469837a6ff301cd14c1f8f24f88549e6d548f24f64e2148eb0f72cebc51f"++[[package]]+name = "lyon"+version = "1.0.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bd0578bdecb7d6d88987b8b2b1e3a4e2f81df9d0ece1078623324a567904e7b7"+dependencies = [+ "lyon_algorithms",+ "lyon_tessellation",+]++[[package]]+name = "lyon_algorithms"+version = "1.0.22"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f3a6b9d4e8b48acd531fbf1241ad9b270df6e60b6b92bdea1469f4f40899d805"+dependencies = [+ "lyon_path",+ "num-traits",+]++[[package]]+name = "lyon_geom"+version = "1.0.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d82dd26aa4dc0b5b70b9115de59824842bcb43cf4a28e1b1e6d0ad148c93f93e"+dependencies = [+ "arrayvec",+ "euclid",+ "num-traits",+]++[[package]]+name = "lyon_path"+version = "1.0.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c463f9c428b7fc5ec885dcd39ce4aa61e29111d0e33483f6f98c74e89d8621e"+dependencies = [+ "lyon_geom",+ "num-traits",+]++[[package]]+name = "lyon_tessellation"+version = "1.0.23"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fd4872650e70dc907dd4f7ebc449d7d657a0d2658e423b2e724970870bbbf75b"+dependencies = [+ "float_next_after",+ "lyon_path",+ "num-traits",+]++[[package]]+name = "mac"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"++[[package]]+name = "mac-notification-sys"+version = "0.6.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fd604973958ddcc11b561193c0fb96ba146506ef2f231ef2e7c35fd2cbc9beca"+dependencies = [+ "cc",+ "log",+ "objc2 0.6.5",+ "objc2-foundation 0.3.2",+ "time",+ "uuid",+]++[[package]]+name = "mach2"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dae608c151f68243f2b000364e1f7b186d9c29845f7d2d85bd31b9ad77ad552b"++[[package]]+name = "malloc_buf"+version = "0.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"+dependencies = [+ "libc",+]++[[package]]+name = "maybe-rayon"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"+dependencies = [+ "cfg-if",+ "rayon",+]++[[package]]+name = "md-5"+version = "0.10.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"+dependencies = [+ "cfg-if",+ "digest 0.10.7",+]++[[package]]+name = "memchr"+version = "2.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"++[[package]]+name = "memmap2"+version = "0.9.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6b0ca1155a9ecc25aa12e8313a119f32edf0255fea2f44839c4ac0a12b2ac157"+dependencies = [+ "libc",+]++[[package]]+name = "memoffset"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"+dependencies = [+ "autocfg",+]++[[package]]+name = "metal"+version = "0.29.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21"+dependencies = [+ "bitflags 2.13.2",+ "block",+ "core-graphics-types 0.1.3",+ "foreign-types",+ "log",+ "objc",+ "paste",+]++[[package]]+name = "mime"+version = "0.3.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"++[[package]]+name = "mime_guess"+version = "2.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"+dependencies = [+ "mime",+ "unicase",+]++[[package]]+name = "minimal-lexical"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"++[[package]]+name = "miniz_oxide"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"+dependencies = [+ "adler2",+ "simd-adler32",+]++[[package]]+name = "miniz_oxide"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"+dependencies = [+ "adler2",+ "simd-adler32",+]++[[package]]+name = "mint"+version = "0.5.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff"++[[package]]+name = "mio"+version = "1.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee"+dependencies = [+ "libc",+ "wasi",+ "windows-sys 0.61.2",+]++[[package]]+name = "moxcms"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"+dependencies = [+ "num-traits",+ "pxfm",+]++[[package]]+name = "multiversion_no_op"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d"++[[package]]+name = "naga"+version = "25.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2b977c445f26e49757f9aca3631c3b8b836942cb278d69a92e7b80d3b24da632"+dependencies = [+ "arrayvec",+ "bit-set 0.8.0",+ "bitflags 2.13.2",+ "cfg_aliases",+ "codespan-reporting 0.12.0",+ "half",+ "hashbrown 0.15.5",+ "hexf-parse",+ "indexmap",+ "log",+ "num-traits",+ "once_cell",+ "rustc-hash 1.1.0",+ "spirv 0.3.0+sdk-1.3.268.0",+ "strum 0.26.3",+ "thiserror 2.0.21",+ "unicode-ident",+]++[[package]]+name = "naga"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130"+dependencies = [+ "arrayvec",+ "bit-set 0.10.0",+ "bitflags 2.13.2",+ "cfg-if",+ "cfg_aliases",+ "codespan-reporting 0.13.1",+ "half",+ "hashbrown 0.17.1",+ "indexmap",+ "libm",+ "log",+ "naga-types",+ "num-traits",+ "once_cell",+ "rustc-hash 1.1.0",+ "spirv 0.4.0+sdk-1.4.341.0",+ "thiserror 2.0.21",+ "unicode-ident",+]++[[package]]+name = "naga-types"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49"+dependencies = [+ "hashbrown 0.17.1",+ "indexmap",+ "rustc-hash 1.1.0",+ "thiserror 2.0.21",+]++[[package]]+name = "nanorand"+version = "0.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3"+dependencies = [+ "getrandom 0.2.17",+]++[[package]]+name = "ndk-sys"+version = "0.6.0+11769913"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873"+dependencies = [+ "jni-sys 0.3.1",+]++[[package]]+name = "new_debug_unreachable"+version = "1.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"++[[package]]+name = "nix"+version = "0.29.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"+dependencies = [+ "bitflags 2.13.2",+ "cfg-if",+ "cfg_aliases",+ "libc",+]++[[package]]+name = "nix"+version = "0.31.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"+dependencies = [+ "bitflags 2.13.2",+ "cfg-if",+ "cfg_aliases",+ "libc",+]++[[package]]+name = "no_std_io2"+version = "0.9.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003"+dependencies = [+ "memchr",+]++[[package]]+name = "nom"+version = "7.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"+dependencies = [+ "memchr",+ "minimal-lexical",+]++[[package]]+name = "nom"+version = "8.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"+dependencies = [+ "memchr",+]++[[package]]+name = "noop_proc_macro"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"++[[package]]+name = "notify-rust"+version = "4.18.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4587364a9a0074333429b3df75a30a205340c56a536ca3eb6ca0e59b87bbf8af"+dependencies = [+ "futures-lite 2.6.1",+ "log",+ "mac-notification-sys",+ "serde",+ "tauri-winrt-notification",+ "zbus",+]++[[package]]+name = "ntapi"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae"+dependencies = [+ "winapi",+]++[[package]]+name = "num"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23"+dependencies = [+ "num-bigint",+ "num-complex",+ "num-integer",+ "num-iter",+ "num-rational",+ "num-traits",+]++[[package]]+name = "num-bigint"+version = "0.4.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367"+dependencies = [+ "num-integer",+ "num-traits",+]++[[package]]+name = "num-bigint-dig"+version = "0.8.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7"+dependencies = [+ "lazy_static",+ "libm",+ "num-integer",+ "num-iter",+ "num-traits",+ "rand 0.8.8",+ "serde",+ "smallvec",+ "zeroize",+]++[[package]]+name = "num-bigint-dig"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7f9a86e097b0d187ad0e65667c2f58b9254671e86e7dbb78036b16692eae099"+dependencies = [+ "libm",+ "num-integer",+ "num-iter",+ "num-traits",+ "once_cell",+ "rand 0.9.5",+ "serde",+ "smallvec",+ "zeroize",+]++[[package]]+name = "num-complex"+version = "0.4.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"+dependencies = [+ "bytemuck",+ "num-traits",+]++[[package]]+name = "num-conv"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"++[[package]]+name = "num-derive"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "num-integer"+version = "0.1.47"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"+dependencies = [+ "num-traits",+]++[[package]]+name = "num-iter"+version = "0.1.46"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b"+dependencies = [+ "num-integer",+ "num-traits",+]++[[package]]+name = "num-rational"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"+dependencies = [+ "num-bigint",+ "num-integer",+ "num-traits",+]++[[package]]+name = "num-traits"+version = "0.2.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"+dependencies = [+ "autocfg",+ "libm",+]++[[package]]+name = "num_cpus"+version = "1.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b"+dependencies = [+ "hermit-abi",+ "libc",+]++[[package]]+name = "objc"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"+dependencies = [+ "malloc_buf",+ "objc_exception",+]++[[package]]+name = "objc-foundation"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"+dependencies = [+ "block",+ "objc",+ "objc_id",+]++[[package]]+name = "objc-sys"+version = "0.3.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"++[[package]]+name = "objc2"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "19d5490aaf8f1d7cf7688dfa9b0ce07900e168852c45cd2c03f534dfd27cfd0b"+dependencies = [+ "objc-sys",+ "objc2-encode",+]++[[package]]+name = "objc2"+version = "0.6.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8"+dependencies = [+ "objc2-encode",+]++[[package]]+name = "objc2-app-kit"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.5.1",+ "libc",+ "objc2 0.5.3",+ "objc2-core-data",+ "objc2-core-image",+ "objc2-foundation 0.2.2",+ "objc2-quartz-core 0.2.2",+]++[[package]]+name = "objc2-app-kit"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.6.2",+ "objc2 0.6.5",+ "objc2-core-foundation",+ "objc2-foundation 0.3.2",+ "objc2-quartz-core 0.3.2",+ "objc2-uniform-type-identifiers",+]++[[package]]+name = "objc2-core-data"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.5.1",+ "objc2 0.5.3",+ "objc2-foundation 0.2.2",+]++[[package]]+name = "objc2-core-foundation"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.6.2",+ "dispatch2",+ "libc",+ "objc2 0.6.5",+]++[[package]]+name = "objc2-core-graphics"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807"+dependencies = [+ "bitflags 2.13.2",+ "dispatch2",+ "objc2 0.6.5",+ "objc2-core-foundation",+ "objc2-io-surface",+]++[[package]]+name = "objc2-core-image"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"+dependencies = [+ "block2 0.5.1",+ "objc2 0.5.3",+ "objc2-foundation 0.2.2",+ "objc2-metal 0.2.2",+]++[[package]]+name = "objc2-core-text"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d"+dependencies = [+ "bitflags 2.13.2",+ "objc2-core-foundation",+]++[[package]]+name = "objc2-core-video"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6"+dependencies = [+ "bitflags 2.13.2",+ "objc2 0.6.5",+ "objc2-core-foundation",+ "objc2-core-graphics",+ "objc2-io-surface",+ "objc2-metal 0.3.2",+]++[[package]]+name = "objc2-encode"+version = "4.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"++[[package]]+name = "objc2-foundation"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.5.1",+ "libc",+ "objc2 0.5.3",+]++[[package]]+name = "objc2-foundation"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.6.2",+ "libc",+ "objc2 0.6.5",+ "objc2-core-foundation",+]++[[package]]+name = "objc2-io-surface"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d"+dependencies = [+ "bitflags 2.13.2",+ "objc2 0.6.5",+ "objc2-core-foundation",+]++[[package]]+name = "objc2-metal"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.5.1",+ "objc2 0.5.3",+ "objc2-foundation 0.2.2",+]++[[package]]+name = "objc2-metal"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.6.2",+ "dispatch2",+ "objc2 0.6.5",+ "objc2-foundation 0.3.2",+]++[[package]]+name = "objc2-quartz-core"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.5.1",+ "objc2 0.5.3",+ "objc2-foundation 0.2.2",+ "objc2-metal 0.2.2",+]++[[package]]+name = "objc2-quartz-core"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f"+dependencies = [+ "bitflags 2.13.2",+ "objc2 0.6.5",+ "objc2-core-foundation",+ "objc2-core-graphics",+ "objc2-foundation 0.3.2",+ "objc2-metal 0.3.2",+]++[[package]]+name = "objc2-security"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "709fe137109bd1e8b5a99390f77a7d8b2961dafc1a1c5db8f2e60329ad6d895a"+dependencies = [+ "objc2-core-foundation",+]++[[package]]+name = "objc2-ui-kit"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.6.2",+ "objc2 0.6.5",+ "objc2-core-foundation",+ "objc2-foundation 0.3.2",+ "objc2-quartz-core 0.3.2",+]++[[package]]+name = "objc2-uniform-type-identifiers"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7902ac02859fc1f7045f8b598c63f1ae0cc7efeaa06a9bc9f3d9a3c955974fa4"+dependencies = [+ "objc2 0.6.5",+ "objc2-foundation 0.3.2",+]++[[package]]+name = "objc2-user-notifications"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e"+dependencies = [+ "bitflags 2.13.2",+ "block2 0.6.2",+ "objc2 0.6.5",+ "objc2-foundation 0.3.2",+]++[[package]]+name = "objc_exception"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"+dependencies = [+ "cc",+]++[[package]]+name = "objc_id"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"+dependencies = [+ "objc",+]++[[package]]+name = "object"+version = "0.39.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2e5a6c098c7a3b6547378093f5cc30bc54fd361ce711e05293a5cc589562739b"+dependencies = [+ "memchr",+]++[[package]]+name = "object"+version = "0.40.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dd229a0361b9d0d4396176e02d65897f487eebeab7caa6d443855ee152ca0b9c"+dependencies = [+ "memchr",+]++[[package]]+name = "once_cell"+version = "1.21.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"++[[package]]+name = "oo7"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e3299dd401feaf1d45afd8fd1c0586f10fcfb22f244bb9afa942cec73503b89d"+dependencies = [+ "aes",+ "ashpd 0.12.3",+ "async-fs",+ "async-io",+ "async-lock",+ "blocking",+ "cbc",+ "cipher",+ "digest 0.10.7",+ "endi",+ "futures-lite 2.6.1",+ "futures-util",+ "getrandom 0.3.4",+ "hkdf",+ "hmac",+ "md-5",+ "num",+ "num-bigint-dig 0.8.6",+ "pbkdf2",+ "rand 0.9.5",+ "serde",+ "sha2 0.10.9",+ "subtle",+ "zbus",+ "zbus_macros",+ "zeroize",+ "zvariant",+]++[[package]]+name = "oo7"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "78f2bfed90f1618b4b48dcad9307f25e14ae894e2949642c87c351601d62cebd"+dependencies = [+ "aes",+ "ashpd 0.13.13",+ "async-fs",+ "async-io",+ "async-lock",+ "blocking",+ "cbc",+ "cipher",+ "digest 0.10.7",+ "endi",+ "futures-lite 2.6.1",+ "futures-util",+ "getrandom 0.4.3",+ "hkdf",+ "hmac",+ "md-5",+ "num",+ "num-bigint-dig 0.9.1",+ "pbkdf2",+ "serde",+ "serde_bytes",+ "sha2 0.10.9",+ "subtle",+ "zbus",+ "zbus_macros",+ "zeroize",+ "zvariant",+]++[[package]]+name = "open"+version = "5.4.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8d8c8b8e725ad26404d6896eb2f064294a0a7b4f1d9120210d85544684c4ca95"+dependencies = [+ "is-wsl",+ "libc",+]++[[package]]+name = "openssl-probe"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1"++[[package]]+name = "option-ext"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"++[[package]]+name = "ordered-float"+version = "5.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f59006ce1e204c30956638535b74d317bca99477b9356dfaec54c37f6f600ab"+dependencies = [+ "num-traits",+]++[[package]]+name = "ordered-stream"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"+dependencies = [+ "futures-core",+ "pin-project-lite",+]++[[package]]+name = "parking"+version = "2.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"++[[package]]+name = "parking_lot"+version = "0.12.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"+dependencies = [+ "lock_api",+ "parking_lot_core",+]++[[package]]+name = "parking_lot_core"+version = "0.9.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"+dependencies = [+ "cfg-if",+ "libc",+ "redox_syscall 0.5.18",+ "smallvec",+ "windows-link 0.2.1",+]++[[package]]+name = "paste"+version = "1.0.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"++[[package]]+name = "pastey"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"++[[package]]+name = "pathfinder_geometry"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b7b7e7b4ea703700ce73ebf128e1450eb69c3a8329199ffbfb9b2a0418e5ad3"+dependencies = [+ "log",+ "pathfinder_simd",+]++[[package]]+name = "pathfinder_simd"+version = "0.5.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4500030c302e4af1d423f36f3b958d1aecb6c04184356ed5a833bf6b60435777"+dependencies = [+ "rustc_version",+]++[[package]]+name = "pbkdf2"+version = "0.12.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"+dependencies = [+ "digest 0.10.7",+ "hmac",+]++[[package]]+name = "percent-encoding"+version = "2.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"++[[package]]+name = "pico-args"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"++[[package]]+name = "pin-project"+version = "1.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924"+dependencies = [+ "pin-project-internal",+]++[[package]]+name = "pin-project-internal"+version = "1.1.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "pin-project-lite"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"++[[package]]+name = "pin-utils"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "13bee6c73da26345c729282832b60b0363cf3dd9f4bfd81d8551b7a1c889a113"++[[package]]+name = "piper"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1"+dependencies = [+ "atomic-waker",+ "fastrand 2.5.0",+ "futures-io",+]++[[package]]+name = "pkg-config"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"++[[package]]+name = "png"+version = "0.17.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"+dependencies = [+ "bitflags 1.3.2",+ "crc32fast",+ "fdeflate",+ "flate2",+ "miniz_oxide 0.8.9",+]++[[package]]+name = "png"+version = "0.18.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"+dependencies = [+ "bitflags 2.13.2",+ "crc32fast",+ "fdeflate",+ "flate2",+ "miniz_oxide 0.8.9",+]++[[package]]+name = "polling"+version = "3.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"+dependencies = [+ "cfg-if",+ "concurrent-queue",+ "hermit-abi",+ "pin-project-lite",+ "rustix 1.1.6",+ "windows-sys 0.61.2",+]++[[package]]+name = "pollster"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7"++[[package]]+name = "pollster"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3"++[[package]]+name = "polycool"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6"+dependencies = [+ "arrayvec",+]++[[package]]+name = "portable-atomic"+version = "1.15.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"++[[package]]+name = "portable-atomic-util"+version = "0.2.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"+dependencies = [+ "portable-atomic",+]++[[package]]+name = "postage"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af3fb618632874fb76937c2361a7f22afd393c982a2165595407edc75b06d3c1"+dependencies = [+ "atomic",+ "crossbeam-queue",+ "futures",+ "log",+ "parking_lot",+ "pin-project",+ "pollster 0.2.5",+ "static_assertions",+ "thiserror 1.0.69",+]++[[package]]+name = "potential_utf"+version = "0.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661"+dependencies = [+ "serde_core",+ "writeable",+ "zerovec",+]++[[package]]+name = "powerfmt"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958"++[[package]]+name = "ppv-lite86"+version = "0.2.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"+dependencies = [+ "zerocopy",+]++[[package]]+name = "presser"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa"++[[package]]+name = "prettyplease"+version = "0.2.37"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"+dependencies = [+ "proc-macro2",+ "syn 2.0.119",+]++[[package]]+name = "proc-macro-crate"+version = "3.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f"+dependencies = [+ "toml_edit 0.25.17+spec-1.1.0",+]++[[package]]+name = "proc-macro-error-attr2"+version = "2.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"+dependencies = [+ "proc-macro2",+ "quote",+]++[[package]]+name = "proc-macro-error2"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"+dependencies = [+ "proc-macro-error-attr2",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "proc-macro2"+version = "1.0.107"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "profiling"+version = "1.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5"+dependencies = [+ "profiling-procmacros",+]++[[package]]+name = "profiling-procmacros"+version = "1.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb"+dependencies = [+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "psm"+version = "0.1.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4dcd034599e63b970727f70d79e02d62390a4a84f7c6b827c27c46d5ac3fa622"+dependencies = [+ "ar_archive_writer",+ "cc",+]++[[package]]+name = "pulp"+version = "0.22.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a"+dependencies = [+ "bytemuck",+ "cfg-if",+ "libm",+ "num-complex",+ "paste",+ "pulp-wasm-simd-flag",+ "raw-cpuid",+ "reborrow",+ "version_check",+]++[[package]]+name = "pulp-wasm-simd-flag"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740"++[[package]]+name = "pxfm"+version = "0.1.30"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea"++[[package]]+name = "qoi"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"+dependencies = [+ "bytemuck",+]++[[package]]+name = "quick-error"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"++[[package]]+name = "quick-xml"+version = "0.41.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1"+dependencies = [+ "memchr",+]++[[package]]+name = "quinn"+version = "0.11.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4051e23e9185c255a7e33ef59cdbca87a22d359052eecd22fc6b901fb37d9d11"+dependencies = [+ "bytes",+ "cfg_aliases",+ "pin-project-lite",+ "quinn-proto",+ "quinn-udp",+ "rustc-hash 2.1.3",+ "rustls",+ "socket2",+ "thiserror 2.0.21",+ "tokio",+ "tracing",+ "web-time",+]++[[package]]+name = "quinn-proto"+version = "0.11.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0e750cca55fe4f0439a15d0bb529da9651e79993e8e72c61a899a36d462befbe"+dependencies = [+ "bytes",+ "getrandom 0.4.3",+ "lru-slab",+ "rand 0.10.3",+ "rand_pcg",+ "ring",+ "rustc-hash 2.1.3",+ "rustls",+ "rustls-pki-types",+ "slab",+ "thiserror 2.0.21",+ "tinyvec",+ "tracing",+ "web-time",+]++[[package]]+name = "quinn-udp"+version = "0.5.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af66907df18639dcf4db56ca65490cabc4b27a97dbadd96f2926cca73298f016"+dependencies = [+ "cfg_aliases",+ "libc",+ "once_cell",+ "socket2",+ "tracing",+ "windows-sys 0.61.2",+]++[[package]]+name = "quote"+version = "1.0.47"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"+dependencies = [+ "proc-macro2",+]++[[package]]+name = "r-efi"+version = "5.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"++[[package]]+name = "r-efi"+version = "6.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"++[[package]]+name = "rand"+version = "0.8.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c"+dependencies = [+ "libc",+ "rand_chacha 0.3.1",+ "rand_core 0.6.4",+]++[[package]]+name = "rand"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"+dependencies = [+ "rand_chacha 0.9.0",+ "rand_core 0.9.5",+]++[[package]]+name = "rand"+version = "0.10.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af"+dependencies = [+ "chacha20",+ "getrandom 0.4.3",+ "rand_core 0.10.1",+]++[[package]]+name = "rand_chacha"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"+dependencies = [+ "ppv-lite86",+ "rand_core 0.6.4",+]++[[package]]+name = "rand_chacha"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"+dependencies = [+ "ppv-lite86",+ "rand_core 0.9.5",+]++[[package]]+name = "rand_core"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"+dependencies = [+ "getrandom 0.2.17",+]++[[package]]+name = "rand_core"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"+dependencies = [+ "getrandom 0.3.4",+]++[[package]]+name = "rand_core"+version = "0.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"++[[package]]+name = "rand_pcg"+version = "0.10.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a"+dependencies = [+ "rand_core 0.10.1",+]++[[package]]+name = "range-alloc"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08"++[[package]]+name = "rangemap"+version = "1.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a611d15b50743feb4c76b7d03edcb0e64f399c26961e4efe6975bc398be6aa3d"++[[package]]+name = "rav1e"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b"+dependencies = [+ "aligned-vec",+ "arbitrary",+ "arg_enum_proc_macro",+ "arrayvec",+ "av-scenechange",+ "av1-grain",+ "bitstream-io",+ "built",+ "cfg-if",+ "interpolate_name",+ "itertools 0.14.0",+ "libc",+ "libfuzzer-sys",+ "log",+ "maybe-rayon",+ "new_debug_unreachable",+ "noop_proc_macro",+ "num-derive",+ "num-traits",+ "paste",+ "profiling",+ "rand 0.9.5",+ "rand_chacha 0.9.0",+ "simd_helpers",+ "thiserror 2.0.21",+ "v_frame",+ "wasm-bindgen",+]++[[package]]+name = "ravif"+version = "0.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45"+dependencies = [+ "avif-serialize",+ "imgref",+ "loop9",+ "quick-error",+ "rav1e",+ "rayon",+ "rgb",+]++[[package]]+name = "raw-cpuid"+version = "11.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186"+dependencies = [+ "bitflags 2.13.2",+]++[[package]]+name = "raw-window-handle"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"++[[package]]+name = "raw-window-metal"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "76e8caa82e31bb98fee12fa8f051c94a6aa36b07cddb03f0d4fc558988360ff1"+dependencies = [+ "cocoa 0.25.0",+ "core-graphics 0.23.2",+ "objc",+ "raw-window-handle",+]++[[package]]+name = "raw-window-metal"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135"+dependencies = [+ "objc2 0.6.5",+ "objc2-core-foundation",+ "objc2-foundation 0.3.2",+ "objc2-quartz-core 0.3.2",+]++[[package]]+name = "rayon"+version = "1.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"+dependencies = [+ "either",+ "rayon-core",+]++[[package]]+name = "rayon-core"+version = "1.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"+dependencies = [+ "crossbeam-deque",+ "crossbeam-utils",+]++[[package]]+name = "read-fonts"+version = "0.37.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5"+dependencies = [+ "bytemuck",+ "core_maths",+ "font-types 0.11.3",+]++[[package]]+name = "read-fonts"+version = "0.41.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709"+dependencies = [+ "bytemuck",+ "font-types 0.12.7",+ "once_cell",+]++[[package]]+name = "reborrow"+version = "0.5.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430"++[[package]]+name = "redox_syscall"+version = "0.2.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"+dependencies = [+ "bitflags 1.3.2",+]++[[package]]+name = "redox_syscall"+version = "0.5.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"+dependencies = [+ "bitflags 2.13.2",+]++[[package]]+name = "redox_users"+version = "0.4.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"+dependencies = [+ "getrandom 0.2.17",+ "libredox",+ "thiserror 1.0.69",+]++[[package]]+name = "ref-cast"+version = "1.0.27"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3"+dependencies = [+ "ref-cast-impl",+]++[[package]]+name = "ref-cast-impl"+version = "1.0.27"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "regex"+version = "1.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"+dependencies = [+ "aho-corasick",+ "memchr",+ "regex-automata",+ "regex-syntax",+]++[[package]]+name = "regex-automata"+version = "0.4.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"+dependencies = [+ "aho-corasick",+ "memchr",+ "regex-syntax",+]++[[package]]+name = "regex-syntax"+version = "0.8.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"++[[package]]+name = "renderdoc-sys"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"++[[package]]+name = "resvg"+version = "0.45.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a8928798c0a55e03c9ca6c4c6846f76377427d2c1e1f7e6de3c06ae57942df43"+dependencies = [+ "log",+ "pico-args",+ "rgb",+ "svgtypes 0.15.3",+ "tiny-skia",+ "usvg 0.45.1",+]++[[package]]+name = "resvg"+version = "0.46.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b563218631706d614e23059436526d005b50ab5f2d506b55a17eb65c5eb83419"+dependencies = [+ "gif",+ "image-webp",+ "log",+ "pico-args",+ "rgb",+ "svgtypes 0.16.1",+ "tiny-skia",+ "usvg 0.46.0",+ "zune-jpeg",+]++[[package]]+name = "rgb"+version = "0.8.53"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4"+dependencies = [+ "bytemuck",+]++[[package]]+name = "ring"+version = "0.17.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7"+dependencies = [+ "cc",+ "cfg-if",+ "getrandom 0.2.17",+ "libc",+ "untrusted",+ "windows-sys 0.52.0",+]++[[package]]+name = "roxmltree"+version = "0.20.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"++[[package]]+name = "roxmltree"+version = "0.21.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9da7f59328b09405b181fee1018925fad50f157afb43c0c0f5c522c256dd5907"+dependencies = [+ "memchr",+]++[[package]]+name = "rust-embed"+version = "8.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "19afa5b4b6a611de00bd1bdae6ae6f39084c9399f0679c3f52d8469cf335cc23"+dependencies = [+ "rust-embed-impl",+ "rust-embed-utils",+ "walkdir",+]++[[package]]+name = "rust-embed-impl"+version = "8.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e0d8afda6374eac59e066abee06d265247ebbaf3006cf878e2879e8356e34053"+dependencies = [+ "mime_guess",+ "proc-macro2",+ "quote",+ "rust-embed-utils",+ "syn 2.0.119",+ "walkdir",+]++[[package]]+name = "rust-embed-utils"+version = "8.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0d84e8ba78bd384263e5922f084cbe1b081c3b7e69add59c8fb097b879ba968a"+dependencies = [+ "globset",+ "sha2 0.11.1",+ "walkdir",+]++[[package]]+name = "rustc-demangle"+version = "0.1.28"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb"++[[package]]+name = "rustc-hash"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"++[[package]]+name = "rustc-hash"+version = "2.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"++[[package]]+name = "rustc_version"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"+dependencies = [+ "semver",+]++[[package]]+name = "rustix"+version = "0.38.44"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"+dependencies = [+ "bitflags 2.13.2",+ "errno",+ "libc",+ "linux-raw-sys 0.4.15",+ "windows-sys 0.59.0",+]++[[package]]+name = "rustix"+version = "1.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa"+dependencies = [+ "bitflags 2.13.2",+ "errno",+ "libc",+ "linux-raw-sys 0.12.1",+ "windows-sys 0.61.2",+]++[[package]]+name = "rustls"+version = "0.23.46"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"+dependencies = [+ "once_cell",+ "ring",+ "rustls-pki-types",+ "rustls-webpki",+ "subtle",+ "zeroize",+]++[[package]]+name = "rustls-native-certs"+version = "0.8.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4"+dependencies = [+ "openssl-probe",+ "rustls-pki-types",+ "schannel",+ "security-framework",+]++[[package]]+name = "rustls-pemfile"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50"+dependencies = [+ "rustls-pki-types",+]++[[package]]+name = "rustls-pki-types"+version = "1.15.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96"+dependencies = [+ "web-time",+ "zeroize",+]++[[package]]+name = "rustls-webpki"+version = "0.103.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"+dependencies = [+ "ring",+ "rustls-pki-types",+ "untrusted",+]++[[package]]+name = "rustversion"+version = "1.0.23"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"++[[package]]+name = "rustybuzz"+version = "0.14.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cfb9cf8877777222e4a3bc7eb247e398b56baba500c38c1c46842431adc8b55c"+dependencies = [+ "bitflags 2.13.2",+ "bytemuck",+ "libm",+ "smallvec",+ "ttf-parser 0.21.1",+ "unicode-bidi-mirroring 0.2.0",+ "unicode-ccc 0.2.0",+ "unicode-properties",+ "unicode-script",+]++[[package]]+name = "rustybuzz"+version = "0.20.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702"+dependencies = [+ "bitflags 2.13.2",+ "bytemuck",+ "core_maths",+ "log",+ "smallvec",+ "ttf-parser 0.25.1",+ "unicode-bidi-mirroring 0.4.0",+ "unicode-ccc 0.4.0",+ "unicode-properties",+ "unicode-script",+]++[[package]]+name = "ryu"+version = "1.0.23"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"++[[package]]+name = "same-file"+version = "1.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"+dependencies = [+ "winapi-util",+]++[[package]]+name = "schannel"+version = "0.1.30"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "schemars"+version = "1.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e"+dependencies = [+ "dyn-clone",+ "indexmap",+ "ref-cast",+ "schemars_derive",+ "serde",+ "serde_json",+]++[[package]]+name = "schemars_derive"+version = "1.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e1c3a92094fa7d61aa124645844facb6b554dfc797136d0f5fd1f890e2bffc69"+dependencies = [+ "proc-macro2",+ "quote",+ "serde_derive_internals",+ "syn 3.0.9",+]++[[package]]+name = "scoped-tls"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294"++[[package]]+name = "scopeguard"+version = "1.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"++[[package]]+name = "screencapturekit"+version = "0.2.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1a5eeeb57ac94960cfe5ff4c402be6585ae4c8d29a2cf41b276048c2e849d64e"+dependencies = [+ "screencapturekit-sys",+]++[[package]]+name = "screencapturekit-sys"+version = "0.2.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "22411b57f7d49e7fe08025198813ee6fd65e1ee5eff4ebc7880c12c82bde4c60"+dependencies = [+ "block",+ "dispatch",+ "objc",+ "objc-foundation",+ "objc_id",+ "once_cell",+]++[[package]]+name = "seahash"+version = "4.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"++[[package]]+name = "security-framework"+version = "3.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"+dependencies = [+ "bitflags 2.13.2",+ "core-foundation 0.10.0",+ "core-foundation-sys",+ "libc",+ "security-framework-sys",+]++[[package]]+name = "security-framework-sys"+version = "2.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"+dependencies = [+ "core-foundation-sys",+ "libc",+]++[[package]]+name = "self_cell"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813"++[[package]]+name = "semver"+version = "1.0.28"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"+dependencies = [+ "serde",+ "serde_core",+]++[[package]]+name = "serde"+version = "1.0.229"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"+dependencies = [+ "serde_core",+ "serde_derive",+]++[[package]]+name = "serde_bytes"+version = "0.11.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8"+dependencies = [+ "serde",+ "serde_core",+]++[[package]]+name = "serde_core"+version = "1.0.229"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"+dependencies = [+ "serde_derive",+]++[[package]]+name = "serde_derive"+version = "1.0.229"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "serde_derive_internals"+version = "0.30.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "serde_fmt"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e497af288b3b95d067a23a4f749f2861121ffcb2f6d8379310dcda040c345ed"+dependencies = [+ "serde_core",+]++[[package]]+name = "serde_json"+version = "1.0.154"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"+dependencies = [+ "foldhash 0.2.0",+ "indexmap",+ "itoa",+ "memchr",+ "serde",+ "serde_core",+ "zmij",+]++[[package]]+name = "serde_json_lenient"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0e033097bf0d2b59a62b42c18ebbb797503839b26afdda2c4e1415cb6c813540"+dependencies = [+ "indexmap",+ "itoa",+ "memchr",+ "ryu",+ "serde",+]++[[package]]+name = "serde_repr"+version = "0.1.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "serde_spanned"+version = "0.6.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"+dependencies = [+ "serde",+]++[[package]]+name = "serde_spanned"+version = "1.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c"+dependencies = [+ "serde_core",+]++[[package]]+name = "serde_urlencoded"+version = "0.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"+dependencies = [+ "form_urlencoded",+ "itoa",+ "ryu",+ "serde",+]++[[package]]+name = "sha1_smol"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"++[[package]]+name = "sha2"+version = "0.10.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"+dependencies = [+ "cfg-if",+ "cpufeatures 0.2.17",+ "digest 0.10.7",+]++[[package]]+name = "sha2"+version = "0.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19"+dependencies = [+ "cfg-if",+ "cpufeatures 0.3.1",+ "digest 0.11.3",+]++[[package]]+name = "shlex"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"++[[package]]+name = "shlex"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"++[[package]]+name = "signal-hook-registry"+version = "1.4.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"+dependencies = [+ "errno",+ "libc",+]++[[package]]+name = "simd-adler32"+version = "0.3.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"++[[package]]+name = "simd_helpers"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"+dependencies = [+ "quote",+]++[[package]]+name = "simdutf8"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"++[[package]]+name = "simplecss"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c"+dependencies = [+ "log",+]++[[package]]+name = "siphasher"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256"++[[package]]+name = "skrifa"+version = "0.40.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac"+dependencies = [+ "bytemuck",+ "read-fonts 0.37.0",+]++[[package]]+name = "skrifa"+version = "0.44.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68"+dependencies = [+ "bytemuck",+ "read-fonts 0.41.0",+]++[[package]]+name = "slab"+version = "0.4.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"++[[package]]+name = "slotmap"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038"+dependencies = [+ "version_check",+]++[[package]]+name = "smallvec"+version = "1.16.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8"++[[package]]+name = "smol"+version = "2.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a33bd3e260892199c3ccfc487c88b2da2265080acb316cd920da72fdfd7c599f"+dependencies = [+ "async-channel 2.5.0",+ "async-executor",+ "async-fs",+ "async-io",+ "async-lock",+ "async-net",+ "async-process",+ "blocking",+ "futures-lite 2.6.1",+]++[[package]]+name = "smol_str"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead"++[[package]]+name = "smol_str"+version = "0.3.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eeb7109d23f319619d4cc0de5464613c8b7b1a09db2774a58101459cf6be2f10"+dependencies = [+ "serde_core",+]++[[package]]+name = "socket2"+version = "0.6.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"+dependencies = [+ "libc",+ "windows-sys 0.61.2",+]++[[package]]+name = "spin"+version = "0.9.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e"+dependencies = [+ "lock_api",+]++[[package]]+name = "spin"+version = "0.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "023a211cb3138dbc438680b32560ad89f699977624c9f8dbb95a47d5b4c07dd3"+dependencies = [+ "lock_api",+]++[[package]]+name = "spirv"+version = "0.3.0+sdk-1.3.268.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844"+dependencies = [+ "bitflags 2.13.2",+]++[[package]]+name = "spirv"+version = "0.4.0+sdk-1.4.341.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f"+dependencies = [+ "bitflags 2.13.2",+]++[[package]]+name = "stable_deref_trait"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"++[[package]]+name = "stacker"+version = "0.1.25"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "707f49d46706bacf8a2b00d51dace3f9de527c13eec3778f570c411f89e69967"+dependencies = [+ "cc",+ "cfg-if",+ "libc",+ "psm",+ "windows-sys 0.61.2",+]++[[package]]+name = "stacksafe"+version = "0.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1d9c1172965d317e87ddb6d364a040d958b40a1db82b6ef97da26253a8b3d090"+dependencies = [+ "stacker",+ "stacksafe-macro",+]++[[package]]+name = "stacksafe-macro"+version = "0.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "172175341049678163e979d9107ca3508046d4d2a7c6682bee46ac541b17db69"+dependencies = [+ "proc-macro-error2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "static_assertions"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"++[[package]]+name = "strict-num"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"+dependencies = [+ "float-cmp",+]++[[package]]+name = "strum"+version = "0.26.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"+dependencies = [+ "strum_macros 0.26.4",+]++[[package]]+name = "strum"+version = "0.27.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf"+dependencies = [+ "strum_macros 0.27.2",+]++[[package]]+name = "strum"+version = "0.28.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd"+dependencies = [+ "strum_macros 0.28.0",+]++[[package]]+name = "strum_macros"+version = "0.26.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"+dependencies = [+ "heck 0.5.0",+ "proc-macro2",+ "quote",+ "rustversion",+ "syn 2.0.119",+]++[[package]]+name = "strum_macros"+version = "0.27.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7"+dependencies = [+ "heck 0.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "strum_macros"+version = "0.28.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664"+dependencies = [+ "heck 0.5.0",+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "subtle"+version = "2.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"++[[package]]+name = "sval"+version = "2.22.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b81b254da21fe1fcc4e3a74fe39b46e25e3a863078f8b71c954d47f84889dbc6"++[[package]]+name = "sval_buffer"+version = "2.22.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "50be352d2822ffafb59e3e2ddac9d5ee60f2eeadbb7b5a2a951b9f3651e87a6f"+dependencies = [+ "sval",+ "sval_ref",+ "zerocopy",+]++[[package]]+name = "sval_dynamic"+version = "2.22.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b048ca293b998d9a45659159f94a64063791e74cdc670164943dbb434405573d"+dependencies = [+ "sval",+]++[[package]]+name = "sval_fmt"+version = "2.22.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e6b5888e40f80568733217f27b7317b845f463400ced36c424b1a804730e53b2"+dependencies = [+ "itoa",+ "ryu",+ "sval",+]++[[package]]+name = "sval_json"+version = "2.22.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e17664d6bb6b74947afaab9d7c991caa9bf5638d4dee16fcbef637f440796049"+dependencies = [+ "itoa",+ "ryu",+ "sval",+]++[[package]]+name = "sval_nested"+version = "2.22.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "07c059969ca5ca163ea7fef6c9661758973d17691aba92abdcf5c428f4ec122c"+dependencies = [+ "sval",+ "sval_buffer",+ "sval_ref",+]++[[package]]+name = "sval_ref"+version = "2.22.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "42d6b29ff568c85c87561807f51d2adfff4b6016c6363133f7cd1652a12548f3"+dependencies = [+ "sval",+]++[[package]]+name = "sval_serde"+version = "2.22.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f33ec9edc42b12764d5c90ca0a1d84189c6bde81ed27507f1e661c6e4e05853"+dependencies = [+ "serde_core",+ "sval",+ "sval_nested",+]++[[package]]+name = "svg_fmt"+version = "0.4.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0193cc4331cfd2f3d2011ef287590868599a2f33c3e69bc22c1a3d3acf9e02fb"++[[package]]+name = "svgtypes"+version = "0.15.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68c7541fff44b35860c1a7a47a7cadf3e4a304c457b58f9870d9706ece028afc"+dependencies = [+ "kurbo 0.11.3",+ "siphasher",+]++[[package]]+name = "svgtypes"+version = "0.16.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d"+dependencies = [+ "kurbo 0.13.1",+ "siphasher",+]++[[package]]+name = "swash"+version = "0.2.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e"+dependencies = [+ "skrifa 0.44.0",+ "yazi",+ "zeno",+]++[[package]]+name = "syn"+version = "1.0.109"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "syn"+version = "2.0.119"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "syn"+version = "3.0.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "sync_wrapper"+version = "1.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"+dependencies = [+ "futures-core",+]++[[package]]+name = "synstructure"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "sys-locale"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"+dependencies = [+ "libc",+]++[[package]]+name = "sysinfo"+version = "0.31.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be"+dependencies = [+ "core-foundation-sys",+ "libc",+ "memchr",+ "ntapi",+ "rayon",+ "windows 0.57.0",+]++[[package]]+name = "system-configuration"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"+dependencies = [+ "bitflags 2.13.2",+ "core-foundation 0.9.4",+ "system-configuration-sys",+]++[[package]]+name = "system-configuration-sys"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"+dependencies = [+ "core-foundation-sys",+ "libc",+]++[[package]]+name = "taffy"+version = "0.6.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "136661daffcdfb128afb0d45a8f7e88078739196d64d7ffa47f8513f4a00a6d7"+dependencies = [+ "arrayvec",+ "grid 0.15.0",+ "num-traits",+ "serde",+ "slotmap",+]++[[package]]+name = "taffy"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a13e5d13f79d558b5d353a98072ca8ca0e99da429467804de959aa8c83c9a004"+dependencies = [+ "arrayvec",+ "grid 0.18.0",+ "serde",+ "slotmap",+]++[[package]]+name = "taffy"+version = "0.15.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3c8480887e8803986d96a7173729565520d4bbb721ad6b7ad6941a22897207aa"+dependencies = [+ "serde",+ "slotmap",+ "smallvec",+]++[[package]]+name = "take-until"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8bdb6fa0dfa67b38c1e66b7041ba9dcf23b99d8121907cd31c807a332f7a0bbb"++[[package]]+name = "tao-core-video-sys"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "271450eb289cb4d8d0720c6ce70c72c8c858c93dd61fc625881616752e6b98f6"+dependencies = [+ "cfg-if",+ "core-foundation-sys",+ "libc",+ "objc",+]++[[package]]+name = "tauri-winrt-notification"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f37a6c354fd28fc9e322ed9bd47e3959576dad28c9d58ea1cf888cce1c7ccb36"+dependencies = [+ "thiserror 2.0.21",+ "windows 0.62.2",+ "windows-version",+]++[[package]]+name = "tempfile"+version = "3.27.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"+dependencies = [+ "fastrand 2.5.0",+ "getrandom 0.4.3",+ "once_cell",+ "rustix 1.1.6",+ "windows-sys 0.61.2",+]++[[package]]+name = "tendril"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0"+dependencies = [+ "futf",+ "mac",+ "utf-8",+]++[[package]]+name = "termcolor"+version = "1.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"+dependencies = [+ "winapi-util",+]++[[package]]+name = "thiserror"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"+dependencies = [+ "thiserror-impl 1.0.69",+]++[[package]]+name = "thiserror"+version = "2.0.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e"+dependencies = [+ "thiserror-impl 2.0.21",+]++[[package]]+name = "thiserror-impl"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "thiserror-impl"+version = "2.0.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "tiff"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52"+dependencies = [+ "fax",+ "flate2",+ "half",+ "quick-error",+ "weezl",+ "zune-jpeg",+]++[[package]]+name = "time"+version = "0.3.55"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134"+dependencies = [+ "deranged",+ "num-conv",+ "powerfmt",+ "serde_core",+ "time-core",+]++[[package]]+name = "time-core"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109"++[[package]]+name = "tiny-keccak"+version = "2.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"+dependencies = [+ "crunchy",+]++[[package]]+name = "tiny-skia"+version = "0.11.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab"+dependencies = [+ "arrayref",+ "arrayvec",+ "bytemuck",+ "cfg-if",+ "log",+ "png 0.17.16",+ "tiny-skia-path",+]++[[package]]+name = "tiny-skia-path"+version = "0.11.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93"+dependencies = [+ "arrayref",+ "bytemuck",+ "strict-num",+]++[[package]]+name = "tinystr"+version = "0.8.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a"+dependencies = [+ "displaydoc",+ "serde_core",+ "zerovec",+]++[[package]]+name = "tinyvec"+version = "1.13.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"++[[package]]+name = "tokio"+version = "1.54.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3"+dependencies = [+ "bytes",+ "libc",+ "mio",+ "pin-project-lite",+ "socket2",+ "windows-sys 0.61.2",+]++[[package]]+name = "tokio-rustls"+version = "0.26.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db"+dependencies = [+ "rustls",+ "tokio",+]++[[package]]+name = "tokio-socks"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7e2948f60dbe26b35f2c7fb74ac2854c1fddded0fe9d7548fcc674a246f7615"+dependencies = [+ "either",+ "futures-util",+ "thiserror 1.0.69",+ "tokio",+]++[[package]]+name = "tokio-util"+version = "0.7.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b"+dependencies = [+ "bytes",+ "futures-core",+ "futures-sink",+ "libc",+ "pin-project-lite",+ "tokio",+]++[[package]]+name = "toml"+version = "0.8.23"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"+dependencies = [+ "serde",+ "serde_spanned 0.6.9",+ "toml_datetime 0.6.11",+ "toml_edit 0.22.27",+]++[[package]]+name = "toml"+version = "1.1.8+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d"+dependencies = [+ "indexmap",+ "serde_core",+ "serde_spanned 1.1.2",+ "toml_datetime 1.1.2+spec-1.1.0",+ "toml_parser",+ "toml_writer",+ "winnow 1.0.4",+]++[[package]]+name = "toml_datetime"+version = "0.6.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"+dependencies = [+ "serde",+]++[[package]]+name = "toml_datetime"+version = "1.1.2+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"+dependencies = [+ "serde_core",+]++[[package]]+name = "toml_edit"+version = "0.22.27"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"+dependencies = [+ "indexmap",+ "serde",+ "serde_spanned 0.6.9",+ "toml_datetime 0.6.11",+ "toml_write",+ "winnow 0.7.15",+]++[[package]]+name = "toml_edit"+version = "0.25.17+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c"+dependencies = [+ "indexmap",+ "toml_datetime 1.1.2+spec-1.1.0",+ "toml_parser",+ "winnow 1.0.4",+]++[[package]]+name = "toml_parser"+version = "1.1.5+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"+dependencies = [+ "winnow 1.0.4",+]++[[package]]+name = "toml_write"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"++[[package]]+name = "toml_writer"+version = "1.1.3+spec-1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770"++[[package]]+name = "tower"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"+dependencies = [+ "futures-core",+ "futures-util",+ "pin-project-lite",+ "sync_wrapper",+ "tokio",+ "tower-layer",+ "tower-service",+]++[[package]]+name = "tower-layer"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"++[[package]]+name = "tower-service"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"++[[package]]+name = "tracing"+version = "0.1.44"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"+dependencies = [+ "log",+ "pin-project-lite",+ "tracing-attributes",+ "tracing-core",+]++[[package]]+name = "tracing-attributes"+version = "0.1.31"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "tracing-core"+version = "0.1.36"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"+dependencies = [+ "once_cell",+]++[[package]]+name = "try-lock"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"++[[package]]+name = "ttf-parser"+version = "0.20.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4"++[[package]]+name = "ttf-parser"+version = "0.21.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8"++[[package]]+name = "ttf-parser"+version = "0.25.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"+dependencies = [+ "core_maths",+]++[[package]]+name = "typeid"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"++[[package]]+name = "typenum"+version = "1.20.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"++[[package]]+name = "uds_windows"+version = "1.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"+dependencies = [+ "memoffset",+ "tempfile",+ "windows-sys 0.61.2",+]++[[package]]+name = "unicase"+version = "2.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f"++[[package]]+name = "unicode-bidi"+version = "0.3.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"++[[package]]+name = "unicode-bidi-mirroring"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86"++[[package]]+name = "unicode-bidi-mirroring"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe"++[[package]]+name = "unicode-ccc"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1df77b101bcc4ea3d78dafc5ad7e4f58ceffe0b2b16bf446aeb50b6cb4157656"++[[package]]+name = "unicode-ccc"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e"++[[package]]+name = "unicode-ident"+version = "1.0.27"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"++[[package]]+name = "unicode-linebreak"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"++[[package]]+name = "unicode-properties"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"++[[package]]+name = "unicode-script"+version = "0.5.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "aa04c955db05429d464c74d495c1ee677e1866e783a4c3747f9c0cef7756cabf"++[[package]]+name = "unicode-segmentation"+version = "1.13.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"++[[package]]+name = "unicode-vo"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94"++[[package]]+name = "unicode-width"+version = "0.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557"++[[package]]+name = "untrusted"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"++[[package]]+name = "url"+version = "2.5.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"+dependencies = [+ "form_urlencoded",+ "idna",+ "percent-encoding",+ "serde",+ "serde_derive",+]++[[package]]+name = "usvg"+version = "0.45.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "80be9b06fbae3b8b303400ab20778c80bbaf338f563afe567cf3c9eea17b47ef"+dependencies = [+ "base64",+ "data-url",+ "flate2",+ "fontdb 0.23.0",+ "imagesize 0.13.0",+ "kurbo 0.11.3",+ "log",+ "pico-args",+ "roxmltree 0.20.0",+ "rustybuzz 0.20.1",+ "simplecss",+ "siphasher",+ "strict-num",+ "svgtypes 0.15.3",+ "tiny-skia-path",+ "unicode-bidi",+ "unicode-script",+ "unicode-vo",+ "xmlwriter",+]++[[package]]+name = "usvg"+version = "0.46.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e419dff010bb12512b0ae9e3d2f318dfbdf0167fde7eb05465134d4e8756076f"+dependencies = [+ "base64",+ "data-url",+ "flate2",+ "fontdb 0.23.0",+ "imagesize 0.14.0",+ "kurbo 0.13.1",+ "log",+ "pico-args",+ "roxmltree 0.21.2",+ "rustybuzz 0.20.1",+ "simplecss",+ "siphasher",+ "strict-num",+ "svgtypes 0.16.1",+ "tiny-skia-path",+ "unicode-bidi",+ "unicode-script",+ "unicode-vo",+ "xmlwriter",+]++[[package]]+name = "utf-8"+version = "0.7.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"++[[package]]+name = "utf8_iter"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0"+dependencies = [+ "utf_types",+]++[[package]]+name = "utf_types"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6"++[[package]]+name = "uuid"+version = "1.29.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514"+dependencies = [+ "getrandom 0.4.3",+ "js-sys",+ "serde_core",+ "sha1_smol",+ "wasm-bindgen",+]++[[package]]+name = "v_frame"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2"+dependencies = [+ "aligned-vec",+ "num-traits",+ "wasm-bindgen",+]++[[package]]+name = "value-bag"+version = "1.14.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2799ffb329a792ecfd902b71306c8a815a6ef1c0470fa9953a6aa4d4cecbe511"+dependencies = [+ "value-bag-serde1",+ "value-bag-sval2",+]++[[package]]+name = "value-bag-serde1"+version = "1.14.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0941feceafbe7a8f59ea1096d45b97002884a41306315ad797b3684b63a81d8c"+dependencies = [+ "erased-serde",+ "serde_core",+ "serde_fmt",+]++[[package]]+name = "value-bag-sval2"+version = "1.14.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "839752af8179287d27eb2b94164641b1ede9e60ab7424163388dc21ebd0508cd"+dependencies = [+ "sval",+ "sval_buffer",+ "sval_dynamic",+ "sval_fmt",+ "sval_json",+ "sval_ref",+ "sval_serde",+]++[[package]]+name = "version_check"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"++[[package]]+name = "vswhom"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b"+dependencies = [+ "libc",+ "vswhom-sys",+]++[[package]]+name = "vswhom-sys"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150"+dependencies = [+ "cc",+ "libc",+]++[[package]]+name = "waker-fn"+version = "1.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7"++[[package]]+name = "walkdir"+version = "2.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"+dependencies = [+ "same-file",+ "winapi-util",+]++[[package]]+name = "want"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b"+dependencies = [+ "try-lock",+]++[[package]]+name = "wasi"+version = "0.11.1+wasi-snapshot-preview1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"++[[package]]+name = "wasip2"+version = "1.0.4+wasi-0.2.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487"+dependencies = [+ "wit-bindgen",+]++[[package]]+name = "wasm-bindgen"+version = "0.2.130"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c"+dependencies = [+ "cfg-if",+ "rustversion",+ "wasm-bindgen-macro",+ "wasm-bindgen-shared",+]++[[package]]+name = "wasm-bindgen-futures"+version = "0.4.80"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5e14e0327cb5368ad60ccb22d04a9827a693c95a926d8d125e9fa39e0baec501"+dependencies = [+ "js-sys",+ "tokio",+ "wasm-bindgen",+]++[[package]]+name = "wasm-bindgen-macro"+version = "0.2.130"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9"+dependencies = [+ "quote",+ "wasm-bindgen-macro-support",+]++[[package]]+name = "wasm-bindgen-macro-support"+version = "0.2.130"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a"+dependencies = [+ "bumpalo",+ "proc-macro2",+ "quote",+ "syn 3.0.9",+ "wasm-bindgen-shared",+]++[[package]]+name = "wasm-bindgen-shared"+version = "0.2.130"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "wasm-streams"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65"+dependencies = [+ "futures-util",+ "js-sys",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+]++[[package]]+name = "wasm_thread"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b7516db7f32decdadb1c3b8deb1b7d78b9df7606c5cc2f6241737c2ab3a0258e"+dependencies = [+ "futures",+ "js-sys",+ "wasm-bindgen",+ "web-sys",+]++[[package]]+name = "wayland-backend"+version = "0.3.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078"+dependencies = [+ "cc",+ "downcast-rs",+ "rustix 1.1.6",+ "scoped-tls",+ "smallvec",+ "wayland-sys",+]++[[package]]+name = "wayland-client"+version = "0.31.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073"+dependencies = [+ "bitflags 2.13.2",+ "rustix 1.1.6",+ "wayland-backend",+ "wayland-scanner",+]++[[package]]+name = "wayland-cursor"+version = "0.31.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d"+dependencies = [+ "rustix 1.1.6",+ "wayland-client",+ "xcursor",+]++[[package]]+name = "wayland-protocols"+version = "0.31.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4"+dependencies = [+ "bitflags 2.13.2",+ "wayland-backend",+ "wayland-client",+ "wayland-scanner",+]++[[package]]+name = "wayland-protocols"+version = "0.32.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6"+dependencies = [+ "bitflags 2.13.2",+ "wayland-backend",+ "wayland-client",+ "wayland-scanner",+]++[[package]]+name = "wayland-protocols-plasma"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479"+dependencies = [+ "bitflags 2.13.2",+ "wayland-backend",+ "wayland-client",+ "wayland-protocols 0.31.2",+ "wayland-scanner",+]++[[package]]+name = "wayland-scanner"+version = "0.31.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0"+dependencies = [+ "proc-macro2",+ "quick-xml",+ "quote",+]++[[package]]+name = "wayland-sys"+version = "0.31.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be"+dependencies = [+ "dlib",+ "log",+ "once_cell",+ "pkg-config",+]++[[package]]+name = "web-sys"+version = "0.3.107"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88"+dependencies = [+ "js-sys",+ "wasm-bindgen",+]++[[package]]+name = "web-time"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"+dependencies = [+ "js-sys",+ "wasm-bindgen",+]++[[package]]+name = "weezl"+version = "0.1.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"++[[package]]+name = "wgpu"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e"+dependencies = [+ "arrayvec",+ "bitflags 2.13.2",+ "bytemuck",+ "cfg-if",+ "cfg_aliases",+ "document-features",+ "hashbrown 0.17.1",+ "js-sys",+ "log",+ "naga 30.0.1",+ "parking_lot",+ "portable-atomic",+ "profiling",+ "raw-window-handle",+ "smallvec",+ "static_assertions",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "web-sys",+ "wgpu-core",+ "wgpu-hal",+ "wgpu-types",+]++[[package]]+name = "wgpu-core"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14"+dependencies = [+ "arrayvec",+ "bit-set 0.10.0",+ "bit-vec 0.9.1",+ "bitflags 2.13.2",+ "bytemuck",+ "cfg_aliases",+ "document-features",+ "hashbrown 0.17.1",+ "indexmap",+ "log",+ "naga 30.0.1",+ "naga-types",+ "once_cell",+ "parking_lot",+ "portable-atomic",+ "profiling",+ "raw-window-handle",+ "rustc-hash 1.1.0",+ "smallvec",+ "thiserror 2.0.21",+ "wgpu-core-deps-apple",+ "wgpu-core-deps-emscripten",+ "wgpu-core-deps-wasm",+ "wgpu-core-deps-windows-linux-android",+ "wgpu-hal",+ "wgpu-naga-bridge",+ "wgpu-types",+]++[[package]]+name = "wgpu-core-deps-apple"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68"+dependencies = [+ "wgpu-hal",+]++[[package]]+name = "wgpu-core-deps-emscripten"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d98b86cf4abf524a902dd35f18ca6a3f08fc2ae9847c8f10b48e30491b1f0b86"+dependencies = [+ "wgpu-hal",+]++[[package]]+name = "wgpu-core-deps-wasm"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d260ca2ca8adc654f513a869bf3cac0b47f5b8d3f87803d6942015f8de597aae"+dependencies = [+ "wgpu-hal",+]++[[package]]+name = "wgpu-core-deps-windows-linux-android"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f"+dependencies = [+ "wgpu-hal",+]++[[package]]+name = "wgpu-hal"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58"+dependencies = [+ "android_system_properties",+ "arrayvec",+ "ash",+ "bit-set 0.10.0",+ "bitflags 2.13.2",+ "block2 0.6.2",+ "bytemuck",+ "cfg-if",+ "cfg_aliases",+ "glow 0.17.0",+ "glutin_wgl_sys",+ "gpu-allocator",+ "hashbrown 0.17.1",+ "js-sys",+ "khronos-egl",+ "libc",+ "libloading",+ "log",+ "naga 30.0.1",+ "naga-types",+ "ndk-sys",+ "objc2 0.6.5",+ "objc2-core-foundation",+ "objc2-core-graphics",+ "objc2-foundation 0.3.2",+ "objc2-metal 0.3.2",+ "objc2-quartz-core 0.3.2",+ "once_cell",+ "ordered-float",+ "parking_lot",+ "portable-atomic",+ "portable-atomic-util",+ "profiling",+ "range-alloc",+ "raw-window-handle",+ "raw-window-metal 1.1.0",+ "renderdoc-sys",+ "smallvec",+ "static_assertions",+ "thiserror 2.0.21",+ "wasm-bindgen",+ "wayland-sys",+ "web-sys",+ "wgpu-naga-bridge",+ "wgpu-types",+ "windows 0.62.2",+ "windows-core 0.62.2",+ "windows-result 0.4.1",+]++[[package]]+name = "wgpu-naga-bridge"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081"+dependencies = [+ "naga 30.0.1",+ "wgpu-types",+]++[[package]]+name = "wgpu-types"+version = "30.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286"+dependencies = [+ "bitflags 2.13.2",+ "bytemuck",+ "js-sys",+ "log",+ "naga-types",+ "raw-window-handle",+ "static_assertions",+ "web-sys",+]++[[package]]+name = "which"+version = "6.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f"+dependencies = [+ "either",+ "home",+ "rustix 0.38.44",+ "winsafe",+]++[[package]]+name = "which"+version = "8.0.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bae2f2b2b816647a1cab1acc91f5bd20812d53cb344382635ec2181940c8034f"+dependencies = [+ "libc",+]++[[package]]+name = "winapi"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"+dependencies = [+ "winapi-i686-pc-windows-gnu",+ "winapi-x86_64-pc-windows-gnu",+]++[[package]]+name = "winapi-i686-pc-windows-gnu"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"++[[package]]+name = "winapi-util"+version = "0.1.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"+dependencies = [+ "windows-sys 0.61.2",+]++[[package]]+name = "winapi-x86_64-pc-windows-gnu"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"++[[package]]+name = "windows"+version = "0.57.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"+dependencies = [+ "windows-core 0.57.0",+ "windows-targets 0.52.6",+]++[[package]]+name = "windows"+version = "0.61.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"+dependencies = [+ "windows-collections 0.2.0",+ "windows-core 0.61.2",+ "windows-future 0.2.1",+ "windows-link 0.1.3",+ "windows-numerics 0.2.0",+]++[[package]]+name = "windows"+version = "0.62.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"+dependencies = [+ "windows-collections 0.3.2",+ "windows-core 0.62.2",+ "windows-future 0.3.2",+ "windows-numerics 0.3.1",+]++[[package]]+name = "windows-capture"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3a4df73e95feddb9ec1a7e9c2ca6323b8c97d5eeeff78d28f1eccdf19c882b24"+dependencies = [+ "parking_lot",+ "rayon",+ "thiserror 2.0.21",+ "windows 0.61.3",+ "windows-future 0.2.1",+]++[[package]]+name = "windows-collections"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"+dependencies = [+ "windows-core 0.61.2",+]++[[package]]+name = "windows-collections"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"+dependencies = [+ "windows-core 0.62.2",+]++[[package]]+name = "windows-core"+version = "0.57.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"+dependencies = [+ "windows-implement 0.57.0",+ "windows-interface 0.57.0",+ "windows-result 0.1.2",+ "windows-targets 0.52.6",+]++[[package]]+name = "windows-core"+version = "0.61.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"+dependencies = [+ "windows-implement 0.60.2",+ "windows-interface 0.59.3",+ "windows-link 0.1.3",+ "windows-result 0.3.4",+ "windows-strings 0.4.2",+]++[[package]]+name = "windows-core"+version = "0.62.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"+dependencies = [+ "windows-implement 0.60.2",+ "windows-interface 0.59.3",+ "windows-link 0.2.1",+ "windows-result 0.4.1",+ "windows-strings 0.5.1",+]++[[package]]+name = "windows-future"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"+dependencies = [+ "windows-core 0.61.2",+ "windows-link 0.1.3",+ "windows-threading 0.1.0",+]++[[package]]+name = "windows-future"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"+dependencies = [+ "windows-core 0.62.2",+ "windows-link 0.2.1",+ "windows-threading 0.2.1",+]++[[package]]+name = "windows-implement"+version = "0.57.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "windows-implement"+version = "0.60.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "windows-interface"+version = "0.57.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "windows-interface"+version = "0.59.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "windows-link"+version = "0.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"++[[package]]+name = "windows-link"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"++[[package]]+name = "windows-numerics"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"+dependencies = [+ "windows-core 0.61.2",+ "windows-link 0.1.3",+]++[[package]]+name = "windows-numerics"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"+dependencies = [+ "windows-core 0.62.2",+ "windows-link 0.2.1",+]++[[package]]+name = "windows-registry"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3"+dependencies = [+ "windows-result 0.3.4",+ "windows-strings 0.3.1",+ "windows-targets 0.53.5",+]++[[package]]+name = "windows-registry"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e"+dependencies = [+ "windows-link 0.1.3",+ "windows-result 0.3.4",+ "windows-strings 0.4.2",+]++[[package]]+name = "windows-registry"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"+dependencies = [+ "windows-link 0.2.1",+ "windows-result 0.4.1",+ "windows-strings 0.5.1",+]++[[package]]+name = "windows-result"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"+dependencies = [+ "windows-targets 0.52.6",+]++[[package]]+name = "windows-result"+version = "0.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"+dependencies = [+ "windows-link 0.1.3",+]++[[package]]+name = "windows-result"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"+dependencies = [+ "windows-link 0.2.1",+]++[[package]]+name = "windows-strings"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319"+dependencies = [+ "windows-link 0.1.3",+]++[[package]]+name = "windows-strings"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"+dependencies = [+ "windows-link 0.1.3",+]++[[package]]+name = "windows-strings"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"+dependencies = [+ "windows-link 0.2.1",+]++[[package]]+name = "windows-sys"+version = "0.48.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"+dependencies = [+ "windows-targets 0.48.5",+]++[[package]]+name = "windows-sys"+version = "0.52.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"+dependencies = [+ "windows-targets 0.52.6",+]++[[package]]+name = "windows-sys"+version = "0.59.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"+dependencies = [+ "windows-targets 0.52.6",+]++[[package]]+name = "windows-sys"+version = "0.61.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"+dependencies = [+ "windows-link 0.2.1",+]++[[package]]+name = "windows-targets"+version = "0.48.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"+dependencies = [+ "windows_aarch64_gnullvm 0.48.5",+ "windows_aarch64_msvc 0.48.5",+ "windows_i686_gnu 0.48.5",+ "windows_i686_msvc 0.48.5",+ "windows_x86_64_gnu 0.48.5",+ "windows_x86_64_gnullvm 0.48.5",+ "windows_x86_64_msvc 0.48.5",+]++[[package]]+name = "windows-targets"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"+dependencies = [+ "windows_aarch64_gnullvm 0.52.6",+ "windows_aarch64_msvc 0.52.6",+ "windows_i686_gnu 0.52.6",+ "windows_i686_gnullvm 0.52.6",+ "windows_i686_msvc 0.52.6",+ "windows_x86_64_gnu 0.52.6",+ "windows_x86_64_gnullvm 0.52.6",+ "windows_x86_64_msvc 0.52.6",+]++[[package]]+name = "windows-targets"+version = "0.53.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"+dependencies = [+ "windows-link 0.2.1",+ "windows_aarch64_gnullvm 0.53.1",+ "windows_aarch64_msvc 0.53.1",+ "windows_i686_gnu 0.53.1",+ "windows_i686_gnullvm 0.53.1",+ "windows_i686_msvc 0.53.1",+ "windows_x86_64_gnu 0.53.1",+ "windows_x86_64_gnullvm 0.53.1",+ "windows_x86_64_msvc 0.53.1",+]++[[package]]+name = "windows-threading"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"+dependencies = [+ "windows-link 0.1.3",+]++[[package]]+name = "windows-threading"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"+dependencies = [+ "windows-link 0.2.1",+]++[[package]]+name = "windows-version"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631"+dependencies = [+ "windows-link 0.2.1",+]++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.48.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"++[[package]]+name = "windows_aarch64_msvc"+version = "0.48.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"++[[package]]+name = "windows_aarch64_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"++[[package]]+name = "windows_aarch64_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"++[[package]]+name = "windows_i686_gnu"+version = "0.48.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"++[[package]]+name = "windows_i686_gnu"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"++[[package]]+name = "windows_i686_gnu"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"++[[package]]+name = "windows_i686_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"++[[package]]+name = "windows_i686_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"++[[package]]+name = "windows_i686_msvc"+version = "0.48.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"++[[package]]+name = "windows_i686_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"++[[package]]+name = "windows_i686_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"++[[package]]+name = "windows_x86_64_gnu"+version = "0.48.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"++[[package]]+name = "windows_x86_64_gnu"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"++[[package]]+name = "windows_x86_64_gnu"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.48.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"++[[package]]+name = "windows_x86_64_msvc"+version = "0.48.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"++[[package]]+name = "windows_x86_64_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"++[[package]]+name = "windows_x86_64_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"++[[package]]+name = "winnow"+version = "0.7.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"+dependencies = [+ "memchr",+]++[[package]]+name = "winnow"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"+dependencies = [+ "memchr",+]++[[package]]+name = "winreg"+version = "0.56.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10"+dependencies = [+ "cfg-if",+ "windows-sys 0.61.2",+]++[[package]]+name = "winsafe"+version = "0.0.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"++[[package]]+name = "wio"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5"+dependencies = [+ "winapi",+]++[[package]]+name = "wit-bindgen"+version = "0.57.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"++[[package]]+name = "writeable"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc"++[[package]]+name = "x11"+version = "2.21.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e"+dependencies = [+ "libc",+ "pkg-config",+]++[[package]]+name = "x11-clipboard"+version = "0.9.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "662d74b3d77e396b8e5beb00b9cad6a9eccf40b2ef68cc858784b14c41d535a3"+dependencies = [+ "libc",+ "x11rb",+]++[[package]]+name = "x11rb"+version = "0.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"+dependencies = [+ "as-raw-xcb-connection",+ "gethostname",+ "libc",+ "rustix 1.1.6",+ "x11rb-protocol",+ "xcursor",+]++[[package]]+name = "x11rb-protocol"+version = "0.13.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd"++[[package]]+name = "xattr"+version = "0.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc"+dependencies = [+ "libc",+]++[[package]]+name = "xcb"+version = "1.7.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a6c2ad15e0e922856ee89afe862b8992334bbe7953adad56cd1199358cb30566"+dependencies = [+ "bitflags 2.13.2",+ "libc",+ "quick-xml",+ "x11",+]++[[package]]+name = "xcursor"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23"++[[package]]+name = "xim-ctext"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2ac61a7062c40f3c37b6e82eeeef835d5cc7824b632a72784a89b3963c33284c"+dependencies = [+ "encoding_rs",+]++[[package]]+name = "xim-parser"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5dcee45f89572d5a65180af3a84e7ddb24f5ea690a6d3aa9de231281544dd7b7"+dependencies = [+ "bitflags 2.13.2",+]++[[package]]+name = "xkbcommon"+version = "0.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8d66ca9352cbd4eecbbc40871d8a11b4ac8107cfc528a6e14d7c19c69d0e1ac9"+dependencies = [+ "as-raw-xcb-connection",+ "libc",+ "memmap2",+ "xkeysym",+]++[[package]]+name = "xkeysym"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56"++[[package]]+name = "xml-rs"+version = "0.8.29"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7"++[[package]]+name = "xmlwriter"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"++[[package]]+name = "y4m"+version = "0.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"++[[package]]+name = "yazi"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac366ea532fa8ee6a992cec9dea525b1dc284e69702f36c2ab5fbebadc81ec86"++[[package]]+name = "yeslogic-fontconfig-sys"+version = "6.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76"+dependencies = [+ "dlib",+ "once_cell",+ "pkg-config",+]++[[package]]+name = "yoke"+version = "0.8.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3"+dependencies = [+ "stable_deref_trait",+ "yoke-derive",+ "zerofrom",+]++[[package]]+name = "yoke-derive"+version = "0.8.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+ "synstructure",+]++[[package]]+name = "zbus"+version = "5.19.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907"+dependencies = [+ "async-broadcast",+ "async-executor",+ "async-io",+ "async-lock",+ "async-process",+ "async-recursion",+ "async-task",+ "async-trait",+ "blocking",+ "enumflags2",+ "event-listener 5.4.2",+ "futures-core",+ "futures-lite 2.6.1",+ "hex",+ "libc",+ "ordered-stream",+ "rustix 1.1.6",+ "serde",+ "serde_repr",+ "tracing",+ "uds_windows",+ "uuid",+ "windows-sys 0.61.2",+ "winnow 1.0.4",+ "zbus_macros",+ "zbus_names",+ "zvariant",+]++[[package]]+name = "zbus_macros"+version = "5.19.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40"+dependencies = [+ "proc-macro-crate",+ "proc-macro2",+ "quote",+ "syn 3.0.9",+ "zbus_names",+ "zvariant",+ "zvariant_utils",+]++[[package]]+name = "zbus_names"+version = "4.3.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd"+dependencies = [+ "serde",+ "winnow 1.0.4",+ "zvariant",+]++[[package]]+name = "zcheapstr"+version = "1.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "939f186d9ecebe044315a5cb6d6f78568bbc21152adc954d5a0c2f58bdbc9920"+dependencies = [+ "serde",+]++[[package]]+name = "zed-async-tar"+version = "0.5.0-zed"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6cf4b5f655e29700e473cb1acd914ab112b37b62f96f7e642d5fc6a0c02eb881"+dependencies = [+ "async-std",+ "filetime",+ "libc",+ "pin-project",+ "redox_syscall 0.2.16",+ "xattr",+]++[[package]]+name = "zed-font-kit"+version = "0.14.1-zed"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a3898e450f36f852edda72e3f985c34426042c4951790b23b107f93394f9bff5"+dependencies = [+ "bitflags 2.13.2",+ "byteorder",+ "core-foundation 0.10.0",+ "core-graphics 0.24.0",+ "core-text",+ "dirs 5.0.1",+ "dwrote",+ "float-ord",+ "freetype-sys",+ "lazy_static",+ "libc",+ "log",+ "pathfinder_geometry",+ "pathfinder_simd",+ "walkdir",+ "winapi",+ "yeslogic-fontconfig-sys",+]++[[package]]+name = "zed-reqwest"+version = "0.12.15-zed"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac2d05756ff48539950c3282ad7acf3817ad3f08797c205ad1c34a2ce03b9970"+dependencies = [+ "base64",+ "bytes",+ "encoding_rs",+ "futures-core",+ "futures-util",+ "h2",+ "http",+ "http-body",+ "http-body-util",+ "hyper",+ "hyper-rustls",+ "hyper-util",+ "ipnet",+ "js-sys",+ "log",+ "mime",+ "mime_guess",+ "once_cell",+ "percent-encoding",+ "pin-project-lite",+ "quinn",+ "rustls",+ "rustls-native-certs",+ "rustls-pemfile",+ "rustls-pki-types",+ "serde",+ "serde_json",+ "serde_urlencoded",+ "sync_wrapper",+ "system-configuration",+ "tokio",+ "tokio-rustls",+ "tokio-socks",+ "tokio-util",+ "tower",+ "tower-service",+ "url",+ "wasm-bindgen",+ "wasm-bindgen-futures",+ "wasm-streams",+ "web-sys",+ "windows-registry 0.4.0",+]++[[package]]+name = "zed-scap"+version = "0.0.8-zed"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6b338d705ae33a43ca00287c11129303a7a0aa57b101b72a1c08c863f698ac8"+dependencies = [+ "anyhow",+ "cocoa 0.25.0",+ "core-graphics-helmer-fork",+ "log",+ "objc",+ "rand 0.8.8",+ "screencapturekit",+ "screencapturekit-sys",+ "sysinfo",+ "tao-core-video-sys",+ "windows 0.61.3",+ "windows-capture",+ "x11",+ "xcb",+]++[[package]]+name = "zed-xim"+version = "0.4.0-zed"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0c0b46ed118eba34d9ba53d94ddc0b665e0e06a2cf874cfa2dd5dec278148642"+dependencies = [+ "ahash",+ "hashbrown 0.14.5",+ "log",+ "x11rb",+ "xim-ctext",+ "xim-parser",+]++[[package]]+name = "zeno"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"++[[package]]+name = "zerocopy"+version = "0.8.63"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8"+dependencies = [+ "zerocopy-derive",+]++[[package]]+name = "zerocopy-derive"+version = "0.8.63"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "zerofrom"+version = "0.1.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272"+dependencies = [+ "zerofrom-derive",+]++[[package]]+name = "zerofrom-derive"+version = "0.1.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+ "synstructure",+]++[[package]]+name = "zeroize"+version = "1.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"+dependencies = [+ "zeroize_derive",+]++[[package]]+name = "zeroize_derive"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.119",+]++[[package]]+name = "zerotrie"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f"+dependencies = [+ "displaydoc",+ "yoke",+ "zerofrom",+ "zerovec",+]++[[package]]+name = "zerovec"+version = "0.11.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40"+dependencies = [+ "serde",+ "yoke",+ "zerofrom",+ "zerovec-derive",+]++[[package]]+name = "zerovec-derive"+version = "0.11.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.9",+]++[[package]]+name = "zlib-rs"+version = "0.6.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"++[[package]]+name = "zmij"+version = "1.0.23"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"++[[package]]+name = "zune-core"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b"++[[package]]+name = "zune-inflate"+version = "0.2.54"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"+dependencies = [+ "simd-adler32",+]++[[package]]+name = "zune-jpeg"+version = "0.5.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"+dependencies = [+ "zune-core",+]++[[package]]+name = "zvariant"+version = "5.15.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7"+dependencies = [+ "endi",+ "enumflags2",+ "serde",+ "serde_bytes",+ "url",+ "winnow 1.0.4",+ "zcheapstr",+ "zvariant_derive",+ "zvariant_utils",+]++[[package]]+name = "zvariant_derive"+version = "5.15.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d"+dependencies = [+ "proc-macro-crate",+ "proc-macro2",+ "quote",+ "syn 3.0.9",+ "zvariant_utils",+]++[[package]]+name = "zvariant_utils"+version = "4.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3"+dependencies = [+ "proc-macro2",+ "quote",+ "serde",+ "syn 3.0.9",+ "winnow 1.0.4",+]diff --git a/bindings/rust/bench/Cargo.toml b/bindings/rust/bench/Cargo.tomlnew file mode 100644index 0000000..e4e1044--- /dev/null+++ b/bindings/rust/bench/Cargo.toml@@ -0,0 +1,8 @@+# Benchmark: the same UI on blenderui and on gpui (Zed's framework).+# Separate workspace so gpui's dependencies never touch the main crates.+[workspace]+resolver = "2"+members = ["bui-bench", "gpui-bench", "gpui-fast-bench"]++[profile.release]+debug = falsediff --git a/bindings/rust/bench/README.md b/bindings/rust/bench/README.mdnew file mode 100644index 0000000..5b5b0a1--- /dev/null+++ b/bindings/rust/bench/README.md@@ -0,0 +1,114 @@+# blenderui vs gpui vs gpui-fast++The same UI on three frameworks:+- `bui-bench`: blenderui.+- `gpui-bench`: [gpui](https://crates.io/crates/gpui) 0.2.2, Zed's GPU-rendered framework.+- `gpui-fast-bench`: [gpui-fast](https://github.com/longbridge/gpui-fast) 0.1.13, a gpui fork with rendering and layout optimizations.++Both gpui apps compile the identical source file (`gpui-bench/src/scene.rs`).+The scene is a 1000×800 window filled with N cells (a rounded, coloured box+with a centred number), built with the same element tree in both+(`div().w(..).h(..).bg(..).rounded(..).flex().items_center().child(label)`).++- **anim**: every frame changes every cell's colour and number, and the view+ calls `window.request_animation_frame()`. That's the worst case: full+ re-render, re-layout and re-paint every frame.+- **idle**: the scene renders once and then nothing changes.+- **blenderui (uncapped)**: animation without vsync pacing (`--uncapped`).++## Running++```sh+cd bindings/rust/bench+set GPUI_FXC_PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\fxc.exe # gpui needs fxc.exe+cargo build --release+py run.py --reps 3 # ~12 minutes; prints a Markdown table, writes results.json+```++Each app measures itself with the same code (`common/measure.rs`):+- **Warm-up and window:** 3 s warm-up, then a 10 s measured window.+- **CPU:** process CPU **cycles** across all threads (`QueryProcessCycleTime`), converted to time with the TSC frequency calibrated during warm-up.+- **Frames and memory:** frames rendered, the working set sampled every 100 ms, and private bytes at the end.+- **GPU:** `run.py` also samples each process's GPU 3D-engine utilisation and GPU memory from the Windows performance counters, because GPU work isn't process CPU time.++Every configuration ran 3 times, and the table shows the medians.++> An earlier version of this benchmark used `GetProcessTimes`. Windows charges+> that per ~15.6 ms clock tick, which aliases with a 60 Hz frame loop and+> under-reported CPU badly (gpui at 1000 cells showed 6.3 ms per frame; it+> really uses 19 ms). All numbers below use the cycle counter.++## Results++Ryzen 7 5800U (8 cores / 16 threads, laptop, plugged in), AMD Radeon iGPU,+60 Hz display, Windows 11, release builds. All three apps ran back to back in+one session, 3 runs each, medians shown.++| App | Cells | Mode | FPS | CPU % (1 core = 100) | CPU ms / frame | GPU 3D % | RAM working set MB | Private MB | GPU memory MB | First frame ms |+|---|---:|---|---:|---:|---:|---:|---:|---:|---:|---:|+| gpui | 100 | anim | 60.1 | 18.8 | 3.12 | 5.4 | 33.5 | 35.8 | 16.1 | 225 |+| gpui-fast | 100 | anim | 60.0 | 8.1 | 1.35 | 2.2 | 35.6 | 40.3 | 19.1 | 206 |+| blenderui | 100 | anim | 60.1 | 38.1 | 6.33 | 0 | 22.3 | 12.9 | 0 | 7 |+| gpui | 100 | idle | 0.0 | 1.1 | 0 | 0.0 | 33.3 | 35.4 | 16.1 | 219 |+| gpui-fast | 100 | idle | 0.0 | 0.1 | 0 | 0.0 | 34.4 | 39.4 | 18.8 | 201 |+| blenderui | 100 | idle | 0.1 | 0.2 | 0 | - | 19.9 | 9.9 | 0 | 6 |+| blenderui (uncapped) | 100 | anim | 494.1 | 259.2 | 5.25 | 0 | 22.9 | 13.4 | 0 | 7 |+| gpui | 1000 | anim | 60.1 | 94.1 | 15.66 | 6.8 | 47.9 | 52.0 | 17.1 | 223 |+| gpui-fast | 1000 | anim | 60.0 | 49.7 | 8.27 | 7.9 | 44.8 | 51.1 | 19.9 | 203 |+| blenderui | 1000 | anim | 60.1 | 99.7 | 16.59 | 0 | 26.8 | 17.8 | 0 | 8 |+| gpui | 1000 | idle | 0.3 | 3.7 | 0 | 0.8 | 47.0 | 51.1 | 17.1 | 219 |+| gpui-fast | 1000 | idle | 0.2 | 0.5 | 0 | 0.0 | 44.1 | 50.3 | 19.9 | 200 |+| blenderui | 1000 | idle | 0.0 | 0.1 | 0 | - | 22.8 | 12.8 | 0 | 5 |+| blenderui (uncapped) | 1000 | anim | 96.7 | 165.4 | 16.85 | 0 | 27.3 | 17.6 | 0 | 7 |+| gpui | 3000 | anim | 22.8 | 100.6 | 44.09 | 4.2 | 77.5 | 94.9 | 20.6 | 215 |+| gpui-fast | 3000 | anim | 29.7 | 54.7 | 18.42 | 4.5 | 64.7 | 85.3 | 23.5 | 213 |+| blenderui | 3000 | anim | 32.6 | 129.7 | 39.67 | 0 | 36.3 | 31.6 | 0 | 5 |+| gpui | 3000 | idle | 0.0 | 0.9 | 0 | 0.0 | 75.2 | 92.3 | 20.6 | 233 |+| gpui-fast | 3000 | idle | 0.0 | 0.1 | 0 | 0.0 | 61.6 | 81.4 | 20.9 | 201 |+| blenderui | 3000 | idle | 0.2 | 1.0 | 0 | - | 27.8 | 19.3 | 0 | 6 |+| blenderui (uncapped) | 3000 | anim | 31.4 | 128.6 | 40.97 | 0 | 35.4 | 37.8 | 0 | 6 |++blenderui has no GPU counter instances (shown as 0): it draws on the CPU. `CPU %`+counts all threads, so above 100 means more than one core.++## What it says++| Animated cells | blenderui | gpui-fast | gpui |+|---|---:|---:|---:|+| 100 | 60 (500 uncapped) | 60 | 60 |+| 1000 | 60 (97 uncapped) | 60 | 60 |+| 3000 | **32.6** | 29.7 | 22.8 |+| CPU ms / frame at 3000 | 39.7 | **18.4** (+GPU) | 44.1 (+GPU) |+| RAM working set at 3000 | **36 MB** | 65 MB (+24 MB GPU) | 78 MB (+21 MB GPU) |+| First frame | **~6 ms** | ~205 ms | ~220 ms |++- **FPS:** at the display cap (100 and 1000 cells) all three tie at 60. At 3000 cells blenderui is fastest: 10 % ahead of gpui-fast (per-run ranges 30.3-32.9 vs 29.7-29.9) and 43 % ahead of gpui. Uncapped, blenderui reaches 97 fps at 1000 cells; the gpui apps can't run uncapped.+- **CPU efficiency: gpui-fast is best,** about 2× less CPU per frame than blenderui on the large scene, plus a little GPU. Its 3000-cell frame rate is held back by something other than CPU (it uses half a core), while blenderui uses 1.3 cores to get there.+- **Memory and startup: blenderui wins clearly.** It uses 1.8-2.2× less working set and 2.7-3.2× less private memory, holds no GPU memory, and shows its first frame about 35× sooner.+- **Idle:** blenderui and gpui-fast both use about 0.1 % CPU; gpui uses about 1 %.+- **gpui across sessions:** at 1000 cells it measured 51 fps in an earlier session and 60 in this one, which is why these numbers come from one session.++## Caveats++- One laptop, one display (60 Hz caps both), the iGPU. A discrete GPU would make gpui's GPU share smaller still.+- Laptop clocks vary between sessions. gpui's 1000-cell scene measured 51 fps in this run and 45-60 fps in earlier ones, so the medians are from runs made back to back in one session.+- blenderui's root is wrapped in `body().m_0()` so its grid fills the window exactly like gpui's root `div`.+- **Where gpui can't win:** gpui uses a parallel GPU, so a much larger window or a high-DPI display shifts work its way. Every blenderui pixel is CPU work (spread over up to 8 threads).+- `CPU ms / frame` for gpui excludes its GPU work. Compare it together with the GPU column.++## How blenderui got here++The first version of this benchmark had blenderui at 29 fps (1000 cells) and 12 fps (3000 cells). These changes, all general-purpose, got it to 60 and 34. `BUI_PROFILE=1` prints the per-phase frame times they were found with.++| Change | Where | Effect at 3000 cells |+|---|---|---|+| **Parallel canvas raster:** horizontal bands on the Win32 thread pool. Text is prepared on one thread and drawn read-only from all of them. The pixels are identical to serial drawing (`BUI_RASTER_THREADS=1` forces serial) | `kit_frame.c`, `gpu_raster.c` | raster 8.6 → 2.7 ms |+| **Fill-only rounded rects** use the span-filling `BUI_raster_round_rect` instead of the general widget-base routine | `kit_frame.c` | raster 11.8 → 4.6 ms (headless) |+| **Style sharing:** elements with the same parent style, matched rules and declarations reuse one computed style (as browsers do) | `layout.rs` | cascade 12 → 3.3 ms |+| **Interned and typed CSS values:** `.w(px(40.0))` and `.bg(rgb(..))` reuse tokens cached by the number's bits instead of formatting and re-parsing a string | `css.rs`, `styled.rs` | `render()` 7.4 → 3.6 ms |+| **Rule index:** stylesheet rules are bucketed by their subject's id, class and tag | `css.rs` | selector matching about 5 → 0.4 ms |+| **Fewer allocations:** text runs are moved rather than copied, text-width lookups don't allocate, the key map is built lazily, text is passed to the kit as a C string once | `layout.rs`, `text.rs`, `paint.rs` | about 3 ms |+| **No overdraw:** a background identical to the one under it isn't painted, and the kit skips its clear when the page is opaque | `paint.rs`, `kit_core.c` | about 1 ms |+| **Frame pacing:** animation frames rebuild right before the render (`BK_window_request_frame`). A frame that is already late doesn't wait for another vblank | `kit_window.c`, `window.rs` | removes 10 ms timer and vsync quantisation stalls |++Still single-threaded and the largest remaining costs are the cascade, box tree and taffy layout (about 20 ms at 3000 cells): incremental restyling and layout would be the next step.diff --git a/bindings/rust/bench/bui-bench/Cargo.toml b/bindings/rust/bench/bui-bench/Cargo.tomlnew file mode 100644index 0000000..eb942be--- /dev/null+++ b/bindings/rust/bench/bui-bench/Cargo.toml@@ -0,0 +1,8 @@+[package]+name = "bui-bench"+version = "0.1.0"+edition = "2024"+publish = false++[dependencies]+blenderui = { path = "../../blenderui" }diff --git a/bindings/rust/bench/bui-bench/src/main.rs b/bindings/rust/bench/bui-bench/src/main.rsnew file mode 100644index 0000000..ce865aa--- /dev/null+++ b/bindings/rust/bench/bui-bench/src/main.rs@@ -0,0 +1,64 @@+//! The benchmark scene on blenderui (same element tree as gpui-bench).++#[path = "../../common/measure.rs"]+mod measure;++use blenderui::prelude::*;++struct Scene {+ cells: usize,+ animate: bool,+ t: u64,+}++impl Render for Scene {+ fn render(&mut self, window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {+ measure::frame();+ let cfg = measure::Config::from_args();+ let (_, w, h, font) = cfg.grid();+ let t = self.t;+ if self.animate {+ self.t += 1;+ window.request_animation_frame();+ }+ // gpui's root fills the window: no <body> margin+ body().m_0().size_full().child(div()+ .size_full()+ .bg(rgb(0x303030))+ .flex()+ .flex_wrap()+ .content_start()+ .gap(px(2.0))+ .p(px(2.0))+ .children((0..self.cells).map(|i| {+ div()+ .w(px(w))+ .h(px(h))+ .bg(rgb(measure::cell_color(i, t)))+ .rounded(px(3.0))+ .flex()+ .items_center()+ .justify_center()+ .text_size(px(font))+ .text_color(rgb(0xffffff))+ .child(measure::cell_label(i, t))+ })))+ }+}++fn main() {+ let cfg = measure::Config::from_args();+ measure::start("blenderui", &cfg);+ let uncapped = std::env::args().any(|a| a == "--uncapped");+ Application::new().run(move |cx: &mut App| {+ let bounds = Bounds { origin: point(px(0.0), px(0.0)), size: size(px(cfg.width), px(cfg.height)) };+ cx.open_window(+ WindowOptions { window_bounds: Some(WindowBounds::Windowed(bounds)), ..Default::default() },+ |window, cx| {+ window.set_vsync(!uncapped);+ cx.new(|_| Scene { cells: cfg.cells, animate: cfg.animate, t: 0 })+ },+ )+ .unwrap();+ });+}diff --git a/bindings/rust/bench/common/measure.rs b/bindings/rust/bench/common/measure.rsnew file mode 100644index 0000000..e78a76e--- /dev/null+++ b/bindings/rust/bench/common/measure.rs@@ -0,0 +1,190 @@+//! Shared by both benchmark apps: the scene parameters and the measurement.+//!+//! A background thread waits for the warm-up, snapshots process CPU time,+//! memory and the frame counter, waits for the measured window, snapshots+//! again, prints one JSON line and exits the process. Nothing here depends on+//! the UI framework, so both apps are measured the same way.++#![allow(dead_code)]++use std::sync::atomic::{AtomicU64, Ordering};+use std::time::{Duration, Instant};++pub static FRAMES: AtomicU64 = AtomicU64::new(0);++pub struct Config {+ pub cells: usize,+ pub animate: bool,+ pub warmup: f64,+ pub seconds: f64,+ pub width: f32,+ pub height: f32,+}++impl Config {+ pub fn from_args() -> Config {+ let args: Vec<String> = std::env::args().collect();+ let get = |k: &str, d: &str| {+ args.iter().position(|a| a == k).and_then(|i| args.get(i + 1)).cloned()+ .unwrap_or_else(|| d.to_owned())+ };+ Config {+ cells: get("--cells", "100").parse().unwrap(),+ animate: get("--mode", "anim") == "anim",+ warmup: get("--warmup", "3").parse().unwrap(),+ seconds: get("--seconds", "10").parse().unwrap(),+ width: 1000.0,+ height: 800.0,+ }+ }++ /// Grid of cells filling the window: (columns, cell width, cell height, font size).+ pub fn grid(&self) -> (usize, f32, f32, f32) {+ let gap = 2.0;+ let cols = ((self.cells as f32 * self.width / self.height).sqrt().ceil() as usize).max(1);+ let rows = self.cells.div_ceil(cols);+ let w = (self.width - gap) / cols as f32 - gap;+ let h = (self.height - gap) / rows as f32 - gap;+ (cols, w.floor(), h.floor(), (h * 0.55).clamp(8.0, 14.0).floor())+ }+}++/// The colour of cell `i` at frame `t` (0xRRGGBB), the same in both apps.+pub fn cell_color(i: usize, t: u64) -> u32 {+ let h = ((i as u64 * 7 + t * 3) % 360) as f32 / 60.0;+ let (s, v) = (0.55f32, 0.75f32);+ let c = v * s;+ let x = c * (1.0 - (h % 2.0 - 1.0).abs());+ let (r, g, b) = match h as u32 {+ 0 => (c, x, 0.0),+ 1 => (x, c, 0.0),+ 2 => (0.0, c, x),+ 3 => (0.0, x, c),+ 4 => (x, 0.0, c),+ _ => (c, 0.0, x),+ };+ let m = v - c;+ let byte = |f: f32| ((f + m) * 255.0).round() as u32;+ (byte(r) << 16) | (byte(g) << 8) | byte(b)+}++/// The label of cell `i` at frame `t`.+pub fn cell_label(i: usize, t: u64) -> String {+ format!("{}", (i as u64 * 13 + t) % 1000)+}++pub fn frame() -> u64 {+ FRAMES.fetch_add(1, Ordering::Relaxed)+}++#[repr(C)]+#[derive(Default)]+struct FileTime {+ lo: u32,+ hi: u32,+}++#[repr(C)]+#[derive(Default)]+struct MemCounters {+ cb: u32,+ page_faults: u32,+ peak_working_set: usize,+ working_set: usize,+ quota_peak_paged: usize,+ quota_paged: usize,+ quota_peak_nonpaged: usize,+ quota_nonpaged: usize,+ pagefile: usize,+ peak_pagefile: usize,+ private_bytes: usize,+}++#[link(name = "kernel32")]+unsafe extern "system" {+ fn GetCurrentProcess() -> isize;+ fn GetProcessTimes(p: isize, c: *mut FileTime, e: *mut FileTime, k: *mut FileTime, u: *mut FileTime) -> i32;+ fn K32GetProcessMemoryInfo(p: isize, m: *mut MemCounters, cb: u32) -> i32;+ fn QueryProcessCycleTime(p: isize, cycles: *mut u64) -> i32;+}++/// CPU cycles used by every thread of the process. Unlike GetProcessTimes+/// (charged per ~15.6 ms clock tick, which aliases with a 60 Hz frame loop)+/// this is exact; `tsc_hz` turns it into time.+fn cpu_cycles() -> u64 {+ let mut c = 0u64;+ unsafe { QueryProcessCycleTime(GetCurrentProcess(), &mut c) };+ c+}++/// The cycle counter's frequency, measured against the wall clock.+fn tsc_hz(over: Duration) -> f64 {+ let (t0, c0) = (Instant::now(), unsafe { core::arch::x86_64::_rdtsc() });+ std::thread::sleep(over);+ let (t1, c1) = (Instant::now(), unsafe { core::arch::x86_64::_rdtsc() });+ (c1 - c0) as f64 / (t1 - t0).as_secs_f64()+}++/// Process CPU time (user + kernel), all threads.+fn cpu_time() -> Duration {+ let (mut c, mut e, mut k, mut u) = Default::default();+ unsafe { GetProcessTimes(GetCurrentProcess(), &mut c, &mut e, &mut k, &mut u) };+ let t = |f: &FileTime| ((f.hi as u64) << 32 | f.lo as u64) * 100;+ Duration::from_nanos(t(&k) + t(&u))+}++fn memory() -> MemCounters {+ let mut m = MemCounters { cb: std::mem::size_of::<MemCounters>() as u32, ..Default::default() };+ unsafe { K32GetProcessMemoryInfo(GetCurrentProcess(), &mut m, m.cb) };+ m+}++/// Start the measuring thread. `name` labels the JSON line.+pub fn start(name: &'static str, cfg: &Config) {+ let (warmup, secs, cells, animate) = (cfg.warmup, cfg.seconds, cfg.cells, cfg.animate);+ let launched = Instant::now();+ std::thread::spawn(move || {+ // time to first frame+ let first = loop {+ if FRAMES.load(Ordering::Relaxed) > 0 {+ break launched.elapsed();+ }+ if launched.elapsed() > Duration::from_secs(30) {+ break Duration::ZERO;+ }+ std::thread::sleep(Duration::from_millis(1));+ };+ let hz = tsc_hz(Duration::from_secs_f64(warmup));+ let (w0, c0, f0) = (Instant::now(), cpu_cycles(), FRAMES.load(Ordering::Relaxed));+ let t0 = cpu_time();+ let mut peak_ws = 0usize;+ let mut ws_sum = 0f64;+ let mut samples = 0u32;+ while w0.elapsed().as_secs_f64() < secs {+ std::thread::sleep(Duration::from_millis(100));+ let m = memory();+ peak_ws = peak_ws.max(m.working_set);+ ws_sum += m.working_set as f64;+ samples += 1;+ }+ let (wall, frames) = (w0.elapsed(), FRAMES.load(Ordering::Relaxed) - f0);+ let cpu = Duration::from_secs_f64((cpu_cycles() - c0) as f64 / hz);+ let _tick_based = cpu_time() - t0; // GetProcessTimes, kept for comparison when debugging+ let m = memory();+ let mb = |b: f64| b / (1024.0 * 1024.0);+ println!(+ "{{\"app\":\"{name}\",\"cells\":{cells},\"mode\":\"{}\",\"fps\":{:.1},\"cpu_pct\":{:.1},\+ \"cpu_ms_per_frame\":{:.3},\"ws_mb\":{:.1},\"peak_ws_mb\":{:.1},\"private_mb\":{:.1},\+ \"first_frame_ms\":{:.0}}}",+ if animate { "anim" } else { "idle" },+ frames as f64 / wall.as_secs_f64(),+ cpu.as_secs_f64() / wall.as_secs_f64() * 100.0,+ if frames > 0 { cpu.as_secs_f64() * 1000.0 / frames as f64 } else { 0.0 },+ mb(ws_sum / samples.max(1) as f64),+ mb(peak_ws as f64),+ mb(m.private_bytes as f64),+ first.as_secs_f64() * 1000.0,+ );+ std::process::exit(0);+ });+}diff --git a/bindings/rust/bench/gpui-bench/Cargo.toml b/bindings/rust/bench/gpui-bench/Cargo.tomlnew file mode 100644index 0000000..d151d50--- /dev/null+++ b/bindings/rust/bench/gpui-bench/Cargo.toml@@ -0,0 +1,8 @@+[package]+name = "gpui-bench"+version = "0.1.0"+edition = "2024"+publish = false++[dependencies]+gpui = "0.2.2"diff --git a/bindings/rust/bench/gpui-bench/src/main.rs b/bindings/rust/bench/gpui-bench/src/main.rsnew file mode 100644index 0000000..8aaa206--- /dev/null+++ b/bindings/rust/bench/gpui-bench/src/main.rs@@ -0,0 +1,6 @@+//! The benchmark scene on gpui 0.2.2.+const APP_NAME: &str = "gpui";+fn new_app() -> gpui::Application {+ gpui::Application::new()+}+include!("scene.rs");diff --git a/bindings/rust/bench/gpui-bench/src/scene.rs b/bindings/rust/bench/gpui-bench/src/scene.rsnew file mode 100644index 0000000..bed7a84--- /dev/null+++ b/bindings/rust/bench/gpui-bench/src/scene.rs@@ -0,0 +1,64 @@+// The benchmark scene on gpui, shared by gpui-bench and gpui-fast-bench+// (included by each; `APP_NAME` labels the results).++#[path = "../../common/measure.rs"]+mod measure;++use gpui::{+ App, AppContext, Bounds, Context, IntoElement, ParentElement, Render, Styled, Window,+ WindowBounds, WindowOptions, div, px, rgb, size,+};++struct Scene {+ cells: usize,+ animate: bool,+ t: u64,+}++impl Render for Scene {+ fn render(&mut self, window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {+ measure::frame();+ let cfg = measure::Config::from_args();+ let (_, w, h, font) = cfg.grid();+ let t = self.t;+ if self.animate {+ self.t += 1;+ window.request_animation_frame();+ }+ div()+ .size_full()+ .bg(rgb(0x303030))+ .flex()+ .flex_wrap()+ .content_start()+ .gap(px(2.0))+ .p(px(2.0))+ .children((0..self.cells).map(|i| {+ div()+ .w(px(w))+ .h(px(h))+ .bg(rgb(measure::cell_color(i, t)))+ .rounded(px(3.0))+ .flex()+ .items_center()+ .justify_center()+ .text_size(px(font))+ .text_color(rgb(0xffffff))+ .child(measure::cell_label(i, t))+ }))+ }+}++fn main() {+ let cfg = measure::Config::from_args();+ measure::start(APP_NAME, &cfg);+ new_app().run(move |cx: &mut App| {+ let bounds = Bounds::centered(None, size(px(cfg.width), px(cfg.height)), cx);+ cx.open_window(+ WindowOptions { window_bounds: Some(WindowBounds::Windowed(bounds)), ..Default::default() },+ |_, cx| cx.new(|_| Scene { cells: cfg.cells, animate: cfg.animate, t: 0 }),+ )+ .unwrap();+ cx.activate(true);+ });+}diff --git a/bindings/rust/bench/gpui-fast-bench/Cargo.toml b/bindings/rust/bench/gpui-fast-bench/Cargo.tomlnew file mode 100644index 0000000..b612064--- /dev/null+++ b/bindings/rust/bench/gpui-fast-bench/Cargo.toml@@ -0,0 +1,9 @@+[package]+name = "gpui-fast-bench"+version = "0.1.0"+edition = "2024"+publish = false++[dependencies]+gpui = { package = "gpui-fast", version = "0.1.0" }+gpui_platform = { package = "gpui-fast-platform", version = "0.1.13" }diff --git a/bindings/rust/bench/gpui-fast-bench/src/main.rs b/bindings/rust/bench/gpui-fast-bench/src/main.rsnew file mode 100644index 0000000..d244bc6--- /dev/null+++ b/bindings/rust/bench/gpui-fast-bench/src/main.rs@@ -0,0 +1,6 @@+//! The same scene source as gpui-bench, built against gpui-fast.+const APP_NAME: &str = "gpui-fast";+fn new_app() -> gpui::Application {+ gpui_platform::application()+}+include!("../../gpui-bench/src/scene.rs");diff --git a/bindings/rust/bench/results.json b/bindings/rust/bench/results.jsonnew file mode 100644index 0000000..c10ccd2--- /dev/null+++ b/bindings/rust/bench/results.json@@ -0,0 +1,296 @@+[+ {+ "app": "gpui",+ "cells": 100,+ "mode": "anim",+ "fps": 60.1,+ "cpu_pct": 18.8,+ "cpu_ms_per_frame": 3.124,+ "gpu_pct": 5.430223331602986,+ "ws_mb": 33.5,+ "peak_ws_mb": 33.5,+ "private_mb": 35.8,+ "gpu_mem_mb": 16.12890625,+ "first_frame_ms": 225+ },+ {+ "app": "gpui-fast",+ "cells": 100,+ "mode": "anim",+ "fps": 60.0,+ "cpu_pct": 8.1,+ "cpu_ms_per_frame": 1.346,+ "gpu_pct": 2.22759138111008,+ "ws_mb": 35.6,+ "peak_ws_mb": 35.6,+ "private_mb": 40.3,+ "gpu_mem_mb": 19.1484375,+ "first_frame_ms": 206+ },+ {+ "app": "blenderui",+ "cells": 100,+ "mode": "anim",+ "fps": 60.1,+ "cpu_pct": 38.1,+ "cpu_ms_per_frame": 6.334,+ "gpu_pct": null,+ "ws_mb": 22.3,+ "peak_ws_mb": 22.7,+ "private_mb": 12.9,+ "gpu_mem_mb": null,+ "first_frame_ms": 7+ },+ {+ "app": "gpui",+ "cells": 100,+ "mode": "idle",+ "fps": 0.0,+ "cpu_pct": 1.1,+ "cpu_ms_per_frame": 0.0,+ "gpu_pct": 0.0,+ "ws_mb": 33.3,+ "peak_ws_mb": 33.3,+ "private_mb": 35.4,+ "gpu_mem_mb": 16.12890625,+ "first_frame_ms": 219+ },+ {+ "app": "gpui-fast",+ "cells": 100,+ "mode": "idle",+ "fps": 0.0,+ "cpu_pct": 0.1,+ "cpu_ms_per_frame": 0.0,+ "gpu_pct": 0.0,+ "ws_mb": 34.4,+ "peak_ws_mb": 34.4,+ "private_mb": 39.4,+ "gpu_mem_mb": 18.7578125,+ "first_frame_ms": 201+ },+ {+ "app": "blenderui",+ "cells": 100,+ "mode": "idle",+ "fps": 0.1,+ "cpu_pct": 0.2,+ "cpu_ms_per_frame": 17.651,+ "gpu_pct": null,+ "ws_mb": 19.9,+ "peak_ws_mb": 19.9,+ "private_mb": 9.9,+ "gpu_mem_mb": null,+ "first_frame_ms": 6+ },+ {+ "app": "blenderui (uncapped)",+ "cells": 100,+ "mode": "anim",+ "fps": 494.1,+ "cpu_pct": 259.2,+ "cpu_ms_per_frame": 5.251,+ "gpu_pct": null,+ "ws_mb": 22.9,+ "peak_ws_mb": 23.3,+ "private_mb": 13.4,+ "gpu_mem_mb": null,+ "first_frame_ms": 7+ },+ {+ "app": "gpui",+ "cells": 1000,+ "mode": "anim",+ "fps": 60.1,+ "cpu_pct": 94.1,+ "cpu_ms_per_frame": 15.662,+ "gpu_pct": 6.799581583082019,+ "ws_mb": 47.9,+ "peak_ws_mb": 48.3,+ "private_mb": 52.0,+ "gpu_mem_mb": 17.07421875,+ "first_frame_ms": 223+ },+ {+ "app": "gpui-fast",+ "cells": 1000,+ "mode": "anim",+ "fps": 60.0,+ "cpu_pct": 49.7,+ "cpu_ms_per_frame": 8.274,+ "gpu_pct": 7.941114150402417,+ "ws_mb": 44.8,+ "peak_ws_mb": 45.1,+ "private_mb": 51.1,+ "gpu_mem_mb": 19.89453125,+ "first_frame_ms": 203+ },+ {+ "app": "blenderui",+ "cells": 1000,+ "mode": "anim",+ "fps": 60.1,+ "cpu_pct": 99.7,+ "cpu_ms_per_frame": 16.588,+ "gpu_pct": null,+ "ws_mb": 26.8,+ "peak_ws_mb": 29.2,+ "private_mb": 17.8,+ "gpu_mem_mb": null,+ "first_frame_ms": 8+ },+ {+ "app": "gpui",+ "cells": 1000,+ "mode": "idle",+ "fps": 0.3,+ "cpu_pct": 3.7,+ "cpu_ms_per_frame": 83.632,+ "gpu_pct": 0.7863746532776426,+ "ws_mb": 47.0,+ "peak_ws_mb": 47.2,+ "private_mb": 51.1,+ "gpu_mem_mb": 17.07421875,+ "first_frame_ms": 219+ },+ {+ "app": "gpui-fast",+ "cells": 1000,+ "mode": "idle",+ "fps": 0.2,+ "cpu_pct": 0.5,+ "cpu_ms_per_frame": 15.09,+ "gpu_pct": 0.0,+ "ws_mb": 44.1,+ "peak_ws_mb": 44.6,+ "private_mb": 50.3,+ "gpu_mem_mb": 19.89453125,+ "first_frame_ms": 200+ },+ {+ "app": "blenderui",+ "cells": 1000,+ "mode": "idle",+ "fps": 0.0,+ "cpu_pct": 0.1,+ "cpu_ms_per_frame": 0.0,+ "gpu_pct": null,+ "ws_mb": 22.8,+ "peak_ws_mb": 22.8,+ "private_mb": 12.8,+ "gpu_mem_mb": null,+ "first_frame_ms": 5+ },+ {+ "app": "blenderui (uncapped)",+ "cells": 1000,+ "mode": "anim",+ "fps": 96.7,+ "cpu_pct": 165.4,+ "cpu_ms_per_frame": 16.847,+ "gpu_pct": null,+ "ws_mb": 27.3,+ "peak_ws_mb": 29.5,+ "private_mb": 17.6,+ "gpu_mem_mb": null,+ "first_frame_ms": 7+ },+ {+ "app": "gpui",+ "cells": 3000,+ "mode": "anim",+ "fps": 22.8,+ "cpu_pct": 100.6,+ "cpu_ms_per_frame": 44.093,+ "gpu_pct": 4.1647137724058325,+ "ws_mb": 77.5,+ "peak_ws_mb": 78.4,+ "private_mb": 94.9,+ "gpu_mem_mb": 20.64453125,+ "first_frame_ms": 215+ },+ {+ "app": "gpui-fast",+ "cells": 3000,+ "mode": "anim",+ "fps": 29.7,+ "cpu_pct": 54.7,+ "cpu_ms_per_frame": 18.419,+ "gpu_pct": 4.54098209237542,+ "ws_mb": 64.7,+ "peak_ws_mb": 65.8,+ "private_mb": 85.3,+ "gpu_mem_mb": 23.47265625,+ "first_frame_ms": 213+ },+ {+ "app": "blenderui",+ "cells": 3000,+ "mode": "anim",+ "fps": 32.6,+ "cpu_pct": 129.7,+ "cpu_ms_per_frame": 39.667,+ "gpu_pct": null,+ "ws_mb": 36.3,+ "peak_ws_mb": 43.4,+ "private_mb": 31.6,+ "gpu_mem_mb": null,+ "first_frame_ms": 5+ },+ {+ "app": "gpui",+ "cells": 3000,+ "mode": "idle",+ "fps": 0.0,+ "cpu_pct": 0.9,+ "cpu_ms_per_frame": 0.0,+ "gpu_pct": 0.0,+ "ws_mb": 75.2,+ "peak_ws_mb": 75.2,+ "private_mb": 92.3,+ "gpu_mem_mb": 20.64453125,+ "first_frame_ms": 233+ },+ {+ "app": "gpui-fast",+ "cells": 3000,+ "mode": "idle",+ "fps": 0.0,+ "cpu_pct": 0.1,+ "cpu_ms_per_frame": 0.0,+ "gpu_pct": 0.0,+ "ws_mb": 61.6,+ "peak_ws_mb": 61.6,+ "private_mb": 81.4,+ "gpu_mem_mb": 20.90625,+ "first_frame_ms": 201+ },+ {+ "app": "blenderui",+ "cells": 3000,+ "mode": "idle",+ "fps": 0.2,+ "cpu_pct": 1.0,+ "cpu_ms_per_frame": 49.36,+ "gpu_pct": null,+ "ws_mb": 27.8,+ "peak_ws_mb": 28.1,+ "private_mb": 19.3,+ "gpu_mem_mb": null,+ "first_frame_ms": 6+ },+ {+ "app": "blenderui (uncapped)",+ "cells": 3000,+ "mode": "anim",+ "fps": 31.4,+ "cpu_pct": 128.6,+ "cpu_ms_per_frame": 40.966,+ "gpu_pct": null,+ "ws_mb": 35.4,+ "peak_ws_mb": 42.9,+ "private_mb": 37.8,+ "gpu_mem_mb": null,+ "first_frame_ms": 6+ }+]\ No newline at end of filediff --git a/bindings/rust/bench/results.md b/bindings/rust/bench/results.mdnew file mode 100644index 0000000..d36f7c5--- /dev/null+++ b/bindings/rust/bench/results.md@@ -0,0 +1,23 @@+| App | Cells | Mode | FPS | CPU % (1 core = 100) | CPU ms / frame | GPU 3D % | RAM working set MB | Private MB | GPU memory MB | First frame ms |+|---|---:|---|---:|---:|---:|---:|---:|---:|---:|---:|+| gpui | 100 | anim | 60.1 | 18.8 | 3.12 | 5.4 | 33.5 | 35.8 | 16.1 | 225 |+| gpui-fast | 100 | anim | 60.0 | 8.1 | 1.35 | 2.2 | 35.6 | 40.3 | 19.1 | 206 |+| blenderui | 100 | anim | 60.1 | 38.1 | 6.33 | - | 22.3 | 12.9 | - | 7 |+| gpui | 100 | idle | 0.0 | 1.1 | - | 0.0 | 33.3 | 35.4 | 16.1 | 219 |+| gpui-fast | 100 | idle | 0.0 | 0.1 | - | 0.0 | 34.4 | 39.4 | 18.8 | 201 |+| blenderui | 100 | idle | 0.1 | 0.2 | - | - | 19.9 | 9.9 | - | 6 |+| blenderui (uncapped) | 100 | anim | 494.1 | 259.2 | 5.25 | - | 22.9 | 13.4 | - | 7 |+| gpui | 1000 | anim | 60.1 | 94.1 | 15.66 | 6.8 | 47.9 | 52.0 | 17.1 | 223 |+| gpui-fast | 1000 | anim | 60.0 | 49.7 | 8.27 | 7.9 | 44.8 | 51.1 | 19.9 | 203 |+| blenderui | 1000 | anim | 60.1 | 99.7 | 16.59 | - | 26.8 | 17.8 | - | 8 |+| gpui | 1000 | idle | 0.3 | 3.7 | - | 0.8 | 47.0 | 51.1 | 17.1 | 219 |+| gpui-fast | 1000 | idle | 0.2 | 0.5 | - | 0.0 | 44.1 | 50.3 | 19.9 | 200 |+| blenderui | 1000 | idle | 0.0 | 0.1 | - | - | 22.8 | 12.8 | - | 5 |+| blenderui (uncapped) | 1000 | anim | 96.7 | 165.4 | 16.85 | - | 27.3 | 17.6 | - | 7 |+| gpui | 3000 | anim | 22.8 | 100.6 | 44.09 | 4.2 | 77.5 | 94.9 | 20.6 | 215 |+| gpui-fast | 3000 | anim | 29.7 | 54.7 | 18.42 | 4.5 | 64.7 | 85.3 | 23.5 | 213 |+| blenderui | 3000 | anim | 32.6 | 129.7 | 39.67 | - | 36.3 | 31.6 | - | 5 |+| gpui | 3000 | idle | 0.0 | 0.9 | - | 0.0 | 75.2 | 92.3 | 20.6 | 233 |+| gpui-fast | 3000 | idle | 0.0 | 0.1 | - | 0.0 | 61.6 | 81.4 | 20.9 | 201 |+| blenderui | 3000 | idle | 0.2 | 1.0 | - | - | 27.8 | 19.3 | - | 6 |+| blenderui (uncapped) | 3000 | anim | 31.4 | 128.6 | 40.97 | - | 35.4 | 37.8 | - | 6 |diff --git a/bindings/rust/bench/run.py b/bindings/rust/bench/run.pynew file mode 100644index 0000000..ce81a3f--- /dev/null+++ b/bindings/rust/bench/run.py@@ -0,0 +1,115 @@+"""Run the blenderui vs gpui / gpui-fast benchmark and print a Markdown table.++ cd bindings/rust/bench+ cargo build --release+ py run.py [--reps 3] [--seconds 10]++Each app measures its own process (CPU time, working set, private bytes,+frames) and prints one JSON line. GPU work does not show up as process CPU+time, so this script also samples the process's GPU engine utilisation and+GPU memory from the Windows performance counters while it runs.+"""++import argparse+import json+import statistics+import subprocess+import sys+import threading+import time+from pathlib import Path++HERE = Path(__file__).resolve().parent+EXE = {"blenderui": HERE / "target/release/bui-bench.exe", "gpui": HERE / "target/release/gpui-bench.exe",+ "gpui-fast": HERE / "target/release/gpui-fast-bench.exe"}+++def gpu_sampler(pid, start_after, duration, out):+ """Average 3D-engine utilisation (%) and GPU memory (MB) of `pid`."""+ time.sleep(start_after)+ n = max(2, int(duration) - 1)+ script = (+ f"$c = Get-Counter -Counter '\\GPU Engine(pid_{pid}_*)\\Utilization Percentage',"+ f"'\\GPU Process Memory(pid_{pid}_*)\\Dedicated Usage','\\GPU Process Memory(pid_{pid}_*)\\Shared Usage'"+ f" -SampleInterval 1 -MaxSamples {n} -ErrorAction SilentlyContinue;"+ "foreach ($s in $c) { $u = 0; $m = 0; foreach ($v in $s.CounterSamples) {"+ " if ($v.Path -like '*utilization percentage') { $u += $v.CookedValue } else { $m += $v.CookedValue } };"+ " Write-Output (\"{0} {1}\" -f $u, $m) }"+ )+ try:+ r = subprocess.run(["powershell", "-NoProfile", "-Command", script],+ capture_output=True, text=True, timeout=duration + 30)+ rows = [tuple(map(float, l.split())) for l in r.stdout.split("\n") if l.strip()]+ if rows:+ out["gpu_pct"] = statistics.mean(r[0] for r in rows)+ out["gpu_mem_mb"] = statistics.mean(r[1] for r in rows) / (1024 * 1024)+ except Exception as e: # counters unavailable: leave the fields out+ out["gpu_error"] = str(e)+++def run(app, cells, mode, warmup, seconds, extra=()):+ args = [str(EXE[app]), "--cells", str(cells), "--mode", mode,+ "--warmup", str(warmup), "--seconds", str(seconds), *extra]+ p = subprocess.Popen(args, stdout=subprocess.PIPE, text=True)+ gpu = {}+ t = threading.Thread(target=gpu_sampler, args=(p.pid, warmup + 1.0, seconds, gpu))+ t.start()+ out, _ = p.communicate(timeout=warmup + seconds + 60)+ t.join()+ line = [l for l in out.splitlines() if l.startswith("{")]+ if not line:+ raise RuntimeError(f"{app} printed no result: {out!r}")+ r = json.loads(line[-1])+ r.update(gpu)+ return r+++def median(rows, key):+ vals = [r[key] for r in rows if key in r]+ return statistics.median(vals) if vals else None+++def main():+ ap = argparse.ArgumentParser()+ ap.add_argument("--reps", type=int, default=3)+ ap.add_argument("--warmup", type=float, default=3)+ ap.add_argument("--seconds", type=float, default=10)+ ap.add_argument("--cells", default="100,1000,3000")+ ap.add_argument("--apps", default="gpui,gpui-fast,blenderui")+ a = ap.parse_args()+ configs = []+ for cells in map(int, a.cells.split(",")):+ for mode in ("anim", "idle"):+ for app in a.apps.split(","):+ configs.append((app, cells, mode, ()))+ if "blenderui" in a.apps.split(","):+ configs.append(("blenderui", cells, "anim", ("--uncapped",)))+ results = []+ for app, cells, mode, extra in configs:+ rows = []+ for rep in range(a.reps):+ r = run(app, cells, mode, a.warmup, a.seconds, extra)+ print(f" {app:9} {cells:5} {mode}{' uncapped' if extra else ''} #{rep + 1}: {json.dumps(r)}",+ file=sys.stderr)+ rows.append(r)+ label = app + (" (uncapped)" if extra else "")+ results.append((label, cells, mode, {k: median(rows, k) for k in (+ "fps", "cpu_pct", "cpu_ms_per_frame", "gpu_pct", "ws_mb", "peak_ws_mb", "private_mb",+ "gpu_mem_mb", "first_frame_ms")}))+ (HERE / "results.json").write_text(json.dumps(+ [{"app": l, "cells": c, "mode": m, **v} for l, c, m, v in results], indent=1))++ def f(v, d=1):+ return "-" if v is None else f"{v:.{d}f}"++ print("| App | Cells | Mode | FPS | CPU % (1 core = 100) | CPU ms / frame | GPU 3D % | "+ "RAM working set MB | Private MB | GPU memory MB | First frame ms |")+ print("|---|---:|---|---:|---:|---:|---:|---:|---:|---:|---:|")+ for label, cells, mode, v in results:+ print(f"| {label} | {cells} | {mode} | {f(v['fps'])} | {f(v['cpu_pct'])} | "+ f"{f(v['cpu_ms_per_frame'], 2) if mode == 'anim' else '-'} | {f(v['gpu_pct'])} | "+ f"{f(v['ws_mb'])} | {f(v['private_mb'])} | {f(v['gpu_mem_mb'])} | {f(v['first_frame_ms'], 0)} |")+++if __name__ == "__main__":+ main()diff --git a/bindings/rust/blenderui-sys/Cargo.toml b/bindings/rust/blenderui-sys/Cargo.tomlnew file mode 100644index 0000000..6e013c8--- /dev/null+++ b/bindings/rust/blenderui-sys/Cargo.toml@@ -0,0 +1,13 @@+[package]+name = "blenderui-sys"+description = "Raw FFI bindings to the BUI C kit (Blender's UI as a C library)"+version.workspace = true+edition.workspace = true+license.workspace = true+repository.workspace = true+rust-version.workspace = true+links = "bui_kit"+build = "build.rs"++[build-dependencies]+cmake = "0.1"diff --git a/bindings/rust/blenderui-sys/build.rs b/bindings/rust/blenderui-sys/build.rsnew file mode 100644index 0000000..a81f0ea--- /dev/null+++ b/bindings/rust/blenderui-sys/build.rs@@ -0,0 +1,49 @@+//! Builds the C kit (kit + gpu + core) with the project's own CMake files and+//! links it statically. Set `BUI_SOURCE_DIR` to build from another checkout.++use std::path::PathBuf;++fn main() {+ let manifest = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());+ let root = std::env::var("BUI_SOURCE_DIR")+ .map(PathBuf::from)+ .unwrap_or_else(|_| manifest.join("../../.."));+ let root = root.canonicalize().expect("BUI source tree not found (set BUI_SOURCE_DIR)");+ // Windows canonical paths are \\?\C:\...; compilers' /FI and -include can't take them.+ let root = PathBuf::from(root.to_string_lossy().trim_start_matches(r"\\?\").to_string());++ let dst = cmake::Config::new(&root)+ .define("BUI_BUILD_TESTS", "OFF")+ .define("BUI_BUILD_EXAMPLES", "OFF")+ .define("BUI_BUILD_PYTHON_BINDINGS", "OFF")+ .define("BUI_BUILD_UI", "OFF")+ .define("BUI_BUILD_QT_BACKEND", "OFF")+ // Always optimized; on MSVC also the release C runtime Rust links.+ .profile("Release")+ .build_target("bui_kit")+ .build();++ let build = dst.join("build");+ for lib in ["kit", "gpu", "core"] {+ for sub in ["", "Release"] {+ println!("cargo:rustc-link-search=native={}", build.join(lib).join(sub).display());+ }+ }+ for lib in ["bui_kit", "bui_gpu", "bui_core"] {+ println!("cargo:rustc-link-lib=static={lib}");+ }+ let target = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();+ if target == "windows" {+ for lib in ["user32", "gdi32"] {+ println!("cargo:rustc-link-lib={lib}");+ }+ } else {+ println!("cargo:rustc-link-lib=m");+ println!("cargo:rustc-link-lib=pthread");+ }+ for dir in ["kit", "gpu", "core", "CMakeLists.txt"] {+ println!("cargo:rerun-if-changed={}", root.join(dir).display());+ }+ println!("cargo:rerun-if-env-changed=BUI_SOURCE_DIR");+ println!("cargo:include={}", root.join("kit/include").display());+}diff --git a/bindings/rust/blenderui-sys/src/lib.rs b/bindings/rust/blenderui-sys/src/lib.rsnew file mode 100644index 0000000..56beced--- /dev/null+++ b/bindings/rust/blenderui-sys/src/lib.rs@@ -0,0 +1,246 @@+//! Raw bindings to the BUI C kit (`kit/include/BUI_kit.h`, `gpu/include/GPU_raster.h`).+//!+//! Everything here is `unsafe` and mirrors the C header one to one; the safe,+//! gpui-style API is the `blenderui` crate.++#![allow(non_camel_case_types, non_snake_case)]++use std::os::raw::{c_char, c_double, c_float, c_int, c_uchar, c_void};++/// A kit node (widget, frame, canvas ...).+#[repr(C)]+pub struct BKNode {+ _private: [u8; 0],+}+/// Input state, popups, focus, undo for one node tree.+#[repr(C)]+pub struct BKContext {+ _private: [u8; 0],+}+/// A native window (Win32) showing a context.+#[repr(C)]+pub struct BKWindow {+ _private: [u8; 0],+}+/// A CPU frame buffer (0x00RRGGBB pixels) with damage tracking.+#[repr(C)]+pub struct BuiRaster {+ _private: [u8; 0],+}++// Event kinds (BK_EV_*).+pub const BK_EV_CHANGE: c_int = 1;+pub const BK_EV_CLICK: c_int = 2;+pub const BK_EV_CALL: c_int = 3;+pub const BK_EV_RENAME: c_int = 4;+pub const BK_EV_ACTIVATE: c_int = 5;+pub const BK_EV_TOGGLE: c_int = 6;+pub const BK_EV_BROWSE: c_int = 7;+pub const BK_EV_PRESS: c_int = 8;+pub const BK_EV_RELEASE: c_int = 9;+pub const BK_EV_DOUBLE: c_int = 10;+pub const BK_EV_MOTION: c_int = 11;+pub const BK_EV_ENTER: c_int = 12;+pub const BK_EV_LEAVE: c_int = 13;+pub const BK_EV_KEY: c_int = 14;+pub const BK_EV_WHEEL: c_int = 15;+pub const BK_EV_SUBMIT: c_int = 16;+pub const BK_EV_VIEW: c_int = 17;+pub const BK_EV_SCROLL: c_int = 18;+pub const BK_EV_CONFIGURE: c_int = 19;+pub const BK_EV_KEYRELEASE: c_int = 20;++// Modifier bits for input calls.+pub const BK_SHIFT: c_int = 1;+pub const BK_CTRL: c_int = 2;+pub const BK_ALT: c_int = 4;+pub const BK_BUTTON1: c_int = 8;++// Geometry managers and anchors.+pub const BK_GEOM_NONE: c_int = 0;+pub const BK_GEOM_PACK: c_int = 1;+pub const BK_GEOM_GRID: c_int = 2;+pub const BK_GEOM_PLACE: c_int = 3;+pub const BK_ANCHOR_N: c_int = 1;+pub const BK_ANCHOR_S: c_int = 2;+pub const BK_ANCHOR_W: c_int = 4;+pub const BK_ANCHOR_E: c_int = 8;++// Canvas item types.+pub const BK_ITEM_RECT: c_int = 0;+pub const BK_ITEM_OVAL: c_int = 1;+pub const BK_ITEM_LINE: c_int = 2;+pub const BK_ITEM_POLYGON: c_int = 3;+pub const BK_ITEM_TEXT: c_int = 4;+pub const BK_ITEM_ARC: c_int = 5;+pub const BK_ITEM_IMAGE: c_int = 6;+pub const BK_ITEM_ROUNDRECT: c_int = 7;++// Font flags (GPU_raster.h).+pub const BUI_FONT_BOLD: c_int = 1;+pub const BUI_FONT_ITALIC: c_int = 2;+pub const BUI_FONT_UNDERLINE: c_int = 4;++/// One item of a canvas display list (`BKCanvasItem`).+#[repr(C)]+#[derive(Clone, Copy)]+pub struct BKCanvasItem {+ pub id: c_int,+ pub type_: c_int,+ pub coords: *const c_float,+ pub ncoords: c_int,+ pub fill: [c_float; 4],+ pub outline: [c_float; 4],+ pub width: c_float,+ pub radius: c_float,+ pub size: c_float,+ pub start: c_float,+ pub extent: c_float,+ pub text: *const c_char,+ pub anchor: c_int,+ pub rgba: *const c_uchar,+ pub iw: c_int,+ pub ih: c_int,+ pub hidden: c_int,+ pub text_flags: c_int,+ pub clip_on: c_int,+ pub clip: [c_float; 4],+}++impl Default for BKCanvasItem {+ fn default() -> Self {+ // SAFETY: all-zero is a valid "empty" item in C (null pointers, no colors).+ unsafe { std::mem::zeroed() }+ }+}++/// Host callbacks of a context (`BKHost`).+#[repr(C)]+#[derive(Clone, Copy)]+pub struct BKHost {+ pub data: *mut c_void,+ pub request: Option<unsafe extern "C" fn(data: *mut c_void)>,+ pub set_cursor: Option<unsafe extern "C" fn(data: *mut c_void, cursor: c_int)>,+ pub warp: Option<unsafe extern "C" fn(data: *mut c_void, x: c_int, y: c_int)>,+ pub clipboard_get: Option<unsafe extern "C" fn(data: *mut c_void) -> *mut c_char>,+ pub clipboard_set: Option<unsafe extern "C" fn(data: *mut c_void, text: *const c_char)>,+ pub schedule: Option<unsafe extern "C" fn(data: *mut c_void, ms: c_int, timer: c_int)>,+ pub emit: Option<+ unsafe extern "C" fn(+ data: *mut c_void,+ node: *mut BKNode,+ kind: c_int,+ ref_: *mut c_void,+ a: c_double,+ b: c_double,+ ),+ >,+}++/// Native window callbacks (`BKWindowCallbacks`).+#[repr(C)]+#[derive(Clone, Copy)]+pub struct BKWindowCallbacks {+ pub data: *mut c_void,+ pub on_timer: Option<unsafe extern "C" fn(data: *mut c_void, win: *mut BKWindow, id: c_int)>,+ pub on_close: Option<unsafe extern "C" fn(data: *mut c_void, win: *mut BKWindow) -> c_int>,+ pub on_frame: Option<unsafe extern "C" fn(data: *mut c_void, win: *mut BKWindow)>,+}++unsafe extern "C" {+ // look+ pub fn BK_set_scale(scale: c_float);+ pub fn BK_scale() -> c_float;+ pub fn BK_unit() -> c_int;+ pub fn BK_set_font(family: *const c_char);++ // nodes+ pub fn BK_node_new(type_: *const c_char) -> *mut BKNode;+ pub fn BK_node_free(node: *mut BKNode);+ pub fn BK_node_add(parent: *mut BKNode, child: *mut BKNode, index: c_int) -> c_int;+ pub fn BK_node_remove(parent: *mut BKNode, child: *mut BKNode);+ pub fn BK_node_rect(node: *const BKNode, r_rect: *mut c_int);+ pub fn BK_node_natural(node: *mut BKNode, r_size: *mut c_int);+ pub fn BK_node_set_image(node: *mut BKNode, rgba: *const c_uchar, w: c_int, h: c_int);++ // properties+ pub fn BK_set_num(node: *mut BKNode, key: *const c_char, value: c_double) -> c_int;+ pub fn BK_set_str(node: *mut BKNode, key: *const c_char, value: *const c_char) -> c_int;+ pub fn BK_set_color(node: *mut BKNode, key: *const c_char, rgba: *const c_float) -> c_int;+ pub fn BK_set_strs(+ node: *mut BKNode,+ key: *const c_char,+ values: *const *const c_char,+ n: c_int,+ ) -> c_int;+ pub fn BK_get_num(node: *mut BKNode, key: *const c_char) -> c_double;+ pub fn BK_get_str(node: *mut BKNode, key: *const c_char) -> *const c_char;+ pub fn BK_get_color(node: *mut BKNode, key: *const c_char, r_rgba: *mut c_float) -> c_int;++ // geometry managers+ pub fn BK_geom_set_manager(child: *mut BKNode, manager: c_int);+ pub fn BK_geom_set(child: *mut BKNode, key: *const c_char, value: c_double);++ // canvas display list+ pub fn BK_canvas_set_item(canvas: *mut BKNode, item: *const BKCanvasItem);+ pub fn BK_canvas_add_item(canvas: *mut BKNode, item: *const BKCanvasItem);+ pub fn BK_canvas_delete(canvas: *mut BKNode, id: c_int);+ pub fn BK_canvas_count(canvas: *mut BKNode) -> c_int;++ // contexts+ pub fn BK_context_new(root: *mut BKNode) -> *mut BKContext;+ pub fn BK_context_free(ctx: *mut BKContext);+ pub fn BK_context_set_host(ctx: *mut BKContext, host: *const BKHost);+ pub fn BK_render(ctx: *mut BKContext, r: *mut BuiRaster, w: c_int, h: c_int, full: c_int)+ -> c_int;+ pub fn BK_needs_render(ctx: *mut BKContext) -> c_int;+ pub fn BK_press(ctx: *mut BKContext, x: c_int, y: c_int, mods: c_int) -> c_int;+ pub fn BK_release(ctx: *mut BKContext, x: c_int, y: c_int, mods: c_int) -> c_int;+ pub fn BK_motion(ctx: *mut BKContext, x: c_int, y: c_int, mods: c_int) -> c_int;+ pub fn BK_wheel(ctx: *mut BKContext, x: c_int, y: c_int, delta: c_int, mods: c_int) -> c_int;+ pub fn BK_key(ctx: *mut BKContext, text: *const c_char, keysym: *const c_char, mods: c_int)+ -> c_int;+ pub fn BK_key_release(ctx: *mut BKContext, keysym: *const c_char, mods: c_int) -> c_int;+ pub fn BK_button(ctx: *mut BKContext, x: c_int, y: c_int, button: c_int, release: c_int,+ mods: c_int) -> c_int;+ pub fn BK_context_menu(ctx: *mut BKContext, x: c_int, y: c_int, mods: c_int) -> c_int;+ pub fn BK_timer(ctx: *mut BKContext, timer: c_int);+ pub fn BK_cursor(ctx: *mut BKContext) -> c_int;+ pub fn BK_focus_node(ctx: *mut BKContext, n: *mut BKNode);+ pub fn BK_clipboard_get(ctx: *mut BKContext) -> *mut c_char;+ pub fn BK_clipboard_set(ctx: *mut BKContext, text: *const c_char);++ // native windows+ pub fn BK_window_supported() -> c_int;+ pub fn BK_window_new(ctx: *mut BKContext, title: *const c_char, width: c_int, height: c_int)+ -> *mut BKWindow;+ pub fn BK_window_free(win: *mut BKWindow);+ pub fn BK_window_set_callbacks(win: *mut BKWindow, cb: *const BKWindowCallbacks);+ pub fn BK_window_show(win: *mut BKWindow);+ pub fn BK_window_close(win: *mut BKWindow);+ pub fn BK_window_is_open(win: *mut BKWindow) -> c_int;+ pub fn BK_window_set_title(win: *mut BKWindow, title: *const c_char);+ pub fn BK_window_set_size(win: *mut BKWindow, width: c_int, height: c_int);+ pub fn BK_window_get_size(win: *mut BKWindow, r_width: *mut c_int, r_height: *mut c_int);+ pub fn BK_window_raster(win: *mut BKWindow) -> *mut BuiRaster;+ pub fn BK_window_frames(win: *mut BKWindow) -> c_int;+ pub fn BK_window_render_now(win: *mut BKWindow);+ pub fn BK_window_timer(win: *mut BKWindow, ms: c_int) -> c_int;+ pub fn BK_window_cancel_timer(win: *mut BKWindow, id: c_int);+ pub fn BK_window_request_frame(win: *mut BKWindow, vsync: c_int);+ pub fn BK_window_wm(win: *mut BKWindow, key: *const c_char, a: c_double, b: c_double);+ pub fn BK_window_wm_get(win: *mut BKWindow, key: *const c_char, r_a: *mut c_double,+ r_b: *mut c_double) -> c_int;+ pub fn BK_window_run();+ pub fn BK_window_pump() -> c_int;+ pub fn BK_window_quit();++ // raster + text (gpu/)+ pub fn BUI_raster_create(width: c_int, height: c_int) -> *mut BuiRaster;+ pub fn BUI_raster_free(r: *mut BuiRaster);+ pub fn BUI_raster_width(r: *const BuiRaster) -> c_int;+ pub fn BUI_raster_height(r: *const BuiRaster) -> c_int;+ pub fn BUI_raster_pixels(r: *const BuiRaster) -> *const u32;+ pub fn BUI_text_measure(family: *const c_char, flags: c_int, size: c_float,+ utf8: *const c_char, len: c_int, r_width: *mut c_float) -> c_int;+}diff --git a/bindings/rust/blenderui/Cargo.toml b/bindings/rust/blenderui/Cargo.tomlnew file mode 100644index 0000000..3315df6--- /dev/null+++ b/bindings/rust/blenderui/Cargo.toml@@ -0,0 +1,17 @@+[package]+name = "blenderui"+description = "Blender's UI for Rust: gpui-style syntax, every HTML element and CSS, drawn by the BUI C kit"+version.workspace = true+edition.workspace = true+license.workspace = true+repository.workspace = true+rust-version.workspace = true+keywords = ["gui", "ui", "blender", "gpui", "html"]+categories = ["gui"]+readme = "README.md"++[dependencies]+blenderui-sys = { path = "../blenderui-sys", version = "0.1.0" }+taffy = { version = "0.6", default-features = false, features = ["std", "flexbox", "grid", "block_layout", "taffy_tree", "content_size"] }+paste = "1"+png = "0.17"diff --git a/bindings/rust/blenderui/README.md b/bindings/rust/blenderui/README.mdnew file mode 100644index 0000000..30ca812--- /dev/null+++ b/bindings/rust/blenderui/README.md@@ -0,0 +1,34 @@+# blenderui++Blender's UI for Rust, with [gpui](https://www.gpui.rs)'s syntax, every HTML+element and CSS. Form controls are Blender's own widgets; layout is+[taffy](https://github.com/DioxusLabs/taffy); drawing and input come from the+[BUI](https://github.com/ppmpreetham/BUI) C kit (built from source, so CMake+and a C compiler are needed).++```rust+use blenderui::prelude::*;++struct Counter { count: i32 }++impl Render for Counter {+ fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ div().flex().flex_col().gap_2().p_4()+ .child(h1().child(format!("Count: {}", self.count)))+ .child(button().child("Add one").on_click(cx.listener(|this, _, _, cx| {+ this.count += 1;+ cx.notify();+ })))+ }+}++fn main() {+ Application::new().run(|cx: &mut App| {+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Counter { count: 0 }))+ .unwrap();+ });+}+```++Guide, CSS coverage and limitations:+[docs/rust.md](https://github.com/ppmpreetham/BUI/blob/main/docs/rust.md).diff --git a/bindings/rust/blenderui/examples/counter.rs b/bindings/rust/blenderui/examples/counter.rsnew file mode 100644index 0000000..324a1a1--- /dev/null+++ b/bindings/rust/blenderui/examples/counter.rs@@ -0,0 +1,26 @@+//! The README example: `cargo run --example counter`.++use blenderui::prelude::*;++struct Counter { count: i32 }++impl Render for Counter {+ fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ div().flex().flex_col().gap_2().p_4()+ .child(h1().child(format!("Count: {}", self.count)))+ .child(p().child("Any ").child(b().child("HTML element")).child(", styled with ")+ .child(code().child(".css()")).child(" or a <style> sheet."))+ .child(button().child("Add one").on_click(cx.listener(|this, _, _, cx| {+ this.count += 1;+ cx.notify();+ })))+ .child(input().input_type("range").min(0.0).max(10.0)) // a Blender slider+ }+}++fn main() {+ Application::new().run(|cx: &mut App| {+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Counter { count: 0 }))+ .unwrap();+ });+}diff --git a/bindings/rust/blenderui/examples/raster_probe.rs b/bindings/rust/blenderui/examples/raster_probe.rsnew file mode 100644index 0000000..406c97b--- /dev/null+++ b/bindings/rust/blenderui/examples/raster_probe.rs@@ -0,0 +1,35 @@+//! Headless frame-cost probe: `BUI_PROFILE=1 cargo run --release --example raster_probe -- [text|notext|square]`.+use blenderui::prelude::*;++struct Scene { t: u64, text: bool, round: bool }++impl Render for Scene {+ fn render(&mut self, w: &mut Window, _: &mut Context<Self>) -> impl IntoElement {+ self.t += 1;+ w.refresh();+ let t = self.t;+ let grid = div().size_full().flex().flex_wrap().gap(px(2.0)).p(px(2.0)).children((0..3000).map(|i| {+ let d = div().w(px(15.0)).h(px(12.0)).bg(rgb(((i as u32 * 7 + t as u32 * 3) % 360) * 0x010203))+ .flex().items_center().justify_center().text_size(px(8.0)).text_color(white());+ let d = if self.round { d.rounded(px(3.0)) } else { d };+ if self.text { d.child(format!("{}", (i as u64 * 13 + t) % 1000)) } else { d }+ }));+ if std::env::var_os("FLEXROOT").is_some() {+ html().flex().child(body().m_0().flex().flex_1().child(grid))+ } else {+ body().m_0().child(grid)+ }+ }+}++fn main() {+ let mode = std::env::args().nth(1).unwrap_or_else(|| "text".into());+ Application::headless().run(|cx| {+ let opts = WindowOptions { window_bounds: Some(WindowBounds::Windowed(Bounds {+ origin: point(px(0.0), px(0.0)), size: size(px(1000.0), px(800.0)) })), ..Default::default() };+ let win = cx.open_window(opts, |_, cx| cx.new(|_| Scene { t: 0, text: mode != "notext", round: mode != "square" })).unwrap();+ let t0 = std::time::Instant::now();+ for _ in 0..120 { cx.draw(win.id); }+ eprintln!("{mode}: {:.2} ms/frame total", t0.elapsed().as_secs_f64() * 1000.0 / 120.0);+ });+}diff --git a/bindings/rust/blenderui/examples/showcase.rs b/bindings/rust/blenderui/examples/showcase.rsnew file mode 100644index 0000000..6d3fbb0--- /dev/null+++ b/bindings/rust/blenderui/examples/showcase.rs@@ -0,0 +1,151 @@+//! A tour of elements, CSS and Blender widgets.+//!+//! ```text+//! cargo run --example showcase # native window+//! cargo run --example showcase -- --screenshot a.png # off-screen render+//! ```++use blenderui::prelude::*;++struct Showcase {+ clicks: u32,+ name: String,+ volume: f64,+ dark: bool,+}++const CSS: &str = r#"+body { margin: 0; }+.app { display: flex; height: 100vh; }+nav { width: 150px; background: #282828; padding: 10px 0; border-right: 1px solid #1d1d1d; }+nav a { display: block; padding: 4px 14px; color: #c8c8c8; text-decoration: none; }+nav a:hover { background: #4772b3; color: white; }+main { flex: 1; padding: 12px 20px; overflow-y: scroll; }+.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }+.card { padding: 10px; border-radius: 6px; background: #3a3a3a; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }+.card.accent { background: linear-gradient(135deg, #4772b3, #7a4fb3); color: white; }+.card h4 { margin: 0 0 4px 0; }+table { width: 100%; border-collapse: collapse; }+td, th { border-bottom: 1px solid #484848; text-align: left; }+tbody tr:nth-child(odd) { background: #353535; }+"#;++impl Render for Showcase {+ fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ let card = |title: &'static str, body: &'static str| {+ div().class("card").child(h4().child(title)).child(small().child(body))+ };+ html()+ .child(head().child(title().child("BUI showcase")).child(style().child(CSS)))+ .child(body().child(+ div().class("app")+ .child(nav().children(["Overview", "Forms", "Tables", "Lists", "About"]+ .map(|s| a().href("#").child(s))))+ .child(blenderui::html::main()+ .child(h1().child("Blender UI, from Rust"))+ .child(p()+ .child("Every ").child(b().child("HTML element"))+ .child(", ").child(i().child("CSS")).child(" and ")+ .child(code().child(".gpui_style()"))+ .child(" method, drawn by Blender's widget code. Text wraps in line boxes, \+ links are ")+ .child(a().href("#").child("underlined"))+ .child(" and ").child(mark().child("marked text")).child(" works."))+ .child(div().class("cards")+ .child(card("Layout", "block, inline, flex, grid, tables").class("accent"))+ .child(card("Selectors", "classes, ids, :hover, :nth-child, @media"))+ .child(card("Widgets", "native Blender buttons, fields, sliders")))+ .child(fieldset()+ .child(legend().child("Form controls"))+ .child(div().flex().flex_wrap().gap_2().items_center()+ .child(label().child("Name"))+ .child(input().id("name").placeholder("Your name").value(self.name.clone())+ .on_change(cx.listener(|this, e: &ChangeEvent, _, cx| {+ this.name = e.value.clone();+ cx.notify();+ })))+ .child(input().id("count").input_type("number").value("3").min(0.0).max(10.0))+ .child(input().id("vol").input_type("range").min(0.0).max(100.0)+ .value(format!("{}", self.volume))+ .on_input(cx.listener(|this, e: &ChangeEvent, _, cx| {+ this.volume = e.number;+ cx.notify();+ })))+ .child(select().id("mode")+ .child(option().child("Object Mode"))+ .child(option().child("Edit Mode"))+ .child(option().child("Sculpt Mode")))+ .child(input().input_type("color").value("#e6a23c")))+ .child(div().flex().gap_4().items_center().mt_2()+ .child(input().id("dark").input_type("checkbox").checked(self.dark)+ .on_change(cx.listener(|this, e: &ChangeEvent, _, cx| {+ this.dark = e.checked;+ cx.notify();+ })))+ .child(label().child("Dark"))+ .child(input().input_type("radio").name("unit").checked(true))+ .child(label().child("Metric"))+ .child(input().input_type("radio").name("unit"))+ .child(label().child("Imperial"))+ .child(button().id("go").child(format!("Clicked {}", self.clicks))+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {+ this.clicks += 1;+ cx.notify();+ }))))+ .child(div().flex().gap_4().items_center().mt_2()+ .child(span().child(format!("Volume {:.0}%", self.volume)))+ .child(progress().value(format!("{}", self.volume / 100.0)).w(px(180.0)))))+ .child(h3().child("Table"))+ .child(table()+ .child(thead().child(tr().child(th().child("Object")).child(th().child("Type"))+ .child(th().child("Vertices"))))+ .child(tbody().children([("Cube", "Mesh", "8"), ("Camera", "Camera", "-"),+ ("Light", "Point", "-"), ("Suzanne", "Mesh", "507")]+ .map(|(o, t, v)| tr().child(td().child(o)).child(td().child(t))+ .child(td().child(v))))))+ .child(div().flex().gap_6()+ .child(div().child(h3().child("Lists"))+ .child(ul().child(li().child("Modeling"))+ .child(li().child("Sculpting").child(ul().child(li().child("Brushes"))))+ .child(li().child("Shading")))+ .child(ol().child(li().child("First")).child(li().child("Second"))))+ .child(div().flex_1().child(h3().child("Details"))+ .child(details().open(true).child(summary().child("Render settings"))+ .child(p().child("Samples, denoising, light paths.")))+ .child(details().child(summary().child("Output properties"))+ .child(p().child("Hidden until opened.")))+ .child(blockquote().child("Everything is a Div; tags only change defaults."))+ .child(pre().child("fn main() {\n println!(\"hi\");\n}")))))))+ }+}++fn main() {+ let args: Vec<String> = std::env::args().collect();+ let shot = args.iter().position(|a| a == "--screenshot").and_then(|i| args.get(i + 1)).cloned();+ let app = if shot.is_some() { Application::headless() } else { Application::new() };+ app.run(move |cx| {+ let opts = WindowOptions {+ window_bounds: Some(WindowBounds::Windowed(Bounds {+ origin: point(px(0.0), px(0.0)),+ size: size(px(900.0), px(760.0)),+ })),+ ..Default::default()+ };+ let win = cx+ .open_window(opts, |_, cx| {+ cx.new(|_| Showcase { clicks: 0, name: String::new(), volume: 40.0, dark: true })+ })+ .unwrap();+ if let Some(path) = shot {+ let (w, h, px) = cx.draw(win.id);+ let (w, h, px) = if w == 0 { cx.draw(win.id) } else { (w, h, px) };+ let rgba: Vec<u8> = px.iter().flat_map(|p| [(p >> 16) as u8, (p >> 8) as u8, *p as u8, 255]).collect();+ let file = std::fs::File::create(&path).unwrap();+ let mut enc = png::Encoder::new(std::io::BufWriter::new(file), w as u32, h as u32);+ enc.set_color(png::ColorType::Rgba);+ enc.set_depth(png::BitDepth::Eight);+ enc.write_header().unwrap().write_image_data(&rgba).unwrap();+ println!("wrote {path} ({w}x{h})");+ }+ });+}diff --git a/bindings/rust/blenderui/src/color.rs b/bindings/rust/blenderui/src/color.rsnew file mode 100644index 0000000..c3fdd85--- /dev/null+++ b/bindings/rust/blenderui/src/color.rs@@ -0,0 +1,219 @@+//! Colors: gpui-style constructors (`rgb`, `rgba`, `hsla`) and CSS color parsing.++/// A color with straight (non-premultiplied) alpha, channels in 0..=1.+#[derive(Clone, Copy, Debug, PartialEq, Default)]+pub struct Rgba {+ pub r: f32,+ pub g: f32,+ pub b: f32,+ pub a: f32,+}++/// gpui's color type name; here the same as [`Rgba`].+pub type Hsla = Rgba;++impl Rgba {+ pub const TRANSPARENT: Rgba = Rgba { r: 0.0, g: 0.0, b: 0.0, a: 0.0 };++ /// The same color with its alpha multiplied by `factor`.+ pub fn opacity(self, factor: f32) -> Rgba {+ Rgba { a: self.a * factor, ..self }+ }++ /// The same color with alpha `a`.+ pub fn alpha(self, a: f32) -> Rgba {+ Rgba { a, ..self }+ }++ pub fn is_transparent(&self) -> bool {+ self.a <= 0.0+ }++ pub(crate) fn to_array(self) -> [f32; 4] {+ [self.r, self.g, self.b, self.a]+ }+}++/// `rgb(0xRRGGBB)`.+pub fn rgb(hex: u32) -> Rgba {+ rgba((hex << 8) | 0xff)+}++/// `rgba(0xRRGGBBAA)`.+pub fn rgba(hex: u32) -> Rgba {+ let c = |shift: u32| ((hex >> shift) & 0xff) as f32 / 255.0;+ Rgba { r: c(24), g: c(16), b: c(8), a: c(0) }+}++/// `hsla(h, s, l, a)` with every component in 0..=1 (as in gpui).+pub fn hsla(h: f32, s: f32, l: f32, a: f32) -> Rgba {+ let h = h.rem_euclid(1.0) * 6.0;+ let c = (1.0 - (2.0 * l - 1.0).abs()) * s;+ let x = c * (1.0 - (h % 2.0 - 1.0).abs());+ let (r, g, b) = match h as u32 {+ 0 => (c, x, 0.0),+ 1 => (x, c, 0.0),+ 2 => (0.0, c, x),+ 3 => (0.0, x, c),+ 4 => (x, 0.0, c),+ _ => (c, 0.0, x),+ };+ let m = l - c / 2.0;+ Rgba { r: r + m, g: g + m, b: b + m, a }+}++pub fn black() -> Rgba {+ rgb(0x000000)+}+pub fn white() -> Rgba {+ rgb(0xffffff)+}+pub fn red() -> Rgba {+ rgb(0xff0000)+}+pub fn green() -> Rgba {+ rgb(0x008000)+}+pub fn blue() -> Rgba {+ rgb(0x0000ff)+}+pub fn yellow() -> Rgba {+ rgb(0xffff00)+}+pub fn transparent_black() -> Rgba {+ Rgba::TRANSPARENT+}+pub fn transparent_white() -> Rgba {+ Rgba { r: 1.0, g: 1.0, b: 1.0, a: 0.0 }+}++/// The 148 CSS named colors (CSS Color Module Level 4).+pub(crate) const NAMED: &[(&str, u32)] = &[+ ("aliceblue", 0xf0f8ff), ("antiquewhite", 0xfaebd7), ("aqua", 0x00ffff),+ ("aquamarine", 0x7fffd4), ("azure", 0xf0ffff), ("beige", 0xf5f5dc), ("bisque", 0xffe4c4),+ ("black", 0x000000), ("blanchedalmond", 0xffebcd), ("blue", 0x0000ff),+ ("blueviolet", 0x8a2be2), ("brown", 0xa52a2a), ("burlywood", 0xdeb887),+ ("cadetblue", 0x5f9ea0), ("chartreuse", 0x7fff00), ("chocolate", 0xd2691e),+ ("coral", 0xff7f50), ("cornflowerblue", 0x6495ed), ("cornsilk", 0xfff8dc),+ ("crimson", 0xdc143c), ("cyan", 0x00ffff), ("darkblue", 0x00008b), ("darkcyan", 0x008b8b),+ ("darkgoldenrod", 0xb8860b), ("darkgray", 0xa9a9a9), ("darkgreen", 0x006400),+ ("darkgrey", 0xa9a9a9), ("darkkhaki", 0xbdb76b), ("darkmagenta", 0x8b008b),+ ("darkolivegreen", 0x556b2f), ("darkorange", 0xff8c00), ("darkorchid", 0x9932cc),+ ("darkred", 0x8b0000), ("darksalmon", 0xe9967a), ("darkseagreen", 0x8fbc8f),+ ("darkslateblue", 0x483d8b), ("darkslategray", 0x2f4f4f), ("darkslategrey", 0x2f4f4f),+ ("darkturquoise", 0x00ced1), ("darkviolet", 0x9400d3), ("deeppink", 0xff1493),+ ("deepskyblue", 0x00bfff), ("dimgray", 0x696969), ("dimgrey", 0x696969),+ ("dodgerblue", 0x1e90ff), ("firebrick", 0xb22222), ("floralwhite", 0xfffaf0),+ ("forestgreen", 0x228b22), ("fuchsia", 0xff00ff), ("gainsboro", 0xdcdcdc),+ ("ghostwhite", 0xf8f8ff), ("gold", 0xffd700), ("goldenrod", 0xdaa520), ("gray", 0x808080),+ ("green", 0x008000), ("greenyellow", 0xadff2f), ("grey", 0x808080), ("honeydew", 0xf0fff0),+ ("hotpink", 0xff69b4), ("indianred", 0xcd5c5c), ("indigo", 0x4b0082), ("ivory", 0xfffff0),+ ("khaki", 0xf0e68c), ("lavender", 0xe6e6fa), ("lavenderblush", 0xfff0f5),+ ("lawngreen", 0x7cfc00), ("lemonchiffon", 0xfffacd), ("lightblue", 0xadd8e6),+ ("lightcoral", 0xf08080), ("lightcyan", 0xe0ffff), ("lightgoldenrodyellow", 0xfafad2),+ ("lightgray", 0xd3d3d3), ("lightgreen", 0x90ee90), ("lightgrey", 0xd3d3d3),+ ("lightpink", 0xffb6c1), ("lightsalmon", 0xffa07a), ("lightseagreen", 0x20b2aa),+ ("lightskyblue", 0x87cefa), ("lightslategray", 0x778899), ("lightslategrey", 0x778899),+ ("lightsteelblue", 0xb0c4de), ("lightyellow", 0xffffe0), ("lime", 0x00ff00),+ ("limegreen", 0x32cd32), ("linen", 0xfaf0e6), ("magenta", 0xff00ff), ("maroon", 0x800000),+ ("mediumaquamarine", 0x66cdaa), ("mediumblue", 0x0000cd), ("mediumorchid", 0xba55d3),+ ("mediumpurple", 0x9370db), ("mediumseagreen", 0x3cb371), ("mediumslateblue", 0x7b68ee),+ ("mediumspringgreen", 0x00fa9a), ("mediumturquoise", 0x48d1cc),+ ("mediumvioletred", 0xc71585), ("midnightblue", 0x191970), ("mintcream", 0xf5fffa),+ ("mistyrose", 0xffe4e1), ("moccasin", 0xffe4b5), ("navajowhite", 0xffdead),+ ("navy", 0x000080), ("oldlace", 0xfdf5e6), ("olive", 0x808000), ("olivedrab", 0x6b8e23),+ ("orange", 0xffa500), ("orangered", 0xff4500), ("orchid", 0xda70d6),+ ("palegoldenrod", 0xeee8aa), ("palegreen", 0x98fb98), ("paleturquoise", 0xafeeee),+ ("palevioletred", 0xdb7093), ("papayawhip", 0xffefd5), ("peachpuff", 0xffdab9),+ ("peru", 0xcd853f), ("pink", 0xffc0cb), ("plum", 0xdda0dd), ("powderblue", 0xb0e0e6),+ ("purple", 0x800080), ("rebeccapurple", 0x663399), ("red", 0xff0000),+ ("rosybrown", 0xbc8f8f), ("royalblue", 0x4169e1), ("saddlebrown", 0x8b4513),+ ("salmon", 0xfa8072), ("sandybrown", 0xf4a460), ("seagreen", 0x2e8b57),+ ("seashell", 0xfff5ee), ("sienna", 0xa0522d), ("silver", 0xc0c0c0), ("skyblue", 0x87ceeb),+ ("slateblue", 0x6a5acd), ("slategray", 0x708090), ("slategrey", 0x708090),+ ("snow", 0xfffafa), ("springgreen", 0x00ff7f), ("steelblue", 0x4682b4), ("tan", 0xd2b48c),+ ("teal", 0x008080), ("thistle", 0xd8bfd8), ("tomato", 0xff6347), ("turquoise", 0x40e0d0),+ ("violet", 0xee82ee), ("wheat", 0xf5deb3), ("white", 0xffffff), ("whitesmoke", 0xf5f5f5),+ ("yellow", 0xffff00), ("yellowgreen", 0x9acd32),+];++/// Parse a CSS color: `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb()`/`rgba()`,+/// `hsl()`/`hsla()` (comma or space syntax, `/ alpha`), named colors and+/// `transparent`. `currentcolor` is resolved by the cascade.+pub fn parse_color(s: &str) -> Option<Rgba> {+ let s = s.trim().to_ascii_lowercase();+ if s == "transparent" {+ return Some(Rgba::TRANSPARENT);+ }+ if let Some(hex) = s.strip_prefix('#') {+ let v = u32::from_str_radix(hex, 16).ok()?;+ let nib = |i: usize| (((v >> (4 * i)) & 0xf)) * 0x11;+ return Some(match hex.len() {+ 3 => rgb((nib(2) << 16) | (nib(1) << 8) | nib(0)),+ 4 => rgba((nib(3) << 24) | (nib(2) << 16) | (nib(1) << 8) | nib(0)),+ 6 => rgb(v),+ 8 => rgba(v),+ _ => return None,+ });+ }+ if let Some((name, rest)) = s.split_once('(') {+ let args: Vec<&str> = rest+ .trim_end_matches(')')+ .split(|c: char| c == ',' || c == '/' || c.is_whitespace())+ .filter(|a| !a.is_empty())+ .collect();+ let num = |a: &str, scale: f32| -> Option<f32> {+ match a.strip_suffix('%') {+ Some(p) => p.parse::<f32>().ok().map(|v| v / 100.0),+ None => a.trim_end_matches("deg").parse::<f32>().ok().map(|v| v / scale),+ }+ };+ let alpha = args.get(3).and_then(|a| num(a, 1.0)).unwrap_or(1.0);+ return match name.trim() {+ "rgb" | "rgba" => Some(Rgba {+ r: num(args.first()?, 255.0)?,+ g: num(args.get(1)?, 255.0)?,+ b: num(args.get(2)?, 255.0)?,+ a: alpha,+ }),+ "hsl" | "hsla" => Some(hsla(+ num(args.first()?, 360.0)?,+ num(args.get(1)?, 100.0)?,+ num(args.get(2)?, 100.0)?,+ alpha,+ )),+ _ => None,+ };+ }+ NAMED.iter().find(|(n, _)| *n == s).map(|(_, v)| rgb(*v))+}++impl From<u32> for Rgba {+ fn from(hex: u32) -> Self {+ rgb(hex)+ }+}++impl From<&str> for Rgba {+ /// CSS color text; invalid colors become transparent.+ fn from(s: &str) -> Self {+ parse_color(s).unwrap_or(Rgba::TRANSPARENT)+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn parses_css_colors() {+ assert_eq!(parse_color("#f00"), Some(rgb(0xff0000)));+ assert_eq!(parse_color("#00ff0080").unwrap().a, 128.0 / 255.0);+ assert_eq!(parse_color("rgb(0 0 255)"), Some(rgb(0x0000ff)));+ assert_eq!(parse_color("rgba(255, 0, 0, 0.5)").unwrap().a, 0.5);+ assert_eq!(parse_color("rebeccapurple"), Some(rgb(0x663399)));+ let h = parse_color("hsl(120 100% 50%)").unwrap();+ assert!((h.g - 1.0).abs() < 1e-5 && h.r.abs() < 1e-5);+ assert_eq!(NAMED.len(), 148);+ }+}diff --git a/bindings/rust/blenderui/src/css.rs b/bindings/rust/blenderui/src/css.rsnew file mode 100644index 0000000..5158c68--- /dev/null+++ b/bindings/rust/blenderui/src/css.rs@@ -0,0 +1,736 @@+//! The CSS engine: tokens, declarations, stylesheets, selectors, cascade.+//!+//! Every way of styling (gpui/tailwind methods, `.style("...")`, the+//! user-agent stylesheet, `<style>` elements, `:hover` states) ends up as+//! [`Decl`]s applied by one property table (`style.rs`).++use std::borrow::Cow;++// ==========================================================================+// Tokens++/// A CSS component value.+#[derive(Clone, Debug, PartialEq)]+pub enum Tok {+ Num(f32),+ Dim(f32, String),+ Pct(f32),+ Ident(String),+ Hash(String),+ Str(String),+ /// `name(args)`, arguments split at top-level commas.+ Func(String, Vec<Vec<Tok>>),+ Comma,+ Slash,+ Delim(char),+}++impl Tok {+ pub(crate) fn ident(&self) -> Option<&str> {+ match self {+ Tok::Ident(s) => Some(s),+ _ => None,+ }+ }+}++/// Tokenize a CSS value (no selectors or blocks).+pub fn tokenize(s: &str) -> Vec<Tok> {+ let mut out = Vec::new();+ let b = s.as_bytes();+ let mut i = 0;+ while i < b.len() {+ let c = b[i] as char;+ if c.is_whitespace() {+ i += 1;+ } else if c == ',' {+ out.push(Tok::Comma);+ i += 1;+ } else if c == '/' {+ out.push(Tok::Slash);+ i += 1;+ } else if c == '"' || c == '\'' {+ let end = s[i + 1..].find(c).map(|e| i + 1 + e).unwrap_or(s.len());+ out.push(Tok::Str(s[i + 1..end].to_string()));+ i = end + 1;+ } else if c == '#' {+ let end = scan_name(s, i + 1);+ out.push(Tok::Hash(s[i + 1..end].to_ascii_lowercase()));+ i = end;+ } else if c.is_ascii_digit()+ || (c == '.' && b.get(i + 1).is_some_and(|d| d.is_ascii_digit()))+ || ((c == '-' || c == '+')+ && b.get(i + 1).is_some_and(|d| d.is_ascii_digit() || *d == b'.'))+ {+ let mut end = i + 1;+ while end < b.len() && (b[end].is_ascii_digit() || b[end] == b'.') {+ end += 1;+ }+ if end < b.len() && (b[end] == b'e' || b[end] == b'E')+ && b.get(end + 1).is_some_and(|d| d.is_ascii_digit() || *d == b'-')+ {+ end += 2;+ while end < b.len() && b[end].is_ascii_digit() {+ end += 1;+ }+ }+ let v: f32 = s[i..end].parse().unwrap_or(0.0);+ if end < b.len() && b[end] == b'%' {+ out.push(Tok::Pct(v));+ i = end + 1;+ } else {+ let unit_end = scan_name(s, end);+ if unit_end > end {+ out.push(Tok::Dim(v, s[end..unit_end].to_ascii_lowercase()));+ } else {+ out.push(Tok::Num(v));+ }+ i = unit_end;+ }+ } else if is_name_start(c) {+ let end = scan_name(s, i);+ let name = s[i..end].to_ascii_lowercase();+ if b.get(end) == Some(&b'(') {+ let close = matching_paren(s, end);+ let inner = &s[end + 1..close];+ let args = if name == "url" {+ vec![vec![Tok::Str(inner.trim().trim_matches(['"', '\'']).to_string())]]+ } else {+ split_top(inner, ',').into_iter().map(tokenize).collect()+ };+ out.push(Tok::Func(name, args));+ i = (close + 1).min(s.len());+ } else {+ out.push(Tok::Ident(name));+ i = end;+ }+ } else {+ out.push(Tok::Delim(c));+ i += c.len_utf8();+ }+ }+ out+}++fn is_name_start(c: char) -> bool {+ c.is_ascii_alphabetic() || c == '-' || c == '_' || !c.is_ascii()+}++fn scan_name(s: &str, mut i: usize) -> usize {+ let b = s.as_bytes();+ while i < b.len() && (b[i].is_ascii_alphanumeric() || b[i] == b'-' || b[i] == b'_' || b[i] >= 0x80)+ {+ i += 1;+ }+ i+}++fn matching_paren(s: &str, open: usize) -> usize {+ let mut depth = 0;+ for (k, c) in s[open..].char_indices() {+ match c {+ '(' => depth += 1,+ ')' => {+ depth -= 1;+ if depth == 0 {+ return open + k;+ }+ }+ _ => {}+ }+ }+ s.len()+}++/// Split at `sep` outside parentheses and quotes.+pub(crate) fn split_top(s: &str, sep: char) -> Vec<&str> {+ let mut parts = Vec::new();+ let (mut depth, mut quote, mut start) = (0i32, None::<char>, 0);+ for (k, c) in s.char_indices() {+ match (quote, c) {+ (Some(q), _) if c == q => quote = None,+ (Some(_), _) => {}+ (None, '"' | '\'') => quote = Some(c),+ (None, '(' | '[') => depth += 1,+ (None, ')' | ']') => depth -= 1,+ (None, _) if c == sep && depth == 0 => {+ parts.push(&s[start..k]);+ start = k + c.len_utf8();+ }+ _ => {}+ }+ }+ parts.push(&s[start..]);+ parts+}++// ==========================================================================+// Declarations++/// One `property: value` declaration.+#[derive(Clone, Debug, PartialEq)]+pub struct Decl {+ pub prop: Cow<'static, str>,+ /// Tokens, shared: equal value strings tokenize once per thread.+ pub value: std::sync::Arc<[Tok]>,+ pub important: bool,+}++/// Tokenize through a per-thread cache (style methods repeat the same values+/// every render: `.w(px(40.0))` is "40px" a thousand times).+fn tokenize_cached(value: &str) -> std::sync::Arc<[Tok]> {+ use std::cell::RefCell;+ use std::collections::HashMap;+ thread_local! {+ static CACHE: RefCell<HashMap<String, std::sync::Arc<[Tok]>>> = RefCell::new(HashMap::new());+ }+ CACHE.with(|c| {+ if let Some(t) = c.borrow().get(value) {+ return t.clone();+ }+ let t: std::sync::Arc<[Tok]> = tokenize(value).into();+ let mut c = c.borrow_mut();+ if c.len() > 50_000 {+ c.clear();+ }+ c.insert(value.to_owned(), t.clone());+ t+ })+}++impl Decl {+ pub fn new(prop: impl Into<Cow<'static, str>>, value: &str) -> Decl {+ let mut value = value.trim();+ let mut important = false;+ if let Some(v) = value.strip_suffix("!important") {+ value = v.trim_end();+ important = true;+ }+ let prop = prop.into();+ let prop = if prop.bytes().any(|b| b.is_ascii_uppercase()) {+ Cow::Owned(prop.to_ascii_lowercase())+ } else {+ prop+ };+ Decl { prop, value: tokenize_cached(value), important }+ }+}++/// Parse a declaration block: `color: red; padding: 4px 8px`.+pub fn parse_declarations(block: &str) -> Vec<Decl> {+ split_top(&strip_comments(block), ';')+ .into_iter()+ .filter_map(|d| {+ let (name, value) = d.split_once(':')?;+ let name = name.trim();+ (!name.is_empty()).then(|| Decl::new(name.to_ascii_lowercase(), value))+ })+ .collect()+}++pub(crate) fn strip_comments(s: &str) -> String {+ let mut out = String::with_capacity(s.len());+ let mut rest = s;+ while let Some(start) = rest.find("/*") {+ out.push_str(&rest[..start]);+ rest = rest[start + 2..].find("*/").map(|e| &rest[start + 2 + e + 2..]).unwrap_or("");+ }+ out.push_str(rest);+ out+}++// ==========================================================================+// Selectors++#[derive(Clone, Debug, PartialEq)]+enum AttrOp {+ Exists,+ Eq,+ Word,+ Prefix,+ Suffix,+ Contains,+ Dash,+}++#[derive(Clone, Debug, PartialEq)]+enum Simple {+ Universal,+ Tag(String),+ Id(String),+ Class(String),+ Attr(String, AttrOp, String),+ Pseudo(String),+ NthChild(i32, i32, bool), // an+b, from the end+ Not(Vec<Simple>),+}++#[derive(Clone, Copy, Debug, PartialEq)]+enum Combinator {+ Descendant,+ Child,+ Adjacent,+ Sibling,+}++/// A complex selector: compounds joined by combinators (stored right to left).+#[derive(Clone, Debug, PartialEq)]+pub struct Selector {+ parts: Vec<(Vec<Simple>, Option<Combinator>)>,+ pub specificity: (u16, u16, u16),+}++/// What a selector can ask about an element.+pub trait Subject: Sized {+ fn tag(&self) -> &str;+ fn id(&self) -> Option<&str>;+ fn has_class(&self, class: &str) -> bool;+ fn attr(&self, name: &str) -> Option<&str>;+ fn state(&self, pseudo: &str) -> bool;+ fn parent(&self) -> Option<Self>;+ fn prev_sibling(&self) -> Option<Self>;+ /// 1-based position among element siblings, and their count.+ fn position(&self) -> (usize, usize);+ fn is_empty(&self) -> bool;+ /// The `class` attribute (used to find candidate rules quickly).+ fn class_attr(&self) -> Option<&str> {+ self.attr("class")+ }+}++impl Selector {+ /// Parse one complex selector; None for unsupported syntax+ /// (pseudo-elements), so the rule is skipped as browsers do.+ pub fn parse(s: &str) -> Option<Selector> {+ let s = s.trim();+ if s.is_empty() || s.contains("::") {+ return None;+ }+ let mut parts: Vec<(Vec<Simple>, Option<Combinator>)> = Vec::new();+ let mut pending: Option<Combinator> = None;+ let mut i = 0;+ let b = s.as_bytes();+ while i < b.len() {+ let c = b[i] as char;+ if c.is_whitespace() {+ i += 1;+ if pending.is_none() && !parts.is_empty() {+ pending = Some(Combinator::Descendant);+ }+ continue;+ }+ if matches!(c, '>' | '+' | '~') {+ pending = Some(match c {+ '>' => Combinator::Child,+ '+' => Combinator::Adjacent,+ _ => Combinator::Sibling,+ });+ i += 1;+ continue;+ }+ let (compound, next) = parse_compound(s, i)?;+ if let Some(last) = parts.last_mut() {+ last.1 = Some(pending.unwrap_or(Combinator::Descendant));+ }+ parts.push((compound, None));+ pending = None;+ i = next;+ }+ if parts.is_empty() {+ return None;+ }+ parts.reverse(); // match from the subject outwards+ let mut spec = (0u16, 0u16, 0u16);+ for (compound, _) in &parts {+ add_specificity(compound, &mut spec);+ }+ // the combinator stored with a compound links it to the *previous* one (leftwards)+ let n = parts.len();+ let combs: Vec<Option<Combinator>> = parts.iter().map(|p| p.1).collect();+ for k in 0..n {+ parts[k].1 = if k + 1 < n { combs[k + 1] } else { None };+ }+ Some(Selector { parts, specificity: spec })+ }++ /// The bucket a rule is filed under: its subject's id, class, tag, or "*".+ fn bucket(&self) -> String {+ let subject = &self.parts[0].0;+ subject.iter().find_map(|s| match s {+ Simple::Id(i) => Some(format!("#{i}")),+ _ => None,+ }).or_else(|| subject.iter().find_map(|s| match s {+ Simple::Class(c) => Some(format!(".{c}")),+ _ => None,+ })).or_else(|| subject.iter().find_map(|s| match s {+ Simple::Tag(t) => Some(t.to_ascii_lowercase()),+ _ => None,+ })).unwrap_or_else(|| "*".into())+ }++ pub fn matches<S: Subject + Clone>(&self, el: &S) -> bool {+ match_from(&self.parts, 0, el)+ }+}++fn add_specificity(compound: &[Simple], spec: &mut (u16, u16, u16)) {+ for s in compound {+ match s {+ Simple::Id(_) => spec.0 += 1,+ Simple::Class(_) | Simple::Attr(..) | Simple::Pseudo(_) | Simple::NthChild(..) => {+ spec.1 += 1+ }+ Simple::Tag(_) => spec.2 += 1,+ Simple::Not(inner) => add_specificity(inner, spec),+ Simple::Universal => {}+ }+ }+}++fn match_from<S: Subject + Clone>(parts: &[(Vec<Simple>, Option<Combinator>)], k: usize, el: &S)+ -> bool {+ let (compound, comb) = &parts[k];+ if !compound.iter().all(|s| match_simple(s, el)) {+ return false;+ }+ let Some(comb) = comb else { return true };+ match comb {+ Combinator::Child => el.parent().is_some_and(|p| match_from(parts, k + 1, &p)),+ Combinator::Descendant => {+ let mut cur = el.parent();+ while let Some(p) = cur {+ if match_from(parts, k + 1, &p) {+ return true;+ }+ cur = p.parent();+ }+ false+ }+ Combinator::Adjacent => el.prev_sibling().is_some_and(|p| match_from(parts, k + 1, &p)),+ Combinator::Sibling => {+ let mut cur = el.prev_sibling();+ while let Some(p) = cur {+ if match_from(parts, k + 1, &p) {+ return true;+ }+ cur = p.prev_sibling();+ }+ false+ }+ }+}++fn match_simple<S: Subject + Clone>(s: &Simple, el: &S) -> bool {+ match s {+ Simple::Universal => true,+ Simple::Tag(t) => el.tag().eq_ignore_ascii_case(t),+ Simple::Id(id) => el.id() == Some(id.as_str()),+ Simple::Class(c) => el.has_class(c),+ Simple::Attr(name, op, val) => match (el.attr(name), op) {+ (None, _) => false,+ (Some(_), AttrOp::Exists) => true,+ (Some(v), AttrOp::Eq) => v == val,+ (Some(v), AttrOp::Word) => v.split_whitespace().any(|w| w == val),+ (Some(v), AttrOp::Prefix) => v.starts_with(val.as_str()),+ (Some(v), AttrOp::Suffix) => v.ends_with(val.as_str()),+ (Some(v), AttrOp::Contains) => v.contains(val.as_str()),+ (Some(v), AttrOp::Dash) => v == val || v.starts_with(&format!("{val}-")),+ },+ Simple::Pseudo(p) => match p.as_str() {+ "first-child" => el.position().0 == 1,+ "last-child" => {+ let (i, n) = el.position();+ i == n+ }+ "only-child" => el.position().1 == 1,+ "root" => el.parent().is_none(),+ "empty" => el.is_empty(),+ "first-of-type" | "last-of-type" => {+ // approximated with element position+ let (i, n) = el.position();+ if p == "first-of-type" { i == 1 } else { i == n }+ }+ other => el.state(other),+ },+ Simple::NthChild(a, b, from_end) => {+ let (i, n) = el.position();+ let pos = if *from_end { (n + 1 - i) as i32 } else { i as i32 };+ if *a == 0 {+ pos == *b+ } else {+ (pos - b) % a == 0 && (pos - b) / a >= 0+ }+ }+ Simple::Not(inner) => !inner.iter().all(|s| match_simple(s, el)),+ }+}++fn parse_compound(s: &str, mut i: usize) -> Option<(Vec<Simple>, usize)> {+ let b = s.as_bytes();+ let mut out = Vec::new();+ while i < b.len() {+ let c = b[i] as char;+ match c {+ '*' => {+ out.push(Simple::Universal);+ i += 1;+ }+ '#' | '.' => {+ let end = scan_name(s, i + 1);+ let name = s[i + 1..end].to_string();+ out.push(if c == '#' { Simple::Id(name) } else { Simple::Class(name) });+ i = end;+ }+ '[' => {+ let close = s[i..].find(']')? + i;+ out.push(parse_attr(&s[i + 1..close])?);+ i = close + 1;+ }+ ':' => {+ let end = scan_name(s, i + 1);+ let name = s[i + 1..end].to_ascii_lowercase();+ if b.get(end) == Some(&b'(') {+ let close = matching_paren(s, end);+ let arg = s[end + 1..close].trim();+ out.push(match name.as_str() {+ "not" => Simple::Not(parse_compound(arg, 0)?.0),+ "nth-child" | "nth-last-child" | "nth-of-type" | "nth-last-of-type" => {+ let (a, bb) = parse_nth(arg)?;+ Simple::NthChild(a, bb, name.contains("last"))+ }+ "is" | "where" => {+ // first alternative only (simple and common)+ let first = split_top(arg, ',')[0];+ Simple::Not(vec![Simple::Not(parse_compound(first.trim(), 0)?.0)])+ }+ _ => return None,+ });+ i = close + 1;+ } else {+ out.push(Simple::Pseudo(name));+ i = end;+ }+ }+ c if is_name_start(c) => {+ let end = scan_name(s, i);+ out.push(Simple::Tag(s[i..end].to_ascii_lowercase()));+ i = end;+ }+ _ => break,+ }+ }+ (!out.is_empty()).then_some((out, i))+}++fn parse_attr(inner: &str) -> Option<Simple> {+ for (op, kind) in [("~=", AttrOp::Word), ("^=", AttrOp::Prefix), ("$=", AttrOp::Suffix),+ ("*=", AttrOp::Contains), ("|=", AttrOp::Dash), ("=", AttrOp::Eq)] {+ if let Some((name, val)) = inner.split_once(op) {+ let val = val.trim().trim_matches(['"', '\'']).to_string();+ return Some(Simple::Attr(name.trim().to_ascii_lowercase(), kind, val));+ }+ }+ Some(Simple::Attr(inner.trim().to_ascii_lowercase(), AttrOp::Exists, String::new()))+}++fn parse_nth(arg: &str) -> Option<(i32, i32)> {+ let a = arg.replace(' ', "").to_ascii_lowercase();+ match a.as_str() {+ "odd" => return Some((2, 1)),+ "even" => return Some((2, 0)),+ _ => {}+ }+ if let Some((x, y)) = a.split_once('n') {+ let x = match x {+ "" | "+" => 1,+ "-" => -1,+ v => v.parse().ok()?,+ };+ let y = if y.is_empty() { 0 } else { y.parse().ok()? };+ Some((x, y))+ } else {+ Some((0, a.parse().ok()?))+ }+}++// ==========================================================================+// Stylesheets++/// One rule: a selector with its declarations, in source order.+#[derive(Clone, Debug)]+pub struct Rule {+ pub selector: Selector,+ pub decls: Vec<Decl>,+ pub order: usize,+ media: Option<Media>,+}++#[derive(Clone, Debug, PartialEq)]+struct Media {+ min_width: Option<f32>,+ max_width: Option<f32>,+ min_height: Option<f32>,+ max_height: Option<f32>,+ dark: Option<bool>,+}++impl Media {+ fn parse(q: &str) -> Media {+ let mut m = Media { min_width: None, max_width: None, min_height: None, max_height: None,+ dark: None };+ for part in q.split("and") {+ let part = part.trim().trim_matches(['(', ')']).trim();+ if let Some((k, v)) = part.split_once(':') {+ let v = v.trim();+ let px = v.trim_end_matches("px").parse::<f32>().ok();+ match k.trim() {+ "min-width" => m.min_width = px,+ "max-width" => m.max_width = px,+ "min-height" => m.min_height = px,+ "max-height" => m.max_height = px,+ "prefers-color-scheme" => m.dark = Some(v == "dark"),+ _ => {}+ }+ }+ }+ m+ }++ fn applies(&self, viewport: (f32, f32)) -> bool {+ self.min_width.is_none_or(|w| viewport.0 >= w)+ && self.max_width.is_none_or(|w| viewport.0 <= w)+ && self.min_height.is_none_or(|h| viewport.1 >= h)+ && self.max_height.is_none_or(|h| viewport.1 <= h)+ && self.dark.is_none_or(|d| d) // Blender's theme is dark+ }+}++/// A parsed stylesheet.+#[derive(Clone, Debug, Default)]+pub struct Stylesheet {+ pub rules: Vec<Rule>,+ /// Rule indices by subject id / class / tag / "*" (rebuilt when `rules` changes length).+ index: std::collections::HashMap<String, Vec<usize>>,+ indexed: usize,+}++impl Stylesheet {+ /// Parse CSS text (rules, `@media` blocks; other at-rules are skipped).+ pub fn parse(css: &str) -> Stylesheet {+ let mut sheet = Stylesheet::default();+ sheet.parse_into(&strip_comments(css), None);+ sheet.reindex();+ sheet+ }++ fn reindex(&mut self) {+ self.index.clear();+ for (k, r) in self.rules.iter().enumerate() {+ self.index.entry(r.selector.bucket()).or_default().push(k);+ }+ self.indexed = self.rules.len();+ }++ fn parse_into(&mut self, css: &str, media: Option<Media>) {+ let mut rest = css;+ while let Some(open) = rest.find('{') {+ let prelude = rest[..open].trim();+ let close = block_end(rest, open);+ let body = &rest[open + 1..close.min(rest.len())];+ if let Some(q) = prelude.strip_prefix("@media") {+ self.parse_into(body, Some(Media::parse(q)));+ } else if !prelude.starts_with('@') {+ let decls = parse_declarations(body);+ for sel in split_top(prelude, ',') {+ if let Some(selector) = Selector::parse(sel) {+ let order = self.rules.len();+ self.rules.push(Rule { selector, decls: decls.clone(), order,+ media: media.clone() });+ }+ }+ }+ rest = &rest[(close + 1).min(rest.len())..];+ }+ }++ /// Declarations of every matching rule, in cascade order.+ pub fn matching<'a, S: Subject + Clone>(&'a self, el: &S, viewport: (f32, f32))+ -> Vec<&'a Rule> {+ let ok = |r: &&Rule| r.media.as_ref().is_none_or(|m| m.applies(viewport)) && r.selector.matches(el);+ let mut hits: Vec<&Rule> = if self.indexed != self.rules.len() {+ self.rules.iter().filter(ok).collect() // `rules` edited by hand: scan all+ } else {+ let mut cand: Vec<usize> = Vec::new();+ let mut take = |key: &str| {+ if let Some(v) = self.index.get(key) {+ cand.extend_from_slice(v);+ }+ };+ take("*");+ take(&el.tag().to_ascii_lowercase());+ if let Some(id) = el.id() {+ take(&format!("#{id}"));+ }+ if let Some(classes) = el.class_attr() {+ for c in classes.split_whitespace() {+ take(&format!(".{c}"));+ }+ }+ cand.sort_unstable();+ cand.dedup();+ cand.into_iter().map(|k| &self.rules[k]).filter(ok).collect()+ };+ hits.sort_by_key(|r| (r.selector.specificity, r.order));+ hits+ }+}++fn block_end(s: &str, open: usize) -> usize {+ let mut depth = 0;+ for (k, c) in s[open..].char_indices() {+ match c {+ '{' => depth += 1,+ '}' => {+ depth -= 1;+ if depth == 0 {+ return open + k;+ }+ }+ _ => {}+ }+ }+ s.len()+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn tokenizes_values() {+ let t = tokenize("1px solid rgb(255, 0, 0) 50% -2.5rem #abc 'x'");+ assert_eq!(t[0], Tok::Dim(1.0, "px".into()));+ assert_eq!(t[1], Tok::Ident("solid".into()));+ assert!(matches!(&t[2], Tok::Func(n, args) if n == "rgb" && args.len() == 3));+ assert_eq!(t[3], Tok::Pct(50.0));+ assert_eq!(t[4], Tok::Dim(-2.5, "rem".into()));+ assert_eq!(t[5], Tok::Hash("abc".into()));+ assert_eq!(t[6], Tok::Str("x".into()));+ }++ #[test]+ fn parses_blocks_and_important() {+ let d = parse_declarations("color: red; padding: 4px 8px !important; /* c */ ;");+ assert_eq!(d.len(), 2);+ assert!(d[1].important && d[1].value.len() == 2);+ }++ #[test]+ fn selector_specificity() {+ let s = Selector::parse("ul > li.item:hover a#x").unwrap();+ assert_eq!(s.specificity, (1, 2, 3));+ assert!(Selector::parse("p::before").is_none());+ let sheet = Stylesheet::parse("@media (max-width: 100px) { p { color: red } } a { b: c }");+ assert_eq!(sheet.rules.len(), 2);+ }+}diff --git a/bindings/rust/blenderui/src/element.rs b/bindings/rust/blenderui/src/element.rsnew file mode 100644index 0000000..0c5793b--- /dev/null+++ b/bindings/rust/blenderui/src/element.rs@@ -0,0 +1,342 @@+//! Elements: one [`Div`] type for every HTML tag, built gpui-style.++use std::borrow::Cow;+use std::rc::Rc;++use crate::css::Decl;+pub use crate::styled::Styled;+use crate::events::*;+use crate::window::{App, Window};++/// Shared, cheap-to-clone text (gpui's `SharedString`).+pub type SharedString = Cow<'static, str>;++/// An element identifier (gpui's `ElementId`): keeps widget and scroll+/// state across renders.+pub type ElementId = SharedString;++pub(crate) type Listener<E> = Rc<dyn Fn(&E, &mut Window, &mut App)>;++/// Custom painting (gpui's `canvas()` element).+pub(crate) type PaintFn = Rc<dyn Fn(crate::geometry::Bounds<f32>, &mut crate::paint::Painter)>;++#[derive(Clone, Default)]+pub(crate) struct Listeners {+ pub click: Vec<Listener<ClickEvent>>,+ pub mouse_down: Vec<(Option<MouseButton>, Listener<MouseDownEvent>)>,+ pub mouse_up: Vec<(Option<MouseButton>, Listener<MouseUpEvent>)>,+ pub mouse_move: Vec<Listener<MouseMoveEvent>>,+ pub hover: Vec<Listener<bool>>,+ pub scroll: Vec<Listener<ScrollWheelEvent>>,+ pub key_down: Vec<Listener<KeyDownEvent>>,+ pub key_up: Vec<Listener<KeyUpEvent>>,+ pub change: Vec<Listener<ChangeEvent>>,+ pub input: Vec<Listener<ChangeEvent>>,+}++/// An element: a tag, its attributes, styles, children and listeners.+/// `div()`, `span()`, `button()` ... all build one of these.+#[derive(Clone)]+pub struct Div {+ pub(crate) tag: &'static str,+ pub(crate) id: Option<ElementId>,+ pub(crate) attrs: Vec<(SharedString, SharedString)>,+ pub(crate) decls: Vec<Decl>,+ pub(crate) hover: Vec<Decl>,+ pub(crate) active: Vec<Decl>,+ pub(crate) focus: Vec<Decl>,+ pub(crate) children: Vec<AnyElement>,+ pub(crate) listeners: Listeners,+ pub(crate) paint: Option<PaintFn>,+ pub(crate) image: Option<Rc<crate::paint::Image>>,+}++/// Anything that can be a child: an element or a text run.+#[derive(Clone)]+pub enum AnyElement {+ Element(Box<Div>),+ Text(SharedString),+}++/// Convert into an element (gpui's `IntoElement`).+pub trait IntoElement {+ fn into_any_element(self) -> AnyElement;+}++impl IntoElement for Div {+ fn into_any_element(self) -> AnyElement {+ AnyElement::Element(Box::new(self))+ }+}+impl IntoElement for AnyElement {+ fn into_any_element(self) -> AnyElement {+ self+ }+}+impl IntoElement for &'static str {+ fn into_any_element(self) -> AnyElement {+ AnyElement::Text(Cow::Borrowed(self))+ }+}+impl IntoElement for String {+ fn into_any_element(self) -> AnyElement {+ AnyElement::Text(Cow::Owned(self))+ }+}+impl IntoElement for Cow<'static, str> {+ fn into_any_element(self) -> AnyElement {+ AnyElement::Text(self)+ }+}++impl Div {+ pub(crate) fn new(tag: &'static str) -> Div {+ Div {+ tag,+ id: None,+ attrs: Vec::new(),+ decls: Vec::new(),+ hover: Vec::new(),+ active: Vec::new(),+ focus: Vec::new(),+ children: Vec::new(),+ listeners: Listeners::default(),+ paint: None,+ image: None,+ }+ }++ /// The HTML tag name.+ pub fn tag(&self) -> &'static str {+ self.tag+ }++ /// Give the element an identity (keeps state such as scroll position and+ /// form values across renders).+ pub fn id(mut self, id: impl Into<ElementId>) -> Self {+ let id = id.into();+ self.attrs.push(("id".into(), id.clone()));+ self.id = Some(id);+ self+ }++ /// Set an HTML attribute (`href`, `type`, `value`, `placeholder` ...).+ pub fn attr(mut self, name: impl Into<SharedString>, value: impl Into<SharedString>) -> Self {+ let name = name.into();+ self.attrs.retain(|(n, _)| *n != name);+ self.attrs.push((name, value.into()));+ self+ }++ /// Add CSS classes (matched by stylesheets).+ pub fn class(mut self, classes: impl Into<SharedString>) -> Self {+ let add = classes.into();+ match self.attrs.iter_mut().find(|(n, _)| n == "class") {+ Some((_, v)) => *v = format!("{v} {add}").into(),+ None => self.attrs.push(("class".into(), add)),+ }+ self+ }++ pub(crate) fn get_attr(&self, name: &str) -> Option<&str> {+ self.attrs.iter().rev().find(|(n, _)| n == name).map(|(_, v)| v.as_ref())+ }++ // -- common HTML attributes, typed ---------------------------------------------+ pub fn href(self, url: impl Into<SharedString>) -> Self {+ self.attr("href", url)+ }+ pub fn value(self, v: impl Into<SharedString>) -> Self {+ self.attr("value", v)+ }+ pub fn placeholder(self, v: impl Into<SharedString>) -> Self {+ self.attr("placeholder", v)+ }+ pub fn input_type(self, t: impl Into<SharedString>) -> Self {+ self.attr("type", t)+ }+ pub fn name(self, n: impl Into<SharedString>) -> Self {+ self.attr("name", n)+ }+ pub fn checked(self, on: bool) -> Self {+ if on { self.attr("checked", "") } else { self.remove_attr("checked") }+ }+ pub fn disabled(self, on: bool) -> Self {+ if on { self.attr("disabled", "") } else { self.remove_attr("disabled") }+ }+ pub fn selected(self, on: bool) -> Self {+ if on { self.attr("selected", "") } else { self.remove_attr("selected") }+ }+ pub fn open(self, on: bool) -> Self {+ if on { self.attr("open", "") } else { self.remove_attr("open") }+ }+ pub fn min(self, v: f64) -> Self {+ self.attr("min", v.to_string())+ }+ pub fn max(self, v: f64) -> Self {+ self.attr("max", v.to_string())+ }+ pub fn step(self, v: f64) -> Self {+ self.attr("step", v.to_string())+ }+ pub fn src(self, path: impl Into<SharedString>) -> Self {+ self.attr("src", path)+ }+ pub fn alt(self, text: impl Into<SharedString>) -> Self {+ self.attr("alt", text)+ }+ pub fn title(self, text: impl Into<SharedString>) -> Self {+ self.attr("title", text)+ }+ pub fn colspan(self, n: u32) -> Self {+ self.attr("colspan", n.to_string())+ }++ fn remove_attr(mut self, name: &str) -> Self {+ self.attrs.retain(|(n, _)| n != name);+ self+ }++ /// Image pixels for `<img>`: RGBA, `width * height * 4` bytes.+ pub fn image_rgba(mut self, width: u32, height: u32, rgba: Vec<u8>) -> Self {+ self.image = Some(Rc::new(crate::paint::Image { width, height, rgba }));+ self+ }++ // -- events ----------------------------------------------------------------------------+ /// Click (press and release on this element); bubbles to ancestors.+ pub fn on_click(mut self, f: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.click.push(Rc::new(f));+ self+ }+ pub fn on_mouse_down(mut self, button: MouseButton,+ f: impl Fn(&MouseDownEvent, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.mouse_down.push((Some(button), Rc::new(f)));+ self+ }+ pub fn on_any_mouse_down(mut self,+ f: impl Fn(&MouseDownEvent, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.mouse_down.push((None, Rc::new(f)));+ self+ }+ pub fn on_mouse_up(mut self, button: MouseButton,+ f: impl Fn(&MouseUpEvent, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.mouse_up.push((Some(button), Rc::new(f)));+ self+ }+ pub fn on_mouse_move(mut self,+ f: impl Fn(&MouseMoveEvent, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.mouse_move.push(Rc::new(f));+ self+ }+ /// Called with `true` when the pointer enters, `false` when it leaves.+ pub fn on_hover(mut self, f: impl Fn(&bool, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.hover.push(Rc::new(f));+ self+ }+ pub fn on_scroll_wheel(mut self,+ f: impl Fn(&ScrollWheelEvent, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.scroll.push(Rc::new(f));+ self+ }+ pub fn on_key_down(mut self, f: impl Fn(&KeyDownEvent, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.key_down.push(Rc::new(f));+ self+ }+ pub fn on_key_up(mut self, f: impl Fn(&KeyUpEvent, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.key_up.push(Rc::new(f));+ self+ }+ /// Form controls: the committed value changed (`change` in HTML).+ pub fn on_change(mut self, f: impl Fn(&ChangeEvent, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.change.push(Rc::new(f));+ self+ }+ /// Form controls: every edit (`input` in HTML).+ pub fn on_input(mut self, f: impl Fn(&ChangeEvent, &mut Window, &mut App) + 'static) -> Self {+ self.listeners.input.push(Rc::new(f));+ self+ }++ // -- state styles (gpui's .hover(|s| ...), CSS :hover / :active / :focus) ----------------+ pub fn hover(mut self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self {+ self.hover.extend(f(StyleRefinement::default()).decls);+ self+ }+ pub fn active(mut self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self {+ self.active.extend(f(StyleRefinement::default()).decls);+ self+ }+ pub fn focus(mut self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self {+ self.focus.extend(f(StyleRefinement::default()).decls);+ self+ }+}++/// A set of style declarations (the argument of `.hover(|s| ...)`).+#[derive(Clone, Default)]+pub struct StyleRefinement {+ pub(crate) decls: Vec<Decl>,+}++impl Styled for Div {+ fn decls_mut(&mut self) -> &mut Vec<Decl> {+ &mut self.decls+ }+}+impl Styled for StyleRefinement {+ fn decls_mut(&mut self) -> &mut Vec<Decl> {+ &mut self.decls+ }+}++/// Children (gpui's `ParentElement`).+pub trait ParentElement: Sized {+ fn children_mut(&mut self) -> &mut Vec<AnyElement>;++ fn child(mut self, child: impl IntoElement) -> Self {+ self.children_mut().push(child.into_any_element());+ self+ }++ fn children(mut self, children: impl IntoIterator<Item = impl IntoElement>) -> Self {+ self.children_mut().extend(children.into_iter().map(IntoElement::into_any_element));+ self+ }+}++impl ParentElement for Div {+ fn children_mut(&mut self) -> &mut Vec<AnyElement> {+ &mut self.children+ }+}++/// Conditional building (gpui's `FluentBuilder`).+pub trait FluentBuilder: Sized {+ fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self {+ if condition { then(self) } else { self }+ }+ fn when_some<T>(self, option: Option<T>, then: impl FnOnce(Self, T) -> Self) -> Self {+ match option {+ Some(v) => then(self, v),+ None => self,+ }+ }+ fn when_none<T>(self, option: &Option<T>, then: impl FnOnce(Self) -> Self) -> Self {+ if option.is_none() { then(self) } else { self }+ }+ fn map<U>(self, f: impl FnOnce(Self) -> U) -> U {+ f(self)+ }+}++impl FluentBuilder for Div {}+impl FluentBuilder for StyleRefinement {}++/// gpui's `canvas(prepaint, paint)`: an element that paints itself.+pub fn canvas(paint: impl Fn(crate::geometry::Bounds<f32>, &mut crate::paint::Painter) + 'static)+ -> Div {+ let mut d = Div::new("canvas");+ d.paint = Some(Rc::new(paint));+ d+}diff --git a/bindings/rust/blenderui/src/events.rs b/bindings/rust/blenderui/src/events.rsnew file mode 100644index 0000000..c167bb2--- /dev/null+++ b/bindings/rust/blenderui/src/events.rs@@ -0,0 +1,96 @@+//! Event types passed to listeners (named as in gpui).++use crate::geometry::{Pixels, Point};++#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub enum MouseButton {+ Left,+ Right,+ Middle,+}++/// Modifier keys held during an event.+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]+pub struct Modifiers {+ pub shift: bool,+ pub control: bool,+ pub alt: bool,+}++impl Modifiers {+ pub(crate) fn from_kit(mods: i32) -> Modifiers {+ Modifiers { shift: mods & 1 != 0, control: mods & 2 != 0, alt: mods & 4 != 0 }+ }+}++#[derive(Clone, Debug)]+pub struct MouseDownEvent {+ pub button: MouseButton,+ pub position: Point<Pixels>,+ pub modifiers: Modifiers,+ pub click_count: usize,+}++#[derive(Clone, Debug)]+pub struct MouseUpEvent {+ pub button: MouseButton,+ pub position: Point<Pixels>,+ pub modifiers: Modifiers,+}++#[derive(Clone, Debug)]+pub struct MouseMoveEvent {+ pub position: Point<Pixels>,+ pub pressed_button: Option<MouseButton>,+ pub modifiers: Modifiers,+}++/// A click: the press and the release.+#[derive(Clone, Debug)]+pub struct ClickEvent {+ pub down: MouseDownEvent,+ pub up: MouseUpEvent,+}++impl ClickEvent {+ pub fn click_count(&self) -> usize {+ self.down.click_count+ }+}++#[derive(Clone, Debug)]+pub struct ScrollWheelEvent {+ pub position: Point<Pixels>,+ /// Lines: positive scrolls the content up (wheel away from the user).+ pub delta: f32,+ pub modifiers: Modifiers,+}++/// A key: `key` is the keysym (`"a"`, `"Return"`, `"Left"` ...).+#[derive(Clone, Debug)]+pub struct Keystroke {+ pub key: String,+ pub key_char: Option<String>,+ pub modifiers: Modifiers,+}++#[derive(Clone, Debug)]+pub struct KeyDownEvent {+ pub keystroke: Keystroke,+}++#[derive(Clone, Debug)]+pub struct KeyUpEvent {+ pub keystroke: Keystroke,+}++/// A form control's value (`input`, `select`, `textarea` ...).+#[derive(Clone, Debug, Default)]+pub struct ChangeEvent {+ /// The value as text (what `.value` holds in the DOM).+ pub value: String,+ /// Checkboxes and radio buttons.+ pub checked: bool,+ /// Numbers, ranges and selects (the selected index).+ pub number: f64,+}diff --git a/bindings/rust/blenderui/src/geometry.rs b/bindings/rust/blenderui/src/geometry.rsnew file mode 100644index 0000000..7e40a29--- /dev/null+++ b/bindings/rust/blenderui/src/geometry.rs@@ -0,0 +1,158 @@+//! Units and geometry, named as in gpui: `px`, `rems`, `relative`, `size`,+//! `point`, `Bounds`.++use std::ops::{Add, Mul, Sub};++/// Logical pixels (scaled by the monitor's DPI when drawn).+#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Default)]+pub struct Pixels(pub f32);++/// Multiples of the root font size (16 px, as in gpui and browsers).+#[derive(Clone, Copy, Debug, PartialEq, Default)]+pub struct Rems(pub f32);++pub fn px(v: f32) -> Pixels {+ Pixels(v)+}+pub fn rems(v: f32) -> Rems {+ Rems(v)+}++/// A fraction of the parent (`relative(0.5)` = 50%).+pub fn relative(fraction: f32) -> Length {+ Length::Percent(fraction * 100.0)+}++/// A CSS length before resolution.+#[derive(Clone, Copy, Debug, PartialEq, Default)]+pub enum Length {+ Px(f32),+ Rem(f32),+ Em(f32),+ Percent(f32),+ Vw(f32),+ Vh(f32),+ #[default]+ Auto,+}++impl From<Pixels> for Length {+ fn from(p: Pixels) -> Self {+ Length::Px(p.0)+ }+}+impl From<Rems> for Length {+ fn from(r: Rems) -> Self {+ Length::Rem(r.0)+ }+}+impl From<f32> for Length {+ fn from(v: f32) -> Self {+ Length::Px(v)+ }+}++pub(crate) const ROOT_FONT_SIZE: f32 = 16.0;++/// What lengths resolve against.+#[derive(Clone, Copy, Debug)]+pub struct Units {+ pub font_size: f32,+ pub viewport: (f32, f32),+}++impl Length {+ /// Absolute pixels, or None for percentages and `auto` (left to layout).+ pub(crate) fn to_px(self, u: &Units) -> Option<f32> {+ match self {+ Length::Px(v) => Some(v),+ Length::Rem(v) => Some(v * ROOT_FONT_SIZE),+ Length::Em(v) => Some(v * u.font_size),+ Length::Vw(v) => Some(v * u.viewport.0 / 100.0),+ Length::Vh(v) => Some(v * u.viewport.1 / 100.0),+ Length::Percent(_) | Length::Auto => None,+ }+ }++ /// Pixels with percentages of `basis` (auto = 0).+ pub(crate) fn resolve(self, u: &Units, basis: f32) -> f32 {+ match self {+ Length::Percent(p) => p * basis / 100.0,+ Length::Auto => 0.0,+ other => other.to_px(u).unwrap_or(0.0),+ }+ }+}++#[derive(Clone, Copy, Debug, PartialEq, Default)]+pub struct Point<T> {+ pub x: T,+ pub y: T,+}++#[derive(Clone, Copy, Debug, PartialEq, Default)]+pub struct Size<T> {+ pub width: T,+ pub height: T,+}++pub fn point<T>(x: T, y: T) -> Point<T> {+ Point { x, y }+}+pub fn size<T>(width: T, height: T) -> Size<T> {+ Size { width, height }+}++/// A rectangle: origin + size.+#[derive(Clone, Copy, Debug, PartialEq, Default)]+pub struct Bounds<T> {+ pub origin: Point<T>,+ pub size: Size<T>,+}++impl Bounds<Pixels> {+ /// A window of `size` centered on the primary screen (gpui's helper).+ pub fn centered(_display: Option<()>, size: Size<Pixels>, _cx: &crate::App) -> Self {+ Bounds { origin: point(px(0.0), px(0.0)), size }+ }+}++impl Bounds<f32> {+ pub(crate) fn contains(&self, x: f32, y: f32) -> bool {+ x >= self.origin.x+ && y >= self.origin.y+ && x < self.origin.x + self.size.width+ && y < self.origin.y + self.size.height+ }++ pub(crate) fn intersect(&self, o: &Bounds<f32>) -> Bounds<f32> {+ let x0 = self.origin.x.max(o.origin.x);+ let y0 = self.origin.y.max(o.origin.y);+ let x1 = (self.origin.x + self.size.width).min(o.origin.x + o.size.width);+ let y1 = (self.origin.y + self.size.height).min(o.origin.y + o.size.height);+ Bounds { origin: point(x0, y0), size: size((x1 - x0).max(0.0), (y1 - y0).max(0.0)) }+ }+}++pub(crate) fn rect(x: f32, y: f32, w: f32, h: f32) -> Bounds<f32> {+ Bounds { origin: point(x, y), size: size(w, h) }+}++impl Add for Pixels {+ type Output = Pixels;+ fn add(self, o: Pixels) -> Pixels {+ Pixels(self.0 + o.0)+ }+}+impl Sub for Pixels {+ type Output = Pixels;+ fn sub(self, o: Pixels) -> Pixels {+ Pixels(self.0 - o.0)+ }+}+impl Mul<f32> for Pixels {+ type Output = Pixels;+ fn mul(self, k: f32) -> Pixels {+ Pixels(self.0 * k)+ }+}diff --git a/bindings/rust/blenderui/src/html.rs b/bindings/rust/blenderui/src/html.rsnew file mode 100644index 0000000..004e3f6--- /dev/null+++ b/bindings/rust/blenderui/src/html.rs@@ -0,0 +1,157 @@+//! Every HTML element as a gpui-style constructor (`div()`, `section()`,+//! `table()` ...), all building the one [`Div`] type, plus the user-agent+//! stylesheet that gives them their default look (Blender's theme).++use std::sync::OnceLock;++use crate::css::Stylesheet;+use crate::element::Div;++/// How an element is realised.+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub enum TagKind {+ /// Laid out and painted from CSS (most elements).+ Box,+ /// A real kit widget: Blender's control with Blender's interaction.+ Widget,+ /// Replaced content with an intrinsic size (`img`, `video` ...).+ Replaced,+ /// Metadata: not rendered (`head`, `script`, `meta` ...).+ Metadata,+ /// Line break / break opportunity.+ Break,+}++macro_rules! tags {+ ($($kind:ident: $($tag:ident),+;)*) => {+ /// Every standard HTML element (WHATWG living standard) and how BUI realises it.+ pub const TAGS: &[(&str, TagKind)] = &[$($((stringify!($tag), TagKind::$kind),)+)*];+ $($(+ #[doc = concat!("The `<", stringify!($tag), ">` element.")]+ pub fn $tag() -> Div { Div::new(stringify!($tag)) }+ )+)*+ };+}++tags! {+ Box: html, body, article, section, nav, aside, h1, h2, h3, h4, h5, h6, hgroup, header,+ footer, address, p, hr, pre, blockquote, ol, ul, menu, li, dl, dt, dd, figure,+ figcaption, main, search, div, a, em, strong, small, s, cite, q, dfn, abbr, ruby, rt, rp,+ data, time, code, var, samp, kbd, sub, sup, i, b, u, mark, bdi, bdo, span, ins, del,+ picture, table, caption, colgroup, col, tbody, thead, tfoot, tr, td, th, form, label,+ fieldset, legend, details, summary, dialog, noscript, slot, output, map, selectedcontent,+ svg, math;+ Widget: button, input, select, option, optgroup, textarea, progress, meter, datalist;+ Replaced: img, iframe, embed, object, video, audio;+ Metadata: head, title, base, link, meta, style, script, template, source, track, area;+ Break: br, wbr;+}++/// `<canvas>`: painted by Rust code, see [`crate::canvas`] (gpui's `canvas()`).+pub const CANVAS_TAG: (&str, TagKind) = ("canvas", TagKind::Replaced);++/// Elements in the WHATWG HTML element index, all constructible here.+pub const HTML_ELEMENT_COUNT: usize = 113;++/// How `tag` is realised (unknown / custom elements are boxes, as in browsers).+pub fn tag_kind(tag: &str) -> TagKind {+ if tag == "canvas" {+ return TagKind::Replaced;+ }+ TAGS.iter().find(|(t, _)| *t == tag).map(|(_, k)| *k).unwrap_or(TagKind::Box)+}++/// A custom element (`custom("my-widget")`), laid out like a `<span>`.+pub fn custom(tag: &'static str) -> Div {+ Div::new(tag)+}++/// The user-agent stylesheet: the browsers' defaults (WHATWG rendering+/// section) in Blender's dark theme.+pub const UA_CSS: &str = r#"+html { display: block; background-color: #303030; color: #e6e6e6; font-size: 13px; }+body { display: block; margin: 8px; }+address, article, aside, blockquote, dd, details, dialog, div, dl, dt, fieldset, figcaption,+figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, legend, main, menu, nav, ol,+p, pre, search, section, ul, noscript, optgroup, option { display: block; }+head, title, base, link, meta, style, script, template, source, track, area, datalist, wbr,+map, [hidden], input[type=hidden], col, colgroup { display: none; }+li, summary { display: list-item; }+p, dl, figure, pre { margin: 0.6em 0; }+blockquote { margin: 0.6em 0; padding: 2px 0 2px 12px; border-left: 3px solid #4772b3; color: #b8b8b8; }+h1 { font-size: 2em; margin: 0.5em 0; font-weight: bold; }+h2 { font-size: 1.5em; margin: 0.5em 0; font-weight: bold; }+h3 { font-size: 1.17em; margin: 0.6em 0; font-weight: bold; }+h4 { font-size: 1em; margin: 0.8em 0; font-weight: bold; }+h5 { font-size: 0.83em; margin: 1em 0; font-weight: bold; }+h6 { font-size: 0.67em; margin: 1.2em 0; font-weight: bold; }+b, strong, th, legend, dt, caption { font-weight: bold; }+i, em, cite, dfn, var, address { font-style: italic; }+u, ins { text-decoration: underline; }+s, del { text-decoration: line-through; color: #999999; }+small { font-size: smaller; }+sub { vertical-align: sub; font-size: smaller; }+sup { vertical-align: super; font-size: smaller; }+code, kbd, samp, pre, var { font-family: monospace; }+code, kbd, samp { background-color: #232323; border-radius: 3px; }+kbd { border: 1px solid #555555; padding: 0 3px; }+pre { white-space: pre; background-color: #232323; padding: 6px 8px; border-radius: 4px; }+mark { background-color: #e6a23c; color: #1d1d1d; }+a { color: #5294e2; text-decoration: underline; cursor: pointer; }+a:hover { color: #78aef0; }+abbr[title] { text-decoration: underline; }+q { font-style: italic; }+rt { font-size: 50%; }+ul, menu { list-style-type: disc; padding-left: 28px; margin: 0.6em 0; }+ol { list-style-type: decimal; padding-left: 28px; margin: 0.6em 0; }+ul ul, ol ul, menu ul { list-style-type: circle; margin: 0; }+ul ul ul, ol ol ul { list-style-type: square; }+ol ol, ul ol { margin: 0; }+dd { margin-left: 28px; }+hr { border-top: 1px solid #484848; margin: 8px 0; }+table { display: table; border-spacing: 2px; }+thead, tbody, tfoot { display: table-row-group; }+tr { display: table-row; }+td, th { display: table-cell; padding: 2px 6px; }+th { text-align: center; }+thead { background-color: #282828; }+caption { display: table-caption; text-align: center; padding: 2px; }+fieldset { margin: 4px 0; padding: 6px 10px 8px; border: 1px solid #484848; border-radius: 4px; }+legend { padding: 0 2px; margin-bottom: 4px; }+details { margin: 2px 0; }+summary { cursor: pointer; font-weight: bold; padding: 2px 0; }+dialog { position: absolute; left: 10%; right: 10%; top: 15%; padding: 12px 16px;+ background-color: #353535; border: 1px solid #555555; border-radius: 6px;+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); z-index: 100; }+dialog:not([open]) { display: none; }+figcaption { font-size: 0.9em; color: #b8b8b8; }+img, video, iframe, embed, object, audio, canvas, svg, math { display: inline-block; }+button, input, select, textarea, progress, meter { display: inline-block; }+audio:not([controls]) { display: none; }+iframe, embed, object, video { border: 1px solid #484848; }+label { cursor: default; }+output { display: inline; }+"#;++/// The parsed user-agent stylesheet (shared, parsed once).+pub fn ua_stylesheet() -> &'static Stylesheet {+ static SHEET: OnceLock<Stylesheet> = OnceLock::new();+ SHEET.get_or_init(|| Stylesheet::parse(UA_CSS))+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn every_standard_element_exists() {+ // the WHATWG element index (113 with <canvas>) plus the svg / math roots+ let html = TAGS.iter().filter(|(t, _)| !matches!(*t, "svg" | "math")).count();+ assert_eq!(html + 1, HTML_ELEMENT_COUNT);+ let mut names: Vec<&str> = TAGS.iter().map(|(t, _)| *t).collect();+ names.sort();+ names.dedup();+ assert_eq!(names.len(), TAGS.len(), "duplicate tags");+ assert!(ua_stylesheet().rules.len() > 80);+ }+}diff --git a/bindings/rust/blenderui/src/layout.rs b/bindings/rust/blenderui/src/layout.rsnew file mode 100644index 0000000..34e05ea--- /dev/null+++ b/bindings/rust/blenderui/src/layout.rs@@ -0,0 +1,1062 @@+//! From an element tree to positioned boxes: cascade, box tree, taffy layout.+//!+//! * Block containers with inline content become wrapping flex lines of word+//! boxes (so text, links and inline-blocks wrap like a browser's line+//! boxes); inline elements own their words for painting and hit testing.+//! * Flex and grid containers get text runs as measured, wrapping leaves.+//! * Tables map onto flex rows and columns, lists paint their markers.++use std::cell::RefCell;+use std::collections::{HashMap, HashSet};+use std::rc::Rc;++use taffy::prelude::*;+use taffy::style::Overflow;++use crate::css::{Decl, Rule, Stylesheet, Subject};+use crate::element::{AnyElement, Div, Listeners, PaintFn, ParentElement};+use crate::geometry::{rect, Bounds, Units};+use crate::html::{tag_kind, ua_stylesheet, TagKind};+use crate::paint::Image;+use crate::style::{apply, Computed, DisplayKind, TextAlign, TextTransform, VAlign, WhiteSpace};+use crate::text;+use crate::widgets::WidgetSpec;++/// Interaction state the cascade reads (`:hover`, `:active`, `:focus`, `details[open]`).+#[derive(Default)]+pub(crate) struct UiState {+ pub hovered: HashSet<String>,+ pub active: HashSet<String>,+ pub focused: Option<String>,+ pub details_open: HashMap<String, bool>,+ pub scroll: HashMap<String, (f32, f32)>,+ pub checked: HashMap<String, bool>,+}++/// What a box holds.+pub(crate) enum Content {+ Element,+ /// A word (or pre-formatted line) inside a line container.+ Word(String),+ /// A whole text run in a flex/grid container (wraps when measured).+ Text(String),+ LineBreak,+ Widget(WidgetSpec),+ Replaced(Replaced),+ /// An anonymous line container (inline content between blocks).+ Anon,+}++pub(crate) enum Replaced {+ Image(Rc<Image>),+ Painted(PaintFn),+ Placeholder(&'static str),+}++/// The element-level data kept from a `Div` after building.+pub(crate) struct ElData {+ pub tag: &'static str,+ pub id: Option<String>,+ pub attrs: Vec<(String, String)>,+ pub listeners: Listeners,+}++pub(crate) struct BoxNode {+ pub parent: Option<usize>,+ pub kids: Vec<usize>,+ pub content: Content,+ pub el: Option<Rc<ElData>>,+ /// The element this box belongs to (itself, or the inline element of a word).+ pub owner: usize,+ pub style: Rc<Computed>,+ pub key: String,+ pub taffy: Option<NodeId>,+ pub pos: (usize, usize),+ pub marker: Option<String>,+ // filled after layout+ pub bounds: Bounds<f32>,+ pub clip: Option<Bounds<f32>>,+ pub opacity: f32,+ pub visible: bool,+ pub scroll_range: (f32, f32),+ pub scroll_pos: (f32, f32),+}++impl BoxNode {+ pub(crate) fn attr(&self, name: &str) -> Option<&str> {+ self.el.as_ref()?.attrs.iter().find(|(n, _)| n == name).map(|(_, v)| v.as_str())+ }+}++/// A laid-out frame.+pub(crate) struct Frame {+ pub nodes: Vec<BoxNode>,+ pub title: Option<String>,+ by_key: std::cell::OnceCell<HashMap<String, usize>>,+}++enum Measure {+ /// The text of box `node` (already whitespace-processed and transformed).+ Text { node: usize, size: f32, flags: i32, line: f32, nowrap: bool },+}++struct Builder<'a> {+ nodes: Vec<BoxNode>,+ taffy: TaffyTree<Measure>,+ author: Stylesheet,+ author_hash: u64,+ state: &'a UiState,+ viewport: (f32, f32),+ title: Option<String>,+ widgets: &'a mut dyn FnMut(&str, &WidgetSpec) -> (f32, f32),+}++// -- style sharing ---------------------------------------------------------------------++/// What a computed style depends on. Holding the parent `Rc` and the value+/// `Arc`s keeps their addresses unique while the entry lives, so they are+/// compared by pointer.+struct StyleKey {+ parent: Rc<Computed>,+ viewport: (u32, u32),+ author: u64,+ rules: Vec<usize>,+ decls: Vec<(std::borrow::Cow<'static, str>, std::sync::Arc<[crate::css::Tok]>, bool)>,+ fixup: u8,+}++impl PartialEq for StyleKey {+ fn eq(&self, o: &Self) -> bool {+ Rc::ptr_eq(&self.parent, &o.parent)+ && self.viewport == o.viewport+ && self.author == o.author+ && self.fixup == o.fixup+ && self.rules == o.rules+ && self.decls.len() == o.decls.len()+ && self.decls.iter().zip(&o.decls).all(|(a, b)| {+ a.2 == b.2 && std::sync::Arc::ptr_eq(&a.1, &b.1) && a.0 == b.0+ })+ }+}+impl Eq for StyleKey {}++impl std::hash::Hash for StyleKey {+ fn hash<H: std::hash::Hasher>(&self, h: &mut H) {+ (Rc::as_ptr(&self.parent) as usize).hash(h);+ self.viewport.hash(h);+ self.author.hash(h);+ self.fixup.hash(h);+ self.rules.hash(h);+ for (p, v, imp) in &self.decls {+ p.hash(h);+ (std::sync::Arc::as_ptr(v) as *const () as usize).hash(h);+ imp.hash(h);+ }+ }+}++thread_local! {+ static STYLES: RefCell<crate::style::FnvMap<StyleKey, Rc<Computed>>> = RefCell::new(Default::default());+}++// -- selector subject -------------------------------------------------------------------++#[derive(Clone)]+struct NodeRef<'b> {+ nodes: &'b [BoxNode],+ state: &'b UiState,+ i: usize,+}++impl Subject for NodeRef<'_> {+ fn tag(&self) -> &str {+ self.nodes[self.i].el.as_ref().map(|e| e.tag).unwrap_or("")+ }+ fn id(&self) -> Option<&str> {+ self.nodes[self.i].el.as_ref()?.id.as_deref()+ }+ fn has_class(&self, class: &str) -> bool {+ self.nodes[self.i].attr("class").is_some_and(|c| c.split_whitespace().any(|w| w == class))+ }+ fn attr(&self, name: &str) -> Option<&str> {+ let n = &self.nodes[self.i];+ if name == "open" && n.el.as_ref().is_some_and(|e| e.tag == "details") {+ return self.state.details_open.get(&n.key).copied()+ .unwrap_or(n.attr("open").is_some()).then_some("");+ }+ n.attr(name)+ }+ fn state(&self, pseudo: &str) -> bool {+ let n = &self.nodes[self.i];+ match pseudo {+ "hover" => self.state.hovered.contains(&n.key),+ "active" => self.state.active.contains(&n.key),+ "focus" | "focus-visible" => self.state.focused.as_deref() == Some(n.key.as_str()),+ "focus-within" => self.state.focused.as_deref().is_some_and(|f| f.starts_with(&n.key)),+ "checked" => self.state.checked.get(&n.key).copied().unwrap_or(n.attr("checked").is_some()),+ "disabled" => n.attr("disabled").is_some(),+ "enabled" => n.attr("disabled").is_none(),+ "link" | "any-link" => self.tag() == "a" && n.attr("href").is_some(),+ "required" => n.attr("required").is_some(),+ "optional" => n.attr("required").is_none(),+ "read-only" => n.attr("readonly").is_some(),+ "read-write" => n.attr("readonly").is_none(),+ "open" => self.attr("open").is_some(),+ "placeholder-shown" => n.attr("placeholder").is_some() && n.attr("value").is_none_or(str::is_empty),+ _ => false,+ }+ }+ fn parent(&self) -> Option<Self> {+ self.nodes[self.i].parent.map(|p| NodeRef { i: p, ..self.clone() })+ }+ fn prev_sibling(&self) -> Option<Self> {+ let p = self.nodes[self.i].parent?;+ let sibs = &self.nodes[p].kids;+ let k = sibs.iter().position(|&s| s == self.i)?;+ sibs[..k].iter().rev().find(|&&s| self.nodes[s].el.is_some())+ .map(|&s| NodeRef { i: s, ..self.clone() })+ }+ fn position(&self) -> (usize, usize) {+ self.nodes[self.i].pos+ }+ fn is_empty(&self) -> bool {+ self.nodes[self.i].kids.is_empty()+ }+}++// -- building -------------------------------------------------------------------------------++fn collect_styles(el: &AnyElement, css: &mut String, title: &mut Option<String>) {+ if let AnyElement::Element(d) = el {+ let text = || d.children.iter().filter_map(|c| match c {+ AnyElement::Text(t) => Some(t.as_ref()),+ _ => None,+ }).collect::<String>();+ match d.tag {+ "style" => css.push_str(&text()),+ "title" if title.is_none() => *title = Some(text()),+ _ => {}+ }+ for c in &d.children {+ collect_styles(c, css, title);+ }+ }+}++impl Builder<'_> {+ fn subject(&self, i: usize) -> NodeRef<'_> {+ NodeRef { nodes: &self.nodes, state: self.state, i }+ }++ /// The computed style of element `i`, shared with every earlier element+ /// that had the same parent style, matched rules and declarations+ /// (browsers call this style sharing). `fixup` adjusts `display` for+ /// widgets and flex/grid items before the result is cached.+ fn cascade(&self, i: usize, div: &Div, parent: &Rc<Computed>, fixup: u8) -> Rc<Computed> {+ let _s = crate::prof::span(" cascade");+ let subj = self.subject(i);+ let ua = ua_stylesheet().matching(&subj, self.viewport);+ let au = self.author.matching(&subj, self.viewport);+ let decls = self.declared(i, div, &ua, &au);+ let key = StyleKey {+ parent: parent.clone(),+ viewport: (self.viewport.0.to_bits(), self.viewport.1.to_bits()),+ author: self.author_hash,+ rules: ua.iter().map(|r| *r as *const Rule as usize).chain(au.iter().map(|r| r.order)).collect(),+ decls: decls.iter().map(|d| (d.prop.clone(), d.value.clone(), d.important)).collect(),+ fixup,+ };+ if let Some(hit) = STYLES.with(|c| c.borrow().get(&key).cloned()) {+ return hit;+ }+ let mut c = self.compute(parent, &decls);+ match fixup {+ 1 if c.display == DisplayKind::Inline => c.display = DisplayKind::InlineBlock,+ 2 if c.display == DisplayKind::Inline => c.display = DisplayKind::Block,+ _ => {}+ }+ let c = Rc::new(c);+ STYLES.with(|cache| {+ let mut cache = cache.borrow_mut();+ if cache.len() > 20_000 {+ cache.clear();+ }+ cache.insert(key, c.clone());+ });+ c+ }++ /// Every declaration that applies to element `i`, in cascade order.+ fn declared<'d>(&self, i: usize, div: &'d Div, ua: &[&'d Rule], au: &[&'d Rule]) -> Vec<&'d Decl> {+ let key = &self.nodes[i].key;+ let mut decls: Vec<&Decl> = Vec::new();+ decls.extend(ua.iter().flat_map(|r| r.decls.iter()));+ decls.extend(au.iter().flat_map(|r| r.decls.iter()));+ decls.extend(div.decls.iter());+ if self.state.hovered.contains(key) {+ decls.extend(div.hover.iter());+ }+ if self.state.active.contains(key) {+ decls.extend(div.active.iter());+ }+ if self.state.focused.as_deref() == Some(key.as_str()) {+ decls.extend(div.focus.iter());+ }+ decls+ }++ fn compute(&self, parent: &Computed, decls: &[&Decl]) -> Computed {+ let mut c = Computed::inherit(parent);+ let font_first = |d: &&Decl| d.prop == "font-size" || d.prop == "font";+ for important in [false, true] {+ // font-size first: em lengths in the other properties depend on it+ for d in decls.iter().filter(|d| d.important == important && font_first(d)) {+ apply(&mut c, parent, self.units(parent.font_size), d);+ }+ }+ let u = self.units(c.font_size);+ for important in [false, true] {+ for d in decls.iter().filter(|d| d.important == important && !font_first(d)) {+ apply(&mut c, parent, u, d);+ }+ }+ c+ }++ fn units(&self, font_size: f32) -> Units {+ Units { font_size, viewport: self.viewport }+ }++ fn push(&mut self, parent: Option<usize>, content: Content, owner: Option<usize>,+ style: Rc<Computed>, key: String) -> usize {+ let i = self.nodes.len();+ self.nodes.push(BoxNode {+ parent,+ kids: Vec::new(),+ content,+ el: None,+ owner: owner.unwrap_or(i),+ style,+ key,+ taffy: None,+ pos: (1, 1),+ marker: None,+ bounds: rect(0.0, 0.0, 0.0, 0.0),+ clip: None,+ opacity: 1.0,+ visible: true,+ scroll_range: (0.0, 0.0),+ scroll_pos: (0.0, 0.0),+ });+ if let Some(p) = parent {+ self.nodes[p].kids.push(i);+ }+ i+ }++ /// Build an element; returns its index (None when not rendered).+ fn element(&mut self, mut div: Div, parent: Option<usize>, key: String, pos: (usize, usize))+ -> Option<usize> {+ let parent_style = parent.map(|p| self.nodes[p].style.clone())+ .unwrap_or_else(|| root_parent());+ let i = self.push(parent, Content::Element, None, parent_style.clone(), key);+ self.nodes[i].pos = pos;+ self.nodes[i].el = Some(Rc::new(ElData {+ tag: div.tag,+ id: div.id.as_ref().map(|s| s.to_string()),+ attrs: div.attrs.iter().map(|(k, v)| (k.to_string(), v.to_string())).collect(),+ listeners: std::mem::take(&mut div.listeners),+ }));+ let kind = tag_kind(div.tag);+ // widgets and replaced elements are atomic inlines; flex/grid items are blockified+ let fixup = if kind == TagKind::Widget || kind == TagKind::Replaced {+ 1+ } else if parent.is_some_and(|p| matches!(self.nodes[p].style.display,+ DisplayKind::Flex | DisplayKind::InlineFlex+ | DisplayKind::Grid | DisplayKind::InlineGrid)) {+ 2+ } else {+ 0+ };+ let style = self.cascade(i, &div, &parent_style, fixup);+ if style.display == DisplayKind::None || kind == TagKind::Metadata {+ self.nodes.pop();+ if let Some(p) = parent {+ self.nodes[p].kids.pop();+ }+ return None;+ }+ self.nodes[i].style = style;+ match kind {+ TagKind::Widget => {+ let spec = WidgetSpec::from_element(&div, &self.nodes[i].key, self.state);+ if let Some(spec) = spec {+ self.nodes[i].content = Content::Widget(spec);+ } else {+ self.children(i, div.children);+ }+ }+ TagKind::Replaced => {+ let r = if let Some(f) = div.paint.take() {+ Replaced::Painted(f)+ } else if let Some(img) = div.image.take().or_else(|| {+ div.get_attr("src").and_then(crate::paint::load_image)+ }) {+ Replaced::Image(img)+ } else {+ Replaced::Placeholder(div.tag)+ };+ self.nodes[i].content = Content::Replaced(r);+ }+ TagKind::Break => {+ self.nodes[i].content = Content::LineBreak;+ }+ TagKind::Box | TagKind::Metadata => {+ let mut children = div.children;+ if div.tag == "details" {+ let open = self.subject(i).attr("open").is_some();+ if !open {+ children.retain(|c| matches!(c, AnyElement::Element(d) if d.tag == "summary"));+ }+ }+ if div.tag == "q" {+ let (open, close) = self.nodes[i].style.quotes.clone()+ .unwrap_or_else(|| ("\u{201c}".into(), "\u{201d}".into()));+ children.insert(0, AnyElement::Text(open.into()));+ children.push(AnyElement::Text(close.into()));+ }+ self.children(i, children);+ }+ }+ Some(i)+ }++ /// Children of element `i`: elements and text, keyed by position.+ fn children(&mut self, i: usize, mut children: Vec<AnyElement>) {+ // list markers: painted outside the box, or inline text when `inside`+ if self.nodes[i].style.display == DisplayKind::ListItem {+ let ls = self.nodes[i].style.list_style;+ let tag = self.nodes[i].el.as_ref().map(|e| e.tag).unwrap_or("");+ let marker = if tag == "summary" {+ let details = self.nodes[i].parent.unwrap_or(i);+ Some(if self.subject(details).attr("open").is_some() { "\u{25be}" } else { "\u{25b8}" }.into())+ } else {+ let idx = self.nodes[i].pos.0 + self.nodes[i].parent+ .and_then(|p| self.nodes[p].attr("start"))+ .and_then(|s| s.parse::<usize>().ok()).map(|s| s - 1).unwrap_or(0);+ ls.marker(idx)+ };+ match marker {+ Some(m) if self.nodes[i].style.marker_inside => {+ children.insert(0, AnyElement::Text(format!("{m}\u{a0}").into()));+ }+ m => self.nodes[i].marker = m,+ }+ }+ let count = children.iter().filter(|c| matches!(c, AnyElement::Element(_))).count();+ let mut k = 0;+ for child in children {+ match child {+ AnyElement::Element(d) => {+ k += 1;+ let key = match &d.id {+ Some(id) => format!("#{id}"),+ None => format!("{}/{}{}", self.nodes[i].key, d.tag, k),+ };+ self.element(*d, Some(i), key, (k, count));+ }+ AnyElement::Text(t) => {+ let key = format!("{}/t{}", self.nodes[i].key, self.nodes[i].kids.len());+ let style = self.nodes[i].style.clone();+ self.push(Some(i), Content::Text(t.into_owned()), Some(i), style, key);+ }+ }+ }+ }++ // -- taffy ------------------------------------------------------------------------------++ fn is_block_level(&self, i: usize) -> bool {+ match &self.nodes[i].content {+ Content::Element => !self.nodes[i].style.display.is_inline_level(),+ Content::Widget(_) | Content::Replaced(_) => false,+ _ => false,+ }+ }++ fn base_style(&self, i: usize) -> Style {+ let c = &self.nodes[i].style;+ let mut s = c.layout.clone();+ s.display = match c.display {+ DisplayKind::Flex | DisplayKind::InlineFlex => Display::Flex,+ DisplayKind::Grid | DisplayKind::InlineGrid => Display::Grid,+ DisplayKind::Table | DisplayKind::TableRowGroup => {+ s.flex_direction = FlexDirection::Column;+ let sp = if c.border_collapse { 0.0 } else { c.border_spacing.1 };+ s.gap.height = LengthPercentage::Length(sp);+ if c.display == DisplayKind::Table && !c.border_collapse {+ let pad = |v: LengthPercentage, add: f32| match v {+ LengthPercentage::Length(p) => LengthPercentage::Length(p + add),+ other => other,+ };+ let (h, v) = c.border_spacing;+ s.padding = Rect { left: pad(s.padding.left, h), right: pad(s.padding.right, h),+ top: pad(s.padding.top, v), bottom: pad(s.padding.bottom, v) };+ }+ Display::Flex+ }+ DisplayKind::TableRow => {+ s.flex_direction = FlexDirection::Row;+ s.gap.width = LengthPercentage::Length(if c.border_collapse { 0.0 } else { c.border_spacing.0 });+ Display::Flex+ }+ _ => Display::Block,+ };+ if c.display == DisplayKind::TableCell && s.size.width == Dimension::Auto {+ let span = self.nodes[i].attr("colspan").and_then(|v| v.parse::<f32>().ok()).unwrap_or(1.0);+ s.flex_grow = span;+ s.flex_shrink = 1.0;+ s.flex_basis = Dimension::Percent(0.0);+ }+ s+ }++ /// Make line-container style: a wrapping flex row aligned per text-align.+ fn line_style(c: &Computed, mut s: Style) -> Style {+ s.display = Display::Flex;+ s.flex_direction = FlexDirection::Row;+ // nowrap / pre text arrives as unbreakable pieces; wrapping only+ // happens at forced breaks (<br>, newlines) and between inline boxes+ s.flex_wrap = FlexWrap::Wrap;+ s.align_items = Some(AlignItems::FlexEnd);+ s.align_content = Some(AlignContent::FlexStart);+ s.justify_content = Some(match c.text_align {+ TextAlign::Center => JustifyContent::Center,+ TextAlign::Right => JustifyContent::FlexEnd,+ _ => JustifyContent::FlexStart,+ });+ s+ }++ fn leaf(&mut self, i: usize, style: Style) -> NodeId {+ let id = self.taffy.new_leaf(style).unwrap();+ self.nodes[i].taffy = Some(id);+ id+ }++ /// The taffy node for box `i` (and its subtree).+ fn layout_node(&mut self, i: usize) -> NodeId {+ let base = self.base_style(i);+ let c = self.nodes[i].style.clone();+ match &self.nodes[i].content {+ Content::Widget(spec) => {+ let (w, h) = (self.widgets)(&self.nodes[i].key, spec);+ let mut s = base;+ if s.size.width == Dimension::Auto {+ s.size.width = Dimension::Length(w);+ }+ if s.size.height == Dimension::Auto {+ s.size.height = Dimension::Length(h);+ }+ return self.leaf(i, s);+ }+ Content::Replaced(r) => {+ let (iw, ih) = match r {+ Replaced::Image(img) => (img.width as f32, img.height as f32),+ _ => (300.0, 150.0),+ };+ let attr = |n: &str| self.nodes[i].attr(n).and_then(|v| v.trim_end_matches("px").parse::<f32>().ok());+ let mut s = base;+ let (aw, ah) = (attr("width"), attr("height"));+ if s.size.width == Dimension::Auto {+ s.size.width = Dimension::Length(aw.unwrap_or(match ah {+ Some(h) if ih > 0.0 => h * iw / ih,+ _ => iw,+ }));+ }+ if s.size.height == Dimension::Auto {+ s.size.height = Dimension::Length(ah.unwrap_or(match aw {+ Some(w) if iw > 0.0 => w * ih / iw,+ _ => ih,+ }));+ }+ return self.leaf(i, s);+ }+ Content::LineBreak => {+ let s = Style { size: Size { width: Dimension::Percent(1.0), height: Dimension::Length(0.0) },+ flex_shrink: 0.0, ..Default::default() };+ return self.leaf(i, s);+ }+ Content::Text(t) => {+ // a text run as a flex/grid item: measured, wrapping. The box+ // keeps the transformed text, so paint draws what was measured.+ if let std::borrow::Cow::Owned(s) = transform(t, c.text_transform, c.white_space) {+ self.nodes[i].content = Content::Text(s);+ }+ let m = Measure::Text {+ node: i,+ size: c.font_size,+ flags: text::flags(&c),+ line: c.line_px(),+ nowrap: matches!(c.white_space, WhiteSpace::NoWrap | WhiteSpace::Pre),+ };+ let id = self.taffy.new_leaf_with_context(Style::default(), m).unwrap();+ self.nodes[i].taffy = Some(id);+ return id;+ }+ _ => {}+ }+ let flex_like = matches!(c.display, DisplayKind::Flex | DisplayKind::InlineFlex+ | DisplayKind::Grid | DisplayKind::InlineGrid+ | DisplayKind::Table | DisplayKind::TableRowGroup+ | DisplayKind::TableRow);+ let kids = self.nodes[i].kids.clone();+ let mut kids = kids;+ kids.sort_by_key(|&k| {+ let st = &self.nodes[k].style;+ if st.display == DisplayKind::TableCaption && st.caption_bottom { i32::MAX } else { st.order }+ });+ let mut out: Vec<NodeId> = Vec::new();+ if flex_like {+ for k in kids {+ if let Content::Text(t) = &self.nodes[k].content {+ if t.trim().is_empty() && self.nodes[k].style.white_space == WhiteSpace::Normal {+ continue;+ }+ }+ out.extend(self.child_nodes(k));+ }+ let id = self.taffy.new_with_children(base, &out).unwrap();+ self.nodes[i].taffy = Some(id);+ return id;+ }+ // block container: runs of inline content become line boxes+ let all_inline = kids.iter().all(|&k| !self.is_block_level(k));+ if all_inline {+ let mut line = Vec::new();+ self.inline_items(&kids, i, &mut line, true);+ let id = self.taffy.new_with_children(Self::line_style(&c, base), &line).unwrap();+ self.nodes[i].taffy = Some(id);+ return id;+ }+ let mut run: Vec<usize> = Vec::new();+ for k in kids {+ if self.is_block_level(k) {+ self.flush_run(i, &mut run, &mut out);+ out.extend(self.child_nodes(k));+ } else {+ run.push(k);+ }+ }+ self.flush_run(i, &mut run, &mut out);+ let id = self.taffy.new_with_children(base, &out).unwrap();+ self.nodes[i].taffy = Some(id);+ id+ }++ fn child_nodes(&mut self, k: usize) -> Vec<NodeId> {+ if self.nodes[k].style.display == DisplayKind::Contents {+ let kids = self.nodes[k].kids.clone();+ return kids.into_iter().flat_map(|c| self.child_nodes(c)).collect();+ }+ vec![self.layout_node(k)]+ }++ /// An anonymous line box for inline content between blocks.+ fn flush_run(&mut self, parent: usize, run: &mut Vec<usize>, out: &mut Vec<NodeId>) {+ let only_space = run.iter().all(|&k| matches!(&self.nodes[k].content,+ Content::Text(t) if t.trim().is_empty()));+ if run.is_empty() || only_space {+ run.clear();+ return;+ }+ let style = self.nodes[parent].style.clone();+ let key = format!("{}/anon{}", self.nodes[parent].key, out.len());+ let anon = self.push(None, Content::Anon, Some(parent), style.clone(), key);+ self.nodes[anon].parent = Some(parent);+ let mut line = Vec::new();+ let items: Vec<usize> = std::mem::take(run);+ self.inline_items(&items, parent, &mut line, true);+ let id = self.taffy.new_with_children(Self::line_style(&style, Style::default()), &line).unwrap();+ self.nodes[anon].taffy = Some(id);+ out.push(id);+ }++ /// Flatten inline content into line items: words, atomic inline boxes, breaks.+ fn inline_items(&mut self, kids: &[usize], owner: usize, line: &mut Vec<NodeId>, first: bool) {+ let mut first_word = first;+ for &k in kids {+ match &self.nodes[k].content {+ Content::Text(_) => {+ let Content::Text(t) = std::mem::replace(&mut self.nodes[k].content, Content::Anon) else {+ unreachable!()+ };+ let words = self.words(k, owner, &t, first_word);+ self.nodes[k].content = Content::Text(t);+ if !words.is_empty() {+ first_word = false;+ }+ line.extend(words);+ }+ Content::Element if self.nodes[k].style.display == DisplayKind::Inline+ || self.nodes[k].style.display == DisplayKind::Contents => {+ let kids = self.nodes[k].kids.clone();+ self.inline_items(&kids, k, line, first_word);+ first_word = false;+ }+ _ => {+ line.extend(self.child_nodes(k));+ first_word = false;+ }+ }+ }+ }++ /// Word boxes for a text node, with the style of its inline owner.+ fn words(&mut self, text_node: usize, owner: usize, t: &str, first: bool) -> Vec<NodeId> {+ let c = self.nodes[owner].style.clone();+ let text = transform(t, c.text_transform, c.white_space);+ let flags = text::flags(&c);+ let line_h = c.line_px();+ let space = text::width(" ", c.font_size, flags) + c.word_spacing;+ let mut pieces: Vec<(String, bool, bool)> = Vec::new(); // text, trailing space, forced break after+ match c.white_space {+ WhiteSpace::Pre | WhiteSpace::PreWrap | WhiteSpace::PreLine => {+ let lines: Vec<&str> = text.split('\n').collect();+ for (n, l) in lines.iter().enumerate() {+ let brk = n + 1 < lines.len();+ if c.white_space == WhiteSpace::Pre {+ pieces.push((l.to_string(), false, brk));+ } else {+ let ws: Vec<&str> = l.split_whitespace().collect();+ if ws.is_empty() {+ pieces.push((String::new(), false, brk));+ }+ for (j, w) in ws.iter().enumerate() {+ pieces.push((w.to_string(), j + 1 < ws.len(), brk && j + 1 == ws.len()));+ }+ }+ }+ }+ WhiteSpace::NoWrap => pieces.push((collapse(&text), false, false)),+ WhiteSpace::Normal => {+ let lead = text.starts_with(char::is_whitespace) && !first;+ let ws: Vec<&str> = text.split_whitespace().collect();+ let trail = text.ends_with(char::is_whitespace);+ for (j, w) in ws.iter().enumerate() {+ let space_after = j + 1 < ws.len() || trail;+ let word = if j == 0 && lead { format!(" {w}") } else { w.to_string() };+ pieces.push((word, space_after, false));+ }+ }+ }+ let indent = if first { c.text_indent.resolve(&self.units(c.font_size), 0.0) } else { 0.0 };+ let mut ids = Vec::new();+ for (n, (word, trailing, brk)) in pieces.into_iter().enumerate() {+ let w = text::width(&word, c.font_size, flags)+ + c.letter_spacing * word.chars().count() as f32+ + if trailing { space } else { 0.0 };+ let key = format!("{}/w{}", self.nodes[text_node].key, n);+ let node = self.push(Some(owner), Content::Word(word), Some(owner), c.clone(), key);+ self.nodes[node].parent = Some(owner);+ let s = Style {+ size: Size { width: Dimension::Length(w.ceil()), height: Dimension::Length(line_h) },+ flex_shrink: 0.0,+ margin: Rect { left: LengthPercentageAuto::Length(if n == 0 { indent } else { 0.0 }),+ ..Rect::zero() },+ ..Default::default()+ };+ ids.push(self.leaf(node, s));+ if brk {+ let b = self.push(Some(owner), Content::LineBreak, Some(owner), c.clone(),+ format!("{}/br{}", self.nodes[text_node].key, n));+ ids.push(self.leaf(b, Style {+ size: Size { width: Dimension::Percent(1.0), height: Dimension::Length(0.0) },+ flex_shrink: 0.0,+ ..Default::default()+ }));+ }+ }+ ids+ }+}++fn collapse(s: &str) -> String {+ s.split_whitespace().collect::<Vec<_>>().join(" ")+}++/// Whitespace processing and `text-transform`; borrows when nothing changes.+fn transform(s: &str, t: TextTransform, ws: WhiteSpace) -> std::borrow::Cow<'_, str> {+ use std::borrow::Cow;+ let collapse_ws = (ws == WhiteSpace::Normal || ws == WhiteSpace::NoWrap) && s.contains(['\n', '\t', '\r']);+ if !collapse_ws && t == TextTransform::None {+ return Cow::Borrowed(s);+ }+ let s = if collapse_ws { s.replace(['\n', '\t', '\r'], " ") } else { s.to_string() };+ Cow::Owned(match t {+ TextTransform::None => s,+ TextTransform::Upper => s.to_uppercase(),+ TextTransform::Lower => s.to_lowercase(),+ TextTransform::Capitalize => s+ .split(' ')+ .map(|w| {+ let mut c = w.chars();+ c.next().map(|f| f.to_uppercase().chain(c).collect()).unwrap_or_default()+ })+ .collect::<Vec<String>>()+ .join(" "),+ })+}++/// Build, cascade and lay out `root` in a `viewport` (logical pixels).+pub(crate) fn layout(root: AnyElement, viewport: (f32, f32), state: &UiState,+ widgets: &mut dyn FnMut(&str, &WidgetSpec) -> (f32, f32)) -> Frame {+ let mut css = String::new();+ let mut title = None;+ collect_styles(&root, &mut css, &mut title);+ let mut b = Builder {+ nodes: Vec::new(),+ taffy: TaffyTree::new(),+ author: Stylesheet::parse(&css),+ author_hash: {+ use std::hash::{Hash, Hasher};+ let mut h = std::collections::hash_map::DefaultHasher::new();+ css.hash(&mut h);+ h.finish()+ },+ state,+ viewport,+ title,+ widgets,+ };+ // the document: <html><body> unless the app built them itself+ let root_div = match root {+ AnyElement::Element(d) if d.tag == "html" => *d,+ AnyElement::Element(d) if d.tag == "body" => crate::html::html().child(*d),+ other => {+ let mut body = crate::html::body();+ body.children.push(other);+ crate::html::html().child(body)+ }+ };+ let span = crate::prof::span("build");+ let root = match b.element(root_div, None, "html".into(), (1, 1)) {+ Some(r) => r,+ None => b.push(None, Content::Element, None, root_parent(), "html".into()),+ };+ drop(span);+ let span = crate::prof::span("boxes");+ let root_id = b.layout_node(root);+ drop(span);+ let span = crate::prof::span("taffy");+ // the root fills the viewport+ let mut rs = b.taffy.style(root_id).unwrap().clone();+ rs.min_size = Size { width: Dimension::Length(viewport.0), height: Dimension::Length(viewport.1) };+ b.taffy.set_style(root_id, rs).unwrap();+ let avail = Size { width: AvailableSpace::Definite(viewport.0),+ height: AvailableSpace::Definite(viewport.1) };+ let nodes = &b.nodes;+ b.taffy+ .compute_layout_with_measure(root_id, avail, |known, available, _id, ctx, _style| {+ match ctx {+ Some(Measure::Text { node, size, flags, line, nowrap }) => {+ let text = match &nodes[*node].content {+ Content::Text(t) => t.as_str(),+ _ => "",+ };+ if !text.contains([' ', '\n']) {+ // one word: no wrapping to do+ let w = text::width(text, *size, *flags);+ return Size { width: known.width.unwrap_or(w.ceil()),+ height: known.height.unwrap_or(*line) };+ }+ let max_w = known.width.unwrap_or(match available.width {+ AvailableSpace::Definite(w) => w,+ AvailableSpace::MinContent => 0.0,+ AvailableSpace::MaxContent => f32::INFINITY,+ });+ let lines = text::wrap(text, *size, *flags,+ if *nowrap { f32::INFINITY } else { max_w });+ let w = lines.iter().map(|l| text::width(l, *size, *flags)).fold(0.0, f32::max);+ Size { width: known.width.unwrap_or(w.ceil()),+ height: known.height.unwrap_or(*line * lines.len().max(1) as f32) }+ }+ None => Size::ZERO,+ }+ })+ .unwrap();+ drop(span);+ let _span = crate::prof::span("place");+ let mut frame = Frame { nodes: b.nodes, title: b.title, by_key: Default::default() };+ let by_taffy: HashMap<NodeId, usize> = frame.nodes.iter().enumerate()+ .filter_map(|(i, n)| n.taffy.map(|t| (t, i))).collect();+ let mut walk = Walk { t: &b.taffy, by_taffy: &by_taffy, state, vp: viewport };+ walk.place(&mut frame.nodes, root_id, 0.0, 0.0, None);+ finish(&mut frame.nodes);+ frame+}++/// Positions follow the taffy tree (words live in line containers, which may+/// be anonymous); translate and scroll offsets shift whole subtrees.+struct Walk<'a> {+ t: &'a TaffyTree<Measure>,+ by_taffy: &'a HashMap<NodeId, usize>,+ state: &'a UiState,+ vp: (f32, f32),+}++impl Walk<'_> {+ fn place(&mut self, nodes: &mut [BoxNode], id: NodeId, ox: f32, oy: f32, clip: Option<Bounds<f32>>) {+ let l = match self.t.layout(id) {+ Ok(l) => *l,+ Err(_) => return,+ };+ let (mut x, mut y) = (ox + l.location.x, oy + l.location.y);+ let (w, h) = (l.size.width, l.size.height);+ let mut child_clip = clip;+ let (mut sx, mut sy) = (0.0, 0.0);+ if let Some(&i) = self.by_taffy.get(&id) {+ let st = nodes[i].style.clone();+ let u = Units { font_size: st.font_size, viewport: self.vp };+ x += st.translate.0.resolve(&u, w);+ y += st.translate.1.resolve(&u, h);+ if matches!(nodes[i].content, Content::Word(_)) {+ y += match st.vertical_align {+ VAlign::Sub => st.font_size * 0.25,+ VAlign::Super => -st.font_size * 0.35,+ VAlign::Baseline => 0.0,+ };+ }+ nodes[i].bounds = rect(x, y, w, h);+ nodes[i].clip = clip;+ let ov = st.layout.overflow;+ if ov.x != Overflow::Visible || ov.y != Overflow::Visible {+ let b = l.border;+ let pad = rect(x + b.left, y + b.top, (w - b.left - b.right).max(0.0),+ (h - b.top - b.bottom).max(0.0));+ child_clip = Some(match clip {+ Some(c) => c.intersect(&pad),+ None => pad,+ });+ if ov.x == Overflow::Scroll || ov.y == Overflow::Scroll {+ let axis = |o: Overflow, content: f32, view: f32| {+ if o == Overflow::Scroll { (content - view).max(0.0) } else { 0.0 }+ };+ let range = (axis(ov.x, l.content_size.width + l.padding.right, pad.size.width),+ axis(ov.y, l.content_size.height + l.padding.bottom, pad.size.height));+ nodes[i].scroll_range = range;+ let (ax, ay) = self.state.scroll.get(&nodes[i].key).copied().unwrap_or((0.0, 0.0));+ sx = ax.clamp(0.0, range.0);+ sy = ay.clamp(0.0, range.1);+ nodes[i].scroll_pos = (sx, sy);+ }+ }+ }+ let kids = self.t.children(id).unwrap_or_default();+ for k in kids {+ self.place(nodes, k, x - sx, y - sy, child_clip);+ }+ }+}++/// Inherited opacity / visibility (parents precede children in the arena),+/// and bounds of inline elements: the union of their pieces (children follow+/// parents, so a reverse pass sees them first).+fn finish(nodes: &mut [BoxNode]) {+ for i in 0..nodes.len() {+ let (po, pv, pc) = match nodes[i].parent {+ Some(p) => (nodes[p].opacity, nodes[p].visible, nodes[p].clip),+ None => (1.0, true, None),+ };+ let own = matches!(nodes[i].content, Content::Element | Content::Widget(_) | Content::Replaced(_));+ nodes[i].opacity = if own { po * nodes[i].style.opacity } else { po };+ nodes[i].visible = pv && nodes[i].style.visible;+ if nodes[i].taffy.is_none() {+ nodes[i].clip = pc;+ }+ }+ for i in (0..nodes.len()).rev() {+ if nodes[i].taffy.is_some() || nodes[i].kids.is_empty() {+ continue;+ }+ let mut acc: Option<Bounds<f32>> = None;+ for &c in &nodes[i].kids {+ let cb = nodes[c].bounds;+ if cb.size.width <= 0.0 && cb.size.height <= 0.0 {+ continue;+ }+ acc = Some(match acc {+ None => cb,+ Some(a) => {+ let x0 = a.origin.x.min(cb.origin.x);+ let y0 = a.origin.y.min(cb.origin.y);+ let x1 = (a.origin.x + a.size.width).max(cb.origin.x + cb.size.width);+ let y1 = (a.origin.y + a.size.height).max(cb.origin.y + cb.size.height);+ rect(x0, y0, x1 - x0, y1 - y0)+ }+ });+ }+ if let Some(a) = acc {+ nodes[i].bounds = a;+ }+ }+}++impl Frame {+ /// Element boxes by key, built on first use (events and tests need it,+ /// rendering doesn't).+ pub(crate) fn by_key(&self) -> &HashMap<String, usize> {+ self.by_key.get_or_init(|| {+ self.nodes.iter().enumerate().filter(|(_, n)| n.el.is_some())+ .map(|(i, n)| (n.key.clone(), i)).collect()+ })+ }++ /// Element boxes from the root down to the topmost box under (x, y).+ pub(crate) fn hit_path(&self, x: f32, y: f32) -> Vec<usize> {+ let mut best: Option<(i32, usize)> = None;+ for (i, n) in self.nodes.iter().enumerate() {+ if !n.visible || !n.style.pointer_events || n.taffy.is_none() {+ continue;+ }+ if n.clip.is_some_and(|c| !c.contains(x, y)) || !n.bounds.contains(x, y) {+ continue;+ }+ // later boxes paint over earlier ones; z-index lifts a subtree+ let z = self.z_of(i);+ if best.is_none_or(|(bz, _)| z >= bz) {+ best = Some((z, i));+ }+ }+ let mut path = Vec::new();+ let mut cur = best.map(|(_, b)| self.nodes[b].owner);+ while let Some(i) = cur {+ if self.nodes[i].el.is_some() {+ path.push(i);+ }+ cur = self.nodes[i].parent;+ }+ path.reverse();+ path+ }++ /// The effective stacking level of a box (its nearest z-index).+ pub(crate) fn z_of(&self, mut i: usize) -> i32 {+ loop {+ if let Some(z) = self.nodes[i].style.z_index {+ return z;+ }+ match self.nodes[i].parent {+ Some(p) => i = p,+ None => return 0,+ }+ }+ }+}++/// The style the root element inherits from: one shared value, so the root's+/// style (and through it everything below) can be reused across frames.+fn root_parent() -> Rc<Computed> {+ thread_local! { static ROOT: Rc<Computed> = Rc::new(Computed::default()); }+ ROOT.with(Rc::clone)+}diff --git a/bindings/rust/blenderui/src/lib.rs b/bindings/rust/blenderui/src/lib.rsnew file mode 100644index 0000000..6d1a5fd--- /dev/null+++ b/bindings/rust/blenderui/src/lib.rs@@ -0,0 +1,80 @@+//! # blenderui+//!+//! Blender's UI for Rust with gpui's syntax, every HTML element and CSS.+//!+//! ```no_run+//! use blenderui::prelude::*;+//!+//! struct Counter {+//! count: i32,+//! }+//!+//! impl Render for Counter {+//! fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+//! div()+//! .flex()+//! .flex_col()+//! .gap_2()+//! .p_4()+//! .child(h1().child(format!("Count: {}", self.count)))+//! .child(button().child("Add one").on_click(cx.listener(|this, _, _, cx| {+//! this.count += 1;+//! cx.notify();+//! })))+//! }+//! }+//!+//! fn main() {+//! Application::new().run(|cx: &mut App| {+//! cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Counter { count: 0 }))+//! .unwrap();+//! });+//! }+//! ```+//!+//! * **Elements**: one [`Div`] type for all 113 HTML elements ([`html`] has a+//! constructor per tag), with `.child()`, `.on_click()`, `.id()`, `.attr()`.+//! * **Styling**: gpui / Tailwind methods ([`Styled`]), any CSS property with+//! `.css("prop", "value")` / `.style("a: b; c: d")`, and `<style>` sheets+//! with selectors, combinators, pseudo-classes and `@media`.+//! * **Layout**: block, inline (wrapping line boxes), flexbox, grid, tables,+//! positioning and scrolling via [taffy](https://docs.rs/taffy).+//! * **Rendering**: Blender's widget drawing; form controls are Blender's own+//! widgets (number fields, sliders, dropdowns, text fields ...).++pub mod color;+pub mod css;+pub mod element;+pub mod events;+pub mod geometry;+pub mod html;+pub(crate) mod layout;+pub mod paint;+pub(crate) mod prof;+pub mod style;+pub mod styled;+pub(crate) mod text;+pub(crate) mod widgets;+pub mod window;++pub use blenderui_sys as sys;++pub use color::*;+pub use element::*;+pub use events::*;+pub use geometry::{point, px, relative, rems, size, Bounds, Length, Pixels, Point, Rems, Size};+pub use paint::{Image, Painter};+pub use styled::{FontWeight, Styled};+pub use window::*;++/// Everything an app needs: `use blenderui::prelude::*;`+pub mod prelude {+ pub use crate::color::*;+ pub use crate::element::*;+ pub use crate::events::*;+ pub use crate::geometry::{point, px, relative, rems, size, Bounds, Length, Pixels, Point, Rems, Size};+ pub use crate::html::*;+ pub use crate::paint::{Image, Painter};+ pub use crate::styled::{FontWeight, Styled};+ pub use crate::window::*;+}diff --git a/bindings/rust/blenderui/src/paint.rs b/bindings/rust/blenderui/src/paint.rsnew file mode 100644index 0000000..afe4bd6--- /dev/null+++ b/bindings/rust/blenderui/src/paint.rs@@ -0,0 +1,612 @@+//! Painting: a frame of laid-out boxes becomes one display list on the kit+//! canvas. [`Painter`] is also what `canvas(|bounds, painter| ...)` draws with.++use std::cell::RefCell;+use std::collections::HashMap;+use std::ffi::CString;+use std::rc::Rc;++use taffy::prelude::*;++use crate::color::Rgba;+use crate::geometry::{rect, Bounds, Units};+use crate::layout::{BoxNode, Content, Frame, Replaced};+use crate::style::{Computed, DisplayKind, TextAlign, WhiteSpace};+use crate::text;+use blenderui_sys as sys;++/// RGBA pixels for `<img>` / `img().image_rgba(...)`.+#[derive(Clone, Debug, PartialEq)]+pub struct Image {+ pub width: u32,+ pub height: u32,+ /// `width * height * 4` bytes, row-major, straight alpha.+ pub rgba: Vec<u8>,+}++impl Image {+ /// Decode a PNG file.+ pub fn from_png(path: &str) -> Option<Image> {+ let decoder = png::Decoder::new(std::fs::File::open(path).ok()?);+ let mut decoder = decoder;+ decoder.set_transformations(png::Transformations::EXPAND | png::Transformations::STRIP_16);+ let mut reader = decoder.read_info().ok()?;+ let mut buf = vec![0; reader.output_buffer_size()];+ let info = reader.next_frame(&mut buf).ok()?;+ let px = (info.width * info.height) as usize;+ let rgba = match info.color_type {+ png::ColorType::Rgba => buf[..px * 4].to_vec(),+ png::ColorType::Rgb => buf[..px * 3].chunks(3).flat_map(|c| [c[0], c[1], c[2], 255]).collect(),+ png::ColorType::GrayscaleAlpha => {+ buf[..px * 2].chunks(2).flat_map(|c| [c[0], c[0], c[0], c[1]]).collect()+ }+ png::ColorType::Grayscale => buf[..px].iter().flat_map(|&g| [g, g, g, 255]).collect(),+ png::ColorType::Indexed => return None,+ };+ Some(Image { width: info.width, height: info.height, rgba })+ }++ /// Nearest-neighbour resample to `w` x `h`.+ fn resized(&self, w: u32, h: u32) -> Vec<u8> {+ if w == self.width && h == self.height {+ return self.rgba.clone();+ }+ let mut out = vec![0u8; (w * h * 4) as usize];+ for y in 0..h {+ let sy = (y as u64 * self.height as u64 / h.max(1) as u64) as u32;+ for x in 0..w {+ let sx = (x as u64 * self.width as u64 / w.max(1) as u64) as u32;+ let s = ((sy * self.width + sx) * 4) as usize;+ let d = ((y * w + x) * 4) as usize;+ out[d..d + 4].copy_from_slice(&self.rgba[s..s + 4]);+ }+ }+ out+ }+}++thread_local! {+ static IMAGES: RefCell<HashMap<String, Option<Rc<Image>>>> = RefCell::new(HashMap::new());+}++/// `src` of an `<img>`: PNG files, decoded once.+pub(crate) fn load_image(src: &str) -> Option<Rc<Image>> {+ IMAGES.with(|m| {+ m.borrow_mut()+ .entry(src.to_owned())+ .or_insert_with(|| Image::from_png(src).map(Rc::new))+ .clone()+ })+}++#[derive(Clone)]+enum Kind {+ Rect { radius: f32, outline: Rgba, width: f32 },+ Oval { outline: Rgba, width: f32 },+ Line { width: f32 },+ Polygon,+ Arc { start: f32, extent: f32 },+ Text { text: CString, size: f32, flags: i32 },+ Image(Rc<Image>),+}++#[derive(Clone)]+struct Item {+ kind: Kind,+ coords: Vec<f32>,+ fill: Rgba,+ clip: Option<Bounds<f32>>,+}++/// Draws into a canvas display list, in logical pixels.+///+/// ```ignore+/// canvas(|bounds, p| {+/// p.fill(bounds, rgb(0x4772b3));+/// p.text(bounds.origin.x + 4.0, bounds.origin.y + 4.0, "hi", 13.0, white());+/// })+/// ```+#[derive(Default)]+pub struct Painter {+ items: Vec<Item>,+ clip: Option<Bounds<f32>>,+ opacity: f32,+}++impl Painter {+ pub(crate) fn new() -> Painter {+ Painter { items: Vec::new(), clip: None, opacity: 1.0 }+ }++ fn push(&mut self, kind: Kind, coords: Vec<f32>, fill: Rgba) {+ let fill = fill.opacity(self.opacity);+ let kind = match kind {+ Kind::Rect { radius, outline, width } => {+ Kind::Rect { radius, outline: outline.opacity(self.opacity), width }+ }+ Kind::Oval { outline, width } => Kind::Oval { outline: outline.opacity(self.opacity), width },+ k => k,+ };+ self.items.push(Item { kind, coords, fill, clip: self.clip });+ }++ fn corners(b: Bounds<f32>) -> Vec<f32> {+ vec![b.origin.x, b.origin.y, b.origin.x + b.size.width, b.origin.y + b.size.height]+ }++ /// A filled rectangle (gpui's `paint_quad(fill(bounds, color))`).+ pub fn fill(&mut self, bounds: Bounds<f32>, color: impl Into<Rgba>) {+ let c = color.into();+ if !c.is_transparent() && bounds.size.width > 0.0 && bounds.size.height > 0.0 {+ self.push(Kind::Rect { radius: 0.0, outline: Rgba::TRANSPARENT, width: 0.0 },+ Self::corners(bounds), c);+ }+ }++ /// A rounded rectangle with an optional border (gpui's `quad`).+ pub fn quad(&mut self, bounds: Bounds<f32>, radius: f32, fill: impl Into<Rgba>,+ border: impl Into<Rgba>, border_width: f32) {+ let (fill, border) = (fill.into(), border.into());+ if fill.is_transparent() && (border.is_transparent() || border_width <= 0.0) {+ return;+ }+ let max_r = bounds.size.width.min(bounds.size.height) / 2.0;+ self.push(Kind::Rect { radius: radius.clamp(0.0, max_r.max(0.0)), outline: border,+ width: border_width },+ Self::corners(bounds), fill);+ }++ /// An ellipse inscribed in `bounds`.+ pub fn oval(&mut self, bounds: Bounds<f32>, fill: impl Into<Rgba>, outline: impl Into<Rgba>,+ width: f32) {+ self.push(Kind::Oval { outline: outline.into(), width }, Self::corners(bounds), fill.into());+ }++ /// A polyline through `points`.+ pub fn line(&mut self, points: &[(f32, f32)], color: impl Into<Rgba>, width: f32) {+ self.push(Kind::Line { width }, points.iter().flat_map(|&(x, y)| [x, y]).collect(), color.into());+ }++ /// A filled polygon (gpui's `paint_path`).+ pub fn polygon(&mut self, points: &[(f32, f32)], color: impl Into<Rgba>) {+ self.push(Kind::Polygon, points.iter().flat_map(|&(x, y)| [x, y]).collect(), color.into());+ }++ /// A pie slice: degrees counter-clockwise from 3 o'clock.+ pub fn arc(&mut self, bounds: Bounds<f32>, start: f32, extent: f32, color: impl Into<Rgba>) {+ self.push(Kind::Arc { start, extent }, Self::corners(bounds), color.into());+ }++ /// Text with its top-left at (x, y).+ pub fn text(&mut self, x: f32, y: f32, text: &str, size: f32, color: impl Into<Rgba>) {+ self.styled_text(x, y, text, size, 0, color.into());+ }++ pub(crate) fn styled_text(&mut self, x: f32, y: f32, text: &str, size: f32, flags: i32, color: Rgba) {+ if !text.trim().is_empty() {+ let text = CString::new(text).unwrap_or_else(|_| CString::new(text.replace('\0', "")).unwrap_or_default());+ self.push(Kind::Text { text, size, flags }, vec![x, y], color);+ }+ }++ /// An image scaled to `bounds`.+ pub fn image(&mut self, bounds: Bounds<f32>, image: &Rc<Image>) {+ self.push(Kind::Image(image.clone()), Self::corners(bounds), Rgba::TRANSPARENT);+ }++ /// Restrict the following drawing to `bounds` (intersected with any current clip).+ pub fn with_clip(&mut self, bounds: Bounds<f32>, f: impl FnOnce(&mut Painter)) {+ let saved = self.clip;+ self.clip = Some(match saved {+ Some(c) => c.intersect(&bounds),+ None => bounds,+ });+ f(self);+ self.clip = saved;+ }++ /// Replace the canvas display list with these items, scaled to device pixels.+ pub(crate) fn flush(&self, canvas: *mut sys::BKNode, scale: f32) {+ // SAFETY: `canvas` is a live kit canvas node owned by the window.+ unsafe { sys::BK_canvas_delete(canvas, -1) };+ for it in &self.items {+ let mut coords: Vec<f32> = it.coords.iter().map(|v| v * scale).collect();+ let mut ci = sys::BKCanvasItem { fill: it.fill.to_array(), ..Default::default() };+ let mut _keep_px = None;+ match &it.kind {+ Kind::Rect { radius, outline, width } => {+ ci.type_ = if *radius > 0.0 { sys::BK_ITEM_ROUNDRECT } else { sys::BK_ITEM_RECT };+ ci.radius = radius * scale;+ if *width > 0.0 {+ ci.outline = outline.to_array();+ ci.width = (width * scale).max(1.0);+ }+ }+ Kind::Oval { outline, width } => {+ ci.type_ = sys::BK_ITEM_OVAL;+ if *width > 0.0 {+ ci.outline = outline.to_array();+ ci.width = (width * scale).max(1.0);+ }+ }+ Kind::Line { width } => {+ ci.type_ = sys::BK_ITEM_LINE;+ ci.width = (width * scale).max(1.0);+ }+ Kind::Polygon => ci.type_ = sys::BK_ITEM_POLYGON,+ Kind::Arc { start, extent } => {+ ci.type_ = sys::BK_ITEM_ARC;+ ci.start = *start;+ ci.extent = *extent;+ }+ Kind::Text { text, size, flags } => {+ ci.type_ = sys::BK_ITEM_TEXT;+ ci.size = size * scale;+ ci.text_flags = *flags;+ ci.anchor = sys::BK_ANCHOR_N | sys::BK_ANCHOR_W;+ ci.text = text.as_ptr();+ }+ Kind::Image(img) => {+ let w = (coords[2] - coords[0]).round().max(1.0) as u32;+ let h = (coords[3] - coords[1]).round().max(1.0) as u32;+ if img.width == 0 || img.height == 0 {+ continue;+ }+ let px = img.resized(w, h);+ ci.type_ = sys::BK_ITEM_IMAGE;+ ci.anchor = sys::BK_ANCHOR_N | sys::BK_ANCHOR_W;+ ci.rgba = px.as_ptr();+ ci.iw = w as i32;+ ci.ih = h as i32;+ coords.truncate(2);+ _keep_px = Some(px);+ }+ }+ if let Some(c) = it.clip {+ ci.clip_on = 1;+ ci.clip = [c.origin.x * scale, c.origin.y * scale, c.size.width * scale,+ c.size.height * scale];+ }+ ci.coords = coords.as_ptr();+ ci.ncoords = coords.len() as i32;+ // SAFETY: every pointer in `ci` outlives the call; the kit copies them.+ unsafe { sys::BK_canvas_add_item(canvas, &ci) };+ }+ }+}++// ==========================================================================+// Painting a frame++fn lp(v: LengthPercentage, basis: f32) -> f32 {+ match v {+ LengthPercentage::Length(p) => p,+ LengthPercentage::Percent(f) => f * basis,+ }+}++/// Border widths (top, right, bottom, left).+fn border_widths(c: &Computed, w: f32) -> [f32; 4] {+ let b = c.layout.border;+ [lp(b.top, w), lp(b.right, w), lp(b.bottom, w), lp(b.left, w)]+}++fn radius_px(c: &Computed, b: Bounds<f32>, vp: (f32, f32)) -> f32 {+ let u = Units { font_size: c.font_size, viewport: vp };+ let m = b.size.width.min(b.size.height);+ c.radius.iter().map(|r| r.resolve(&u, m)).fold(0.0, f32::max).min(m / 2.0)+}++/// Paint every box of `frame`, in stacking order.+pub(crate) fn paint_frame(frame: &Frame, p: &mut Painter, vp: (f32, f32)) {+ let mut order: Vec<usize> = (0..frame.nodes.len()).collect();+ order.sort_by_key(|&i| frame.z_of(i)); // stable: tree order within a level+ for i in order {+ let n = &frame.nodes[i];+ if !n.visible || n.opacity <= 0.0 {+ continue;+ }+ p.opacity = n.opacity;+ p.clip = n.clip;+ paint_node(frame, n, p, vp);+ }+ p.opacity = 1.0;+ p.clip = None;+}++/// A background that repaints exactly the pixels already under it: an opaque+/// plain fill with the colour and bounds of the nearest painted ancestor, with+/// only undecorated same-sized boxes in between (so nothing else can show).+fn redundant_background(frame: &Frame, n: &BoxNode) -> bool {+ let c = &*n.style;+ if c.background.a < 1.0 || c.gradient.is_some() || !c.shadows.is_empty() {+ return false;+ }+ let mut cur = n.parent;+ while let Some(i) = cur {+ let a = &frame.nodes[i];+ let ac = &*a.style;+ if a.bounds != n.bounds || a.taffy.is_none() || !ac.shadows.is_empty() || ac.gradient.is_some()+ || a.opacity < 1.0 || a.clip.is_some() != n.clip.is_some()+ {+ return false;+ }+ if !ac.background.is_transparent() {+ return ac.background == c.background && n.opacity >= 1.0;+ }+ if border_widths(ac, a.bounds.size.width).iter().any(|w| *w > 0.0) {+ return false;+ }+ cur = a.parent;+ }+ false+}++fn paint_node(frame: &Frame, n: &BoxNode, p: &mut Painter, vp: (f32, f32)) {+ let c = &*n.style;+ let b = n.bounds;+ match &n.content {+ Content::Word(w) => {+ // inline element backgrounds paint per line fragment (here: per word)+ let owner = &frame.nodes[n.owner];+ if owner.taffy.is_none() {+ p.fill(b, owner.style.background);+ }+ paint_text_line(p, c, w, b.origin.x, b.origin.y, b.size.height, None);+ }+ // a text run as a flex/grid item (in line boxes its words paint instead)+ Content::Text(t) if n.taffy.is_some() => {+ let flags = text::flags(c);+ let nowrap = matches!(c.white_space, WhiteSpace::NoWrap | WhiteSpace::Pre);+ if !c.ellipsis && !t.contains([' ', '\n']) {+ // one word: one line (the common label case)+ let lw = text::width(t, c.font_size, flags);+ let x = match c.text_align {+ TextAlign::Center => b.origin.x + (b.size.width - lw) / 2.0,+ TextAlign::Right => b.origin.x + b.size.width - lw,+ _ => b.origin.x,+ };+ paint_text_line(p, c, t, x, b.origin.y, c.line_px(), Some(lw));+ return;+ }+ let lines = if nowrap {+ vec![t.clone()]+ } else {+ text::wrap(t, c.font_size, flags, b.size.width + 0.5)+ };+ let lh = c.line_px();+ for (k, line) in lines.iter().enumerate() {+ let line = if c.ellipsis { text::ellipsize(line, c.font_size, flags, b.size.width) }+ else { line.clone() };+ let lw = text::width(&line, c.font_size, flags);+ let x = match c.text_align {+ TextAlign::Center => b.origin.x + (b.size.width - lw) / 2.0,+ TextAlign::Right => b.origin.x + b.size.width - lw,+ _ => b.origin.x,+ };+ paint_text_line(p, c, &line, x, b.origin.y + lh * k as f32, lh, Some(lw));+ }+ }+ Content::Element | Content::Replaced(_) if n.taffy.is_some() => {+ paint_box(n, p, vp, redundant_background(frame, n));+ if let Some(m) = &n.marker {+ let bw = border_widths(c, b.size.width);+ let pad = lp(c.layout.padding.top, b.size.width);+ let flags = text::flags(c);+ let mw = text::width(m, c.font_size, flags);+ paint_text_line(p, c, m, b.origin.x - mw - 6.0, b.origin.y + bw[0] + pad, c.line_px(),+ Some(mw));+ }+ if let Content::Replaced(r) = &n.content {+ let inner = content_box(c, b);+ match r {+ Replaced::Image(img) => p.image(inner, img),+ Replaced::Painted(f) => {+ let f = f.clone();+ p.with_clip(inner, |p| f(inner, p));+ }+ Replaced::Placeholder(tag) => {+ p.fill(inner, crate::color::rgb(0x282828));+ let label = n.attr("alt").unwrap_or(tag);+ let w = text::width(label, c.font_size, 0);+ p.styled_text(inner.origin.x + (inner.size.width - w) / 2.0,+ inner.origin.y + (inner.size.height - c.font_size) / 2.0,+ label, c.font_size, 0, crate::color::rgb(0x8a8a8a));+ }+ }+ }+ paint_scrollbars(n, p);+ }+ _ => {}+ }+}++fn content_box(c: &Computed, b: Bounds<f32>) -> Bounds<f32> {+ let w = b.size.width;+ let bw = border_widths(c, w);+ let pd = c.layout.padding;+ let (pt, pr, pb, pl) = (lp(pd.top, w), lp(pd.right, w), lp(pd.bottom, w), lp(pd.left, w));+ rect(b.origin.x + bw[3] + pl, b.origin.y + bw[0] + pt,+ (w - bw[1] - bw[3] - pl - pr).max(0.0), (b.size.height - bw[0] - bw[2] - pt - pb).max(0.0))+}++/// One line of text in a line box of height `lh`, with decorations.+fn paint_text_line(p: &mut Painter, c: &Computed, s: &str, x: f32, y: f32, lh: f32, width: Option<f32>) {+ let flags = text::flags(c);+ let size = c.font_size;+ let top = y + ((lh - size) / 2.0).max(0.0);+ let s = if c.small_caps { s.to_uppercase() } else { s.to_owned() };+ let size_draw = if c.small_caps { size * 0.8 } else { size };+ if let Some(sh) = c.text_shadow {+ p.styled_text(x + sh.x, top + sh.y, &s, size_draw, flags, sh.color);+ }+ if c.letter_spacing != 0.0 {+ let mut cx = x;+ for ch in s.chars() {+ let t = ch.to_string();+ p.styled_text(cx, top, &t, size_draw, flags, c.color);+ cx += text::width(&t, size_draw, flags) + c.letter_spacing;+ }+ } else {+ p.styled_text(x, top, &s, size_draw, flags, c.color);+ }+ if c.underline || c.line_through || c.overline {+ let w = width.unwrap_or_else(|| text::width(s.trim_end(), size_draw, flags));+ let thick = (size / 14.0).max(1.0);+ let dc = c.decoration_color.unwrap_or(c.color);+ let mut deco = |yy: f32| p.fill(rect(x, yy, w, thick), dc);+ if c.underline {+ deco(top + size * 0.92);+ }+ if c.line_through {+ deco(top + size * 0.48);+ }+ if c.overline {+ deco(top);+ }+ }+}++/// Shadows, background, borders and outline of an element box.+fn paint_box(n: &BoxNode, p: &mut Painter, vp: (f32, f32), skip_background: bool) {+ let c = &*n.style;+ let b = n.bounds;+ if matches!(c.display, DisplayKind::Contents) || b.size.width <= 0.0 && b.size.height <= 0.0 {+ return;+ }+ let r = radius_px(c, b, vp);+ for s in c.shadows.iter().filter(|s| !s.inset) {+ let steps = (s.blur / 2.0).ceil().clamp(1.0, 8.0) as usize;+ for k in 0..steps {+ let grow = s.spread + s.blur * (k as f32 + 1.0) / (steps as f32 + 1.0);+ let a = s.color.a / steps as f32 * if s.blur > 0.0 { 1.0 } else { steps as f32 };+ let sb = rect(b.origin.x + s.x - grow, b.origin.y + s.y - grow,+ b.size.width + 2.0 * grow, b.size.height + 2.0 * grow);+ p.quad(sb, r + grow, s.color.alpha(a), Rgba::TRANSPARENT, 0.0);+ }+ }+ match &c.gradient {+ Some(g) => p.with_clip(b, |p| paint_gradient(p, g, b)),+ None if skip_background => {}+ None => p.quad(b, r, c.background, Rgba::TRANSPARENT, 0.0),+ }+ for s in c.shadows.iter().filter(|s| s.inset) {+ let w = s.blur.max(1.0) + s.spread;+ p.with_clip(b, |p| {+ p.quad(rect(b.origin.x + s.x, b.origin.y + s.y, b.size.width, b.size.height), r,+ Rgba::TRANSPARENT, s.color, w);+ });+ }+ let bw = border_widths(c, b.size.width);+ let visible: Vec<usize> = (0..4).filter(|&k| bw[k] > 0.0 && c.border_drawn[k]+ && !c.border_color[k].is_transparent()).collect();+ let uniform = visible.len() == 4 && bw.iter().all(|w| *w == bw[0])+ && c.border_color.iter().all(|x| *x == c.border_color[0]);+ if uniform {+ let h = bw[0] / 2.0;+ p.quad(rect(b.origin.x + h, b.origin.y + h, b.size.width - bw[0], b.size.height - bw[0]),+ (r - h).max(0.0), Rgba::TRANSPARENT, c.border_color[0], bw[0]);+ } else {+ let (x, y, w, h) = (b.origin.x, b.origin.y, b.size.width, b.size.height);+ for k in visible {+ let side = match k {+ 0 => rect(x, y, w, bw[0]),+ 1 => rect(x + w - bw[1], y, bw[1], h),+ 2 => rect(x, y + h - bw[2], w, bw[2]),+ _ => rect(x, y, bw[3], h),+ };+ p.fill(side, c.border_color[k]);+ }+ }+ let (ow, oc, off) = c.outline;+ if ow > 0.0 && !oc.is_transparent() {+ let g = off + ow / 2.0;+ p.quad(rect(b.origin.x - g, b.origin.y - g, b.size.width + 2.0 * g, b.size.height + 2.0 * g),+ r + g, Rgba::TRANSPARENT, oc, ow);+ }+}++fn mix(a: Rgba, b: Rgba, t: f32) -> Rgba {+ Rgba { r: a.r + (b.r - a.r) * t, g: a.g + (b.g - a.g) * t, b: a.b + (b.b - a.b) * t,+ a: a.a + (b.a - a.a) * t }+}++/// Colour at position `t` (0..1) along a gradient.+fn gradient_at(g: &crate::style::Gradient, t: f32) -> Rgba {+ let n = g.stops.len();+ if n == 0 {+ return Rgba::TRANSPARENT;+ }+ let pos: Vec<f32> = g.stops.iter().enumerate()+ .map(|(k, (_, p))| p.unwrap_or(if n == 1 { 0.0 } else { k as f32 / (n - 1) as f32 }))+ .collect();+ if t <= pos[0] {+ return g.stops[0].0;+ }+ for k in 1..n {+ if t <= pos[k] {+ let span = (pos[k] - pos[k - 1]).max(1e-6);+ return mix(g.stops[k - 1].0, g.stops[k].0, (t - pos[k - 1]) / span);+ }+ }+ g.stops[n - 1].0+}++/// Gradients as bands: horizontal/vertical strips, or rings for radial ones.+fn paint_gradient(p: &mut Painter, g: &crate::style::Gradient, b: Bounds<f32>) {+ const BANDS: usize = 48;+ let (x, y, w, h) = (b.origin.x, b.origin.y, b.size.width, b.size.height);+ if g.radial {+ for k in (0..BANDS).rev() {+ let t = (k as f32 + 0.5) / BANDS as f32;+ let f = (k + 1) as f32 / BANDS as f32;+ let (rw, rh) = (w * f * std::f32::consts::SQRT_2, h * f * std::f32::consts::SQRT_2);+ p.oval(rect(x + (w - rw) / 2.0, y + (h - rh) / 2.0, rw, rh), gradient_at(g, t),+ Rgba::TRANSPARENT, 0.0);+ }+ return;+ }+ // angle: 180deg = to bottom, 90deg = to right+ let a = g.angle_deg.to_radians();+ let (dx, dy) = (a.sin(), -a.cos());+ let len = (w * dx.abs() + h * dy.abs()).max(1.0);+ let (cx, cy) = (x + w / 2.0, y + h / 2.0);+ for k in 0..BANDS {+ let t0 = k as f32 / BANDS as f32;+ let t1 = (k + 1) as f32 / BANDS as f32;+ let col = gradient_at(g, (t0 + t1) / 2.0);+ // a band perpendicular to the gradient line, long enough to cover the box+ let (s0, s1) = ((t0 - 0.5) * len, (t1 - 0.5) * len + 0.6);+ let (px, py) = (-dy, dx);+ let span = w + h;+ let pts = [+ (cx + dx * s0 + px * span, cy + dy * s0 + py * span),+ (cx + dx * s1 + px * span, cy + dy * s1 + py * span),+ (cx + dx * s1 - px * span, cy + dy * s1 - py * span),+ (cx + dx * s0 - px * span, cy + dy * s0 - py * span),+ ];+ p.polygon(&pts, col);+ }+}++/// Overlay scrollbars on scroll containers that overflow.+fn paint_scrollbars(n: &BoxNode, p: &mut Painter) {+ let (rx, ry) = n.scroll_range;+ let b = n.bounds;+ let (sx, sy) = n.scroll_pos;+ let thumb = crate::color::rgba(0x8a8a8aa0);+ if ry > 0.0 {+ let h = b.size.height;+ let th = (h * h / (h + ry)).max(16.0);+ let ty = b.origin.y + (h - th) * (sy / ry);+ p.quad(rect(b.origin.x + b.size.width - 6.0, ty + 1.0, 4.0, th - 2.0), 2.0, thumb,+ Rgba::TRANSPARENT, 0.0);+ }+ if rx > 0.0 {+ let w = b.size.width;+ let tw = (w * w / (w + rx)).max(16.0);+ let tx = b.origin.x + (w - tw) * (sx / rx);+ p.quad(rect(tx + 1.0, b.origin.y + b.size.height - 6.0, tw - 2.0, 4.0), 2.0, thumb,+ Rgba::TRANSPARENT, 0.0);+ }+}diff --git a/bindings/rust/blenderui/src/prof.rs b/bindings/rust/blenderui/src/prof.rsnew file mode 100644index 0000000..8ec217b--- /dev/null+++ b/bindings/rust/blenderui/src/prof.rs@@ -0,0 +1,57 @@+//! `BUI_PROFILE=1`: per-phase frame timings, averaged and printed to stderr+//! every 60 frames. Costs one thread-local bool check when off.++use std::cell::RefCell;+use std::time::Instant;++thread_local! {+ static ON: bool = std::env::var_os("BUI_PROFILE").is_some();+ static ACC: RefCell<(Vec<(&'static str, f64)>, u32)> = const { RefCell::new((Vec::new(), 0)) };+}++pub(crate) fn on() -> bool {+ ON.with(|o| *o)+}++/// Times its scope into the phase `name`.+pub(crate) struct Span(Option<(&'static str, Instant)>);++pub(crate) fn span(name: &'static str) -> Span {+ Span(on().then(|| (name, Instant::now())))+}++impl Drop for Span {+ fn drop(&mut self) {+ if let Some((name, t)) = self.0 {+ add(name, t.elapsed().as_secs_f64() * 1000.0);+ }+ }+}++/// Add `ms` to phase `name`.+pub(crate) fn add(name: &'static str, ms: f64) {+ ACC.with(|a| {+ let mut a = a.borrow_mut();+ match a.0.iter_mut().find(|(n, _)| *n == name) {+ Some(e) => e.1 += ms,+ None => a.0.push((name, ms)),+ }+ });+}++/// End of a frame: print the averages every 60 frames.+pub(crate) fn frame_done() {+ if !on() {+ return;+ }+ ACC.with(|a| {+ let mut a = a.borrow_mut();+ a.1 += 1;+ if a.1 == 60 {+ let line: Vec<String> = a.0.iter().map(|(n, ms)| format!("{n} {:.2}", ms / 60.0)).collect();+ eprintln!("frame ms: {}", line.join(" "));+ a.0.clear();+ a.1 = 0;+ }+ });+}diff --git a/bindings/rust/blenderui/src/style.rs b/bindings/rust/blenderui/src/style.rsnew file mode 100644index 0000000..8d410c0--- /dev/null+++ b/bindings/rust/blenderui/src/style.rs@@ -0,0 +1,1725 @@+//! Computed style and the one table that applies every CSS property.+//!+//! Layout properties land directly in a `taffy::Style`; paint and text+//! properties in [`Computed`]. Shorthands call the longhand handlers, so+//! each property has exactly one implementation.++use std::collections::HashMap;+use std::sync::OnceLock;++use taffy::geometry::MinMax;+use taffy::prelude::*;+use taffy::style::Overflow;++use crate::color::{parse_color, Rgba};+use crate::css::{Decl, Tok};+use crate::geometry::{Length, Units};++// ==========================================================================+// Computed style++#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub enum DisplayKind {+ None,+ Block,+ Inline,+ InlineBlock,+ Flex,+ InlineFlex,+ Grid,+ InlineGrid,+ Contents,+ ListItem,+ Table,+ TableRowGroup,+ TableRow,+ TableCell,+ TableCaption,+}++impl DisplayKind {+ pub fn is_inline_level(self) -> bool {+ matches!(self, DisplayKind::Inline | DisplayKind::InlineBlock | DisplayKind::InlineFlex+ | DisplayKind::InlineGrid)+ }+}++#[derive(Clone, Copy, Debug, PartialEq)]+pub enum TextAlign {+ Left,+ Center,+ Right,+ Justify,+}++#[derive(Clone, Copy, Debug, PartialEq)]+pub enum WhiteSpace {+ Normal,+ NoWrap,+ Pre,+ PreWrap,+ PreLine,+}++#[derive(Clone, Copy, Debug, PartialEq)]+pub enum TextTransform {+ None,+ Upper,+ Lower,+ Capitalize,+}++#[derive(Clone, Copy, Debug, PartialEq)]+pub enum LineHeight {+ Normal,+ Factor(f32),+ Px(f32),+}++#[derive(Clone, Copy, Debug, PartialEq)]+pub enum ListStyle {+ None,+ Disc,+ Circle,+ Square,+ Decimal,+ LowerAlpha,+ UpperAlpha,+ LowerRoman,+ UpperRoman,+}++#[derive(Clone, Copy, Debug, PartialEq)]+pub enum VAlign {+ Baseline,+ Sub,+ Super,+}++#[derive(Clone, Debug, PartialEq)]+pub struct Gradient {+ pub radial: bool,+ pub angle_deg: f32,+ pub stops: Vec<(Rgba, Option<f32>)>,+}++#[derive(Clone, Copy, Debug, PartialEq)]+pub struct Shadow {+ pub x: f32,+ pub y: f32,+ pub blur: f32,+ pub spread: f32,+ pub color: Rgba,+ pub inset: bool,+}++/// The style of one element after the cascade.+#[derive(Clone, Debug)]+pub struct Computed {+ pub display: DisplayKind,+ pub layout: Style,+ pub order: i32,+ // paint (not inherited)+ pub background: Rgba,+ pub gradient: Option<Gradient>,+ pub border_color: [Rgba; 4],+ pub border_drawn: [bool; 4],+ pub radius: [Length; 4],+ pub shadows: Vec<Shadow>,+ pub outline: (f32, Rgba, f32),+ pub opacity: f32,+ pub z_index: Option<i32>,+ pub translate: (Length, Length),+ pub scale: f32,+ // inherited+ pub visible: bool,+ pub cursor: Option<i32>,+ pub pointer_events: bool,+ pub color: Rgba,+ pub accent: Option<Rgba>,+ pub font_size: f32,+ pub weight: u16,+ pub italic: bool,+ pub underline: bool,+ pub line_through: bool,+ pub overline: bool,+ pub text_align: TextAlign,+ pub line_height: LineHeight,+ pub white_space: WhiteSpace,+ pub text_transform: TextTransform,+ pub letter_spacing: f32,+ pub word_spacing: f32,+ pub text_indent: Length,+ pub list_style: ListStyle,+ pub ellipsis: bool,+ pub small_caps: bool,+ pub vertical_align: VAlign,+ pub font_family: String,+ // tables, lists, quotes and text effects (inherited)+ pub border_spacing: (f32, f32),+ pub border_collapse: bool,+ pub caption_bottom: bool,+ pub marker_inside: bool,+ /// `quotes`: None = the default curly quotes.+ pub quotes: Option<(String, String)>,+ pub text_shadow: Option<Shadow>,+ pub decoration_color: Option<Rgba>,+}++impl Default for Computed {+ fn default() -> Self {+ Computed {+ display: DisplayKind::Inline,+ layout: Style { display: Display::Block, ..Default::default() },+ order: 0,+ background: Rgba::TRANSPARENT,+ gradient: None,+ border_color: [Rgba::TRANSPARENT; 4],+ border_drawn: [true; 4],+ radius: [Length::Px(0.0); 4],+ shadows: Vec::new(),+ outline: (0.0, Rgba::TRANSPARENT, 0.0),+ opacity: 1.0,+ z_index: None,+ translate: (Length::Px(0.0), Length::Px(0.0)),+ scale: 1.0,+ visible: true,+ cursor: None,+ pointer_events: true,+ color: crate::color::rgb(0xe6e6e6),+ accent: None,+ font_size: 13.0,+ weight: 400,+ italic: false,+ underline: false,+ line_through: false,+ overline: false,+ text_align: TextAlign::Left,+ line_height: LineHeight::Normal,+ white_space: WhiteSpace::Normal,+ text_transform: TextTransform::None,+ letter_spacing: 0.0,+ word_spacing: 0.0,+ text_indent: Length::Px(0.0),+ list_style: ListStyle::Disc,+ ellipsis: false,+ small_caps: false,+ vertical_align: VAlign::Baseline,+ font_family: String::new(),+ border_spacing: (0.0, 0.0),+ border_collapse: false,+ caption_bottom: false,+ marker_inside: false,+ quotes: None,+ text_shadow: None,+ decoration_color: None,+ }+ }+}++impl Computed {+ /// A child's starting style: inherited properties from `parent`, the rest initial.+ pub fn inherit(parent: &Computed) -> Computed {+ Computed {+ visible: parent.visible,+ cursor: parent.cursor,+ pointer_events: parent.pointer_events,+ color: parent.color,+ accent: parent.accent,+ font_size: parent.font_size,+ weight: parent.weight,+ italic: parent.italic,+ text_align: parent.text_align,+ line_height: parent.line_height,+ white_space: parent.white_space,+ text_transform: parent.text_transform,+ letter_spacing: parent.letter_spacing,+ word_spacing: parent.word_spacing,+ text_indent: parent.text_indent,+ list_style: parent.list_style,+ small_caps: parent.small_caps,+ font_family: parent.font_family.clone(),+ // text-decoration propagates to inline descendants in CSS+ underline: parent.underline,+ line_through: parent.line_through,+ overline: parent.overline,+ decoration_color: parent.decoration_color,+ border_spacing: parent.border_spacing,+ border_collapse: parent.border_collapse,+ caption_bottom: parent.caption_bottom,+ marker_inside: parent.marker_inside,+ quotes: parent.quotes.clone(),+ text_shadow: parent.text_shadow,+ ..Computed::default()+ }+ }++ /// Line box height in pixels.+ pub fn line_px(&self) -> f32 {+ match self.line_height {+ LineHeight::Normal => (self.font_size * 1.3).round(),+ LineHeight::Factor(f) => (self.font_size * f).round(),+ LineHeight::Px(p) => p,+ }+ }++ pub fn bold(&self) -> bool {+ self.weight >= 600+ }+}++// ==========================================================================+// Applying declarations++/// What a handler sees: the style being computed, its parent, units.+pub struct Ctx<'a> {+ pub c: &'a mut Computed,+ pub parent: &'a Computed,+ pub u: Units,+}++type Handler = fn(&mut Ctx, &[Tok]) -> bool;++/// Apply one declaration; false when the property or value isn't understood.+pub fn apply(c: &mut Computed, parent: &Computed, u: Units, d: &Decl) -> bool {+ let mut ctx = Ctx { c, parent, u };+ let name = d.prop.as_ref();+ if let [Tok::Ident(k)] = &*d.value {+ if matches!(k.as_str(), "inherit" | "initial" | "unset" | "revert" | "revert-layer") {+ return global_keyword(&mut ctx, name, k);+ }+ }+ if name.starts_with("--") {+ return true; // custom properties are accepted (no var() substitution)+ }+ match handlers().get(name) {+ Some(h) => h(&mut ctx, &d.value),+ None => ACCEPTED.contains(&name),+ }+}++/// Standard properties that parse and are accepted but have no effect in this+/// renderer (floats, bidi, generated content, background images, animation ...).+pub const ACCEPTED: &[&str] = &[+ "background-attachment", "background-position", "background-repeat", "background-size",+ "background-clip", "background-origin", "clear", "float", "clip", "clip-path", "content",+ "counter-increment", "counter-reset", "counter-set", "direction", "unicode-bidi",+ "writing-mode", "empty-cells", "list-style-image", "table-layout", "grid-template-areas",+ "object-fit", "object-position", "filter", "backdrop-filter", "mix-blend-mode", "isolation",+ "transition", "transition-property", "transition-duration", "transition-timing-function",+ "transition-delay", "animation", "animation-name", "animation-duration", "animation-delay",+ "animation-iteration-count", "animation-direction", "animation-fill-mode",+ "animation-timing-function", "animation-play-state", "will-change", "contain",+ "user-select", "resize", "appearance", "caret-color", "scroll-behavior", "scroll-snap-type",+ "scroll-snap-align", "overscroll-behavior", "touch-action", "hyphens", "overflow-wrap",+ "word-wrap", "word-break", "tab-size", "font-feature-settings", "font-kerning",+ "font-stretch", "text-rendering", "-webkit-font-smoothing", "-moz-osx-font-smoothing",+ "orphans", "widows", "page-break-before", "page-break-after", "page-break-inside",+ "break-before", "break-after", "break-inside", "columns", "column-count", "column-width",+ "column-rule", "rotate", "transform-origin", "perspective", "backface-visibility",+ "box-decoration-break", "image-rendering", "shape-outside", "text-underline-offset",+ "text-decoration-thickness", "text-decoration-style", "text-justify", "line-break",+];++/// Implemented or accepted.+pub fn is_supported(name: &str) -> bool {+ is_implemented(name) || ACCEPTED.contains(&name) || name.starts_with("--")+}++fn global_keyword(ctx: &mut Ctx, name: &str, keyword: &str) -> bool {+ let src = if keyword == "inherit" || (keyword == "unset" && is_inherited(name)) {+ ctx.parent.clone()+ } else {+ Computed::default()+ };+ macro_rules! copy {+ ($($prop:literal => $($field:ident).+),* $(,)?) => {+ match name {+ $($prop => { ctx.c.$($field).+ = src.$($field).+.clone(); true })*+ _ => handlers().contains_key(name),+ }+ };+ }+ copy! {+ "color" => color, "font-size" => font_size, "font-weight" => weight,+ "font-style" => italic, "text-align" => text_align, "line-height" => line_height,+ "white-space" => white_space, "text-transform" => text_transform,+ "letter-spacing" => letter_spacing, "word-spacing" => word_spacing,+ "visibility" => visible, "cursor" => cursor, "list-style-type" => list_style,+ "background-color" => background, "opacity" => opacity, "display" => display,+ "width" => layout.size.width, "height" => layout.size.height,+ "font-family" => font_family, "accent-color" => accent,+ }+}++fn is_inherited(name: &str) -> bool {+ INHERITED.contains(&name)+}++const INHERITED: &[&str] = &[+ "border-spacing", "border-collapse", "caption-side", "list-style-position", "quotes",+ "text-shadow", "empty-cells",+ "color", "cursor", "font", "font-family", "font-size", "font-style", "font-variant",+ "font-weight", "letter-spacing", "line-height", "list-style", "list-style-type",+ "text-align", "text-indent", "text-transform", "visibility", "white-space", "word-spacing",+ "accent-color", "caret-color", "pointer-events",+];++/// FNV-1a: property names are short, so this beats the default SipHash.+#[derive(Default, Clone, Copy)]+pub(crate) struct Fnv(pub u64);++impl std::hash::Hasher for Fnv {+ fn finish(&self) -> u64 {+ self.0+ }+ fn write(&mut self, bytes: &[u8]) {+ let mut h = if self.0 == 0 { 0xcbf29ce484222325 } else { self.0 };+ for b in bytes {+ h = (h ^ *b as u64).wrapping_mul(0x100000001b3);+ }+ self.0 = h;+ }+}++pub(crate) type FnvMap<K, V> = HashMap<K, V, std::hash::BuildHasherDefault<Fnv>>;++fn handlers() -> &'static FnvMap<&'static str, Handler> {+ static MAP: OnceLock<FnvMap<&'static str, Handler>> = OnceLock::new();+ MAP.get_or_init(|| HANDLERS.iter().copied().collect())+}++/// Names of every property that changes layout or rendering.+pub fn implemented_properties() -> impl Iterator<Item = &'static str> {+ HANDLERS.iter().map(|(n, _)| *n)+}++pub fn is_implemented(name: &str) -> bool {+ handlers().contains_key(name)+}++// -- value helpers -----------------------------------------------------------------++pub(crate) fn length(t: &Tok) -> Option<Length> {+ Some(match t {+ Tok::Num(v) if *v == 0.0 => Length::Px(0.0),+ Tok::Pct(p) => Length::Percent(*p),+ Tok::Ident(s) if s == "auto" => Length::Auto,+ Tok::Dim(v, unit) => match unit.as_str() {+ "px" => Length::Px(*v),+ "rem" => Length::Rem(*v),+ "em" => Length::Em(*v),+ "ex" | "ch" => Length::Em(*v * 0.5),+ "vw" => Length::Vw(*v),+ "vh" => Length::Vh(*v),+ "vmin" | "vmax" => Length::Vw(*v),+ "pt" => Length::Px(*v * 4.0 / 3.0),+ "pc" => Length::Px(*v * 16.0),+ "in" => Length::Px(*v * 96.0),+ "cm" => Length::Px(*v * 96.0 / 2.54),+ "mm" => Length::Px(*v * 96.0 / 25.4),+ "q" => Length::Px(*v * 96.0 / 101.6),+ _ => return None,+ },+ Tok::Func(f, args) if matches!(f.as_str(), "calc" | "min" | "max" | "clamp") => {+ return calc(f, args)+ }+ _ => return None,+ })+}++/// `calc()` and friends: sums of pixels, or of percentages (a mix keeps the+/// percentage part, the closest a single taffy length can express).+fn calc(f: &str, args: &[Vec<Tok>]) -> Option<Length> {+ let eval = |toks: &[Tok]| -> Option<Length> {+ let (mut px, mut pct, mut sign, mut any_pct) = (0.0f32, 0.0f32, 1.0f32, false);+ for t in toks {+ match t {+ Tok::Delim('+') => sign = 1.0,+ Tok::Delim('-') => sign = -1.0,+ Tok::Pct(p) => {+ pct += sign * p;+ any_pct = true;+ }+ other => {+ let l = length(other)?;+ px += sign * l.to_px(&Units { font_size: 16.0, viewport: (0.0, 0.0) })?;+ }+ }+ }+ Some(if any_pct { Length::Percent(pct) } else { Length::Px(px) })+ };+ match f {+ "calc" => eval(args.first()?),+ "min" | "max" => args.iter().filter_map(|a| eval(a)).next(),+ _ => args.get(1).and_then(|a| eval(a)),+ }+}++pub(crate) fn tok_text(t: &Tok) -> String {+ match t {+ Tok::Num(v) => format!("{v}"),+ Tok::Dim(v, u) => format!("{v}{u}"),+ Tok::Pct(v) => format!("{v}%"),+ Tok::Ident(s) => s.clone(),+ Tok::Hash(h) => format!("#{h}"),+ Tok::Str(s) => s.clone(),+ Tok::Func(n, args) => format!(+ "{n}({})",+ args.iter()+ .map(|a| a.iter().map(tok_text).collect::<Vec<_>>().join(" "))+ .collect::<Vec<_>>()+ .join(",")+ ),+ Tok::Comma => ",".into(),+ Tok::Slash => "/".into(),+ Tok::Delim(c) => c.to_string(),+ }+}++pub(crate) fn color(t: &Tok, current: Rgba) -> Option<Rgba> {+ match t {+ Tok::Ident(s) if s == "currentcolor" => Some(current),+ Tok::Ident(s) if matches!(s.as_str(), "canvas" | "field") => Some(crate::color::rgb(0x282828)),+ Tok::Ident(s) if matches!(s.as_str(), "canvastext" | "fieldtext" | "buttontext") => {+ Some(crate::color::rgb(0xe6e6e6))+ }+ Tok::Ident(s) if matches!(s.as_str(), "linktext" | "highlight") => {+ Some(crate::color::rgb(0x4772b3))+ }+ Tok::Hash(_) | Tok::Ident(_) | Tok::Func(..) => parse_color(&tok_text(t)),+ _ => None,+ }+}++fn number(t: &Tok) -> Option<f32> {+ match t {+ Tok::Num(v) => Some(*v),+ Tok::Pct(p) => Some(*p / 100.0),+ _ => None,+ }+}++fn kw(v: &[Tok]) -> Option<&str> {+ v.first().and_then(Tok::ident)+}++fn px(ctx: &Ctx, l: Length) -> f32 {+ l.to_px(&ctx.u).unwrap_or(0.0)+}++fn lp(ctx: &Ctx, l: Length) -> LengthPercentage {+ match l {+ Length::Percent(p) => LengthPercentage::Percent(p / 100.0),+ Length::Auto => LengthPercentage::Length(0.0),+ other => LengthPercentage::Length(px(ctx, other)),+ }+}++fn lpa(ctx: &Ctx, l: Length) -> LengthPercentageAuto {+ match l {+ Length::Percent(p) => LengthPercentageAuto::Percent(p / 100.0),+ Length::Auto => LengthPercentageAuto::Auto,+ other => LengthPercentageAuto::Length(px(ctx, other)),+ }+}++fn dim(ctx: &Ctx, l: Length) -> Dimension {+ match l {+ Length::Percent(p) => Dimension::Percent(p / 100.0),+ Length::Auto => Dimension::Auto,+ other => Dimension::Length(px(ctx, other)),+ }+}++fn dim_kw(ctx: &Ctx, v: &[Tok]) -> Option<Dimension> {+ match kw(v) {+ Some("none") | Some("max-content") | Some("min-content") | Some("fit-content") => {+ Some(Dimension::Auto)+ }+ _ => v.first().and_then(length).map(|l| dim(ctx, l)),+ }+}++/// The 1–4 value box shorthand: top right bottom left.+fn four<T: Copy>(v: &[T]) -> Option<[T; 4]> {+ Some(match v.len() {+ 1 => [v[0]; 4],+ 2 => [v[0], v[1], v[0], v[1]],+ 3 => [v[0], v[1], v[2], v[1]],+ 4 => [v[0], v[1], v[2], v[3]],+ _ => return None,+ })+}++fn lengths(v: &[Tok]) -> Option<Vec<Length>> {+ v.iter().filter(|t| !matches!(t, Tok::Slash)).map(length).collect()+}++// side index: 0 top, 1 right, 2 bottom, 3 left+fn set_margin(ctx: &mut Ctx, side: usize, l: Length) {+ let v = lpa(ctx, l);+ let m = &mut ctx.c.layout.margin;+ match side {+ 0 => m.top = v,+ 1 => m.right = v,+ 2 => m.bottom = v,+ _ => m.left = v,+ }+}++fn set_padding(ctx: &mut Ctx, side: usize, l: Length) {+ let v = lp(ctx, l);+ let p = &mut ctx.c.layout.padding;+ match side {+ 0 => p.top = v,+ 1 => p.right = v,+ 2 => p.bottom = v,+ _ => p.left = v,+ }+}++fn set_inset(ctx: &mut Ctx, side: usize, l: Length) {+ let v = lpa(ctx, l);+ let i = &mut ctx.c.layout.inset;+ match side {+ 0 => i.top = v,+ 1 => i.right = v,+ 2 => i.bottom = v,+ _ => i.left = v,+ }+}++fn set_border_width(ctx: &mut Ctx, side: usize, w: f32) {+ let v = LengthPercentage::Length(w);+ let b = &mut ctx.c.layout.border;+ match side {+ 0 => b.top = v,+ 1 => b.right = v,+ 2 => b.bottom = v,+ _ => b.left = v,+ }+}++fn border_width_tok(ctx: &Ctx, t: &Tok) -> Option<f32> {+ match t.ident() {+ Some("thin") => Some(1.0),+ Some("medium") => Some(3.0),+ Some("thick") => Some(5.0),+ _ => length(t).map(|l| px(ctx, l)),+ }+}++const BORDER_STYLES: &[&str] = &["none", "hidden", "solid", "dashed", "dotted", "double",+ "groove", "ridge", "inset", "outset"];++/// `border[-side]: <width> || <style> || <color>` for the given sides.+fn border_sides(ctx: &mut Ctx, v: &[Tok], sides: &[usize]) -> bool {+ let (mut w, mut style, mut col) = (None, None, None);+ for t in v {+ if let Some(s) = t.ident().filter(|s| BORDER_STYLES.contains(s)) {+ style = Some(s.to_string());+ } else if let Some(c) = color(t, ctx.c.color).filter(|_| !matches!(t, Tok::Dim(..))) {+ col = Some(c);+ } else if let Some(px) = border_width_tok(ctx, t) {+ w = Some(px);+ } else {+ return false;+ }+ }+ let none = matches!(style.as_deref(), Some("none") | Some("hidden"));+ for &s in sides {+ let width = if none { 0.0 } else { w.unwrap_or(if style.is_some() { 3.0 } else { 0.0 }) };+ set_border_width(ctx, s, width);+ ctx.c.border_color[s] = col.unwrap_or(ctx.c.color);+ ctx.c.border_drawn[s] = !none;+ }+ true+}++fn per_side(v: &[Tok], mut f: impl FnMut(usize, &Tok) -> bool) -> bool {+ match four(&v.iter().collect::<Vec<_>>()) {+ Some(sides) => (0..4).all(|i| f(i, sides[i])),+ None => false,+ }+}++fn align(v: &str) -> Option<AlignItems> {+ Some(match v {+ "start" | "self-start" => AlignItems::Start,+ "end" | "self-end" => AlignItems::End,+ "flex-start" | "left" => AlignItems::FlexStart,+ "flex-end" | "right" => AlignItems::FlexEnd,+ "center" => AlignItems::Center,+ "baseline" | "first" | "last" => AlignItems::Baseline,+ "stretch" | "normal" => AlignItems::Stretch,+ _ => return None,+ })+}++fn align_content(v: &str) -> Option<AlignContent> {+ Some(match v {+ "start" => AlignContent::Start,+ "end" => AlignContent::End,+ "flex-start" | "left" => AlignContent::FlexStart,+ "flex-end" | "right" => AlignContent::FlexEnd,+ "center" => AlignContent::Center,+ "stretch" | "normal" => AlignContent::Stretch,+ "space-between" => AlignContent::SpaceBetween,+ "space-around" => AlignContent::SpaceAround,+ "space-evenly" => AlignContent::SpaceEvenly,+ _ => return None,+ })+}++fn kw_align(v: &[Tok]) -> Option<AlignItems> {+ v.iter().filter_map(Tok::ident).filter(|s| *s != "safe" && *s != "unsafe").next_back()+ .and_then(align)+}++fn kw_align_content(v: &[Tok]) -> Option<AlignContent> {+ v.iter().filter_map(Tok::ident).filter(|s| *s != "safe" && *s != "unsafe").next_back()+ .and_then(align_content)+}++// -- grid ----------------------------------------------------------------------------++fn track_min(ctx: &Ctx, t: &Tok) -> Option<MinTrackSizingFunction> {+ Some(match t.ident() {+ Some("auto") => MinTrackSizingFunction::Auto,+ Some("min-content") => MinTrackSizingFunction::MinContent,+ Some("max-content") => MinTrackSizingFunction::MaxContent,+ _ => match t {+ Tok::Dim(_, u) if u == "fr" => MinTrackSizingFunction::Auto,+ _ => MinTrackSizingFunction::Fixed(lp(ctx, length(t)?)),+ },+ })+}++fn track_max(ctx: &Ctx, t: &Tok) -> Option<MaxTrackSizingFunction> {+ Some(match t.ident() {+ Some("auto") => MaxTrackSizingFunction::Auto,+ Some("min-content") => MaxTrackSizingFunction::MinContent,+ Some("max-content") => MaxTrackSizingFunction::MaxContent,+ _ => match t {+ Tok::Dim(v, u) if u == "fr" => MaxTrackSizingFunction::Fraction(*v),+ _ => MaxTrackSizingFunction::Fixed(lp(ctx, length(t)?)),+ },+ })+}++fn track(ctx: &Ctx, t: &Tok) -> Option<NonRepeatedTrackSizingFunction> {+ match t {+ Tok::Func(f, args) if f == "minmax" && args.len() == 2 => Some(MinMax {+ min: track_min(ctx, args[0].first()?)?,+ max: track_max(ctx, args[1].first()?)?,+ }),+ Tok::Func(f, args) if f == "fit-content" => Some(MinMax {+ min: MinTrackSizingFunction::Auto,+ max: MaxTrackSizingFunction::FitContent(lp(ctx, length(args.first()?.first()?)?)),+ }),+ _ => Some(MinMax { min: track_min(ctx, t)?, max: track_max(ctx, t)? }),+ }+}++fn track_list(ctx: &Ctx, v: &[Tok]) -> Option<Vec<TrackSizingFunction>> {+ if kw(v) == Some("none") {+ return Some(Vec::new());+ }+ let mut out = Vec::new();+ for t in v {+ match t {+ Tok::Func(f, args) if f == "repeat" && args.len() >= 2 => {+ let rep = match args[0].first()? {+ Tok::Num(n) => GridTrackRepetition::Count(*n as u16),+ Tok::Ident(s) if s == "auto-fill" => GridTrackRepetition::AutoFill,+ Tok::Ident(s) if s == "auto-fit" => GridTrackRepetition::AutoFit,+ _ => return None,+ };+ let tracks = args[1..].iter().flatten().map(|t| track(ctx, t))+ .collect::<Option<Vec<_>>>()?;+ out.push(TrackSizingFunction::Repeat(rep, tracks));+ }+ Tok::Delim('[') | Tok::Delim(']') => {}+ _ => out.push(TrackSizingFunction::Single(track(ctx, t)?)),+ }+ }+ Some(out)+}++fn grid_line(v: &[Tok]) -> Option<Line<GridPlacement>> {+ let place = |toks: &[Tok]| -> Option<GridPlacement> {+ match toks {+ [Tok::Ident(s)] if s == "auto" => Some(GridPlacement::Auto),+ [Tok::Num(n)] => Some(taffy::style_helpers::line(*n as i16)),+ [Tok::Ident(s), Tok::Num(n)] if s == "span" => {+ Some(taffy::style_helpers::span(*n as u16))+ }+ [Tok::Ident(_)] => Some(GridPlacement::Auto), // named lines/areas+ _ => None,+ }+ };+ let parts: Vec<&[Tok]> = v.split(|t| matches!(t, Tok::Slash)).collect();+ let start = place(parts[0])?;+ let end = match parts.get(1) {+ Some(p) => place(p)?,+ None => GridPlacement::Auto,+ };+ Some(Line { start, end })+}++// -- backgrounds, shadows, fonts -----------------------------------------------------------++fn gradient(ctx: &Ctx, t: &Tok) -> Option<Gradient> {+ let Tok::Func(f, args) = t else { return None };+ let radial = f.contains("radial");+ if !f.contains("gradient") {+ return None;+ }+ let mut angle = 180.0;+ let mut first = 0;+ if let Some(a) = args.first() {+ match a.first() {+ Some(Tok::Dim(v, u)) if u == "deg" || u == "turn" || u == "rad" => {+ angle = match u.as_str() {+ "turn" => v * 360.0,+ "rad" => v.to_degrees(),+ _ => *v,+ };+ first = 1;+ }+ Some(Tok::Ident(s)) if s == "to" => {+ let dirs: Vec<&str> = a[1..].iter().filter_map(Tok::ident).collect();+ angle = match dirs.as_slice() {+ ["top"] => 0.0,+ ["right"] => 90.0,+ ["left"] => 270.0,+ ["bottom"] => 180.0,+ [a, b] if (*a == "top" || *b == "top") => {+ if dirs.contains(&"right") { 45.0 } else { 315.0 }+ }+ _ => if dirs.contains(&"right") { 135.0 } else { 225.0 },+ };+ first = 1;+ }+ Some(Tok::Ident(s)) if radial && !parse_color(s).is_some() => first = 1,+ _ => {}+ }+ }+ let stops: Vec<(Rgba, Option<f32>)> = args[first..]+ .iter()+ .filter_map(|stop| {+ let c = stop.iter().find_map(|t| color(t, ctx.c.color))?;+ let pos = stop.iter().find_map(|t| match t {+ Tok::Pct(p) => Some(p / 100.0),+ _ => None,+ });+ Some((c, pos))+ })+ .collect();+ (!stops.is_empty()).then_some(Gradient { radial, angle_deg: angle, stops })+}++fn shadows(ctx: &Ctx, v: &[Tok]) -> Option<Vec<Shadow>> {+ if kw(v) == Some("none") {+ return Some(Vec::new());+ }+ v.split(|t| matches!(t, Tok::Comma))+ .map(|part| {+ let mut nums = Vec::new();+ let mut c = Rgba { a: 0.35, ..Rgba::default() };+ let mut inset = false;+ for t in part {+ if t.ident() == Some("inset") {+ inset = true;+ } else if let Some(l) = length(t) {+ nums.push(px(ctx, l));+ } else {+ c = color(t, ctx.c.color)?;+ }+ }+ if nums.len() < 2 {+ return None;+ }+ Some(Shadow {+ x: nums[0],+ y: nums[1],+ blur: *nums.get(2).unwrap_or(&0.0),+ spread: *nums.get(3).unwrap_or(&0.0),+ color: c,+ inset,+ })+ })+ .collect()+}++fn font_size(ctx: &Ctx, t: &Tok) -> Option<f32> {+ let base = ctx.parent.font_size;+ Some(match t.ident() {+ Some("xx-small") => 9.0,+ Some("x-small") => 10.0,+ Some("small") => 13.0 * 0.89,+ Some("medium") => 13.0,+ Some("large") => 13.0 * 1.2,+ Some("x-large") => 13.0 * 1.5,+ Some("xx-large") => 13.0 * 2.0,+ Some("xxx-large") => 13.0 * 3.0,+ Some("smaller") => base / 1.2,+ Some("larger") => base * 1.2,+ _ => match length(t)? {+ Length::Percent(p) => base * p / 100.0,+ Length::Em(e) => base * e,+ other => other.to_px(&ctx.u)?,+ },+ })+}++fn font_weight(ctx: &Ctx, t: &Tok) -> Option<u16> {+ Some(match t {+ Tok::Num(n) => *n as u16,+ Tok::Ident(s) => match s.as_str() {+ "normal" => 400,+ "bold" => 700,+ "bolder" => (ctx.parent.weight + 300).min(900),+ "lighter" => ctx.parent.weight.saturating_sub(300).max(100),+ _ => return None,+ },+ _ => return None,+ })+}++fn line_height(t: &Tok, ctx: &Ctx) -> Option<LineHeight> {+ Some(match t {+ Tok::Ident(s) if s == "normal" => LineHeight::Normal,+ Tok::Num(n) => LineHeight::Factor(*n),+ Tok::Pct(p) => LineHeight::Factor(p / 100.0),+ _ => LineHeight::Px(match length(t)? {+ Length::Em(e) => e * ctx.c.font_size,+ other => other.to_px(&ctx.u)?,+ }),+ })+}++fn display(ctx: &mut Ctx, v: &[Tok]) -> bool {+ let words: Vec<&str> = v.iter().filter_map(Tok::ident).collect();+ let k = match words.as_slice() {+ ["none"] => DisplayKind::None,+ ["block"] | ["block", "flow"] | ["flow-root"] | ["block", "flow-root"] => DisplayKind::Block,+ ["inline"] | ["inline", "flow"] | ["ruby"] | ["ruby-text"] | ["ruby-base"] => {+ DisplayKind::Inline+ }+ ["inline-block"] | ["inline", "flow-root"] => DisplayKind::InlineBlock,+ ["flex"] | ["block", "flex"] => DisplayKind::Flex,+ ["inline-flex"] | ["inline", "flex"] => DisplayKind::InlineFlex,+ ["grid"] | ["block", "grid"] => DisplayKind::Grid,+ ["inline-grid"] | ["inline", "grid"] => DisplayKind::InlineGrid,+ ["contents"] => DisplayKind::Contents,+ ["list-item"] | ["block", "list-item"] => DisplayKind::ListItem,+ ["table"] | ["inline-table"] => DisplayKind::Table,+ ["table-row-group"] | ["table-header-group"] | ["table-footer-group"] => {+ DisplayKind::TableRowGroup+ }+ ["table-row"] => DisplayKind::TableRow,+ ["table-cell"] | ["table-column"] | ["table-column-group"] => DisplayKind::TableCell,+ ["table-caption"] => DisplayKind::TableCaption,+ _ => return false,+ };+ ctx.c.display = k;+ true+}++const CURSORS: &[(&str, i32)] = &[+ ("auto", -1), ("default", 0), ("pointer", 5), ("text", 3), ("vertical-text", 3),+ ("crosshair", 4), ("move", 6), ("all-scroll", 6), ("grab", 6), ("grabbing", 6),+ ("ew-resize", 1), ("e-resize", 1), ("w-resize", 1), ("col-resize", 1),+ ("ns-resize", 2), ("n-resize", 2), ("s-resize", 2), ("row-resize", 2),+ ("none", 7), ("not-allowed", 0), ("wait", 0), ("progress", 0), ("help", 0),+ ("context-menu", 0), ("cell", 4), ("copy", 0), ("alias", 0), ("no-drop", 0),+ ("nesw-resize", 6), ("nwse-resize", 6), ("ne-resize", 6), ("nw-resize", 6),+ ("se-resize", 6), ("sw-resize", 6), ("zoom-in", 4), ("zoom-out", 4),+];++fn roman(mut n: usize, upper: bool) -> String {+ let table = [(1000, "m"), (900, "cm"), (500, "d"), (400, "cd"), (100, "c"), (90, "xc"),+ (50, "l"), (40, "xl"), (10, "x"), (9, "ix"), (5, "v"), (4, "iv"), (1, "i")];+ let mut s = String::new();+ for (v, r) in table {+ while n >= v {+ s.push_str(r);+ n -= v;+ }+ }+ if upper { s.to_uppercase() } else { s }+}++impl ListStyle {+ /// The marker text for the `index`-th (1-based) item.+ pub fn marker(self, index: usize) -> Option<String> {+ Some(match self {+ ListStyle::None => return None,+ ListStyle::Disc => "\u{2022}".into(),+ ListStyle::Circle => "\u{25e6}".into(),+ ListStyle::Square => "\u{25aa}".into(),+ ListStyle::Decimal => format!("{index}."),+ ListStyle::LowerAlpha => format!("{}.", (b'a' + ((index - 1) % 26) as u8) as char),+ ListStyle::UpperAlpha => format!("{}.", (b'A' + ((index - 1) % 26) as u8) as char),+ ListStyle::LowerRoman => format!("{}.", roman(index, false)),+ ListStyle::UpperRoman => format!("{}.", roman(index, true)),+ })+ }+}++fn list_style(s: &str) -> Option<ListStyle> {+ Some(match s {+ "none" => ListStyle::None,+ "disc" => ListStyle::Disc,+ "circle" => ListStyle::Circle,+ "square" => ListStyle::Square,+ "decimal" | "decimal-leading-zero" => ListStyle::Decimal,+ "lower-alpha" | "lower-latin" => ListStyle::LowerAlpha,+ "upper-alpha" | "upper-latin" => ListStyle::UpperAlpha,+ "lower-roman" => ListStyle::LowerRoman,+ "upper-roman" => ListStyle::UpperRoman,+ _ => return None,+ })+}++fn overflow(s: &str) -> Option<Overflow> {+ Some(match s {+ "visible" => Overflow::Visible,+ "hidden" => Overflow::Hidden,+ "clip" => Overflow::Clip,+ "scroll" | "auto" | "overlay" => Overflow::Scroll,+ _ => return None,+ })+}++/// Run another property's handler (shorthands, logical aliases).+fn delegate(ctx: &mut Ctx, name: &str, v: &[Tok]) -> bool {+ handlers().get(name).is_some_and(|h| h(ctx, v))+}++macro_rules! side_handlers {+ ($setter:ident, $top:literal, $right:literal, $bottom:literal, $left:literal) => {+ [+ ($top, (|c: &mut Ctx, v: &[Tok]| v.first().and_then(length).map(|l| $setter(c, 0, l)).is_some()) as Handler),+ ($right, (|c: &mut Ctx, v: &[Tok]| v.first().and_then(length).map(|l| $setter(c, 1, l)).is_some()) as Handler),+ ($bottom, (|c: &mut Ctx, v: &[Tok]| v.first().and_then(length).map(|l| $setter(c, 2, l)).is_some()) as Handler),+ ($left, (|c: &mut Ctx, v: &[Tok]| v.first().and_then(length).map(|l| $setter(c, 3, l)).is_some()) as Handler),+ ]+ };+}++static HANDLERS: &[(&str, Handler)] = &{+ const fn h(n: &'static str, f: Handler) -> (&'static str, Handler) {+ (n, f)+ }+ // The table: [box model, positioning, flexbox, grid, alignment, overflow,+ // background, border, effects, text, interaction]. Every entry changes+ // layout or rendering.+ let margin = side_handlers!(set_margin, "margin-top", "margin-right", "margin-bottom", "margin-left");+ let padding = side_handlers!(set_padding, "padding-top", "padding-right", "padding-bottom", "padding-left");+ let inset = side_handlers!(set_inset, "top", "right", "bottom", "left");+ [+ // -- box model --------------------------------------------------------------+ h("display", display),+ h("box-sizing", |c, v| {+ c.c.layout.box_sizing = match kw(v) {+ Some("content-box") => BoxSizing::ContentBox,+ Some("border-box") => BoxSizing::BorderBox,+ _ => return false,+ };+ true+ }),+ h("width", |c, v| dim_kw(c, v).map(|d| c.c.layout.size.width = d).is_some()),+ h("height", |c, v| dim_kw(c, v).map(|d| c.c.layout.size.height = d).is_some()),+ h("min-width", |c, v| dim_kw(c, v).map(|d| c.c.layout.min_size.width = d).is_some()),+ h("min-height", |c, v| dim_kw(c, v).map(|d| c.c.layout.min_size.height = d).is_some()),+ h("max-width", |c, v| dim_kw(c, v).map(|d| c.c.layout.max_size.width = d).is_some()),+ h("max-height", |c, v| dim_kw(c, v).map(|d| c.c.layout.max_size.height = d).is_some()),+ h("inline-size", |c, v| delegate(c, "width", v)),+ h("block-size", |c, v| delegate(c, "height", v)),+ h("min-inline-size", |c, v| delegate(c, "min-width", v)),+ h("min-block-size", |c, v| delegate(c, "min-height", v)),+ h("max-inline-size", |c, v| delegate(c, "max-width", v)),+ h("max-block-size", |c, v| delegate(c, "max-height", v)),+ h("aspect-ratio", |c, v| {+ let nums: Vec<f32> = v.iter().filter_map(number).collect();+ c.c.layout.aspect_ratio = match (kw(v), nums.as_slice()) {+ (Some("auto"), _) => None,+ (_, [w, h]) if *h != 0.0 => Some(w / h),+ (_, [r]) => Some(*r),+ _ => return false,+ };+ true+ }),+ margin[0], margin[1], margin[2], margin[3],+ h("margin", |c, v| lengths(v).and_then(|l| four(&l)).map(|s| {+ (0..4).for_each(|i| set_margin(c, i, s[i]))+ }).is_some()),+ h("margin-inline-start", |c, v| delegate(c, "margin-left", v)),+ h("margin-inline-end", |c, v| delegate(c, "margin-right", v)),+ h("margin-block-start", |c, v| delegate(c, "margin-top", v)),+ h("margin-block-end", |c, v| delegate(c, "margin-bottom", v)),+ h("margin-inline", |c, v| pair(c, v, "margin-left", "margin-right")),+ h("margin-block", |c, v| pair(c, v, "margin-top", "margin-bottom")),+ padding[0], padding[1], padding[2], padding[3],+ h("padding", |c, v| lengths(v).and_then(|l| four(&l)).map(|s| {+ (0..4).for_each(|i| set_padding(c, i, s[i]))+ }).is_some()),+ h("padding-inline-start", |c, v| delegate(c, "padding-left", v)),+ h("padding-inline-end", |c, v| delegate(c, "padding-right", v)),+ h("padding-block-start", |c, v| delegate(c, "padding-top", v)),+ h("padding-block-end", |c, v| delegate(c, "padding-bottom", v)),+ h("padding-inline", |c, v| pair(c, v, "padding-left", "padding-right")),+ h("padding-block", |c, v| pair(c, v, "padding-top", "padding-bottom")),+ // -- positioning ------------------------------------------------------------+ h("position", |c, v| {+ c.c.layout.position = match kw(v) {+ Some("static") | Some("relative") | Some("sticky") => Position::Relative,+ Some("absolute") | Some("fixed") => Position::Absolute,+ _ => return false,+ };+ true+ }),+ inset[0], inset[1], inset[2], inset[3],+ h("inset", |c, v| lengths(v).and_then(|l| four(&l)).map(|s| {+ (0..4).for_each(|i| set_inset(c, i, s[i]))+ }).is_some()),+ h("inset-inline-start", |c, v| delegate(c, "left", v)),+ h("inset-inline-end", |c, v| delegate(c, "right", v)),+ h("inset-block-start", |c, v| delegate(c, "top", v)),+ h("inset-block-end", |c, v| delegate(c, "bottom", v)),+ h("inset-inline", |c, v| pair(c, v, "left", "right")),+ h("inset-block", |c, v| pair(c, v, "top", "bottom")),+ h("z-index", |c, v| {+ c.c.z_index = match v.first() {+ Some(Tok::Num(n)) => Some(*n as i32),+ Some(Tok::Ident(s)) if s == "auto" => None,+ _ => return false,+ };+ true+ }),+ // -- flexbox --------------------------------------------------------------------+ h("flex-direction", |c, v| {+ c.c.layout.flex_direction = match kw(v) {+ Some("row") => FlexDirection::Row,+ Some("row-reverse") => FlexDirection::RowReverse,+ Some("column") => FlexDirection::Column,+ Some("column-reverse") => FlexDirection::ColumnReverse,+ _ => return false,+ };+ true+ }),+ h("flex-wrap", |c, v| {+ c.c.layout.flex_wrap = match kw(v) {+ Some("nowrap") => FlexWrap::NoWrap,+ Some("wrap") => FlexWrap::Wrap,+ Some("wrap-reverse") => FlexWrap::WrapReverse,+ _ => return false,+ };+ true+ }),+ h("flex-flow", |c, v| v.iter().all(|t| {+ let one = std::slice::from_ref(t);+ delegate(c, "flex-direction", one) || delegate(c, "flex-wrap", one)+ })),+ h("flex-grow", |c, v| v.first().and_then(number).map(|n| c.c.layout.flex_grow = n).is_some()),+ h("flex-shrink", |c, v| v.first().and_then(number).map(|n| c.c.layout.flex_shrink = n).is_some()),+ h("flex-basis", |c, v| match kw(v) {+ Some("content") => {+ c.c.layout.flex_basis = Dimension::Auto;+ true+ }+ _ => dim_kw(c, v).map(|d| c.c.layout.flex_basis = d).is_some(),+ }),+ h("flex", |c, v| {+ let l = &mut c.c.layout;+ match (kw(v), v) {+ (Some("none"), _) => (l.flex_grow, l.flex_shrink, l.flex_basis) = (0.0, 0.0, Dimension::Auto),+ (Some("auto"), _) => (l.flex_grow, l.flex_shrink, l.flex_basis) = (1.0, 1.0, Dimension::Auto),+ (Some("initial"), _) => (l.flex_grow, l.flex_shrink, l.flex_basis) = (0.0, 1.0, Dimension::Auto),+ (_, [Tok::Num(g)]) => (l.flex_grow, l.flex_shrink, l.flex_basis) = (*g, 1.0, Dimension::Percent(0.0)),+ (_, [Tok::Num(g), Tok::Num(s)]) => (l.flex_grow, l.flex_shrink, l.flex_basis) = (*g, *s, Dimension::Percent(0.0)),+ (_, [Tok::Num(g), Tok::Num(s), b]) => {+ let Some(len) = length(b) else { return false };+ let d = dim(c, len);+ let l = &mut c.c.layout;+ (l.flex_grow, l.flex_shrink, l.flex_basis) = (*g, *s, d);+ }+ (_, [Tok::Num(g), b]) => {+ let Some(len) = length(b) else { return false };+ let d = dim(c, len);+ let l = &mut c.c.layout;+ (l.flex_grow, l.flex_shrink, l.flex_basis) = (*g, 1.0, d);+ }+ (_, [b]) => {+ let Some(len) = length(b) else { return false };+ let d = dim(c, len);+ let l = &mut c.c.layout;+ (l.flex_grow, l.flex_shrink, l.flex_basis) = (1.0, 1.0, d);+ }+ _ => return false,+ }+ true+ }),+ h("order", |c, v| match v.first() {+ Some(Tok::Num(n)) => {+ c.c.order = *n as i32;+ true+ }+ _ => false,+ }),+ // -- alignment ------------------------------------------------------------------+ h("align-items", |c, v| kw_align(v).map(|a| c.c.layout.align_items = Some(a)).is_some()),+ h("align-self", |c, v| match kw(v) {+ Some("auto") => {+ c.c.layout.align_self = None;+ true+ }+ _ => kw_align(v).map(|a| c.c.layout.align_self = Some(a)).is_some(),+ }),+ h("justify-items", |c, v| kw_align(v).map(|a| c.c.layout.justify_items = Some(a)).is_some()),+ h("justify-self", |c, v| match kw(v) {+ Some("auto") => {+ c.c.layout.justify_self = None;+ true+ }+ _ => kw_align(v).map(|a| c.c.layout.justify_self = Some(a)).is_some(),+ }),+ h("align-content", |c, v| kw_align_content(v).map(|a| c.c.layout.align_content = Some(a)).is_some()),+ h("justify-content", |c, v| kw_align_content(v).map(|a| c.c.layout.justify_content = Some(a)).is_some()),+ h("place-items", |c, v| two_kw(c, v, "align-items", "justify-items")),+ h("place-content", |c, v| two_kw(c, v, "align-content", "justify-content")),+ h("place-self", |c, v| two_kw(c, v, "align-self", "justify-self")),+ h("gap", |c, v| {+ let Some(l) = lengths(v) else { return false };+ let (r, col) = match l.as_slice() {+ [a] => (*a, *a),+ [a, b] => (*a, *b),+ _ => return false,+ };+ c.c.layout.gap = Size { width: lp(c, col), height: lp(c, r) };+ true+ }),+ h("row-gap", |c, v| v.first().and_then(length).map(|l| c.c.layout.gap.height = lp(c, l)).is_some()),+ h("column-gap", |c, v| match kw(v) {+ Some("normal") => true,+ _ => v.first().and_then(length).map(|l| c.c.layout.gap.width = lp(c, l)).is_some(),+ }),+ h("grid-gap", |c, v| delegate(c, "gap", v)),+ h("grid-row-gap", |c, v| delegate(c, "row-gap", v)),+ h("grid-column-gap", |c, v| delegate(c, "column-gap", v)),+ // -- grid -------------------------------------------------------------------------+ h("grid-template-columns", |c, v| track_list(c, v).map(|t| c.c.layout.grid_template_columns = t).is_some()),+ h("grid-template-rows", |c, v| track_list(c, v).map(|t| c.c.layout.grid_template_rows = t).is_some()),+ h("grid-template", |c, v| {+ let parts: Vec<&[Tok]> = v.split(|t| matches!(t, Tok::Slash)).collect();+ match parts.as_slice() {+ [rows, cols] => delegate(c, "grid-template-rows", rows)+ && delegate(c, "grid-template-columns", cols),+ _ => delegate(c, "grid-template-rows", v),+ }+ }),+ h("grid", |c, v| {+ // <rows> / <columns> | auto-flow [dense] <rows> / <columns> | <rows> / auto-flow <columns>+ let parts: Vec<&[Tok]> = v.split(|t| matches!(t, Tok::Slash)).collect();+ let [rows, cols] = parts.as_slice() else { return false };+ let flow = |p: &[Tok]| p.iter().any(|t| t.ident() == Some("auto-flow"));+ let dense = v.iter().any(|t| t.ident() == Some("dense"));+ let strip = |p: &[Tok]| p.iter().filter(|t| !matches!(t.ident(), Some("auto-flow" | "dense")))+ .cloned().collect::<Vec<Tok>>();+ if flow(rows) {+ c.c.layout.grid_auto_flow = if dense { GridAutoFlow::RowDense } else { GridAutoFlow::Row };+ let auto = strip(rows);+ (auto.is_empty() || delegate(c, "grid-auto-rows", &auto))+ && delegate(c, "grid-template-columns", cols)+ } else if flow(cols) {+ c.c.layout.grid_auto_flow = if dense { GridAutoFlow::ColumnDense } else { GridAutoFlow::Column };+ let auto = strip(cols);+ (auto.is_empty() || delegate(c, "grid-auto-columns", &auto))+ && delegate(c, "grid-template-rows", rows)+ } else {+ delegate(c, "grid-template", v)+ }+ }),+ h("grid-auto-columns", |c, v| v.iter().map(|t| track(c, t)).collect::<Option<Vec<_>>>()+ .map(|t| c.c.layout.grid_auto_columns = t).is_some()),+ h("grid-auto-rows", |c, v| v.iter().map(|t| track(c, t)).collect::<Option<Vec<_>>>()+ .map(|t| c.c.layout.grid_auto_rows = t).is_some()),+ h("grid-auto-flow", |c, v| {+ let words: Vec<&str> = v.iter().filter_map(Tok::ident).collect();+ let dense = words.contains(&"dense");+ c.c.layout.grid_auto_flow = match (words.contains(&"column"), dense) {+ (true, true) => GridAutoFlow::ColumnDense,+ (true, false) => GridAutoFlow::Column,+ (false, true) => GridAutoFlow::RowDense,+ (false, false) => GridAutoFlow::Row,+ };+ true+ }),+ h("grid-row", |c, v| grid_line(v).map(|l| c.c.layout.grid_row = l).is_some()),+ h("grid-column", |c, v| grid_line(v).map(|l| c.c.layout.grid_column = l).is_some()),+ h("grid-row-start", |c, v| grid_line(v).map(|l| c.c.layout.grid_row.start = l.start).is_some()),+ h("grid-row-end", |c, v| grid_line(v).map(|l| c.c.layout.grid_row.end = l.start).is_some()),+ h("grid-column-start", |c, v| grid_line(v).map(|l| c.c.layout.grid_column.start = l.start).is_some()),+ h("grid-column-end", |c, v| grid_line(v).map(|l| c.c.layout.grid_column.end = l.start).is_some()),+ h("grid-area", |c, v| {+ let parts: Vec<&[Tok]> = v.split(|t| matches!(t, Tok::Slash)).collect();+ let get = |i: usize| parts.get(i).and_then(|p| grid_line(p)).map(|l| l.start);+ match (get(0), get(1), get(2), get(3)) {+ (Some(rs), cs, re, ce) => {+ c.c.layout.grid_row = Line { start: rs, end: re.unwrap_or(GridPlacement::Auto) };+ c.c.layout.grid_column = Line {+ start: cs.unwrap_or(GridPlacement::Auto),+ end: ce.unwrap_or(GridPlacement::Auto),+ };+ true+ }+ _ => false,+ }+ }),+ // -- overflow ---------------------------------------------------------------------+ h("overflow-x", |c, v| kw(v).and_then(overflow).map(|o| c.c.layout.overflow.x = o).is_some()),+ h("overflow-y", |c, v| kw(v).and_then(overflow).map(|o| c.c.layout.overflow.y = o).is_some()),+ h("overflow", |c, v| {+ let o: Option<Vec<Overflow>> = v.iter().filter_map(Tok::ident).map(overflow).collect();+ match o.as_deref() {+ Some([a]) => c.c.layout.overflow = taffy::Point { x: *a, y: *a },+ Some([a, b]) => c.c.layout.overflow = taffy::Point { x: *a, y: *b },+ _ => return false,+ }+ true+ }),+ h("overflow-inline", |c, v| delegate(c, "overflow-x", v)),+ h("overflow-block", |c, v| delegate(c, "overflow-y", v)),+ h("scrollbar-width", |c, v| {+ c.c.layout.scrollbar_width = match kw(v) {+ Some("none") => 0.0,+ Some("thin") => 6.0,+ Some("auto") => 8.0,+ _ => return v.first().and_then(length).map(|l| c.c.layout.scrollbar_width = px(c, l)).is_some(),+ };+ true+ }),+ h("text-overflow", |c, v| {+ c.c.ellipsis = kw(v) == Some("ellipsis");+ true+ }),+ // -- background -------------------------------------------------------------------+ h("background-color", |c, v| v.first().and_then(|t| color(t, c.c.color)).map(|col| c.c.background = col).is_some()),+ h("background-image", |c, v| match kw(v) {+ Some("none") => {+ c.c.gradient = None;+ true+ }+ _ => v.first().and_then(|t| gradient(c, t)).map(|g| c.c.gradient = Some(g)).is_some(),+ }),+ h("background", |c, v| {+ let mut ok = false;+ for t in v {+ if let Some(g) = gradient(c, t) {+ c.c.gradient = Some(g);+ ok = true;+ } else if let Some(col) = color(t, c.c.color) {+ c.c.background = col;+ ok = true;+ } else if t.ident() == Some("none") {+ c.c.background = Rgba::TRANSPARENT;+ c.c.gradient = None;+ ok = true;+ }+ }+ ok+ }),+ // -- border -------------------------------------------------------------------------+ h("border", |c, v| border_sides(c, v, &[0, 1, 2, 3])),+ h("border-top", |c, v| border_sides(c, v, &[0])),+ h("border-right", |c, v| border_sides(c, v, &[1])),+ h("border-bottom", |c, v| border_sides(c, v, &[2])),+ h("border-left", |c, v| border_sides(c, v, &[3])),+ h("border-inline", |c, v| border_sides(c, v, &[1, 3])),+ h("border-block", |c, v| border_sides(c, v, &[0, 2])),+ h("border-inline-start", |c, v| border_sides(c, v, &[3])),+ h("border-inline-end", |c, v| border_sides(c, v, &[1])),+ h("border-block-start", |c, v| border_sides(c, v, &[0])),+ h("border-block-end", |c, v| border_sides(c, v, &[2])),+ h("border-width", |c, v| per_side(v, |i, t| border_width_tok(c, t).map(|w| set_border_width(c, i, w)).is_some())),+ h("border-top-width", |c, v| v.first().and_then(|t| border_width_tok(c, t)).map(|w| set_border_width(c, 0, w)).is_some()),+ h("border-right-width", |c, v| v.first().and_then(|t| border_width_tok(c, t)).map(|w| set_border_width(c, 1, w)).is_some()),+ h("border-bottom-width", |c, v| v.first().and_then(|t| border_width_tok(c, t)).map(|w| set_border_width(c, 2, w)).is_some()),+ h("border-left-width", |c, v| v.first().and_then(|t| border_width_tok(c, t)).map(|w| set_border_width(c, 3, w)).is_some()),+ h("border-color", |c, v| per_side(v, |i, t| color(t, c.c.color).map(|col| c.c.border_color[i] = col).is_some())),+ h("border-top-color", |c, v| v.first().and_then(|t| color(t, c.c.color)).map(|col| c.c.border_color[0] = col).is_some()),+ h("border-right-color", |c, v| v.first().and_then(|t| color(t, c.c.color)).map(|col| c.c.border_color[1] = col).is_some()),+ h("border-bottom-color", |c, v| v.first().and_then(|t| color(t, c.c.color)).map(|col| c.c.border_color[2] = col).is_some()),+ h("border-left-color", |c, v| v.first().and_then(|t| color(t, c.c.color)).map(|col| c.c.border_color[3] = col).is_some()),+ h("border-style", |c, v| per_side(v, |i, t| border_style(c, i, t))),+ h("border-top-style", |c, v| v.first().is_some_and(|t| border_style(c, 0, t))),+ h("border-right-style", |c, v| v.first().is_some_and(|t| border_style(c, 1, t))),+ h("border-bottom-style", |c, v| v.first().is_some_and(|t| border_style(c, 2, t))),+ h("border-left-style", |c, v| v.first().is_some_and(|t| border_style(c, 3, t))),+ h("border-radius", |c, v| {+ let first: Vec<Tok> = v.split(|t| matches!(t, Tok::Slash)).next().unwrap_or(&[]).to_vec();+ lengths(&first).and_then(|l| four(&l)).map(|s| c.c.radius = s).is_some()+ }),+ h("border-top-left-radius", |c, v| v.first().and_then(length).map(|l| c.c.radius[0] = l).is_some()),+ h("border-top-right-radius", |c, v| v.first().and_then(length).map(|l| c.c.radius[1] = l).is_some()),+ h("border-bottom-right-radius", |c, v| v.first().and_then(length).map(|l| c.c.radius[2] = l).is_some()),+ h("border-bottom-left-radius", |c, v| v.first().and_then(length).map(|l| c.c.radius[3] = l).is_some()),+ h("border-start-start-radius", |c, v| delegate(c, "border-top-left-radius", v)),+ h("border-start-end-radius", |c, v| delegate(c, "border-top-right-radius", v)),+ h("border-end-start-radius", |c, v| delegate(c, "border-bottom-left-radius", v)),+ h("border-end-end-radius", |c, v| delegate(c, "border-bottom-right-radius", v)),+ h("outline", |c, v| {+ let (mut w, mut col, mut ok) = (c.c.outline.0.max(3.0), c.c.color, true);+ for t in v {+ if t.ident().is_some_and(|s| s == "none") {+ w = 0.0;+ } else if t.ident().is_some_and(|s| BORDER_STYLES.contains(&s) || s == "auto") {+ } else if let Some(cc) = color(t, c.c.color).filter(|_| !matches!(t, Tok::Dim(..))) {+ col = cc;+ } else if let Some(px) = border_width_tok(c, t) {+ w = px;+ } else {+ ok = false;+ }+ }+ c.c.outline.0 = w;+ c.c.outline.1 = col;+ ok+ }),+ h("outline-width", |c, v| v.first().and_then(|t| border_width_tok(c, t)).map(|w| c.c.outline.0 = w).is_some()),+ h("outline-color", |c, v| v.first().and_then(|t| color(t, c.c.color)).map(|col| c.c.outline.1 = col).is_some()),+ h("outline-style", |c, v| {+ if kw(v) == Some("none") {+ c.c.outline.0 = 0.0;+ }+ true+ }),+ h("outline-offset", |c, v| v.first().and_then(length).map(|l| c.c.outline.2 = px(c, l)).is_some()),+ // -- effects ------------------------------------------------------------------------+ h("opacity", |c, v| v.first().and_then(number).map(|n| c.c.opacity = n.clamp(0.0, 1.0)).is_some()),+ h("visibility", |c, v| {+ c.c.visible = match kw(v) {+ Some("visible") => true,+ Some("hidden") | Some("collapse") => false,+ _ => return false,+ };+ true+ }),+ h("box-shadow", |c, v| shadows(c, v).map(|s| c.c.shadows = s).is_some()),+ h("transform", |c, v| {+ let mut ok = true;+ for t in v {+ match t {+ Tok::Func(f, args) => {+ let arg = |i: usize| args.get(i).and_then(|a| a.first()).and_then(length);+ match f.as_str() {+ "translate" => {+ c.c.translate = (arg(0).unwrap_or_default(), arg(1).unwrap_or(Length::Px(0.0)))+ }+ "translatex" => c.c.translate.0 = arg(0).unwrap_or_default(),+ "translatey" => c.c.translate.1 = arg(0).unwrap_or_default(),+ "scale" => {+ c.c.scale = args.first().and_then(|a| a.first()).and_then(number).unwrap_or(1.0)+ }+ _ => ok = false, // rotate/skew/matrix: not drawn+ }+ }+ Tok::Ident(s) if s == "none" => {+ c.c.translate = (Length::Px(0.0), Length::Px(0.0));+ c.c.scale = 1.0;+ }+ _ => ok = false,+ }+ }+ ok+ }),+ h("translate", |c, v| {+ let l = lengths(v).unwrap_or_default();+ c.c.translate = (*l.first().unwrap_or(&Length::Px(0.0)), *l.get(1).unwrap_or(&Length::Px(0.0)));+ !l.is_empty()+ }),+ // -- text ---------------------------------------------------------------------------+ h("color", |c, v| v.first().and_then(|t| color(t, c.parent.color)).map(|col| c.c.color = col).is_some()),+ h("font-size", |c, v| v.first().and_then(|t| font_size(c, t)).map(|s| c.c.font_size = s).is_some()),+ h("font-weight", |c, v| v.first().and_then(|t| font_weight(c, t)).map(|w| c.c.weight = w).is_some()),+ h("font-style", |c, v| {+ c.c.italic = matches!(kw(v), Some("italic") | Some("oblique"));+ true+ }),+ h("font-family", |c, v| {+ c.c.font_family = v.iter().map(tok_text).collect::<Vec<_>>().join(" ");+ true+ }),+ h("font-variant", |c, v| {+ c.c.small_caps = kw(v) == Some("small-caps");+ true+ }),+ h("font-variant-caps", |c, v| delegate(c, "font-variant", v)),+ h("font", |c, v| {+ // [style] [variant] [weight] size[/line-height] family+ let mut i = 0;+ while i < v.len() {+ let t = &v[i];+ if let Some(s) = t.ident() {+ match s {+ "italic" | "oblique" => c.c.italic = true,+ "small-caps" => c.c.small_caps = true,+ "bold" | "bolder" | "lighter" => c.c.weight = font_weight(c, t).unwrap_or(400),+ "normal" => {}+ _ => break,+ }+ } else if let Tok::Num(n) = t {+ c.c.weight = *n as u16;+ } else if let Some(s) = font_size(c, t) {+ c.c.font_size = s;+ if matches!(v.get(i + 1), Some(Tok::Slash)) {+ if let Some(lh) = v.get(i + 2).and_then(|t| line_height(t, c)) {+ c.c.line_height = lh;+ }+ i += 2;+ }+ i += 1;+ c.c.font_family = v[i..].iter().map(tok_text).collect::<Vec<_>>().join(" ");+ return true;+ } else {+ return false;+ }+ i += 1;+ }+ false+ }),+ h("line-height", |c, v| v.first().and_then(|t| line_height(t, c)).map(|l| c.c.line_height = l).is_some()),+ h("text-align", |c, v| {+ c.c.text_align = match kw(v) {+ Some("left") | Some("start") => TextAlign::Left,+ Some("right") | Some("end") => TextAlign::Right,+ Some("center") | Some("-webkit-center") => TextAlign::Center,+ Some("justify") => TextAlign::Justify,+ _ => return false,+ };+ true+ }),+ h("text-decoration", |c, v| {+ let words: Vec<&str> = v.iter().filter_map(Tok::ident).collect();+ c.c.underline = words.contains(&"underline");+ c.c.line_through = words.contains(&"line-through");+ c.c.overline = words.contains(&"overline");+ true+ }),+ h("text-decoration-line", |c, v| delegate(c, "text-decoration", v)),+ h("white-space", |c, v| {+ c.c.white_space = match kw(v) {+ Some("normal") => WhiteSpace::Normal,+ Some("nowrap") => WhiteSpace::NoWrap,+ Some("pre") => WhiteSpace::Pre,+ Some("pre-wrap") | Some("break-spaces") => WhiteSpace::PreWrap,+ Some("pre-line") => WhiteSpace::PreLine,+ _ => return false,+ };+ true+ }),+ h("text-wrap", |c, v| {+ if kw(v) == Some("nowrap") {+ c.c.white_space = WhiteSpace::NoWrap;+ }+ true+ }),+ h("text-transform", |c, v| {+ c.c.text_transform = match kw(v) {+ Some("none") => TextTransform::None,+ Some("uppercase") => TextTransform::Upper,+ Some("lowercase") => TextTransform::Lower,+ Some("capitalize") => TextTransform::Capitalize,+ _ => return false,+ };+ true+ }),+ h("letter-spacing", |c, v| match kw(v) {+ Some("normal") => {+ c.c.letter_spacing = 0.0;+ true+ }+ _ => v.first().and_then(length).map(|l| c.c.letter_spacing = px(c, l)).is_some(),+ }),+ h("word-spacing", |c, v| match kw(v) {+ Some("normal") => {+ c.c.word_spacing = 0.0;+ true+ }+ _ => v.first().and_then(length).map(|l| c.c.word_spacing = px(c, l)).is_some(),+ }),+ h("text-indent", |c, v| v.first().and_then(length).map(|l| c.c.text_indent = l).is_some()),+ h("vertical-align", |c, v| {+ c.c.vertical_align = match kw(v) {+ Some("sub") => VAlign::Sub,+ Some("super") => VAlign::Super,+ _ => VAlign::Baseline,+ };+ true+ }),+ h("list-style-type", |c, v| kw(v).and_then(list_style).map(|l| c.c.list_style = l).is_some()),+ h("list-style-position", |c, v| match kw(v) {+ Some(p @ ("inside" | "outside")) => {+ c.c.marker_inside = p == "inside";+ true+ }+ _ => false,+ }),+ h("quotes", |c, v| {+ let strs: Vec<&str> = v.iter().filter_map(|t| match t {+ Tok::Str(s) => Some(s.as_str()),+ _ => None,+ }).collect();+ match (kw(v), strs.as_slice()) {+ (Some("none"), _) => c.c.quotes = Some((String::new(), String::new())),+ (Some("auto"), _) => c.c.quotes = None,+ (_, [open, close, ..]) => c.c.quotes = Some((open.to_string(), close.to_string())),+ _ => return false,+ }+ true+ }),+ h("text-shadow", |c, v| {+ if kw(v) == Some("none") {+ c.c.text_shadow = None;+ return true;+ }+ let first: Vec<Tok> = v.split(|t| matches!(t, Tok::Comma)).next().unwrap_or(&[]).to_vec();+ let lens: Vec<f32> = first.iter().filter_map(|t| length(t).and_then(|l| l.to_px(&c.u))).collect();+ let col = first.iter()+ .find_map(|t| color(t, c.c.color).filter(|_| !matches!(t, Tok::Dim(..) | Tok::Num(_))))+ .unwrap_or(c.c.color);+ match lens.as_slice() {+ [x, y, rest @ ..] => {+ c.c.text_shadow = Some(Shadow { x: *x, y: *y, blur: rest.first().copied().unwrap_or(0.0),+ spread: 0.0, color: col, inset: false });+ true+ }+ _ => false,+ }+ }),+ h("text-decoration-color", |c, v| v.first().and_then(|t| color(t, c.c.color))+ .map(|col| c.c.decoration_color = Some(col)).is_some()),+ // -- tables ----------------------------------------------------------------------------+ h("border-spacing", |c, v| {+ let l: Option<Vec<f32>> = v.iter().map(|t| length(t).and_then(|l| l.to_px(&c.u))).collect();+ match l.as_deref() {+ Some([a]) => c.c.border_spacing = (*a, *a),+ Some([a, b]) => c.c.border_spacing = (*a, *b),+ _ => return false,+ }+ true+ }),+ h("border-collapse", |c, v| match kw(v) {+ Some(k @ ("collapse" | "separate")) => {+ c.c.border_collapse = k == "collapse";+ true+ }+ _ => false,+ }),+ h("caption-side", |c, v| match kw(v) {+ Some(k @ ("top" | "bottom" | "block-start" | "block-end")) => {+ c.c.caption_bottom = matches!(k, "bottom" | "block-end");+ true+ }+ _ => false,+ }),+ h("list-style", |c, v| v.iter().filter_map(Tok::ident).find_map(list_style)+ .map(|l| c.c.list_style = l).is_some()),+ // -- interaction --------------------------------------------------------------------+ h("cursor", |c, v| {+ let name = v.iter().filter_map(Tok::ident).next_back();+ match name.and_then(|n| CURSORS.iter().find(|(k, _)| *k == n)) {+ Some((_, -1)) => c.c.cursor = None,+ Some((_, id)) => c.c.cursor = Some(*id),+ None => return false,+ }+ true+ }),+ h("pointer-events", |c, v| {+ c.c.pointer_events = kw(v) != Some("none");+ true+ }),+ h("accent-color", |c, v| match kw(v) {+ Some("auto") => {+ c.c.accent = None;+ true+ }+ _ => v.first().and_then(|t| color(t, c.c.color)).map(|col| c.c.accent = Some(col)).is_some(),+ }),+ ]+};++fn pair(c: &mut Ctx, v: &[Tok], a: &str, b: &str) -> bool {+ let (x, y) = match v {+ [one] => (one.clone(), one.clone()),+ [x, y] => (x.clone(), y.clone()),+ _ => return false,+ };+ delegate(c, a, &[x]) && delegate(c, b, &[y])+}++fn two_kw(c: &mut Ctx, v: &[Tok], a: &str, b: &str) -> bool {+ let (x, y) = match v {+ [one] => (one.clone(), one.clone()),+ [x, y] => (x.clone(), y.clone()),+ _ => return false,+ };+ delegate(c, a, &[x]) && delegate(c, b, &[y])+}++fn border_style(c: &mut Ctx, side: usize, t: &Tok) -> bool {+ match t.ident() {+ Some(s) if BORDER_STYLES.contains(&s) => {+ let none = s == "none" || s == "hidden";+ c.c.border_drawn[side] = !none;+ if none {+ set_border_width(c, side, 0.0);+ }+ true+ }+ _ => false,+ }+}++#[cfg(test)]+mod tests {+ use super::*;+ use crate::css::parse_declarations;++ fn computed(css: &str) -> Computed {+ let parent = Computed::default();+ let mut c = Computed::inherit(&parent);+ let u = Units { font_size: 13.0, viewport: (800.0, 600.0) };+ for d in parse_declarations(css) {+ assert!(apply(&mut c, &parent, u, &d), "not applied: {}", d.prop);+ }+ c+ }++ #[test]+ fn box_model_and_flex() {+ let c = computed("display: flex; padding: 4px 8px; margin: 0 auto; flex: 1; gap: 2px 6px;+ width: 50%; border: 2px solid #f00; border-radius: 4px");+ assert_eq!(c.display, DisplayKind::Flex);+ assert_eq!(c.layout.padding.left, LengthPercentage::Length(8.0));+ assert_eq!(c.layout.margin.left, LengthPercentageAuto::Auto);+ assert_eq!(c.layout.flex_grow, 1.0);+ assert_eq!(c.layout.size.width, Dimension::Percent(0.5));+ assert_eq!(c.layout.border.top, LengthPercentage::Length(2.0));+ assert_eq!(c.border_color[0], crate::color::rgb(0xff0000));+ }++ #[test]+ fn grid_and_text() {+ let c = computed("grid-template-columns: repeat(3, 1fr) 100px; grid-column: 1 / span 2;+ font: italic bold 20px/1.5 serif; text-decoration: underline;+ background: linear-gradient(to right, red, blue); box-shadow: 0 2px 4px #000");+ assert_eq!(c.layout.grid_template_columns.len(), 2);+ assert!(c.italic && c.bold() && c.underline && c.font_size == 20.0);+ assert_eq!(c.gradient.as_ref().unwrap().stops.len(), 2);+ assert_eq!(c.shadows.len(), 1);+ }+}diff --git a/bindings/rust/blenderui/src/styled.rs b/bindings/rust/blenderui/src/styled.rsnew file mode 100644index 0000000..670ff31--- /dev/null+++ b/bindings/rust/blenderui/src/styled.rs@@ -0,0 +1,418 @@+//! gpui's `Styled` methods (tailwind names). Each method is CSS sugar: it+//! pushes a declaration that the one CSS property table applies.++use crate::color::Rgba;+use std::cell::RefCell;+use std::sync::Arc;++use crate::css::{parse_declarations, tokenize, Decl, Tok};+use crate::geometry::Length;++pub(crate) fn css_len(l: Length) -> String {+ match l {+ Length::Px(v) => format!("{v}px"),+ Length::Rem(v) => format!("{v}rem"),+ Length::Em(v) => format!("{v}em"),+ Length::Percent(v) => format!("{v}%"),+ Length::Vw(v) => format!("{v}vw"),+ Length::Vh(v) => format!("{v}vh"),+ Length::Auto => "auto".into(),+ }+}++/// Tokens for a typed value, cached by its bits (no string formatting or+/// parsing on the hot path). A miss tokenizes the same CSS text the string+/// path would, so handlers see identical tokens.+fn cached_tokens(key: (u8, [u32; 4]), css: impl FnOnce() -> String) -> Arc<[Tok]> {+ thread_local! {+ static CACHE: RefCell<crate::style::FnvMap<(u8, [u32; 4]), Arc<[Tok]>>> = RefCell::new(Default::default());+ }+ CACHE.with(|c| {+ if let Some(t) = c.borrow().get(&key) {+ return t.clone();+ }+ let t: Arc<[Tok]> = tokenize(&css()).into();+ let mut c = c.borrow_mut();+ if c.len() > 50_000 {+ c.clear();+ }+ c.insert(key, t.clone());+ t+ })+}++pub(crate) fn len_tokens(l: Length) -> Arc<[Tok]> {+ let (tag, v) = match l {+ Length::Px(v) => (0, v),+ Length::Rem(v) => (1, v),+ Length::Em(v) => (2, v),+ Length::Percent(v) => (3, v),+ Length::Vw(v) => (4, v),+ Length::Vh(v) => (5, v),+ Length::Auto => (6, 0.0),+ };+ cached_tokens((tag, [v.to_bits(), 0, 0, 0]), || css_len(l))+}++pub(crate) fn color_tokens(c: Rgba) -> Arc<[Tok]> {+ cached_tokens((7, [c.r.to_bits(), c.g.to_bits(), c.b.to_bits(), c.a.to_bits()]), || c.to_css())+}++impl Rgba {+ /// CSS text: `rgba(r, g, b, a)`.+ pub fn to_css(self) -> String {+ format!("rgba({},{},{},{})", (self.r * 255.0).round(), (self.g * 255.0).round(),+ (self.b * 255.0).round(), self.a)+ }+}++/// Font weights (gpui's `FontWeight`).+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub struct FontWeight(pub u16);++impl FontWeight {+ pub const THIN: FontWeight = FontWeight(100);+ pub const EXTRA_LIGHT: FontWeight = FontWeight(200);+ pub const LIGHT: FontWeight = FontWeight(300);+ pub const NORMAL: FontWeight = FontWeight(400);+ pub const MEDIUM: FontWeight = FontWeight(500);+ pub const SEMIBOLD: FontWeight = FontWeight(600);+ pub const BOLD: FontWeight = FontWeight(700);+ pub const EXTRA_BOLD: FontWeight = FontWeight(800);+ pub const BLACK: FontWeight = FontWeight(900);+}++/// A spacing/sizing method with the whole tailwind scale:+/// `p(l)`, `p_0`, `p_0p5`, `p_1` ... `p_96`, `p_px`.+macro_rules! scale {+ ($name:ident: $($prop:literal),+) => {+ paste::paste! {+ fn $name(self, length: impl Into<Length>) -> Self {+ let v = len_tokens(length.into());+ self$(.css_tokens($prop, v.clone()))++ }+ fn [<$name _0>](self) -> Self { self.$name(Length::Px(0.0)) }+ fn [<$name _0p5>](self) -> Self { self.$name(Length::Rem(0.125)) }+ fn [<$name _1>](self) -> Self { self.$name(Length::Rem(0.25)) }+ fn [<$name _1p5>](self) -> Self { self.$name(Length::Rem(0.375)) }+ fn [<$name _2>](self) -> Self { self.$name(Length::Rem(0.5)) }+ fn [<$name _2p5>](self) -> Self { self.$name(Length::Rem(0.625)) }+ fn [<$name _3>](self) -> Self { self.$name(Length::Rem(0.75)) }+ fn [<$name _3p5>](self) -> Self { self.$name(Length::Rem(0.875)) }+ fn [<$name _4>](self) -> Self { self.$name(Length::Rem(1.0)) }+ fn [<$name _5>](self) -> Self { self.$name(Length::Rem(1.25)) }+ fn [<$name _6>](self) -> Self { self.$name(Length::Rem(1.5)) }+ fn [<$name _7>](self) -> Self { self.$name(Length::Rem(1.75)) }+ fn [<$name _8>](self) -> Self { self.$name(Length::Rem(2.0)) }+ fn [<$name _9>](self) -> Self { self.$name(Length::Rem(2.25)) }+ fn [<$name _10>](self) -> Self { self.$name(Length::Rem(2.5)) }+ fn [<$name _11>](self) -> Self { self.$name(Length::Rem(2.75)) }+ fn [<$name _12>](self) -> Self { self.$name(Length::Rem(3.0)) }+ fn [<$name _16>](self) -> Self { self.$name(Length::Rem(4.0)) }+ fn [<$name _20>](self) -> Self { self.$name(Length::Rem(5.0)) }+ fn [<$name _24>](self) -> Self { self.$name(Length::Rem(6.0)) }+ fn [<$name _32>](self) -> Self { self.$name(Length::Rem(8.0)) }+ fn [<$name _40>](self) -> Self { self.$name(Length::Rem(10.0)) }+ fn [<$name _48>](self) -> Self { self.$name(Length::Rem(12.0)) }+ fn [<$name _56>](self) -> Self { self.$name(Length::Rem(14.0)) }+ fn [<$name _64>](self) -> Self { self.$name(Length::Rem(16.0)) }+ fn [<$name _72>](self) -> Self { self.$name(Length::Rem(18.0)) }+ fn [<$name _80>](self) -> Self { self.$name(Length::Rem(20.0)) }+ fn [<$name _96>](self) -> Self { self.$name(Length::Rem(24.0)) }+ fn [<$name _px>](self) -> Self { self.$name(Length::Px(1.0)) }+ fn [<$name _auto>](self) -> Self { self.$name(Length::Auto) }+ }+ };+}++/// Fractions for sizes: `w_full`, `w_1_2`, `w_2_3` ...+macro_rules! fractions {+ ($name:ident) => {+ paste::paste! {+ fn [<$name _full>](self) -> Self { self.$name(Length::Percent(100.0)) }+ fn [<$name _1_2>](self) -> Self { self.$name(Length::Percent(50.0)) }+ fn [<$name _1_3>](self) -> Self { self.$name(Length::Percent(100.0 / 3.0)) }+ fn [<$name _2_3>](self) -> Self { self.$name(Length::Percent(200.0 / 3.0)) }+ fn [<$name _1_4>](self) -> Self { self.$name(Length::Percent(25.0)) }+ fn [<$name _3_4>](self) -> Self { self.$name(Length::Percent(75.0)) }+ fn [<$name _1_5>](self) -> Self { self.$name(Length::Percent(20.0)) }+ fn [<$name _2_5>](self) -> Self { self.$name(Length::Percent(40.0)) }+ fn [<$name _3_5>](self) -> Self { self.$name(Length::Percent(60.0)) }+ fn [<$name _4_5>](self) -> Self { self.$name(Length::Percent(80.0)) }+ fn [<$name _1_6>](self) -> Self { self.$name(Length::Percent(100.0 / 6.0)) }+ fn [<$name _5_6>](self) -> Self { self.$name(Length::Percent(500.0 / 6.0)) }+ }+ };+}++/// Methods that set one fixed declaration: `flex() => display: flex`.+macro_rules! fixed {+ ($($name:ident => $prop:literal : $value:literal),* $(,)?) => {+ $(fn $name(self) -> Self { self.css($prop, $value) })*+ };+}++/// Style methods shared by elements and `.hover(|s| ...)` refinements.+pub trait Styled: Sized {+ fn decls_mut(&mut self) -> &mut Vec<Decl>;++ /// One CSS declaration: `.css("grid-template-columns", "1fr 2fr")`.+ fn css(mut self, property: &'static str, value: impl AsRef<str>) -> Self {+ self.decls_mut().push(Decl::new(property, value.as_ref()));+ self+ }++ /// A declaration with already-tokenized value (the typed methods' fast path).+ #[doc(hidden)]+ fn css_tokens(mut self, property: &'static str, value: Arc<[Tok]>) -> Self {+ self.decls_mut().push(Decl { prop: property.into(), value, important: false });+ self+ }++ /// A CSS declaration block: `.style("display: flex; gap: 4px")`.+ fn style(mut self, block: impl AsRef<str>) -> Self {+ self.decls_mut().extend(parse_declarations(block.as_ref()));+ self+ }++ // -- spacing and sizing --------------------------------------------------------------+ scale!(p: "padding");+ scale!(px: "padding-left", "padding-right");+ scale!(py: "padding-top", "padding-bottom");+ scale!(pt: "padding-top");+ scale!(pr: "padding-right");+ scale!(pb: "padding-bottom");+ scale!(pl: "padding-left");+ scale!(m: "margin");+ scale!(mx: "margin-left", "margin-right");+ scale!(my: "margin-top", "margin-bottom");+ scale!(mt: "margin-top");+ scale!(mr: "margin-right");+ scale!(mb: "margin-bottom");+ scale!(ml: "margin-left");+ scale!(gap: "gap");+ scale!(gap_x: "column-gap");+ scale!(gap_y: "row-gap");+ scale!(w: "width");+ scale!(h: "height");+ scale!(size: "width", "height");+ scale!(min_w: "min-width");+ scale!(min_h: "min-height");+ scale!(max_w: "max-width");+ scale!(max_h: "max-height");+ scale!(top: "top");+ scale!(right: "right");+ scale!(bottom: "bottom");+ scale!(left: "left");+ scale!(inset: "inset");+ scale!(flex_basis: "flex-basis");+ scale!(rounded: "border-radius");+ fractions!(w);+ fractions!(h);+ fractions!(size);+ fractions!(min_w);+ fractions!(min_h);+ fractions!(max_w);+ fractions!(max_h);+ fractions!(top);+ fractions!(right);+ fractions!(bottom);+ fractions!(left);+ fractions!(inset);+ fractions!(flex_basis);++ // -- display, position, overflow ----------------------------------------------------------+ fixed! {+ block => "display": "block", flex => "display": "flex", grid => "display": "grid",+ inline => "display": "inline", inline_block => "display": "inline-block",+ inline_flex => "display": "inline-flex", contents => "display": "contents",+ hidden => "display": "none",+ visible => "visibility": "visible", invisible => "visibility": "hidden",+ relative => "position": "relative", absolute => "position": "absolute",+ fixed_position => "position": "fixed",+ overflow_hidden => "overflow": "hidden", overflow_visible => "overflow": "visible",+ overflow_scroll => "overflow": "scroll", overflow_x_hidden => "overflow-x": "hidden",+ overflow_y_hidden => "overflow-y": "hidden", overflow_x_scroll => "overflow-x": "scroll",+ overflow_y_scroll => "overflow-y": "scroll", overflow_clip => "overflow": "clip",+ box_border => "box-sizing": "border-box", box_content => "box-sizing": "content-box",+ }++ // -- flexbox ----------------------------------------------------------------------------+ fixed! {+ flex_row => "flex-direction": "row", flex_col => "flex-direction": "column",+ flex_row_reverse => "flex-direction": "row-reverse",+ flex_col_reverse => "flex-direction": "column-reverse",+ flex_wrap => "flex-wrap": "wrap", flex_wrap_reverse => "flex-wrap": "wrap-reverse",+ flex_nowrap => "flex-wrap": "nowrap",+ flex_1 => "flex": "1 1 0%", flex_auto => "flex": "auto", flex_initial => "flex": "initial",+ flex_none => "flex": "none", flex_grow => "flex-grow": "1", flex_grow_0 => "flex-grow": "0",+ flex_shrink => "flex-shrink": "1", flex_shrink_0 => "flex-shrink": "0",+ items_start => "align-items": "flex-start", items_end => "align-items": "flex-end",+ items_center => "align-items": "center", items_baseline => "align-items": "baseline",+ items_stretch => "align-items": "stretch",+ self_start => "align-self": "flex-start", self_end => "align-self": "flex-end",+ self_center => "align-self": "center", self_flex_start => "align-self": "flex-start",+ self_flex_end => "align-self": "flex-end", self_baseline => "align-self": "baseline",+ self_stretch => "align-self": "stretch",+ justify_start => "justify-content": "flex-start", justify_end => "justify-content": "flex-end",+ justify_center => "justify-content": "center",+ justify_between => "justify-content": "space-between",+ justify_around => "justify-content": "space-around",+ justify_evenly => "justify-content": "space-evenly",+ justify_stretch => "justify-content": "stretch",+ content_normal => "align-content": "normal", content_center => "align-content": "center",+ content_start => "align-content": "flex-start", content_end => "align-content": "flex-end",+ content_between => "align-content": "space-between",+ content_around => "align-content": "space-around",+ content_evenly => "align-content": "space-evenly", content_stretch => "align-content": "stretch",+ }++ fn order(self, n: i32) -> Self {+ self.css("order", n.to_string())+ }++ // -- grid -------------------------------------------------------------------------------+ fn grid_cols(self, n: u16) -> Self {+ self.css("grid-template-columns", format!("repeat({n}, minmax(0, 1fr))"))+ }+ fn grid_rows(self, n: u16) -> Self {+ self.css("grid-template-rows", format!("repeat({n}, minmax(0, 1fr))"))+ }+ fn col_span(self, n: u16) -> Self {+ self.css("grid-column", format!("span {n}"))+ }+ fn col_span_full(self) -> Self {+ self.css("grid-column", "1 / -1")+ }+ fn col_start(self, n: i16) -> Self {+ self.css("grid-column-start", n.to_string())+ }+ fn col_end(self, n: i16) -> Self {+ self.css("grid-column-end", n.to_string())+ }+ fn row_span(self, n: u16) -> Self {+ self.css("grid-row", format!("span {n}"))+ }+ fn row_span_full(self) -> Self {+ self.css("grid-row", "1 / -1")+ }+ fn row_start(self, n: i16) -> Self {+ self.css("grid-row-start", n.to_string())+ }+ fn row_end(self, n: i16) -> Self {+ self.css("grid-row-end", n.to_string())+ }++ // -- colors -------------------------------------------------------------------------------+ fn bg(self, color: impl Into<Rgba>) -> Self {+ self.css_tokens("background-color", color_tokens(color.into()))+ }+ fn text_color(self, color: impl Into<Rgba>) -> Self {+ self.css_tokens("color", color_tokens(color.into()))+ }+ fn border_color(self, color: impl Into<Rgba>) -> Self {+ self.css_tokens("border-color", color_tokens(color.into()))+ }+ fn outline_color(self, color: impl Into<Rgba>) -> Self {+ self.css_tokens("outline-color", color_tokens(color.into()))+ }+ fn accent_color(self, color: impl Into<Rgba>) -> Self {+ self.css_tokens("accent-color", color_tokens(color.into()))+ }+ fn opacity(self, value: f32) -> Self {+ self.css("opacity", value.to_string())+ }++ // -- borders ----------------------------------------------------------------------------+ fixed! {+ border_0 => "border-width": "0", border_1 => "border-width": "1px",+ border_2 => "border-width": "2px", border_4 => "border-width": "4px",+ border_8 => "border-width": "8px",+ border_t_1 => "border-top-width": "1px", border_r_1 => "border-right-width": "1px",+ border_b_1 => "border-bottom-width": "1px", border_l_1 => "border-left-width": "1px",+ border_t_2 => "border-top-width": "2px", border_r_2 => "border-right-width": "2px",+ border_b_2 => "border-bottom-width": "2px", border_l_2 => "border-left-width": "2px",+ border_x_1 => "border-inline": "1px solid", border_y_1 => "border-block": "1px solid",+ border_solid => "border-style": "solid", border_dashed => "border-style": "dashed",+ border_dotted => "border-style": "dotted", border_none => "border-style": "none",+ rounded_none => "border-radius": "0", rounded_xs => "border-radius": "0.125rem",+ rounded_sm => "border-radius": "0.25rem", rounded_md => "border-radius": "0.375rem",+ rounded_lg => "border-radius": "0.5rem", rounded_xl => "border-radius": "0.75rem",+ rounded_2xl => "border-radius": "1rem", rounded_3xl => "border-radius": "1.5rem",+ rounded_full => "border-radius": "9999px",+ rounded_t_md => "border-top-left-radius": "0.375rem",+ rounded_b_md => "border-bottom-left-radius": "0.375rem",+ }++ // -- shadows ------------------------------------------------------------------------------+ fixed! {+ shadow_none => "box-shadow": "none",+ shadow_2xs => "box-shadow": "0 1px rgba(0,0,0,0.05)",+ shadow_xs => "box-shadow": "0 1px 2px rgba(0,0,0,0.05)",+ shadow_sm => "box-shadow": "0 1px 3px rgba(0,0,0,0.1)",+ shadow_md => "box-shadow": "0 4px 6px -1px rgba(0,0,0,0.1)",+ shadow_lg => "box-shadow": "0 10px 15px -3px rgba(0,0,0,0.1)",+ shadow_xl => "box-shadow": "0 20px 25px -5px rgba(0,0,0,0.1)",+ shadow_2xl => "box-shadow": "0 25px 50px -12px rgba(0,0,0,0.25)",+ }++ // -- text ---------------------------------------------------------------------------------+ fixed! {+ text_xs => "font-size": "0.75rem", text_sm => "font-size": "0.875rem",+ text_base => "font-size": "1rem", text_lg => "font-size": "1.125rem",+ text_xl => "font-size": "1.25rem", text_2xl => "font-size": "1.5rem",+ text_3xl => "font-size": "1.875rem", text_4xl => "font-size": "2.25rem",+ text_5xl => "font-size": "3rem", text_6xl => "font-size": "3.75rem",+ font_thin => "font-weight": "100", font_light => "font-weight": "300",+ font_normal => "font-weight": "400", font_medium => "font-weight": "500",+ font_semibold => "font-weight": "600", font_bold => "font-weight": "700",+ font_extrabold => "font-weight": "800", font_black => "font-weight": "900",+ italic => "font-style": "italic", not_italic => "font-style": "normal",+ underline => "text-decoration": "underline", line_through => "text-decoration": "line-through",+ overline => "text-decoration": "overline", no_underline => "text-decoration": "none",+ text_left => "text-align": "left", text_center => "text-align": "center",+ text_right => "text-align": "right", text_justify => "text-align": "justify",+ uppercase => "text-transform": "uppercase", lowercase => "text-transform": "lowercase",+ capitalize => "text-transform": "capitalize", normal_case => "text-transform": "none",+ whitespace_normal => "white-space": "normal", whitespace_nowrap => "white-space": "nowrap",+ whitespace_pre => "white-space": "pre", whitespace_pre_wrap => "white-space": "pre-wrap",+ whitespace_pre_line => "white-space": "pre-line",+ text_ellipsis => "text-overflow": "ellipsis",+ leading_none => "line-height": "1", leading_tight => "line-height": "1.25",+ leading_snug => "line-height": "1.375", leading_normal => "line-height": "1.5",+ leading_relaxed => "line-height": "1.625", leading_loose => "line-height": "2",+ }++ /// Single line, clipped with an ellipsis.+ fn truncate(self) -> Self {+ self.css("overflow", "hidden").css("white-space", "nowrap").css("text-overflow", "ellipsis")+ }+ fn text_size(self, size: impl Into<Length>) -> Self {+ self.css_tokens("font-size", len_tokens(size.into()))+ }+ fn line_height(self, h: impl Into<Length>) -> Self {+ self.css_tokens("line-height", len_tokens(h.into()))+ }+ fn font_weight(self, w: FontWeight) -> Self {+ self.css("font-weight", w.0.to_string())+ }+ fn font_family(self, family: impl AsRef<str>) -> Self {+ self.css("font-family", family)+ }++ // -- interaction ----------------------------------------------------------------------------+ fixed! {+ cursor_default => "cursor": "default", cursor_pointer => "cursor": "pointer",+ cursor_text => "cursor": "text", cursor_move => "cursor": "move",+ cursor_not_allowed => "cursor": "not-allowed", cursor_context_menu => "cursor": "context-menu",+ cursor_crosshair => "cursor": "crosshair", cursor_grab => "cursor": "grab",+ cursor_grabbing => "cursor": "grabbing", cursor_ew_resize => "cursor": "ew-resize",+ cursor_ns_resize => "cursor": "ns-resize", cursor_col_resize => "cursor": "col-resize",+ cursor_row_resize => "cursor": "row-resize", cursor_none => "cursor": "none",+ pointer_events_none => "pointer-events": "none",+ }++ fn z_index(self, z: i32) -> Self {+ self.css("z-index", z.to_string())+ }+}diff --git a/bindings/rust/blenderui/src/text.rs b/bindings/rust/blenderui/src/text.rsnew file mode 100644index 0000000..704c6b3--- /dev/null+++ b/bindings/rust/blenderui/src/text.rs@@ -0,0 +1,85 @@+//! Text measuring and wrapping with the kit's font engine (the same one that+//! draws, so layout and paint agree).++use std::cell::RefCell;+use std::collections::HashMap;++use crate::style::Computed;+use blenderui_sys as sys;++/// Font flags for a style (bold / italic; decorations are painted as lines).+pub(crate) fn flags(c: &Computed) -> i32 {+ (if c.bold() { sys::BUI_FONT_BOLD } else { 0 }) | (if c.italic { sys::BUI_FONT_ITALIC } else { 0 })+}++type Widths = crate::style::FnvMap<Box<str>, f32>;++thread_local! {+ /// (size bits, flags) -> text -> width; looked up by `&str`, no allocation.+ static CACHE: RefCell<HashMap<(u32, i32), Widths>> = RefCell::new(HashMap::new());+}++/// Advance width of `s` at `size` px.+pub(crate) fn width(s: &str, size: f32, flags: i32) -> f32 {+ if s.is_empty() {+ return 0.0;+ }+ let font = (size.to_bits(), flags);+ if let Some(w) = CACHE.with(|c| c.borrow().get(&font).and_then(|m| m.get(s)).copied()) {+ return w;+ }+ let mut w = 0.0f32;+ // SAFETY: pointers are valid for the call; "" selects the UI font.+ let ok = unsafe {+ sys::BUI_text_measure(c"".as_ptr(), flags, size, s.as_ptr().cast(), s.len() as i32, &mut w)+ };+ if ok == 0 {+ w = s.chars().count() as f32 * size * 0.55; // no native text engine+ }+ CACHE.with(|c| {+ let mut c = c.borrow_mut();+ let m = c.entry(font).or_default();+ if m.len() > 20_000 {+ m.clear();+ }+ m.insert(s.into(), w);+ });+ w+}++/// Greedy word wrap of `s` into lines no wider than `max` (explicit newlines kept).+pub(crate) fn wrap(s: &str, size: f32, flags: i32, max: f32) -> Vec<String> {+ let mut out = Vec::new();+ for para in s.split('\n') {+ let mut line = String::new();+ for word in para.split(' ').filter(|w| !w.is_empty()) {+ let candidate = if line.is_empty() { word.to_owned() } else { format!("{line} {word}") };+ if !line.is_empty() && width(&candidate, size, flags) > max {+ out.push(std::mem::replace(&mut line, word.to_owned()));+ } else {+ line = candidate;+ }+ }+ out.push(line);+ }+ out+}++/// `s` cut to fit `max` with a trailing ellipsis (`text-overflow: ellipsis`).+pub(crate) fn ellipsize(s: &str, size: f32, flags: i32, max: f32) -> String {+ if width(s, size, flags) <= max {+ return s.to_owned();+ }+ let chars: Vec<char> = s.chars().collect();+ let (mut lo, mut hi) = (0, chars.len());+ while lo < hi {+ let mid = (lo + hi).div_ceil(2);+ let t: String = chars[..mid].iter().collect::<String>() + "\u{2026}";+ if width(&t, size, flags) <= max {+ lo = mid;+ } else {+ hi = mid - 1;+ }+ }+ chars[..lo].iter().collect::<String>() + "\u{2026}"+}diff --git a/bindings/rust/blenderui/src/widgets.rs b/bindings/rust/blenderui/src/widgets.rsnew file mode 100644index 0000000..a387d18--- /dev/null+++ b/bindings/rust/blenderui/src/widgets.rs@@ -0,0 +1,426 @@+//! Form controls are Blender's own widgets: each `<button>`, `<input>`,+//! `<select>`, `<textarea>`, `<progress>` and `<meter>` is a kit node,+//! reconciled by key across renders and placed where layout put it.++use std::collections::HashMap;+use std::ffi::{CStr, CString};++use crate::color::{parse_color, Rgba};+use crate::element::{AnyElement, Div};+use crate::events::ChangeEvent;+use crate::geometry::Bounds;+use crate::layout::UiState;+use blenderui_sys as sys;++#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub(crate) enum WKind {+ Button,+ Text { mask: bool },+ Number,+ Slider,+ Checkbox,+ Radio,+ Color,+ Select,+ TextArea,+ Progress,+}++impl WKind {+ fn class(self) -> &'static CStr {+ match self {+ WKind::Button => c"button",+ WKind::Text { .. } => c"text",+ WKind::Number => c"number",+ WKind::Slider => c"slider",+ WKind::Checkbox => c"checkbox",+ WKind::Radio => c"radio",+ WKind::Color => c"swatch",+ WKind::Select => c"dropdown",+ WKind::TextArea => c"textarea",+ WKind::Progress => c"progress",+ }+ }++ /// Default size in logical pixels when the kit's natural size is smaller.+ fn min_size(self) -> (f32, f32) {+ match self {+ WKind::Text { .. } | WKind::Number | WKind::Slider => (150.0, 20.0),+ WKind::Select => (120.0, 20.0),+ WKind::TextArea => (240.0, 64.0),+ WKind::Progress => (160.0, 20.0),+ WKind::Color => (40.0, 20.0),+ WKind::Checkbox | WKind::Radio => (20.0, 20.0),+ WKind::Button => (20.0, 20.0),+ }+ }+}++/// What a form element asks for (compared with the last render to sync).+#[derive(Clone, Debug, PartialEq)]+pub(crate) struct WidgetSpec {+ pub kind: WKind,+ pub label: String,+ pub text: Option<String>,+ pub value: Option<f64>,+ pub min: f64,+ pub max: f64,+ pub step: f64,+ pub items: Vec<String>,+ pub color: Option<Rgba>,+ pub placeholder: String,+ pub disabled: bool,+ pub name: Option<String>,+}++fn text_of(children: &[AnyElement]) -> Option<String> {+ let mut s = String::new();+ for c in children {+ match c {+ AnyElement::Text(t) => s.push_str(t),+ AnyElement::Element(d) if matches!(d.tag, "span" | "b" | "i" | "em" | "strong") => {+ s.push_str(&text_of(&d.children)?)+ }+ AnyElement::Element(_) => return None,+ }+ }+ Some(s.split_whitespace().collect::<Vec<_>>().join(" "))+}++impl WidgetSpec {+ fn new(kind: WKind, d: &Div) -> WidgetSpec {+ let num = |k: &str| d.get_attr(k).and_then(|v| v.trim().parse::<f64>().ok());+ WidgetSpec {+ kind,+ label: String::new(),+ text: None,+ value: None,+ min: num("min").unwrap_or(f64::NEG_INFINITY),+ max: num("max").unwrap_or(f64::INFINITY),+ step: num("step").unwrap_or(1.0),+ items: Vec::new(),+ color: None,+ placeholder: d.get_attr("placeholder").unwrap_or("").to_owned(),+ disabled: d.get_attr("disabled").is_some(),+ name: d.get_attr("name").map(str::to_owned),+ }+ }++ /// The widget for a form element, or None to lay it out as a box+ /// (a `<button>` holding elements, `<option>` outside a select ...).+ pub(crate) fn from_element(d: &Div, key: &str, state: &UiState) -> Option<WidgetSpec> {+ let num = |k: &str| d.get_attr(k).and_then(|v| v.trim().parse::<f64>().ok());+ let checked = || {+ state.checked.get(key).copied().unwrap_or(d.get_attr("checked").is_some())+ };+ let mut s;+ match d.tag {+ "button" => {+ s = WidgetSpec::new(WKind::Button, d);+ s.label = text_of(&d.children)?;+ }+ "input" => {+ let ty = d.get_attr("type").unwrap_or("text").to_ascii_lowercase();+ let value = d.get_attr("value").map(str::to_owned);+ match ty.as_str() {+ "button" | "submit" | "reset" => {+ s = WidgetSpec::new(WKind::Button, d);+ s.label = value.unwrap_or_else(|| match ty.as_str() {+ "submit" => "Submit".into(),+ "reset" => "Reset".into(),+ _ => String::new(),+ });+ }+ "file" => {+ s = WidgetSpec::new(WKind::Button, d);+ s.label = "Browse\u{2026}".into();+ }+ "checkbox" => {+ s = WidgetSpec::new(WKind::Checkbox, d);+ s.value = Some(checked() as i32 as f64);+ }+ "radio" => {+ s = WidgetSpec::new(WKind::Radio, d);+ s.value = Some(checked() as i32 as f64);+ }+ "number" => {+ s = WidgetSpec::new(WKind::Number, d);+ s.value = num("value");+ }+ "range" => {+ s = WidgetSpec::new(WKind::Slider, d);+ if s.min.is_infinite() {+ s.min = 0.0;+ }+ if s.max.is_infinite() {+ s.max = 100.0;+ }+ s.value = Some(num("value").unwrap_or((s.min + s.max) / 2.0));+ }+ "color" => {+ s = WidgetSpec::new(WKind::Color, d);+ s.color = Some(value.as_deref().and_then(parse_color)+ .unwrap_or(crate::color::black()));+ }+ "image" | "hidden" => return None,+ _ => {+ // text, password, email, url, search, tel, date, time ...+ s = WidgetSpec::new(WKind::Text { mask: ty == "password" }, d);+ s.text = value;+ }+ }+ }+ "select" => {+ s = WidgetSpec::new(WKind::Select, d);+ let mut selected = None;+ let want = d.get_attr("value");+ fn options<'a>(c: &'a [AnyElement], out: &mut Vec<&'a Div>) {+ for e in c {+ if let AnyElement::Element(d) = e {+ match d.tag {+ "option" => out.push(d),+ "optgroup" => options(&d.children, out),+ _ => {}+ }+ }+ }+ }+ let mut opts = Vec::new();+ options(&d.children, &mut opts);+ for (k, o) in opts.iter().enumerate() {+ let label = text_of(&o.children).unwrap_or_default();+ let value = o.get_attr("value").map(str::to_owned).unwrap_or_else(|| label.clone());+ if o.get_attr("selected").is_some() || want == Some(value.as_str()) {+ selected = Some(k);+ }+ s.items.push(label);+ }+ s.value = Some(selected.unwrap_or(0) as f64);+ }+ "textarea" => {+ s = WidgetSpec::new(WKind::TextArea, d);+ s.text = Some(d.get_attr("value").map(str::to_owned)+ .unwrap_or_else(|| d.children.iter().filter_map(|c| match c {+ AnyElement::Text(t) => Some(t.as_ref()),+ _ => None,+ }).collect()));+ }+ "progress" | "meter" => {+ s = WidgetSpec::new(WKind::Progress, d);+ let min = if d.tag == "meter" { num("min").unwrap_or(0.0) } else { 0.0 };+ let max = num("max").unwrap_or(1.0);+ let v = num("value").unwrap_or(0.0);+ s.value = Some(((v - min) / (max - min).max(1e-9)).clamp(0.0, 1.0));+ s.label = text_of(&d.children).unwrap_or_default();+ }+ _ => return None,+ }+ Some(s)+ }+}++fn cstr(s: &str) -> CString {+ CString::new(s.replace('\0', "")).unwrap_or_default()+}++pub(crate) struct WidgetNode {+ pub node: *mut sys::BKNode,+ pub spec: WidgetSpec,+ seen: bool,+}++/// The kit widgets of one window, keyed by element key.+pub(crate) struct Widgets {+ pub nodes: HashMap<String, WidgetNode>,+ /// Set while Rust writes values, so the kit's change echoes are ignored.+ pub syncing: bool,+}++impl Widgets {+ pub(crate) fn new() -> Widgets {+ Widgets { nodes: HashMap::new(), syncing: false }+ }++ /// Ensure the kit node for `key` exists and matches `spec`; returns its+ /// natural size in logical pixels.+ pub(crate) fn ensure(&mut self, parent: *mut sys::BKNode, key: &str, spec: &WidgetSpec, scale: f32)+ -> (f32, f32) {+ if self.nodes.get(key).is_some_and(|w| w.spec.kind != spec.kind) {+ let w = self.nodes.remove(key).unwrap();+ // SAFETY: the node is ours and attached to `parent`.+ unsafe { sys::BK_node_free(w.node) };+ }+ self.syncing = true;+ let entry = self.nodes.entry(key.to_owned()).or_insert_with(|| {+ // SAFETY: plain constructor calls on a fresh node.+ let node = unsafe { sys::BK_node_new(spec.kind.class().as_ptr()) };+ unsafe {+ sys::BK_node_add(parent, node, -1);+ sys::BK_geom_set_manager(node, sys::BK_GEOM_PLACE);+ }+ let w = WidgetNode { node, spec: spec.clone(), seen: true };+ sync(node, None, spec);+ w+ });+ if entry.spec != *spec {+ sync(entry.node, Some(&entry.spec), spec);+ entry.spec = spec.clone();+ }+ entry.seen = true;+ self.syncing = false;+ let mut nat = [0i32; 2];+ // SAFETY: valid node, two-int out array.+ unsafe { sys::BK_node_natural(entry.node, nat.as_mut_ptr()) };+ let (mw, mh) = spec.kind.min_size();+ ((nat[0] as f32 / scale).max(mw), (nat[1] as f32 / scale).max(mh))+ }++ /// Place every widget at its laid-out bounds; free those not rendered.+ pub(crate) fn place(&mut self, at: &HashMap<String, (Bounds<f32>, Option<Bounds<f32>>, bool)>,+ scale: f32) {+ self.nodes.retain(|key, w| {+ if !w.seen || !at.contains_key(key) {+ // SAFETY: frees our node (detaching it from the canvas).+ unsafe { sys::BK_node_free(w.node) };+ return false;+ }+ w.seen = false;+ let (b, clip, visible) = at[key];+ let shown = visible && clip.is_none_or(|c| {+ let i = c.intersect(&b);+ i.size.width > 0.0 && i.size.height > 0.0+ });+ unsafe {+ sys::BK_geom_set(w.node, c"x".as_ptr(), (b.origin.x * scale).round() as f64);+ sys::BK_geom_set(w.node, c"y".as_ptr(), (b.origin.y * scale).round() as f64);+ sys::BK_geom_set(w.node, c"width".as_ptr(), (b.size.width * scale).round() as f64);+ sys::BK_geom_set(w.node, c"height".as_ptr(), (b.size.height * scale).round() as f64);+ sys::BK_set_num(w.node, c"visible".as_ptr(), shown as i32 as f64);+ }+ true+ });+ }++ pub(crate) fn key_of(&self, node: *mut sys::BKNode) -> Option<String> {+ self.nodes.iter().find(|(_, w)| w.node == node).map(|(k, _)| k.clone())+ }++ /// The control's current value, as an HTML `change` event sees it.+ pub(crate) fn read(&self, key: &str) -> ChangeEvent {+ let Some(w) = self.nodes.get(key) else { return ChangeEvent::default() };+ let n = w.node;+ // SAFETY: live node; returned strings are copied immediately.+ unsafe {+ let num = sys::BK_get_num(n, c"value".as_ptr());+ let text = CStr::from_ptr(sys::BK_get_str(n, c"value".as_ptr())).to_string_lossy().into_owned();+ match w.spec.kind {+ WKind::Text { .. } | WKind::TextArea => ChangeEvent { value: text, checked: false, number: 0.0 },+ WKind::Checkbox | WKind::Radio => ChangeEvent {+ value: if num != 0.0 { "on".into() } else { String::new() },+ checked: num != 0.0,+ number: num,+ },+ WKind::Select => ChangeEvent {+ value: w.spec.items.get(num as usize).cloned().unwrap_or_default(),+ checked: false,+ number: num,+ },+ WKind::Color => {+ let mut c = [0f32; 4];+ sys::BK_get_color(n, c"value".as_ptr(), c.as_mut_ptr());+ let b = |v: f32| (v.clamp(0.0, 1.0) * 255.0).round() as u8;+ ChangeEvent { value: format!("#{:02x}{:02x}{:02x}", b(c[0]), b(c[1]), b(c[2])),+ checked: false, number: 0.0 }+ }+ _ => ChangeEvent { value: format_num(num), checked: false, number: num },+ }+ }+ }++ /// Radio groups: turning one on turns the others with its name off.+ pub(crate) fn radio_group(&self, key: &str) -> Vec<String> {+ let Some(name) = self.nodes.get(key).and_then(|w| w.spec.name.clone()) else { return vec![] };+ self.nodes.iter()+ .filter(|(k, w)| *k != key && w.spec.kind == WKind::Radio && w.spec.name.as_ref() == Some(&name))+ .map(|(k, _)| k.clone())+ .collect()+ }++ pub(crate) fn set_value(&mut self, key: &str, v: f64) {+ if let Some(w) = self.nodes.get(key) {+ self.syncing = true;+ unsafe { sys::BK_set_num(w.node, c"value".as_ptr(), v) };+ self.syncing = false;+ }+ }++ pub(crate) fn free_all(&mut self) {+ for (_, w) in self.nodes.drain() {+ unsafe { sys::BK_node_free(w.node) };+ }+ }+}++fn format_num(v: f64) -> String {+ if v.fract() == 0.0 && v.abs() < 1e15 { format!("{}", v as i64) } else { format!("{v}") }+}++/// Push the properties of `spec` that differ from `old` into the kit node.+fn sync(n: *mut sys::BKNode, old: Option<&WidgetSpec>, spec: &WidgetSpec) {+ // SAFETY: `n` is a live node; C strings outlive each call.+ unsafe {+ let set_num = |k: &CStr, v: f64| { sys::BK_set_num(n, k.as_ptr(), v); };+ let set_str = |k: &CStr, v: &str| { let c = cstr(v); sys::BK_set_str(n, k.as_ptr(), c.as_ptr()); };+ if old.is_none_or(|o| o.disabled != spec.disabled) {+ set_num(c"enabled", (!spec.disabled) as i32 as f64);+ }+ if old.is_none_or(|o| o.label != spec.label) && !spec.label.is_empty() {+ match spec.kind {+ WKind::Button | WKind::Progress => set_str(c"text", &spec.label),+ _ => set_str(c"label", &spec.label),+ }+ }+ if old.is_none_or(|o| o.placeholder != spec.placeholder) && !spec.placeholder.is_empty() {+ set_str(c"placeholder", &spec.placeholder);+ }+ if let WKind::Text { mask: true } = spec.kind {+ if old.is_none() {+ set_num(c"mask", 1.0);+ }+ }+ if old.is_none_or(|o| (o.min, o.max, o.step) != (spec.min, spec.max, spec.step))+ && matches!(spec.kind, WKind::Number | WKind::Slider)+ {+ if spec.min.is_finite() {+ set_num(c"min", spec.min);+ }+ if spec.max.is_finite() {+ set_num(c"max", spec.max);+ }+ set_num(c"step", spec.step);+ if spec.step.fract() == 0.0 {+ set_num(c"precision", 0.0);+ }+ }+ if old.is_none_or(|o| o.items != spec.items) && spec.kind == WKind::Select {+ let cs: Vec<CString> = spec.items.iter().map(|s| cstr(s)).collect();+ let ptrs: Vec<*const std::ffi::c_char> = cs.iter().map(|c| c.as_ptr()).collect();+ sys::BK_set_strs(n, c"items".as_ptr(), ptrs.as_ptr(), ptrs.len() as i32);+ }+ if old.is_none_or(|o| o.text != spec.text) {+ if let Some(t) = &spec.text {+ set_str(c"text", t);+ }+ }+ if old.is_none_or(|o| o.value != spec.value) {+ if let Some(v) = spec.value {+ set_num(if spec.kind == WKind::Progress { c"factor" } else { c"value" }, v);+ }+ }+ if old.is_none_or(|o| o.color != spec.color) {+ if let Some(c) = spec.color {+ sys::BK_set_color(n, c"value".as_ptr(), c.to_array().as_ptr());+ }+ }+ }+}diff --git a/bindings/rust/blenderui/src/window.rs b/bindings/rust/blenderui/src/window.rsnew file mode 100644index 0000000..5e89d18--- /dev/null+++ b/bindings/rust/blenderui/src/window.rs@@ -0,0 +1,1082 @@+//! Application, windows, entities and event dispatch, shaped like gpui:+//!+//! ```ignore+//! Application::new().run(|cx: &mut App| {+//! cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Counter { n: 0 })).unwrap();+//! });+//! ```++use std::any::{Any, TypeId};+use std::cell::{Ref, RefCell};+use std::collections::{HashMap, VecDeque};+use std::ffi::{c_char, c_double, c_int, c_void, CStr, CString};+use std::marker::PhantomData;+use std::ops::{Deref, DerefMut};+use std::rc::Rc;++use crate::element::{AnyElement, IntoElement, Listener, Listeners, SharedString};+use crate::events::*;+use crate::geometry::{point, px, size, Bounds, Pixels, Size};+use crate::layout::{layout, Content, Frame, UiState};+use crate::paint::{paint_frame, Painter};+use crate::widgets::{WKind, Widgets};+use blenderui_sys as sys;++// ==========================================================================+// Entities++/// Shared state owned by the app (gpui's `Entity<T>`).+pub struct Entity<T> {+ inner: Rc<RefCell<Option<T>>>,+}++impl<T> Clone for Entity<T> {+ fn clone(&self) -> Self {+ Entity { inner: self.inner.clone() }+ }+}++impl<T: 'static> Entity<T> {+ /// Read the value.+ pub fn read<'a>(&'a self, _cx: &'a App) -> Ref<'a, T> {+ Ref::map(self.inner.borrow(), |v| v.as_ref().expect("entity is being built"))+ }++ /// Mutate the value with a [`Context`] for it.+ pub fn update<R>(&self, cx: &mut App, f: impl FnOnce(&mut T, &mut Context<T>) -> R) -> R {+ let mut slot = self.inner.borrow_mut();+ let value = slot.as_mut().expect("entity is being built");+ let mut ctx = Context { app: cx, entity: self.clone() };+ f(value, &mut ctx)+ }++ /// Same entity?+ pub fn entity_id(&self) -> usize {+ Rc::as_ptr(&self.inner) as *const () as usize+ }++ pub fn downgrade(&self) -> WeakEntity<T> {+ WeakEntity { inner: Rc::downgrade(&self.inner) }+ }+}++/// A weak handle (gpui's `WeakEntity<T>`).+pub struct WeakEntity<T> {+ inner: std::rc::Weak<RefCell<Option<T>>>,+}++impl<T> Clone for WeakEntity<T> {+ fn clone(&self) -> Self {+ WeakEntity { inner: self.inner.clone() }+ }+}++impl<T: 'static> WeakEntity<T> {+ pub fn upgrade(&self) -> Option<Entity<T>> {+ self.inner.upgrade().map(|inner| Entity { inner })+ }++ /// Update if still alive.+ pub fn update<R>(&self, cx: &mut App, f: impl FnOnce(&mut T, &mut Context<T>) -> R) -> Option<R> {+ self.upgrade().map(|e| e.update(cx, f))+ }+}++/// The app, seen from inside an entity (gpui's `Context<T>`); derefs to [`App`].+pub struct Context<'a, T> {+ app: &'a mut App,+ entity: Entity<T>,+}++impl<T> Deref for Context<'_, T> {+ type Target = App;+ fn deref(&self) -> &App {+ self.app+ }+}+impl<T> DerefMut for Context<'_, T> {+ fn deref_mut(&mut self) -> &mut App {+ self.app+ }+}++impl<T: 'static> Context<'_, T> {+ /// This entity.+ pub fn entity(&self) -> Entity<T> {+ self.entity.clone()+ }++ pub fn weak_entity(&self) -> WeakEntity<T> {+ self.entity.downgrade()+ }++ /// Re-render the windows showing this entity.+ pub fn notify(&mut self) {+ self.app.notify_all();+ }++ /// Turn a method-like closure into an element listener (gpui's `cx.listener`).+ pub fn listener<E: ?Sized>(+ &self,+ f: impl Fn(&mut T, &E, &mut Window, &mut Context<T>) + 'static,+ ) -> impl Fn(&E, &mut Window, &mut App) + 'static {+ let weak = self.entity.downgrade();+ move |e: &E, window: &mut Window, cx: &mut App| {+ if let Some(entity) = weak.upgrade() {+ entity.update(cx, |this, cx| f(this, e, window, cx));+ }+ }+ }+}++/// A view: something that renders an element tree (gpui's `Render`).+pub trait Render: 'static + Sized {+ fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement;+}++// ==========================================================================+// The application++/// Window identity.+#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]+pub struct WindowId(pub usize);++/// A typed window handle (gpui's `WindowHandle<V>`).+pub struct WindowHandle<V> {+ pub id: WindowId,+ entity: Entity<V>,+}++impl<V> Clone for WindowHandle<V> {+ fn clone(&self) -> Self {+ WindowHandle { id: self.id, entity: self.entity.clone() }+ }+}++impl<V: 'static> WindowHandle<V> {+ /// The root view of the window.+ pub fn root(&self) -> Entity<V> {+ self.entity.clone()+ }++ /// Update the root view with its window.+ pub fn update<R>(&self, cx: &mut App,+ f: impl FnOnce(&mut V, &mut Window, &mut Context<V>) -> R) -> Option<R> {+ let mut w = cx.windows.get_mut(self.id.0)?.take()?;+ let r = self.entity.update(cx, |v, cx| f(v, &mut w, cx));+ cx.windows[self.id.0] = Some(w);+ Some(r)+ }+}++/// How a window opens (gpui's `WindowBounds`).+#[derive(Clone, Copy, Debug)]+pub enum WindowBounds {+ Windowed(Bounds<Pixels>),+ Maximized(Bounds<Pixels>),+ Fullscreen(Bounds<Pixels>),+}++#[derive(Clone, Debug, Default)]+pub struct TitlebarOptions {+ pub title: Option<SharedString>,+}++/// Options for [`App::open_window`] (gpui's `WindowOptions`).+#[derive(Clone, Debug, Default)]+pub struct WindowOptions {+ pub window_bounds: Option<WindowBounds>,+ pub titlebar: Option<TitlebarOptions>,+ pub is_resizable: Option<bool>,+ pub window_min_size: Option<Size<Pixels>>,+}++/// The application entry point (gpui's `Application`).+pub struct Application {+ headless: bool,+}++impl Default for Application {+ fn default() -> Self {+ Application::new()+ }+}++impl Application {+ /// Native windows.+ pub fn new() -> Application {+ Application { headless: false }+ }++ /// Off-screen windows (tests, screenshots, CI): nothing is shown, the+ /// `simulate_*` and `draw` methods drive it.+ pub fn headless() -> Application {+ Application { headless: true }+ }++ /// Run `f`, then the event loop until every window is closed.+ pub fn run(self, f: impl FnOnce(&mut App)) {+ // the C kit keeps global state: one application at a time per process+ static KIT: std::sync::Mutex<()> = std::sync::Mutex::new(());+ let _guard = KIT.lock().unwrap_or_else(|e| e.into_inner());+ let headless = self.headless || unsafe { sys::BK_window_supported() } == 0;+ let mut app = App::create(headless);+ f(&mut app);+ app.flush();+ if headless {+ app.shutdown();+ return;+ }+ APP.with(|a| *a.borrow_mut() = Some(app));+ // SAFETY: plain message loop; callbacks re-enter through APP.+ unsafe { sys::BK_window_run() };+ if let Some(mut app) = APP.with(|a| a.borrow_mut().take()) {+ app.shutdown();+ }+ }+}++thread_local! {+ /// The running app while the native loop runs (callbacks borrow it).+ static APP: RefCell<Option<App>> = const { RefCell::new(None) };+ /// Kit events that arrived while the app was busy.+ static QUEUE: RefCell<VecDeque<RawEvent>> = const { RefCell::new(VecDeque::new()) };+}++struct RawEvent {+ window: usize,+ node: *mut sys::BKNode,+ kind: c_int,+ text: String,+ a: f64,+ b: f64,+}++/// The application state (gpui's `App`).+pub struct App {+ windows: Vec<Option<Box<Window>>>,+ headless: bool,+ globals: HashMap<TypeId, Box<dyn Any>>,+ propagate: bool,+}++impl App {+ fn create(headless: bool) -> App {+ App { windows: Vec::new(), headless, globals: HashMap::new(), propagate: true }+ }++ /// Create an entity (gpui's `cx.new`).+ pub fn new<T: 'static>(&mut self, build: impl FnOnce(&mut Context<T>) -> T) -> Entity<T> {+ let entity = Entity { inner: Rc::new(RefCell::new(None)) };+ let mut ctx = Context { app: self, entity: entity.clone() };+ let v = build(&mut ctx);+ *entity.inner.borrow_mut() = Some(v);+ entity+ }++ /// Open a window whose root view is built by `build`.+ pub fn open_window<V: Render>(+ &mut self,+ options: WindowOptions,+ build: impl FnOnce(&mut Window, &mut App) -> Entity<V>,+ ) -> Result<WindowHandle<V>, String> {+ let bounds = match options.window_bounds {+ Some(WindowBounds::Windowed(b) | WindowBounds::Maximized(b) | WindowBounds::Fullscreen(b)) => b,+ None => Bounds { origin: point(px(0.0), px(0.0)), size: size(px(1024.0), px(700.0)) },+ };+ let title = options.titlebar.as_ref().and_then(|t| t.title.clone())+ .map(|t| t.to_string()).unwrap_or_else(|| "BUI".into());+ let id = self.windows.len();+ let mut w = Window::create(id, &title, bounds.size.width.0, bounds.size.height.0, self.headless)?;+ if let Some(n) = &w.native {+ unsafe {+ if let Some(WindowBounds::Maximized(_)) = options.window_bounds {+ sys::BK_window_wm(*n, c"state".as_ptr(), 1.0, 0.0);+ }+ if options.is_resizable == Some(false) {+ sys::BK_window_wm(*n, c"resizable".as_ptr(), 0.0, 0.0);+ }+ if let Some(m) = options.window_min_size {+ sys::BK_window_wm(*n, c"minsize".as_ptr(), (m.width.0 * w.scale) as f64,+ (m.height.0 * w.scale) as f64);+ }+ }+ }+ let entity = build(&mut w, self);+ let view = entity.clone();+ w.view = Some(Rc::new(move |window: &mut Window, cx: &mut App| {+ view.update(cx, |v, cx| v.render(window, cx).into_any_element())+ }));+ w.dirty = true;+ self.windows.push(Some(Box::new(w)));+ if !self.headless {+ self.with_window(id, |w, app| w.rebuild(app));+ if let Some(n) = self.window(WindowId(id)).and_then(|w| w.native) {+ unsafe { sys::BK_window_show(n) };+ }+ }+ Ok(WindowHandle { id: WindowId(id), entity })+ }++ /// Mark every window for re-render.+ pub fn notify_all(&mut self) {+ for w in self.windows.iter_mut().flatten() {+ w.refresh();+ }+ }++ /// Stop the event loop.+ pub fn quit(&mut self) {+ unsafe { sys::BK_window_quit() };+ }++ /// Stop the current event from reaching ancestors.+ pub fn stop_propagation(&mut self) {+ self.propagate = false;+ }++ /// Activate the app (no-op: windows come to the front when shown).+ pub fn activate(&mut self, _ignoring_other_apps: bool) {}++ pub fn set_global<G: 'static>(&mut self, g: G) {+ self.globals.insert(TypeId::of::<G>(), Box::new(g));+ }+ pub fn global<G: 'static>(&self) -> &G {+ self.try_global().expect("global not set")+ }+ pub fn try_global<G: 'static>(&self) -> Option<&G> {+ self.globals.get(&TypeId::of::<G>()).and_then(|g| g.downcast_ref())+ }+ pub fn global_mut<G: 'static>(&mut self) -> &mut G {+ self.globals.get_mut(&TypeId::of::<G>()).and_then(|g| g.downcast_mut()).expect("global not set")+ }++ pub fn window(&self, id: WindowId) -> Option<&Window> {+ self.windows.get(id.0)?.as_deref()+ }++ fn with_window<R>(&mut self, id: usize, f: impl FnOnce(&mut Window, &mut App) -> R) -> Option<R> {+ let mut w = self.windows.get_mut(id)?.take()?;+ let r = f(&mut w, self);+ self.windows[id] = Some(w);+ Some(r)+ }++ /// Handle queued kit events, then re-render what changed.+ fn drain(&mut self) {+ while let Some(ev) = QUEUE.with(|q| q.borrow_mut().pop_front()) {+ self.with_window(ev.window, |w, app| w.dispatch(ev, app));+ }+ }++ /// Re-render dirty windows now (headless) or soon (native: next loop turn).+ fn flush(&mut self) {+ self.drain();+ for id in 0..self.windows.len() {+ let Some(w) = self.windows[id].as_deref_mut() else { continue };+ if !w.dirty {+ continue;+ }+ match w.native {+ // animation: rebuild right before the next (vsync-paced) render+ Some(n) if w.animation_frame => {+ w.animation_frame = false;+ unsafe { sys::BK_window_request_frame(n, w.vsync as c_int) };+ }+ Some(n) if !w.timer_pending => {+ w.timer_pending = true;+ unsafe { sys::BK_window_timer(n, 0) };+ }+ Some(_) => {}+ None => {+ self.with_window(id, |w, app| w.rebuild(app));+ }+ }+ }+ }++ fn shutdown(&mut self) {+ for w in self.windows.iter_mut().flatten() {+ w.destroy();+ }+ self.windows.clear();+ }++ // -- automation (tests, screenshots) --------------------------------------------------++ /// Render a window off-screen: (width, height, 0x00RRGGBB pixels) in device pixels.+ pub fn draw(&mut self, id: WindowId) -> (usize, usize, Vec<u32>) {+ self.flush();+ let Some(w) = self.windows.get_mut(id.0).and_then(|w| w.as_deref_mut()) else {+ return (0, 0, Vec::new());+ };+ let (pw, ph) = w.phys;+ // SAFETY: the raster is sized to the window; pixels are copied out.+ let px = unsafe {+ if w.raster.is_null() {+ w.raster = sys::BUI_raster_create(pw, ph);+ }+ let _s = crate::prof::span("kit render");+ sys::BK_render(w.ctx, w.raster, pw, ph, 1);+ let p = sys::BUI_raster_pixels(w.raster);+ std::slice::from_raw_parts(p, (pw * ph) as usize).to_vec()+ };+ self.flush(); // configure events from the render+ (pw as usize, ph as usize, px)+ }++ /// Bounds (logical pixels) of the element with `.id(id)`.+ pub fn element_bounds(&mut self, window: WindowId, id: &str) -> Option<Bounds<f32>> {+ self.flush();+ let w = self.window(window)?;+ let f = w.frame.as_ref()?;+ f.by_key().get(&format!("#{id}")).map(|&i| f.nodes[i].bounds)+ }++ fn input(&mut self, window: WindowId, f: impl FnOnce(*mut sys::BKContext, f32)) {+ self.flush();+ if let Some(w) = self.window(window) {+ if w.frame.is_none() {+ return;+ }+ f(w.ctx, w.scale);+ }+ self.flush();+ }++ /// Move the pointer to (x, y) in logical pixels.+ pub fn simulate_mouse_move(&mut self, window: WindowId, x: f32, y: f32) {+ self.input(window, |ctx, s| unsafe {+ sys::BK_motion(ctx, (x * s) as c_int, (y * s) as c_int, 0);+ });+ }++ /// Press and release the left button at (x, y).+ pub fn simulate_click(&mut self, window: WindowId, x: f32, y: f32) {+ self.simulate_mouse_move(window, x, y);+ self.input(window, |ctx, s| unsafe {+ sys::BK_press(ctx, (x * s) as c_int, (y * s) as c_int, 0);+ });+ self.input(window, |ctx, s| unsafe {+ sys::BK_release(ctx, (x * s) as c_int, (y * s) as c_int, sys::BK_BUTTON1);+ });+ }++ /// Scroll the wheel at (x, y): positive `lines` scroll the content up.+ pub fn simulate_scroll(&mut self, window: WindowId, x: f32, y: f32, lines: i32) {+ self.simulate_mouse_move(window, x, y);+ self.input(window, |ctx, s| unsafe {+ sys::BK_wheel(ctx, (x * s) as c_int, (y * s) as c_int, lines, 0);+ });+ }++ /// Type text / press a key (`keysym` as in Tk: "Return", "BackSpace", "a" ...).+ pub fn simulate_key(&mut self, window: WindowId, text: &str, keysym: &str) {+ let (t, k) = (CString::new(text).unwrap_or_default(), CString::new(keysym).unwrap_or_default());+ self.input(window, |ctx, _| unsafe {+ sys::BK_key(ctx, t.as_ptr(), k.as_ptr(), 0);+ });+ }+}++// ==========================================================================+// Kit callbacks++unsafe extern "C" fn on_emit(data: *mut c_void, node: *mut sys::BKNode, kind: c_int, ref_: *mut c_void,+ a: c_double, b: c_double) {+ let text = if ref_.is_null() || kind < sys::BK_EV_PRESS {+ String::new()+ } else {+ // SAFETY: raw events carry a C string in `ref`.+ unsafe { CStr::from_ptr(ref_ as *const c_char) }.to_string_lossy().into_owned()+ };+ QUEUE.with(|q| q.borrow_mut().push_back(RawEvent { window: data as usize, node, kind, text, a, b }));+ with_running_app(|app| app.flush());+}++unsafe extern "C" fn on_timer(data: *mut c_void, _win: *mut sys::BKWindow, _id: c_int) {+ let id = data as usize;+ let ran = with_running_app(|app| {+ app.drain();+ app.with_window(id, |w, app| {+ w.timer_pending = false;+ if w.dirty {+ w.rebuild(app);+ }+ });+ app.flush();+ });+ if !ran {+ // the app is busy (re-entrant callback): try again next turn+ unsafe { sys::BK_window_timer(_win, 1) };+ }+}++unsafe extern "C" fn on_frame(data: *mut c_void, _win: *mut sys::BKWindow) {+ // BUI_PROFILE: wall time between frames, i.e. rebuild + kit render + present+ thread_local! { static LAST: std::cell::Cell<Option<std::time::Instant>> = const { std::cell::Cell::new(None) }; }+ if crate::prof::on() {+ let now = std::time::Instant::now();+ if let Some(t) = LAST.with(|l| l.replace(Some(now))) {+ crate::prof::add("frame interval", (now - t).as_secs_f64() * 1000.0);+ }+ }+ let id = data as usize;+ with_running_app(|app| {+ app.drain();+ app.with_window(id, |w, app| {+ if w.dirty {+ w.rebuild(app);+ }+ });+ app.flush();+ });+}++unsafe extern "C" fn on_close(data: *mut c_void, _win: *mut sys::BKWindow) -> c_int {+ let id = data as usize;+ with_running_app(|app| {+ if let Some(w) = app.windows.get_mut(id).and_then(|w| w.as_deref_mut()) {+ w.closed = true;+ }+ });+ 1+}++fn with_running_app(f: impl FnOnce(&mut App)) -> bool {+ let Some(mut app) = APP.with(|a| a.try_borrow_mut().ok().and_then(|mut a| a.take())) else {+ return false;+ };+ f(&mut app);+ APP.with(|a| *a.borrow_mut() = Some(app));+ true+}++unsafe extern "C" fn noop(_: *mut c_void) {}++// ==========================================================================+// Windows++type ViewFn = Rc<dyn Fn(&mut Window, &mut App) -> AnyElement>;++/// A window (gpui's `Window`): its kit context, layout and interaction state.+pub struct Window {+ id: usize,+ ctx: *mut sys::BKContext,+ canvas: *mut sys::BKNode,+ root: *mut sys::BKNode,+ opaque: bool,+ native: Option<*mut sys::BKWindow>,+ raster: *mut sys::BuiRaster,+ phys: (i32, i32),+ scale: f32,+ view: Option<ViewFn>,+ frame: Option<Frame>,+ state: UiState,+ widgets: Widgets,+ dirty: bool,+ timer_pending: bool,+ animation_frame: bool,+ vsync: bool,+ closed: bool,+ title: String,+ cursor: i32,+ pointer: (f32, f32),+ pressed: Vec<String>,+ press_button: MouseButton,+}++impl Window {+ fn create(id: usize, title: &str, w: f32, h: f32, headless: bool) -> Result<Window, String> {+ // SAFETY: building a fresh kit tree; pointers stay owned by this window.+ unsafe {+ let root = sys::BK_node_new(c"frame".as_ptr());+ let canvas = sys::BK_node_new(c"canvas".as_ptr());+ if root.is_null() || canvas.is_null() {+ return Err("kit nodes unavailable".into());+ }+ sys::BK_node_add(root, canvas, -1);+ sys::BK_geom_set_manager(canvas, sys::BK_GEOM_PLACE);+ sys::BK_geom_set(canvas, c"relwidth".as_ptr(), 1.0);+ sys::BK_geom_set(canvas, c"relheight".as_ptr(), 1.0);+ sys::BK_set_num(canvas, c"events".as_ptr(), 1.0);+ let ctx = sys::BK_context_new(root);+ let host = sys::BKHost {+ data: id as *mut c_void,+ request: Some(noop),+ set_cursor: None,+ warp: None,+ clipboard_get: None,+ clipboard_set: None,+ schedule: None,+ emit: Some(on_emit),+ };+ sys::BK_context_set_host(ctx, &host);+ let mut win = Window {+ id,+ ctx,+ canvas,+ root,+ opaque: false,+ native: None,+ raster: std::ptr::null_mut(),+ phys: (w.round() as i32, h.round() as i32),+ scale: 1.0,+ view: None,+ frame: None,+ state: UiState::default(),+ widgets: Widgets::new(),+ dirty: true,+ timer_pending: false,+ animation_frame: false,+ vsync: true,+ closed: false,+ title: title.to_owned(),+ cursor: 0,+ pointer: (-1.0, -1.0),+ pressed: Vec::new(),+ press_button: MouseButton::Left,+ };+ if headless {+ win.scale = sys::BK_scale().max(1.0);+ win.phys = ((w * win.scale).round() as i32, (h * win.scale).round() as i32);+ } else {+ let t = CString::new(title).unwrap_or_default();+ let n = sys::BK_window_new(ctx, t.as_ptr(), w.round() as c_int, h.round() as c_int);+ if n.is_null() {+ return Err("could not create a native window".into());+ }+ let cb = sys::BKWindowCallbacks { data: id as *mut c_void, on_timer: Some(on_timer),+ on_close: Some(on_close), on_frame: Some(on_frame) };+ sys::BK_window_set_callbacks(n, &cb);+ win.scale = sys::BK_scale().max(0.5);+ win.phys = ((w * win.scale).round() as i32, (h * win.scale).round() as i32);+ win.native = Some(n);+ }+ Ok(win)+ }+ }++ fn destroy(&mut self) {+ self.widgets.free_all();+ unsafe {+ if let Some(n) = self.native.take() {+ sys::BK_window_free(n);+ }+ if !self.raster.is_null() {+ sys::BUI_raster_free(self.raster);+ self.raster = std::ptr::null_mut();+ }+ }+ }++ /// Window id.+ pub fn window_handle(&self) -> WindowId {+ WindowId(self.id)+ }++ /// Re-render on the next turn.+ /// Render again on the next display refresh (gpui's+ /// `request_animation_frame`): call it from `render` to animate.+ pub fn request_animation_frame(&mut self) {+ self.animation_frame = true;+ self.dirty = true;+ }++ /// Pace animation frames to the display (default `true`). With `false`+ /// frames render as fast as the CPU allows (benchmarks).+ pub fn set_vsync(&mut self, on: bool) {+ self.vsync = on;+ }++ /// Frames presented to the native window so far.+ pub fn presented_frames(&self) -> u64 {+ self.native.map_or(0, |n| unsafe { sys::BK_window_frames(n) } as u64)+ }++ pub fn refresh(&mut self) {+ self.dirty = true;+ }++ /// Content size in logical pixels.+ pub fn viewport_size(&self) -> Size<Pixels> {+ size(px(self.phys.0 as f32 / self.scale), px(self.phys.1 as f32 / self.scale))+ }++ pub fn bounds(&self) -> Bounds<Pixels> {+ Bounds { origin: point(px(0.0), px(0.0)), size: self.viewport_size() }+ }++ /// Device pixels per logical pixel.+ pub fn scale_factor(&self) -> f32 {+ self.scale+ }++ pub fn set_window_title(&mut self, title: &str) {+ if self.title != title {+ self.title = title.to_owned();+ if let Some(n) = self.native {+ let t = CString::new(title).unwrap_or_default();+ unsafe { sys::BK_window_set_title(n, t.as_ptr()) };+ }+ }+ }++ /// Pointer position in logical pixels.+ pub fn mouse_position(&self) -> crate::geometry::Point<Pixels> {+ point(px(self.pointer.0), px(self.pointer.1))+ }++ /// The `.id()` of the focused element, if any.+ pub fn focused_id(&self) -> Option<&str> {+ self.state.focused.as_deref().and_then(|k| k.strip_prefix('#'))+ }++ /// Focus the element with `.id(id)` (keyboard events go to it).+ pub fn focus_id(&mut self, id: &str) {+ self.state.focused = Some(format!("#{id}"));+ self.dirty = true;+ }++ /// Is the element with `.id(id)` hovered?+ pub fn is_hovered(&self, id: &str) -> bool {+ self.state.hovered.contains(&format!("#{id}"))+ }++ /// Scroll offset of a scroll container with `.id(id)`.+ pub fn scroll_offset(&self, id: &str) -> (f32, f32) {+ self.state.scroll.get(&format!("#{id}")).copied().unwrap_or((0.0, 0.0))+ }++ pub fn set_scroll_offset(&mut self, id: &str, x: f32, y: f32) {+ self.state.scroll.insert(format!("#{id}"), (x, y));+ self.dirty = true;+ }++ fn viewport(&self) -> (f32, f32) {+ (self.phys.0 as f32 / self.scale, self.phys.1 as f32 / self.scale)+ }++ // -- render -----------------------------------------------------------------------------++ fn rebuild(&mut self, app: &mut App) {+ let Some(view) = self.view.clone() else { return };+ self.dirty = false;+ let root = {+ let _s = crate::prof::span("render");+ view(self, app)+ };+ let vp = self.viewport();+ let (canvas, scale) = (self.canvas, self.scale);+ let widgets = &mut self.widgets;+ let frame = layout(root, vp, &self.state, &mut |key, spec| widgets.ensure(canvas, key, spec, scale));+ let mut p = Painter::new();+ {+ let _s = crate::prof::span("paint");+ paint_frame(&frame, &mut p, vp);+ }+ {+ let _s = crate::prof::span("flush");+ p.flush(canvas, scale);+ }+ let _rest = crate::prof::span("widgets+hover");+ let mut at = HashMap::new();+ for n in &frame.nodes {+ if matches!(n.content, Content::Widget(_)) {+ at.insert(n.key.clone(), (n.bounds, n.clip, n.visible));+ }+ }+ self.widgets.place(&at, scale);+ // an opaque <html> background covers the window: the kit can skip its clear+ let opaque = frame.nodes.first().is_some_and(|h| h.style.background.a >= 1.0 && h.style.opacity >= 1.0);+ if opaque != self.opaque {+ self.opaque = opaque;+ unsafe { sys::BK_set_num(self.root, c"opaque".as_ptr(), opaque as i32 as f64) };+ }+ if let Some(t) = frame.title.clone() {+ self.set_window_title(&t);+ }+ self.frame = Some(frame);+ self.update_hover(app, false);+ drop(_rest);+ crate::prof::frame_done();+ }++ // -- events ------------------------------------------------------------------------------++ /// Element keys from the root to the deepest element under the pointer.+ fn path_at(&self, x: f32, y: f32) -> Vec<String> {+ let Some(f) = &self.frame else { return Vec::new() };+ f.hit_path(x, y).into_iter().map(|i| f.nodes[i].key.clone()).collect()+ }++ /// Listeners of `pick` from `key` up to the root (bubbling order).+ fn bubble<E: 'static>(&self, key: &str, pick: impl Fn(&Listeners) -> Vec<Listener<E>>)+ -> Vec<Listener<E>> {+ let Some(f) = &self.frame else { return Vec::new() };+ let mut out = Vec::new();+ let mut cur = f.by_key().get(key).copied();+ while let Some(i) = cur {+ if let Some(el) = &f.nodes[i].el {+ out.extend(pick(&el.listeners));+ }+ cur = f.nodes[i].parent;+ }+ out+ }++ fn fire<E: 'static>(&mut self, app: &mut App, listeners: Vec<Listener<E>>, e: &E) {+ app.propagate = true;+ for l in listeners {+ l(e, self, app);+ if !app.propagate {+ break;+ }+ }+ app.propagate = true;+ }++ fn update_hover(&mut self, app: &mut App, fire: bool) {+ let path = self.path_at(self.pointer.0, self.pointer.1);+ let now: std::collections::HashSet<String> = path.iter().cloned().collect();+ if now == self.state.hovered {+ return;+ }+ let entered: Vec<String> = now.difference(&self.state.hovered).cloned().collect();+ let left: Vec<String> = self.state.hovered.difference(&now).cloned().collect();+ let restyle = self.frame.as_ref().is_some_and(|f| {+ entered.iter().chain(&left).any(|k| f.by_key().get(k).is_some())+ });+ self.state.hovered = now;+ // cursor of the deepest element that sets one+ if let Some(f) = &self.frame {+ let cursor = path.iter().rev()+ .find_map(|k| f.by_key().get(k).and_then(|&i| f.nodes[i].style.cursor)).unwrap_or(0);+ if cursor != self.cursor {+ self.cursor = cursor;+ unsafe { sys::BK_set_num(self.canvas, c"cursor".as_ptr(), cursor as f64) };+ }+ }+ if fire {+ for (keys, on) in [(left, false), (entered, true)] {+ for k in keys {+ let ls = self.frame.as_ref().and_then(|f| f.by_key().get(&k).map(|&i| f.nodes[i].clone_hover()))+ .unwrap_or_default();+ self.fire(app, ls, &on);+ }+ }+ }+ if restyle {+ self.dirty = true;+ }+ }++ fn pointer_event(&self, text: &str) -> (Modifiers, MouseButton) {+ let mut it = text.split_whitespace().map(|v| v.parse::<i32>().unwrap_or(0));+ let mods = it.next().unwrap_or(0);+ let button = match it.next().unwrap_or(1) {+ 2 => MouseButton::Middle,+ 3 => MouseButton::Right,+ _ => MouseButton::Left,+ };+ (Modifiers::from_kit(mods), button)+ }++ fn dispatch(&mut self, ev: RawEvent, app: &mut App) {+ if ev.node != self.canvas {+ self.widget_event(ev, app);+ return;+ }+ let (x, y) = (ev.a as f32 / self.scale, ev.b as f32 / self.scale);+ match ev.kind {+ sys::BK_EV_CONFIGURE => {+ let phys = (ev.a as i32, ev.b as i32);+ if phys != self.phys && phys.0 > 0 && phys.1 > 0 {+ self.phys = phys;+ self.dirty = true;+ }+ }+ sys::BK_EV_MOTION | sys::BK_EV_ENTER => {+ self.pointer = (x, y);+ self.update_hover(app, true);+ let (modifiers, _) = self.pointer_event(&ev.text);+ let pressed = (!self.pressed.is_empty()).then_some(self.press_button);+ let e = MouseMoveEvent { position: point(px(x), px(y)), pressed_button: pressed, modifiers };+ if let Some(deepest) = self.state_deepest() {+ let ls = self.bubble(&deepest, |l| l.mouse_move.clone());+ self.fire(app, ls, &e);+ }+ }+ sys::BK_EV_LEAVE => {+ self.pointer = (-1.0, -1.0);+ self.update_hover(app, true);+ }+ sys::BK_EV_PRESS | sys::BK_EV_DOUBLE => {+ self.pointer = (x, y);+ let (modifiers, button) = self.pointer_event(&ev.text);+ let path = self.path_at(x, y);+ self.press_button = button;+ self.state.active = path.iter().cloned().collect();+ self.state.focused = path.last().cloned();+ self.pressed = path.clone();+ self.dirty = true;+ let e = MouseDownEvent { button, position: point(px(x), px(y)), modifiers,+ click_count: if ev.kind == sys::BK_EV_DOUBLE { 2 } else { 1 } };+ if let Some(deepest) = path.last() {+ let ls = self.bubble(deepest, |l| l.mouse_down.iter()+ .filter(|(b, _)| b.is_none_or(|b| b == button)).map(|(_, f)| f.clone()).collect());+ self.fire(app, ls, &e);+ }+ }+ sys::BK_EV_RELEASE => {+ let (modifiers, button) = self.pointer_event(&ev.text);+ let path = self.path_at(x, y);+ let up = MouseUpEvent { button, position: point(px(x), px(y)), modifiers };+ if let Some(deepest) = path.last() {+ let ls = self.bubble(deepest, |l| l.mouse_up.iter()+ .filter(|(b, _)| b.is_none_or(|b| b == button)).map(|(_, f)| f.clone()).collect());+ self.fire(app, ls, &up);+ }+ // click: the deepest element under both press and release+ let common = self.pressed.iter().zip(&path).take_while(|(a, b)| a == b)+ .map(|(a, _)| a.clone()).last();+ self.pressed.clear();+ self.state.active.clear();+ self.dirty = true;+ if let (Some(target), MouseButton::Left) = (common, button) {+ self.toggle_details(&target);+ let down = MouseDownEvent { button, position: point(px(x), px(y)), modifiers, click_count: 1 };+ let e = ClickEvent { down, up };+ let ls = self.bubble(&target, |l| l.click.clone());+ self.fire(app, ls, &e);+ }+ }+ sys::BK_EV_WHEEL => {+ let (modifiers, _) = self.pointer_event(&ev.text);+ let (px_, py_) = self.pointer;+ let e = ScrollWheelEvent { position: point(px(px_), px(py_)), delta: ev.a as f32, modifiers };+ let path = self.path_at(px_, py_);+ if let Some(deepest) = path.last() {+ let ls = self.bubble(deepest, |l| l.scroll.clone());+ self.fire(app, ls, &e);+ }+ self.scroll_by(&path, -(ev.a as f32) * 40.0, modifiers.shift);+ }+ sys::BK_EV_KEY | sys::BK_EV_KEYRELEASE => {+ let mut parts = ev.text.splitn(2, '\t');+ let ch = parts.next().unwrap_or("").to_owned();+ let key = parts.next().unwrap_or("").to_owned();+ let ks = Keystroke { key, key_char: (!ch.is_empty()).then_some(ch),+ modifiers: Modifiers::from_kit(ev.a as i32) };+ let target = self.state.focused.clone().or_else(|| self.state_deepest())+ .unwrap_or_else(|| "html".into());+ if ev.kind == sys::BK_EV_KEY {+ let ls = self.bubble(&target, |l| l.key_down.clone());+ self.fire(app, ls, &KeyDownEvent { keystroke: ks });+ } else {+ let ls = self.bubble(&target, |l| l.key_up.clone());+ self.fire(app, ls, &KeyUpEvent { keystroke: ks });+ }+ }+ _ => {}+ }+ }++ fn state_deepest(&self) -> Option<String> {+ let path = self.path_at(self.pointer.0, self.pointer.1);+ path.last().cloned()+ }++ /// `<summary>` clicks open and close their `<details>`.+ fn toggle_details(&mut self, target: &str) {+ let Some(f) = &self.frame else { return };+ let mut cur = f.by_key().get(target).copied();+ while let Some(i) = cur {+ let n = &f.nodes[i];+ if n.el.as_ref().is_some_and(|e| e.tag == "summary") {+ if let Some(p) = n.parent.filter(|&p| f.nodes[p].el.as_ref().is_some_and(|e| e.tag == "details")) {+ let key = f.nodes[p].key.clone();+ let open = self.state.details_open.get(&key).copied()+ .unwrap_or(f.nodes[p].attr("open").is_some());+ self.state.details_open.insert(key, !open);+ self.dirty = true;+ }+ return;+ }+ cur = n.parent;+ }+ }++ /// Scroll the innermost scroll container along `path` that can move.+ fn scroll_by(&mut self, path: &[String], dy: f32, horizontal: bool) {+ let Some(f) = &self.frame else { return };+ for key in path.iter().rev() {+ let Some(&i) = f.by_key().get(key) else { continue };+ let n = &f.nodes[i];+ let (rx, ry) = n.scroll_range;+ let (sx, sy) = n.scroll_pos;+ let (nx, ny) = if horizontal || ry <= 0.0 {+ ((sx + dy).clamp(0.0, rx), sy)+ } else {+ (sx, (sy + dy).clamp(0.0, ry))+ };+ if (nx, ny) != (sx, sy) {+ self.state.scroll.insert(key.clone(), (nx, ny));+ self.dirty = true;+ return;+ }+ }+ }++ fn widget_event(&mut self, ev: RawEvent, app: &mut App) {+ if self.widgets.syncing {+ return;+ }+ let Some(key) = self.widgets.key_of(ev.node) else { return };+ match ev.kind {+ sys::BK_EV_CHANGE => {+ let e = self.widgets.read(&key);+ let kind = self.widgets.nodes.get(&key).map(|w| w.spec.kind);+ match kind {+ Some(WKind::Checkbox) => {+ self.state.checked.insert(key.clone(), e.checked);+ }+ Some(WKind::Radio) if e.checked => {+ self.state.checked.insert(key.clone(), true);+ for other in self.widgets.radio_group(&key) {+ self.state.checked.insert(other.clone(), false);+ self.widgets.set_value(&other, 0.0);+ }+ }+ _ => {}+ }+ let ls = self.bubble(&key, |l| l.input.clone());+ self.fire(app, ls, &e);+ let ls = self.bubble(&key, |l| l.change.clone());+ self.fire(app, ls, &e);+ self.dirty = true;+ }+ sys::BK_EV_CLICK => {+ let (x, y) = self.pointer;+ let down = MouseDownEvent { button: MouseButton::Left, position: point(px(x), px(y)),+ modifiers: Modifiers::default(), click_count: 1 };+ let up = MouseUpEvent { button: MouseButton::Left, position: point(px(x), px(y)),+ modifiers: Modifiers::default() };+ let ls = self.bubble(&key, |l| l.click.clone());+ self.fire(app, ls, &ClickEvent { down, up });+ self.dirty = true;+ }+ _ => {}+ }+ }+}++impl crate::layout::BoxNode {+ fn clone_hover(&self) -> Vec<Listener<bool>> {+ self.el.as_ref().map(|e| e.listeners.hover.clone()).unwrap_or_default()+ }+}++/// Marker so `Window` is not `Send` (it holds raw kit pointers).+#[allow(dead_code)]+struct NotSend(PhantomData<*const ()>);diff --git a/bindings/rust/blenderui/tests/headless.rs b/bindings/rust/blenderui/tests/headless.rsnew file mode 100644index 0000000..4d571e5--- /dev/null+++ b/bindings/rust/blenderui/tests/headless.rs@@ -0,0 +1,215 @@+//! Off-screen windows: layout, painting and interaction end to end.++use blenderui::prelude::*;++fn pixel(img: &(usize, usize, Vec<u32>), x: usize, y: usize) -> u32 {+ img.2[y * img.0 + x]+}++fn open<V: Render>(cx: &mut App, w: f32, h: f32, v: V) -> WindowHandle<V> {+ let opts = WindowOptions {+ window_bounds: Some(WindowBounds::Windowed(Bounds {+ origin: point(px(0.0), px(0.0)),+ size: size(px(w), px(h)),+ })),+ ..Default::default()+ };+ cx.open_window(opts, |_, cx| cx.new(|_| v)).unwrap()+}++struct Boxes;++impl Render for Boxes {+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {+ body()+ .m_0()+ .child(div().id("red").w(px(50.0)).h(px(30.0)).bg(rgb(0xff0000)))+ .child(+ div().id("row").flex().gap(px(10.0)).child(div().id("a").size(px(20.0)).bg(rgb(0x00ff00)))+ .child(div().id("b").flex_1().h(px(20.0)).bg(rgb(0x0000ff))),+ )+ .child(div().id("styled").style("width: 40px; height: 10px; background: #ffff00; margin-left: 5px"))+ }+}++#[test]+fn block_and_flex_layout_paint() {+ Application::headless().run(|cx| {+ let win = open(cx, 200.0, 100.0, Boxes);+ let id = win.id;+ let img = cx.draw(id);+ assert!(img.0 > 0);+ let s = img.0 as f32 / 200.0; // device pixels per logical pixel+ let b = cx.element_bounds(id, "red").unwrap();+ assert_eq!((b.origin.x, b.origin.y, b.size.width, b.size.height), (0.0, 0.0, 50.0, 30.0));+ let a = cx.element_bounds(id, "a").unwrap();+ let bb = cx.element_bounds(id, "b").unwrap();+ assert_eq!(a.origin.y, 30.0);+ assert_eq!(bb.origin.x, 30.0);+ assert_eq!(bb.size.width, 170.0);+ let st = cx.element_bounds(id, "styled").unwrap();+ assert_eq!((st.origin.x, st.origin.y, st.size.width), (5.0, 50.0, 40.0));+ let at = |x: f32, y: f32| pixel(&img, (x * s) as usize, (y * s) as usize);+ assert_eq!(at(10.0, 10.0), 0xff0000);+ assert_eq!(at(35.0, 40.0), 0x0000ff);+ assert_eq!(at(10.0, 40.0), 0x00ff00);+ assert_eq!(at(20.0, 55.0), 0xffff00);+ assert_eq!(at(150.0, 90.0), 0x303030); // html background+ });+}++struct Counter {+ count: i32,+ changed: String,+}++impl Render for Counter {+ fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ div()+ .child(+ div().id("plus").w(px(60.0)).h(px(20.0)).bg(rgb(0x4772b3))+ .hover(|s| s.bg(rgb(0xffffff)))+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {+ this.count += 1;+ cx.notify();+ })),+ )+ .child(p().id("label").child(format!("count {}", self.count)))+ .child(button().id("btn").child("Add").on_click(cx.listener(|this, _: &ClickEvent, _, cx| {+ this.count += 10;+ cx.notify();+ })))+ .child(input().id("check").input_type("checkbox").on_change(cx.listener(+ |this, e: &ChangeEvent, _, cx| {+ this.changed = format!("checked={}", e.checked);+ cx.notify();+ },+ )))+ }+}++#[test]+fn clicks_hover_and_widgets() {+ Application::headless().run(|cx| {+ let win = open(cx, 300.0, 200.0, Counter { count: 0, changed: String::new() });+ let id = win.id;+ cx.draw(id);+ let plus = cx.element_bounds(id, "plus").unwrap();+ cx.simulate_click(id, plus.origin.x + 5.0, plus.origin.y + 5.0);+ cx.simulate_click(id, plus.origin.x + 5.0, plus.origin.y + 5.0);+ assert_eq!(win.root().read(cx).count, 2);+ // :hover style from .hover(|s| ...)+ let img = cx.draw(id);+ let s = img.0 as f32 / 300.0;+ let at = |x: f32, y: f32| pixel(&img, (x * s) as usize, (y * s) as usize);+ assert_eq!(at(plus.origin.x + 30.0, plus.origin.y + 10.0), 0xffffff);+ // a real Blender button+ let btn = cx.element_bounds(id, "btn").unwrap();+ assert!(btn.size.width > 20.0 && btn.size.height >= 18.0, "{btn:?}");+ cx.simulate_click(id, btn.origin.x + btn.size.width / 2.0, btn.origin.y + btn.size.height / 2.0);+ assert_eq!(win.root().read(cx).count, 12);+ let check = cx.element_bounds(id, "check").unwrap();+ cx.simulate_click(id, check.origin.x + 8.0, check.origin.y + check.size.height / 2.0);+ assert_eq!(win.root().read(cx).changed, "checked=true");+ });+}++struct Page;++impl Render for Page {+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {+ html()+ .child(head().child(style().child(+ "body { margin: 0 } .card > p:first-child { color: #ff0000 } #wrap { width: 100px; }+ ul li:nth-child(2) { height: 33px } @media (max-width: 100px) { #wrap { width: 1px } }",+ )))+ .child(body().child(+ div().id("wrap")+ .child(div().class("card").child(p().id("first").child("one two three four five six seven")))+ .child(ul().child(li().child("a")).child(li().id("second").child("b"))),+ ))+ }+}++#[test]+fn stylesheets_and_inline_wrapping() {+ Application::headless().run(|cx| {+ let win = open(cx, 400.0, 300.0, Page);+ let id = win.id;+ cx.draw(id);+ let wrap = cx.element_bounds(id, "wrap").unwrap();+ assert_eq!(wrap.size.width, 100.0);+ let first = cx.element_bounds(id, "first").unwrap();+ // seven words cannot fit 100px on one line: they wrap+ assert!(first.size.height > 30.0, "{first:?}");+ let second = cx.element_bounds(id, "second").unwrap();+ assert_eq!(second.size.height, 33.0);+ });+}++struct Tables;++impl Render for Tables {+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {+ body().m_0()+ .child(style().child("#t { border-spacing: 10px 4px; width: 200px } caption { caption-side: bottom }+ #g { display: grid; grid: auto-flow 30px / 50px 50px; width: 100px }"))+ .child(table().id("t")+ .child(caption().id("cap").child("cap"))+ .child(tbody().child(tr().id("r1").child(td().id("c1").child("a")).child(td().id("c2").child("b")))+ .child(tr().id("r2").child(td().child("c")).child(td().child("d")))))+ .child(div().id("g").children((0..4).map(|k| div().id(format!("g{k}")))))+ }+}++#[test]+fn tables_captions_and_grid_shorthand() {+ Application::headless().run(|cx| {+ let win = open(cx, 300.0, 300.0, Tables);+ let id = win.id;+ cx.draw(id);+ let c1 = cx.element_bounds(id, "c1").unwrap();+ let c2 = cx.element_bounds(id, "c2").unwrap();+ let r1 = cx.element_bounds(id, "r1").unwrap();+ let r2 = cx.element_bounds(id, "r2").unwrap();+ assert_eq!(c1.origin.x, 10.0, "spacing pads the table");+ assert_eq!(c2.origin.x - (c1.origin.x + c1.size.width), 10.0, "horizontal spacing");+ assert_eq!(r2.origin.y - (r1.origin.y + r1.size.height), 4.0, "vertical spacing");+ let cap = cx.element_bounds(id, "cap").unwrap();+ assert!(cap.origin.y > r2.origin.y, "caption-side: bottom");+ let g3 = cx.element_bounds(id, "g3").unwrap();+ assert_eq!((g3.origin.x - cx.element_bounds(id, "g").unwrap().origin.x, g3.size.height), (50.0, 30.0));+ });+}++struct Paint;++impl Render for Paint {+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {+ body().m_0().child(+ canvas(|b, p| {+ p.fill(b, rgb(0x232323));+ p.quad(b, 6.0, rgba(0x4772b380), rgb(0x4772b3), 1.0);+ p.line(&[(b.origin.x, b.origin.y), (b.origin.x + 80.0, b.origin.y + 40.0)], white(), 2.0);+ p.oval(Bounds { origin: point(150.0, 10.0), size: size(20.0, 20.0) }, red(), black(), 1.0);+ p.text(b.origin.x + 4.0, b.origin.y + 4.0, "hello", 13.0, white());+ })+ .id("cv")+ .w(px(200.0))+ .h(px(100.0)),+ )+ }+}++#[test]+fn canvas_painter() {+ Application::headless().run(|cx| {+ let win = open(cx, 220.0, 120.0, Paint);+ let img = cx.draw(win.id);+ let s = img.0 as f32 / 220.0;+ let at = |x: f32, y: f32| pixel(&img, (x * s) as usize, (y * s) as usize);+ assert_eq!(cx.element_bounds(win.id, "cv").unwrap().size.width, 200.0);+ assert_eq!(at(160.0, 20.0), 0xff0000, "oval");+ assert_ne!(at(100.0, 80.0), 0x303030, "filled");+ });+}diff --git a/bindings/rust/blenderui/tests/parity.rs b/bindings/rust/blenderui/tests/parity.rsnew file mode 100644index 0000000..bd758ee--- /dev/null+++ b/bindings/rust/blenderui/tests/parity.rs@@ -0,0 +1,70 @@+//! Coverage of HTML elements and CSS properties (the numbers in the README).+//! `cargo test --test parity -- --nocapture` prints the report.++use blenderui::html::{tag_kind, TagKind, HTML_ELEMENT_COUNT, TAGS};+use blenderui::style::{implemented_properties, is_implemented, is_supported, ACCEPTED};++/// The CSS 2.1 property index minus aural (speech) and paged-media properties:+/// everything CSS 2.1 defines for screens.+const CSS21_VISUAL: &[&str] = &[+ "background-attachment", "background-color", "background-image", "background-position",+ "background-repeat", "background", "border-collapse", "border-color", "border-spacing",+ "border-style", "border-top", "border-right", "border-bottom", "border-left",+ "border-top-color", "border-right-color", "border-bottom-color", "border-left-color",+ "border-top-style", "border-right-style", "border-bottom-style", "border-left-style",+ "border-top-width", "border-right-width", "border-bottom-width", "border-left-width",+ "border-width", "border", "bottom", "caption-side", "clear", "clip", "color", "content",+ "counter-increment", "counter-reset", "cursor", "direction", "display", "empty-cells", "float",+ "font-family", "font-size", "font-style", "font-variant", "font-weight", "font", "height", "left",+ "letter-spacing", "line-height", "list-style-image", "list-style-position", "list-style-type",+ "list-style", "margin-right", "margin-left", "margin-top", "margin-bottom", "margin",+ "max-height", "max-width", "min-height", "min-width", "outline-color", "outline-style",+ "outline-width", "outline", "overflow", "padding-top", "padding-right", "padding-bottom",+ "padding-left", "padding", "position", "quotes", "right", "table-layout", "text-align",+ "text-decoration", "text-indent", "text-transform", "top", "unicode-bidi", "vertical-align",+ "visibility", "white-space", "width", "word-spacing", "z-index",+];++/// CSS Flexible Box Layout Module Level 1.+const FLEXBOX: &[&str] = &[+ "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",+ "order", "align-content", "align-items", "align-self", "justify-content",+];++/// CSS Grid Layout Module Level 2 plus Box Alignment's gaps and place-* shorthands.+const GRID: &[&str] = &[+ "grid", "grid-area", "grid-auto-columns", "grid-auto-flow", "grid-auto-rows", "grid-column",+ "grid-column-end", "grid-column-start", "grid-row", "grid-row-end", "grid-row-start",+ "grid-template", "grid-template-areas", "grid-template-columns", "grid-template-rows", "gap",+ "row-gap", "column-gap", "justify-items", "justify-self", "place-items", "place-content",+ "place-self",+];++/// (implemented, supported): supported adds properties parsed without effect.+fn coverage(name: &str, list: &[&str]) -> (usize, usize) {+ let no_effect: Vec<&&str> = list.iter().filter(|p| !is_implemented(p)).collect();+ let unknown: Vec<&&str> = list.iter().filter(|p| !is_supported(p)).collect();+ let have = list.len() - no_effect.len();+ println!("{name}: {have}/{} rendered, {}/{} parsed; no effect: {no_effect:?}; unknown: {unknown:?}",+ list.len(), list.len() - unknown.len(), list.len());+ (have, list.len() - unknown.len())+}++#[test]+fn report() {+ let html = TAGS.iter().filter(|(t, _)| !matches!(*t, "svg" | "math")).count() + 1;+ assert_eq!(html, HTML_ELEMENT_COUNT);+ let widgets = TAGS.iter().filter(|(_, k)| *k == TagKind::Widget).count();+ println!("HTML elements: {html}/{HTML_ELEMENT_COUNT} (+ svg, math roots; {widgets} as Blender widgets)");+ assert_eq!(tag_kind("canvas"), TagKind::Replaced);+ println!("CSS properties: {} rendered, {} more parsed without effect",+ implemented_properties().count(), ACCEPTED.len());+ let (css21, css21_parsed) = coverage("CSS 2.1 (screen)", CSS21_VISUAL);+ let (flex, _) = coverage("Flexbox", FLEXBOX);+ let (grid, grid_parsed) = coverage("Grid", GRID);+ assert_eq!(flex, FLEXBOX.len());+ assert_eq!(css21_parsed, CSS21_VISUAL.len());+ assert_eq!(grid_parsed, GRID.len());+ assert!(css21 * 100 / CSS21_VISUAL.len() >= 80, "CSS 2.1 coverage fell");+ assert!(grid + 1 >= GRID.len(), "grid coverage fell");+}diff --git a/core/include/BLI_alloca.h b/core/include/BLI_alloca.hindex a364ce0..0f73ab1 100644--- a/core/include/BLI_alloca.h+++ b/core/include/BLI_alloca.h@@ -17,7 +17,9 @@#ifdef __cplusplus#define BLI_array_alloca(arr, realsize) \(std::remove_reference_t<decltype(arr)>)alloca(sizeof(*arr) * (realsize))-#else+#elif defined(__GNUC__)#define BLI_array_alloca(arr, realsize) \((typeof(arr))alloca(sizeof(*arr) * (realsize)))+#else /* C: void * converts to the target pointer type (MSVC has no typeof) */+#define BLI_array_alloca(arr, realsize) alloca(sizeof(*arr) * (realsize))#endifdiff --git a/core/include/BLI_string_utf8.h b/core/include/BLI_string_utf8.hindex 051d8ca..663f079 100644--- a/core/include/BLI_string_utf8.h+++ b/core/include/BLI_string_utf8.h@@ -60,9 +60,9 @@ int BLI_str_utf8_invalid_substitute(char *str, size_t str_len, const char substi* \note This is intended for situations when the string is expected to be valid,* where copying and substituting values is typically not needed.*/-[[nodiscard]] const char *BLI_str_utf8_invalid_substitute_if_needed(+const char *BLI_str_utf8_invalid_substitute_if_needed(const char *str, size_t str_len, const char substitute, char *buf, const size_t buf_maxncpy)- ATTR_NONNULL(1, 4);+ ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 4);/*** \return The size (in bytes) of a single UTF8 char.diff --git a/docs/images/rust-showcase.png b/docs/images/rust-showcase.pngnew file mode 100644index 0000000..37f91c3Binary files /dev/null and b/docs/images/rust-showcase.png differdiff --git a/docs/rust.md b/docs/rust.mdnew file mode 100644index 0000000..a3de112--- /dev/null+++ b/docs/rust.md@@ -0,0 +1,378 @@+# Rust: gpui syntax, HTML and CSS++The `blenderui` crate (`bindings/rust/`) gives Rust programs Blender's UI with+the syntax of [gpui](https://www.gpui.rs): views implement `Render`, elements+are built with `div().flex().gap_2().child(...)`, and listeners come from+`cx.listener(...)`. On top of gpui's model it supports **every HTML element**+and **CSS**: `<style>` sheets, selectors, the cascade, flexbox, grid, tables,+inline text that wraps, lists, `<details>`, and form controls that are real+Blender widgets.++<p align="center"><img src="images/rust-showcase.png" width="640" alt="The Rust showcase example"></p>++- [Install](#install)+- [The app model](#the-app-model)+- [Elements](#elements)+- [Styling](#styling)+- [Layout](#layout)+- [Form controls](#form-controls)+- [Events](#events)+- [Painting your own content](#painting-your-own-content)+- [Headless rendering and tests](#headless-rendering-and-tests)+- [Coverage](#coverage)+- [Performance vs gpui](#performance-vs-gpui)+- [Limitations](#limitations)+- [How it works](#how-it-works)++## Install++```toml+[dependencies]+blenderui = { git = "https://github.com/ppmpreetham/BUI" }+```++Building needs **CMake** and a **C compiler**: `blenderui-sys` compiles the C+kit with the `cmake` crate. On Windows the default Rust target+(`x86_64-pc-windows-msvc`) uses MSVC (Visual Studio Build Tools). To build+against another checkout of the C sources, set `BUI_SOURCE_DIR`.++From the repository:++```sh+cd bindings/rust+cargo run --example showcase # the window above+cargo run --example showcase -- --screenshot a.png # render it off-screen to a PNG+cargo run --example counter # the README example+cargo test # unit, coverage and headless tests+```++The workspace uses edition 2024 (Rust 1.85 or newer).++## The app model++It follows gpui closely:++| gpui | blenderui |+| ---------------------------------------- | ------------------------------------------------------------- |+| `Application::new().run(\|cx\| ...)` | the same; `Application::headless()` renders off-screen |+| `cx.open_window(options, \|window, cx\| cx.new(\|cx\| View))` | the same; returns `WindowHandle<View>` |+| `impl Render for View` | the same: `fn render(&mut self, window, cx) -> impl IntoElement` |+| `Entity<T>`, `WeakEntity<T>`, `cx.new` | the same: `read`, `update`, `downgrade`, `upgrade` |+| `Context<T>`: `notify`, `listener`, `entity` | the same; it derefs to `App` |+| `WindowOptions { window_bounds, titlebar, .. }`, `WindowBounds::Windowed(..)` | the same, plus `is_resizable`, `window_min_size` |+| `cx.set_global`, `cx.global` | the same |+| `cx.stop_propagation()` | the same |++```rust+use blenderui::prelude::*;++struct Todo { items: Vec<String>, draft: String }++impl Render for Todo {+ fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ div().p_4().flex().flex_col().gap_2()+ .child(h2().child(format!("{} items", self.items.len())))+ .child(ul().children(self.items.iter().map(|s| li().child(s.clone()))))+ .child(div().flex().gap_2()+ .child(input().id("draft").placeholder("New item").value(self.draft.clone())+ .on_change(cx.listener(|this, e: &ChangeEvent, _, cx| {+ this.draft = e.value.clone();+ cx.notify();+ })))+ .child(button().child("Add").on_click(cx.listener(|this, _, _, cx| {+ this.items.push(std::mem::take(&mut this.draft));+ cx.notify();+ }))))+ }+}+```++`cx.notify()` re-renders. Rendering builds a fresh element tree; elements with+an `.id(...)` keep their state across renders (scroll position, a text field's+contents, a checkbox you clicked, which `<details>` are open).++`Window` gives listeners `viewport_size()`, `scale_factor()`, `mouse_position()`,+`set_window_title()`, `focus_id()` / `focused_id()`, `is_hovered(id)`,+`scroll_offset(id)` / `set_scroll_offset(id, x, y)`, `refresh()` and+`request_animation_frame()` (call it from `render` to animate; frames are paced+to the display, `set_vsync(false)` lifts the cap).+A `<title>` element sets the window title too.++## Elements++There is **one element type, `Div`**, and a constructor for every element of+the WHATWG HTML index: `div()`, `span()`, `section()`, `table()`, `tr()`,+`details()`, `dialog()`, `input()`, `select()`, `video()` ... (113 elements,+plus `svg()` and `math()` as boxes). Tags only change the defaults: what the+user-agent stylesheet gives them and how they are realised.++| Kind | Elements | Realised as |+| --------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------- |+| Box | `div`, `p`, `h1`-`h6`, `a`, `span`, `ul`/`ol`/`li`, `table` ..., `details`, `dialog`, `form` ... | laid out and painted from CSS |+| Widget | `button`, `input`, `select`, `textarea`, `progress`, `meter` (+ `option`, `optgroup`, `datalist`) | Blender's own widgets ([below](#form-controls)) |+| Replaced | `img`, `video`, `audio`, `iframe`, `embed`, `object`, `canvas` | an intrinsic size; `img` shows PNG files or RGBA pixels |+| Metadata | `head`, `title`, `style`, `script`, `meta`, `link`, `template` ... | not rendered (`<style>` and `<title>` are read) |+| Break | `br`, `wbr` | line breaks |++Unknown names work too: `custom("my-widget")` is a box, like a custom element+in a browser.++Every element has `.child(..)`, `.children(..)`, `.id(..)`, `.class(..)`,+`.attr(name, value)` and typed attributes: `.href`, `.value`, `.placeholder`,+`.input_type`, `.name`, `.checked`, `.disabled`, `.selected`, `.open`, `.min`,+`.max`, `.step`, `.src`, `.alt`, `.title`, `.colspan`. `FluentBuilder` adds+`.when(cond, |el| ..)`, `.when_some(opt, |el, v| ..)` and `.map(..)`.+Text children are `&'static str`, `String` or `SharedString`.++> `main()` (the `<main>` element) has the same name as your program's+> `fn main`. Inside `fn main` call it as `blenderui::html::main()`.++The document is wrapped in `<html><body>` unless your root already is one, so+`body { margin: 0 }` and the user-agent defaults behave as in a browser. The+defaults are Blender's dark theme: `#303030` background, 13 px text, blue+links.++## Styling++Three ways, one cascade:++```rust+// 1. gpui / Tailwind methods+div().flex().items_center().gap_2().px_3().py_1().rounded_md().bg(rgb(0x3a3a3a))+ .text_color(white()).shadow_md().hover(|s| s.bg(rgb(0x4772b3)))++// 2. any CSS property+div().css("grid-template-columns", "repeat(3, 1fr)")+ .style("border-left: 3px solid #4772b3; padding: 4px 8px")++// 3. stylesheets, anywhere in the tree+style().child(".card:hover > h4 { color: #e6a23c } @media (max-width: 600px) { nav { display: none } }")+```++**`Styled` methods** (~1,300, generated from Tailwind's scales): spacing and+sizing on the spacing scale (`p_4`, `mx_auto`, `w_64`, `h_full`, `w_1_3`,+`size(px(20.0))`, `gap_x_2`), display and position (`flex`, `grid`, `block`,+`hidden`, `absolute`, `inset_0`, `z_index`), flexbox (`flex_col`, `flex_1`,+`items_center`, `justify_between`, `flex_wrap`), grid (`grid_cols(3)`,+`col_span(2)`), color (`bg`, `text_color`, `border_color`, `opacity`),+borders and corners (`border_1`, `border_t_2`, `rounded_lg`, `rounded_full`),+shadows (`shadow_sm` ... `shadow_2xl`), text (`text_sm` ... `text_6xl`,+`font_bold`, `italic`, `underline`, `uppercase`, `truncate`, `leading_tight`,+`whitespace_nowrap`), overflow (`overflow_y_scroll`) and cursors+(`cursor_pointer`). Colors: `rgb(0xRRGGBB)`, `rgba(0xRRGGBBAA)`,+`hsla(h, s, l, a)`, named helpers, or any CSS color string.++**State styles**: `.hover(|s| ..)`, `.active(|s| ..)` and `.focus(|s| ..)`+take a refinement with the same methods (they are CSS `:hover` / `:active` /+`:focus` rules for that element).++**Selectors**: type, `*`, `#id`, `.class`, attributes (`[a]`, `=`, `~=`,+`|=`, `^=`, `$=`, `*=`), combinators (descendant, `>`, `+`, `~`), and+pseudo-classes: `:hover`, `:active`, `:focus`, `:focus-within`,+`:focus-visible`, `:checked`, `:disabled`, `:enabled`, `:link`, `:any-link`,+`:required`, `:optional`, `:read-only`, `:read-write`, `:open`,+`:placeholder-shown`, `:first-child`, `:last-child`, `:only-child`,+`:first-of-type`, `:last-of-type`, `:nth-child()`, `:nth-last-child()`,+`:nth-of-type()`, `:nth-last-of-type()`, `:empty`, `:root`, `:not()`,+`:is()`, `:where()`. `@media` with width and height conditions is evaluated against the+window.++**Cascade**: user-agent sheet, then author sheets, then inline declarations+(methods, `.css`, `.style`), then state refinements; `!important` wins over+all of them, and specificity and order decide within a level. `inherit`,+`initial`, `unset` and `revert` are understood (they copy or reset the text,+color, size and display properties). Custom properties (`--name`) are+accepted but `var()` is not substituted. Units: `px`, `em`, `rem`, `%`, `vw`,+`vh`, `vmin`, `vmax`, `ch`, `ex`, `pt`, `pc`, `in`, `cm`, `mm`, `Q`, and+`calc()`, `min()`, `max()`, `clamp()`.++## Layout++Layout is computed with [taffy](https://github.com/DioxusLabs/taffy):++- **Block** flow with margins, padding, borders, `box-sizing`, min/max sizes+ and `aspect-ratio`.+- **Inline** content becomes line boxes: text breaks into words that wrap,+ inline elements (`b`, `a`, `code`, `mark` ...) style their words, and+ inline-blocks and widgets sit on the line. `white-space` (`normal`,+ `nowrap`, `pre`, `pre-wrap`, `pre-line`), `text-align`, `text-indent`,+ `letter-spacing`, `word-spacing`, `vertical-align: sub | super`,+ `text-transform` and `text-overflow: ellipsis` apply.+- **Flexbox** and **grid**: every property of both modules (except+ `grid-template-areas`), including `repeat()`, `minmax()`, `fr`,+ `auto-fill` / `auto-fit`, spans and line placement.+- **Tables**: rows and cells share the width (`colspan` weights cells),+ `border-spacing`, `border-collapse` and `caption-side` apply.+- **Positioning**: `relative`, `absolute` (and `fixed` as absolute), `inset`+ properties, `z-index` for painting and hit testing, `transform: translate()`.+- **Overflow**: `hidden` / `clip` clip, `scroll` / `auto` scroll with the+ wheel (Shift for horizontal) and show overlay scrollbars.+- **Lists**: `list-style-type` (`disc`, `circle`, `square`, `decimal`,+ `lower-alpha`, `upper-roman` ...), `list-style-position`, `<ol start>`.+- **`<details>` / `<summary>`**: clicking the summary toggles the details+ (`.open(true)` sets the initial state); `<dialog>` shows with `.open(true)`.++## Form controls++Form elements are Blender's widgets, with Blender's interaction (drag to+scrub numbers, Ctrl+Z, double-click to type, Escape to cancel):++| HTML | Blender widget | `ChangeEvent` |+| ------------------------------------------------- | ------------------------------------ | ------------------------------------- |+| `button()` with text, `input().input_type("submit" \| "button" \| "reset")` | button | `on_click` |+| `input()`: `text`, `password` (masked), `email`, `search`, `url`, `tel`, `date` ... | text field | `value` |+| `input().input_type("number")` | number field | `number`, `value` |+| `input().input_type("range")` | slider | `number`, `value` |+| `input().input_type("checkbox")` | checkbox | `checked` |+| `input().input_type("radio")` (grouped by `name`) | radio button | `checked` |+| `input().input_type("color")` | color swatch (opens Blender's picker) | `value` as `#rrggbb` |+| `select()` with `option()` / `optgroup()` | dropdown menu | `number` (index), `value` (text) |+| `textarea()` | multi-line text editor | `value` |+| `progress()`, `meter()` | progress bar | (display only) |++`on_input` and `on_change` both fire when the value changes. Values you pass+(`.value(..)`, `.checked(..)`) are pushed to the widget only when they change+between renders, so a field the user is typing in is not reset; bind it to your+state (as in the todo example) to control it. A `button()` holding elements+other than text is laid out as an ordinary box (style it with CSS) and still+gets `on_click`.++## Events++| Listener | Event | Bubbles |+| ------------------------------------------ | ------------------------------------------------------- | ------- |+| `on_click` | `ClickEvent { down, up }` (press and release on the element) | yes |+| `on_mouse_down(button, ..)`, `on_any_mouse_down` | `MouseDownEvent { button, position, modifiers, click_count }` | yes |+| `on_mouse_up(button, ..)` | `MouseUpEvent` | yes |+| `on_mouse_move` | `MouseMoveEvent { position, pressed_button, modifiers }` | yes |+| `on_hover` | `bool`: entered / left | no |+| `on_scroll_wheel` | `ScrollWheelEvent { position, delta, modifiers }` | yes |+| `on_key_down`, `on_key_up` | `KeyDownEvent { keystroke: Keystroke { key, key_char, modifiers } }` | yes (from the focused element) |+| `on_change`, `on_input` | `ChangeEvent { value, checked, number }` | yes |++Positions are logical pixels. Clicking an element focuses it; key events go+to the focused element and bubble up. `cx.stop_propagation()` stops bubbling.++## Painting your own content++`canvas(|bounds, painter| ..)` is gpui's `canvas()`: it paints with a+`Painter` in logical pixels, clipped to its box.++```rust+canvas(|b, p| {+ p.fill(b, rgb(0x232323));+ p.quad(b, 6.0, rgba(0x4772b380), rgb(0x4772b3), 1.0); // rounded rect + border+ p.line(&[(b.origin.x, b.origin.y), (b.origin.x + 80.0, b.origin.y + 40.0)], white(), 2.0);+ p.oval(Bounds { origin: point(10.0, 10.0), size: size(20.0, 20.0) }, red(), black(), 1.0);+ p.text(b.origin.x + 4.0, b.origin.y + 4.0, "hello", 13.0, white());+})+.w(px(200.0)).h(px(100.0))+```++`Painter` also has `polygon`, `arc` (pie slices), `image` (scaled) and+`with_clip`. Images: `img().src("file.png")` (PNG, decoded once and cached) or+`img().image_rgba(w, h, pixels)`.++## Headless rendering and tests++`Application::headless()` runs the same code without a native window (and is+what you get on platforms without one). Drive it from the `run` closure:++```rust+Application::headless().run(|cx| {+ let win = cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Counter { count: 0 }))+ .unwrap();+ let b = cx.element_bounds(win.id, "plus").unwrap(); // the element with .id("plus")+ cx.simulate_click(win.id, b.origin.x + 2.0, b.origin.y + 2.0);+ assert_eq!(win.root().read(cx).count, 1);+ let (w, h, pixels) = cx.draw(win.id); // 0x00RRGGBB, device pixels+});+```++Also `simulate_mouse_move`, `simulate_scroll` and `simulate_key(text, keysym)`.+The kit has global state, so one `Application` runs at a time per process+(`run` takes a lock; parallel tests queue up).++## Coverage++From `cargo test --test parity -- --nocapture`:++| Area | Coverage |+| ------------------------------------- | -------------------------------------------------------------------------------- |+| HTML elements (WHATWG index) | **113 / 113** constructible, plus `svg` / `math` roots; 9 are Blender widgets |+| CSS properties | **173** change layout or rendering; **87** more parse but have no effect |+| CSS 2.1, screen properties | **76 / 90** rendered, 90 / 90 parsed |+| Flexbox | **12 / 12** |+| Grid | **22 / 23** (no `grid-template-areas`) |+| gpui / Tailwind `Styled` methods | ~1,300 |++The CSS 2.1 properties that parse without effect: `float`, `clear`, `clip`,+`content`, `counter-increment`, `counter-reset`, `direction`,+`unicode-bidi`, `empty-cells`, `table-layout`, `list-style-image` and+`background-attachment` / `-position` / `-repeat` (there are no background+images; gradients are supported).++## Performance vs gpui++The same UI on blenderui, [gpui-fast](https://github.com/longbridge/gpui-fast)+0.1.13 and gpui 0.2.2: a window of N rounded, labelled cells that all change+every frame. Ryzen 7 5800U laptop at 60 Hz, one session, median of 3 runs.+[bindings/rust/bench](../bindings/rust/bench/README.md) has the full table and+how to re-run it.++| | blenderui | gpui-fast | gpui |+|---|---|---|---|+| 100 / 1000 animated cells | 60 / 60 fps (display cap; 500 / 97 uncapped) | 60 / 60 fps | 60 / 60 fps |+| 3000 animated cells | **32.6 fps** | 29.7 fps | 22.8 fps |+| CPU per frame at 3000 cells | 39.7 ms (all threads) | **18.4 ms** + GPU | 44.1 ms + GPU |+| RAM (working set) | **20-36 MB** | 34-65 MB + 19-24 MB GPU | 33-78 MB + 16-21 MB GPU |+| First frame after launch | **~6 ms** | ~205 ms | ~220 ms |++blenderui leads on frame rate in the heavy scene, memory and startup.+gpui-fast does the least CPU work per frame. blenderui rasterises on the CPU+in parallel bands (`BUI_RASTER_THREADS=1` forces one thread). `BUI_PROFILE=1`+prints its per-phase frame times.++## Limitations++- **No floats** (`float` is ignored), no `::before` / `::after` or generated+ content, no right-to-left text.+- **One font face**: the UI font in regular, bold and italic. `font-family`+ is parsed but `monospace` text uses the UI font.+- **Transforms**: `translate` only; `scale()` and `rotate()` are ignored.+- **No `var()`**: custom properties are accepted but not substituted.+- **Inline boxes** paint their background per word; borders and padding on+ inline elements (`<kbd>`, `<code>`) are not drawn.+- **Widgets draw above page content**, so a `z-index`ed box (a `<dialog>`)+ over a form field does not cover the field.+- **Images**: PNG only, nearest-neighbour scaling. `video`, `audio`,+ `iframe` show a placeholder.+- **Windows** are native on Windows; elsewhere use `Application::headless()`+ until the Linux and macOS window hosts exist.+- `text-align: justify` aligns left; `<table>` columns are equal-width+ (weighted by `colspan`) rather than sized to their content.++## How it works++```+ Render::render ─► element tree (one Div type for every tag)+ │+ cascade: UA sheet ▸ <style> sheets ▸ inline ▸ :hover/:active/:focus ▸ !important+ │ one handler table applies every property+ box tree: blocks, line boxes of words, flex/grid items, tables as flex+ │+ taffy layout ─► absolute boxes, clips, scroll offsets+ │+ paint ─► one display list on a kit canvas form controls ─► kit widget nodes,+ │ (rects, rounded rects, text, images) placed at their boxes+ ▼+ C kit: input, hit testing, Blender widget drawing, damage rendering, Win32 window+```++- `blenderui-sys` is the raw FFI over `kit/include/BUI_kit.h`; its build script+ builds the C kit with CMake and links it statically.+- Every style source (methods, `.css`, `.style`, sheets, the user-agent sheet,+ state refinements) becomes CSS declarations applied by one table of property+ handlers, so a property has exactly one implementation.+- Each render rebuilds the display list and reconciles widget nodes by key,+ re-rendering after events (on the next turn of the native message loop).diff --git a/gpu/include/GPU_raster.h b/gpu/include/GPU_raster.hindex f390d5d..fbbb0e4 100644--- a/gpu/include/GPU_raster.h+++ b/gpu/include/GPU_raster.h@@ -173,6 +173,24 @@ int BUI_raster_text(BuiRaster *r,int BUI_text_measure(const char *family, int flags, float size, const char *utf8, int len, float *r_width);+/* Parallel rasterisation. A view draws into `src`'s pixels, clipped to+ * src's clip and the rectangle [x0, x1) x [y0, y1); views over disjoint+ * rectangles may be drawn into from different threads. `dst` points at+ * BUI_raster_view_size() bytes. Views only draw: no frames, damage or present. */+size_t BUI_raster_view_size(void);+void BUI_raster_view(const BuiRaster *src, BuiRaster *dst, int x0, int y0, int x1, int y1);++/* Text in two steps so the drawing can run on several threads: prepare+ * (one thread; builds the glyph mask) and draw the prepared run (any thread,+ * read-only). Prepared runs stay valid while BUI_text_generation() is+ * unchanged. Prepare returns NULL when there is nothing to draw or no native+ * text engine. */+typedef struct BuiTextRun BuiTextRun;+const BuiTextRun *BUI_text_prepare(+ const char *family, int flags, float size, const char *utf8, int len, float *r_width);+unsigned BUI_text_generation(void);+void BUI_raster_text_run(BuiRaster *r, float x, float y, const BuiTextRun *run, const float rgba[4]);+/* A BuiGpuSink that renders into `r` (user pointer is the raster). */const BuiGpuSink *BUI_raster_sink(BuiRaster *r);diff --git a/gpu/intern/gpu_raster.c b/gpu/intern/gpu_raster.cindex 0b63e39..84d1c62 100644--- a/gpu/intern/gpu_raster.c+++ b/gpu/intern/gpu_raster.c@@ -294,6 +294,20 @@ void BUI_raster_invalidate(BuiRaster *r)r->full_damage = 1;}+size_t BUI_raster_view_size(void)+{+ return sizeof(BuiRaster);+}++void BUI_raster_view(const BuiRaster *src, BuiRaster *dst, int x0, int y0, int x1, int y1)+{+ *dst = *src; /* shares the pixels; drawing only touches pix inside the clip */+ dst->cx0 = clampi(x0 > src->cx0 ? x0 : src->cx0, 0, src->w);+ dst->cy0 = clampi(y0 > src->cy0 ? y0 : src->cy0, 0, src->h);+ dst->cx1 = clampi(x1 < src->cx1 ? x1 : src->cx1, dst->cx0, src->w);+ dst->cy1 = clampi(y1 < src->cy1 ? y1 : src->cy1, dst->cy0, src->h);+}+void BUI_raster_set_clip(BuiRaster *r, int x, int y, int w, int h){if (w <= 0 || h <= 0) {@@ -1332,9 +1346,11 @@ typedef struct TextRun {# define RUN_MAX_FILL 6000static TextRun *g_runs = NULL;static int g_run_count = 0;+static unsigned g_text_gen = 1; /* bumped whenever runs or fonts are freed */static void runs_flush(void){+ g_text_gen++;if (!g_runs) {return;}@@ -1348,6 +1364,7 @@ static void runs_flush(void)static void fonts_flush(void){+ g_text_gen++;for (int i = 0; i < g_font_count; i++) {DeleteObject(g_fonts[i].font);}@@ -1564,6 +1581,37 @@ int BUI_text_measure(return 1;}+unsigned BUI_text_generation(void)+{+ return g_text_gen;+}++const BuiTextRun *BUI_text_prepare(+ const char *family, int flags, float size, const char *utf8, int len, float *r_width)+{+ if (r_width) {+ *r_width = 0.0f;+ }+ if (len <= 0) {+ return NULL;+ }+ const int f = font_get(family, flags, size);+ if (f < 0) {+ return NULL;+ }+ TextRun *e = run_get(f, utf8, len);+ if (!e) {+ return NULL;+ }+ if (r_width) {+ *r_width = e->advance;+ }+ if (!e->built) {+ run_build(e);+ }+ return e->mask ? (const BuiTextRun *)e : NULL; /* NULL: whitespace-only */+}+int BUI_raster_text(BuiRaster *r,float x,float y,@@ -1575,26 +1623,25 @@ int BUI_raster_text(BuiRaster *r,if (len <= 0) {return 1;}- const int f = font_get(r->font_family, r->font_flags, size);- if (f < 0) {- return 0;- }- TextRun *e = run_get(f, utf8, len);- if (!e) {+ if (font_get(r->font_family, r->font_flags, size) < 0) {return 0;}- if (!e->built) {- run_build(e);- }- if (!e->mask) {- return 1; /* whitespace-only or empty */+ const BuiTextRun *run = BUI_text_prepare(r->font_family, r->font_flags, size, utf8, len, NULL);+ if (run) {+ BUI_raster_text_run(r, x, y, run, rgba);}+ return 1;+}++void BUI_raster_text_run(BuiRaster *r, float x, float y, const BuiTextRun *run, const float rgba[4])+{+ const TextRun *e = (const TextRun *)run;const Paint p = paint_from(rgba);- if (p.a <= 0) {- return 1;+ if (!e || !e->mask || p.a <= 0) {+ return;}const int dx = (int)floorf(x + 0.5f) - e->ox;- const int dy = (int)floorf(y + 0.5f) - g_fonts[f].ascent;+ const int dy = (int)floorf(y + 0.5f) - g_fonts[e->font].ascent;const int x0 = clampi(dx, r->cx0, r->cx1), x1 = clampi(dx + e->mw, r->cx0, r->cx1);const int y0 = clampi(dy, r->cy0, r->cy1), y1 = clampi(dy + e->mh, r->cy0, r->cy1);for (int py = y0; py < y1; py++) {@@ -1614,7 +1661,6 @@ int BUI_raster_text(BuiRaster *r,}}}- return 1;}int BUI_raster_present_native(BuiRaster *r, void *window_handle, int full)@@ -1725,6 +1771,34 @@ int BUI_raster_present_native(BuiRaster *r, void *window_handle, int full)return 0;}+unsigned BUI_text_generation(void)+{+ return 1;+}++const BuiTextRun *BUI_text_prepare(+ const char *family, int flags, float size, const char *utf8, int len, float *r_width)+{+ (void)family;+ (void)flags;+ (void)size;+ (void)utf8;+ (void)len;+ if (r_width) {+ *r_width = 0.0f;+ }+ return NULL;+}++void BUI_raster_text_run(BuiRaster *r, float x, float y, const BuiTextRun *run, const float rgba[4])+{+ (void)r;+ (void)x;+ (void)y;+ (void)run;+ (void)rgba;+}+#endif/** \} */diff --git a/kit/include/BUI_kit.h b/kit/include/BUI_kit.hindex 5bfb735..9bdecc4 100644--- a/kit/include/BUI_kit.h+++ b/kit/include/BUI_kit.h@@ -212,8 +212,12 @@ typedef struct BKCanvasItem {const unsigned char *rgba; /* images: iw * ih RGBA pixels */int iw, ih;int hidden;+ int text_flags; /* BUI_FONT_BOLD | ITALIC | UNDERLINE */+ int clip_on; /* clip the item to `clip` (x, y, w, h in canvas space) */+ float clip[4];} BKCanvasItem;void BK_canvas_set_item(BKNode *canvas, const BKCanvasItem *item); /* insert or replace by id */+void BK_canvas_add_item(BKNode *canvas, const BKCanvasItem *item); /* append, ids not checked */void BK_canvas_delete(BKNode *canvas, int id); /* id < 0: all */void BK_canvas_raise(BKNode *canvas, int id, int to_top);int BK_canvas_count(BKNode *canvas);@@ -313,6 +317,9 @@ typedef struct BKWindowCallbacks {void *data;void (*on_timer)(void *data, BKWindow *win, int id); /* BK_window_timer fired */int (*on_close)(void *data, BKWindow *win); /* return 0 to keep it open */+ /* BK_window_request_frame: called right before the frame renders, so a host+ * can rebuild its UI for exactly the frame that presents it. */+ void (*on_frame)(void *data, BKWindow *win);} BKWindowCallbacks;int BK_window_supported(void);BKWindow *BK_window_new(BKContext *ctx, const char *title, int width, int height);@@ -328,6 +335,9 @@ BuiRaster *BK_window_raster(BKWindow *win);int BK_window_frames(BKWindow *win);void BK_window_render_now(BKWindow *win);int BK_window_timer(BKWindow *win, int ms); /* one-shot; returns its id */+/* Ask for an animation frame: `on_frame` runs before the next render. With+ * `vsync`, consecutive frames are paced to the display's refresh. */+void BK_window_request_frame(BKWindow *win, int vsync);void BK_window_cancel_timer(BKWindow *win, int id);void *BK_window_handle(BKWindow *win); /* HWND *//* Window-manager requests (Tk's wm): "pos" (x, y), "minsize"/"maxsize" (w, h),diff --git a/kit/intern/kit_core.c b/kit/intern/kit_core.cindex 8a0e969..1d927f6 100644--- a/kit/intern/kit_core.c+++ b/kit/intern/kit_core.c@@ -759,6 +759,7 @@ static const struct {{"line", NF_LINE, false}, {"bold", NF_BOLD, true},{"events", NF_EVENTS, false}, {"nopropagate", NF_NOPROPAGATE, true},{"viewevents", NF_VIEWEVENTS, false}, {"noscrollbar", NF_NOSCROLLBAR, true},+ {"opaque", NF_OPAQUE, false},};static int g_view_watchers; /* > 0 once any node asked for view events */@@ -1749,7 +1750,9 @@ static void draw_region(BKContext *ctx, const BKRect *rect)const int w = ctx->win_w, h = ctx->win_h;bk_clip_reset(w, h);bk_clip_push(rect->xmin, rect->ymin, bk_rw(rect), bk_rh(rect));- bk_fill(rect->xmin, rect->ymin, bk_rw(rect), bk_rh(rect), bk_theme.region_bg);+ if (!(ctx->root && (ctx->root->flags & NF_OPAQUE))) {+ bk_fill(rect->xmin, rect->ymin, bk_rw(rect), bk_rh(rect), bk_theme.region_bg);+ }const int top = ctx->header_h, view_h = h - top;bk_clip_push(0, top, w, view_h);if (ctx->root) {diff --git a/kit/intern/kit_frame.c b/kit/intern/kit_frame.cindex 27cf4b2..35a65eb 100644--- a/kit/intern/kit_frame.c+++ b/kit/intern/kit_frame.c@@ -16,6 +16,20 @@#include "kit_intern.h"+#ifdef _WIN32+# ifndef WIN32_LEAN_AND_MEAN+# define WIN32_LEAN_AND_MEAN+# endif+# ifndef NOMINMAX+# define NOMINMAX+# endif+# if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0601+# undef _WIN32_WINNT+# define _WIN32_WINNT 0x0601 /* thread pool work objects */+# endif+# include <windows.h>+#endif+static int u(void){return bk_unit();@@ -772,13 +786,13 @@ static int canvas_find(CanvasData *d, int id)return -1;}-void BK_canvas_set_item(BKNode *n, const BKCanvasItem *item)+static void canvas_store(BKNode *n, const BKCanvasItem *item, bool replace){if (n->cls != &bk_cls_canvas) {return;}CanvasData *d = CANVAS(n);- int i = canvas_find(d, item->id);+ int i = replace ? canvas_find(d, item->id) : -1;if (i < 0) {if (d->n == d->cap) {d->cap = d->cap ? d->cap * 2 : 16;@@ -802,6 +816,17 @@ void BK_canvas_set_item(BKNode *n, const BKCanvasItem *item)bk_invalidate(n);}+void BK_canvas_set_item(BKNode *n, const BKCanvasItem *item)+{+ canvas_store(n, item, true);+}++/* Rebuilding a whole display list (immediate-mode hosts): no id lookup. */+void BK_canvas_add_item(BKNode *n, const BKCanvasItem *item)+{+ canvas_store(n, item, false);+}+void BK_canvas_delete(BKNode *n, int id){CanvasData *d = CANVAS(n);@@ -857,7 +882,17 @@ static void draw_polyline(const float *pts, int npts, float ox, float oy, const}}-static void canvas_item_draw(const CItem *ci, float ox, float oy)+/* Per-item data computed before drawing (one thread): the rows an item can+ * touch, and its prepared text. */+typedef struct ItemPrep {+ float y0, y1;+ const BuiTextRun *run;+ float tx, ty;+} ItemPrep;++/* Draw one item into `r`. With `prep`, text uses the prepared run (safe on+ * any thread); without it, text is prepared here. */+static void canvas_item_draw(BuiRaster *r, const CItem *ci, float ox, float oy, const ItemPrep *prep){const BKCanvasItem *it = &ci->it;if (it->hidden) {@@ -866,7 +901,6 @@ static void canvas_item_draw(const CItem *ci, float ox, float oy)const float *p = ci->coords;const float lw = it->width > 0 ? it->width : 1.0f;const bool fill = it->fill[3] > 0, outline = it->outline[3] > 0;- BuiRaster *r = bk_draw.r;switch (it->type) {case BK_ITEM_RECT:case BK_ITEM_ROUNDRECT: {@@ -875,7 +909,11 @@ static void canvas_item_draw(const CItem *ci, float ox, float oy)}const float x0 = BK_MIN(p[0], p[2]), y0 = BK_MIN(p[1], p[3]);const float w = fabsf(p[2] - p[0]), h = fabsf(p[3] - p[1]);- if (it->type == BK_ITEM_ROUNDRECT || it->radius > 0) {+ if ((it->type == BK_ITEM_ROUNDRECT || it->radius > 0) && fill && !outline) {+ /* fill only: the span-filled rounded rect (AA work on the rim only) */+ BUI_raster_round_rect(r, ox + x0, oy + y0, w, h, it->radius, it->fill);+ }+ else if (it->type == BK_ITEM_ROUNDRECT || it->radius > 0) {BuiWidgetBase wb = {{ox + x0, oy + y0, w, h}, it->radius, BK_MAX(0, it->radius - lw), CNR_ALL};if (fill) {memcpy(wb.inner1, it->fill, sizeof(float[4]));@@ -965,15 +1003,22 @@ static void canvas_item_draw(const CItem *ci, float ox, float oy)const float size = it->size > 0 ? it->size : bk_font_size();const int len = (int)strlen(ci->text);float tw = 0;- BUI_text_measure("", 0, size, ci->text, len, &tw);+ if (!(it->anchor & BK_ANCHOR_W)) { /* the width only moves centred / right text */+ BUI_text_measure("", it->text_flags, size, ci->text, len, &tw);+ }float x = ox + p[0], y = oy + p[1];x -= anchor_off(it->anchor, (int)tw, BK_ANCHOR_W, BK_ANCHOR_E);/* y: baseline from the anchor (cap height ~0.72 em) */const float asc = size * 0.72f;y += asc - anchor_off(it->anchor, (int)asc, BK_ANCHOR_N, BK_ANCHOR_S);const float *c = it->fill[3] > 0 ? it->fill : it->outline;- BUI_raster_set_font(r, "", 0);- BUI_raster_text(r, floorf(x + 0.5f), floorf(y + 0.5f), ci->text, len, size, c);+ if (prep) {+ BUI_raster_text_run(r, prep->tx, prep->ty, prep->run, c);+ }+ else {+ BUI_raster_set_font(r, "", it->text_flags);+ BUI_raster_text(r, floorf(x + 0.5f), floorf(y + 0.5f), ci->text, len, size, c);+ }break;}case BK_ITEM_IMAGE: {@@ -983,12 +1028,209 @@ static void canvas_item_draw(const CItem *ci, float ox, float oy)const float w = (float)ci->img->w, h = (float)ci->img->h;const float x = ox + p[0] - anchor_off(it->anchor, (int)w, BK_ANCHOR_W, BK_ANCHOR_E);const float y = oy + p[1] - anchor_off(it->anchor, (int)h, BK_ANCHOR_N, BK_ANCHOR_S);- bk_image_draw(ci->img, x, y, w, h, 1.0f);+ BUI_raster_image(r, x, y, w, h, ci->img->argb, ci->img->w, ci->img->h, 1.0f);break;}}}+/* -- parallel canvas drawing ------------------------------------------------+ * Large display lists are drawn in horizontal bands on the thread pool. Each+ * band draws every item that touches it, in list order, into a view clipped+ * to the band, so the pixels equal serial drawing. Text is prepared first on+ * this thread (the glyph cache is not thread-safe); lines, arcs and outlined+ * polygons use the kit's global drawing state and keep a canvas serial. */++#define PAR_MIN_ITEMS 64++static bool item_parallel_safe(const BKCanvasItem *it)+{+ switch (it->type) {+ case BK_ITEM_LINE:+ case BK_ITEM_ARC:+ return false;+ case BK_ITEM_POLYGON:+ return !(it->outline[3] > 0);+ default:+ return true;+ }+}++/* Rows an item can touch, and its prepared text; false if text was not ready. */+static bool item_prepare(const CItem *ci, float ox, float oy, ItemPrep *pp)+{+ const BKCanvasItem *it = &ci->it;+ const float *p = ci->coords;+ const float pad = (it->width > 0 ? it->width : 1.0f) + 2.0f;+ pp->run = NULL;+ pp->y0 = 1e30f;+ pp->y1 = -1e30f;+ for (int k = 1; k < it->ncoords; k += 2) {+ pp->y0 = BK_MIN(pp->y0, oy + p[k] - pad);+ pp->y1 = BK_MAX(pp->y1, oy + p[k] + pad);+ }+ if (it->type == BK_ITEM_TEXT && ci->text && it->ncoords >= 2) {+ const float size = it->size > 0 ? it->size : bk_font_size();+ float tw = 0;+ pp->run = BUI_text_prepare("", it->text_flags, size, ci->text, (int)strlen(ci->text), &tw);+ float x = ox + p[0], y = oy + p[1];+ x -= anchor_off(it->anchor, (int)tw, BK_ANCHOR_W, BK_ANCHOR_E);+ const float asc = size * 0.72f;+ y += asc - anchor_off(it->anchor, (int)asc, BK_ANCHOR_N, BK_ANCHOR_S);+ pp->tx = floorf(x + 0.5f);+ pp->ty = floorf(y + 0.5f);+ pp->y0 = y - size * 1.5f - 2.0f;+ pp->y1 = y + size + 2.0f;+ }+ else if (it->type == BK_ITEM_IMAGE && ci->img) {+ pp->y0 = oy + p[1] - (float)ci->img->h;+ pp->y1 = oy + p[1] + (float)ci->img->h;+ }+ if (it->clip_on) {+ pp->y0 = BK_MAX(pp->y0, oy + it->clip[1] - 1.0f);+ pp->y1 = BK_MIN(pp->y1, oy + it->clip[1] + it->clip[3] + 1.0f);+ }+ return true;+}++typedef struct BandJob {+ const CanvasData *d;+ const ItemPrep *prep;+ const BuiRaster *base;+ int clip[4]; /* the canvas clip, x0 y0 x1 y1 */+ float ox, oy;+ int nbands, band_h;+ volatile long next;+} BandJob;++static void band_draw(const BandJob *j, int b)+{+ const int y0 = j->clip[1] + b * j->band_h, y1 = BK_MIN(j->clip[3], y0 + j->band_h);+ if (y1 <= y0) {+ return;+ }+ BuiRaster *view = (BuiRaster *)malloc(BUI_raster_view_size());+ if (!view) {+ return;+ }+ for (int i = 0; i < j->d->n; i++) {+ const ItemPrep *pp = &j->prep[i];+ if (pp->y1 < (float)y0 || pp->y0 >= (float)y1) {+ continue;+ }+ const CItem *ci = &j->d->items[i];+ const BKCanvasItem *it = &ci->it;+ int cx0 = j->clip[0], cy0 = y0, cx1 = j->clip[2], cy1 = y1;+ if (it->clip_on) {+ cx0 = BK_MAX(cx0, (int)floorf(j->ox + it->clip[0]));+ cy0 = BK_MAX(cy0, (int)floorf(j->oy + it->clip[1]));+ cx1 = BK_MIN(cx1, (int)floorf(j->ox + it->clip[0]) + (int)ceilf(it->clip[2]));+ cy1 = BK_MIN(cy1, (int)floorf(j->oy + it->clip[1]) + (int)ceilf(it->clip[3]));+ if (cx1 <= cx0 || cy1 <= cy0) {+ continue;+ }+ }+ BUI_raster_view(j->base, view, cx0, cy0, cx1, cy1);+ canvas_item_draw(view, ci, j->ox, j->oy, it->type == BK_ITEM_TEXT ? pp : NULL);+ }+ free(view);+}++static int par_threads(void)+{+ static int n = -1;+ if (n < 0) {+ const char *env = getenv("BUI_RASTER_THREADS");+ n = env ? atoi(env) : 0;+#ifdef _WIN32+ if (n <= 0) {+ SYSTEM_INFO si;+ GetSystemInfo(&si);+ n = (int)si.dwNumberOfProcessors;+ }+#endif+ n = BK_CLAMP(n, 1, 8);+ }+ return n;+}++#ifdef _WIN32+static BandJob g_job;+static VOID CALLBACK band_worker(PTP_CALLBACK_INSTANCE inst, PVOID ctx, PTP_WORK work)+{+ (void)inst;+ (void)work;+ BandJob *j = (BandJob *)ctx;+ long b;+ while ((b = InterlockedIncrement(&j->next) - 1) < j->nbands) {+ band_draw(j, (int)b);+ }+}+#endif++/* Draw `d` in bands on several threads; false when it has to be drawn serially. */+static bool canvas_draw_parallel(const CanvasData *d, float ox, float oy)+{+ const int threads = par_threads();+ if (threads < 2 || d->n < PAR_MIN_ITEMS) {+ return false;+ }+ for (int i = 0; i < d->n; i++) {+ if (!item_parallel_safe(&d->items[i].it)) {+ return false;+ }+ }+#ifdef _WIN32+ ItemPrep *prep = (ItemPrep *)malloc(sizeof(ItemPrep) * (size_t)d->n);+ if (!prep) {+ return false;+ }+ /* phase 1: rows and text, on this thread; redo if the glyph cache was flushed */+ bool ready = false;+ for (int attempt = 0; attempt < 3 && !ready; attempt++) {+ const unsigned gen = BUI_text_generation();+ for (int i = 0; i < d->n; i++) {+ item_prepare(&d->items[i], ox, oy, &prep[i]);+ }+ ready = BUI_text_generation() == gen;+ }+ if (!ready) {+ free(prep);+ return false;+ }+ /* phase 2: bands on the pool, this thread included */+ static PTP_WORK work = NULL;+ if (!work) {+ work = CreateThreadpoolWork(band_worker, &g_job, NULL);+ if (!work) {+ free(prep);+ return false;+ }+ }+ BandJob *j = &g_job;+ j->d = d;+ j->prep = prep;+ j->base = bk_draw.r;+ memcpy(j->clip, bk_draw.clip, sizeof(j->clip));+ j->ox = ox;+ j->oy = oy;+ j->nbands = threads * 3; /* more bands than threads: balances uneven rows */+ j->band_h = BK_MAX(1, (j->clip[3] - j->clip[1] + j->nbands - 1) / j->nbands);+ j->next = 0;+ for (int t = 1; t < threads; t++) {+ SubmitThreadpoolWork(work);+ }+ band_worker(NULL, j, NULL);+ WaitForThreadpoolWorkCallbacks(work, FALSE);+ free(prep);+ return true;+#else+ (void)ox;+ (void)oy;+ return false;+#endif+}+static void canvas_draw(BKNode *n){if (n->flags & NF_HAS_BG) {@@ -997,8 +1239,23 @@ static void canvas_draw(BKNode *n)CanvasData *d = CANVAS(n);bk_clip_push(n->x, n->y, n->w, n->h);const float ox = (float)(n->x - n->scroll_x), oy = (float)(n->y - n->scroll);+ if (bk_draw.clip[2] > bk_draw.clip[0] && bk_draw.clip[3] > bk_draw.clip[1] &&+ canvas_draw_parallel(d, ox, oy))+ {+ bk_clip_pop();+ return;+ }for (int i = 0; i < d->n; i++) {- canvas_item_draw(&d->items[i], ox, oy);+ const BKCanvasItem *it = &d->items[i].it;+ if (it->clip_on) { /* overflow: hidden / scroll containers */+ bk_clip_push((int)floorf(ox + it->clip[0]), (int)floorf(oy + it->clip[1]),+ (int)ceilf(it->clip[2]), (int)ceilf(it->clip[3]));+ canvas_item_draw(bk_draw.r, &d->items[i], ox, oy, NULL);+ bk_clip_pop();+ }+ else {+ canvas_item_draw(bk_draw.r, &d->items[i], ox, oy, NULL);+ }}bk_clip_pop();}diff --git a/kit/intern/kit_intern.h b/kit/intern/kit_intern.hindex a24d139..304849b 100644--- a/kit/intern/kit_intern.h+++ b/kit/intern/kit_intern.h@@ -275,6 +275,7 @@ enum {NF_VIEWEVENTS = 1 << 21, /* emit BK_EV_VIEW when the scrolled view changes */NF_NOSCROLLBAR = 1 << 22, /* an external scrollbar drives the view */NF_CONFIGURED = 1 << 23, /* geometry changed since the host was told (BK_EV_CONFIGURE) */+ NF_OPAQUE = 1 << 24, /* root: the host paints every pixel, skip the region clear */};typedef struct BKStrs {diff --git a/kit/intern/kit_window.c b/kit/intern/kit_window.cindex 8ccc070..45d177b 100644--- a/kit/intern/kit_window.c+++ b/kit/intern/kit_window.c@@ -37,6 +37,8 @@ struct BKWindow {BuiRaster *raster;BKWindowCallbacks cb;int render_pending, frames, cursor, tip_id, next_timer, tracking, full;+ int want_frame, frame_vsync; /* BK_window_request_frame */+ LARGE_INTEGER frame_start; /* when the last animation frame began */float scale;int min_w, min_h, max_w, max_h; /* client size limits (logical px; 0 = none) */int fixed_w, fixed_h; /* axes the user may not resize (Tk's resizable) */@@ -235,18 +237,49 @@ static void vsync(void)}}+/* Milliseconds since the current animation frame began. */+static double frame_ms(const BKWindow *win)+{+ LARGE_INTEGER now, freq;+ QueryPerformanceCounter(&now);+ QueryPerformanceFrequency(&freq);+ return (double)(now.QuadPart - win->frame_start.QuadPart) * 1000.0 / (double)freq.QuadPart;+}+static void do_render(BKWindow *win){RECT rc;GetClientRect(win->hwnd, &rc);const int w = BK_MAX(1, rc.right - rc.left), h = BK_MAX(1, rc.bottom - rc.top);const int resized = BUI_raster_width(win->raster) != w || BUI_raster_height(win->raster) != h;+ /* BUI_PROFILE: kit raster and present times, averaged over 60 frames */+ static int prof = -1;+ static double acc_render, acc_present;+ static int acc_n;+ LARGE_INTEGER t0, t1, t2, freq;+ if (prof < 0) {+ prof = getenv("BUI_PROFILE") != NULL;+ }+ QueryPerformanceCounter(&t0);const int regions = BK_render(win->ctx, win->raster, w, h, win->full);+ QueryPerformanceCounter(&t1);win->full = 0;if (regions || resized) {BUI_raster_present_native(win->raster, win->hwnd, resized);win->frames++;}+ QueryPerformanceCounter(&t2);+ if (prof) {+ QueryPerformanceFrequency(&freq);+ acc_render += (double)(t1.QuadPart - t0.QuadPart) * 1000.0 / (double)freq.QuadPart;+ acc_present += (double)(t2.QuadPart - t1.QuadPart) * 1000.0 / (double)freq.QuadPart;+ if (++acc_n == 60) {+ fprintf(stderr, "kit ms: raster %.2f present %.2f (%dx%d)\n", acc_render / 60,+ acc_present / 60, w, h);+ acc_render = acc_present = 0;+ acc_n = 0;+ }+ }if (BK_animating(win->ctx)) {vsync(); /* pace animation frames to the display */host_request(win);@@ -318,8 +351,20 @@ static LRESULT CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)BKContext *ctx = win->ctx;switch (msg) {case WM_BK_RENDER:+ if (win->want_frame && win->cb.on_frame) {+ /* render_pending is still set: edits made here join this frame */+ win->want_frame = 0;+ QueryPerformanceCounter(&win->frame_start);+ win->cb.on_frame(win->cb.data, win);+ }win->render_pending = 0;do_render(win);+ if (win->want_frame) { /* the host asked for the next frame */+ if (win->frame_vsync && frame_ms(win) < 15.0) {+ vsync(); /* early: wait for the next refresh; late: start right away */+ }+ host_request(win);+ }return 0;case WM_PAINT: {PAINTSTRUCT ps;@@ -655,6 +700,13 @@ int BK_window_timer(BKWindow *win, int ms)return id;}+void BK_window_request_frame(BKWindow *win, int vsync)+{+ win->want_frame = 1;+ win->frame_vsync = vsync;+ host_request(win);+}+void BK_window_cancel_timer(BKWindow *win, int id){if (win->hwnd) {@@ -847,6 +899,7 @@ int BK_window_timer(BKWindow *win, int ms)return 0;}void BK_window_cancel_timer(BKWindow *win, int id) {}+void BK_window_request_frame(BKWindow *win, int vsync) {}void *BK_window_handle(BKWindow *win){return NULL;