Skip to content

armgit / BUI

Public Imported from GitHub
0

Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI

feat: website & docs

Preetham Pemmasani2970b6164861
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..45e6d24
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,99 @@
+# Build and test on every platform: the C/C++ project with ctest (C kit, GPU parity,
+# window smoke, Dear ImGui, the Python bindings' suites), the Rust crates, and a
+# packaging check of the published Rust crates. macOS runs on Apple Silicon
+# (macos-14) and Intel (macos-15-intel; GitHub retired the macos-13 images).
+#
+# Wheels are built by wheels.yml.
+
+name: ci
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ workflow_dispatch:
+
+concurrency:
+ group: ci-${{ github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+jobs:
+ cmake:
+ name: cmake + ctest (${{ matrix.os }})
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 60
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-14, macos-15-intel, ubuntu-latest, windows-latest]
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.12"
+ - name: X11 headers and a virtual display (Linux)
+ if: runner.os == 'Linux'
+ run: sudo apt-get update && sudo apt-get install -y libx11-dev xvfb
+ - name: Configure
+ shell: bash
+ run: >
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
+ -DBUI_BUILD_EXAMPLES=ON -DBUI_WARNINGS_AS_ERRORS=OFF
+ -DPython3_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
+ - name: Build
+ run: cmake --build build --config Release --parallel 4
+ - name: Test (Linux, under Xvfb)
+ if: runner.os == 'Linux'
+ run: xvfb-run -a ctest --test-dir build -C Release --output-on-failure
+ - name: Test
+ if: runner.os != 'Linux'
+ run: ctest --test-dir build -C Release --output-on-failure
+ # macOS: the native window host is Cocoa (kit/intern/kit_window_cocoa.m); the
+ # smoke test opens a real window in the runner's GUI session (or skips, exit 77)
+ - name: Window smoke test, verbose (macOS)
+ if: runner.os == 'macOS'
+ run: ctest --test-dir build -C Release -R bui_window_smoke -V
+
+ rust:
+ name: cargo test (${{ matrix.os }})
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 60
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-14, macos-15-intel, ubuntu-latest, windows-latest]
+ defaults:
+ run:
+ working-directory: bindings/rust
+ steps:
+ - uses: actions/checkout@v4
+ - uses: dtolnay/rust-toolchain@stable
+ - name: X11 headers (Linux)
+ if: runner.os == 'Linux'
+ run: sudo apt-get update && sudo apt-get install -y libx11-dev
+ - name: cargo test (blenderui, blenderui-imgui)
+ run: cargo test -p blenderui -p blenderui-imgui
+ - name: cargo build (Node.js addon, QuickJS runtime)
+ run: cargo build -p blenderui-node -p blenderui-qjs
+
+ # The crates.io package of blenderui-sys builds from its vendored sources alone.
+ package:
+ name: cargo package (blenderui-sys, vendored C sources)
+ runs-on: ubuntu-latest
+ timeout-minutes: 60
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.12"
+ - uses: dtolnay/rust-toolchain@stable
+ - run: sudo apt-get update && sudo apt-get install -y libx11-dev
+ - name: Vendor the C sources and package
+ run: |
+ python bindings/rust/scripts/vendor_c.py
+ cd bindings/rust
+ cargo package -p blenderui-sys --allow-dirty
+ ls -l target/package/*.crate
diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml
index e25c0c4..3f24ac0 100644
--- a/.github/workflows/wheels.yml
+++ b/.github/workflows/wheels.yml
@@ -27,7 +27,9 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ubuntu-latest, windows-latest, macos-14, macos-13]
+ # macOS: Apple Silicon (macos-14) and Intel (macos-15-intel; the macos-13
+ # images are retired, jobs on them stay queued)
+ os: [ubuntu-latest, windows-latest, macos-14, macos-15-intel]
steps:
- uses: actions/checkout@v4
diff --git a/.gitignore b/.gitignore
index 228114d..5672f59 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ build-ui/
*.o
reference/
**/target/
+**/node_modules/
# packaging
dist/
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 09602df..aefb1ea 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -5,6 +5,28 @@ BUI is a decoupled UI toolkit extracted from the Blender project
reusable interface machinery — no Blender application logic (no scene graph,
depsgraph, nodes, operators-on-datablocks, file loading, Python).
+**What actually runs.** Every app and binding runs on **`kit/`**, a C runtime
+that re-ports Blender's interface code (widget drawing from
+`interface_widgets.cc`, interaction from `interface_handlers.cc`) and draws
+through `gpu/`'s software raster or GPU renderer:
+
+```
+ tkinter / Qt syntax / components (Python) · Rust (blenderui) · JS / React · Dear ImGui · C
+ │
+ kit/ node tree · geometry managers · input & interaction · widget drawing · menus
+ · editors · undo · animation · themes · native windows (Win32, X11, Cocoa)
+ · kit/intern/blender/ (Blender files copied in: string search, UI undo, float precision)
+ │
+ gpu/ software raster (default) or GPU renderer (Direct3D 11 / OpenGL 3.3) · text engine
+ │
+ core/ blenlib subset (math, rct, string_search.cc, expr_pylike_eval.cc ...)
+```
+
+**Blender's original sources, kept for reference.** `ui/` holds Blender's
+`editors/interface` files, compiled only with `-DBUI_BUILD_UI=ON` (off by
+default). They sit on `types/`, `compat/` and the immediate-mode seam of
+`gpu/`, as below; `kit/` doesn't use them.
+
```
┌──────────────────────────────────────────────────────────────────┐
│ ui/ widget toolkit: blocks/buttons, layout engine, │
@@ -31,7 +53,8 @@ depsgraph, nodes, operators-on-datablocks, file loading, Python).
Dependency rule: arrows point downward only. `ui/` never includes Blender
application code; everything it needs arrives through `types/`, `gpu/`, or
-`compat/`.
+`compat/`. (This diagram is the reference build; the runtime above doesn't
+include `ui/`.)
## Modules
@@ -41,17 +64,21 @@ application code; everything it needs arrives through `types/`, `gpu/`, or
| `types/` | Verbatim `DNA_*_types.h` struct definitions. `DNA_listBase.h` aliases `blender::{Link,LinkData,ListBase}` onto the core's C structs so DNA structs and the C listbase API share one type. | **Builds** |
| `gpu/` | The draw surface used by the toolkit (`GPU_*`, `imm*`) behind seam headers + a null backend that *records and forwards*: with a sink installed it emits screen-space primitives (`GPU_backend_sink.h`); without one it discards them. Theme colors reach the GPU layer through function-pointer hooks. | **Builds + tested** |
| `compat/` | Seam headers carrying upstream API names (`RNA_access.hh`, `BLF_api.hh`, …) with BUI-owned opaque types and stub implementations (`intern/bui_stubs.cc`). | **Builds** |
-| `ui/` | The toolkit sources from `editors/interface`: interface.cc family, widgets, handlers, regions, view2d, views, textbox. Option-gated (`-DBUI_BUILD_UI=ON`). | **Compiles + links** |
-| `kit/` | Blender's UI as a retained-mode C runtime: node tree, uiLayout-style layout, `interface_handlers.cc` interaction rules, widget drawing ported from `interface_widgets.cc` (widget-base shader parameters rendered by `gpu/` raster), menus, color picker, views, editors; Tk-style pack/grid/place geometry managers, canvas display list, multi-line text area; UI undo/redo, Tab field traversal, vertical multi-drag, panel animation; damage-driven rendering; native window hosts for Win32, X11 and Cocoa (`kit_window_win32.c`, `kit_window_x11.c`, `kit_window_cocoa.m`; `kit_window_null.c` elsewhere). C API: `kit/include/BUI_kit.h`. | **Builds + tested** |
+| `ui/` | The toolkit sources from `editors/interface`: interface.cc family, widgets, handlers, regions, view2d, views, textbox. Kept for reference and porting work; **not compiled by default** (`-DBUI_BUILD_UI=ON` builds it as `bui_ui`). `kit/` re-ports what it needs in C. | **Compiles + links** (opt-in) |
+| `kit/` | Blender's UI as a retained-mode C runtime: node tree, uiLayout-style layout, `interface_handlers.cc` interaction rules, widget drawing ported from `interface_widgets.cc` (widget-base shader parameters rendered by `gpu/` raster), menus, color picker, views, editors; Tk-style pack/grid/place geometry managers, canvas display list, multi-line text area; UI undo/redo, Tab field traversal, vertical multi-drag, panel animation; Blender's file browser; damage-driven rendering; Blender's Dark and Light themes (`kit_theme_presets.c`, generated by `tools/gen_theme.py` from Blender's `Blender_Dark.xml` / `Blender_Light.xml` presets over `userdef_default_theme.c`; `BK_set_theme`); native window hosts for Win32, X11 and Cocoa (`kit_window_win32.c`, `kit_window_x11.c`, `kit_window_cocoa.m`; `kit_window_null.c` elsewhere). The Win32 host is BUI's own; the X11 host follows Blender's GHOST input mapping, and the Cocoa host (experimental: checked by CI, not yet tried by hand on a Mac) is ported from GHOST's Cocoa backend. `kit/intern/blender/` holds Blender files copied in and edited for the kit (each edit marked `BUI:`): `interface_string_search.cc` (menu search with recent searches), `interface_undo.cc` (text-edit undo), `interface_utils.cc` (float display precision). C API: `kit/include/BUI_kit.h`. | **Builds + tested** |
| `api/` | `bui_c_api.h` — small stable C ABI: version info + sink/viewport plumbing for hosts and bindings. | **Builds + tested** |
| `bindings/python/` | `buipy` CPython extension (no third-party deps) + `bui` package: `bui.components` (Blender component library), `bui.qtsyntax` / `bui.tksyntax` (Qt / tkinter APIs as thin facades over the kit), `bui.host` (native or Tk windows), `SvgSink` headless renderer, `bui.qt.BuiCanvas` PySide6/PyQt6 widget. | **Builds + tested** |
-| `bindings/imgui/` | Dear ImGui (vendored, 1.93.1 WIP) on BUI: `imgui_impl_bui` platform + renderer backend hosted in a kit `custom` node (input, cursors, clipboard, DPI, damage-driven frames) drawing through `BUI_raster_mesh` and BUI textures; Blender style and Inter font. Gate: `-DBUI_BUILD_IMGUI` (ON with C++). | **Builds + tested** |
+| `bindings/imgui/` | Dear ImGui (vendored, 1.93.1 WIP) on BUI: `imgui_impl_bui` platform + renderer backend hosted in a kit `custom` node (input, cursors, clipboard, DPI, damage-driven frames) drawing through `BUI_raster_mesh` and BUI textures; Blender style and Inter font; the C API (`cimgui.h`) and the generator behind the Python and Rust bindings; the Blender-widgets build (`blender/`, `-DBUI_IMGUI_BLENDER_WIDGETS=ON`). Gate: `-DBUI_BUILD_IMGUI` (ON with C++). | **Builds + tested** |
+| `bindings/rust/` | `blenderui` (HTML/CSS/Tailwind, `rsx!` and gpui-style builders, hooks, Blender components; layout by taffy) over `blenderui-sys`; `blenderui-macros`, `blenderui-tailwind`, `blenderui-imgui`, and the JavaScript runtimes `blenderui-jsview`, `blenderui-node` (napi-rs) and `blenderui-qjs` (QuickJS). | **Builds + tested** |
+| `bindings/node/`, `bindings/react/` | `@blender-ui/native` (DOM-like API, signals) and `@blender-ui/react` (React 19.3 renderer) on `blenderui-node`. | **Builds + tested** |
| `backends/qt/` | C++ Qt backend: `BUI::QtSink` (BuiGpuSink → QPainter) + `BUI::BuiWidget` (QWidget host, no moc needed). Gate: `-DBUI_BUILD_QT_BACKEND=ON`. | **Shipped** (builds where Qt exists) |
-| `examples/` | `bui_svg_demo.c` (C, sink → SVG), `python_demo.py` (buipy → SVG). | **Builds + run** |
+| `examples/` | `kit_hello.c` (the kit in a native window), `svg_demo.c` (C, sink → SVG), `python_demo.py` (buipy → SVG), the Python, Qt, tkinter and ImGui demos, and `site/` (the website's screenshot programs). C examples need `-DBUI_BUILD_EXAMPLES=ON`. | **Builds + run** |
## Render-sink dispatch
-The null backend is the integration seam. `gpu/include/GPU_backend_sink.h`
+The null backend is the integration seam for the immediate-mode GPU API
+(`imm*`, batches) that `ui/`, `buipy.demo_scene` and the sink examples use.
+The kit doesn't draw through it (see below). `gpu/include/GPU_backend_sink.h`
defines `BuiGpuSink` — a function-pointer table (`triangles`, `lines`,
`points`, `text`, `scissor`, `begin_frame`, `end_frame`). The null backend:
@@ -65,8 +92,11 @@ defines `BuiGpuSink` — a function-pointer table (`triangles`, `lines`,
The kit itself draws through `GPU_raster.h`:
- **Software raster** (`gpu/intern/gpu_raster.c`): the default. It renders
anti-aliased SDF primitives into a CPU frame buffer, in parallel bands.
- Text is a glyph-run cache over stb_truetype, with Inter (Blender's UI
- font) embedded as the default face (`gpu/extern/font_inter.h`).
+ Text is a glyph-run cache with Inter (Blender's UI font) embedded as the
+ default face (`gpu/extern/font_inter.h`). Glyphs are rendered by the
+ vendored FreeType 2.13.3 the way Blender's BLF does (light hinting, gamma
+ 1.43, optical size; `BUI_TEXT_FREETYPE`, on by default), or by stb_truetype
+ with it off; stb_truetype also reads metrics and character maps.
`BUI_TEXT_GDI=ON` switches Windows to GDI and system fonts.
The GPU renderer draws text one quad per glyph. Slug (`K_SLUG` in
`bui_ui.hlsl`) is the default: glyph outlines are uploaded once as
@@ -95,12 +125,15 @@ primitive, after the same clip test. This follows Blender's
- Text runs and images are cached in atlases. Polygons are covered on the
CPU and uploaded as masks.
- Frames render into a persistent target, so damage rectangles still limit
- redraws. Presentation uses a flip-model swap chain with dirty rects.
+ redraws. On Windows, presentation uses a flip-model swap chain with dirty
+ rects.
- The device is created on a worker thread, and a lost device falls back
to software.
-Real renderers plug in at three levels: C (`bui_set_render_sink`), Qt/C++
-(`BUI::QtSink`), Python (`buipy.set_backend`). See INTEGRATION.md.
+Real renderers plug into the immediate-mode seam at three levels: C
+(`bui_set_render_sink`), Qt/C++ (`BUI::QtSink`), Python
+(`buipy.set_backend`). To show kit widgets in your own renderer, render the
+kit into a `BuiRaster` and blit it instead. See INTEGRATION.md.
## Build
@@ -114,7 +147,10 @@ cmake --build build-ui # + widget toolkit (bui_ui)
Options: `BUI_BUILD_PYTHON_BINDINGS` (ON; auto-skips without Python dev
files), `BUI_BUILD_QT_BACKEND` (OFF; needs Qt5/Qt6 Widgets),
-`BUI_BUILD_EXAMPLES`, `BUI_BUILD_TESTS`.
+`BUI_BUILD_EXAMPLES`, `BUI_BUILD_TESTS`, `BUI_BUILD_UI` (OFF),
+`BUI_BUILD_IMGUI`, `BUI_IMGUI_BLENDER_WIDGETS`, `BUI_TEXT_FREETYPE`,
+`BUI_TEXT_GDI`, `BUI_SLUG`, `BUI_WARNINGS_AS_ERRORS`. See
+[docs/getting-started.md](docs/getting-started.md#build-options).
Windows note: the toolchain must resolve MinGW runtime DLLs from
`/c/msys64/ucrt64/bin` **before** `/mingw64/bin` or other vendors' paths
@@ -126,11 +162,13 @@ ucrt64 dir: `export PATH="/c/msys64/ucrt64/bin:$PATH"`.
Cut entirely (Blender application logic): scene/mesh/node/depsgraph/modifiers,
animrig (only the DNA structs + a minimal `animrig::Slot` wrapper remain),
asset system, sequencer, render, Python-in-Blender, file I/O (BLO),
-eyedroppers, app-specific UI templates, window manager backends (GHOST),
-operator system.
+eyedroppers, app-specific UI templates, window manager backends (GHOST; the
+kit's X11 and Cocoa hosts re-port the parts they need), operator system.
-Remaining seams before a *hosted* toolkit (real widgets on screen) works —
-call-site counts measured from the copied sources:
+The table below is about the **`ui/` reference sources** only. `kit/` has
+real widgets on screen today; these seams are what Blender's original
+`editors/interface` code would still need to be hosted as-is. Call-site
+counts measured from the copied sources:
| Seam | Touchpoints | Notes |
|---|---|---|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 38dca1e..d9516d9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,81 @@ All notable changes to **blenderui** (BUI). The format follows
## [Unreleased]
+### Added (latest: summary)
+The newest work. Details for some items follow in the sections below.
+
+- **Dear ImGui on BUI** (`bindings/imgui/`): the real Dear ImGui 1.93.1 WIP
+ (vendored, MIT) on a BUI platform + renderer backend (`imgui_impl_bui`),
+ hosted in a kit `custom` node: BUI's windows and input, the software raster,
+ Direct3D 11 or OpenGL 3.3, damage-driven frames (idle costs nothing),
+ Blender's theme colors and metrics and the Inter font
+ (`ImGui_ImplBUI_StyleBlender`).
+ - **Bindings generated from `imgui.h`:** C (`cimgui.h`, all 399 functions,
+ CMake target `bui_cimgui`), Python (`import blenderui.imgui`, the
+ `_buiimgui` extension, 366 of 399 functions) and Rust (the
+ `blenderui-imgui` crate: FFI for 385 of 399, a safe layer for 366, and a
+ runner). C++ uses `imgui.h` unchanged (`bui::imgui`).
+ - **Blender widgets:** with `-DBUI_IMGUI_BLENDER_WIDGETS=ON` (Rust feature
+ `blender-widgets`), an edited `imgui_widgets.cpp` makes ImGui's widgets
+ Blender's: `DragFloat` is the drag-to-scrub number field, `SliderFloat`
+ the number slider, checkboxes drag-toggle, menus and combos get Blender's
+ menus. Window title bars, tooltips, plain popups, tables and the color
+ picker keep ImGui's drawing.
+ - Examples: `examples/imgui_demo.cpp`, `imgui_demo_c.c`,
+ `imgui_blender_compare.cpp`, `bindings/rust/blenderui-imgui/examples/demo.rs`.
+- **Linux GPU renderer on OpenGL 3.3 core** (`gpu/intern/gpu_gl.c`): the same
+ instances, atlases, Slug text and uber-shader as Direct3D 11, translated to
+ GLSL; GLX on the X11 window's connection, EGL (then a GLX pbuffer) offscreen;
+ `libGL`, `libEGL` and `libX11` are loaded at run time, so no GL headers are
+ needed and BUI falls back to the CPU raster where OpenGL is missing. The GPU
+ parity test passes on Mesa's software OpenGL and on an NVIDIA GPU.
+ `BUI_GPU_EGL` picks the EGL platform.
+- **macOS: a native Cocoa window host** (`kit/intern/kit_window_cocoa.m`),
+ ported from Blender's GHOST Cocoa backend, with Retina scaling. Experimental:
+ checked by CI but not yet tried by hand on a Mac (see `docs/macos-testing.md`). Python can
+ fall back to the Tk window with `BUI_HOST=tk`; JavaScript stays headless on
+ macOS.
+- **Light theme:** Blender's Dark (default) and Light presets, generated by
+ `tools/gen_theme.py` from Blender's `Blender_Dark.xml` / `Blender_Light.xml`
+ over `userdef_default_theme.c` (`kit/intern/kit_theme_presets.c`). Switch at
+ run time with `BK_set_theme("light")` (C), `bui.set_theme("light")`
+ (Python, also forwarded to the ImGui extension), `blenderui::set_theme` /
+ `Application::theme` (Rust), `new App({ theme })` / `app.setTheme` and
+ React's `render(..., { theme })` (JavaScript), or with `BUI_THEME=light`
+ without code. Widgets, panels, the region background, the `styled` HTML
+ sheet and ImGui's Blender style all follow. `BK_theme_name` /
+ `BK_theme_color` read the active theme.
+- **Three looks in Rust and JavaScript:** plain HTML now looks like a browser's
+ (black text on white, Chrome-style form controls, in Inter); `styled` gives
+ any subtree Blender's look and Blender's widgets; and ten **Blender
+ components** (`Button`, `Checkbox`, `Radio`, `NumberField`, `NumberSlider`,
+ `TextField`, `TextArea`, `ColorSwatch`, `Dropdown`, `ProgressBar`) are
+ Blender's widgets anywhere (`<NumberSlider>` in `rsx!` and JSX,
+ `NumberSlider()` in builders, `win.createElement("NumberSlider")`).
+- **CSS effects, animations and transitions** (Rust and JavaScript):
+ `@keyframes` animations and transitions (every longhand, easing functions,
+ interruptible transitions), `filter` and `backdrop-filter`, blend modes,
+ `clip-path`, masks, 2D transforms and `border-image`. Frames render only
+ while something moves; headless windows step a virtual clock.
+- **Blender's string search** (`kit/intern/blender/interface_string_search.cc`,
+ `core/intern/string_search.cc`): menu search ranks by word initials and
+ forgives typos ("ad cu" finds "Add Cube"), with Blender's recent searches
+ ranked first for short queries (`BK_recent_searches_*`).
+- **Blender's expression evaluator** (`core/intern/expr_pylike_eval.cc`): type
+ math into number fields (`2*pi`, `min(4, 3)`, `x if c else y`);
+ `BK_eval_number` from C.
+- **Text-edit undo** (`kit/intern/blender/interface_undo.cc`): Ctrl+Z /
+ Ctrl+Shift+Z inside a text field while you type.
+- **Blender's float display precision** (`kit/intern/blender/interface_utils.cc`,
+ `UI_calc_float_precision`): small values show the decimals they need.
+- **Panel animation:** panels collapse and open with Blender's animation.
+- **Documentation website:** <https://bui.preetham.top>, with tutorials per
+ language, concepts, guides, references and benchmarks, and new screenshots
+ in dark and light (`website/public/images/shots/`, regenerated by
+ `python tools/gen_doc_images.py --site`).
+- **`blenderui` on crates.io** (`cargo add blenderui`); `blenderui-imgui` is
+ used from git for now.
+
### Changed (closer to Blender 5.x)
- **Text is rendered like Blender's BLF:** BUI now vendors FreeType 2.13.3 (`gpu/extern/freetype`, CMake `BUI_TEXT_FREETYPE`, on by default) and renders as `blenfont/intern/blf_glyph.cc` does:
- light hinting;
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e54038..57843b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,6 +76,10 @@ if(BUI_BUILD_TESTS)
target_link_libraries(bui_window_smoke PRIVATE bui::kit)
add_test(NAME bui_window_smoke COMMAND bui_window_smoke)
set_tests_properties(bui_window_smoke PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 30)
+ # themes: Blender's Dark / Light presets (BK_set_theme), dark stays pixel-identical
+ add_executable(bui_theme_test tests/theme_test.c)
+ target_link_libraries(bui_theme_test PRIVATE bui::kit)
+ add_test(NAME bui_theme_test COMMAND bui_theme_test)
endif()
# before the Python bindings: they add the blenderui.imgui extension when bui_cimgui exists
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index cd267a2..bf4cd60 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -19,8 +19,9 @@ ctest --test-dir build --output-on-failure # C and Python suites
cd bindings/rust && cargo test # Rust crates
```
-You need CMake ≥ 3.20, a C11 compiler (on Windows, MSYS2 MinGW is the tested
-toolchain for the Python build) and Python 3.11+. More detail:
+You need CMake ≥ 3.20, a C11 / C++20 compiler (on Windows, MSYS2 MinGW is the
+tested toolchain for the Python build), Python 3.11+, and on Linux the X11
+headers (`libx11-dev` / `libX11-devel`). More detail:
[docs/getting-started.md](docs/getting-started.md).
## Where things live
@@ -33,6 +34,10 @@ toolchain for the Python build) and Python 3.11+. More detail:
| Rust: CSS, layout, hooks | `bindings/rust/blenderui/src/` |
| Rust: `rsx!`, `#[component]`, `tw!` | `bindings/rust/blenderui-macros/src/` |
| Tailwind utilities and variants | `bindings/rust/blenderui-tailwind/src/lib.rs` |
+| JavaScript and React | `bindings/node/`, `bindings/react/`, `bindings/rust/blenderui-node/`, `bindings/rust/blenderui-jsview/` |
+| Dear ImGui backend, bindings, Blender widgets | `bindings/imgui/` (bindings are generated by `bindings/imgui/gen/gen.py`) |
+| Themes | `tools/gen_theme.py` (generates `kit/intern/kit_theme_presets.c` from Blender's presets) |
+| Docs | `README.md`, `docs/`, and the website in `website/` (<https://bui.preetham.top>) |
[ARCHITECTURE.md](ARCHITECTURE.md) explains the module boundaries.
@@ -42,6 +47,7 @@ toolchain for the Python build) and Python 3.11+. More detail:
- C: `ctest`.
- Python: `bindings/python/tests/`. For tkinter behavior, add to the side-by-side compat suite.
- Rust: `bindings/rust/blenderui/tests/`.
+ - JavaScript: `bindings/node/test/` and `bindings/react/test/`.
- Don't let performance regress. The test suite enforces frame budgets. For
rendering or layout changes, run the benchmark in `bindings/rust/bench/`
and include before and after numbers.
diff --git a/INTEGRATION.md b/INTEGRATION.md
index c4a5d55..322a14b 100644
--- a/INTEGRATION.md
+++ b/INTEGRATION.md
@@ -1,16 +1,28 @@
# Host integration guide
-> **High-level syntax layers (recommended):** you may not need any of the
-> plumbing below. `bindings/python` ships two application-facing APIs that
-> render through BUI — **Qt syntax** (`bui.qtsyntax`) and **tkinter syntax**
-> (`bui.tksyntax`). See "High-level syntax layers" at the bottom, and
-> "Testing the Python bindings" for the one setup step they need.
-
-BUI draws; you present. The toolkit never opens a window, creates a GL
-context, or picks a UI framework. Instead, every draw call funnels through the
-**GPU seam** into a render **sink** you install. This document covers the
-three supported paths: plain C/C++, Qt (C++), and Python (PySide6/PyQt6 or
-headless).
+> **Most apps don't need this page.** The kit (`kit/`, `BUI_kit.h`) and every
+> language binding (tkinter and Qt syntax, the components, Rust, JavaScript,
+> Dear ImGui) open native windows themselves and draw into BUI's own raster or
+> GPU renderer. This page is about the **lower-level render-sink layer**: for
+> hosts that want BUI's primitives in their own renderer. See "High-level
+> syntax layers" at the bottom, and "Testing the Python bindings" for the one
+> setup step they need.
+
+## Two drawing paths
+
+| Path | Who uses it | What it draws into |
+|---|---|---|
+| **The kit's raster path** | Everything in `kit/` and every binding | A `BuiRaster`: the software raster (`gpu/intern/gpu_raster.c`) or, on a GPU window, Direct3D 11 / OpenGL instances. A native window presents it; headless code reads its pixels. |
+| **Render sinks** (this page) | `api/bui_c_api.h`, the Qt backend, `bui.svg`, `buipy.demo_scene` | Triangles, lines, points and text runs from the immediate-mode GPU seam (`gpu/intern/gpu_null.c`), handed to a `BuiGpuSink` you install |
+
+The sink layer never opens a window, creates a GL context or picks a UI
+framework: every immediate-mode draw call funnels through the **GPU seam**
+into the **sink** you install. The kit's widgets don't go through it. To show
+kit widgets inside your own window, render the kit into a `BuiRaster`
+(`BK_render`) and blit the pixels, as `bui.qt.BuiCanvas` does below.
+
+This document covers the three sink paths: plain C/C++, Qt (C++), and Python
+(PySide6/PyQt6 or headless).
```
┌────────────────────────┐
@@ -49,9 +61,11 @@ The coordinate contract: 2D positions transformed by the current model matrix
(identity matrices → pixel coordinates), colors as RGBA floats 0..1.
A complete minimal example is `examples/svg_demo.c` — it installs an SVG
-recorder and draws through the immediate-mode seam:
+recorder and draws through the immediate-mode seam. It's an example, so
+configure with `-DBUI_BUILD_EXAMPLES=ON` first:
```sh
+cmake -S . -B build -DBUI_BUILD_EXAMPLES=ON
cmake --build build --target bui_svg_demo
./build/examples/bui_svg_demo out.svg
```
@@ -112,17 +126,20 @@ canvas.show()
sys.exit(app.exec())
```
-`BuiCanvas` installs a `QtPainterBackend` for each paint pass, so the toolkit
-renders through the same QPainter path as the C++ backend — pure Python, no
-shiboken build.
+`BuiCanvas` renders each paint pass into one `buipy.Raster` in C (the same
+software raster the kit uses) and shows it with a single
+`QPainter.drawImage`: pure Python, no shiboken build. The per-primitive
+`QtPainterBackend` (which maps each triangle, line and text run onto
+`QPainter`, like the C++ backend) is still in `bui.qt` for custom use.
## High-level syntax layers
Two facades speak the syntax of established toolkits on top of the C kit
(`kit/`, exposed to Python as `buipy.KitNode` / `buipy.KitContext`): widgets
are kit nodes, layouts are the kit's C geometry managers, and windows come
-from `bui.host` (native Win32 / X11 / Cocoa windows, or Tk with
-`BUI_HOST=tk`):
+from `bui.host` (native Win32 / X11 / Cocoa windows, the Cocoa one still
+experimental, or Tk with `BUI_HOST=tk`). They use the kit's raster path, not
+render sinks:
### Qt syntax — `bui.qtsyntax`
@@ -143,12 +160,11 @@ window.show()
app.exec()
```
-Supported surface: see [SYNTAX_COVERAGE.md](SYNTAX_COVERAGE.md) for the
-exact, honest list (the daily-driver core: windows, labels, buttons,
-checkboxes, box layouts, signals, a `setStyleSheet` subset). Anything not
-yet implemented raises a clear error naming that file. The window host is
-chosen at runtime: **PySide6/PyQt6** if installed, otherwise a stdlib
-tkinter window — the same code runs either way, always rendered by BUI.
+Supported surface: see [docs/qt.md](docs/qt.md) and
+[SYNTAX_COVERAGE.md](SYNTAX_COVERAGE.md) for the exact, honest list
+(widgets, layouts, signals, `QPainter`, menus, timers, a `setStyleSheet`
+subset). Anything not yet implemented raises `AttributeError`. Neither PySide
+nor PyQt is needed: windows come from `bui.host`, as above.
### tkinter syntax — `bui.tksyntax`
@@ -160,15 +176,16 @@ root.title("BUI — tkinter syntax")
root.geometry("420x260")
status = Label(root, text="")
status.pack()
-Button(root, text="Click me", command=lambda: status.setText("Clicked!")).pack(pady=4)
+Button(root, text="Click me", command=lambda: status.config(text="Clicked!")).pack(pady=4)
Checkbutton(root, text="Enable feature").pack()
root.mainloop()
```
-Runs on the Python standard library alone. `pack(side=, padx=, pady=)`,
-`place(x=, y=)`, `config(**kw)`, `invoke()` are supported; widgets render onto
-a tk.Canvas **via the BUI sink**, so swapping the host renderer (Qt, SVG,
-custom) changes nothing in app code.
+Every public tkinter and ttk name is implemented (7,846 of 7,846); see
+[docs/tkinter.md](docs/tkinter.md). Widgets are kit nodes drawn by the kit's
+raster path in a `bui.host` window. Existing programs run unchanged with
+`python -m bui.tksyntax app.py` (or `blenderui-tk app.py` after
+`pip install blenderui`).
## Testing the Python bindings
@@ -187,12 +204,12 @@ python examples/python_demo.py # needs the interpreter CMake used
```
**2. Match the interpreter.** The extension only loads in the interpreter it
-was built for (CMake found Python 3.14 on this machine →
+was built for (if CMake found Python 3.14, it built
`buipy.cp314-win_amd64.pyd`). Check which one CMake picked and run that one:
```sh
grep Python3_EXECUTABLE build/CMakeCache.txt
-C:/Users/ppmpr/AppData/Local/Programs/Python/Python314/python.exe examples/python_demo.py
+C:/Path/Python314/python.exe examples/python_demo.py
```
To target a different interpreter, point CMake at it explicitly:
diff --git a/README.md b/README.md
index bc50486..52de0d1 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,14 @@
<div align="center">
-
-# BUI
+ <p align="center">
+ <picture>
+ <source media="(prefers-color-scheme: dark)" srcset="public/logo.png" />
+ <img alt="Zopra Logo" src="public/logo.png" width="300"/>
+ </picture>
+ </p>
+
+ <h1 align="center">
+ BUI
+ </h1>
**Blender's user interface, as a library you can use from Python, Rust, JavaScript/React, C, C++ and Dear ImGui.**
@@ -8,20 +16,13 @@ People spent decades building and optimizing Blender's GUI. It's battery and mem
[![PyPI](https://img.shields.io/pypi/v/blenderui?label=pypi%20blenderui)](https://pypi.org/project/blenderui/)
[![Python](https://img.shields.io/pypi/pyversions/blenderui)](https://pypi.org/project/blenderui/)
+[![crates.io](https://img.shields.io/crates/v/blenderui?label=crates.io%20blenderui)](https://crates.io/crates/blenderui)
[![@blender-ui/react](https://img.shields.io/npm/v/@blender-ui/react?label=%40blender-ui%2Freact)](https://www.npmjs.com/package/@blender-ui/react)
[![Wheels](https://github.com/ppmpreetham/BUI/actions/workflows/wheels.yml/badge.svg)](https://github.com/ppmpreetham/BUI/actions/workflows/wheels.yml)
-[![License: GPL-2.0-or-later](https://img.shields.io/badge/license-GPL--2.0--or--later-blue)](#license)
+[![License: GPL-2.0-or-later](https://img.shields.io/badge/license-GPL--2.0--or--later-blue)](#43-license-and-credits)
![Platforms](https://img.shields.io/badge/platforms-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)
-[What is BUI](#what-is-bui) ·
-[Quick start](#quick-start) ·
-[Features](#features) ·
-[Platforms](#platforms) ·
-[Status](#status) ·
-[Performance](#performance) ·
-[Benchmarks](#run-the-benchmarks-yourself) ·
-[Docs](#documentation) ·
-[Building](#building-from-source)
+**Website and full documentation: [bui.preetham.top](https://bui.preetham.top)**
<img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/components.png" width="330" alt="BUI's Blender components: panels, number sliders, vector fields, checkboxes and a color swatch">
<img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/tkinter_items.png" width="300" alt="An unmodified tkinter program running on BUI">
@@ -33,7 +34,82 @@ People spent decades building and optimizing Blender's GUI. It's battery and mem
> [!NOTE]
> This repository is built entirely using LLMs. No human-written code.
-## What is BUI?
+This README is a small book. Read it front to back for the whole story, or
+jump to the chapter you need. Every chapter links to a longer guide in
+[`docs/`](docs/) or on the [website](https://bui.preetham.top) when there's
+more to say.
+
+## Contents
+
+**[Part I: Welcome](#part-i-welcome)**
+
+1. [What BUI is](#1-what-bui-is)
+2. [Why BUI exists](#2-why-bui-exists)
+3. [Who it's for](#3-who-its-for)
+4. [The many ways in](#4-the-many-ways-in)
+5. [Features at a glance](#5-features-at-a-glance)
+6. [A gallery](#6-a-gallery)
+
+**[Part II: Getting started](#part-ii-getting-started)**
+
+7. [Install](#7-install)
+8. [First app: tkinter](#8-first-app-tkinter)
+9. [First app: Blender components](#9-first-app-blender-components)
+10. [First app: Qt syntax](#10-first-app-qt-syntax)
+11. [First app: Rust, in rsx and gpui builders](#11-first-app-rust-in-rsx-and-gpui-builders)
+12. [First app: JavaScript and React](#12-first-app-javascript-and-react)
+13. [First app: Dear ImGui](#13-first-app-dear-imgui)
+14. [First app: C](#14-first-app-c)
+
+**[Part III: Concepts](#part-iii-concepts)**
+
+15. [How it works](#15-how-it-works)
+16. [Blender's widgets and interactions](#16-blenders-widgets-and-interactions)
+17. [Three looks: HTML, styled and Blender components](#17-three-looks-html-styled-and-blender-components)
+18. [Rendering on the CPU and the GPU](#18-rendering-on-the-cpu-and-the-gpu)
+19. [Damage rendering](#19-damage-rendering)
+20. [Window hosts](#20-window-hosts)
+21. [Text and fonts](#21-text-and-fonts)
+22. [Themes: dark and light](#22-themes-dark-and-light)
+
+**[Part IV: Guides by language](#part-iv-guides-by-language)**
+
+23. [Python](#23-python)
+24. [Rust](#24-rust)
+25. [JavaScript and React](#25-javascript-and-react)
+26. [Dear ImGui](#26-dear-imgui)
+27. [C and embedding](#27-c-and-embedding)
+28. [Where the docs live](#28-where-the-docs-live)
+
+**[Part V: Performance](#part-v-performance)**
+
+29. [Before you read the numbers](#29-before-you-read-the-numbers)
+30. [Start time and battery](#30-start-time-and-battery)
+31. [Frame times](#31-frame-times)
+32. [JavaScript and React: startup and animation](#32-javascript-and-react-startup-and-animation)
+33. [Run the benchmarks yourself](#33-run-the-benchmarks-yourself)
+
+**[Part VI: Reference](#part-vi-reference)**
+
+34. [Platforms](#34-platforms)
+35. [Environment variables](#35-environment-variables)
+36. [Building from source and CMake options](#36-building-from-source-and-cmake-options)
+37. [Coverage](#37-coverage)
+38. [Repository layout](#38-repository-layout)
+39. [Examples](#39-examples)
+
+**[Part VII: The project](#part-vii-the-project)**
+
+40. [Status and roadmap](#40-status-and-roadmap)
+41. [FAQ](#41-faq)
+42. [Contributing and publishing](#42-contributing-and-publishing)
+43. [License and credits](#43-license-and-credits)
+
+---
+
+# Part I: Welcome
+
+## 1. What BUI is
BUI takes the user interface of [Blender](https://www.blender.org) (its widget
drawing, its interaction rules and its look) and turns it into a standalone UI
@@ -41,34 +117,315 @@ library with a small C core. Your code builds the widget tree and handles
callbacks. Layout, input, drawing and presenting all happen in fast native code,
on the CPU or the GPU.
-You can drive it many ways, and all of them share the same C runtime:
+At the heart of BUI is the **kit**: a small runtime written in C. The kit
+holds every widget in one tree, lays them out, handles the mouse and keyboard,
+and draws them the way Blender does. The drawing code is a C port of
+Blender's own widget code, and the interaction follows Blender's rules. On top
+of the kit sit **bindings**: thin layers that let Python, Rust, JavaScript,
+C++ and Dear ImGui talk to it.
+
+What BUI is not:
+
+- **Not Blender.** It contains the parts of Blender's UI code it needs and
+ builds on its own. You don't need Blender installed, and you don't need to
+ know Blender to use it.
+- **Not a browser.** The Rust and JavaScript sides use HTML and CSS as a *UI
+ language*, but there's no browser engine, no webview and no network.
+- **Not a re-imagining.** The widget drawing is ported from Blender's
+ `interface_widgets.cc`, and the Dear ImGui support runs the real Dear ImGui.
+
+## 2. Why BUI exists
+
+Blender's interface is famous for how it *feels*. You press a number field and
+drag: the cursor vanishes, the value glides under your hand, and you never hit
+the edge of the screen. You type `2*pi` into a field and it just works. You
+type "ad cu" into a menu and it finds "Add Cube". Millions of artists have
+these habits in their hands.
+
+That interface is also fast and frugal. It redraws only what changed, sleeps
+when nothing does, and starts in milliseconds. BUI exists so that any app,
+in any language, can have both: Blender's feel, and Blender's efficiency.
+
+## 3. Who it's for
+
+- **You have a tkinter app** and wish it looked less like 1998. Run it on BUI,
+ unchanged.
+- **You're building a tool for artists** who already know Blender. Give them
+ the panels, sliders and shortcuts their hands expect.
+- **You write Rust or React** and want a native desktop UI without shipping a
+ browser.
+- **You use Dear ImGui** and want it to look and feel like Blender, with one
+ build flag.
+- **You're curious** how a UI toolkit works. The source is readable, and the
+ [concepts](#part-iii-concepts) are explained in plain words.
+
+## 4. The many ways in
+
+You can drive BUI many ways, and all of them share the same C runtime, so they
+all get the same widgets and interactions:
| You write | You get | Status |
| --- | --- | --- |
-| **tkinter** code, even existing programs, unchanged | Blender-styled apps; every tkinter and ttk API | ✅ Complete |
-| **Qt-style** Python (`QWidget`, layouts, `clicked.connect`) | The common subset of Qt widgets | 🟡 Partial |
-| **Blender components** (`Panel`, `NumberSlider`, `PieMenu`, the node editor ...) | 45 native Blender widgets and editors, from Python; ten of them also from Rust and JavaScript | ✅ Complete |
-| **Rust**: HTML + CSS + Tailwind, JSX (`rsx!` / `view!`), hooks, or [gpui](https://www.gpui.rs) / [zopra](https://zopra.preetham.top) syntax | A web-like framework: HTML that looks like a browser's, Blender's look with `styled`, and Blender components (`<NumberSlider>`, `<Button>` ...) | ✅ Working |
-| **JavaScript / React** on Node.js or Bun: a DOM-like API or JSX | The same engine and components in native windows, over napi-rs; React's hooks backed by signals | ✅ Working |
-| **Dear ImGui** from C++, C, Python or Rust | The real Dear ImGui on BUI windows in Blender's theme, or a build where ImGui's widgets *are* Blender's widgets | ✅ Working |
-| **C** (`BUI_kit.h`) | The kit itself: nodes, widgets, windows | ✅ Working |
-| **MyGo** | MyGo | 🟡 Not yet |
+| **tkinter** code, even existing programs, unchanged | Blender-styled apps; every tkinter and ttk API | Complete |
+| **Qt-style** Python (`QWidget`, layouts, `clicked.connect`) | The common subset of Qt widgets | Partial |
+| **Blender components** (`Panel`, `NumberSlider`, `PieMenu`, the node editor ...) | 45 native Blender widgets and editors, from Python; ten of them also from Rust and JavaScript | Complete |
+| **Rust**: HTML + CSS + Tailwind, HTML-like markup (`rsx!` / `view!`), hooks, or [gpui](https://www.gpui.rs) / [zopra](https://zopra.preetham.top) syntax | A web-like framework: HTML that looks like a browser's, Blender's look with `styled`, and Blender components (`<NumberSlider>`, `<Button>` ...) | Working |
+| **JavaScript / React** on Node.js or Bun: a DOM-like API or JSX | The same engine and components in native windows, over napi-rs; React's hooks backed by signals | Working |
+| **Dear ImGui** from C++, C, Python or Rust | The real Dear ImGui on BUI windows in Blender's theme, or a build where ImGui's widgets *are* Blender's widgets | Working |
+| **C** (`BUI_kit.h`) | The kit itself: nodes, widgets, windows | Working |
+| **MyGo** | MyGo | Not yet (coming soon) |
+
+Not sure which to pick? If you already have code, use the row that matches it.
+If you're starting fresh in Python, the Blender components are the friendliest.
+
+## 5. Features at a glance
+
+### Blender's widgets and interactions
+
+- Number fields you **drag with a hidden, continuous cursor**: Shift for precision, Ctrl to snap.
+- **Math in number fields**, with Blender's own expression evaluator: `2*pi`, `min(4, 3)`, `round(1.7)`, `x if c else y`.
+- Ctrl+Wheel steps values, Ctrl+C / Ctrl+V copy values, Backspace resets.
+- **Drag across checkboxes** to set them all.
+- Press-drag-release menus, pie menus, and **Blender's fuzzy menu search**: "ad cu" finds "Add Cube", typos are forgiven, recent picks rank first.
+- **Ctrl+Z / Ctrl+Shift+Z** on every UI edit, and inside a text field while you type; Tab between fields.
+- Blender's float display precision, multi-field vertical drags, and panels that collapse with Blender's animation.
+- The HSV color wheel, color ramps, curves, trees, lists, text areas, canvases, a node editor and Blender's File Browser.
+- **Blender's Dark and Light themes**, switchable at run time.
+
+### Python, four ways
+
+- **tkinter**: all 7,846 public names of tkinter and ttk. Nine real programs behave identically on the standard library and on BUI.
+- **Qt syntax**: widgets, layouts, signals, `QPainter`, menus and timers.
+- **Components**: 45 Blender widgets, editors and templates.
+- **Dear ImGui**: `from blenderui import imgui`, pyimgui-style.
+- One `pip install`, no Qt or Tk widgets drawing anything.
+
+### Rust: the web platform, natively
-## Quick start
+- **All 113 HTML elements**, drawn like a browser draws them; `styled` gives any subtree Blender's look, and **Blender components** (`<NumberSlider>`, `<Button>`, `<ColorSwatch>` ...) are real Blender widgets.
+- **Modern CSS**: flexbox, grid with named areas, tables, `calc()` and every math function, `var()`, `oklch()` and `color-mix()`, `:has()`, nesting, `@layer`, `@media` ranges, `@container`, `::before`/`::after`, counters.
+- **Effects and motion**: `@keyframes` animations and transitions, filters, `backdrop-filter`, blend modes, `clip-path`, masks, 2D transforms, `border-image`.
+- **Tailwind CSS v4**: `class="md:hover:bg-sky-500/50"` or bare attributes (`<div p-4 bg-[#4772b3]>`), with **"did you mean" compile errors**.
+- **`rsx!` / `view!`** HTML-like markup, **`#[component]`**, and **hooks** in zopra, React or Leptos style (`use_state`, `signal`, `Memo`, `Effect`, context).
+- **gpui-compatible syntax** too: `div().flex().gap_2()`, `Render`, `cx.listener`.
+- On [crates.io](https://crates.io/crates/blenderui): `cargo add blenderui`.
+
+### Fast by design
+
+- **Damage rendering**: an idle UI costs 0% CPU, and a hover redraws only the widget it touches.
+- **Opt-in GPU renderer** (Direct3D 11 on Windows, OpenGL 3.3 on Linux), modeled on Blender's instanced widget drawing. It draws the same pixels as the CPU raster.
+- In the benchmark, **2–4× less CPU per frame than gpui-fast**, with **less RAM** and a **~5 ms first frame**.
+- **Blender's text**: Inter (Blender's UI font) is embedded and rendered with FreeType the way Blender renders it, so text looks the same on every platform. On the GPU, glyphs are drawn from their outlines with [Slug](https://github.com/EricLengyel/Slug), falling back to a per-glyph atlas like Blender's.
+
+### JavaScript and React
+
+- **React 19.3** renders to BUI: HTML host components, CSS and Tailwind, events, Suspense, transitions, actions, and Blender components (`<NumberSlider>`, `<Button>` ...). BUI draws them, on the CPU or the GPU; there's no browser and no webview.
+- **React's hooks, by React's names**, holding signals: pass one into JSX (`{count}`) and a change updates that one node without re-rendering; read it while rendering (`count.value`) and the component re-renders, as with React. A conformance suite checks each hook against React's own.
+- **`@blender-ui/native`**: a DOM-like API (`createElement`, `appendChild`, `addEventListener`) with the same signals, for apps without React.
+- **Node.js and Bun**, through a napi-rs addon, with headless mode for tests.
+
+### Small standalone apps
+
+- **`bui build app.jsx`** produces one executable of about **5 MB**: BUI with an embedded QuickJS engine.
+- **First frame in ~70 ms**, at **19 MB** of RAM, with nothing to install. There's no browser and no webview.
+- **`--bun`** builds a Bun executable instead, with Node's APIs and a JIT.
+- Builds take under a second: the app's bundle is appended to a prebuilt runtime.
+
+### Dear ImGui
-### Python
+- **The real Dear ImGui 1.93**: every function of `imgui.h` works, including `ShowDemoWindow()`.
+- **Four languages**: C++ (drop-in `imgui.h`), C (`cimgui.h`, all 399 functions), Python and Rust (generated from `imgui.h`).
+- **Blender's look**: Blender's theme colors and metrics with Inter; or, with `BUI_IMGUI_BLENDER_WIDGETS=ON`, Blender's actual widgets and interaction, pixel-identical to BUI's own.
+- **Idle costs nothing**: frames run only on input and while something animates.
+
+### Native everywhere
+
+- **Native windows** on Windows (Win32) and Linux (X11, Wayland through XWayland), and an experimental Cocoa host for macOS ported from Blender's GHOST.
+- **HiDPI**: per-monitor DPI on Windows, `Xft.dpi` on Linux, Retina on macOS.
+- **Headless mode** for tests and screenshots, with a virtual clock that steps animations exactly.
+- On Linux, libX11 and libGL are loaded at run time, so BUI imports on servers without them.
+
+## 6. A gallery
+
+Every screenshot here is a real BUI window, rendered off-screen. Where an image
+comes in a dark and a light version, GitHub shows the one that matches your
+theme.
+
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-node-editor-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-node-editor-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-node-editor-dark.png" width="760" alt="A Geometry Nodes editor in BUI: seven nodes with typed sockets, colored links and header menus">
+</picture>
+<br><sub>The node editor, from Python (<code>examples/site/geometry_nodes.py</code>)</sub>
+</p>
+
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-pie-menu-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-pie-menu-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-pie-menu-dark.png" width="400" alt="A Shading pie menu open over a node editor">
+</picture>
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-menu-search-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-menu-search-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-menu-search-dark.png" width="400" alt="The File menu with exp typed: Blender's fuzzy search through submenus">
+</picture>
+<br><sub>A pie menu, and Blender's menu search (type in any open menu)</sub>
+</p>
+
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-color-picker-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-color-picker-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-color-picker-dark.png" width="380" alt="Blender's color picker: HSV wheel, value strip, HSV sliders, hex field and eyedropper">
+</picture>
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-tooltip-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-tooltip-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-tooltip-dark.png" width="420" alt="A tooltip on a Denoise dropdown">
+</picture>
+<br><sub>The color picker, and a tooltip</sub>
+</p>
+
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-html-effects-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-html-effects-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-html-effects-dark.png" width="720" alt="CSS effects: filters, clip-path shapes, transforms, blend modes and backdrop-filter on a gradient landscape">
+</picture>
+<br><sub>CSS effects in Rust: filters, <code>clip-path</code>, transforms, blend modes, <code>backdrop-filter</code> (<code>site_effects.rs</code>)</sub>
+</p>
+
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-css-grid-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-css-grid-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-css-grid-dark.png" width="640" alt="A material library laid out with CSS grid: auto-fill columns, spans and dense packing">
+</picture>
+<br><sub>CSS grid with <code>repeat(auto-fill, minmax())</code>, spans and <code>grid-auto-flow: dense</code> (<code>site_grid.rs</code>)</sub>
+</p>
+
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-animation-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-animation-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/feature-animation-dark.png" width="730" alt="Three moments of CSS keyframe animations: a spinner, a progress sweep, a bouncing ball and a fading toast">
+</picture>
+<br><sub>CSS <code>@keyframes</code> at 0.25 s, 0.6 s and 1.0 s (<code>site_animation.rs</code>)</sub>
+</p>
+
+<details>
+<summary><b>More screenshots</b></summary>
+<p align="center">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/rust-showcase.png" width="560" alt="The Rust showcase: a stylesheet, grid cards, Blender form widgets, a table and lists">
+ <br><sub><code>examples/showcase.rs</code>: HTML + CSS in Rust</sub><br><br>
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/imgui-stock.png" width="560" alt="Dear ImGui's demo in Blender's theme, with ImGui's own widgets">
+ <br><sub>Dear ImGui's demo with its own widgets, in Blender's theme</sub><br><br>
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/qt.png" width="420" alt="Qt syntax on BUI">
+ <br><sub>Qt syntax</sub><br><br>
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/tkinter_notes.png" width="260" alt="tkinter Text with tags">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/tkinter_canvas.png" width="260" alt="tkinter Canvas">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/tkinter_messagebox.png" width="260" alt="tkinter messagebox">
+ <br><sub>tkinter programs: text with tags, canvas, dialogs</sub>
+</p>
+</details>
+
+---
+
+# Part II: Getting started
+
+## 7. Install
+
+**Python.** You need CPython 3.11 or newer. Wheels are published for Windows,
+Linux and macOS, so there's nothing to compile. One package gives you all four
+Python APIs (tkinter syntax, Qt syntax, the Blender components and Dear ImGui):
```sh
pip install blenderui
+python -c "import blenderui; print(blenderui.__version__)"
```
+Import it as `blenderui`. You'll also see `import bui` in older examples: it's
+the same code under its original name, but an unrelated project owns `bui` on
+PyPI, so prefer `blenderui` in anything you publish.
+
+**Rust.** The crate is [`blenderui` on crates.io](https://crates.io/crates/blenderui):
+
+```sh
+cargo add blenderui
+```
+
+The first build compiles BUI's C kit for you, so you need Rust 1.88 or newer,
+CMake and a C compiler (on Windows, the Visual Studio Build Tools for the
+default MSVC target), and on Linux the X11 headers (`libx11-dev` or
+`libX11-devel`; no GL headers are needed).
+
+**JavaScript.** You need Node.js 18 or newer, or Bun:
+
+```sh
+npm install @blender-ui/react react # or: bun add @blender-ui/react react
+npm install @blender-ui/native # the DOM-like API, without React
+```
+
+[![@blender-ui/react](https://img.shields.io/npm/v/@blender-ui/react?label=%40blender-ui%2Freact)](https://www.npmjs.com/package/@blender-ui/react)
+[![@blender-ui/native](https://img.shields.io/npm/v/@blender-ui/native?label=%40blender-ui%2Fnative)](https://www.npmjs.com/package/@blender-ui/native)
+
+The npm packages are prebuilt for **Windows x64**. On **Linux**, build the
+addon from a clone (`npm install` then `npm run build` in `bindings/`, with
+Rust, CMake and a C compiler); windows are native X11 windows there. On
+**macOS**, JavaScript runs headless for now (see [Platforms](#34-platforms)).
+
+**C and C++.** Build from source with CMake 3.20+ and a C11 / C++20 compiler
+(MSVC, GCC or MinGW-w64, or Clang); on Linux, also the X11 headers:
+
+```sh
+git clone https://github.com/ppmpreetham/BUI && cd BUI
+cmake -S . -B build
+cmake --build build -j 2
+ctest --test-dir build # optional: run the test suites
+```
+
+In your own CMake project, add BUI as a subdirectory and link `bui::kit` (or
+`bui::imgui` for Dear ImGui):
+
+```cmake
+add_subdirectory(BUI)
+target_link_libraries(myapp PRIVATE bui::kit)
+```
+
+**Dear ImGui.** Python gets it with `pip install blenderui`
+(`import blenderui.imgui`). C++ links `bui::imgui`, C links `bui_cimgui`.
+Rust uses the `blenderui-imgui` crate, which isn't on crates.io yet, so take it
+from git:
+
+```toml
+[dependencies]
+blenderui-imgui = { git = "https://github.com/ppmpreetham/BUI" }
+```
+
+**If something goes wrong:**
+
+| Symptom | Fix |
+| --- | --- |
+| `ImportError: buipy` | You're running from a source checkout without a build. Build first (`cmake --build build`), or set `BUIPY_BUILD_DIR`. The extension must match your Python version. |
+| The window never appears | Start the event loop: `mainloop()`, `app.exec()` or `App.run()`. |
+| Blurry or tiny UI | Set `BUI_UI_SCALE`, for example `BUI_UI_SCALE=1.25`. |
+| `gpu=True` does nothing | Run with `BUI_GPU_DEBUG=1` to see why the GPU device didn't start. Without Direct3D 11 or OpenGL 3.3, BUI stays on the CPU renderer, which draws the same pixels. |
+
+More: [docs/getting-started.md](docs/getting-started.md) and
+[Install BUI](https://bui.preetham.top/docs/start/installation/) on the website.
+
+## 8. First app: tkinter
+
Run any tkinter program on BUI **without changing a line**:
```sh
blenderui-tk my_app.py # same as: python -m bui.tksyntax my_app.py
```
-Or opt in from code:
+`blenderui-tk` makes `import tkinter` return BUI's implementation for that
+run. Or opt in from code:
```python
import blenderui.tksyntax as tk
@@ -82,7 +439,27 @@ ttk.Button(root, text="Greet",
root.mainloop()
```
-Or build with Blender's own components:
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-tkinter-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-tkinter-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-tkinter-dark.png" width="420" alt="An unchanged tkinter program: a glTF export dialog with entries, checkbuttons, radio buttons, a spinbox, an option menu, a scale and a listbox">
+</picture>
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-ttk-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-ttk-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-ttk-dark.png" width="415" alt="An unchanged ttk program: a render-farm queue with a combobox, notebook, treeview and progress bar">
+</picture>
+<br><sub>Unchanged tkinter and ttk programs (<code>examples/site/tk_export.py</code>, <code>ttk_queue.py</code>)</sub>
+</p>
+
+Number fields (`Spinbox`, `Scale`) scrub like Blender's, Ctrl+Z / Ctrl+Shift+Z
+undo edits, and `filedialog` opens Blender's File Browser. Guide:
+[docs/tkinter.md](docs/tkinter.md).
+
+## 9. First app: Blender components
+
+Build with Blender's own components:
```python
from blenderui.components import App, Panel, NumberSlider, VectorField, Checkbox, ColorSwatch, Button
@@ -98,12 +475,86 @@ App("Object", (420, 520),
).run()
```
-### Rust
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-components-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-components-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-components-dark.png" width="400" alt="A Render Properties editor built from Blender components: menus, side tabs, panels with header checkboxes, number fields, sliders, dropdowns and a color swatch">
+</picture>
+<br><sub>A Render Properties editor from the components (<code>examples/site/render_props.py</code>)</sub>
+</p>
+
+There are 45 components: layout, values, buttons, views, menus and pie menus,
+the color picker, the color ramp, curve and node editors, areas and templates.
+Reference: [docs/components.md](docs/components.md).
-```bash
-cargo add blenderui # not on crates.io yet: use the git dependency (see Status)
+## 10. First app: Qt syntax
+
+Write Qt-style Python. The import is the only line that differs from PySide
+or PyQt, and neither is needed:
+
+```python
+import sys
+from blenderui.qtsyntax import (QApplication, QWidget, QVBoxLayout, QFormLayout,
+ QLineEdit, QComboBox, QSlider, QProgressBar,
+ QPushButton, QLabel, Qt)
+
+app = QApplication(sys.argv)
+window = QWidget()
+window.setWindowTitle("Export")
+layout = QVBoxLayout(window)
+
+form = QFormLayout()
+kind = QComboBox()
+kind.addItems(["glTF", "FBX", "OBJ"])
+quality = QSlider(Qt.Horizontal)
+quality.setRange(0, 100)
+form.addRow("Format:", kind)
+form.addRow("Quality:", quality)
+layout.addLayout(form)
+
+bar = QProgressBar()
+quality.valueChanged.connect(bar.setValue)
+layout.addWidget(bar)
+
+status = QLabel("Ready.")
+go = QPushButton("Export")
+go.clicked.connect(lambda: status.setText("Exporting as " + kind.currentText()))
+layout.addWidget(status)
+layout.addWidget(go)
+
+window.show()
+sys.exit(app.exec())
```
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-qt-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-qt-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/python-qt-dark.png" width="560" alt="A material editor in Qt syntax: a list, line edit, group box with a form layout, combo box, slider with spin box, checkbox and progress bar">
+</picture>
+<br><sub>Qt syntax (<code>examples/site/qt_material.py</code>)</sub>
+</p>
+
+Qt syntax is **partial** (about 24% of Qt's method names on the main widget
+classes); anything missing raises `AttributeError`. Guide:
+[docs/qt.md](docs/qt.md).
+
+## 11. First app: Rust, in rsx and gpui builders
+
+BUI's Rust crate has **two first-class syntaxes**, and they draw the same
+window:
+
+- **`rsx!`** is HTML-like markup inside a macro, with `#[component]` functions
+ and hooks for state.
+- **gpui builders** are plain method chains: `div().flex().gap_3().child(...)`.
+ State lives in your view struct, and `cx.listener` updates it. gpui code
+ compiles against BUI too.
+
+**In `rsx!`** (this is
+[`bindings/rust/blenderui/examples/hello.rs`](bindings/rust/blenderui/examples/hello.rs);
+run it with `cargo run --release --example hello` in `bindings/rust`):
+
```rust
use blenderui::prelude::*;
@@ -141,21 +592,68 @@ fn main() {
}
```
+**In gpui builders**, the same window:
+
+```rust
+use blenderui::prelude::*;
+
+struct Hello { count: i32 }
+
+impl Render for Hello {
+ fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
+ let counter = div().flex().items_center().gap_3().p_4().rounded_xl().bg(rgb(0x27272a))
+ .child(span().text_color(rgb(0xd4d4d8)).child(format!("Clicks: {}", self.count)))
+ .child(div().px_3().py_1().rounded_md().bg(rgb(0x0369a1))
+ .hover(|s| s.bg(rgb(0x0ea5e9))).cursor_pointer()
+ .child("Add one")
+ .on_click(cx.listener(|this, _, _, cx| {
+ this.count += 1;
+ cx.notify();
+ })));
+ body().m_0().p_6().css("min-height", "100vh").flex().flex_col().gap_4()
+ .bg(rgb(0x18181b)).text_color(white())
+ .child(h1().text_2xl().font_bold().child("Hello, BUI"))
+ .child(counter)
+ .child(NumberSlider().min(0.0).max(10.0).value("5")) // a real Blender slider
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Hello { count: 0 })).unwrap();
+ });
+}
+```
+
<p align="center">
<img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/rust-hello.png" width="420" alt="The Rust hello example: a heading, a counter component and a Blender slider">
</p>
-This is [`bindings/rust/blenderui/examples/hello.rs`](bindings/rust/blenderui/examples/hello.rs)
-(`cargo run --release --example hello`).
+Two small things that trip people up in `rsx!`:
-### JavaScript and React
+- Text children are text (`&'static str`, `String`, `SharedString`) or
+ elements. Numbers and borrowed `&str` props aren't, so write
+ `{count().to_string()}` and `{label.to_string()}`.
+- A component's body is a normal block that ends in markup, usually an
+ `rsx!`.
-[![@blender-ui/react](https://img.shields.io/npm/v/@blender-ui/react?label=%40blender-ui%2Freact)](https://www.npmjs.com/package/@blender-ui/react)
-[![@blender-ui/native](https://img.shields.io/npm/v/@blender-ui/native?label=%40blender-ui%2Fnative)](https://www.npmjs.com/package/@blender-ui/native)
+Here's a bigger example, a render-farm dashboard, written once in each syntax.
+The two programs draw identical pixels:
-```sh
-npm install @blender-ui/react react # or: bun add @blender-ui/react react
-```
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-rsx-dashboard-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-rsx-dashboard-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-rsx-dashboard-dark.png" width="700" alt="A render-farm dashboard: a CSS grid of stat cards, job rows with Blender progress bars, a node list, a dropdown, button and checkbox">
+</picture>
+<br><sub><code>site_dashboard.rs</code> (<code>rsx!</code>) and <code>site_dashboard_builder.rs</code> (gpui builders)</sub>
+</p>
+
+Guide: [docs/rust.md](docs/rust.md), and the
+[Rust tutorial](https://bui.preetham.top/docs/tutorials/first-app-rust/) on the
+website.
+
+## 12. First app: JavaScript and React
```jsx
/** @jsxImportSource @blender-ui/react */
@@ -180,15 +678,45 @@ bun app.jsx # run it (Bun reads JSX directly)
npx bui build app.jsx # or ship it: app.exe, one 5 MB file
```
+Without React, `@blender-ui/native` gives you a DOM-like API:
+
+```js
+const { App, signal } = require('@blender-ui/native')
+
+const app = new App({ gpu: true })
+const win = app.window({ title: 'Hello', width: 360, height: 200 })
+win.body.className = 'm-0 p-6 flex flex-col gap-3 bg-[#2b2b2b] text-[#e6e6e6]'
+
+const clicks = signal(0)
+const label = win.createElement('span')
+label.textContent = clicks // follows the signal
+const button = win.createElement('button')
+button.textContent = 'Add one'
+button.addEventListener('click', () => clicks.value++)
+win.body.appendChild(label)
+win.body.appendChild(button)
+```
+
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/js-react-tasks-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/js-react-tasks-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/js-react-tasks-dark.png" width="440" alt="A task list in React on BUI: a Blender text field, button, checkboxes and a progress bar">
+</picture>
+<br><sub>A task list in React (<code>examples/site/js/todo_react.js</code>); the DOM-like version draws the same</sub>
+</p>
+
Node.js 18+ or Bun. Prebuilt for Windows x64; on Linux, build the addon from
source (`npm run build` in `bindings/node`) and windows are native. Guide:
[docs/javascript.md](docs/javascript.md).
-### Dear ImGui
+## 13. First app: Dear ImGui
The real Dear ImGui 1.93 runs on BUI: BUI's windows, input, CPU/GPU renderer,
Blender's theme and the Inter font. Existing ImGui code compiles unchanged.
+**C++:**
+
```cpp
#include "imgui.h"
#include "imgui_impl_bui.h" // see examples/imgui_demo.cpp
@@ -210,6 +738,8 @@ int main() {
}
```
+**Python:**
+
```python
import blenderui.imgui as imgui # C: cimgui.h · Rust: the blenderui-imgui crate
@@ -224,172 +754,453 @@ def frame():
imgui.run(frame, title="Hello", size=(1280, 800))
```
+**C** (`cimgui.h`, cimgui conventions: `ImGui_Button`, `ImGui_ButtonEx`, and
+the backend in `cimgui_impl_bui.h`) and **Rust** (`blenderui-imgui`) work the
+same way:
+
+```rust
+use blenderui_imgui as imgui;
+
+fn main() {
+ let mut value = 0.5f32;
+ imgui::run("Hello", [1280, 800], move || {
+ imgui::show_demo_window();
+ imgui::begin("Hello");
+ imgui::slider_float("Value", &mut value, 0.0, 1.0);
+ imgui::end();
+ });
+}
+```
+
Build with `-DBUI_IMGUI_BLENDER_WIDGETS=ON` (or the Rust feature
`blender-widgets`) and ImGui's widgets become Blender's own: `DragFloat` is
Blender's drag-to-scrub number field (Shift for precision, Ctrl to snap),
`SliderFloat` Blender's number slider, checkboxes drag-toggle, menus and combos
-get Blender's menus. The rest of the ImGui API is unchanged.
+get Blender's menus. The rest of the ImGui API is unchanged. (The PyPI wheel
+is built without it, so from Python you get ImGui's own widgets in Blender's
+theme unless you build from source.)
<p align="center">
<img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/imgui-blender.png" width="720" alt="Dear ImGui's demo window drawn with Blender's widgets">
<br><sub>Dear ImGui's own demo with <code>BUI_IMGUI_BLENDER_WIDGETS=ON</code>: number fields, sliders, color rows and panel headers are Blender's</sub>
</p>
-Guide, coverage and the stock look: [docs/imgui.md](docs/imgui.md).
-
-### C
-
-```c
-#include "BUI_kit.h" /* see examples/kit_hello.c and docs/c-api.md */
-```
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/imgui-cpp-stock-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/imgui-cpp-stock-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/imgui-cpp-stock-dark.png" width="400" alt="A scene inspector in Dear ImGui with ImGui's own widgets and colors">
+</picture>
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/imgui-cpp-blender-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/imgui-cpp-blender-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/imgui-cpp-blender-dark.png" width="400" alt="The same inspector with Blender widgets and Blender's style">
+</picture>
+<br><sub>The same ImGui code: ImGui's widgets (left) and the Blender-widgets build (right) (<code>examples/site/imgui_inspector.cpp</code>)</sub>
+</p>
-Build from source with CMake (see [Building from source](#building-from-source)).
+Guide, coverage and the stock look: [docs/imgui.md](docs/imgui.md).
-## HTML, Blender, or both
+## 14. First app: C
-In Rust and JavaScript you pick the look per element:
+The kit's API is one header, `kit/include/BUI_kit.h`, and it doubles as the
+reference: every function has a one-line comment. This is a shortened
+[`examples/kit_hello.c`](examples/kit_hello.c): a slider and a button in a
+native window.
-| You write | You get |
-| --- | --- |
-| Plain HTML: `<button>`, `<input type="range">`, `<select>` ... | What a browser draws: black text on white and Chrome's form controls, in the Inter UI font |
-| `styled` on any element: `<div styled>`, `div().styled()` | Blender's look for it and everything inside: dark theme, UI font, Blender widgets |
-| **Blender components** (capitalized): `<NumberSlider>`, `<Button>` ... | Blender's widgets and interaction everywhere (drag to scrub, Ctrl+Z, Blender's color picker) |
+```c
+#include <stdio.h>
+#include "BUI_kit.h"
-The components are `Button`, `Checkbox`, `Radio`, `NumberField`, `NumberSlider`,
-`TextField`, `TextArea`, `ColorSwatch`, `Dropdown` and `ProgressBar`. Each one
-is the HTML element it stands for, so every attribute, style and event works on
-it:
+static void on_event(void *data, BKNode *node, int kind, void *ref, double a, double b)
+{
+ if (kind == BK_EV_CLICK) printf("clicked %s\n", BK_get_str(node, "text"));
+ else if (kind == BK_EV_CHANGE) printf("%s = %g\n", BK_get_str(node, "label"), BK_get_num(node, "value"));
+}
-```rust
-rsx! {
- <main class="p-4 flex gap-2"> // browser look
- <input type="range" /> // Chrome's slider
- <NumberSlider min={0.0} max={10.0} value="2.5" /> // Blender's slider
- <div styled><button>"Apply"</button></div> // Blender's look inside
- </main>
+int main(void)
+{
+ BKNode *root = BK_node_new("frame"); /* everything is a node */
+ BK_set_num(root, "padding", 8); /* configured by property name */
+
+ BKNode *size = BK_node_new("slider");
+ BK_set_str(size, "label", "Size");
+ BK_set_num(size, "max", 10);
+ BK_set_num(size, "value", 2.5);
+ BK_node_add(root, size, -1);
+ BK_geom_set_manager(size, BK_GEOM_PACK); /* Tk's packer, in C */
+ BK_geom_set(size, "fill", 1);
+
+ BKNode *apply = BK_node_new("button");
+ BK_set_str(apply, "text", "Apply");
+ BK_node_add(root, apply, -1);
+ BK_geom_set_manager(apply, BK_GEOM_PACK);
+
+ BKContext *ctx = BK_context_new(root); /* input, focus, popups, undo */
+ BKHost host = {0};
+ host.emit = on_event; /* the window fills in the rest */
+ BK_context_set_host(ctx, &host);
+
+ if (BK_window_supported()) { /* Win32, X11 or Cocoa */
+ BKWindow *win = BK_window_new(ctx, "BUI from C", 320, 120);
+ BK_window_show(win);
+ BK_window_run();
+ BK_window_free(win);
+ }
+ BK_context_free(ctx);
+ BK_node_free(root);
+ return 0;
}
-div().child(Checkbox().checked(true)).child(Button().child("Apply")) // gpui syntax
```
-```jsx
-import { render, NumberSlider, Button } from "@blender-ui/react"
-// <NumberSlider min={0} max={10} onChange={...} />, <Button onClick={...}>Apply</Button>
-// DOM API: win.createElement("NumberSlider")
+```sh
+cmake -S . -B build -DBUI_BUILD_EXAMPLES=ON
+cmake --build build --target bui_kit_hello
```
<p align="center">
- <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/rust-forms.png" width="460" alt="Form controls as plain HTML, inside styled, and as Blender components">
- <br><sub><code>cargo run --example forms</code>: plain HTML, inside <code>styled</code>, and the Blender components</sub>
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/c-kit-app-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/c-kit-app-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/c-kit-app-dark.png" width="360" alt="A modifier stack built with the C kit: panels, enum rows, number fields, dropdowns, a slider, checkboxes and buttons">
+</picture>
+<br><sub>A bigger C program: a modifier stack (<code>examples/site/kit_modifiers.c</code>)</sub>
</p>
-Python's [Blender components](docs/components.md) (`Panel`, `PieMenu`, the node
-editor ...) are a separate, larger set.
-
-## Features
-
-<table>
-<tr><td width="50%" valign="top">
-
-### 🎛️ Blender's widgets and interactions
-
-- Number fields you **drag with a hidden, continuous cursor**: Shift for precision, Ctrl to snap.
-- **Math in number fields**, with Blender's own expression evaluator: `2*pi`, `min(4, 3)`, `round(1.7)`, `x if c else y`.
-- Ctrl+Wheel steps values, Ctrl+C / Ctrl+V copy values, Backspace resets.
-- **Drag across checkboxes** to set them all.
-- Press-drag-release menus, pie menus, and **Blender's fuzzy menu search**: "ad cu" finds "Add Cube", typos are forgiven, recent picks rank first.
-- **Ctrl+Z / Ctrl+Shift+Z** on every UI edit, and inside a text field while you type; Tab between fields.
-- Blender's float display precision, multi-field vertical drags, and panels that collapse with Blender's animation.
-- The HSV color wheel, color ramps, curves, trees, lists, text areas, canvases and a node editor.
+Without a window system, render into a raster instead
+(`BK_render(ctx, raster, w, h, full)`), which is also how tests and
+screenshots work. Guide: [docs/c-api.md](docs/c-api.md).
-</td><td width="50%" valign="top">
+---
-### 🐍 Python, four ways
+# Part III: Concepts
-- **tkinter**: all 7,846 public names of tkinter and ttk. Nine real programs behave identically on the standard library and on BUI.
-- **Qt syntax**: widgets, layouts, signals, `QPainter`, menus and timers.
-- **Components**: 45 Blender widgets, editors and templates.
-- **Dear ImGui**: `from blenderui import imgui`, pyimgui-style.
-- One `pip install`, no Qt or Tk widgets drawing anything.
-
-</td></tr>
-<tr><td valign="top">
+## 15. How it works
-### 🦀 Rust: the web platform, natively
-
-- **All 113 HTML elements**, drawn like a browser draws them; `styled` gives any subtree Blender's look, and **Blender components** (`<NumberSlider>`, `<Button>`, `<ColorSwatch>` ...) are real Blender widgets.
-- **Modern CSS**: flexbox, grid with named areas, tables, `calc()` and every math function, `var()`, `oklch()` and `color-mix()`, `:has()`, nesting, `@layer`, `@media` ranges, `@container`, `::before`/`::after`, counters.
-- **Effects and motion**: `@keyframes` animations and transitions, filters, `backdrop-filter`, blend modes, `clip-path`, masks, 2D transforms, `border-image`.
-- **Tailwind CSS v4**: `class="md:hover:bg-sky-500/50"` or bare attributes (`<div p-4 bg-[#4772b3]>`), with **"did you mean" compile errors**.
-- **`rsx!` / `view!`** JSX, **`#[component]`**, and **hooks** in zopra, React or Leptos style (`use_state`, `signal`, `Memo`, `Effect`, context).
-- **gpui-compatible syntax** too: `div().flex().gap_2()`, `Render`, `cx.listener`.
-
-</td><td valign="top">
-
-### ⚡ Fast by design
-
-- **Damage rendering**: an idle UI costs 0% CPU, and a hover redraws only the widget it touches.
-- **Opt-in GPU renderer** (Direct3D 11 on Windows, OpenGL 3.3 on Linux), modeled on Blender's instanced widget drawing. It draws the same pixels as the CPU raster.
-- In the benchmark, **2–4× less CPU per frame than gpui-fast**, with **less RAM** and a **~5 ms first frame**.
-- **Blender's text**: Inter (Blender's UI font) is embedded, so text looks the same on every platform. On the GPU, glyphs are drawn from their outlines with [Slug](https://github.com/EricLengyel/Slug), falling back to a per-glyph atlas like Blender's.
+```
+ your code: tkinter Qt components Dear ImGui (C++/C/Python/Rust) Rust: rsx! / HTML / CSS / Tailwind / hooks JS / React
+ │ │ │ │ │ │
+ └──── Python: options, signals │ ImGui core + BUI backend └── style cascade + taffy layout ◄────┘
+ │ │ │
+ C kit (kit/): node tree · geometry · input & interaction · Blender widget drawing · undo · animation · themes · Blender search/expr
+ │
+ renderer: damage-driven software raster (parallel) or GPU (Direct3D 11 / OpenGL 3.3, instanced, opt-in)
+ │
+ window: native Win32 / X11 / Cocoa window · stdlib Tk window · headless (tests, screenshots)
+```
-</td></tr>
-<tr><td valign="top">
+1. **Your code**, in any language above, creates widgets and says what happens
+ when they change.
+2. **The kit** keeps them in one tree, lays them out and handles input,
+ following Blender's rules.
+3. **The renderer** draws them, on the CPU by default or on the GPU if you ask.
+4. **Damage rendering** keeps it cheap: a change redraws only the rectangle it
+ touched, and an idle window uses no CPU at all.
-### ⚛️ JavaScript and React
+What's under the hood:
-- **React 19.3** renders to BUI: HTML host components, CSS and Tailwind, events, Suspense, transitions, actions, and Blender components (`<NumberSlider>`, `<Button>` ...). BUI draws them, on the CPU or the GPU; there's no browser and no webview.
-- **React's hooks, by React's names**, holding signals: pass one into JSX (`{count}`) and a change updates that one node without re-rendering; read it while rendering (`count.value`) and the component re-renders, as with React. A conformance suite checks each hook against React's own.
-- **`@blender-ui/native`**: a DOM-like API (`createElement`, `appendChild`, `addEventListener`) with the same signals, for apps without React.
-- **Node.js and Bun**, through a napi-rs addon, with headless mode for tests.
-
-</td><td valign="top">
-
-### 📦 Small standalone apps
+- **Blender's real UI code.** Widget drawing is a C port of Blender's
+ `interface_widgets.cc` (`round_box_edges`, `widgetbase_draw`, the shape
+ tables), and interaction follows `interface_handlers.cc`. Color math, rects,
+ text cursors, string search and expression evaluation are Blender's
+ `blenlib`, copied in. A few interface files (string search, text-edit undo,
+ float precision) are copied into `kit/intern/blender/` and edited for the
+ kit. The X11 and Cocoa hosts follow Blender's GHOST; the Win32 host is BUI's
+ own.
+- **One node tree.** Every widget is one kit node. The C kit owns layout, hit
+ testing, hover, focus, drags, menus, tooltips, undo and animation.
+- **Damage rendering.** A change marks only its widget's rectangle, and only
+ changed tiles reach the screen.
+- **Thin bindings.** Python, Rust and JavaScript keep only what their syntax
+ layer needs.
-- **`bui build app.jsx`** produces one executable of about **5 MB**: BUI with an embedded QuickJS engine.
-- **First frame in ~70 ms**, at **19 MB** of RAM, with nothing to install. There's no browser and no webview.
-- **`--bun`** builds a Bun executable instead, with Node's APIs and a JIT.
-- Builds take under a second: the app's bundle is appended to a prebuilt runtime.
+More: [ARCHITECTURE.md](ARCHITECTURE.md) and
+[How it works](https://bui.preetham.top/docs/concepts/how-it-works/).
+
+## 16. Blender's widgets and interactions
+
+These rules live in the C kit, so they work the same everywhere Blender
+widgets are drawn: the Python components, tkinter and Qt syntax, the Rust and
+JavaScript Blender components and form controls inside `styled`, ImGui's
+Blender-widgets build, and every C kit widget.
+
+- **Drag to scrub.** Press a number field and drag sideways. The cursor hides
+ and wraps, so you never hit the screen edge, and comes back where the drag
+ started. A float moves one click step per pixel; Shift moves at a tenth of
+ the speed; Esc cancels and restores the value.
+- **Ctrl snaps** with Blender's rules: unbounded floats to whole units, angles
+ to 10°, sliders to 0.1, 1 or 10 depending on their range, integers to
+ multiples of 10.
+- **Click to type**, and type **math**: Blender's expression evaluator
+ (`expr_pylike_eval.cc`) turns `2*pi`, `90/4`, `min(4, 3)` or
+ `x if c else y` into numbers. This works in Blender number fields and
+ sliders; plain text fields keep what you type as text.
+- **Shortcuts on any value:** Backspace resets to the default, `-` negates,
+ Ctrl+Wheel steps, Ctrl+C / Ctrl+V copy and paste, right-click opens Copy,
+ Paste and Reset.
+- **Several fields at once.** Drag *down* over a column of number fields to
+ collect them, then sideways to change them together. Drag across checkboxes
+ (or panel headers) to set them all in one stroke.
+- **Panels** collapse with Blender's animation; Ctrl+click opens one and
+ closes the others; drag the grip to reorder.
+- **Menus** work press-drag-release or click; hover switches menu-bar menus;
+ **pie menus** open around the pointer.
+- **Menu search** is Blender's string search: start typing in any open menu.
+ It matches word initials ("ad cu" finds "Add Cube"), forgives typos, and
+ ranks your recent picks first.
+- **Undo everywhere.** Ctrl+Z and Ctrl+Shift+Z work on every UI edit, and
+ inside a text field while you type. A burst of typing or a multi-field drag
+ is one step.
+- **Float precision** follows Blender: small values show the decimals they
+ need.
+- **Tooltips** appear after Blender's half-second delay.
+
+Coming soon: typing values with units ("2 m"), Blender's search-as-you-type
+popups, and widget drag and drop. More:
+[Blender's widgets](https://bui.preetham.top/docs/concepts/blender-widgets/).
+
+## 17. Three looks: HTML, styled and Blender components
-</td></tr>
-<tr><td valign="top">
+In Rust and JavaScript you pick the look per element:
-### 🧩 Dear ImGui
+| You write | You get |
+| --- | --- |
+| Plain HTML: `<button>`, `<input type="range">`, `<select>` ... | What a browser draws: black text on white and Chrome's form controls, in the Inter UI font |
+| `styled` on any element: `<div styled>`, `div().styled()` | Blender's look for it and everything inside: Blender's theme (dark or light), UI font, Blender widgets |
+| **Blender components** (capitalized): `<NumberSlider>`, `<Button>` ... | Blender's widgets and interaction everywhere (drag to scrub, Ctrl+Z, Blender's color picker) |
-- **The real Dear ImGui 1.93**: every function of `imgui.h` works, including `ShowDemoWindow()`.
-- **Four languages**: C++ (drop-in `imgui.h`), C (`cimgui.h`, all 399 functions), Python and Rust (generated from `imgui.h`).
-- **Blender's look**: Blender's theme colors and metrics with Inter; or, with `BUI_IMGUI_BLENDER_WIDGETS=ON`, Blender's actual widgets and interaction, pixel-identical to BUI's own.
-- **Idle costs nothing**: frames run only on input and while something animates.
+The components are `Button`, `Checkbox`, `Radio`, `NumberField`, `NumberSlider`,
+`TextField`, `TextArea`, `ColorSwatch`, `Dropdown` and `ProgressBar`. Each one
+is the HTML element it stands for, so every attribute, style and event works on
+it:
-</td><td valign="top">
+```rust
+rsx! {
+ <main class="p-4 flex gap-2"> // browser look
+ <input type="range" /> // Chrome's slider
+ <NumberSlider min={0.0} max={10.0} value="2.5" /> // Blender's slider
+ <div styled><button>"Apply"</button></div> // Blender's look inside
+ </main>
+}
+div().child(Checkbox().checked(true)).child(Button().child("Apply")) // gpui syntax
+```
-### 🖥️ Native everywhere
+```jsx
+import { render, NumberSlider, Button } from "@blender-ui/react"
+// <NumberSlider min={0} max={10} onChange={...} />, <Button onClick={...}>Apply</Button>
+// DOM API: win.createElement("NumberSlider")
+```
-- **Native windows** on Windows (Win32) and Linux (X11, Wayland through XWayland), and a Cocoa host for macOS ported from Blender's GHOST.
-- **HiDPI**: per-monitor DPI on Windows, `Xft.dpi` on Linux, Retina on macOS.
-- **Headless mode** for tests and screenshots, with a virtual clock that steps animations exactly.
-- On Linux, libX11 and libGL are loaded at run time, so BUI imports on servers without them.
+<p align="center">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/rust-forms.png" width="460" alt="Form controls as plain HTML, inside styled, and as Blender components">
+ <br><sub><code>cargo run --example forms</code>: plain HTML, inside <code>styled</code>, and the Blender components</sub>
+</p>
-</td></tr>
-</table>
+<p align="center">
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-html-plain-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-html-plain-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-html-plain-dark.png" width="400" alt="A form and a table in plain HTML, with a browser's default look">
+</picture>
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-html-styled-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-html-styled-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-html-styled-dark.png" width="400" alt="The same markup inside styled: Blender's theme and widgets">
+</picture>
+<br><sub>The same markup, plain (left) and inside <code>styled</code> (right). Plain HTML looks the same in both themes.</sub>
+</p>
-<details>
-<summary><b>More screenshots</b></summary>
<p align="center">
- <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/rust-showcase.png" width="560" alt="The Rust showcase: a stylesheet, grid cards, Blender form widgets, a table and lists">
- <br><sub><code>examples/showcase.rs</code>: HTML + CSS in Rust</sub><br><br>
- <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/imgui-stock.png" width="560" alt="Dear ImGui's demo in Blender's theme, with ImGui's own widgets">
- <br><sub>Dear ImGui's demo with its own widgets, in Blender's theme</sub><br><br>
- <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/qt.png" width="420" alt="Qt syntax on BUI">
- <br><sub>Qt syntax</sub><br><br>
- <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/tkinter_notes.png" width="260" alt="tkinter Text with tags">
- <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/tkinter_canvas.png" width="260" alt="tkinter Canvas">
- <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/docs/images/tkinter_messagebox.png" width="260" alt="tkinter messagebox">
- <br><sub>tkinter programs: text with tags, canvas, dialogs</sub>
+<picture>
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-components-dark.png">
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-components-light.png">
+ <img src="https://raw.githubusercontent.com/ppmpreetham/BUI/main/website/public/images/shots/rust-components-dark.png" width="340" alt="Camera properties built from Blender components in Rust: number fields, sliders, a dropdown, checkboxes, a text field, a color swatch, a progress bar and buttons">
+</picture>
+<br><sub>Blender components from Rust (<code>site_components.rs</code>)</sub>
</p>
-</details>
-### A taste of the Rust side
+Python's [Blender components](docs/components.md) (`Panel`, `PieMenu`, the node
+editor ...) are a separate, larger set.
+
+## 18. Rendering on the CPU and the GPU
+
+BUI has two renderers, and they draw **the same pixels**.
+
+- **The software raster** (`gpu/intern/gpu_raster.c`) is the default. It draws
+ anti-aliased shapes with signed-distance coverage, like Blender's widget
+ shaders, into one frame buffer, compares it with the last frame in 64×32
+ tiles, and reports only the tiles that changed. Big canvases draw in
+ parallel bands on Windows (`BUI_RASTER_THREADS`). It needs nothing from your
+ graphics card and uses the least memory.
+- **The GPU renderer** is opt-in: **Direct3D 11 on Windows**
+ (`gpu/intern/gpu_d3d11.c`) and **OpenGL 3.3 core on Linux**
+ (`gpu/intern/gpu_gl.c`). It's modeled on Blender's instanced widget drawing:
+ each primitive is one 128-byte instance of a single uber-shader, so a frame
+ is a few instanced draw calls. Text and images are cached in atlases.
+ Frames render into a persistent target, so only damaged regions redraw; on
+ Windows, a flip-model swap chain presents dirty rectangles. On Linux,
+ `libGL`, `libEGL` and `libX11` are loaded at run time (GLX for windows, EGL
+ for offscreen), so no GL headers are needed, and BUI falls back to the CPU
+ where OpenGL is missing.
+
+The shaders evaluate the software raster's formulas: the parity test finds 10
+of 172,800 pixels that differ by more than 3/255, on both backends.
+
+Turn the GPU on:
+
+| Where | How |
+| --- | --- |
+| Python | `bui.set_gpu(True)` before creating windows; tkinter syntax also `tk.Tk(gpu=True)` |
+| Rust | `Application::new().gpu(true)`, or `WindowOptions { gpu: Some(true), .. }` |
+| JavaScript | `new App({ gpu: true })`, or React's `render(..., { gpu: true })` |
+| C | `BUI_gpu_set_default(1)`, or `BK_window_set_gpu(win, 1)` |
+| Any app, no code change | `BUI_GPU=1` |
+
+`BUI_GPU=1` overrides the app-wide setting in code; `BUI_GPU=0` turns the
+app-wide defaults off, but a window that asks for the GPU itself still gets
+it. Where no device can start, BUI quietly stays on the CPU
+(`BUI_GPU_DEBUG=1` says why).
+
+**Which one?** A tool window, form or settings panel: the CPU (lightest on
+memory, idles at zero). A large or HiDPI window, lots of animation, thousands
+of items: the GPU (about half the CPU per frame, or less, for about 10 MB more
+RAM plus GPU memory). Servers and tests: the CPU. macOS: the CPU, for now
+(a GPU renderer there is coming soon).
+
+More: [Rendering](https://bui.preetham.top/docs/concepts/rendering/).
+
+## 19. Damage rendering
+
+Leave a BUI window open and walk away: it uses no CPU at all. Hover a button,
+and BUI redraws that button, not the window.
+
+1. A change marks only its widget's rectangle as dirty (popups get a margin
+ for their shadow).
+2. Dirty rectangles merge (up to 24 per window).
+3. If nothing is dirty, the loop doesn't render; it sleeps until the next
+ input or timer.
+4. Only the dirty regions are redrawn, clipped to their rectangles.
+5. The raster compares the new pixels with the last frame in 64×32 tiles; a
+ redraw that changed nothing reports nothing.
+6. Only damaged tiles reach the screen (Win32 copies them, X11 sends each
+ rectangle with `XPutImage`, Cocoa invalidates them, the GPU presents dirty
+ rectangles).
+
+On the full component demo, that's about **0.7 ms** for a complete frame and
+about **0.05 ms** for a hover or number-scrub frame. Animations run only while
+something moves, paced to the display. More:
+[Damage rendering](https://bui.preetham.top/docs/concepts/damage-rendering/).
+
+## 20. Window hosts
+
+A **window host** puts a kit context in a top-level window and feeds it input.
+
+| Host | Where | Notes |
+| --- | --- | --- |
+| **Win32** (`kit_window_win32.c`) | Windows | BUI's own host. Per-monitor DPI, vsync-paced animation, clipboard, cursors, window-manager features. |
+| **X11** (`kit_window_x11.c`) | Linux; Wayland through XWayland | Input mapping after Blender's GHOST. `Xft.dpi` scaling. libX11 is loaded when the first window opens. |
+| **Cocoa** (`kit_window_cocoa.m`) | macOS | **Experimental.** Ported from Blender's GHOST Cocoa code, with Retina scaling. So far it's only been checked by CI, not yet by a person on a real Mac; testing notes in [docs/macos-testing.md](docs/macos-testing.md). |
+| **Tk** | Python, anywhere | A stdlib `tkinter` window that shows the kit's frame buffer. `BUI_HOST=tk` forces it; it's also the fallback where no native host works. |
+| **Headless** | Everywhere | No window: render into a raster for tests and screenshots, with a virtual clock that steps animations exactly. |
+
+`BUI_UI_SCALE=1.5` fixes the UI scale instead of following the display (1 is
+Blender's default, 20 px widgets). More:
+[Window hosts](https://bui.preetham.top/docs/concepts/window-hosts/).
+
+## 21. Text and fonts
+
+Your app's text looks the same on Windows, Linux and macOS, and it looks like
+Blender's:
+
+- **Inter**, Blender's UI font, is embedded (the variable version, with
+ optical-size and weight axes). UI text is 11 pt at scale 1.
+- **Rendered like Blender's BLF**: BUI vendors FreeType 2.13.3 and renders
+ with light hinting, Blender's gamma-1.43 coverage table, Inter's optical
+ size, a real bold instance, no kerning (as in Blender), and Blender's text
+ shadows. With `BUI_TEXT_FREETYPE=OFF`, stb_truetype rasterizes instead.
+- **On the GPU**, glyphs are drawn from their outlines with
+ [Slug](https://github.com/EricLengyel/Slug) by default, or from a per-glyph
+ atlas like Blender's (`BUI_SLUG=0`, `bui.set_slug(False)`,
+ `.slug(false)`, `BUI_gpu_set_slug(0)`).
+- **Other fonts**: `BUI_FONT=path.ttf` replaces Inter, `BUI_FONT_DIR` adds a
+ folder to search first, `blenderui::add_font` (Rust) and
+ `BUI_text_add_font` (C) register faces from memory, and CSS `@font-face`
+ loads local files.
+- **Windows' GDI text** is opt-in (`-DBUI_TEXT_GDI=ON`, Rust feature
+ `gdi-text`): ClearType-style hinting and system fonts, without Slug.
+
+Limits worth knowing: no per-glyph font fallback yet (missing characters show
+as boxes), no IME, right-to-left text is reordered but not shaped, no OpenType
+features. Font fallback and IME are coming soon. More:
+[Text and fonts](https://bui.preetham.top/docs/concepts/text-and-fonts/).
+
+## 22. Themes: dark and light
+
+BUI looks like Blender because it uses Blender's theme. It ships two:
+Blender's **Dark** theme (the default) and its **Light** preset. Both are
+generated by `tools/gen_theme.py` from Blender's own `Blender_Dark.xml` and
+`Blender_Light.xml` presets, over Blender 5.x's built-in defaults. Switch at
+run time, and every open window relayouts and redraws:
+
+| Where | Light theme |
+| --- | --- |
+| C | `BK_set_theme("light")`; `BK_theme_name()`, `BK_theme_color("region_bg", rgba)` |
+| Python | `blenderui.set_theme("light")` (also switches the Dear ImGui extension); `theme_name()`, `theme_color(key)` |
+| Rust | `blenderui::set_theme("light")`, or `Application::new().theme("light")`; `theme_name()`, `theme_color(key)` |
+| JavaScript | `new App({ theme: "light" })`, `app.setTheme("light")`, or React's `render(..., { theme: "light" })` |
+| Dear ImGui | Its Blender style follows the kit's theme (pick it before the backend starts) |
+| Any app, no code change | `BUI_THEME=light` (or `dark`) |
+
+Widgets, panels, the region background, the `styled` HTML sheet and ImGui's
+Blender style all follow the theme. Plain HTML keeps a browser's look either
+way. Inside each theme you can still color things yourself: `bg` / `fg` in
+tkinter, `setStyleSheet` in Qt syntax, `color=` on components, full CSS on
+HTML in Rust and JavaScript, ImGui's own style colors.
+
+BUI also includes Blender's icons: all 781 of Blender's SVG icons, rasterized with Blender's NanoSVG code so
+they're sharp at any scale. Use them by Blender's name: `Button("Add",
+icon="ADD")`, `EnumRow(..., icons=[...])`.
+
+Coming soon: loading any Blender theme file, beyond Dark and Light. More:
+[Theming](https://bui.preetham.top/docs/concepts/theming/).
+
+---
+
+# Part IV: Guides by language
+
+## 23. Python
+
+`pip install blenderui` gives you four APIs in one package:
+
+- **tkinter syntax** (`blenderui.tksyntax`): every public tkinter and ttk name
+ (7,846 of 7,846). Run existing programs with `blenderui-tk app.py`, or call
+ `blenderui.tksyntax.install()` first. `messagebox` and `simpledialog` are
+ Blender-styled, `colorchooser` is Blender's color picker, and `filedialog`
+ is Blender's File Browser (`BUI_FILEDIALOG=native` for the OS dialogs).
+ Look-only Tk options (`relief`, `ttk.Style` ...) are accepted, but the look
+ comes from Blender's theme. Guide: [docs/tkinter.md](docs/tkinter.md).
+- **Qt syntax** (`blenderui.qtsyntax`): widgets, layouts (box, grid, form,
+ stacked), signals, `QPainter`, menus, timers and animations, `QFileDialog`
+ as Blender's File Browser. Partial: model/view classes, docks, toolbars,
+ splitters and Qt stylesheets are missing. Guide: [docs/qt.md](docs/qt.md).
+- **Blender components** (`blenderui.components`): 45 components, from
+ `NumberSlider` to `NodeEditor`. Reference:
+ [docs/components.md](docs/components.md).
+- **Dear ImGui** (`blenderui.imgui`), pyimgui-style. Guide:
+ [docs/imgui.md](docs/imgui.md#python).
+
+You can mix them in one process: windows, timers and the event loop are shared
+(`bui.host`). Every interaction runs in C, so tests can drive widgets headless.
+On the website: [tkinter](https://bui.preetham.top/docs/python/tkinter/),
+[Qt syntax](https://bui.preetham.top/docs/python/qt-syntax/),
+[components](https://bui.preetham.top/docs/python/components/),
+[headless testing](https://bui.preetham.top/docs/python/headless-testing/).
+
+## 24. Rust
+
+The `blenderui` crate is a web-like framework drawn by BUI: every HTML element,
+CSS, Tailwind, HTML-like markup (`rsx!` / `view!`) or gpui-style builders,
+components and hooks. A taste:
```rust
rsx! {
@@ -412,106 +1223,134 @@ rsx! {
error: rsx!: `bg-sky-50O` is not a Tailwind utility; did you mean `bg-sky-500` or `bg-sky-50` or `bg-sky-100`?
```
-## Platforms
-
-| | Windows | Linux | macOS |
-| --- | --- | --- | --- |
-| Window | Native (Win32) | Native (X11; Wayland through XWayland) | Native (Cocoa) 🧪 |
-| Python (`pip install`) | ✅ wheels | ✅ wheels | ✅ wheels |
-| Rust | ✅ | ✅ (build from source) | ✅ 🧪 |
-| JavaScript / React | ✅ prebuilt on npm | ✅ build the addon from source (`npm run build`) | headless (see below) |
-| C, C++, Dear ImGui | ✅ | ✅ | ✅ 🧪 |
-| Renderer | CPU raster, or GPU (Direct3D 11) | CPU raster, or GPU (OpenGL 3.3) | CPU raster |
-| HiDPI | Per-monitor DPI | `Xft.dpi` | Retina (backing scale) |
-
-🧪 The macOS window host is new: it's a port of Blender's Cocoa code (GHOST),
-written but not yet run on a Mac. Python can still use the stdlib Tk window
-there (`BUI_HOST=tk`). Node runs BUI on its own UI thread and macOS only allows
-windows on the main thread, so JavaScript stays headless on macOS for now.
-
-On Linux, libX11 and libGL are loaded when the first window opens, so BUI also
-imports and renders headless on servers and in containers without them, and
-falls back to the CPU raster where OpenGL is missing. Building from source needs
-the X11 headers (`libx11-dev` / `libX11-devel`); no GL headers are needed. The
-C, Python, window and GPU parity tests pass on Linux, on Mesa's software OpenGL
-and on an NVIDIA GPU.
-
-## Status
-
-### ✅ Done
-
-| Area | What works |
-| --- | --- |
-| C runtime (`kit/`) | Nodes, Tk-style geometry managers, input, Blender widget drawing, damage rendering, undo, animation, text area, canvas, scroll views, Blender's string search, expression evaluator, text-edit undo and float precision |
-| Native windows | Windows (Win32) and Linux (X11; Wayland through XWayland), in C: DPI-aware, frame-paced animation, clipboard, cursors, window-manager features |
-| tkinter syntax | **Complete**: every public tkinter and ttk name (7,846 of 7,846) |
-| Components | 45 Blender components, including the color ramp, curve and node editors |
-| Rust | HTML (113/113 elements), Flexbox 12/12, Grid 23/23, CSS 2.1 90/90, math functions, `var()`, CSS Color 4/5, Selectors 4, `@layer` / `@media` / `@supports` / `@scope` / `@container` / `@font-face` / `@property`, `@keyframes` animations and transitions, filters / blend modes / masks / `clip-path` / 2D transforms / `border-image`, bidi text, background images, `object-fit`, Tailwind v4, `rsx!`, `#[component]` with optional props and `key`, hooks, Blender components, browser-look form controls, headless testing |
-| Dear ImGui | The real Dear ImGui 1.93 on BUI (CPU, Direct3D 11, OpenGL), Blender theme and Inter; C++ / C (399/399 functions) / Python and Rust (366–385/399); the Blender-widgets build |
-| Rendering | Software raster (parallel, damage-tracked), GPU renderer (Direct3D 11 on Windows, OpenGL 3.3 on Linux), textured meshes, portable text engine |
-| JavaScript / React | `@blender-ui/native`: a DOM-like API over napi-rs, with its own UI thread, only changes crossing the boundary, vsync-paced `requestAnimationFrame` and signals. `@blender-ui/react`: a React 19.3 renderer whose hooks (`useState`, `useMemo`, `useEffect` ...) hold signals that update nodes without re-renders. Both on Node.js and Bun, with headless testing. `bui build` makes standalone executables: about 5 MB with the embedded QuickJS runtime, or Bun's with `--bun` ([guide](docs/javascript.md)) |
-| Packaging | [`blenderui` on PyPI](https://pypi.org/project/blenderui/), with a CI workflow for wheels on all platforms (Linux wheels with the native X11 host); [`@blender-ui/react`](https://www.npmjs.com/package/@blender-ui/react) and [`@blender-ui/native`](https://www.npmjs.com/package/@blender-ui/native) on npm |
-
-### 🟡 Partial or in progress
-
-| Area | What's missing |
-| --- | --- |
-| Qt syntax (~25%) | Model/view classes, docks, toolbars, splitters, Qt stylesheets ([details](docs/qt.md#coverage)) |
-| CSS (261 of 745 W3C properties render, 129 more parse) | 3D transforms, OpenType font features, multi-column layout; hit testing ignores 2D transforms. Most of the remaining W3C list is drafts, speech, print and SVG ([breakdown](docs/rust.md#coverage)) |
-| Text | No text wrapping around floats; right-to-left text is reordered (bidi) but not shaped (Arabic joining); no OpenType features; no per-glyph font fallback yet (characters missing from the font show as boxes); no IME |
-| Rust components | No async resources (`use_resource`); no generic components |
-| Dear ImGui | Python and safe Rust skip the `va_list`, `void*` and C-callback functions (reachable from C and the Rust FFI); with Blender widgets, window title bars, tooltips, plain popups, tables and the color picker keep ImGui's drawing |
-| JavaScript / React packages | npm packages are prebuilt for Windows x64 only (on Linux, build the addon from source); events reach JavaScript after BUI handled them (no native `preventDefault`), and `event.target` is the deepest _listening_ element |
-| macOS | The native Cocoa window host is written but not yet tested on a Mac; JavaScript is headless there (Node's UI thread isn't the main thread); no GPU renderer yet |
-| crates.io | The crates are ready to publish but not published yet; use the git dependency for now |
-
-### 🗺️ Planned
+What's in the box:
+
+- **Layout** by [taffy](https://github.com/DioxusLabs/taffy): block flow and
+ wrapping text, flexbox and grid (every property, including
+ `grid-template-areas` and named lines), tables, `relative` / `absolute` /
+ `fixed` positioning (fixed boxes are placed against the window), scrolling,
+ and bidirectional text.
+- **CSS**: selectors level 4, nesting, `@layer` / `@media` / `@supports` /
+ `@scope` / `@container` / `@font-face` / `@property`, `var()` and `env()`,
+ every math function, CSS Color 4 and 5.
+- **Effects and animations**: `@keyframes` animations and transitions (every
+ longhand, `cubic-bezier()`, `steps()`, `linear()`, interruptible
+ transitions), `filter` and `backdrop-filter`, `mix-blend-mode`, `clip-path`,
+ masks, 2D transforms, `border-image`. Frames render only while something
+ moves, and headless windows step a virtual clock (`App::advance_clock`).
+- **Tailwind CSS v4**, compiled on first use, with compile-time checks in
+ `rsx!` and `tw!`.
+- **Components and hooks** in zopra, React or Leptos style, with optional
+ props and keys.
+- **Blender components**, `styled`, and the [theme](#22-themes-dark-and-light).
+- **Headless testing**: `Application::headless()`, screenshots, simulated
+ input.
+
+Not yet: async resources (`use_resource`), generic components, 3D
+transforms, OpenType features, multi-column layout. Guide:
+[docs/rust.md](docs/rust.md), crate README:
+[bindings/rust/blenderui](bindings/rust/blenderui/README.md), and the website's
+[Rust section](https://bui.preetham.top/docs/rust/overview/) (including
+[effects and animations](https://bui.preetham.top/docs/rust/effects-and-animations/)).
+
+## 25. JavaScript and React
+
+- **`@blender-ui/react`**: a React 19.3 renderer. HTML host components, CSS and
+ Tailwind, events, Suspense, transitions, actions, and the Blender components.
+ Hooks keep React's names but hold signals: pass one into JSX and a change
+ updates that node without re-rendering. README:
+ [bindings/react](bindings/react/README.md).
+- **`@blender-ui/native`**: a DOM-like API (`createElement`, `appendChild`,
+ `addEventListener`, `className` with Tailwind, `style`) with signals,
+ `memo`, `effect` and `batch`. README: [bindings/node](bindings/node/README.md).
+- **How it's fast**: BUI renders on its own UI thread, so it never blocks
+ JavaScript; each tick sends one batch of changes; styles are parsed once.
+- **Standalone apps**: `npx bui build app.jsx` makes a ~5 MB executable with
+ an embedded QuickJS engine; `--bun` makes a Bun executable instead;
+ `npx bui run app.jsx` runs on QuickJS without building.
+- **Tests**: `new App({ headless: true })` renders off-screen, and
+ `win.click(x, y)` simulates input.
+
+Limits: npm packages are prebuilt for Windows x64 only; events reach
+JavaScript after BUI handled them (no native `preventDefault`), and
+`event.target` is the deepest *listening* element. Guide:
+[docs/javascript.md](docs/javascript.md); website:
+[React](https://bui.preetham.top/docs/javascript/react/),
+[native API](https://bui.preetham.top/docs/javascript/native-api/),
+[signals](https://bui.preetham.top/docs/javascript/signals/),
+[standalone executables](https://bui.preetham.top/docs/javascript/standalone-executables/).
+
+## 26. Dear ImGui
+
+| Language | What you use | Built by |
+| --- | --- | --- |
+| C++ | `imgui.h` + `imgui_impl_bui.h` | CMake target `bui_imgui` (`bui::imgui`) |
+| C | `cimgui.h` + `cimgui_impl_bui.h` | CMake target `bui_cimgui` |
+| Python | `import blenderui.imgui as imgui` | The `_buiimgui` extension, in the wheel |
+| Rust | the `blenderui-imgui` crate (git dependency for now) | Cargo |
+
+The C, Python and Rust bindings are generated from `imgui.h`. ImGui is
+idle-free on BUI: frames run only on input and while something animates.
+The Blender-widgets build (`BUI_IMGUI_BLENDER_WIDGETS=ON`, Rust feature
+`blender-widgets`) swaps in Blender's widgets, and can be switched at run time
+(`ImGui_ImplBUI_SetBlenderWidgets`, `imgui.set_blender_widgets`). In that
+build, window title bars, tooltips, plain popups, tables and the color picker
+keep ImGui's drawing.
+
+Guides: [docs/imgui.md](docs/imgui.md),
+[bindings/imgui/README.md](bindings/imgui/README.md) (the backend and the
+Blender style), [bindings/imgui/blender/README.md](bindings/imgui/blender/README.md)
+(the widget mapping), and the website's
+[Dear ImGui section](https://bui.preetham.top/docs/imgui/cpp/).
+
+## 27. C and embedding
+
+The kit's concepts: **nodes** made by type name (`frame`, `slider`, `button`,
+`panel`, `tree`, `canvas`, `filebrowser` ...), **properties** set by name,
+Tk's **geometry managers** (pack, grid, place) in C, a **context** that owns
+input, popups, focus and undo, a **host** that receives events, and
+**windows**. A `custom` node draws and handles input itself; Dear ImGui runs
+on BUI that way. Guide: [docs/c-api.md](docs/c-api.md).
+
+To embed BUI in your own renderer, render the kit into a `BuiRaster` and blit
+it (as `bui.qt.BuiCanvas` does inside Qt). A separate, lower-level layer,
+**render sinks** (`api/bui_c_api.h`), hands the triangles, lines and text of
+the immediate-mode GPU seam to your renderer; the Qt/QPainter backend and the
+SVG recorder use it. Guide: [INTEGRATION.md](INTEGRATION.md).
+
+## 28. Where the docs live
-| Target | Plan |
+| Guide | What's inside |
| --- | --- |
-| **WebAssembly** | The kit in the browser: the raster blits to `<canvas>`, DOM events feed the kit; `@blender-ui/react` and the DOM-like API on top, unchanged |
-| **egui** | BUI panels inside egui, plus a Blender-styled theme |
-| **More from Blender's source** | Per-glyph font fallback (BLF), IME, search-as-you-type popups, units in number fields, widget drag and drop |
-| **macOS GPU and JavaScript windows** | The GPU renderer on Metal (or the OpenGL backend), and Node windows on the main thread |
-| **More GPU backends** | Vulkan / WebGPU drawing the same instance stream as Direct3D 11 and OpenGL |
-| **More languages** | MyGo, C#, Go, Zig, Swift, Kotlin and Lua over the same C header; Godot, Unity and Bevy; Flutter |
-
-## How it works
-
-```
- your code: tkinter Qt components Dear ImGui (C++/C/Python/Rust) Rust: rsx! / HTML / CSS / Tailwind / hooks JS / React
- │ │ │ │ │ │
- └──── Python: options, signals │ ImGui core + BUI backend └── style cascade + taffy layout ◄────┘
- │ │ │
- C kit (kit/): node tree · geometry · input & interaction · Blender widget drawing · undo · animation · Blender search/expr
- │
- renderer: damage-driven software raster (parallel) or GPU (Direct3D 11 / OpenGL 3.3, instanced, opt-in)
- │
- window: native Win32 / X11 / Cocoa window · stdlib Tk window · headless (tests, screenshots)
-```
+| [Website](https://bui.preetham.top) | Everything below, as tutorials, concepts and references, with screenshots in dark and light |
+| [Getting started](docs/getting-started.md) | Building, environment variables, window hosts, GPU rendering, troubleshooting |
+| [tkinter](docs/tkinter.md) | Running tkinter apps on BUI, behavior notes, limitations |
+| [Qt syntax](docs/qt.md) | Classes, signals, layouts, painting, coverage |
+| [Components](docs/components.md) | The `bui.components` reference |
+| [Rust](docs/rust.md) | `rsx!`, hooks, HTML, CSS and Tailwind coverage, effects, animations, events, headless tests |
+| [JavaScript and React](docs/javascript.md) | `@blender-ui/native`, `@blender-ui/react`, how changes cross to the UI thread, performance |
+| [Dear ImGui](docs/imgui.md) | Dear ImGui on BUI from C++, C, Python and Rust; the Blender-widgets build; coverage |
+| [C API](docs/c-api.md) | The C kit (`BUI_kit.h`) |
+| [Integration](INTEGRATION.md) | Embedding BUI drawing in C, C++, Qt or PySide hosts |
+| [Architecture](ARCHITECTURE.md) | Modules and what was taken from Blender |
+| [Syntax coverage](SYNTAX_COVERAGE.md) | The Qt and tkinter surface, exactly |
+| [macOS testing](docs/macos-testing.md) | How to try the experimental Cocoa host on a Mac |
+| [Publishing](docs/publishing.md) | Releasing to PyPI and crates.io |
+| [Changelog](CHANGELOG.md) | What changed |
-- **Blender's real UI code.** Widget drawing is a C port of Blender's
- `interface_widgets.cc` (`round_box_edges`, `widgetbase_draw`, the shape
- tables), and interaction follows `interface_handlers.cc`. Color math, rects,
- text cursors, string search and expression evaluation are Blender's
- `blenlib`, copied in. The X11 and Cocoa hosts follow Blender's GHOST.
-- **One node tree.** Every widget is one kit node. The C kit owns layout, hit
- testing, hover, focus, drags, menus, tooltips, undo and animation.
-- **Damage rendering.** A change marks only its widget's rectangle, and only
- changed tiles reach the screen.
-- **Thin bindings.** Python, Rust and JavaScript keep only what their syntax
- layer needs.
+---
-More: [ARCHITECTURE.md](ARCHITECTURE.md).
+# Part V: Performance
-## Performance
+## 29. Before you read the numbers
These numbers were measured on a Ryzen 7 5800U laptop (Windows 11, on AC
-power) before the latest features (ImGui, the Linux GPU renderer, the Blender
-search and expression code) landed. Rerun them with the tools in
-[Run the benchmarks yourself](#run-the-benchmarks-yourself).
+power) **before the latest features landed**: Dear ImGui, the Linux GPU
+renderer, the light theme, and the Blender search and expression code. They
+show the shape of things, not a promise for your machine. Rerun them with the
+tools in [Run the benchmarks yourself](#33-run-the-benchmarks-yourself).
-### Start time and battery
+## 30. Start time and battery
The same small settings window (a label, text field, checkbox, slider and
button) written each of the five ways, from [`bench/apps`](bench/apps), on
@@ -556,7 +1395,7 @@ uses more memory (the GPU device), and pays off on large, animated scenes
(below). Node's event loop accounts for the JavaScript idle figure, Python's
times include starting the interpreter, and memory doesn't count GPU memory.
-### Frame times
+## 31. Frame times
Python and C, on the full component demo (520×900):
@@ -571,7 +1410,7 @@ full software redraw of about 5–8 ms.
Rust, against Zed's [gpui](https://crates.io/crates/gpui) and the faster fork
[gpui-fast](https://github.com/longbridge/gpui-fast). The scene is 3000
-animated cells, and all apps ran in the same session:
+animated cells, and all apps ran in the same session (GPU rows on Direct3D 11):
| | blenderui (GPU) | blenderui (CPU) | gpui-fast | gpui |
| --- | ---: | ---: | ---: | ---: |
@@ -610,7 +1449,7 @@ gpui-fast's heavy-scene frame rate varies between sessions on this laptop
[bindings/rust/bench/README.md](bindings/rust/bench/README.md).
</details>
-### JavaScript and React: startup and animation
+## 32. JavaScript and React: startup and animation
**Startup.** These launch a small React app (the counter above) that quits once
its first frame is on screen. Each figure is the median of 12 launches after a
@@ -664,7 +1503,7 @@ What this means:
Method, the memory breakdown and how to rerun:
[docs/javascript.md](docs/javascript.md#performance).
-### Run the benchmarks yourself
+## 33. Run the benchmarks yourself
Every number above comes from a tool in this repo. Build in release mode, close
other heavy apps, and plug the laptop in. Run one benchmark (and one build) at
@@ -726,51 +1565,89 @@ py bindings/python/bench/tk_canvas_bench.py 3000 one # move one
```
**Inside any app:** run it with `BUI_PROFILE=1` to print per-phase frame times
-(layout, paint, raster, present), and with `BUI_GPU=1` / `BUI_GPU=0` to pick the
-renderer.
+(layout, paint, raster, present) every 60 frames; any value turns it on. Use
+`BUI_GPU=1` / `BUI_GPU=0` to pick the renderer. More:
+[Profiling](https://bui.preetham.top/docs/performance/profiling/).
-## Documentation
+---
-| Guide | What's inside |
-| --- | --- |
-| [Getting started](docs/getting-started.md) | Building, environment variables, window hosts, GPU rendering, troubleshooting |
-| [tkinter](docs/tkinter.md) | Running tkinter apps on BUI, behavior notes, limitations |
-| [Qt syntax](docs/qt.md) | Classes, signals, layouts, painting, coverage |
-| [Components](docs/components.md) | The `bui.components` reference |
-| [Rust](docs/rust.md) | `rsx!`, hooks, HTML, CSS and Tailwind coverage, effects, animations, events, headless tests |
-| [JavaScript and React](docs/javascript.md) | `@blender-ui/native`, `@blender-ui/react`, how changes cross to the UI thread, performance |
-| [Dear ImGui](docs/imgui.md) | Dear ImGui on BUI from C++, C, Python and Rust; the Blender-widgets build; coverage |
-| [C API](docs/c-api.md) | The C kit (`BUI_kit.h`) |
-| [Integration](INTEGRATION.md) | Embedding BUI drawing in C, C++, Qt or PySide hosts |
-| [Architecture](ARCHITECTURE.md) | Modules and what was taken from Blender |
-| [Publishing](docs/publishing.md) | Releasing to PyPI and crates.io |
-| [Changelog](CHANGELOG.md) | What changed |
+# Part VI: Reference
-<details>
-<summary><b>Examples</b></summary>
+## 34. Platforms
-| File | Shows |
-| --- | --- |
-| [`examples/tk_unchanged_app.py`](examples/tk_unchanged_app.py) | A plain tkinter app: menus, notebook, form, table, text, canvas |
-| [`examples/components_demo.py`](examples/components_demo.py) | Every Blender component in a properties-editor layout |
-| [`examples/qt_syntax_demo.py`](examples/qt_syntax_demo.py) | Qt syntax: layouts, form widgets, signals |
-| [`examples/tk_syntax_demo.py`](examples/tk_syntax_demo.py) | tkinter syntax laid out like a Blender properties editor |
-| [`examples/kit_hello.c`](examples/kit_hello.c) | The C kit: a slider and a button in a native window |
-| [`examples/imgui_demo.cpp`](examples/imgui_demo.cpp) | Dear ImGui's demo window on BUI, from C++ |
-| [`examples/imgui_demo_c.c`](examples/imgui_demo_c.c) | The same from C (`cimgui.h`) |
-| [`examples/imgui_blender_compare.cpp`](examples/imgui_blender_compare.cpp) | ImGui widgets next to BUI's native Blender widgets |
-| [`hello.rs`](bindings/rust/blenderui/examples/hello.rs) | Rust: a component, hooks, Tailwind attributes and a Blender slider |
-| [`showcase.rs`](bindings/rust/blenderui/examples/showcase.rs) | Rust: HTML, a stylesheet, flex/grid, tables, Blender form widgets |
-| [`forms.rs`](bindings/rust/blenderui/examples/forms.rs) | Rust: form controls as plain HTML, inside `styled`, and as Blender components |
-| [`blenderui-imgui` demo](bindings/rust/blenderui-imgui/examples/demo.rs) | Dear ImGui from Rust (`cargo run -p blenderui-imgui --example demo`) |
-| [`bindings/node/examples/counter.js`](bindings/node/examples/counter.js) | JavaScript: the DOM-like API |
-| [`bindings/react/examples/counter.jsx`](bindings/react/examples/counter.jsx) | React in JSX (`bun examples/counter.jsx`) |
+| | Windows | Linux | macOS |
+| --- | --- | --- | --- |
+| Window | Native (Win32) | Native (X11; Wayland through XWayland) | Native (Cocoa), experimental |
+| Python (`pip install`) | Works: wheels | Works: wheels (native X11 host) | Works: wheels |
+| Rust (`cargo add blenderui`) | Works | Works | Experimental |
+| JavaScript / React | Works: prebuilt on npm | Works: build the addon from source (`npm run build`); native X11 windows | Headless (see below) |
+| C, C++, Dear ImGui | Works | Works | Experimental |
+| Renderer | CPU raster, or GPU (Direct3D 11) | CPU raster, or GPU (OpenGL 3.3) | CPU raster |
+| HiDPI | Per-monitor DPI | `Xft.dpi` | Retina (backing scale) |
-</details>
+**Works** means it works and is tested. **Experimental** means it's written
+but not yet tried by hand on real hardware (macOS has only been checked by CI).
+
+**macOS.** The macOS window host is new: it's a port of Blender's Cocoa code
+(GHOST). So far it has only been checked by CI, not by a person clicking around
+on a real Mac. If you have one, please try it and
+tell us what happens: [docs/macos-testing.md](docs/macos-testing.md). Python
+can still use the stdlib Tk window there (`BUI_HOST=tk`; this needs Python's
+`tkinter`, for example from python.org or `brew install python-tk`). Node runs
+BUI on its own UI thread and macOS only allows windows on the main thread, so
+JavaScript stays headless on macOS for now.
+
+**Linux.** libX11 and libGL are loaded when the first window opens, so BUI also
+imports and renders headless on servers and in containers without them, and
+falls back to the CPU raster where OpenGL is missing. Building from source needs
+the X11 headers (`libx11-dev` / `libX11-devel`); no GL headers are needed. The
+C, Python, window and GPU parity tests pass on Linux, on Mesa's software OpenGL
+and on an NVIDIA GPU.
+
+**Packages:**
+
+| Package | Platforms | Notes |
+| --- | --- | --- |
+| `blenderui` on PyPI | Windows x86_64, Linux x86_64 (manylinux), macOS arm64 and x86_64 | CPython 3.11 to 3.14. No musllinux or 32-bit wheels. |
+| `blenderui` on crates.io | Any platform with CMake and a C compiler | Rust 1.88+. `blenderui-imgui` isn't on crates.io yet: use it as a git dependency. |
+| `@blender-ui/native`, `@blender-ui/react` on npm | Windows x64 | Node.js 18+ or Bun. Elsewhere, build the addon from source. |
+| C and C++ (CMake) | Windows, Linux, macOS | CMake 3.20+, a C11 and C++20 compiler. |
-## Building from source
+## 35. Environment variables
-You need **CMake ≥ 3.20**, a **C11 / C++17 compiler** (MSVC, GCC/MinGW or
+Most are read by the C library, so they work the same from every language.
+On/off variables look at the first character: `1`, `y`, `Y`, `t` or `T` is on.
+Where a variable and an app-wide API call set the same thing, the variable
+wins.
+
+| Variable | What it does |
+| --- | --- |
+| `BUI_GPU` | `1` draws native windows on the GPU (Direct3D 11 / OpenGL 3.3). Overrides `bui.set_gpu()`, `Application::gpu()`, `BUI_gpu_set_default()`. `0` turns those defaults off; a window that asks for the GPU itself still gets it. |
+| `BUI_SLUG` | GPU text: `1` from glyph outlines (Slug, the default), `0` from a per-glyph atlas. |
+| `BUI_GPU_DEBUG` | `1` prints why the GPU renderer couldn't start. |
+| `BUI_GPU_WARP` | `1` (Windows) creates the Direct3D 11 device on WARP, the software rasterizer. Handy in VMs and CI. |
+| `BUI_GPU_EGL` | `default` or `surfaceless` (Linux): the EGL platform for offscreen GPU rendering. |
+| `BUI_RASTER_THREADS` | 1 to 8 (Windows): the most threads the software raster uses for big canvases. |
+| `BUI_PROFILE` | Prints frame times every 60 frames. **Any** value turns it on, even `0`. |
+| `BUI_THEME` | `dark` (default) or `light`: Blender's theme, when the app doesn't set one. |
+| `BUI_UI_SCALE` | A fixed UI scale (`1.25`, `1.5` ...) instead of the display's. Clamped to 0.5–4. |
+| `BUI_HOST` | `tk` (Python): use the stdlib Tk window even where a native host exists. |
+| `BUI_MAC_TK` | `0` (Python on macOS): skip starting a hidden Tk root before the first native window. |
+| `BUI_FONT`, `BUI_FONT_DIR` | A font file to replace Inter, and an extra font folder to search first. |
+| `BUI_FILEDIALOG` | `native` (or `system`, `tk`), Python: file dialogs use the OS's instead of Blender's File Browser. |
+| `BUI_BOOKMARKS` | The File Browser's bookmarks file. |
+| `BUIPY_BUILD_DIR` | Running Python from a source checkout: the folder holding the built `buipy` extension. |
+| `BUI_NODE_ADDON` | `@blender-ui/native`: load this `.node` addon instead of the bundled one. |
+| `BUI_HEADLESS` | `1`: `bui build` apps and `bui run` render off-screen (same as `--headless`). |
+| `BUI_SOURCE_DIR`, `BUI_TEXT_GDI` | Build time, Rust: build the C library from this checkout; use GDI text. |
+
+Every variable, with defaults and where it's read:
+[Environment variables](https://bui.preetham.top/docs/reference/environment-variables/)
+and [docs/getting-started.md](docs/getting-started.md#environment-variables).
+
+## 36. Building from source and CMake options
+
+You need **CMake 3.20+**, a **C11 / C++20 compiler** (MSVC, GCC/MinGW or
Clang) and **Python 3.11+** with headers. On Linux, also the X11 headers.
```sh
@@ -784,33 +1661,134 @@ python examples/components_demo.py
cd bindings/rust && cargo test # Rust: CSS, Tailwind, rsx!, hooks, effects, headless windows
```
-CMake options: `BUI_BUILD_IMGUI` (Dear ImGui, on when a C++ compiler is
-present), `BUI_IMGUI_BLENDER_WIDGETS` (ImGui with Blender's widgets),
-`BUI_BUILD_PYTHON_BINDINGS`, `BUI_BUILD_TESTS`, `BUI_BUILD_EXAMPLES`,
-`BUI_TEXT_GDI` (Windows' GDI text). Rebuild the docs screenshots with
-`python tools/gen_doc_images.py`.
-
-<details>
-<summary>Repository layout</summary>
+| Option | Default | What it does |
+| --- | --- | --- |
+| `BUI_BUILD_TESTS` | `ON` | C test programs and the `ctest` suites |
+| `BUI_BUILD_EXAMPLES` | `OFF` | The C examples (`bui_kit_hello`, `bui_svg_demo`, the site screenshot programs) |
+| `BUI_BUILD_PYTHON_BINDINGS` | `ON` | The `buipy` extension (and the ImGui extension); skipped without Python's dev files |
+| `BUI_BUILD_IMGUI` | `ON` with a C++ compiler | Dear ImGui on BUI, its C API, demo and test |
+| `BUI_IMGUI_BLENDER_WIDGETS` | `OFF` | Dear ImGui with Blender's widgets |
+| `BUI_BUILD_QT_BACKEND` | `OFF` | The C++ Qt/QPainter render-sink backend (needs Qt 5 or 6) |
+| `BUI_BUILD_UI` | `OFF` | Also compile Blender's original `ui/` sources (reference only) |
+| `BUI_TEXT_FREETYPE` | `ON` | Render glyphs with FreeType like Blender's BLF; `OFF` uses stb_truetype |
+| `BUI_TEXT_GDI` | `OFF` | Windows' GDI text and system fonts |
+| `BUI_SLUG` | `ON` | Slug as the GPU's default text method (switchable at run time) |
+| `BUI_WARNINGS_AS_ERRORS` | `OFF` | GCC and Clang only: when `OFF` the build adds `-Wno-error`; it never adds `-Werror` or `/WX` itself |
+
+Rebuild the docs screenshots with `python tools/gen_doc_images.py` (and the
+website's dark and light shots with `--site`). More:
+[CMake options](https://bui.preetham.top/docs/reference/cmake-options/).
+
+## 37. Coverage
+
+| API | Coverage | Status |
+| --- | --- | --- |
+| tkinter and ttk | **7,846 of 7,846** public names; nine real programs behave identically | Complete |
+| Qt syntax | **About 220 of 920** public method names on 25 core widget classes (~24%) | Partial |
+| Blender components (Python) | **45** components (10 of them also in Rust and JavaScript) | Complete |
+| HTML elements (Rust, JavaScript) | **113 of 113** | Complete |
+| CSS properties (Rust, JavaScript) | **261 of 745** W3C properties render, **129** more parse, **355** not recognized (mostly drafts, speech, paged media and SVG) | Partial |
+| CSS 2.1 screen properties | **90 of 90** | Complete |
+| Flexbox / Grid | **12 of 12** / **23 of 23** | Complete |
+| Dear ImGui, C | **399 of 399** functions | Complete |
+| Dear ImGui, Python and safe Rust | **366 of 399** functions (Rust FFI: 385) | Partial |
+
+How each was counted: [Coverage](https://bui.preetham.top/docs/reference/coverage/),
+[SYNTAX_COVERAGE.md](SYNTAX_COVERAGE.md), [docs/rust.md](docs/rust.md#coverage),
+[docs/imgui.md](docs/imgui.md#coverage).
+
+## 38. Repository layout
| Path | Contents |
| --- | --- |
-| `kit/` | The C runtime: nodes, input, widget drawing (the `interface_widgets.cc` port), menus, geometry managers, canvas, the Win32, X11 and Cocoa window hosts; `kit/intern/blender/` holds Blender files copied in (string search, text-edit undo, float precision). API: `kit/include/BUI_kit.h` |
-| `gpu/` | Software raster, GPU renderer on Direct3D 11 (`gpu_d3d11.c`, `shaders/`) and OpenGL 3.3 (`gpu_gl.c`), textured meshes, Slug text, text engine (stb_truetype + embedded Inter, or GDI) |
+| `kit/` | The C runtime: nodes, input, widget drawing (the `interface_widgets.cc` port), menus, geometry managers, canvas, the File Browser, themes (`kit_theme_presets.c`), the Win32, X11 and Cocoa window hosts; `kit/intern/blender/` holds Blender files copied in (string search, text-edit undo, float precision). API: `kit/include/BUI_kit.h` |
+| `gpu/` | Software raster, GPU renderer on Direct3D 11 (`gpu_d3d11.c`, `shaders/`) and OpenGL 3.3 (`gpu_gl.c`), textured meshes, Slug text, text engine (FreeType or stb_truetype + embedded Inter, or GDI) |
| `core/`, `types/` | Blender's `blenlib` subset (including `string_search.cc` and `expr_pylike_eval.cc`) and data types |
| `ui/`, `compat/` | Blender's original interface sources, kept for reference (not compiled by default; `kit/` re-ports them in C), and the seams replacing Blender's application APIs |
| `api/` | Stable C ABI for render-sink hosts |
| `bindings/python/` | The `buipy` extension and the `bui` / `blenderui` packages (tkinter, Qt, components, ImGui) |
-| `bindings/rust/` | `blenderui`, `blenderui-sys`, `blenderui-macros`, `blenderui-tailwind`, `blenderui-imgui`, `blenderui-node`, `blenderui-qjs`, and the benchmark |
+| `bindings/rust/` | `blenderui`, `blenderui-sys`, `blenderui-macros`, `blenderui-tailwind`, `blenderui-imgui`, `blenderui-jsview`, `blenderui-node`, `blenderui-qjs`, and the benchmark |
| `bindings/node/`, `bindings/react/` | `@blender-ui/native` and `@blender-ui/react` |
| `bindings/imgui/` | Dear ImGui (vendored), the BUI backend, Blender style, the C API and its generator, the Blender-widgets build |
| `backends/qt/` | C++ Qt/QPainter render-sink backend |
| `bench/` | The start time and battery benchmark |
-| `examples/`, `tools/` | Demos, the icon generator, the docs screenshot generator |
+| `examples/`, `tools/` | Demos, the website's screenshot programs (`examples/site/`), the icon and theme generators, the docs screenshot generator |
+| `website/` | The documentation website, [bui.preetham.top](https://bui.preetham.top) |
-</details>
+## 39. Examples
+
+| File | Shows |
+| --- | --- |
+| [`examples/tk_unchanged_app.py`](examples/tk_unchanged_app.py) | A plain tkinter app: menus, notebook, form, table, text, canvas |
+| [`examples/components_demo.py`](examples/components_demo.py) | Every Blender component in a properties-editor layout |
+| [`examples/qt_syntax_demo.py`](examples/qt_syntax_demo.py) | Qt syntax: layouts, form widgets, signals |
+| [`examples/tk_syntax_demo.py`](examples/tk_syntax_demo.py) | tkinter syntax laid out like a Blender properties editor |
+| [`examples/kit_hello.c`](examples/kit_hello.c) | The C kit: a slider and a button in a native window |
+| [`examples/imgui_demo.cpp`](examples/imgui_demo.cpp) | Dear ImGui's demo window on BUI, from C++ |
+| [`examples/imgui_demo_c.c`](examples/imgui_demo_c.c) | The same from C (`cimgui.h`) |
+| [`examples/imgui_blender_compare.cpp`](examples/imgui_blender_compare.cpp) | ImGui widgets next to BUI's native Blender widgets |
+| [`examples/site/`](examples/site/) | The website's screenshot programs: a Render Properties editor and a node editor (Python components), tkinter and ttk dialogs, a Qt material editor, an ImGui inspector (C++ and Python), a C modifier stack, and a JavaScript task list (DOM and React) |
+| [`hello.rs`](bindings/rust/blenderui/examples/hello.rs) | Rust: a component, hooks, Tailwind attributes and a Blender slider |
+| [`showcase.rs`](bindings/rust/blenderui/examples/showcase.rs) | Rust: HTML, a stylesheet, flex/grid, tables, Blender form widgets |
+| [`forms.rs`](bindings/rust/blenderui/examples/forms.rs) | Rust: form controls as plain HTML, inside `styled`, and as Blender components |
+| [`site_dashboard.rs`](bindings/rust/blenderui/examples/site_dashboard.rs), [`site_dashboard_builder.rs`](bindings/rust/blenderui/examples/site_dashboard_builder.rs) | Rust: the same dashboard in `rsx!` and in gpui builders |
+| [`site_effects.rs`](bindings/rust/blenderui/examples/site_effects.rs), [`site_grid.rs`](bindings/rust/blenderui/examples/site_grid.rs), [`site_animation.rs`](bindings/rust/blenderui/examples/site_animation.rs) | Rust: CSS effects, grid and `@keyframes` |
+| [`site_plain_html.rs`](bindings/rust/blenderui/examples/site_plain_html.rs), [`site_styled.rs`](bindings/rust/blenderui/examples/site_styled.rs), [`site_components.rs`](bindings/rust/blenderui/examples/site_components.rs) | Rust: the three looks |
+| [`blenderui-imgui` demo](bindings/rust/blenderui-imgui/examples/demo.rs) | Dear ImGui from Rust (`cargo run -p blenderui-imgui --example demo`) |
+| [`bindings/node/examples/counter.js`](bindings/node/examples/counter.js) | JavaScript: the DOM-like API |
+| [`bindings/react/examples/counter.jsx`](bindings/react/examples/counter.jsx) | React in JSX (`bun examples/counter.jsx`) |
+
+---
+
+# Part VII: The project
+
+## 40. Status and roadmap
+
+**Done**
+
+| Area | What works |
+| --- | --- |
+| C runtime (`kit/`) | Nodes, Tk-style geometry managers, input, Blender widget drawing, damage rendering, undo, animation, text area, canvas, scroll views, Blender's string search, expression evaluator, text-edit undo and float precision, Blender's Dark and Light themes |
+| Native windows | Windows (Win32) and Linux (X11; Wayland through XWayland), in C: DPI-aware, frame-paced animation, clipboard, cursors, window-manager features |
+| tkinter syntax | **Complete**: every public tkinter and ttk name (7,846 of 7,846) |
+| Components | 45 Blender components, including the color ramp, curve and node editors |
+| Rust | HTML (113/113 elements), Flexbox 12/12, Grid 23/23, CSS 2.1 90/90, math functions, `var()`, CSS Color 4/5, Selectors 4, `@layer` / `@media` / `@supports` / `@scope` / `@container` / `@font-face` / `@property`, `@keyframes` animations and transitions, filters / blend modes / masks / `clip-path` / 2D transforms / `border-image`, bidi text, background images, `object-fit`, Tailwind v4, `rsx!`, `#[component]` with optional props and `key`, hooks, Blender components, browser-look form controls, headless testing |
+| Dear ImGui | The real Dear ImGui 1.93 on BUI (CPU, Direct3D 11, OpenGL), Blender theme and Inter; C++ / C (399/399 functions) / Python and Rust (366–385/399); the Blender-widgets build |
+| Rendering | Software raster (parallel, damage-tracked), GPU renderer (Direct3D 11 on Windows, OpenGL 3.3 on Linux), textured meshes, portable text engine (FreeType, as in Blender) |
+| JavaScript / React | `@blender-ui/native`: a DOM-like API over napi-rs, with its own UI thread, only changes crossing the boundary, vsync-paced `requestAnimationFrame` and signals. `@blender-ui/react`: a React 19.3 renderer whose hooks (`useState`, `useMemo`, `useEffect` ...) hold signals that update nodes without re-renders. Both on Node.js and Bun, with headless testing. `bui build` makes standalone executables: about 5 MB with the embedded QuickJS runtime, or Bun's with `--bun` ([guide](docs/javascript.md)) |
+| Packaging | [`blenderui` on PyPI](https://pypi.org/project/blenderui/), with a CI workflow for wheels on all platforms (Linux wheels with the native X11 host); [`blenderui` on crates.io](https://crates.io/crates/blenderui); [`@blender-ui/react`](https://www.npmjs.com/package/@blender-ui/react) and [`@blender-ui/native`](https://www.npmjs.com/package/@blender-ui/native) on npm |
+| Docs | The website, [bui.preetham.top](https://bui.preetham.top) |
+
+**Partial or in progress**
+
+| Area | What's missing |
+| --- | --- |
+| Qt syntax (~24%) | Model/view classes, docks, toolbars, splitters, Qt stylesheets ([details](docs/qt.md#coverage)) |
+| CSS (261 of 745 W3C properties render, 129 more parse) | 3D transforms, OpenType font features, multi-column layout; hit testing ignores 2D transforms. Most of the remaining W3C list is drafts, speech, print and SVG ([breakdown](docs/rust.md#coverage)) |
+| Text | No text wrapping around floats; right-to-left text is reordered (bidi) but not shaped (Arabic joining); no OpenType features; no per-glyph font fallback yet (characters missing from the font show as boxes); no IME |
+| Rust components | No async resources (`use_resource`); no generic components |
+| Dear ImGui | Python and safe Rust skip the `va_list`, `void*` and C-callback functions (reachable from C and the Rust FFI); with Blender widgets, window title bars, tooltips, plain popups, tables and the color picker keep ImGui's drawing |
+| JavaScript / React packages | npm packages are prebuilt for Windows x64 only (on Linux, build the addon from source); events reach JavaScript after BUI handled them (no native `preventDefault`), and `event.target` is the deepest _listening_ element |
+| macOS | **Experimental.** The native Cocoa window host is written and checked by CI, but not yet tried by hand on a Mac ([how to help](docs/macos-testing.md)); JavaScript is headless there (Node's UI thread isn't the main thread); no GPU renderer yet |
+| crates.io | `blenderui` is published; `blenderui-imgui` isn't yet, so use it as a git dependency |
+| Themes | Dark and Light work; loading other Blender theme files doesn't yet |
+
+**Planned (coming soon)**
+
+| Target | Plan |
+| --- | --- |
+| **WebAssembly** | The kit in the browser: the raster blits to `<canvas>`, DOM events feed the kit; `@blender-ui/react` and the DOM-like API on top, unchanged |
+| **egui** | BUI panels inside egui, plus a Blender-styled theme |
+| **More from Blender's source** | Per-glyph font fallback (BLF), IME, search-as-you-type popups, units in number fields, widget drag and drop |
+| **macOS GPU and JavaScript windows** | The GPU renderer on Metal (or the OpenGL backend), and Node windows on the main thread |
+| **More GPU backends** | Vulkan / WebGPU drawing the same instance stream as Direct3D 11 and OpenGL |
+| **Qt parity** | Measure against PySide6, run the same programs on Qt and BUI, fill in the missing classes, then `install()` so `import PySide6` programs run unchanged |
+| **More languages** | MyGo, C#, Go, Zig, Swift, Kotlin and Lua over the same C header; Godot, Unity and Bevy; Flutter |
-## FAQ
+Our roadmap has no dates on it. Like a good render, it's done when the noise
+goes away.
+
+## 41. FAQ
<details>
<summary><b>Do I need Blender installed?</b></summary>
@@ -865,33 +1843,97 @@ Tailwind classes are compiled to CSS once, on first use. Hooks are a few
nanoseconds per read or write.
</details>
+<details>
+<summary><b>Can I change the colors?</b></summary>
+Yes. Switch between Blender's Dark and Light themes at run time
+(<a href="#22-themes-dark-and-light">Themes</a>), color individual widgets in
+every API, and use full CSS on plain HTML elements in Rust and JavaScript.
+Loading any other Blender theme file is coming soon.
+</details>
+
+<details>
+<summary><b>Does it run on my Mac?</b></summary>
+Probably, but nobody has checked yet: the Cocoa host is written and
+experimental. Python can always fall back to the Tk window
+(<code>BUI_HOST=tk</code>). If you try it, the notes in
+<a href="docs/macos-testing.md">docs/macos-testing.md</a> say what to report.
+</details>
+
+<details>
+<summary><b>Is it ready for production?</b></summary>
+Much of it is complete and tested (the C kit, tkinter, the components, Rust,
+Dear ImGui, JavaScript), and some parts are partial or experimental (Qt syntax,
+parts of CSS and text, macOS). <a href="#40-status-and-roadmap">Status and
+roadmap</a> shows which is which. Pin your version, and test on the platforms
+you ship.
+</details>
+
+<details>
+<summary><b>Who wrote it?</b></summary>
+The repository is built entirely using LLMs, with no human-written code. The
+drawing and interaction code is ported from Blender's sources, and the behavior
+is checked by tests: C, Python, Rust and JavaScript suites, the tkinter
+side-by-side programs and the GPU parity test.
+</details>
+
<details>
<summary><b>Why GPL?</b></summary>
BUI is derived from Blender's source code, which is GPL-2.0-or-later, so BUI is too.
</details>
-## Contributing
+<details>
+<summary><b>Can I use BUI in a commercial app?</b></summary>
+The GPL allows commercial use. What it asks is that when you distribute a
+program that includes BUI, you distribute it under the GPL too, with its source
+code available. If that doesn't fit your project, talk to a lawyer before you
+ship. (This is a summary, not legal advice.)
+</details>
+
+## 42. Contributing and publishing
Contributions are welcome: bug reports, missing tkinter/Qt behavior, CSS
-features, platform hosts and docs. Read [CONTRIBUTING.md](CONTRIBUTING.md) first,
-and please follow the [Code of Conduct](CODE_OF_CONDUCT.md). Report security
-issues privately, as [SECURITY.md](SECURITY.md) describes.
+features, platform hosts and docs. If you have a Mac, running the Cocoa host
+and reporting what happens is one of the most useful things you can do right
+now. Read [CONTRIBUTING.md](CONTRIBUTING.md) first, and please follow the
+[Code of Conduct](CODE_OF_CONDUCT.md). Report security issues privately, as
+[SECURITY.md](SECURITY.md) describes.
-## Acknowledgments
+Releases go to PyPI (`blenderui`, wheels built by CI on a `v*` tag), crates.io
+(`blenderui-tailwind`, `blenderui-macros`, `blenderui-sys` and `blenderui`, in
+that order) and npm (`@blender-ui/native`, `@blender-ui/react`). The steps are
+in [docs/publishing.md](docs/publishing.md).
-- [Blender](https://www.blender.org): the UI this project is built from, including its GHOST window code and blenlib.
-- [Dear ImGui](https://github.com/ocornut/imgui) by Omar Cornut: the immediate-mode GUI that runs on BUI (MIT).
+## 43. License and credits
+
+**License.** BUI is derived from Blender sources and is licensed
+**GPL-2.0-or-later**. The SPDX header is kept in every file. Third-party parts
+keep their own licenses:
+
+| Part | What it does in BUI | License |
+| --- | --- | --- |
+| [Blender](https://www.blender.org) sources | Widget drawing, interaction rules, theme, icons, `blenlib`, GHOST window code, the File Browser and node editor | GPL-2.0-or-later |
+| [Dear ImGui](https://github.com/ocornut/imgui) by Omar Cornut | The immediate-mode GUI that runs on BUI | MIT |
+| [Inter](https://rsms.me/inter) by Rasmus Andersson | The embedded UI font, as in Blender (`gpu/extern/Inter-LICENSE.txt`) | SIL Open Font License 1.1 |
+| [FreeType](https://freetype.org) 2.13.3 | Glyph loading, hinting and rendering, like Blender's BLF | FreeType License or GPLv2 (dual-licensed) |
+| [stb_truetype](https://github.com/nothings/stb) by Sean Barrett | Font metrics and character maps, and the fallback rasterizer | Public domain |
+| [NanoSVG](https://github.com/memononen/nanosvg) by Mikko Mononen, as edited by Blender | Rasterizing Blender's SVG icons | Zlib |
+| [Slug](https://github.com/EricLengyel/Slug) by Eric Lengyel | The GPU glyph coverage algorithm (shader code "Copyright 2017 by Eric Lengyel") | MIT |
+| [Tailwind CSS](https://tailwindcss.com) | The v4 default theme values behind the Tailwind support | MIT |
+
+The Rust and JavaScript bindings also depend on crates and packages such as
+taffy, napi-rs, React and QuickJS, each under its own license.
+
+**Acknowledgments.** Thank you to:
+
+- [Blender](https://www.blender.org) and its community: the UI this project is built from, including its GHOST window code and blenlib.
+- [Dear ImGui](https://github.com/ocornut/imgui) by Omar Cornut: the immediate-mode GUI that runs on BUI.
- [taffy](https://github.com/DioxusLabs/taffy): flexbox, grid and block layout for the Rust crate.
-- [Tailwind CSS](https://tailwindcss.com): the v4 theme (MIT) behind the Tailwind support.
-- [stb_truetype](https://github.com/nothings/stb): the text engine (public domain).
-- [Inter](https://rsms.me/inter) by Rasmus Andersson: the embedded UI font, as in Blender (SIL Open Font License 1.1).
-- [Slug](https://github.com/EricLengyel/Slug) by Eric Lengyel: the GPU glyph coverage algorithm (shader code MIT, "Copyright 2017 by Eric Lengyel").
+- [Tailwind CSS](https://tailwindcss.com): the v4 theme behind the Tailwind support.
+- [FreeType](https://freetype.org): glyph rendering, as in Blender.
+- [stb_truetype](https://github.com/nothings/stb): font metrics and the fallback rasterizer.
+- [NanoSVG](https://github.com/memononen/nanosvg) by Mikko Mononen: the icon rasterizer, via Blender's edited copy.
+- [Inter](https://rsms.me/inter) by Rasmus Andersson: the embedded UI font, as in Blender.
+- [Slug](https://github.com/EricLengyel/Slug) by Eric Lengyel: the GPU glyph coverage algorithm.
- [gpui](https://github.com/zed-industries/zed), [zopra](https://github.com/ppmpreetham/zopra) and [Leptos](https://leptos.dev): the APIs the Rust syntax follows.
-## License
-
-BUI is derived from Blender sources and is licensed **GPL-2.0-or-later**. The
-SPDX header is kept in every file. Third-party parts keep their own licenses:
-stb_truetype is public domain, the Tailwind theme values and Dear ImGui are MIT,
-Inter is OFL-1.1 (`gpu/extern/Inter-LICENSE.txt`), and the Slug shader port is
-MIT.
+<p align="center"><sub>BUI is Blender's UI, minus the default cube. You're free to add your own.</sub></p>
diff --git a/SYNTAX_COVERAGE.md b/SYNTAX_COVERAGE.md
index 0431731..7fa8844 100644
--- a/SYNTAX_COVERAGE.md
+++ b/SYNTAX_COVERAGE.md
@@ -10,7 +10,7 @@ drawing or input code:
| `pack` / `grid` / `place`, Qt box / grid / form layouts | kit C geometry managers (`kit/intern/kit_frame.c`, a port of Tk's packer and gridder) |
| `Canvas` items, `QPainter` | kit canvas display list (rect, round rect, oval, line, polygon, arc, text, image) |
| Input, hover, focus, popups, menus, undo | `BKContext` in C |
-| Windows, timers | `bui.host` → native Win32 window (`kit/intern/kit_window.c`) or Tk fallback |
+| Windows, timers | `bui.host` → native window (`kit/intern/kit_window_win32.c` on Windows, `kit_window_x11.c` on Linux, `kit_window_cocoa.m` on macOS, experimental) or Tk fallback (`BUI_HOST=tk`) |
| Signals, variables, traces, item/tag models | Python (small) |
Anything not listed raises `AttributeError` — nothing fails silently.
@@ -40,7 +40,7 @@ Anything not listed raises `AttributeError` — nothing fails silently.
| `Signal` (`pyqtSignal`, `Signal_`) | class-level signals; `connect/disconnect/emit`; slots taking fewer arguments are called with fewer |
| `QTimer`, `QPropertyAnimation`, `QEasingCurve` | `start/stop/singleShot/setInterval/setSingleShot`, `timeout`; animation at 120 Hz with easing, `finished/valueChanged` |
| Value types | `QColor`, `QPen`, `QBrush`, `QFont`, `QPoint`, `QSize`, `QRect`, `QPixmap`/`QImage`, `QIcon`, `QMargins`, `QSizePolicy`, `Qt` constants, events (`QMouseEvent`, `QKeyEvent`, `QWheelEvent`, `QPaintEvent`, `QCloseEvent`) |
-| `QMessageBox` / `QFileDialog` | non-blocking stubs / stdlib file dialogs |
+| `QMessageBox` / `QFileDialog` | non-blocking stubs (not drawn yet) / Blender's File Browser (`BUI_FILEDIALOG=native` for the OS dialogs) |
¹ `setStyleSheet`: `color`, `background(-color)` on containers, `font-weight: bold`.
@@ -58,7 +58,7 @@ python -m bui.tksyntax my_tk_app.py # or call bui.tksyntax.install() first
**Coverage:** every public member of every tkinter / ttk widget class,
`Tk`, `Toplevel`, the variables, `Event`, `PhotoImage` and `BitmapImage`
exists (7846 of 7846 names, measured against the stdlib), and
-`tests/test_tk_compat.py` runs nine real tkinter programs (calculator,
+`bindings/python/tests/test_tk_compat.py` runs nine real tkinter programs (calculator,
to-do list with scrollbar, validated form, text editor with menus, sortable
table, canvas, scrollable frame, notebook/paned window/option menu, events and
variables) on both the stdlib and BUI and requires identical results.
@@ -87,7 +87,7 @@ per bindtag (widget, class, toplevel, `all`) and stop on `"break"`, a
| Canvas | all item types (incl. `window` for scrollable frames, smoothed lines, arrows), tags and tag expressions, `find_*` / `addtag_*`, `tag_bind` with `current` and `<Enter>`/`<Leave>` per item, shape-accurate hit tests, `move` / `moveto` / `scale` / `coords`, text-item editing |
| Text | full index grammar (`line.char`, `end`, marks, `tag.first`, `@x,y`, `+N chars/lines`, `linestart`, `wordend` ...), tags with foreground/background and priorities, `tag_bind`, marks with gravity, `search` (regexp, backwards, count), `dump`, `count`, undo stack, `<<Modified>>`, peers |
| Windows | native window: `geometry` (size and position), `attributes` (`-topmost`, `-alpha`, `-fullscreen`, `-disabled`), `resizable`, `minsize` / `maxsize`, `overrideredirect`, `state` / `iconify` / `withdraw`, `transient`, `protocol`, `grab_set` (disables other windows), clipboard |
-| Dialogs | `messagebox` and `simpledialog` (`Dialog`, `SimpleDialog`, `ask*`) as Blender-styled modal windows, `colorchooser` with Blender's color picker, `filedialog` with the OS dialogs |
+| Dialogs | `messagebox` and `simpledialog` (`Dialog`, `SimpleDialog`, `ask*`) as Blender-styled modal windows, `colorchooser` with Blender's color picker, `filedialog` with Blender's File Browser (`BUI_FILEDIALOG=native` for the OS dialogs) |
| Images | `PhotoImage` (PNG and PPM/PGM read and written in Python, GIF through Tk; `put`/`get`/`copy`/`zoom`/`subsample`/`copy_replace`/`data`/`write`), `BitmapImage` (XBM) |
Not supported, because nothing in the kit corresponds: `send` (raises like
diff --git a/bindings/imgui/README.md b/bindings/imgui/README.md
index a84006d..bc3d9a7 100644
--- a/bindings/imgui/README.md
+++ b/bindings/imgui/README.md
@@ -83,7 +83,11 @@ redraw the node.
## Blender style (`ImGui_ImplBUI_StyleBlender`)
-Colors from Blender's default theme (`userdef_default_theme.c`), metrics from the widget
+Colors from the kit's active theme (`BK_theme_color`): Blender's default Dark theme
+(`userdef_default_theme.c`, the values below), or its Light preset after
+`BK_set_theme("light")` / `BUI_THEME=light` (Python: `bui.set_theme("light")`). Pick the
+theme before the backend starts, or call `ImGui_ImplBUI_StyleBlender` again after
+switching. Metrics come from the widget
unit (U = 20 px at scale 1) and `uiStyle`:
| ImGuiCol | Blender theme value |
diff --git a/bindings/imgui/blender/README.md b/bindings/imgui/blender/README.md
index e93be44..738fbda 100644
--- a/bindings/imgui/blender/README.md
+++ b/bindings/imgui/blender/README.md
@@ -104,7 +104,8 @@ aligns vectors (no gap, inner corners square), instead of ImGui's `ItemInnerSpac
tooltips, `BeginPopup` / context-menu backgrounds (only combos and `BeginMenu` menus get
Blender's menu backdrop), table headers and window titles keep ImGui's rendering in the
Blender style and ImGui's glyphs.
-- `ColorPicker3/4` (Blender's HSV circle is not ported to the kit), `VSlider*`, `PlotLines` /
+- `ColorPicker3/4` (the kit has Blender's HSV color picker, but this build doesn't route
+ ImGui's picker to it yet), `VSlider*`, `PlotLines` /
`PlotHistogram`, `ImageButton`, `Bullet` and `TextLink` keep ImGui's drawing.
- Text being typed uses ImGui's glyphs (its cursor and selection are measured with them).
- Indeterminate `ProgressBar` (negative fraction) shows the moving end of ImGui's segment.
diff --git a/bindings/imgui/blender/imgui_widgets_blender.cpp b/bindings/imgui/blender/imgui_widgets_blender.cpp
index 63099ea..e8bc81a 100644
--- a/bindings/imgui/blender/imgui_widgets_blender.cpp
+++ b/bindings/imgui/blender/imgui_widgets_blender.cpp
@@ -2405,7 +2405,15 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
BuiEmit(BuiWidget(BK_WIDGET_MENU, bb, (hovered ? BK_WS_HOVER : 0) | (popup_open ? BK_WS_SELECTED : 0)), text ? preview_value : NULL);
g.ComboPreviewData.PreviewRect = (flags & ImGuiComboFlags_NoPreview) ? ImRect() : ImRect(bb.Min.x, bb.Min.y, value_x2, bb.Max.y);
if (preview_value != NULL && !(flags & ImGuiComboFlags_NoPreview) && !text)
+ {
+ float mt[4]; // the menu button's own text color (wcol_menu.text: light on the dark button in Blender Light)
+ const bool themed = BK_theme_color("menu.text", mt) != 0;
+ if (themed)
+ PushStyleColor(ImGuiCol_Text, ImVec4(mt[0], mt[1], mt[2], mt[3] * style.Colors[ImGuiCol_Text].w));
RenderTextClipped(bb.Min + style.FramePadding, ImVec2(value_x2, bb.Max.y), preview_value, NULL, NULL);
+ if (themed)
+ PopStyleColor();
+ }
else if (preview_value != NULL && g.LogEnabled)
LogRenderedText(&bb.Min, preview_value);
if (label_size.x > 0)
diff --git a/bindings/imgui/imgui_bui_style.cpp b/bindings/imgui/imgui_bui_style.cpp
index bb7ff71..834c2e2 100644
--- a/bindings/imgui/imgui_bui_style.cpp
+++ b/bindings/imgui/imgui_bui_style.cpp
@@ -10,6 +10,7 @@
#include "imgui_impl_bui.h"
#include "imgui_internal.h" // ImMin, ImMax, ImFormatString
+#include "BUI_kit.h" // BK_theme_color: the active theme (BK_set_theme / BUI_THEME)
#include "GPU_raster.h" // BUI_text_default_font
#include <cmath>
@@ -136,38 +137,44 @@ void ImGui_ImplBUI_StyleBlender(ImGuiStyle* dst, float scale)
// scale 1) and ScaleAllSizes() truncates the padding, which made frames 19 px.
style.FramePadding.y = ImMax(1.0f, (IM_ROUND(unit * scale) - IM_ROUND(font * scale)) * 0.5f);
- // -- colors --
- const ImVec4 text = Rgba(0xe6e6e6ff); // wcol_regular.text
- const ImVec4 region = Rgba(0x303030ff); // space back (region background)
- const ImVec4 inner = Rgba(0x545454ff); // wcol_regular / num / option .inner
- const ImVec4 outline = Rgba(0x3d3d3dff); // wcol_*.outline
- const ImVec4 select = Rgba(0x4772b3ff); // inner_sel: the selection blue
- const ImVec4 select_menu = Rgba(0x4772b3b3); // wcol_menu.inner_sel
- const ImVec4 panel_header = Rgba(0x3d3d3dff);
- const ImVec4 dark = Rgba(0x1d1d1dff); // wcol_text.inner, wcol_tab.inner
+ // -- colors: the kit's active theme (Blender's Dark by default, or its Light preset:
+ // BK_set_theme / BUI_THEME); the hex values are the dark defaults --
+ auto T = [](const char* key, uint32_t dark_default) {
+ float f[4];
+ return BK_theme_color(key, f) ? ImVec4(f[0], f[1], f[2], f[3]) : Rgba(dark_default);
+ };
+ auto A = [](ImVec4 c, float a) { return ImVec4(c.x, c.y, c.z, a); };
+ const ImVec4 text = T("regular.text", 0xe6e6e6ffu); // wcol_regular.text
+ const ImVec4 region = T("region_bg", 0x303030ffu); // space back (region background)
+ const ImVec4 inner = T("regular.inner", 0x545454ffu); // wcol_regular / num / option .inner
+ const ImVec4 outline = T("regular.outline", 0x3d3d3dffu); // wcol_*.outline
+ const ImVec4 select = T("regular.inner_sel", 0x4772b3ffu); // inner_sel: the selection blue
+ const ImVec4 select_menu = T("menu.inner_sel", 0x4772b3b3u); // wcol_menu.inner_sel
+ const ImVec4 panel_header = T("panel_header", 0x3d3d3dffu);
+ const ImVec4 dark = T("tab.inner", 0x1d1d1dffu); // wcol_tab.inner
ImVec4* c = style.Colors;
c[ImGuiCol_Text] = text;
- c[ImGuiCol_TextDisabled] = Rgba(0x999999ff); // wcol_menu_back.text (muted)
+ c[ImGuiCol_TextDisabled] = T("menu_back.text", 0x999999ffu); // muted
c[ImGuiCol_WindowBg] = region;
c[ImGuiCol_ChildBg] = Rgba(0x00000000);
- c[ImGuiCol_PopupBg] = Rgba(0x181818ff); // wcol_menu_back.inner
+ c[ImGuiCol_PopupBg] = T("menu_back.inner", 0x181818ffu);
c[ImGuiCol_Border] = outline;
c[ImGuiCol_BorderShadow] = Rgba(0x00000000);
c[ImGuiCol_FrameBg] = inner; // wcol_num.inner
c[ImGuiCol_FrameBgHovered] = Hover(inner);
- c[ImGuiCol_FrameBgActive] = Rgba(0x222222ff); // wcol_num.inner_sel (dragging / editing)
+ c[ImGuiCol_FrameBgActive] = T("num.inner_sel", 0x222222ffu); // dragging / editing
c[ImGuiCol_TitleBg] = dark;
c[ImGuiCol_TitleBgActive] = panel_header;
- c[ImGuiCol_TitleBgCollapsed] = Rgba(0x1d1d1dcc);
+ c[ImGuiCol_TitleBgCollapsed] = A(dark, dark.w * 0.8f);
c[ImGuiCol_MenuBarBg] = dark;
c[ImGuiCol_ScrollbarBg] = Rgba(0x22222200); // wcol_scroll.inner
c[ImGuiCol_ScrollbarGrab] = inner; // wcol_scroll.item
c[ImGuiCol_ScrollbarGrabHovered] = Hover(inner);
c[ImGuiCol_ScrollbarGrabActive] = Hover(Hover(inner));
- c[ImGuiCol_CheckMark] = Rgba(0xffffffff); // wcol_option.item
- c[ImGuiCol_CheckboxSelectedBg] = select; // wcol_option.inner_sel
- c[ImGuiCol_SliderGrab] = select; // wcol_numslider.item
- c[ImGuiCol_SliderGrabActive] = Hover(select);
+ c[ImGuiCol_CheckMark] = T("option.item", 0xffffffffu);
+ c[ImGuiCol_CheckboxSelectedBg] = T("option.inner_sel", 0x4772b3ffu);
+ c[ImGuiCol_SliderGrab] = T("numslider.item", 0x4772b3ffu);
+ c[ImGuiCol_SliderGrabActive] = Hover(c[ImGuiCol_SliderGrab]);
c[ImGuiCol_Button] = inner; // wcol_regular.inner
c[ImGuiCol_ButtonHovered] = Hover(inner);
c[ImGuiCol_ButtonActive] = select; // wcol_regular.inner_sel
@@ -180,28 +187,28 @@ void ImGui_ImplBUI_StyleBlender(ImGuiStyle* dst, float scale)
c[ImGuiCol_ResizeGrip] = Rgba(0xffffff1a);
c[ImGuiCol_ResizeGripHovered] = select_menu;
c[ImGuiCol_ResizeGripActive] = select;
- c[ImGuiCol_InputTextCursor] = Rgba(0x71a8ffff); // widget_text_cursor
+ c[ImGuiCol_InputTextCursor] = T("cursor", 0x71a8ffffu); // widget_text_cursor
c[ImGuiCol_Tab] = dark; // wcol_tab.inner
c[ImGuiCol_TabHovered] = panel_header;
- c[ImGuiCol_TabSelected] = region; // wcol_tab.inner_sel
+ c[ImGuiCol_TabSelected] = T("tab.inner_sel", 0x303030ffu);
c[ImGuiCol_TabSelectedOverline] = select;
c[ImGuiCol_TabDimmed] = dark;
- c[ImGuiCol_TabDimmedSelected] = region;
- c[ImGuiCol_TabDimmedSelectedOverline] = Rgba(0x4772b380);
- c[ImGuiCol_PlotLines] = Rgba(0xccccccff);
+ c[ImGuiCol_TabDimmedSelected] = c[ImGuiCol_TabSelected];
+ c[ImGuiCol_TabDimmedSelectedOverline] = A(select, 128.0f / 255.0f);
+ c[ImGuiCol_PlotLines] = T("list_item.text", 0xccccccffu);
c[ImGuiCol_PlotLinesHovered] = Rgba(0xffffffff);
- c[ImGuiCol_PlotHistogram] = select; // wcol_progress.item
- c[ImGuiCol_PlotHistogramHovered] = Hover(select);
+ c[ImGuiCol_PlotHistogram] = T("progress.item", 0x4772b3ffu);
+ c[ImGuiCol_PlotHistogramHovered] = Hover(c[ImGuiCol_PlotHistogram]);
c[ImGuiCol_TableHeaderBg] = panel_header;
c[ImGuiCol_TableBorderStrong] = dark;
c[ImGuiCol_TableBorderLight] = outline;
c[ImGuiCol_TableRowBg] = Rgba(0x00000000);
c[ImGuiCol_TableRowBgAlt] = Rgba(0xffffff0a);
c[ImGuiCol_TextLink] = Rgba(0x6fa9e6ff); // theme link
- c[ImGuiCol_TextSelectedBg] = Rgba(0x4772b3cc);
+ c[ImGuiCol_TextSelectedBg] = A(select, 0.8f);
c[ImGuiCol_TreeLines] = Rgba(0xffffff1f);
c[ImGuiCol_DragDropTarget] = select;
- c[ImGuiCol_DragDropTargetBg] = Rgba(0x4772b333);
+ c[ImGuiCol_DragDropTargetBg] = A(select, 0.2f);
c[ImGuiCol_UnsavedMarker] = text;
c[ImGuiCol_NavCursor] = select;
c[ImGuiCol_NavWindowingHighlight] = Rgba(0xffffffb3);
diff --git a/bindings/node/README.md b/bindings/node/README.md
index 988931c..662f52c 100644
--- a/bindings/node/README.md
+++ b/bindings/node/README.md
@@ -4,8 +4,9 @@
[![license](https://img.shields.io/npm/l/@blender-ui/native)](https://github.com/ppmpreetham/BUI/blob/main/LICENSE)
[BUI](https://github.com/ppmpreetham/BUI), Blender's UI toolkit, from
-JavaScript. It gives you native windows drawn on the CPU or with Direct3D 11,
-HTML elements, CSS and Tailwind classes, and signals. It runs on Node.js and
+JavaScript. It gives you native windows drawn on the CPU or the GPU
+(Direct3D 11 on Windows, OpenGL 3.3 on Linux), HTML elements, CSS and Tailwind
+classes, Blender components (`NumberSlider`, `Button` ...), and signals. It runs on Node.js and
Bun through a napi-rs addon, and `bui build` turns an app into a single
executable of about 5 MB. There's no browser and no webview.
@@ -59,6 +60,11 @@ win.body.appendChild(button)
- Without the addon: `require('@blender-ui/native/signals')`.
- **Tests:** `new App({ headless: true })` renders off-screen, and
`win.click(x, y)` simulates input.
+- **Looks and theme:** plain HTML looks like a browser's; the `styled`
+ attribute gives an element and its subtree Blender's look; the Blender
+ components (`win.createElement('NumberSlider')`, `'Button'`, `'Checkbox'`
+ ...) are Blender's widgets anywhere. `new App({ theme: 'light' })` or
+ `app.setTheme('light')` (or `BUI_THEME=light`) switches Blender's theme.
## Standalone apps
@@ -96,7 +102,8 @@ nothing.
## Benchmarks
-Ryzen 7 5800U laptop, Windows 11, GPU renderer. Method:
+Ryzen 7 5800U laptop, Windows 11, GPU renderer, measured before the latest
+features landed. Method:
[guide](https://github.com/ppmpreetham/BUI/blob/main/docs/javascript.md#performance).
| Startup (small app, quits at first frame) | First frame | Launch to exit | RAM | Size |
@@ -117,10 +124,14 @@ Ryzen 7 5800U laptop, Windows 11, GPU renderer. Method:
- **Prebuilt for Windows x64.** Elsewhere, build from a clone of the
[repository](https://github.com/ppmpreetham/BUI) with `npm run build` in
- `bindings/node`. You need Rust, CMake and a C compiler, and native windows
- aren't supported there yet, so use `headless: true`.
+ `bindings/node` (you need Rust, CMake and a C compiler).
+ - **Linux:** built from source, windows are native X11 windows (Wayland
+ through XWayland), on the CPU or OpenGL. Building needs the X11 headers.
+ - **macOS:** headless only for now (`headless: true`): BUI runs on its own
+ UI thread under Node, and macOS only allows windows on the main thread.
- **Runtimes:** Node.js 18 or newer, or Bun.
Guide: [docs/javascript.md](https://github.com/ppmpreetham/BUI/blob/main/docs/javascript.md) ·
+Website: [bui.preetham.top](https://bui.preetham.top) ·
Source: [github.com/ppmpreetham/BUI](https://github.com/ppmpreetham/BUI) ·
License: GPL-2.0-or-later
diff --git a/bindings/node/index.d.ts b/bindings/node/index.d.ts
index fab789f..4c63d15 100644
--- a/bindings/node/index.d.ts
+++ b/bindings/node/index.d.ts
@@ -1,11 +1,13 @@
// Types for @blender-ui/native.
export interface AppOptions {
- /** Draw on the GPU (Direct3D 11). */
+ /** Draw on the GPU: Direct3D 11 on Windows, OpenGL 3.3 on Linux. */
gpu?: boolean
/** GPU text from glyph outlines (Slug, default) or a per-glyph atlas. */
slug?: boolean
/** No native windows: tests, screenshots, CI. */
headless?: boolean
+ /** Blender's 'dark' (default) or 'light' theme (BUI_THEME otherwise). */
+ theme?: 'dark' | 'light'
/** Quit when the last window closes (default true). */
quitOnLastWindowClosed?: boolean
}
@@ -110,6 +112,8 @@ export class App {
quitOnLastWindowClosed: boolean
window (options?: WindowOptions): Window
setSlug (on: boolean): void
+ /** Blender's 'dark' (default) or 'light' theme; open windows redraw. */
+ setTheme (name: 'dark' | 'light'): void
quit (): void
}
diff --git a/bindings/node/index.js b/bindings/node/index.js
index 2cbc826..3ba87a7 100644
--- a/bindings/node/index.js
+++ b/bindings/node/index.js
@@ -24,7 +24,8 @@ function loadAddon () {
} catch (err) {
throw new Error(`@blender-ui/native: no native addon for ${process.platform}-${process.arch}. ` +
'Prebuilt binaries are for Windows x64; elsewhere, build it from a clone of ' +
- 'https://github.com/ppmpreetham/BUI with `npm run build` in bindings/node (needs Rust, CMake and a C compiler).',
+ 'https://github.com/ppmpreetham/BUI with `npm run build` in bindings/node (needs Rust, CMake and a C compiler), ' +
+ 'then use that package, or point BUI_NODE_ADDON at the built blenderui.<platform>-<arch>.node.',
{ cause: err })
}
}
@@ -501,7 +502,7 @@ class Window {
class App {
/**
- * @param {{ gpu?: boolean, slug?: boolean, headless?: boolean,
+ * @param {{ gpu?: boolean, slug?: boolean, headless?: boolean, theme?: 'dark' | 'light',
* quitOnLastWindowClosed?: boolean }} [options]
*/
constructor (options = {}) {
@@ -509,7 +510,7 @@ class App {
this._nextWindow = 1
this.quitOnLastWindowClosed = options.quitOnLastWindowClosed ?? true
this.native = new native.NativeApp(
- { gpu: options.gpu, slug: options.slug, headless: options.headless },
+ { gpu: options.gpu, slug: options.slug, headless: options.headless, theme: options.theme },
raw => this._event(raw))
}
@@ -525,6 +526,11 @@ class App {
/** GPU text: Slug (glyph outlines) or the glyph atlas. */
setSlug (on) { this.native.setSlug(!!on) }
+ /** Blender's 'dark' (default) or 'light' theme; open windows redraw. */
+ setTheme (name) {
+ if (!this.native.setTheme(String(name))) throw new RangeError(`unknown theme ${name} (expected 'dark' or 'light')`)
+ }
+
/** Close every window and end the UI thread (Node may then exit). */
quit () {
if (this._quit) return
diff --git a/bindings/node/package.json b/bindings/node/package.json
index 654f851..594f60f 100644
--- a/bindings/node/package.json
+++ b/bindings/node/package.json
@@ -1,6 +1,6 @@
{
"name": "@blender-ui/native",
- "version": "0.2.0",
+ "version": "0.2.1",
"description": "Blender's UI from JavaScript: native windows (CPU or Direct3D 11), HTML elements, CSS and Tailwind classes, signals. Node.js and Bun, through napi-rs.",
"main": "index.js",
"types": "index.d.ts",
@@ -36,10 +36,13 @@
"node": ">=18"
},
"os": [
- "win32"
+ "win32",
+ "linux",
+ "darwin"
],
"cpu": [
- "x64"
+ "x64",
+ "arm64"
],
"license": "GPL-2.0-or-later",
"repository": {
@@ -47,7 +50,7 @@
"url": "git+https://github.com/ppmpreetham/BUI.git",
"directory": "bindings/node"
},
- "homepage": "https://github.com/ppmpreetham/BUI/blob/main/docs/javascript.md",
+ "homepage": "https://bui.preetham.top",
"bugs": {
"url": "https://github.com/ppmpreetham/BUI/issues"
},
diff --git a/bindings/package-lock.json b/bindings/package-lock.json
index cf1483d..e02c4d3 100644
--- a/bindings/package-lock.json
+++ b/bindings/package-lock.json
@@ -12,13 +12,16 @@
},
"node": {
"name": "@blender-ui/native",
- "version": "0.2.0",
+ "version": "0.2.1",
"cpu": [
- "x64"
+ "x64",
+ "arm64"
],
"license": "GPL-2.0-or-later",
"os": [
- "win32"
+ "win32",
+ "linux",
+ "darwin"
],
"bin": {
"bui": "cli.js"
@@ -67,10 +70,10 @@
},
"react": {
"name": "@blender-ui/react",
- "version": "0.1.0",
+ "version": "0.2.0",
"license": "GPL-2.0-or-later",
"dependencies": {
- "@blender-ui/native": "^0.2.0",
+ "@blender-ui/native": "^0.2.1",
"react-reconciler": "0.34.0"
},
"devDependencies": {
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index ca47b9c..46eefdf 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -104,6 +104,12 @@ if(BUI_BUILD_TESTS)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
set_tests_properties(buipy_nodes PROPERTIES ENVIRONMENT "PYTHONPATH=${BUIPY_TEST_PYTHONPATH}")
+ add_test(
+ NAME buipy_theme
+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_theme.py
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+ set_tests_properties(buipy_theme PROPERTIES ENVIRONMENT "PYTHONPATH=${BUIPY_TEST_PYTHONPATH}")
add_test(
NAME buipy_tk_compat
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_tk_compat.py
diff --git a/bindings/python/bui/__init__.py b/bindings/python/bui/__init__.py
index ceb20cf..c13259f 100644
--- a/bindings/python/bui/__init__.py
+++ b/bindings/python/bui/__init__.py
@@ -125,8 +125,30 @@ def set_backend(backend) -> None:
buipy.set_backend(backend)
+def set_theme(name: str = "dark") -> None:
+ """Switch every BUI window to Blender's ``"dark"`` (default) or
+ ``"light"`` theme (its Blender_Light.xml preset); open windows redraw.
+ Without a call the ``BUI_THEME`` environment variable picks the theme."""
+ from bui import theme as _theme
+ buipy.kit_set_theme(str(name))
+ _theme._sync()
+ if "_buiimgui" in sys.modules: # the Dear ImGui extension has its own kit
+ sys.modules["_buiimgui"].set_theme(str(name))
+
+
+def theme_name() -> str:
+ """The active theme: ``"dark"`` or ``"light"``."""
+ return buipy.kit_theme_name()
+
+
+def theme_color(key: str):
+ """A color of the active theme as ``(r, g, b, a)`` floats, e.g.
+ ``"region_bg"``, ``"text"``, ``"regular.inner"`` (see BK_theme_color)."""
+ return buipy.kit_theme_color(key)
+
+
def set_gpu(on: bool = True) -> None:
- """Draw new native windows on the GPU (Direct3D 11): the same pixels as
+ """Draw new native windows on the GPU (Direct3D 11 / OpenGL 3.3): the same pixels as
the software raster, with rasterization off the CPU. Falls back to the
software raster where no device exists. ``BUI_GPU=1``/``0`` overrides.
Per window: ``Tk(gpu=True)``."""
diff --git a/bindings/python/bui/__pycache__/__init__.cpython-314.pyc b/bindings/python/bui/__pycache__/__init__.cpython-314.pyc
index 367ffce..10f1747 100644
Binary files a/bindings/python/bui/__pycache__/__init__.cpython-314.pyc and b/bindings/python/bui/__pycache__/__init__.cpython-314.pyc differ
diff --git a/bindings/python/bui/__pycache__/_version.cpython-314.pyc b/bindings/python/bui/__pycache__/_version.cpython-314.pyc
index fdbb69b..4ebfb43 100644
Binary files a/bindings/python/bui/__pycache__/_version.cpython-314.pyc and b/bindings/python/bui/__pycache__/_version.cpython-314.pyc differ
diff --git a/bindings/python/bui/__pycache__/filebrowser.cpython-314.pyc b/bindings/python/bui/__pycache__/filebrowser.cpython-314.pyc
new file mode 100644
index 0000000..71512b5
Binary files /dev/null and b/bindings/python/bui/__pycache__/filebrowser.cpython-314.pyc differ
diff --git a/bindings/python/bui/__pycache__/host.cpython-314.pyc b/bindings/python/bui/__pycache__/host.cpython-314.pyc
index d8ef257..9edc001 100644
Binary files a/bindings/python/bui/__pycache__/host.cpython-314.pyc and b/bindings/python/bui/__pycache__/host.cpython-314.pyc differ
diff --git a/bindings/python/bui/__pycache__/qtsyntax.cpython-314.pyc b/bindings/python/bui/__pycache__/qtsyntax.cpython-314.pyc
index f0b2af5..e25c954 100644
Binary files a/bindings/python/bui/__pycache__/qtsyntax.cpython-314.pyc and b/bindings/python/bui/__pycache__/qtsyntax.cpython-314.pyc differ
diff --git a/bindings/python/bui/__pycache__/theme.cpython-314.pyc b/bindings/python/bui/__pycache__/theme.cpython-314.pyc
index 5e69745..9b873db 100644
Binary files a/bindings/python/bui/__pycache__/theme.cpython-314.pyc and b/bindings/python/bui/__pycache__/theme.cpython-314.pyc differ
diff --git a/bindings/python/bui/_version.py b/bindings/python/bui/_version.py
index b247734..914167e 100644
--- a/bindings/python/bui/_version.py
+++ b/bindings/python/bui/_version.py
@@ -3,4 +3,4 @@
SPDX-License-Identifier: GPL-2.0-or-later
"""
-__version__ = "0.1.0"
+__version__ = "0.2.0"
diff --git a/bindings/python/bui/host.py b/bindings/python/bui/host.py
index 28263bf..8af5fe5 100644
--- a/bindings/python/bui/host.py
+++ b/bindings/python/bui/host.py
@@ -129,7 +129,8 @@ class Window:
top = tk.Toplevel(_tk())
top.title(self._title)
top.geometry("%dx%d" % self._size)
- top.configure(bg="#303030")
+ top.configure(bg="#%02x%02x%02x" % tuple(
+ int(round(v * 255)) for v in buipy.kit_theme_color("region_bg")[:3]))
top.protocol("WM_DELETE_WINDOW", self._tk_close)
top.withdraw()
surface = TkSurface(top, _Scene(self.ctx), width=self._size[0], height=self._size[1])
diff --git a/bindings/python/bui/qtsyntax.py b/bindings/python/bui/qtsyntax.py
index 7a7d4f9..e4694d6 100644
--- a/bindings/python/bui/qtsyntax.py
+++ b/bindings/python/bui/qtsyntax.py
@@ -2,7 +2,8 @@
Every QWidget is a kit node; QBoxLayout / QGridLayout / QFormLayout run on
the kit's C geometry managers, ``paintEvent`` + QPainter record into a kit
-canvas, and top-level windows are native (Windows) or Tk (:mod:`bui.host`).
+canvas, and top-level windows are native (Win32, X11, Cocoa) or Tk
+(:mod:`bui.host`).
Signals, timers and animations are plain Python (as in PySide's Python
layer)::
diff --git a/bindings/python/bui/theme.py b/bindings/python/bui/theme.py
index 67141dc..243d249 100644
--- a/bindings/python/bui/theme.py
+++ b/bindings/python/bui/theme.py
@@ -177,3 +177,39 @@ def with_alpha(c, a):
_update_metrics()
+
+
+# --- theme switching ------------------------------------------------------------
+_WCOL_KIT = {"text": "textfield"} # this module's set names -> BK_theme_color's
+
+
+def _sync() -> None:
+ """Refresh this module's colors from the engine's active theme
+ (``bui.set_theme`` / ``BUI_THEME``)."""
+ global REGION_BG, TOPBAR_BG, PANEL_HEADER, PANEL_BACK, PANEL_OUTLINE, TEXT
+ global WIDGET_EMBOSS, TEXT_CURSOR, TEXT_SELECTION
+ try:
+ import buipy
+ col = buipy.kit_theme_color
+ except (ImportError, AttributeError): # pragma: no cover - engine not built
+ return
+ for name, w in WCOL.items():
+ k = _WCOL_KIT.get(name, name)
+ w.outline, w.inner, w.inner_sel = col(k + ".outline"), col(k + ".inner"), col(k + ".inner_sel")
+ w.item, w.text, w.text_sel = col(k + ".item"), col(k + ".text"), col(k + ".text_sel")
+ REGION_BG, TOPBAR_BG = col("region_bg"), col("header_bg")
+ PANEL_HEADER, PANEL_BACK, PANEL_OUTLINE = col("panel_header"), col("panel_back"), col("panel_outline")
+ TEXT, WIDGET_EMBOSS = col("text"), col("emboss")
+ TEXT_CURSOR, TEXT_SELECTION = col("cursor"), col("selection")
+
+
+def set_theme(name: str = "dark") -> None:
+ """Blender's ``"dark"`` (default) or ``"light"`` theme for every window."""
+ import buipy
+ buipy.kit_set_theme(str(name))
+ _sync()
+
+
+def theme_name() -> str:
+ import buipy
+ return buipy.kit_theme_name()
diff --git a/bindings/python/bui/tksyntax/__pycache__/_core.cpython-314.pyc b/bindings/python/bui/tksyntax/__pycache__/_core.cpython-314.pyc
index 9bb0a3c..a920f1d 100644
Binary files a/bindings/python/bui/tksyntax/__pycache__/_core.cpython-314.pyc and b/bindings/python/bui/tksyntax/__pycache__/_core.cpython-314.pyc differ
diff --git a/bindings/python/bui/tksyntax/__pycache__/filedialog.cpython-314.pyc b/bindings/python/bui/tksyntax/__pycache__/filedialog.cpython-314.pyc
index c776fec..26d7c41 100644
Binary files a/bindings/python/bui/tksyntax/__pycache__/filedialog.cpython-314.pyc and b/bindings/python/bui/tksyntax/__pycache__/filedialog.cpython-314.pyc differ
diff --git a/bindings/python/bui/tksyntax/_core.py b/bindings/python/bui/tksyntax/_core.py
index 7b14c12..be9e881 100644
--- a/bindings/python/bui/tksyntax/_core.py
+++ b/bindings/python/bui/tksyntax/_core.py
@@ -2357,6 +2357,13 @@ class _TkApp:
_ROOT_BG = (0.188, 0.188, 0.188, 1.0) # Blender's editor background (#303030)
+def _root_bg():
+ """The window background: the theme's region color (bui.set_theme / BUI_THEME)."""
+ if buipy.kit_theme_name() == "dark":
+ return _ROOT_BG
+ return buipy.kit_theme_color("region_bg")
+
+
class Tk(_WindowHost, Misc, Wm):
"""Toplevel widget of Tk which represents mostly the main window of an
application (a native window on Windows, Blender-styled)."""
@@ -2366,7 +2373,7 @@ class Tk(_WindowHost, Misc, Wm):
def __init__(self, screenName=None, baseName=None, className="Tk", useTk=True, sync=False,
use=None, gpu=None):
- """``gpu=True`` draws this window on the GPU (Direct3D 11) instead of
+ """``gpu=True`` draws this window on the GPU (Direct3D 11 / OpenGL) instead of
the software raster: same pixels, rasterization off the CPU. ``None``
follows ``bui.set_gpu()`` / the ``BUI_GPU`` environment variable."""
global _default_root
@@ -2377,7 +2384,7 @@ class Tk(_WindowHost, Misc, Wm):
self._opts = {}
self._className = className
self._node = _Node("frame", self)
- self._node.set("bg", _ROOT_BG)
+ self._node.set("bg", _root_bg())
self.tk = _TkApp(self)
self._init_window(className)
if baseName is None: # tkinter titles the window after the script
@@ -2472,7 +2479,7 @@ class Toplevel(_WindowHost, BaseWidget, Wm):
kw = _gm_kw(cnf, kw)
menu = kw.pop("menu", None)
BaseWidget.__init__(self, master, "toplevel", {}, {})
- self._node.set("bg", _ROOT_BG)
+ self._node.set("bg", _root_bg())
self._init_window("Toplevel")
self._window.title(self._root().title())
self._title = self._root().title()
diff --git a/bindings/python/bui/tksyntax/filedialog.py b/bindings/python/bui/tksyntax/filedialog.py
index 1b3337a..bc95848 100644
--- a/bindings/python/bui/tksyntax/filedialog.py
+++ b/bindings/python/bui/tksyntax/filedialog.py
@@ -1,7 +1,9 @@
-"""tkinter.filedialog: the operating system's file dialogs.
+"""tkinter.filedialog: Blender's File Browser, with tkinter's API.
-Like Tk on Windows and macOS, these are native dialogs (shown through the
-stdlib Tk); the option names and return values are tkinter's.
+The ask* functions and dialog classes open Blender's File Browser
+(bui.filebrowser) in its own window. With BUI_FILEDIALOG=native they use the
+operating system's dialogs instead (shown through the stdlib Tk). Either way,
+the option names and return values are tkinter's.
SPDX-License-Identifier: GPL-2.0-or-later
"""
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 3249459..5be01df 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -61,10 +61,13 @@ def stage_extension() -> str:
ext_name = stage_extension()
+# the one version (bui/_version.py, also read by CMake and pyproject.toml)
+with open(os.path.join(HERE, "bui", "_version.py"), encoding="utf-8") as f:
+ VERSION = f.read().split('__version__ = "')[1].split('"')[0]
setup(
name="bui",
- version="0.1.0",
+ version=VERSION,
description="BUI — Blender-derived UI toolkit with Qt/tkinter-style Python syntax",
packages=["bui"],
package_data={"bui": [ext_name]},
diff --git a/bindings/python/src/buiimgui_module.cpp b/bindings/python/src/buiimgui_module.cpp
index 53b2ccb..ce3efb9 100644
--- a/bindings/python/src/buiimgui_module.cpp
+++ b/bindings/python/src/buiimgui_module.cpp
@@ -318,6 +318,28 @@ static PyObject* bi_set_scale(PyObject*, PyObject* args)
Py_RETURN_NONE;
}
+// This extension carries its own copy of the kit: bui.set_theme() forwards here.
+extern "C" int BK_set_theme(const char* name);
+extern "C" const char* BK_theme_name(void);
+
+static PyObject* bi_set_theme(PyObject*, PyObject* args)
+{
+ const char* name;
+ if (!PyArg_ParseTuple(args, "s", &name))
+ return nullptr;
+ if (!BK_set_theme(name))
+ {
+ PyErr_Format(PyExc_ValueError, "unknown theme '%s' (expected 'dark' or 'light')", name);
+ return nullptr;
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject* bi_theme_name(PyObject*, PyObject*)
+{
+ return PyUnicode_FromString(BK_theme_name());
+}
+
static PyObject* bi_sizeof(PyObject*, PyObject* args)
{
const char* n;
@@ -333,6 +355,8 @@ static PyMethodDef bi_module_methods_extra[] = {
{ "set_blender_widgets", bi_set_blender_widgets, METH_O, "set_blender_widgets(on) -- switch Blender's widgets on or off (when built with them)" },
{ "get_ui_scale", bi_get_scale, METH_NOARGS, "get_ui_scale() -> BUI's UI scale (DPI)" },
{ "set_ui_scale", bi_set_scale, METH_VARARGS, "set_ui_scale(scale)" },
+ { "set_theme", bi_set_theme, METH_VARARGS, "set_theme(name) -- Blender's 'dark' or 'light' theme (also bui.set_theme)" },
+ { "theme_name", bi_theme_name, METH_NOARGS, "theme_name() -> 'dark' or 'light'" },
{ "_sizeof", bi_sizeof, METH_VARARGS, "_sizeof(type_name) -> sizeof() in C++ (tests)" },
{ nullptr, nullptr, 0, nullptr },
};
diff --git a/bindings/python/src/buipy_kit.c b/bindings/python/src/buipy_kit.c
index 0e1ef14..e1964cc 100644
--- a/bindings/python/src/buipy_kit.c
+++ b/bindings/python/src/buipy_kit.c
@@ -1836,6 +1836,38 @@ static PyObject *kit_unit(PyObject *m, PyObject *unused)
return PyLong_FromLong(BK_unit());
}
+static PyObject *kit_set_theme(PyObject *m, PyObject *arg)
+{
+ const char *name = PyUnicode_AsUTF8(arg);
+ if (!name) {
+ return NULL;
+ }
+ if (!BK_set_theme(name)) {
+ PyErr_Format(PyExc_ValueError, "unknown theme %R (expected 'dark' or 'light')", arg);
+ return NULL;
+ }
+ Py_RETURN_NONE;
+}
+
+static PyObject *kit_theme_name(PyObject *m, PyObject *unused)
+{
+ return PyUnicode_FromString(BK_theme_name());
+}
+
+static PyObject *kit_theme_color(PyObject *m, PyObject *arg)
+{
+ const char *key = PyUnicode_AsUTF8(arg);
+ float c[4];
+ if (!key) {
+ return NULL;
+ }
+ if (!BK_theme_color(key, c)) {
+ PyErr_Format(PyExc_KeyError, "%R", arg);
+ return NULL;
+ }
+ return Py_BuildValue("(dddd)", (double)c[0], (double)c[1], (double)c[2], (double)c[3]);
+}
+
static PyObject *kit_set_font(PyObject *m, PyObject *arg)
{
BK_set_font(PyUnicode_AsUTF8(arg));
@@ -1870,6 +1902,9 @@ static PyMethodDef kit_functions[] = {
{"kit_scale", kit_scale, METH_NOARGS, ""},
{"kit_unit", kit_unit, METH_NOARGS, "U.widget_unit in pixels."},
{"kit_set_font", kit_set_font, METH_O, "UI font family."},
+ {"kit_set_theme", kit_set_theme, METH_O, "Theme: 'dark' (default) or 'light' (Blender's presets)."},
+ {"kit_theme_name", kit_theme_name, METH_NOARGS, "The active theme: 'dark' or 'light'."},
+ {"kit_theme_color", kit_theme_color, METH_O, "A theme color as (r, g, b, a) 0..1, e.g. 'region_bg', 'regular.inner'."},
{"kit_icon_names", kit_icon_names, METH_NOARGS, "All icon names."},
{"kit_eval_number", kit_eval_number, METH_O, "Evaluate number input ('2*pi')."},
{"kit_link_fields", kit_link_fields, METH_O, "Link number fields for Alt editing."},
diff --git a/bindings/python/tests/test_theme.py b/bindings/python/tests/test_theme.py
new file mode 100644
index 0000000..1c2e148
--- /dev/null
+++ b/bindings/python/tests/test_theme.py
@@ -0,0 +1,103 @@
+"""Themes: bui.set_theme / BUI_THEME switch Blender's Dark and Light presets.
+
+SPDX-License-Identifier: GPL-2.0-or-later
+"""
+
+import os
+import subprocess
+import sys
+
+HERE = os.path.dirname(os.path.abspath(__file__))
+sys.path.insert(0, os.path.join(HERE, ".."))
+
+import bui # noqa: E402 (locates buipy)
+import buipy # noqa: E402
+from bui import theme # noqa: E402
+from bui.components import App, Button, Checkbox, NumberSlider, Panel # noqa: E402
+
+
+def gray(r, x, y):
+ return tuple(r.pixel(x, y)[:3])
+
+
+def build():
+ return App("theme", (260, 200),
+ Panel("Render", NumberSlider("Samples", 64, min=1, max=512),
+ Checkbox("Denoise", True), Button("Render Image")))
+
+
+def test_default_dark():
+ assert bui.theme_name() == "dark"
+ assert all(abs(a - b) < 1e-6 for a, b in zip(bui.theme_color("region_bg"), (48 / 255,) * 3 + (1.0,)))
+ assert len(bui.theme_color("regular.inner")) == 4
+ try:
+ bui.theme_color("no_such_color")
+ except KeyError:
+ pass
+ else:
+ raise AssertionError("unknown key")
+ try:
+ bui.set_theme("solarized")
+ except ValueError:
+ pass
+ else:
+ raise AssertionError("unknown theme")
+ assert bui.theme_name() == "dark"
+
+
+def test_switch_redraws_and_dark_is_unchanged():
+ app = build()
+ w, h = app.size
+ r = app.render_raster(w, h, True)
+ dark = [r.pixel(x, y) for y in range(0, h, 3) for x in range(0, w, 3)]
+ assert gray(r, w - 2, h - 2) == (48, 48, 48)
+ bui.set_theme("light")
+ assert bui.theme_name() == "light"
+ assert theme.REGION_BG == bui.theme_color("region_bg")
+ r = app.render_raster(w, h) # the switch damaged the whole frame
+ assert gray(r, w - 2, h - 2) == (179, 179, 179), gray(r, w - 2, h - 2)
+ light = [r.pixel(x, y) for y in range(0, h, 3) for x in range(0, w, 3)]
+ assert sum(a != b for a, b in zip(dark, light)) > len(dark) // 2
+ bui.set_theme("dark")
+ r = app.render_raster(w, h)
+ assert [r.pixel(x, y) for y in range(0, h, 3) for x in range(0, w, 3)] == dark
+ assert theme.REGION_BG == bui.theme_color("region_bg")
+
+
+def test_tk_root_follows_theme():
+ import bui.tksyntax as tk
+ bui.set_theme("light")
+ try:
+ root = tk.Tk()
+ tk.Label(root, text="hi").pack()
+ root.update()
+ w, h = root._window.size
+ r = buipy.Raster(w, h)
+ root._ctx.render(w, h, r, True)
+ assert gray(r, w - 2, h - 2) == (179, 179, 179), gray(r, w - 2, h - 2)
+ root.destroy()
+ finally:
+ bui.set_theme("dark")
+
+
+def test_env_var():
+ code = "import bui; print(bui.theme_name(), bui.theme_color('region_bg')[0])"
+ env = dict(os.environ, BUI_THEME="light")
+ out = subprocess.run([sys.executable, "-c", code], env=env, capture_output=True, text=True,
+ cwd=os.path.join(HERE, ".."))
+ assert out.returncode == 0, out.stderr
+ name, r = out.stdout.split()
+ assert name == "light" and abs(float(r) - 179 / 255) < 1e-6, out.stdout
+
+
+def main() -> int:
+ tests = [v for k, v in sorted(globals().items()) if k.startswith("test_")]
+ for t in tests:
+ t()
+ print("ok", t.__name__)
+ print("all theme tests passed")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/bindings/react/README.md b/bindings/react/README.md
index cfb1824..c9c29da 100644
--- a/bindings/react/README.md
+++ b/bindings/react/README.md
@@ -103,7 +103,8 @@ cover yet.
[`@blender-ui/native`](https://www.npmjs.com/package/@blender-ui/native),
and `act(fn)` is for tests.
- Window options: `title`, `width`, `height`, `resizable`, `gpu`,
- `headless`.
+ `slug`, `headless`, and `theme` (`'dark'`, the default, or `'light'`:
+ Blender's Light theme; `BUI_THEME` applies otherwise).
## Standalone apps
@@ -129,7 +130,8 @@ lists updating through signals, or use `--bun`.
## Benchmarks
-Ryzen 7 5800U laptop, Windows 11, GPU renderer, React's production build.
+Ryzen 7 5800U laptop, Windows 11, GPU renderer, React's production build,
+measured before the latest features landed.
The full method is in the [guide](https://github.com/ppmpreetham/BUI/blob/main/docs/javascript.md#performance).
**Startup:** a small React app that quits at its first frame; medians of 12
@@ -156,10 +158,14 @@ launches.
## Requirements
-- **Windows x64** for native windows; `headless: true` renders off-screen.
+- **Windows x64** prebuilt. On **Linux**, build the `@blender-ui/native`
+ addon from source (`npm run build` in `bindings/node`) and windows are
+ native X11 windows. On **macOS** it's headless for now. `headless: true`
+ renders off-screen anywhere.
- **Node.js 18** or newer, or Bun.
- **React 19.3.**
Guide: [docs/javascript.md](https://github.com/ppmpreetham/BUI/blob/main/docs/javascript.md) ·
+Website: [bui.preetham.top](https://bui.preetham.top) ·
Source: [github.com/ppmpreetham/BUI](https://github.com/ppmpreetham/BUI) ·
License: GPL-2.0-or-later
diff --git a/bindings/react/index.js b/bindings/react/index.js
index 216ae16..957dac3 100644
--- a/bindings/react/index.js
+++ b/bindings/react/index.js
@@ -321,7 +321,7 @@ function createRoot (window) {
* @returns {{ app: App, window: import('@blender-ui/native').Window, root: ReturnType<typeof createRoot> }}
*/
function render (element, options = {}) {
- const app = options.app ?? new App({ gpu: options.gpu, slug: options.slug, headless: options.headless })
+ const app = options.app ?? new App({ gpu: options.gpu, slug: options.slug, headless: options.headless, theme: options.theme })
const window = app.window(options)
const root = createRoot(window)
root.render(element)
diff --git a/bindings/react/package.json b/bindings/react/package.json
index 2a67527..b69171b 100644
--- a/bindings/react/package.json
+++ b/bindings/react/package.json
@@ -1,6 +1,6 @@
{
"name": "@blender-ui/react",
- "version": "0.1.0",
+ "version": "0.2.0",
"description": "React renderer for BUI: Blender's UI in native windows from JSX, with React's hooks backed by signals. Node.js and Bun.",
"main": "index.js",
"types": "index.d.ts",
@@ -40,7 +40,7 @@
"node": ">=18"
},
"dependencies": {
- "@blender-ui/native": "^0.2.0",
+ "@blender-ui/native": "^0.2.1",
"react-reconciler": "0.34.0"
},
"peerDependencies": {
@@ -55,7 +55,7 @@
"url": "git+https://github.com/ppmpreetham/BUI.git",
"directory": "bindings/react"
},
- "homepage": "https://github.com/ppmpreetham/BUI/blob/main/docs/javascript.md",
+ "homepage": "https://bui.preetham.top",
"bugs": {
"url": "https://github.com/ppmpreetham/BUI/issues"
},
diff --git a/bindings/rust/Cargo.lock b/bindings/rust/Cargo.lock
index e363586..1512663 100644
--- a/bindings/rust/Cargo.lock
+++ b/bindings/rust/Cargo.lock
@@ -37,7 +37,7 @@ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
[[package]]
name = "blenderui"
-version = "0.1.0"
+version = "0.2.0"
dependencies = [
"blenderui-macros",
"blenderui-sys",
@@ -50,28 +50,28 @@ dependencies = [
[[package]]
name = "blenderui-imgui"
-version = "0.1.0"
+version = "0.2.0"
dependencies = [
"blenderui-sys",
]
[[package]]
name = "blenderui-jsview"
-version = "0.1.0"
+version = "0.2.0"
dependencies = [
"blenderui",
]
[[package]]
name = "blenderui-macros"
-version = "0.1.0"
+version = "0.2.0"
dependencies = [
"blenderui-tailwind",
]
[[package]]
name = "blenderui-node"
-version = "0.1.0"
+version = "0.2.0"
dependencies = [
"blenderui",
"blenderui-jsview",
@@ -82,7 +82,7 @@ dependencies = [
[[package]]
name = "blenderui-qjs"
-version = "0.1.0"
+version = "0.2.0"
dependencies = [
"blenderui",
"blenderui-jsview",
@@ -91,14 +91,14 @@ dependencies = [
[[package]]
name = "blenderui-sys"
-version = "0.1.0"
+version = "0.2.0"
dependencies = [
"cmake",
]
[[package]]
name = "blenderui-tailwind"
-version = "0.1.0"
+version = "0.2.0"
[[package]]
name = "cc"
diff --git a/bindings/rust/Cargo.toml b/bindings/rust/Cargo.toml
index 4173bc2..1a0ba07 100644
--- a/bindings/rust/Cargo.toml
+++ b/bindings/rust/Cargo.toml
@@ -4,8 +4,10 @@ members = ["blenderui-sys", "blenderui-tailwind", "blenderui-macros", "blenderui
exclude = ["bench"]
[workspace.package]
-version = "0.1.0"
+version = "0.2.0"
edition = "2024"
license = "GPL-2.0-or-later"
repository = "https://github.com/ppmpreetham/BUI"
+homepage = "https://bui.preetham.top"
+authors = ["BUI contributors"]
rust-version = "1.88"
diff --git a/bindings/rust/bench/README.md b/bindings/rust/bench/README.md
index 5e7c4cd..4e3d16b 100644
--- a/bindings/rust/bench/README.md
+++ b/bindings/rust/bench/README.md
@@ -21,6 +21,13 @@ with a centred number), built with the same element tree in both
- **blenderui (uncapped)**: animation without vsync pacing (`--uncapped`), for
both renderers.
+> **When these were measured.** The results below come from a Ryzen 7 5800U
+> laptop on Windows 11 (Direct3D 11 for the GPU rows), before the latest
+> features landed: Dear ImGui, the Linux OpenGL renderer, the light theme and
+> Blender's search and expression code. Rerun them with the steps below to see
+> today's numbers on your machine. The benchmark is Windows-only (gpui needs
+> `fxc.exe`, and `run.py` reads Windows' GPU counters).
+
## Running
```sh
diff --git a/bindings/rust/blenderui-imgui/Cargo.toml b/bindings/rust/blenderui-imgui/Cargo.toml
index 7469729..500389b 100644
--- a/bindings/rust/blenderui-imgui/Cargo.toml
+++ b/bindings/rust/blenderui-imgui/Cargo.toml
@@ -5,13 +5,17 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
+homepage.workspace = true
+authors.workspace = true
rust-version.workspace = true
+documentation = "https://docs.rs/blenderui-imgui"
keywords = ["gui", "imgui", "blender", "ui"]
categories = ["gui", "api-bindings"]
+include = ["src/**", "tests/**", "examples/**", "Cargo.toml"]
[dependencies]
# builds and links bui_cimgui (Dear ImGui + its C API + the BUI backend) with the C kit
-blenderui-sys = { path = "../blenderui-sys", version = "0.1.0", features = ["imgui"] }
+blenderui-sys = { path = "../blenderui-sys", version = "0.2.0", features = ["imgui"] }
[features]
# ImGui's widgets drawn and handled as Blender's widgets (bindings/imgui/blender)
diff --git a/bindings/rust/blenderui-jsview/Cargo.toml b/bindings/rust/blenderui-jsview/Cargo.toml
index 1489544..d4f5fd7 100644
--- a/bindings/rust/blenderui-jsview/Cargo.toml
+++ b/bindings/rust/blenderui-jsview/Cargo.toml
@@ -5,6 +5,8 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
+homepage.workspace = true
+authors.workspace = true
rust-version.workspace = true
publish = false
diff --git a/bindings/rust/blenderui-macros/Cargo.toml b/bindings/rust/blenderui-macros/Cargo.toml
index 3519219..4ff29e7 100644
--- a/bindings/rust/blenderui-macros/Cargo.toml
+++ b/bindings/rust/blenderui-macros/Cargo.toml
@@ -5,12 +5,16 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
+homepage.workspace = true
+authors.workspace = true
rust-version.workspace = true
+documentation = "https://docs.rs/blenderui-macros"
keywords = ["gui", "jsx", "rsx", "tailwind", "css"]
categories = ["gui"]
+include = ["src/**", "Cargo.toml"]
[lib]
proc-macro = true
[dependencies]
-blenderui-tailwind = { path = "../blenderui-tailwind", version = "0.1.0" }
+blenderui-tailwind = { path = "../blenderui-tailwind", version = "0.2.0" }
diff --git a/bindings/rust/blenderui-node/Cargo.toml b/bindings/rust/blenderui-node/Cargo.toml
index f4545eb..6ac0619 100644
--- a/bindings/rust/blenderui-node/Cargo.toml
+++ b/bindings/rust/blenderui-node/Cargo.toml
@@ -5,6 +5,8 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
+homepage.workspace = true
+authors.workspace = true
rust-version.workspace = true
publish = false
diff --git a/bindings/rust/blenderui-node/src/lib.rs b/bindings/rust/blenderui-node/src/lib.rs
index 101e680..7a95360 100644
--- a/bindings/rust/blenderui-node/src/lib.rs
+++ b/bindings/rust/blenderui-node/src/lib.rs
@@ -65,12 +65,14 @@ impl From<view::Event> for BuiEvent {
#[napi(object)]
pub struct AppOptions {
- /// Draw on the GPU (Direct3D 11).
+ /// Draw on the GPU (Direct3D 11 on Windows, OpenGL 3.3 on Linux).
pub gpu: Option<bool>,
/// GPU text from glyph outlines (Slug) or a glyph atlas.
pub slug: Option<bool>,
/// No native windows (tests, screenshots, CI).
pub headless: Option<bool>,
+ /// Blender's "dark" (default) or "light" theme.
+ pub theme: Option<String>,
}
#[napi(object)]
@@ -154,6 +156,7 @@ impl NativeApp {
Some(o) => (o.gpu, o.slug, o.headless.unwrap_or(false)),
None => (None, None, false),
};
+ let theme = options.as_ref().and_then(|o| o.theme.clone());
// macOS: AppKit only runs on the main thread, which here is the
// JavaScript thread (libuv's loop), while BUI runs on its own
// "bui-ui" thread; the Cocoa host refuses windows there, so stay
@@ -168,6 +171,9 @@ impl NativeApp {
if let Some(s) = slug {
a = a.slug(s);
}
+ if let Some(t) = &theme {
+ a = a.theme(t);
+ }
let events = tsfn.clone();
a.run(move |cx| {
cx.set_global(events.clone());
@@ -241,6 +247,19 @@ impl NativeApp {
});
}
+ /// Blender's "dark" or "light" theme for every window (they redraw).
+ #[napi]
+ pub fn set_theme(&self, name: String) -> bool {
+ let ok = matches!(name.to_ascii_lowercase().as_str(), "dark" | "light" | "blender dark" | "blender light");
+ if ok {
+ self.link.send(move |cx| {
+ blenderui::set_theme(&name);
+ cx.notify_all();
+ });
+ }
+ ok
+ }
+
/// End the UI thread (closes every window).
#[napi]
pub fn quit(&self) {
diff --git a/bindings/rust/blenderui-qjs/Cargo.toml b/bindings/rust/blenderui-qjs/Cargo.toml
index 8a3092c..7d7c5c2 100644
--- a/bindings/rust/blenderui-qjs/Cargo.toml
+++ b/bindings/rust/blenderui-qjs/Cargo.toml
@@ -5,6 +5,8 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
+homepage.workspace = true
+authors.workspace = true
rust-version.workspace = true
publish = false
diff --git a/bindings/rust/blenderui-sys/Cargo.toml b/bindings/rust/blenderui-sys/Cargo.toml
index a9970fe..208bad7 100644
--- a/bindings/rust/blenderui-sys/Cargo.toml
+++ b/bindings/rust/blenderui-sys/Cargo.toml
@@ -5,7 +5,10 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
+homepage.workspace = true
+authors.workspace = true
rust-version.workspace = true
+documentation = "https://docs.rs/blenderui-sys"
links = "bui_kit"
build = "build.rs"
keywords = ["gui", "ui", "blender", "ffi"]
diff --git a/bindings/rust/blenderui-sys/build.rs b/bindings/rust/blenderui-sys/build.rs
index 85fb63c..2e41627 100644
--- a/bindings/rust/blenderui-sys/build.rs
+++ b/bindings/rust/blenderui-sys/build.rs
@@ -5,6 +5,11 @@
use std::path::PathBuf;
fn main() {
+ // docs.rs: rustdoc links nothing, so skip the C build (its sandbox may lack
+ // the toolchain, and the build takes long)
+ if std::env::var_os("DOCS_RS").is_some() {
+ return;
+ }
let manifest = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
// BUI_SOURCE_DIR, else the repository around this crate, else the sources
// vendored into the published crate (`csrc/`, see scripts/vendor_c.py)
@@ -66,8 +71,11 @@ fn main() {
println!("cargo:rustc-link-lib={lib}");
}
} else {
- if target == "linux" || target.ends_with("bsd") {
- println!("cargo:rustc-link-lib=X11"); // the native window host
+ // No libX11 / libGL link: the X11 window host (kit_window_x11.c) and the
+ // OpenGL renderer (gpu_gl.c) dlopen() them at run time, so programs start
+ // (headless) without X11 installed. dlopen itself is in libdl before glibc 2.34.
+ if target == "linux" {
+ println!("cargo:rustc-link-lib=dl");
}
if target == "macos" {
// the Cocoa window host (kit/intern/kit_window_cocoa.m): static
diff --git a/bindings/rust/blenderui-sys/src/lib.rs b/bindings/rust/blenderui-sys/src/lib.rs
index ecdbad4..9f7bcb0 100644
--- a/bindings/rust/blenderui-sys/src/lib.rs
+++ b/bindings/rust/blenderui-sys/src/lib.rs
@@ -154,6 +154,9 @@ unsafe extern "C" {
pub fn BK_scale() -> c_float;
pub fn BK_unit() -> c_int;
pub fn BK_set_font(family: *const c_char);
+ pub fn BK_set_theme(name: *const c_char) -> c_int;
+ pub fn BK_theme_name() -> *const c_char;
+ pub fn BK_theme_color(key: *const c_char, r_rgba: *mut c_float) -> c_int;
// nodes
pub fn BK_node_new(type_: *const c_char) -> *mut BKNode;
diff --git a/bindings/rust/blenderui-tailwind/Cargo.toml b/bindings/rust/blenderui-tailwind/Cargo.toml
index d34205e..c39f499 100644
--- a/bindings/rust/blenderui-tailwind/Cargo.toml
+++ b/bindings/rust/blenderui-tailwind/Cargo.toml
@@ -5,6 +5,10 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
+homepage.workspace = true
+authors.workspace = true
rust-version.workspace = true
+documentation = "https://docs.rs/blenderui-tailwind"
keywords = ["tailwind", "css", "gui", "blenderui"]
categories = ["gui", "web-programming"]
+include = ["src/**", "Cargo.toml"]
diff --git a/bindings/rust/blenderui/Cargo.toml b/bindings/rust/blenderui/Cargo.toml
index 05721be..cdabe06 100644
--- a/bindings/rust/blenderui/Cargo.toml
+++ b/bindings/rust/blenderui/Cargo.toml
@@ -5,15 +5,20 @@ version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
+homepage.workspace = true
+authors.workspace = true
rust-version.workspace = true
+documentation = "https://docs.rs/blenderui"
keywords = ["gui", "ui", "blender", "gpui", "html"]
categories = ["gui"]
readme = "README.md"
+# the crate, its README, tests and examples (examples/site: the website's demos)
+include = ["src/**", "tests/**", "examples/**", "README.md", "Cargo.toml"]
[dependencies]
-blenderui-sys = { path = "../blenderui-sys", version = "0.1.0", default-features = false }
-blenderui-macros = { path = "../blenderui-macros", version = "0.1.0" }
-blenderui-tailwind = { path = "../blenderui-tailwind", version = "0.1.0" }
+blenderui-sys = { path = "../blenderui-sys", version = "0.2.0", default-features = false }
+blenderui-macros = { path = "../blenderui-macros", version = "0.2.0" }
+blenderui-tailwind = { path = "../blenderui-tailwind", version = "0.2.0" }
taffy = { version = "0.15", default-features = false, features = ["std", "taffy_tree", "flexbox", "flexbox_balance", "grid", "block_layout", "float_layout", "calc", "content_size"] }
paste = "1"
smallvec = { version = "1", features = ["union", "const_generics"] }
diff --git a/bindings/rust/blenderui/README.md b/bindings/rust/blenderui/README.md
index 863acdb..c8b2b92 100644
--- a/bindings/rust/blenderui/README.md
+++ b/bindings/rust/blenderui/README.md
@@ -32,15 +32,42 @@ fn main() {
}
```
+Install it from [crates.io](https://crates.io/crates/blenderui):
+
+```sh
+cargo add blenderui
+```
+
+**Two syntaxes.** The example above uses gpui-style builders. The same UI can
+be written as HTML-like markup with `rsx!` (with `#[component]` functions and
+hooks such as `use_state`), and Tailwind classes work in both.
+
+**Three looks.** Plain HTML looks like a browser's; add `styled` to any
+element for Blender's look; use the Blender components (`NumberSlider`,
+`Button`, `Checkbox`, `ColorSwatch` ...) for Blender's real widgets anywhere.
+`blenderui::set_theme("light")` or `Application::new().theme("light")` (or
+`BUI_THEME=light`) switches Blender's theme from Dark to Light.
+
**GPU rendering:** windows draw on the CPU by default. Use
`Application::new().gpu(true)` (or `WindowOptions { gpu: Some(true), .. }`, or
-run with `BUI_GPU=1`) to draw them with Direct3D 11. This produces the same
-pixels at a fraction of the CPU cost: 11.6 ms vs 22.0 ms per frame for
-3000 animated cells, where gpui-fast needs 31.9 ms.
+run with `BUI_GPU=1`) to draw them on the GPU: Direct3D 11 on Windows, OpenGL
+3.3 on Linux. This produces the same pixels at a fraction of the CPU cost:
+11.6 ms vs 22.0 ms per frame for 3000 animated cells, where gpui-fast needs
+31.9 ms (Windows, Direct3D 11; measured before the latest features landed).
+
+**Text** works the same on every platform: the default portable engine embeds
+Inter (Blender's UI font), renders it with FreeType like Blender does, and
+draws it with Slug on the GPU. The opt-in `gdi-text` feature uses Windows' GDI
+engine and system fonts instead. (`portable-text` is a deprecated no-op.)
+Register extra fonts with `blenderui::add_font`.
+
+**Platforms:** Windows (Win32) and Linux (X11) native windows; macOS (Cocoa)
+is experimental. You need Rust 1.88+, CMake and a C compiler (the first build
+compiles BUI's C kit), and the X11 headers on Linux.
-**Text** works on every platform: GDI on Windows and a bundled stb_truetype
-engine elsewhere (the `portable-text` feature selects it on Windows).
-Register fonts with `blenderui::add_font` where there are none (wasm).
+Dear ImGui on BUI is a separate crate, `blenderui-imgui`, not on crates.io
+yet: use it as a git dependency.
Guide, CSS coverage and limitations:
-[docs/rust.md](https://github.com/ppmpreetham/BUI/blob/main/docs/rust.md).
+[docs/rust.md](https://github.com/ppmpreetham/BUI/blob/main/docs/rust.md),
+and the website: <https://bui.preetham.top>.
diff --git a/bindings/rust/blenderui/examples/site/common.rs b/bindings/rust/blenderui/examples/site/common.rs
new file mode 100644
index 0000000..cc748c9
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site/common.rs
@@ -0,0 +1,50 @@
+//! Shared by the `site_*` examples (the website's screenshots): open one
+//! window natively, or with `--screenshot out.png` render it off-screen and
+//! save it. `BUI_THEME=light` and `BUI_UI_SCALE=2` apply to both.
+
+#![allow(dead_code)]
+
+use blenderui::prelude::*;
+
+pub fn screenshot_arg() -> Option<String> {
+ let args: Vec<String> = std::env::args().collect();
+ args.iter().position(|a| a == "--screenshot").and_then(|i| args.get(i + 1)).cloned()
+}
+
+pub fn options(w: f32, h: f32, title: &str) -> WindowOptions {
+ WindowOptions {
+ window_bounds: Some(WindowBounds::Windowed(Bounds {
+ origin: point(px(0.0), px(0.0)),
+ size: size(px(w), px(h)),
+ })),
+ titlebar: Some(TitlebarOptions { title: Some(title.to_string().into()) }),
+ ..Default::default()
+ }
+}
+
+/// Writes 0x00RRGGBB pixels as an RGB PNG.
+pub fn save(path: &str, w: usize, h: usize, px: &[u32]) {
+ let rgb: Vec<u8> = px.iter().flat_map(|p| [(p >> 16) as u8, (p >> 8) as u8, *p as u8]).collect();
+ let file = std::fs::File::create(path).expect("create png");
+ let mut enc = png::Encoder::new(std::io::BufWriter::new(file), w as u32, h as u32);
+ enc.set_color(png::ColorType::Rgb);
+ enc.set_depth(png::BitDepth::Eight);
+ enc.set_compression(png::Compression::Best);
+ enc.write_header().expect("png").write_image_data(&rgb).expect("png");
+ println!("wrote {path} ({w}x{h})");
+}
+
+/// Runs one view: a native window, or (with `--screenshot`) one off-screen frame.
+pub fn run<V: Render + 'static>(w: f32, h: f32, title: &str, make: impl FnOnce() -> V + 'static) {
+ let shot = screenshot_arg();
+ let app = if shot.is_some() { Application::headless() } else { Application::new() };
+ let title = title.to_string();
+ app.run(move |cx| {
+ let win = cx.open_window(options(w, h, &title), |_, cx| cx.new(|_| make())).unwrap();
+ if let Some(path) = shot {
+ cx.draw(win.id);
+ let (pw, ph, px) = cx.draw(win.id);
+ save(&path, pw, ph, &px);
+ }
+ });
+}
diff --git a/bindings/rust/blenderui/examples/site/dashboard_data.rs b/bindings/rust/blenderui/examples/site/dashboard_data.rs
new file mode 100644
index 0000000..43759e9
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site/dashboard_data.rs
@@ -0,0 +1,64 @@
+//! The render-farm dashboard's data and stylesheet (site_dashboard and
+//! site_dashboard_builder). Colours are translucent over the `styled`
+//! background, so the page follows Blender's dark and light themes.
+
+#![allow(dead_code)]
+
+pub const STATS: [(&str, &str, &str, u32); 4] = [
+ ("Active jobs", "3", "+1 since 09:00", 38),
+ ("Frames today", "12,480", "+18% vs. yesterday", 72),
+ ("GPU utilisation", "87%", "8 of 8 nodes busy", 87),
+ ("Queue ETA", "1h 42m", "6 jobs waiting", 55),
+];
+
+pub const JOBS: [(&str, &str, &str, u32); 5] = [
+ ("robot_arm.blend", "Cycles", "149 / 240", 62),
+ ("forest_flyby.blend", "EEVEE", "880 / 1200", 73),
+ ("ocean_sim.blend", "Cycles", "175 / 500", 35),
+ ("product_shot.blend", "Cycles", "1 / 1", 100),
+ ("title_card.blend", "EEVEE", "12 / 90", 13),
+];
+
+pub const NODES: [(&str, &str, u32); 5] = [
+ ("gpu-01 · RTX 4090", "busy", 96),
+ ("gpu-02 · RTX 4090", "busy", 91),
+ ("gpu-03 · RTX 3080", "busy", 78),
+ ("cpu-01 · 64 cores", "idle", 12),
+ ("cpu-02 · 64 cores", "down", 0),
+];
+
+pub const CSS: &str = r#"
+body { margin: 0; padding: 14px 16px; }
+header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
+header .title { flex: 1; display: flex; align-items: baseline; gap: 10px; }
+h1 { font-size: 20px; margin: 0; }
+h2 { font-size: 13px; margin: 0 0 8px 0; opacity: 0.8; }
+.muted { opacity: 0.6; font-size: 12px; }
+.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
+.card { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 8px;
+ background: rgba(128, 128, 128, 0.16); border: 1px solid rgba(128, 128, 128, 0.22); }
+.card strong { font-size: 22px; }
+.delta { font-size: 11px; color: #3fa66b; }
+.meter { height: 4px; border-radius: 2px; background: rgba(128, 128, 128, 0.3); }
+.meter .fill { height: 4px; border-radius: 2px; background: linear-gradient(90deg, #4772b3, #6f9be0); }
+.meter.small { width: 70px; }
+.columns { display: flex; gap: 10px; }
+.panel { padding: 10px 12px; border-radius: 8px; background: rgba(128, 128, 128, 0.12); }
+.jobs { flex: 1; min-width: 0; }
+.nodes { flex: none; width: 230px; }
+.job { display: flex; align-items: center; gap: 8px; height: 26px; }
+.job .name { width: 124px; white-space: nowrap; }
+.job .frames { width: 70px; text-align: right; }
+.job .bar { flex: 1; }
+.job .pct { width: 36px; text-align: right; font-size: 12px; }
+.badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; color: white; width: 40px; text-align: center; }
+.badge.cycles { background: #4772b3; }
+.badge.eevee { background: #3a9b7a; }
+.node { display: flex; align-items: center; gap: 8px; height: 24px; }
+.node .name { flex: 1; font-size: 12px; white-space: nowrap; }
+.dot { width: 8px; height: 8px; border-radius: 4px; }
+.dot.busy { background: #e0a030; }
+.dot.idle { background: #3fa66b; }
+.dot.down { background: #d0504a; }
+.row { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; }
+"#;
diff --git a/bindings/rust/blenderui/examples/site/form_page.rs b/bindings/rust/blenderui/examples/site/form_page.rs
new file mode 100644
index 0000000..e0e7b3e
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site/form_page.rs
@@ -0,0 +1,58 @@
+//! One HTML page for site_plain_html (a browser's look) and site_styled
+//! (the same markup inside `styled`: Blender's theme and widgets).
+
+#![allow(dead_code)]
+
+use blenderui::prelude::*;
+
+const CSS: &str = r#"
+body { margin: 0; padding: 16px 20px; }
+h2 { margin: 0 0 2px 0; }
+p.lead { margin: 0 0 12px 0; opacity: 0.7; }
+form { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; align-items: center; }
+label.k { text-align: right; }
+.inline { display: flex; gap: 14px; align-items: center; }
+.actions { grid-column: 2; display: flex; gap: 8px; margin-top: 6px; }
+fieldset { margin-top: 14px; }
+table { width: 100%; border-collapse: collapse; }
+th, td { text-align: left; padding: 3px 6px; }
+"#;
+
+pub fn page(styled: bool) -> Div {
+ let root = html().child(head().child(style().child(CSS)));
+ let root = if styled { root.styled() } else { root };
+ root.child(body()
+ .child(h2().child("Export Animation"))
+ .child(p().class("lead").child("Encode the rendered frames of ").child(code().child("robot_arm.blend")))
+ .child(form()
+ .child(label().class("k").child("File name"))
+ .child(input().value("robot_arm_final"))
+ .child(label().class("k").child("Container"))
+ .child(select().child(option().child("MPEG-4 (.mp4)")).child(option().child("Matroska (.mkv)"))
+ .child(option().child("QuickTime (.mov)")))
+ .child(label().class("k").child("Frame rate"))
+ .child(input().input_type("number").value("24").min(1.0).max(120.0))
+ .child(label().class("k").child("Quality"))
+ .child(input().input_type("range").min(0.0).max(100.0).value("72"))
+ .child(label().class("k").child("Audio"))
+ .child(div().class("inline")
+ .child(label().child(input().input_type("radio").name("audio").checked(true)).child(" AAC"))
+ .child(label().child(input().input_type("radio").name("audio")).child(" FLAC"))
+ .child(label().child(input().input_type("radio").name("audio")).child(" None")))
+ .child(label().class("k").child("Tint"))
+ .child(div().class("inline")
+ .child(input().input_type("color").value("#e6a23c"))
+ .child(label().child(input().input_type("checkbox").checked(true)).child(" Burn in frame numbers")))
+ .child(label().class("k").child("Progress"))
+ .child(progress().value("0.64"))
+ .child(div().class("actions")
+ .child(button().child("Export"))
+ .child(button().child("Cancel"))))
+ .child(fieldset()
+ .child(legend().child("Recent exports"))
+ .child(table()
+ .child(thead().child(tr().child(th().child("File")).child(th().child("Size")).child(th().child("Date"))))
+ .child(tbody().children([("robot_arm_v12.mp4", "184 MB", "Today 10:42"),
+ ("forest_flyby.mkv", "1.2 GB", "Yesterday")]
+ .map(|(a, b, c)| tr().child(td().child(a)).child(td().child(b)).child(td().child(c))))))))
+}
diff --git a/bindings/rust/blenderui/examples/site_animation.rs b/bindings/rust/blenderui/examples/site_animation.rs
new file mode 100644
index 0000000..2c1da07
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site_animation.rs
@@ -0,0 +1,89 @@
+//! CSS animations and transitions: `@keyframes` with easing on a spinner,
+//! a progress sweep, a bouncing ball and a fading toast. With
+//! `--screenshot` it renders three moments (0.25 s, 0.6 s, 1.0 s) of the
+//! deterministic headless clock side by side.
+//!
+//! ```text
+//! cargo run --release --example site_animation
+//! ```
+
+#[path = "site/common.rs"]
+mod common;
+
+use std::time::Duration;
+
+use blenderui::prelude::*;
+
+const CSS: &str = r#"
+body { margin: 0; padding: 14px; }
+.card { border-radius: 10px; background: rgba(128, 128, 128, 0.16); padding: 12px; display: flex;
+ flex-direction: column; gap: 12px; height: 222px; }
+h3 { margin: 0; font-size: 14px; }
+.row { display: flex; align-items: center; gap: 12px; }
+.spinner { width: 28px; height: 28px; border-radius: 14px; border: 4px solid rgba(128, 128, 128, 0.35);
+ position: relative; animation: spin 1.2s linear infinite; }
+.spinner .arc { position: absolute; left: 9px; top: -4px; width: 10px; height: 10px; border-radius: 5px;
+ background: #4772b3; }
+@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
+.track { flex: 1; height: 8px; border-radius: 4px; background: rgba(128, 128, 128, 0.3); }
+.sweep { height: 8px; border-radius: 4px; background: linear-gradient(90deg, #4772b3, #9b6fe0);
+ animation: grow 1.2s ease-in-out forwards; }
+@keyframes grow { from { width: 5%; } to { width: 100%; } }
+.lane { height: 54px; position: relative; border-bottom: 2px solid rgba(128, 128, 128, 0.4); }
+.ball { position: absolute; width: 22px; height: 22px; border-radius: 11px; left: 0; top: 30px;
+ background: #e8903c; border: 3px solid #ffd27a;
+ animation: bounce 1.2s ease-out forwards; }
+@keyframes bounce { 0% { left: 0px; top: 30px; } 25% { top: 0px; } 50% { top: 30px; }
+ 75% { top: 12px; } 100% { left: 170px; top: 30px; } }
+.toast { padding: 6px 10px; border-radius: 6px; background: #3fa66b; color: white; font-size: 12px;
+ animation: fade 1.2s ease forwards; }
+@keyframes fade { 0% { opacity: 0; transform: translateY(10px); } 60% { opacity: 1; transform: translateY(0px); }
+ 100% { opacity: 1; transform: translateY(0px); } }
+"#;
+
+struct Anim;
+
+impl Render for Anim {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ html().styled()
+ .child(head().child(style().child(CSS)))
+ .child(body().child(div().class("card")
+ .child(h3().child("Uploading render…"))
+ .child(div().class("row").child(div().class("spinner").child(div().class("arc")))
+ .child(div().class("track").child(div().class("sweep"))))
+ .child(div().class("lane").child(div().class("ball")))
+ .child(div().class("row").child(div().class("toast").child("✓ robot_arm.mp4 uploaded")))))
+ }
+}
+
+fn main() {
+ let Some(path) = common::screenshot_arg() else {
+ common::run(240.0, 250.0, "CSS animation", || Anim);
+ return;
+ };
+ Application::headless().run(move |cx| {
+ let win = cx.open_window(common::options(240.0, 250.0, "CSS animation"), |_, cx| cx.new(|_| Anim))
+ .unwrap();
+ cx.draw(win.id);
+ let mut frames = Vec::new();
+ let mut t = 0u64;
+ for ms in [250u64, 600, 1000] {
+ cx.advance_clock(Duration::from_millis(ms - t));
+ t = ms;
+ frames.push(cx.draw(win.id));
+ }
+ // a filmstrip: the frames side by side, a gap of the page background
+ let (fw, fh, ref first) = frames[0];
+ let gap = fw / 40;
+ let bg = first[fh / 2 * fw + 1];
+ let w = fw * 3 + gap * 2;
+ let mut out = vec![bg; w * fh];
+ for (i, (_, _, px)) in frames.iter().enumerate() {
+ for y in 0..fh {
+ let x0 = i * (fw + gap);
+ out[y * w + x0..y * w + x0 + fw].copy_from_slice(&px[y * fw..(y + 1) * fw]);
+ }
+ }
+ common::save(&path, w, fh, &out);
+ });
+}
diff --git a/bindings/rust/blenderui/examples/site_components.rs b/bindings/rust/blenderui/examples/site_components.rs
new file mode 100644
index 0000000..569674d
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site_components.rs
@@ -0,0 +1,82 @@
+//! Blender components from Rust: camera properties built from `NumberField`,
+//! `NumberSlider`, `Dropdown`, `Checkbox`, `ColorSwatch`, `TextField`,
+//! `Button` and `ProgressBar` (always Blender's widgets), laid out with CSS.
+//!
+//! ```text
+//! cargo run --release --example site_components
+//! ```
+
+#[path = "site/common.rs"]
+mod common;
+
+use blenderui::prelude::*;
+
+const CSS: &str = r#"
+body { margin: 0; padding: 8px; }
+.panel { border-radius: 4px; background: rgba(128, 128, 128, 0.14); margin-bottom: 4px; padding-bottom: 6px; }
+.panel h3 { margin: 0; padding: 4px 10px; font-size: 13px; font-weight: normal; }
+.row { display: flex; align-items: center; height: 22px; padding: 0 10px; gap: 6px; }
+.row .k { flex: none; width: 38%; text-align: right; padding-right: 6px; font-size: 12px; }
+.row .v { flex: 1; display: flex; gap: 2px; }
+.row .v > * { flex: 1; min-width: 0; width: 0; }
+.check { padding-left: 38%; }
+.foot { display: flex; gap: 6px; padding: 4px 10px 0 10px; }
+.foot > * { flex: 1; }
+"#;
+
+struct Camera;
+
+fn row(label: &'static str, value: Div) -> Div {
+ div().class("row").child(span().class("k").child(label)).child(div().class("v").child(value))
+}
+
+impl Render for Camera {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ rsx! {
+ <html styled>
+ <head><style>{CSS}</style></head>
+ <body>
+ <div class="panel">
+ <h3>"Lens"</h3>
+ {row("Type", Dropdown().child(option().child("Perspective")).child(option().child("Orthographic")))}
+ {row("Focal Length", NumberField().value("50").min(1.0).max(5000.0).attr("suffix", " mm"))}
+ {row("Lens Unit", Dropdown().child(option().child("Millimeters")).child(option().child("Field of View")))}
+ <div class="row"><span class="k">"Shift"</span><div class="v">
+ <NumberField value="0.000" step="0.01" />
+ <NumberField value="0.125" step="0.01" />
+ </div></div>
+ {row("Clip Start", NumberField().value("0.1").step(0.01))}
+ {row("End", NumberField().value("1000").step(1.0))}
+ </div>
+ <div class="panel">
+ <h3>"Depth of Field"</h3>
+ <div class="row check"><Checkbox checked={true} />"Enabled"</div>
+ {row("Focus Object", TextField().value("Robot Arm"))}
+ {row("F-Stop", NumberSlider().min(0.1).max(32.0).value("2.8").step(0.1))}
+ {row("Blades", NumberField().value("6").min(0.0).max(16.0))}
+ {row("Rotation", NumberSlider().min(-180.0).max(180.0).value("15"))}
+ </div>
+ <div class="panel">
+ <h3>"Viewport Display"</h3>
+ {row("Size", NumberSlider().min(0.0).max(10.0).value("1.0").step(0.1))}
+ {row("Passepartout", NumberSlider().min(0.0).max(1.0).value("0.85").step(0.05))}
+ {row("Guide Color", ColorSwatch().value("#e6a23c"))}
+ <div class="row check"><Checkbox checked={true} />"Show Limits"</div>
+ <div class="row check"><Checkbox />"Show Mist"</div>
+ </div>
+ <div class="foot">
+ <ProgressBar max="100" value="40" />
+ </div>
+ <div class="foot">
+ <Button>"Set Active Camera"</Button>
+ <Button>"Frame Selected"</Button>
+ </div>
+ </body>
+ </html>
+ }
+ }
+}
+
+fn main() {
+ common::run(400.0, 520.0, "Camera", || Camera);
+}
diff --git a/bindings/rust/blenderui/examples/site_dashboard.rs b/bindings/rust/blenderui/examples/site_dashboard.rs
new file mode 100644
index 0000000..bb5cda5
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site_dashboard.rs
@@ -0,0 +1,80 @@
+//! A render-farm dashboard in `rsx!` (the same app as `site_dashboard_builder`
+//! in gpui's builder syntax): HTML + CSS in Blender's theme (`styled`) with
+//! Blender widgets mixed in.
+//!
+//! ```text
+//! cargo run --release --example site_dashboard
+//! BUI_THEME=light BUI_UI_SCALE=2 cargo run --release --example site_dashboard -- --screenshot out.png
+//! ```
+
+#[path = "site/common.rs"]
+mod common;
+#[path = "site/dashboard_data.rs"]
+mod data;
+
+use blenderui::prelude::*;
+use data::{CSS, JOBS, NODES, STATS};
+
+struct Dashboard;
+
+impl Render for Dashboard {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ rsx! {
+ <html styled>
+ <head><style>{CSS}</style></head>
+ <body>
+ <header>
+ <div class="title">
+ <h1>"Render Farm"</h1>
+ <span class="muted">"Studio cluster · 8 nodes"</span>
+ </div>
+ <Dropdown>
+ <option>"Last 24 hours"</option>
+ <option>"Last 7 days"</option>
+ </Dropdown>
+ <Button>"New Job"</Button>
+ </header>
+ <section class="stats">
+ {for (label, value, delta, fill) in STATS {
+ <div class="card">
+ <span class="muted">{label}</span>
+ <strong>{value}</strong>
+ <div class="meter"><div class="fill" style={format!("width: {fill}%")} /></div>
+ <span class="delta">{delta}</span>
+ </div>
+ }}
+ </section>
+ <section class="columns">
+ <div class="panel jobs">
+ <h2>"Jobs"</h2>
+ {for (name, engine, frames, pct) in JOBS {
+ <div class="job">
+ <span class="name">{name}</span>
+ <span class={format!("badge {}", engine.to_lowercase())}>{engine}</span>
+ <span class="muted frames">{frames}</span>
+ <ProgressBar class="bar" max="100" value={pct.to_string()} />
+ <span class="pct">{format!("{pct}%")}</span>
+ </div>
+ }}
+ </div>
+ <div class="panel nodes">
+ <h2>"Nodes"</h2>
+ {for (name, state, load) in NODES {
+ <div class="node">
+ <span class={format!("dot {state}")} />
+ <span class="name">{name}</span>
+ <div class="meter small"><div class="fill" style={format!("width: {load}%")} /></div>
+ </div>
+ }}
+ <label class="row"><Checkbox checked={true} />"Wake idle nodes"</label>
+ </div>
+ </section>
+ </body>
+ </html>
+ }
+ }
+}
+
+fn main() {
+ common::run(700.0, 370.0, "Render Farm", || Dashboard);
+}
diff --git a/bindings/rust/blenderui/examples/site_dashboard_builder.rs b/bindings/rust/blenderui/examples/site_dashboard_builder.rs
new file mode 100644
index 0000000..e67f847
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site_dashboard_builder.rs
@@ -0,0 +1,62 @@
+//! The render-farm dashboard of `site_dashboard`, written in gpui's builder
+//! syntax instead of `rsx!` (same elements, same stylesheet, same pixels).
+//!
+//! ```text
+//! cargo run --release --example site_dashboard_builder
+//! ```
+
+#[path = "site/common.rs"]
+mod common;
+#[path = "site/dashboard_data.rs"]
+mod data;
+
+use blenderui::prelude::*;
+use data::{CSS, JOBS, NODES, STATS};
+
+struct Dashboard;
+
+impl Render for Dashboard {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ let stat = |(label, value, delta, fill): (&str, &str, &str, u32)| {
+ div().class("card")
+ .child(span().class("muted").child(label.to_string()))
+ .child(strong().child(value.to_string()))
+ .child(div().class("meter").child(div().class("fill").style(format!("width: {fill}%"))))
+ .child(span().class("delta").child(delta.to_string()))
+ };
+ let job = |(name, engine, frames, pct): (&str, &str, &str, u32)| {
+ div().class("job")
+ .child(span().class("name").child(name.to_string()))
+ .child(span().class(format!("badge {}", engine.to_lowercase())).child(engine.to_string()))
+ .child(span().class("muted frames").child(frames.to_string()))
+ .child(ProgressBar().class("bar").attr("max", "100").value(pct.to_string()))
+ .child(span().class("pct").child(format!("{pct}%")))
+ };
+ let node = |(name, state, load): (&str, &str, u32)| {
+ div().class("node")
+ .child(span().class(format!("dot {state}")))
+ .child(span().class("name").child(name.to_string()))
+ .child(div().class("meter small").child(div().class("fill").style(format!("width: {load}%"))))
+ };
+ html().styled()
+ .child(head().child(style().child(CSS)))
+ .child(body()
+ .child(header()
+ .child(div().class("title")
+ .child(h1().child("Render Farm"))
+ .child(span().class("muted").child("Studio cluster · 8 nodes")))
+ .child(Dropdown().child(option().child("Last 24 hours")).child(option().child("Last 7 days")))
+ .child(Button().child("New Job")))
+ .child(section().class("stats").children(STATS.map(stat)))
+ .child(section().class("columns")
+ .child(div().class("panel jobs").child(h2().child("Jobs")).children(JOBS.map(job)))
+ .child(div().class("panel nodes")
+ .child(h2().child("Nodes"))
+ .children(NODES.map(node))
+ .child(label().class("row").child(Checkbox().checked(true)).child("Wake idle nodes")))))
+ }
+}
+
+fn main() {
+ common::run(700.0, 370.0, "Render Farm", || Dashboard);
+}
diff --git a/bindings/rust/blenderui/examples/site_effects.rs b/bindings/rust/blenderui/examples/site_effects.rs
new file mode 100644
index 0000000..258cdb6
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site_effects.rs
@@ -0,0 +1,93 @@
+//! CSS effects on element pixels: `filter`, `clip-path`, transforms,
+//! `mix-blend-mode` and `backdrop-filter`, on a small landscape made of
+//! gradients (no images).
+//!
+//! ```text
+//! cargo run --release --example site_effects
+//! ```
+
+#[path = "site/common.rs"]
+mod common;
+
+use blenderui::prelude::*;
+
+const CSS: &str = r#"
+body { margin: 0; padding: 14px; }
+.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
+figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; }
+figcaption { font-size: 11px; font-family: monospace; opacity: 0.75; }
+.scene { width: 120px; height: 84px; border-radius: 8px; overflow: hidden; position: relative;
+ background: linear-gradient(180deg, #2d5fa8 0%, #e89a5a 70%, #f2c46d 100%); }
+.sun { position: absolute; left: 70px; top: 22px; width: 30px; height: 30px; border-radius: 15px;
+ background: #ffd25a; box-shadow: 0 0 14px 4px rgba(255, 214, 120, 0.8); }
+.hill1 { position: absolute; left: -20px; top: 46px; width: 110px; height: 60px; border-radius: 55px 55px 0 0;
+ background: #2f6b4a; }
+.hill2 { position: absolute; left: 50px; top: 54px; width: 110px; height: 60px; border-radius: 55px 55px 0 0;
+ background: #24543a; }
+.f-gray { filter: grayscale(1); }
+.f-sepia { filter: sepia(0.9); }
+.f-hue { filter: hue-rotate(150deg) saturate(1.4); }
+.f-blur { filter: blur(3px); }
+.f-shadow { filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.55)); border-radius: 0; overflow: visible;
+ clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
+.c-circle { clip-path: circle(40% at 50% 50%); }
+.c-poly { clip-path: polygon(0 0, 100% 15%, 85% 100%, 10% 85%); }
+.t-rotate { transform: rotate(-12deg); }
+.t-skew { transform: skewX(-14deg) scale(0.9); }
+.blend { width: 120px; height: 84px; position: relative; border-radius: 8px; background: #e6e6e6; }
+.blend div { position: absolute; width: 50px; height: 50px; border-radius: 25px; }
+.blend .r { left: 18px; top: 8px; background: #e04a4a; }
+.blend .g { left: 52px; top: 8px; background: #3fb36b; }
+.blend .b { left: 35px; top: 32px; background: #4a7ae0; }
+.m-multiply div { mix-blend-mode: multiply; }
+.m-screen { background: #1d1d1d; }
+.m-screen div { mix-blend-mode: screen; }
+.m-diff div { mix-blend-mode: difference; }
+.frost { position: relative; }
+.glass { position: absolute; left: 14px; top: 20px; width: 92px; height: 44px; border-radius: 8px;
+ backdrop-filter: blur(6px); background: rgba(255, 255, 255, 0.25);
+ border: 1px solid rgba(255, 255, 255, 0.5); }
+"#;
+
+fn scene(class: &str) -> Div {
+ div().class(format!("scene {class}"))
+ .child(div().class("sun")).child(div().class("hill1")).child(div().class("hill2"))
+}
+
+fn fig(content: Div, caption: &'static str) -> Div {
+ figure().child(content).child(figcaption().child(caption))
+}
+
+fn blend(class: &str) -> Div {
+ div().class(format!("blend {class}"))
+ .child(div().class("r")).child(div().class("g")).child(div().class("b"))
+}
+
+struct Effects;
+
+impl Render for Effects {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ html().styled()
+ .child(head().child(style().child(CSS)))
+ .child(body().child(div().class("grid")
+ .child(fig(scene(""), "original"))
+ .child(fig(scene("f-gray"), "grayscale(1)"))
+ .child(fig(scene("f-sepia"), "sepia(0.9)"))
+ .child(fig(scene("f-hue"), "hue-rotate(150deg)"))
+ .child(fig(scene("f-blur"), "blur(3px)"))
+ .child(fig(scene("c-circle"), "clip-path: circle()"))
+ .child(fig(scene("c-poly"), "clip-path: polygon()"))
+ .child(fig(scene("f-shadow"), "drop-shadow + star"))
+ .child(fig(scene("t-rotate"), "rotate(-12deg)"))
+ .child(fig(scene("t-skew"), "skewX() scale()"))
+ .child(fig(blend("m-multiply"), "blend: multiply"))
+ .child(fig(blend("m-screen"), "blend: screen"))
+ .child(fig(blend("m-diff"), "blend: difference"))
+ .child(fig(scene("frost").child(div().class("glass")), "backdrop-filter"))
+ .child(fig(scene("f-hue t-rotate c-circle"), "all of them"))))
+ }
+}
+
+fn main() {
+ common::run(720.0, 352.0, "CSS effects", || Effects);
+}
diff --git a/bindings/rust/blenderui/examples/site_grid.rs b/bindings/rust/blenderui/examples/site_grid.rs
new file mode 100644
index 0000000..c1a91ab
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site_grid.rs
@@ -0,0 +1,80 @@
+//! CSS grid: an asset browser laid out with `grid-template-columns`, spans
+//! and `repeat(auto-fill, minmax())`, in Blender's theme.
+//!
+//! ```text
+//! cargo run --release --example site_grid
+//! ```
+
+#[path = "site/common.rs"]
+mod common;
+
+use blenderui::prelude::*;
+
+const CSS: &str = r#"
+body { margin: 0; padding: 12px; }
+.layout { display: grid; grid-template-columns: 150px 1fr; grid-template-rows: auto 1fr; gap: 10px;
+ height: 446px; }
+.top { grid-column: 1 / span 2; display: flex; align-items: center; gap: 10px; }
+.top h1 { font-size: 17px; margin: 0; flex: 1; }
+aside { border-radius: 8px; background: rgba(128, 128, 128, 0.14); padding: 8px; display: flex;
+ flex-direction: column; gap: 2px; }
+aside .cat { padding: 4px 8px; border-radius: 4px; font-size: 12px; display: flex; }
+aside .cat span { flex: 1; }
+aside .cat.on { background: #4772b3; color: white; }
+main { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); grid-auto-rows: 92px; grid-auto-flow: dense;
+ gap: 8px; }
+.tile { border-radius: 8px; display: flex; flex-direction: column; justify-content: flex-end;
+ padding: 6px 8px; color: white; font-size: 11px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
+.tile b { font-size: 12px; }
+.wide { grid-column: span 2; }
+.tall { grid-row: span 2; }
+"#;
+
+const TILES: [(&str, &str, &str, &str); 13] = [
+ ("Brushed Steel", "PBR · 4K", "linear-gradient(135deg, #8a9099, #4b525c)", "wide"),
+ ("Car Paint", "Clear coat", "radial-gradient(circle at 30% 30%, #ff7a6b, #a3122a)", "tall"),
+ ("Oak", "Wood · 2K", "linear-gradient(160deg, #c08a52, #7a4b25)", ""),
+ ("Marble", "Stone", "linear-gradient(120deg, #f2f0ea, #b9b4a8)", ""),
+ ("Neon", "Emission", "radial-gradient(circle, #ff4fd8, #3a0b6e)", ""),
+ ("Ocean", "Volume", "linear-gradient(180deg, #2bc0d6, #0b3d73)", "wide"),
+ ("Moss", "Organic", "linear-gradient(140deg, #8fbf4a, #2f5b22)", ""),
+ ("Rubber", "Matte", "linear-gradient(160deg, #3a3a3a, #121212)", ""),
+ ("Gold", "Metal", "linear-gradient(135deg, #ffe08a, #b07a1c)", ""),
+ ("Lava", "Emission", "radial-gradient(circle at 70% 70%, #ffb347, #b3240b)", ""),
+ ("Glass", "Transmission", "linear-gradient(135deg, #cfeffd, #6fb3d9)", ""),
+ ("Concrete", "Stone", "linear-gradient(150deg, #a3a3a0, #5f5f5c)", ""),
+ ("Velvet", "Fabric", "radial-gradient(circle at 40% 30%, #8a3cc2, #2e0f4a)", ""),
+];
+
+const CATS: [(&str, u32, bool); 6] = [("All", 128, false), ("Metals", 18, false), ("Paints", 24, true),
+ ("Woods", 15, false), ("Stone", 21, false), ("Emissive", 9, false)];
+
+struct Grid;
+
+impl Render for Grid {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ html().styled()
+ .child(head().child(style().child(CSS)))
+ .child(body().child(div().class("layout")
+ .child(div().class("top")
+ .child(h1().child("Material Library"))
+ .child(TextField().placeholder("Search materials").w(px(180.0)))
+ .child(Dropdown().child(option().child("Sort by name")).child(option().child("Sort by date"))))
+ .child(aside().children(CATS.map(|(name, n, on)| {
+ div().class(if on { "cat on" } else { "cat" })
+ .child(span().child(name)).child(small().child(n.to_string()))
+ })))
+ .child(blenderui::html::main().children(TILES.map(|(name, kind, bg, span)| {
+ div().class(format!("tile {span}")).style(format!("background: {bg}"))
+ .child(b().child(name)).child(span_el(kind))
+ })))))
+ }
+}
+
+fn span_el(text: &'static str) -> Div {
+ span().child(text)
+}
+
+fn main() {
+ common::run(640.0, 470.0, "CSS grid", || Grid);
+}
diff --git a/bindings/rust/blenderui/examples/site_plain_html.rs b/bindings/rust/blenderui/examples/site_plain_html.rs
new file mode 100644
index 0000000..1b88d00
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site_plain_html.rs
@@ -0,0 +1,25 @@
+//! Plain HTML: form controls and tables with a browser's default look
+//! (the same page as `site_styled`, without `styled`).
+//!
+//! ```text
+//! cargo run --release --example site_plain_html
+//! ```
+
+#[path = "site/common.rs"]
+mod common;
+#[path = "site/form_page.rs"]
+mod form_page;
+
+use blenderui::prelude::*;
+
+struct Page;
+
+impl Render for Page {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ form_page::page(false)
+ }
+}
+
+fn main() {
+ common::run(560.0, 520.0, "Export Animation", || Page);
+}
diff --git a/bindings/rust/blenderui/examples/site_styled.rs b/bindings/rust/blenderui/examples/site_styled.rs
new file mode 100644
index 0000000..51746e2
--- /dev/null
+++ b/bindings/rust/blenderui/examples/site_styled.rs
@@ -0,0 +1,25 @@
+//! The `site_plain_html` page inside `styled`: the same markup, drawn in
+//! Blender's theme with Blender's widgets (dark or light: BUI_THEME).
+//!
+//! ```text
+//! cargo run --release --example site_styled
+//! ```
+
+#[path = "site/common.rs"]
+mod common;
+#[path = "site/form_page.rs"]
+mod form_page;
+
+use blenderui::prelude::*;
+
+struct Page;
+
+impl Render for Page {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ form_page::page(true)
+ }
+}
+
+fn main() {
+ common::run(560.0, 520.0, "Export Animation", || Page);
+}
diff --git a/bindings/rust/blenderui/src/element.rs b/bindings/rust/blenderui/src/element.rs
index 024c310..df86d8f 100644
--- a/bindings/rust/blenderui/src/element.rs
+++ b/bindings/rust/blenderui/src/element.rs
@@ -152,8 +152,11 @@ impl Div {
/// Give this element and everything inside it Blender's look (dark
/// theme, UI font size, themed links, code, tables ...). Without it,
- /// elements get the browsers' defaults: black text on white. Form
- /// widgets look like Blender either way. `<div styled>` in `rsx!`.
+ /// elements get the browsers' defaults: black text on white, with
+ /// browser-look (Chrome-style) form controls; inside `styled`, form
+ /// controls are Blender's widgets. The Blender components
+ /// (`NumberSlider()`, `Button()` ...) are Blender's widgets anywhere.
+ /// `<div styled>` in `rsx!`.
pub fn styled(self) -> Self {
self.attr("styled", "")
}
diff --git a/bindings/rust/blenderui/src/html.rs b/bindings/rust/blenderui/src/html.rs
index 7d1e8e9..b94c323 100644
--- a/bindings/rust/blenderui/src/html.rs
+++ b/bindings/rust/blenderui/src/html.rs
@@ -69,7 +69,9 @@ pub fn custom(tag: &'static str) -> Div {
/// The user-agent stylesheet: the browsers' defaults (WHATWG rendering
/// section: black text on white). An element with the `styled` attribute
/// (`div().styled()`, `<div styled>`) and everything inside it get Blender's
-/// dark theme instead. Form widgets are Blender widgets either way.
+/// theme (dark, or light with `BUI_THEME` / `set_theme`) instead. Outside
+/// `styled`, form controls are drawn like a browser's; inside it they are
+/// Blender's widgets, and the Blender components always are.
pub const UA_CSS: &str = r#"
html { display: block; background-color: #ffffff; color: #000000; font-size: 16px; }
body { display: block; margin: 8px; }
@@ -203,10 +205,48 @@ pub fn ua_stylesheet() -> &'static Stylesheet {
SHEET.get_or_init(|| Stylesheet::parse(UA_CSS))
}
-/// The parsed [`UA_STYLED_CSS`] (shared, parsed once).
+/// [`UA_STYLED_CSS`]'s colours in Blender's Light theme (Blender_Light.xml:
+/// the properties editor's #b3b3b3 back and dark text), in sheet order.
+const UA_STYLED_LIGHT: &[(&str, &str)] = &[
+ ("background-color: #303030; color: #e6e6e6;", "background-color: #b3b3b3; color: #1a1a1a;"),
+ ("color: #b8b8b8; }", "color: #3d3d3d; }"),
+ ("color: #999999; }", "color: #4d4d4d; }"),
+ ("background-color: #232323; border-radius: 3px;", "background-color: #c7c7c7; border-radius: 3px;"),
+ ("border: 1px solid #555555; padding: 0 3px;", "border: 1px solid #8c8c8c; padding: 0 3px;"),
+ ("background-color: #232323; padding: 6px 8px;", "background-color: #c7c7c7; padding: 6px 8px;"),
+ ("a { color: #5294e2;", "a { color: #1f5bb5;"),
+ ("a:hover { color: #78aef0; }", "a:hover { color: #3a78d6; }"),
+ ("border-top: 1px solid #484848;", "border-top: 1px solid #8c8c8c;"),
+ ("thead { background-color: #282828; }", "thead { background-color: #a6a6a6; }"),
+ ("border: 1px solid #484848; border-radius: 4px;", "border: 1px solid #8c8c8c; border-radius: 4px;"),
+ ("background-color: #353535; border: 1px solid #555555;", "background-color: #cccccc; border: 1px solid #8c8c8c;"),
+ ("box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);", "box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);"),
+ ("figcaption { font-size: 0.9em; color: #b8b8b8; }", "figcaption { font-size: 0.9em; color: #3d3d3d; }"),
+ ("iframe, embed, object, video { border: 1px solid #484848; }", "iframe, embed, object, video { border: 1px solid #8c8c8c; }"),
+];
+
+/// The `styled` user-agent stylesheet for a theme (`"dark"` or `"light"`).
+pub fn ua_styled_css(theme: &str) -> String {
+ let mut css = UA_STYLED_CSS.to_string();
+ if theme == "light" {
+ for (dark, light) in UA_STYLED_LIGHT {
+ debug_assert!(css.contains(dark), "UA_STYLED_LIGHT out of date: {dark}");
+ css = css.replacen(dark, light, 1);
+ }
+ }
+ css
+}
+
+/// The parsed `styled` sheet for the active theme ([`crate::set_theme`],
+/// `BUI_THEME`): [`UA_STYLED_CSS`] or its light variant (each parsed once).
pub fn ua_styled_stylesheet() -> &'static Stylesheet {
- static SHEET: OnceLock<Stylesheet> = OnceLock::new();
- SHEET.get_or_init(|| Stylesheet::parse(UA_STYLED_CSS))
+ static DARK: OnceLock<Stylesheet> = OnceLock::new();
+ static LIGHT: OnceLock<Stylesheet> = OnceLock::new();
+ if crate::theme_name() == "light" {
+ LIGHT.get_or_init(|| Stylesheet::parse(&ua_styled_css("light")))
+ } else {
+ DARK.get_or_init(|| Stylesheet::parse(UA_STYLED_CSS))
+ }
}
#[cfg(test)]
diff --git a/bindings/rust/blenderui/src/lib.rs b/bindings/rust/blenderui/src/lib.rs
index b872eb5..605a4ae 100644
--- a/bindings/rust/blenderui/src/lib.rs
+++ b/bindings/rust/blenderui/src/lib.rs
@@ -158,8 +158,36 @@ pub fn set_slug(on: bool) {
unsafe { sys::BUI_gpu_set_slug(on as std::os::raw::c_int) }
}
-/// Whether this platform has native windows (Windows today); elsewhere
-/// apps run headless or through a host such as the Tk fallback.
+/// Switch every window to Blender's `"dark"` (the default) or `"light"`
+/// theme (its Blender_Light.xml preset): widgets, panels, the region
+/// background and the `styled` HTML sheet follow it, and open windows
+/// redraw. Returns `false` for an unknown name. Without a call the
+/// `BUI_THEME` environment variable (dark|light) picks the theme.
+pub fn set_theme(name: &str) -> bool {
+ let Ok(c) = std::ffi::CString::new(name) else { return false };
+ // SAFETY: a NUL-terminated string; the kit copies the preset.
+ unsafe { sys::BK_set_theme(c.as_ptr()) != 0 }
+}
+
+/// The active theme: `"dark"` or `"light"`.
+pub fn theme_name() -> &'static str {
+ // SAFETY: the kit returns a static string.
+ let s = unsafe { std::ffi::CStr::from_ptr(sys::BK_theme_name()) };
+ if s.to_bytes() == b"light" { "light" } else { "dark" }
+}
+
+/// A color of the active theme as RGBA 0..1 (`"region_bg"`, `"text"`,
+/// `"regular.inner"` ...; see `BK_theme_color` in BUI_kit.h).
+pub fn theme_color(key: &str) -> Option<[f32; 4]> {
+ let c = std::ffi::CString::new(key).ok()?;
+ let mut out = [0.0f32; 4];
+ // SAFETY: `out` holds the four floats the kit writes.
+ (unsafe { sys::BK_theme_color(c.as_ptr(), out.as_mut_ptr()) } != 0).then_some(out)
+}
+
+/// Whether this platform has native windows: Win32 on Windows, X11 on Linux
+/// (when a display is available) and Cocoa on macOS (experimental).
+/// Without them, apps run headless.
pub fn native_windows() -> bool {
// SAFETY: a constant query.
unsafe { sys::BK_window_supported() != 0 }
diff --git a/bindings/rust/blenderui/src/paint.rs b/bindings/rust/blenderui/src/paint.rs
index fc1aac1..4a36fce 100644
--- a/bindings/rust/blenderui/src/paint.rs
+++ b/bindings/rust/blenderui/src/paint.rs
@@ -900,8 +900,9 @@ fn paint_node(frame: &Frame, styles: &StyleStore, tc: &mut TextCache, i: usize,
p.fill(inner, crate::color::rgb(0x282828));
let label = frame.attr(i, "alt").unwrap_or(tag);
let w = tc.width(label, c.font_size, 0);
+ let base = text::baseline(inner.origin.y, inner.size.height, c.font_size);
p.styled_text(inner.origin.x + (inner.size.width - w) / 2.0,
- inner.origin.y + (inner.size.height - c.font_size) / 2.0,
+ text::item_top(base, c.font_size),
label, c.font_size, 0, crate::color::rgb(0x8a8a8a));
}
}
@@ -927,9 +928,10 @@ fn paint_text_line(p: &mut Painter, tc: &mut TextCache, c: &Computed, s: &str, x
width: Option<f32>) {
let flags = text::flags(c);
let size = c.font_size;
- let top = y + ((lh - size) / 2.0).max(0.0);
+ let base = text::baseline(y, lh, size);
let s: std::borrow::Cow<str> = if c.small_caps { s.to_uppercase().into() } else { s.into() };
let size_draw = if c.small_caps { size * 0.8 } else { size };
+ let top = text::item_top(base, size_draw);
if let Some(sh) = c.text_shadow {
p.styled_text(x + sh.x, top + sh.y, &s, size_draw, flags, sh.color);
}
@@ -948,18 +950,15 @@ fn paint_text_line(p: &mut Painter, tc: &mut TextCache, c: &Computed, s: &str, x
let thick = c.decoration_thickness.unwrap_or(size / 14.0).max(1.0);
let dc = c.decoration_color.unwrap_or(c.color);
if c.underline {
- // the offset is measured from the baseline (about 0.8em down)
- let y = match c.underline_offset {
- Some(o) => top + size * 0.8 + o,
- None => top + size * 0.92,
- };
+ // `text-underline-offset` is measured from the baseline
+ let y = base + c.underline_offset.unwrap_or(size * text::UNDERLINE);
decoration(p, c.decoration_style, x, y, w, thick, dc);
}
if c.line_through {
- decoration(p, c.decoration_style, x, top + size * 0.48, w, thick, dc);
+ decoration(p, c.decoration_style, x, base - size * text::STRIKEOUT - thick / 2.0, w, thick, dc);
}
if c.overline {
- decoration(p, c.decoration_style, x, top, w, thick, dc);
+ decoration(p, c.decoration_style, x, text::ascent_top(base, size), w, thick, dc);
}
}
}
@@ -1014,6 +1013,7 @@ fn paint_box(n: &BoxNode, c: &Computed, p: &mut Painter, vp: (f32, f32), skip_ba
let clip_box = edge_box(c, b, c.bg_clip, &bw);
let clip_r = (r - (clip_box.origin.x - b.origin.x)).max(0.0);
match &c.gradient {
+ Some(g) if clip_r > 0.0 => with_rounded_clip(p, clip_box, clip_r, |p| paint_gradient(p, g, clip_box)),
Some(g) => p.with_clip(clip_box, |p| paint_gradient(p, g, clip_box)),
None if skip_background && c.bg_clip == BoxEdge::Border => {}
None => p.quad(clip_box, clip_r, c.background, Rgba::TRANSPARENT, 0.0),
@@ -1430,6 +1430,33 @@ fn mix(a: Rgba, b: Rgba, t: f32) -> Rgba {
a: a.a + (b.a - a.a) * t }
}
+/// Runs `f` clipped to the rounded box `b` (radius `r`): one clip for the
+/// straight middle, and thin rows across the corners, each as wide as the
+/// rounded outline at its height (gradients have no rounded fill of their own).
+fn with_rounded_clip(p: &mut Painter, b: Bounds<f32>, r: f32, f: impl Fn(&mut Painter)) {
+ let (x, y, w, h) = (b.origin.x, b.origin.y, b.size.width, b.size.height);
+ let r = r.min(w / 2.0).min(h / 2.0);
+ if r < 0.5 {
+ p.with_clip(b, |p| f(p));
+ return;
+ }
+ p.with_clip(rect(x, y + r, w, h - 2.0 * r), |p| f(p));
+ const ROW: f32 = 0.5; // device rows at 2x
+ let rows = (r / ROW).ceil() as usize;
+ for k in 0..rows {
+ let y0 = k as f32 * ROW;
+ let rh = ROW.min(r - y0);
+ let dy = r - (y0 + rh / 2.0); // distance from the corner centres' line
+ let inset = r - (r * r - dy * dy).max(0.0).sqrt();
+ let rw = w - 2.0 * inset;
+ if rw <= 0.0 {
+ continue;
+ }
+ p.with_clip(rect(x + inset, y + y0, rw, rh), |p| f(p));
+ p.with_clip(rect(x + inset, y + h - y0 - rh, rw, rh), |p| f(p));
+ }
+}
+
/// Colour at position `t` (0..1) along a gradient.
fn gradient_at(g: &crate::style::Gradient, t: f32) -> Rgba {
let n = g.stops.len();
diff --git a/bindings/rust/blenderui/src/text.rs b/bindings/rust/blenderui/src/text.rs
index ee1364f..99d673e 100644
--- a/bindings/rust/blenderui/src/text.rs
+++ b/bindings/rust/blenderui/src/text.rs
@@ -83,16 +83,71 @@ pub(crate) fn family(flags: i32) -> (*const std::os::raw::c_char, i32) {
(f.get(id).map_or(c"".as_ptr(), |c| c.as_ptr()), low)
}
+// Vertical font metrics, in em, of the UI font (the embedded Inter,
+// gpu/extern/font_inter.h: 2048 units per em). Browsers lay lines out with
+// the OS/2 typo metrics (USE_TYPO_METRICS is set): ascender 1984,
+// descender -494, line gap 0. Decorations: `post` underlinePosition -348
+// (the line's top), OS/2 yStrikeoutPosition 671 / yStrikeoutSize 140.
+
+/// Ascent of the font's content area above the baseline.
+const ASCENT: f32 = 1984.0 / 2048.0;
+/// Descent of the font's content area below the baseline.
+const DESCENT: f32 = 494.0 / 2048.0;
+/// Top of the underline below the baseline.
+pub(crate) const UNDERLINE: f32 = 348.0 / 2048.0;
+/// Middle of the strikeout stroke above the baseline.
+pub(crate) const STRIKEOUT: f32 = (671.0 - 140.0 / 2.0) / 2048.0;
+/// Where the kit puts the baseline below the top of a north-anchored text
+/// item (kit_frame.c, BK_ITEM_TEXT: the cap height, 0.72 em).
+const KIT_ITEM_BASELINE: f32 = 0.72;
+
+/// The baseline of `size` px text in a line box of height `lh` at `y`: like
+/// a browser, the font's content area (ascent + descent) is centred in the
+/// line box (CSS 2 §10.8.1, half-leading; negative when `lh` is smaller).
+pub(crate) const fn baseline(y: f32, lh: f32, size: f32) -> f32 {
+ y + (lh - (ASCENT + DESCENT) * size) / 2.0 + ASCENT * size
+}
+
+/// The top of the content area of `size` px text on `baseline` (`overline`).
+pub(crate) const fn ascent_top(baseline: f32, size: f32) -> f32 {
+ baseline - ASCENT * size
+}
+
+/// The y of a north-anchored kit text item of `size` px whose baseline is
+/// `baseline` (what [`crate::paint::Painter`] text items take).
+pub(crate) const fn item_top(baseline: f32, size: f32) -> f32 {
+ baseline - KIT_ITEM_BASELINE * size
+}
+
type Widths = crate::style::FnvMap<Box<str>, f32>;
/// Text widths by (size, flags) then text: looked up by `&str`, no
/// allocation on a hit. Owned by the window, kept across frames.
-#[derive(Default)]
+///
+/// Text is measured at the size it is drawn at, `size * scale` device
+/// pixels (as Blender measures with BLF at the UI-scaled size), and returned
+/// in logical pixels: the variable UI font's optical size and the engine's
+/// whole-pixel sizes follow the device size, so a width measured at the
+/// logical size would not match the drawn text.
pub(crate) struct TextCache {
fonts: crate::style::FnvMap<(u32, i32), Widths>,
+ /// Device pixels per logical pixel (the window's resolution scale).
+ scale: f32,
+}
+
+impl Default for TextCache {
+ fn default() -> Self {
+ TextCache { fonts: crate::style::FnvMap::default(), scale: 1.0 }
+ }
}
impl TextCache {
+ /// Measure for a window drawn at `scale` device pixels per logical pixel.
+ pub(crate) fn set_scale(&mut self, scale: f32) {
+ self.fonts.clear();
+ self.scale = scale;
+ }
+
/// Advance width of `s` at `size` px.
pub(crate) fn width(&mut self, s: &str, size: f32, flags: i32) -> f32 {
if s.is_empty() {
@@ -106,10 +161,12 @@ impl TextCache {
let (fam, low) = family(flags);
// SAFETY: pointers are valid for the call (families are 'static).
let ok = unsafe {
- sys::BUI_text_measure(fam, low, size, s.as_ptr().cast(), s.len() as i32, &mut w)
+ sys::BUI_text_measure(fam, low, size * self.scale, 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
+ } else {
+ w /= self.scale;
}
if m.len() > 20_000 {
m.clear();
diff --git a/bindings/rust/blenderui/src/window.rs b/bindings/rust/blenderui/src/window.rs
index d814c62..0fe7db0 100644
--- a/bindings/rust/blenderui/src/window.rs
+++ b/bindings/rust/blenderui/src/window.rs
@@ -215,7 +215,7 @@ pub struct WindowOptions {
pub titlebar: Option<TitlebarOptions>,
pub is_resizable: Option<bool>,
pub window_min_size: Option<Size<Pixels>>,
- /// Draw this window on the GPU (Direct3D 11) instead of the software
+ /// Draw this window on the GPU (Direct3D 11 / OpenGL 3.3) instead of the software
/// raster; `None` follows [`Application::gpu`] / the `BUI_GPU` variable.
pub gpu: Option<bool>,
}
@@ -226,6 +226,7 @@ pub struct Application {
gpu: Option<bool>,
slug: Option<bool>,
keep_alive: bool,
+ theme: Option<String>,
}
impl Default for Application {
@@ -237,7 +238,7 @@ impl Default for Application {
impl Application {
/// Native windows.
pub fn new() -> Application {
- Application { headless: false, gpu: None, slug: None, keep_alive: false }
+ Application { headless: false, gpu: None, slug: None, keep_alive: false, theme: None }
}
/// Draw every window on the GPU (Direct3D 11 on Windows): the same
@@ -258,6 +259,13 @@ impl Application {
self
}
+ /// Blender's `"dark"` (default) or `"light"` theme for every window (see
+ /// [`crate::set_theme`]); the `BUI_THEME` variable applies otherwise.
+ pub fn theme(mut self, name: &str) -> Application {
+ self.theme = Some(name.to_string());
+ self
+ }
+
/// Keep the event loop running with no windows open, until
/// [`App::quit`]: for apps driven from another thread ([`App::ui_sender`]).
pub fn keep_alive(mut self, on: bool) -> Application {
@@ -268,7 +276,7 @@ impl Application {
/// Off-screen windows (tests, screenshots, CI): nothing is shown, the
/// `simulate_*` and `draw` methods drive it.
pub fn headless() -> Application {
- Application { headless: true, gpu: None, slug: None, keep_alive: false }
+ Application { headless: true, gpu: None, slug: None, keep_alive: false, theme: None }
}
/// Run `f`, then the event loop until every window is closed.
@@ -283,6 +291,16 @@ impl Application {
if let Some(on) = self.slug {
crate::set_slug(on);
}
+ if let Some(t) = &self.theme {
+ crate::set_theme(t);
+ }
+ if headless {
+ // off-screen windows have no monitor DPI: BUI_UI_SCALE (e.g. 2 for
+ // retina-sharp screenshots) sets the resolution scale
+ if let Some(s) = std::env::var("BUI_UI_SCALE").ok().and_then(|v| v.parse::<f32>().ok()) {
+ unsafe { sys::BK_set_scale(s) };
+ }
+ }
let mut app = App::create(headless);
f(&mut app);
app.flush();
@@ -876,6 +894,7 @@ impl Window {
win.phys = ((w * win.scale).round() as i32, (h * win.scale).round() as i32);
win.native = Some(n);
}
+ win.caches.text.set_scale(win.scale);
Ok(win)
}
}
diff --git a/bindings/rust/blenderui/tests/text_metrics.rs b/bindings/rust/blenderui/tests/text_metrics.rs
new file mode 100644
index 0000000..084bfe8
--- /dev/null
+++ b/bindings/rust/blenderui/tests/text_metrics.rs
@@ -0,0 +1,133 @@
+//! Text placement against a browser: the baseline in the line box and the
+//! extent of text decorations, drawn at a resolution scale of 2 (the size
+//! the site screenshots use, where measuring and drawing sizes differ).
+
+use blenderui::prelude::*;
+
+/// Inter's content area (OS/2 typo ascender / descender) and cap height, in em.
+const ASCENT: f32 = 1984.0 / 2048.0;
+const DESCENT: f32 = 494.0 / 2048.0;
+const CAP: f32 = 1490.0 / 2048.0;
+
+/// Every test here draws at scale 2 (the kit reads this once per run).
+fn scale_2() {
+ static ONCE: std::sync::Once = std::sync::Once::new();
+ // SAFETY: set once, before any window opens; every test calls this first.
+ ONCE.call_once(|| unsafe { std::env::set_var("BUI_UI_SCALE", "2") });
+}
+
+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()
+}
+
+/// Device-pixel rows / columns of `img` inside `[x0, x1) x [y0, y1)` where
+/// `ink` holds, as (first row, last row, first column, last column).
+fn ink_box(img: &(usize, usize, Vec<u32>), (x0, y0, x1, y1): (usize, usize, usize, usize),
+ ink: impl Fn(u32) -> bool) -> Option<(usize, usize, usize, usize)> {
+ let mut b: Option<(usize, usize, usize, usize)> = None;
+ for y in y0..y1.min(img.1) {
+ for x in x0..x1.min(img.0) {
+ if ink(img.2[y * img.0 + x]) {
+ b = Some(b.map_or((y, y, x, x), |(t, bo, l, r)| (t.min(y), bo.max(y), l.min(x), r.max(x))));
+ }
+ }
+ }
+ b
+}
+
+fn red(px: u32) -> u32 {
+ (px >> 16) & 0xff
+}
+
+struct Pill;
+
+impl Render for Pill {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ body().m_0().child(
+ div().style("display: flex; align-items: center; padding: 10px").child(
+ div().id("pill")
+ .style("font-size: 10px; padding: 1px 8px; border-radius: 8px; background: #000; color: #fff")
+ .child("HEH"),
+ ),
+ )
+ }
+}
+
+/// `.tag { font-size: 10px; padding: 1px 8px }`: the capitals sit where a
+/// browser puts them, centred in the pill (they used to ride ~1.4px high).
+#[test]
+fn text_is_centred_like_a_browser_line_box() {
+ scale_2();
+ Application::headless().run(|cx| {
+ let id = open(cx, 200.0, 60.0, Pill).id;
+ let img = cx.draw(id);
+ let s = img.0 as f32 / 200.0;
+ assert!((s - 2.0).abs() < 1e-3, "scale {s}");
+ let b = cx.element_bounds(id, "pill").unwrap();
+ // white glyphs on the black pill, inside the padding (off its round corners)
+ let area = (((b.origin.x + 8.0) * s) as usize, (b.origin.y * s) as usize,
+ ((b.origin.x + b.size.width - 8.0) * s) as usize, ((b.origin.y + b.size.height) * s) as usize);
+ let (top, bottom, _, _) = ink_box(&img, area, |p| red(p) > 128).expect("no text drawn");
+ // the browser: the content area centred in the 13px line box
+ let (y, lh, size) = (b.origin.y + 1.0, 13.0, 10.0);
+ let base = y + (lh - (ASCENT + DESCENT) * size) / 2.0 + ASCENT * size;
+ let want = (base - CAP * size / 2.0) * s;
+ let got = (top + bottom + 1) as f32 / 2.0;
+ assert!((got - want).abs() <= 1.0, "cap centre {got} device px, a browser's {want}");
+ // and so centred in the pill box itself
+ let mid = (b.origin.y + b.size.height / 2.0) * s;
+ assert!((got - mid).abs() <= 1.0, "cap centre {got}, pill centre {mid}");
+ });
+}
+
+struct Struck;
+
+impl Render for Struck {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ body().m_0().child(
+ div().style("display: flex; align-items: center; width: 400px; height: 32px; padding: 0 10px").child(
+ div().id("text").style("flex: 1; font-size: 13px; line-height: 17px; text-decoration: line-through; color: #000")
+ .child("Retopologize the robot arm"),
+ ),
+ )
+ }
+}
+
+/// `.item .text { flex: 1 }` struck through: the line ends with the text
+/// (it overshot ~9px when widths were measured at the logical size).
+#[test]
+fn line_through_ends_with_the_text() {
+ scale_2();
+ Application::headless().run(|cx| {
+ let id = open(cx, 440.0, 40.0, Struck).id;
+ let img = cx.draw(id);
+ let s = img.0 as f32 / 440.0;
+ let b = cx.element_bounds(id, "text").unwrap();
+ let (x0, x1) = ((b.origin.x * s) as usize, ((b.origin.x + b.size.width) * s) as usize);
+ let dark = |p: u32| red(p) < 96;
+ let (top, bottom, left, right) = ink_box(&img, (x0, 0, x1, img.1), dark).expect("no text drawn");
+ // the stroke: the rows dark furthest right of the text's own ink
+ let rows: Vec<usize> = (top..=bottom)
+ .filter(|&y| (left..=right).filter(|&x| dark(img.2[y * img.0 + x])).count() > (right - left) * 3 / 4)
+ .collect();
+ assert!(!rows.is_empty(), "no line-through");
+ // the glyphs' own right edge: rows off the stroke
+ let (glyph_right, _) = (top..=bottom).filter(|y| !rows.contains(y))
+ .filter_map(|y| (left..=right).rev().find(|&x| dark(img.2[y * img.0 + x])).map(|x| (x, y)))
+ .max().unwrap();
+ let over = (right as f32 - glyph_right as f32) / s;
+ assert!(over.abs() <= 1.0, "line-through ends {over} px past the last glyph");
+ // a browser strikes through the x-height, below the cap centre
+ let (y, lh, size) = (b.origin.y, 17.0, 13.0);
+ let base = y + (lh - (ASCENT + DESCENT) * size) / 2.0 + ASCENT * size;
+ let mid = (rows[0] + rows[rows.len() - 1] + 1) as f32 / 2.0 / s;
+ assert!(mid < base && mid > base - CAP * size / 2.0, "stroke at {mid}, baseline {base}");
+ });
+}
diff --git a/bindings/rust/blenderui/tests/theme.rs b/bindings/rust/blenderui/tests/theme.rs
new file mode 100644
index 0000000..e747b45
--- /dev/null
+++ b/bindings/rust/blenderui/tests/theme.rs
@@ -0,0 +1,65 @@
+//! Themes: Blender's Dark (default) and Light presets, for Blender widgets and
+//! the `styled` HTML sheet. One test (the theme is process-global).
+
+use blenderui::prelude::*;
+
+struct Page;
+
+impl Render for Page {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ body()
+ .m_0()
+ .child(div().id("themed").styled().h(px(40.0)).child(pre().id("pre").child("x")))
+ .child(div().id("plain").h(px(20.0)))
+ }
+}
+
+fn draw(cx: &mut App) -> (usize, usize, Vec<u32>) {
+ let opts = WindowOptions {
+ window_bounds: Some(WindowBounds::Windowed(Bounds {
+ origin: point(px(0.0), px(0.0)),
+ size: size(px(200.0), px(80.0)),
+ })),
+ ..Default::default()
+ };
+ let win = cx.open_window(opts, |_, cx| cx.new(|_| Page)).unwrap();
+ let img = cx.draw(win.id);
+ cx.close_window(win.id);
+ img
+}
+
+#[test]
+fn dark_and_light_themes() {
+ assert_eq!(blenderui::theme_name(), "dark");
+ assert_eq!(blenderui::theme_color("region_bg"), Some([48.0 / 255.0, 48.0 / 255.0, 48.0 / 255.0, 1.0]));
+ assert!(blenderui::theme_color("regular.inner").is_some());
+ assert!(blenderui::theme_color("no.such").is_none());
+ assert!(!blenderui::set_theme("solarized"));
+
+ // the light sheet substitutes every dark colour it lists
+ let light = blenderui::html::ua_styled_css("light");
+ assert!(light.contains("background-color: #b3b3b3; color: #1a1a1a;"));
+ assert!(!light.contains("#303030"));
+ assert_eq!(blenderui::html::ua_styled_css("dark"), blenderui::html::UA_STYLED_CSS);
+
+ let at = |img: &(usize, usize, Vec<u32>), x: f32, y: f32| {
+ let s = img.0 as f32 / 200.0;
+ img.2[(y * s) as usize * img.0 + (x * s) as usize]
+ };
+ Application::headless().run(|cx| {
+ let dark = draw(cx);
+ assert_eq!(at(&dark, 190.0, 38.0), 0x303030, "styled: Blender's dark background");
+ assert_eq!(at(&dark, 190.0, 70.0), 0xffffff, "plain HTML stays white");
+ });
+ Application::headless().theme("light").run(|cx| {
+ assert_eq!(blenderui::theme_name(), "light");
+ let light = draw(cx);
+ assert_eq!(at(&light, 190.0, 38.0), 0xb3b3b3, "styled: Blender_Light.xml's background");
+ assert_eq!(at(&light, 190.0, 70.0), 0xffffff, "plain HTML stays white");
+ });
+ assert!(blenderui::set_theme("dark"));
+ Application::headless().run(|cx| {
+ let again = draw(cx);
+ assert_eq!(at(&again, 190.0, 38.0), 0x303030);
+ });
+}
diff --git a/bindings/rust/scripts/vendor_c.py b/bindings/rust/scripts/vendor_c.py
index 4579f87..6351eae 100644
--- a/bindings/rust/scripts/vendor_c.py
+++ b/bindings/rust/scripts/vendor_c.py
@@ -1,32 +1,78 @@
-"""Copy the C sources blenderui-sys builds into the crate (`csrc/`), so the
-published crate is self-contained. Run before `cargo package` / `cargo publish`:
+"""Copy the C/C++/Objective-C sources blenderui-sys builds into the crate (`csrc/`),
+so the published crate is self-contained. Run before `cargo package` / `cargo publish`:
python bindings/rust/scripts/vendor_c.py
`csrc/` is git-ignored; inside the repo, build.rs uses the repo itself.
+
+What build.rs configures (BUI_BUILD_TESTS / EXAMPLES / PYTHON_BINDINGS / UI / QT_BACKEND
+off) needs: the top CMakeLists.txt (+ the version in bindings/python/bui/_version.py),
+core, types, gpu (with FreeType and the embedded Inter font), compat, kit (every window
+host: Win32, X11, Cocoa .m, null; Blender's C++ in kit/intern/blender, the theme presets,
+the file browser), api, ui/CMakeLists.txt (an interface target when BUI_BUILD_UI is off)
+and, for the `imgui` feature, bindings/imgui (Dear ImGui, its C API, the Blender widgets
+and tests/bui_png.h, which the C API includes). Test directories, generators and caches
+are left out. The script checks that every source the CMake files name is present.
"""
+import re
import shutil
+import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[3]
DEST = ROOT / "bindings" / "rust" / "blenderui-sys" / "csrc"
-# bindings/imgui: Dear ImGui on BUI + its C API (blenderui-sys's `imgui` feature)
-DIRS = ["core", "types", "gpu", "compat", "ui", "kit", "api", "bindings/imgui"]
-FILES = ["CMakeLists.txt", "LICENSE", "bindings/python/bui/_version.py"]
-SKIP = shutil.ignore_patterns("__pycache__", "*.pyc", "build*", "*.o", "*.obj")
+DIRS = ["core", "types", "gpu", "compat", "kit", "api", "bindings/imgui"]
+FILES = ["CMakeLists.txt", "LICENSE", "bindings/python/bui/_version.py", "ui/CMakeLists.txt"]
+# relative directories (from ROOT) never needed by the crate's CMake configuration
+SKIP_DIRS = {"core/tests", "gpu/tests", "bindings/imgui/gen"}
+SKIP_NAMES = shutil.ignore_patterns("__pycache__", "*.pyc", "*.py", "build*", "*.o", "*.obj")
+# header names in CMake files that are no paths: <bui_ftoption.h> includes, find_path
+NOT_FILES = {"bui_ftoption.h", "bui_ftmodule.h", "X11/Xlib.h"}
+
+
+def ignore(src: str, names: list[str]) -> set[str]:
+ rel = Path(src).resolve().relative_to(ROOT).as_posix()
+ skipped = set(SKIP_NAMES(src, names))
+ skipped |= {n for n in names if f"{rel}/{n}" in SKIP_DIRS}
+ return skipped
+
+
+def check_sources() -> list[str]:
+ """Every path a vendored CMakeLists.txt names (intern/x.c, ${FT}/src/..., ...) exists."""
+ missing = []
+ for cm in DEST.rglob("CMakeLists.txt"):
+ text = cm.read_text(encoding="utf-8", errors="replace")
+ text = re.sub(r"#[^\n]*", "", text)
+ ft = cm.parent / "extern" / "freetype"
+ imgui = cm.parent / "extern" / "imgui"
+ for tok in re.findall(r"[\w${}/.+-]+\.(?:c|cc|cpp|m|mm|h|hh)\b", text):
+ if "CMAKE_SOURCE_DIR" in tok or tok.startswith("tests/") and cm.parent == DEST:
+ continue # examples/ and tests/ of the top directory: only with tests/examples on
+ path = (tok.replace("${CMAKE_CURRENT_SOURCE_DIR}/", "")
+ .replace("${FT}", str(ft)).replace("${IMGUI_DIR}", str(imgui)))
+ if "$" in path or tok.startswith(("/FI", "-include")) or tok in NOT_FILES:
+ continue
+ p = Path(path) if Path(path).is_absolute() else cm.parent / path
+ # ui/: its sources only build with BUI_BUILD_UI (off for the crate)
+ if not p.exists() and cm.parent != DEST / "ui":
+ missing.append(str(p.relative_to(DEST)))
+ return missing
def main() -> None:
if DEST.exists():
shutil.rmtree(DEST)
for d in DIRS:
- shutil.copytree(ROOT / d, DEST / d, ignore=SKIP)
+ shutil.copytree(ROOT / d, DEST / d, ignore=ignore)
for f in FILES:
(DEST / f).parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(ROOT / f, DEST / f)
size = sum(p.stat().st_size for p in DEST.rglob("*") if p.is_file())
print(f"vendored {size / 1e6:.1f} MB of C sources into {DEST}")
+ missing = check_sources()
+ if missing:
+ sys.exit("missing from csrc/ (add them to vendor_c.py):\n " + "\n ".join(missing))
if __name__ == "__main__":
diff --git a/core/intern/expr_pylike_eval.cc b/core/intern/expr_pylike_eval.cc
index 6e480e6..35d01a2 100644
--- a/core/intern/expr_pylike_eval.cc
+++ b/core/intern/expr_pylike_eval.cc
@@ -580,7 +580,9 @@ static bool parse_add_func(ExprParseState *state,
feclearexcept(FE_ALL_EXCEPT);
if (std::holds_alternative<UnaryOpFunc>(funcptr)) {
- UnaryOpFunc func = std::get<UnaryOpFunc>(funcptr);
+ /* BUI: get_if, not std::get: libc++ gates std::get on variants (it can throw
+ * bad_variant_access) to macOS 10.14+, and Rust's x86_64 macOS default is 10.12 */
+ UnaryOpFunc func = *std::get_if<UnaryOpFunc>(&funcptr);
if (jmp_gap >= 1 && prev_ops[-1].opcode == OPCODE_CONST) {
/* volatile because some compilers overly aggressive optimize this call out.
@@ -596,7 +598,7 @@ static bool parse_add_func(ExprParseState *state,
parse_add_op(state, OPCODE_FUNC1, 0)->arg.func1 = func;
}
else if (std::holds_alternative<BinaryOpFunc>(funcptr)) {
- BinaryOpFunc func = std::get<BinaryOpFunc>(funcptr);
+ BinaryOpFunc func = *std::get_if<BinaryOpFunc>(&funcptr);
if (jmp_gap >= 2 && prev_ops[-2].opcode == OPCODE_CONST && prev_ops[-1].opcode == OPCODE_CONST)
{
@@ -615,7 +617,7 @@ static bool parse_add_func(ExprParseState *state,
parse_add_op(state, OPCODE_FUNC2, -1)->arg.func2 = func;
}
else if (std::holds_alternative<TernaryOpFunc>(funcptr)) {
- TernaryOpFunc func = std::get<TernaryOpFunc>(funcptr);
+ TernaryOpFunc func = *std::get_if<TernaryOpFunc>(&funcptr);
if (jmp_gap >= 3 && prev_ops[-3].opcode == OPCODE_CONST &&
prev_ops[-2].opcode == OPCODE_CONST && prev_ops[-1].opcode == OPCODE_CONST)
diff --git a/core/intern/guardedalloc.c b/core/intern/guardedalloc.c
index 0cc3fda..7dc2e2b 100644
--- a/core/intern/guardedalloc.c
+++ b/core/intern/guardedalloc.c
@@ -4,6 +4,8 @@
#include <string.h>
#ifdef __GLIBC__
# include <malloc.h> /* malloc_usable_size */
+#elif defined(__APPLE__)
+# include <malloc/malloc.h> /* malloc_size */
#endif
#include "BLI_compiler_attrs.h"
@@ -16,6 +18,10 @@ static size_t bui_malloc_usable_size(void *ptr)
return ptr ? _msize(ptr) : 0;
#elif defined(__GLIBC__)
return ptr ? malloc_usable_size(ptr) : 0;
+#elif defined(__APPLE__)
+ /* macOS: without it MEM_dupallocN returned NULL (BLI_duplicatelist) and
+ * MEM_recallocN left the new tail uninitialized */
+ return ptr ? malloc_size(ptr) : 0;
#else
(void)ptr;
return 0;
diff --git a/docs/c-api.md b/docs/c-api.md
index ab9b56d..1c93beb 100644
--- a/docs/c-api.md
+++ b/docs/c-api.md
@@ -53,7 +53,7 @@ int main(void)
host.emit = on_event; /* the window fills in the rest */
BK_context_set_host(ctx, &host);
- if (BK_window_supported()) { /* Windows, Linux: native window */
+ if (BK_window_supported()) { /* Win32, X11, Cocoa (experimental) */
BKWindow *win = BK_window_new(ctx, "BUI from C", 320, 120);
BK_window_show(win);
BK_window_run();
@@ -82,6 +82,7 @@ int main(void)
| **Events** | `emit(data, node, kind, ref, a, b)`. Kinds: `BK_EV_CHANGE`, `CLICK`, `CALL` (menu item or hotkey), `RENAME`, `ACTIVATE`, `TOGGLE`, `BROWSE`, `SUBMIT`. With the `"events"` property you also get raw `PRESS` / `RELEASE` / `DOUBLE` / `MOTION` / `ENTER` / `LEAVE` / `KEY` / `KEYRELEASE` / `WHEEL` / `CONFIGURE`, plus `VIEW` and `SCROLL` for scrolling. |
| **Windows** | `BK_window_new`, `show`, `close`, `set_title`, `set_size`, `wm(key, a, b)` (position, topmost, alpha, resizable, minsize, state ...), `timer`, `run`, `pump`, `quit` |
| **GPU rendering** | `BUI_gpu_set_default(1)` (all new windows), `BK_window_set_gpu(win, 1)` (one window), `BK_window_gpu(win)` (1 once frames draw on the GPU). `BUI_GPU=1/0` overrides. For your own rasters: `BUI_raster_gpu_attach(r, hwnd_or_NULL, wait)`, `BUI_raster_gpu_poll`, `BUI_raster_is_gpu`. |
+| **Theme** | `BK_set_theme("dark" / "light")` (Blender's Dark or Light preset; every context relayouts and redraws), `BK_theme_name()`, `BK_theme_color(key, rgba)` (`"region_bg"`, `"text"`, `"regular.inner"` ...). Without a call, `BUI_THEME=dark|light` picks the theme. `BK_set_scale` sets the UI scale. |
| **Text** | `BUI_text_measure`, `BUI_raster_text`, `BUI_text_add_font(family, flags, data, len)` (register a font; needed on wasm) |
| **Specialised** | Canvas display list (`BK_canvas_set_item`), text area (`BK_textarea_*`), trees (`BK_tree_item_*`), menus (`BK_open_menu`, `BK_open_pie`), color ramps and curves, `BK_undo` / `BK_redo` |
| **Custom nodes** | A `custom` node draws and handles input itself: `BK_custom_set(node, &cls, data)` with `event` (pointer with all three buttons and a grab, precise wheel via `BK_scroll`, keys and text while focused, key releases, focus), `frame` (called by `BK_render` when requested with `BK_custom_request_frame(node, ms)`: immediate-mode UIs build their frame there) and `draw` (raster + rect). `BK_custom_set_cursor`, `BK_node_context`. Dear ImGui runs on it: [../bindings/imgui](../bindings/imgui/README.md). |
@@ -96,9 +97,20 @@ tree gridview canvas textarea image ramp curve normal histogram custom`.
Read the header for the full list. It is the reference: every function
has a one-line comment.
-## Lower level: render sinks
+## Showing the kit in your own window
-The kit draws through `gpu/` into a `BuiRaster`. If you have your own
-renderer (OpenGL, Vulkan, a game engine, Qt's `QPainter`), you can receive
-BUI's primitives instead through a render sink. See
-[../INTEGRATION.md](../INTEGRATION.md).
+The kit always draws into a `BuiRaster`: the software raster, or Direct3D 11
+/ OpenGL instances when the window is on the GPU. To put kit widgets inside
+your own renderer or framework, render the context into a raster with
+`BK_render(ctx, raster, w, h, full)`, upload or blit its pixels (32-bit
+`0x00RRGGBB`, rows top-down), and feed input back with `BK_press`,
+`BK_motion`, `BK_key` and friends. `bui.qt.BuiCanvas` does exactly this
+inside a Qt widget.
+
+## A different layer: render sinks
+
+Render sinks (`api/bui_c_api.h`, `bui_set_render_sink`) are **not** how the
+kit draws. They receive the triangles, lines, points and text runs of the
+immediate-mode GPU seam (`gpu/intern/gpu_null.c`), which the Qt/QPainter
+backend, the SVG recorder and `buipy.demo_scene` use. Kit widgets never pass
+through a sink. See [../INTEGRATION.md](../INTEGRATION.md).
diff --git a/docs/components.md b/docs/components.md
index 236223a..3dcc4cd 100644
--- a/docs/components.md
+++ b/docs/components.md
@@ -98,12 +98,15 @@ Value components (`NumberField`, `NumberSlider`, `Checkbox`, `Toggle`,
| `Checkbox` | `Checkbox(label, value=False)` |
| `Toggle` | `Toggle(label, value=False, *, icon=None, icon_on=None, emboss=True)` |
| `Decorator` | `Decorator(label, value)`: the keyframe dot next to a property |
-| `Dropdown` | `Dropdown(label, items, value=None, *, icon_only=False)` |
-| `EnumRow` | `EnumRow(label, items, value=None, *, vertical=False, icon_only=False)` |
+| `Dropdown` | `Dropdown(label, items, value=None, *, icons=None, icon_only=False)` |
+| `EnumRow` | `EnumRow(label, items, value=None, *, icons=None, vertical=False, icon_only=False)` |
| `ColorSwatch` | `ColorSwatch(label, (r, g, b, a), *, picker="circle" or "square", alpha=True)` |
-Items can be strings or `(text, "ICON")` pairs. Icon names come from
-Blender (`buipy.kit_icon_names()` lists all 120).
+Items are strings. Give them icons with `icons=[...]`, one icon name per
+item (`""` for none), or a dict from item to icon name:
+`EnumRow("Mode", ["Object", "Edit"], icons=["OBJECT_DATAMODE", "EDITMODE_HLT"])`.
+`ListView` takes `icons=[...]` the same way. Icon names are Blender's: all 781
+of Blender's SVG icons (`buipy.kit_icon_names()` lists them).
## Buttons, labels, feedback
diff --git a/docs/getting-started.md b/docs/getting-started.md
index 2428d87..819aa0b 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -5,8 +5,9 @@
Requirements:
- CMake ≥ 3.20
-- A C11 / C++17 compiler: GCC (MinGW-w64 on Windows), Clang or MSVC
-- Python 3 with development headers, for the Python APIs (`buipy`)
+- A C11 / C++20 compiler: GCC (MinGW-w64 on Windows), Clang or MSVC
+- Python 3.11+ with development headers, for the Python APIs (`buipy`)
+- On Linux, the X11 headers (`libx11-dev` / `libX11-devel`) for native windows. No GL headers are needed.
```sh
cmake -S . -B build
@@ -27,11 +28,14 @@ cmake --build build
|---|---|---|
| `BUI_BUILD_PYTHON_BINDINGS` | `ON` | Build the `buipy` CPython extension. It is skipped with a message if the Python dev files are missing. |
| `BUI_BUILD_TESTS` | `ON` | C test executables and the ctest suites |
-| `BUI_BUILD_EXAMPLES` | `OFF` | C examples (`bui_svg_demo`) |
+| `BUI_BUILD_EXAMPLES` | `OFF` | C examples (`bui_kit_hello`, `bui_svg_demo`, the site screenshot programs) |
| `BUI_BUILD_UI` | `OFF` | Compile Blender's original `ui/` sources as well (not needed for the kit) |
| `BUI_BUILD_QT_BACKEND` | `OFF` | The C++ Qt/QPainter render-sink backend (needs Qt 5/6 Widgets) |
-| `BUI_WARNINGS_AS_ERRORS` | `OFF` | `-Werror` / `/WX` |
+| `BUI_BUILD_IMGUI` | `ON` when a C++ compiler is present | Dear ImGui on BUI (`bui::imgui`), its C API (`bui_cimgui`), demo and test |
+| `BUI_IMGUI_BLENDER_WIDGETS` | `OFF` | Dear ImGui's widgets become Blender's (an edited `imgui_widgets.cpp`) |
+| `BUI_WARNINGS_AS_ERRORS` | `OFF` | Only affects GCC and Clang today: when `OFF` the build adds `-Wno-error`; when `ON` it doesn't. It never adds `-Werror` or `/WX` by itself. |
| `BUI_SLUG` | `ON` | GPU text from glyph outlines (Slug) by default; `OFF` makes the glyph atlas the default (switchable at run time either way) |
+| `BUI_TEXT_FREETYPE` | `ON` | Rasterize glyphs with the vendored FreeType 2.13.3, the way Blender's BLF does (light hinting, gamma 1.43, Inter's optical size). `OFF` uses stb_truetype. Ignored when `BUI_TEXT_GDI` is on. |
| `BUI_TEXT_GDI` | `OFF` | Use Windows' GDI text engine and system fonts instead of the portable engine (embedded Inter, Slug on the GPU) |
## 2. Use it from Python
@@ -81,25 +85,27 @@ shared (`bui.host`).
| `BUIPY_BUILD_DIR` | Directory containing the built `buipy` extension |
| `BUI_HOST=tk` | Force the stdlib-Tk window host even where the native host exists |
| `BUI_UI_SCALE` | Fix the UI scale (for example `1.5`) instead of following the monitor's DPI |
-| `BUI_GPU=1` | Draw native windows on the GPU (Direct3D 11 on Windows, OpenGL 3.3 on Linux). `BUI_GPU=0` forces the software raster. Overrides `bui.set_gpu()` / `.gpu(true)` |
+| `BUI_GPU=1` | Draw native windows on the GPU (Direct3D 11 on Windows, OpenGL 3.3 on Linux). Overrides the app-wide defaults `bui.set_gpu()`, `Application::gpu()` and `BUI_gpu_set_default()`. `BUI_GPU=0` turns those defaults off, but a window that asks for the GPU itself (`Tk(gpu=True)`, `WindowOptions { gpu: Some(true) }`, `BK_window_set_gpu`) still gets it. |
| `BUI_GPU_DEBUG=1` | Print why the GPU renderer could not start |
| `BUI_FONT`, `BUI_FONT_DIR` | A font file to replace the embedded Inter UI font, and an extra font folder |
| `BUI_SLUG` | `0` draws GPU text from a per-glyph bitmap atlas instead of glyph outlines (Slug); `1` forces Slug. Overrides `bui.set_slug()` / `.slug()` / `BUI_gpu_set_slug()` |
-| `BUI_PROFILE=1` | Print per-phase frame times (raster and present) |
-| `BUI_FILEDIALOG=native` | File dialogs (`tkinter.filedialog`, `QFileDialog`) use the operating system's dialogs instead of Blender's File Browser |
+| `BUI_PROFILE` | Print frame times every 60 frames (per phase in Rust and JavaScript; raster and present in the Windows host). **Any** value turns it on, even `0`. |
+| `BUI_THEME` | `dark` (default) or `light`: Blender's Dark or Light theme preset, when the app doesn't call `bui.set_theme()` / `blenderui::set_theme()` / `BK_set_theme()` |
+| `BUI_FILEDIALOG=native` (or `system`, `tk`) | File dialogs (`tkinter.filedialog`, `QFileDialog`) use the operating system's dialogs instead of Blender's File Browser |
| `BUI_BOOKMARKS` | The file browser's bookmarks file (default `$XDG_CONFIG_HOME/bui/bookmarks.txt`, or `%APPDATA%\bui\bookmarks.txt` on Windows) |
## Window hosts
`bui.host.Window` puts a kit context in a top-level window.
-- **Native (Windows and Linux).** A window written in C: Win32 on Windows,
+- **Native (Windows and Linux).** A window written in C: BUI's own Win32 host on Windows,
X11 on Linux (Wayland sessions run it through XWayland). Input goes
straight into the kit, and frames are presented by blitting only the
changed tiles. It follows the display's DPI (per-monitor on Windows,
`Xft.dpi` on X11) and paces animations to the display's refresh rate.
-- **Native (macOS).** A Cocoa window (a port of Blender's GHOST code; new,
- not yet tested on a Mac) with Retina scaling. It needs the main thread.
+- **Native (macOS, experimental).** A Cocoa window (a port of Blender's GHOST
+ code; new, checked by CI but not yet tried by hand on a Mac) with Retina scaling. It needs the main
+ thread. See [macos-testing.md](macos-testing.md).
- **Tk (with `BUI_HOST=tk`, or where no native host works).** A stdlib `tkinter` window that
shows the kit's frame buffer and forwards input to it. The UI and the API
are identical, but presenting is a little slower.
@@ -148,4 +154,4 @@ pending events once, and `bui.host.quit()` stops the loop.
| Blurry or tiny UI | Set `BUI_UI_SCALE`. On Windows the native host is DPI-aware by default. |
| `gpu=True` has no effect | Run with `BUI_GPU_DEBUG=1` to see why the device failed. Machines without Direct3D 11 (Windows) or OpenGL 3.3 (Linux) stay on the software raster. |
| Monospace/serif text uses the UI font | Install a TrueType font family (DejaVu, Liberation or Noto). The UI font itself (Inter) is embedded. |
-| A tkinter feature behaves differently | See the behaviour notes in [tkinter.md](tkinter.md#behaviour). If stdlib tkinter does something else, that is a bug; `tests/test_tk_compat.py` shows how to write a side-by-side check. |
+| A tkinter feature behaves differently | See the behaviour notes in [tkinter.md](tkinter.md#behaviour). If stdlib tkinter does something else, that is a bug; `bindings/python/tests/test_tk_compat.py` shows how to write a side-by-side check. |
diff --git a/docs/imgui.md b/docs/imgui.md
index c633d68..5928580 100644
--- a/docs/imgui.md
+++ b/docs/imgui.md
@@ -151,9 +151,13 @@ _buiimgui`) and installed with the wheel.
## Rust
+`blenderui-imgui` isn't on crates.io yet (only `blenderui` is), so take it from git, or
+by path from a clone. Add `features = ["blender-widgets"]` for Blender's widgets.
+
```toml
[dependencies]
-blenderui-imgui = { path = "bindings/rust/blenderui-imgui" }
+blenderui-imgui = { git = "https://github.com/ppmpreetham/BUI" }
+# or, from a clone: blenderui-imgui = { path = "bindings/rust/blenderui-imgui" }
```
```rust
diff --git a/docs/macos-testing.md b/docs/macos-testing.md
new file mode 100644
index 0000000..7aa8156
--- /dev/null
+++ b/docs/macos-testing.md
@@ -0,0 +1,235 @@
+# Testing BUI on macOS
+
+Thanks for testing BUI on a Mac. The macOS window host is new and has only
+been checked by CI so far, so a person clicking around finds what CI can't.
+This guide takes about 30–60 minutes: build from source, run the tests, try a
+few apps, and report back.
+
+What runs on macOS:
+
+- **Native windows** through AppKit (`kit/intern/kit_window_cocoa.m`, ported
+ from Blender's GHOST Cocoa backend): Retina scaling, trackpad scrolling,
+ cursor warping for drag-to-scrub, the clipboard, cursors, full screen.
+- **Drawing on the CPU.** The GPU renderer is Direct3D 11 on Windows and
+ OpenGL on Linux. There is no Metal renderer yet, so `BUI_GPU=1` is ignored
+ and frames are drawn by the software rasterizer and shown with
+ CoreGraphics.
+- The C kit, Python (`blenderui` / `bui`, the tkinter layer, Dear ImGui), Rust
+ (`blenderui`, `blenderui-imgui`) and C/C++ (Dear ImGui on BUI).
+
+## 1. Prerequisites
+
+You need macOS 11 (Big Sur) or newer, on Apple Silicon or Intel.
+
+| Tool | How to get it | Check |
+| --- | --- | --- |
+| Xcode Command Line Tools (clang, git) | `xcode-select --install` | `clang --version` |
+| CMake 3.20+ | `brew install cmake` (or cmake.org) | `cmake --version` |
+| Python 3.11+ **with tkinter** | python.org installer, or `brew install [email protected] [email protected]` | `python3.12 -c "import tkinter; print(tkinter.TkVersion)"` |
+| Rust (stable) | `curl https://sh.rustup.rs -sSf \| sh` | `cargo --version` |
+
+The `python3` that comes with the Command Line Tools is 3.9, which is too old.
+Use the full name of a newer one (`python3.12` below) everywhere.
+
+## 2. Get the code
+
+```sh
+git clone https://github.com/ppmpreetham/BUI.git
+cd BUI
+git rev-parse --short HEAD # note this for your report
+```
+
+## 3. Build the C/C++ project and run the tests
+
+```sh
+cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUI_BUILD_EXAMPLES=ON \
+ -DPython3_EXECUTABLE="$(which python3.12)"
+cmake --build build --parallel
+ctest --test-dir build --output-on-failure
+```
+
+Configuring should print `BUI: building buipy Python bindings for Python 3.12…`.
+If it says the Python development files were not found, the
+`-DPython3_EXECUTABLE` path is wrong.
+
+All tests should pass. What they cover:
+
+| Test | What it checks |
+| --- | --- |
+| `bui_window_smoke` | Opens a real Cocoa window with a node editor, renders, runs timers, sends input and quits on its own. A window appears for about a second. Exit 77 (shown as skipped) means no GUI session, for example over plain `ssh`. |
+| `bui_theme_test` | Blender's Dark and Light themes |
+| `core`, `gpu_parity` | the C core, and the rasterizer (the GPU half is skipped on macOS) |
+| `imgui_backend`, `imgui_c_api` | Dear ImGui on BUI, headless, from C++ and C |
+| `buipy*` | the Python bindings: kit, Qt and tkinter syntax, components, nodes, themes, the file browser, ImGui |
+
+Run the window smoke test on its own to see what it printed:
+
+```sh
+./build/bui_window_smoke
+# frames 7 ticks 5 size 960x640 gpu 0 (size is in pixels: twice the points on Retina)
+```
+
+## 4. Try the apps
+
+Run these from the repository root, in Terminal, one at a time. Close each
+window with its close button or Cmd+W. Cmd+Q asks every window to close.
+
+**C: a slider and a button**
+
+```sh
+./build/examples/bui_kit_hello
+```
+
+Drag the slider and click the button: the terminal prints the values.
+
+**Python: every Blender component**
+
+```sh
+python3.12 examples/components_demo.py
+```
+
+This is the main test app. It finds the Python extension in `build/` by itself.
+
+**Python: an unchanged tkinter app**
+
+```sh
+PYTHONPATH=bindings/python python3.12 -m bui.tksyntax examples/tk_unchanged_app.py
+```
+
+Compare with the real Tk: `python3.12 examples/tk_unchanged_app.py`. Also open
+the app's file dialog: it is Blender's File Browser in a BUI window. Check that
+the Volumes list on the left shows your disks (from `/Volumes`) and that the
+Home, Desktop, Documents, Downloads, Movies, Pictures and Music folders are listed.
+
+**Rust**
+
+```sh
+cd bindings/rust
+cargo test -p blenderui
+cargo run --release -p blenderui --example hello
+cargo run --release -p blenderui --example showcase
+cargo run --release -p blenderui-imgui --example demo
+cd ../..
+```
+
+The first build compiles the C kit through CMake, so it takes a few minutes.
+
+**Dear ImGui (C++)**
+
+```sh
+./build/bindings/imgui/bui_imgui_demo
+```
+
+**Light theme.** Run any of the above with `BUI_THEME=light`:
+
+```sh
+BUI_THEME=light python3.12 examples/components_demo.py
+```
+
+## 5. What to check
+
+Use `components_demo.py` for most of these. On macOS, **Command works as
+Blender's Ctrl** (Cmd+C, Cmd+V, Cmd+Z, Cmd+wheel) and **Option is Alt**.
+
+- [ ] **Window opens** in front, with a Dock icon and a menu bar (the app menu
+ and a Window menu). Text and icons are sharp, not blurry.
+- [ ] **Retina:** widgets are the same size in points as on a 1x screen, with
+ crisp edges. `BUI_UI_SCALE=1.5 python3.12 examples/components_demo.py`
+ should make the whole UI 1.5 times larger in pixels.
+- [ ] **Resize:** drag a window edge. The contents redraw *while* you drag, with
+ no stretched or black frames. Try the green button (full screen), then
+ leave full screen. Try Window > Zoom and Cmd+M (minimize), then restore it.
+- [ ] **Multiple monitors:** drag the window between a Retina and a non-Retina
+ display. The UI should re-render sharp at the new scale when it lands.
+- [ ] **Trackpad scrolling:** two-finger scroll in lists and scroll views. It
+ should feel smooth and not too fast. Horizontal swipes scroll horizontally
+ (BUI treats them as Shift+wheel). After a flick, press a key: the leftover
+ momentum must not keep scrolling or turn into Cmd+scroll.
+- [ ] **Mouse wheel** (if you have a mouse): one step per notch.
+- [ ] **Drag to scrub:** press and drag a number field or slider sideways. The
+ pointer hides and the value changes smoothly. Keep dragging far past the
+ edge of the window: BUI moves the hidden pointer back inside (a warp), so
+ the value keeps changing and never gets stuck. Release: the pointer
+ reappears where the drag started (on a slider, at the new value). Watch
+ for jumps in the value right after each warp.
+- [ ] **Typing:** click a number field and type `2*pi`, Return. Type in text
+ fields, including Shift, Option characters (Option+e then e should give
+ `é` if the layout allows it; report what happens) and emoji from the
+ Character Viewer (Ctrl+Cmd+Space). Arrow keys, Home/End (Fn+arrows),
+ Backspace and Forward Delete (Fn+Backspace).
+- [ ] **Clipboard:** Cmd+C on a value, Cmd+V into another; copy text from BUI
+ and paste it into TextEdit, and the other way round.
+- [ ] **Tooltips:** hover a button for about half a second; the tooltip appears
+ and goes away when the pointer moves.
+- [ ] **Menus:** the File and Edit menus in the demo: hover to switch, type to
+ search, submenus. Right-click (two-finger click on a trackpad) a value for
+ its context menu. Press **Q** for the pie menu.
+- [ ] **Cursors:** the pointer turns into an I-beam over text fields and into
+ resize arrows over splitters and panel edges.
+- [ ] **Color picker:** click a color swatch; drag in the wheel; try the eyedropper.
+- [ ] **Focus:** click another app and back; keys go to the BUI window again.
+ If an app has two windows (the tkinter app's dialogs), closing one makes
+ the other one take the keyboard.
+- [ ] **Quit:** Cmd+Q closes the app cleanly (no crash report).
+
+## 6. Collect logs and screenshots
+
+- **Terminal output:** run the app with its output saved:
+ `python3.12 examples/components_demo.py 2>&1 | tee bui-log.txt`.
+- **Screenshots:** Cmd+Shift+4, then Space, then click the window. For a
+ problem with motion (scrolling, scrubbing, resizing), a screen recording
+ helps the most: Cmd+Shift+5.
+- **Off-screen renders** to compare with Windows and Linux pixel for pixel:
+ `./build/bindings/imgui/bui_imgui_demo --screenshot demo.png` (also with
+ `BUI_THEME=light` or `BUI_UI_SCALE=2` in front).
+- **Frame timings (Rust apps):** `BUI_PROFILE=1 cargo run --release -p blenderui --example showcase`
+ prints averaged per-phase frame times to the terminal. (In the C window host
+ `BUI_PROFILE` is only implemented on Windows; `BUI_GPU_DEBUG` reports on the GPU
+ renderers of Windows and Linux and prints nothing on macOS, which has none.)
+- **Crashes:** macOS writes a report to `~/Library/Logs/DiagnosticReports/`
+ (a `.ips` file named after the program, for example `python3.12-…ips` or
+ `bui_kit_hello-…ips`). Attach it.
+- **Failing tests:** attach the whole output of
+ `ctest --test-dir build --output-on-failure`.
+
+## 7. Known limitations
+
+- **No GPU renderer on macOS** (no Metal backend). `BUI_GPU=1`,
+ `BK_window_set_gpu` and `buipy.set_gpu` are ignored; everything draws on the CPU.
+ Big windows on 5K displays may feel slower than on Windows.
+- **Node.js and React** (`@blender-ui/native`, `@blender-ui/react`) run headless on
+ macOS: BUI runs on its own thread under Node, and AppKit only allows windows on
+ the main thread. The QuickJS runtime (`bui-runtime`, apps made with `bui build`)
+ has the same limitation.
+- **Windows only from the main thread**, and only in a GUI session: over `ssh`,
+ BUI runs headless (`bui_window_smoke` is skipped).
+- **No input method (IME) support yet:** composed input such as Japanese or
+ Chinese, and possibly dead-key accents, is not expected to work.
+- Fonts are Blender's (Inter, drawn with FreeType like Blender), not the system font.
+- Python: when tkinter is importable, BUI starts a hidden Tk first (Tk insists on
+ creating the application object). `BUI_MAC_TK=0` skips that; `BUI_HOST=tk`
+ draws BUI inside a Tk window instead of a native one, for comparison.
+
+## 8. Report your results
+
+Open an issue at <https://github.com/ppmpreetham/BUI/issues> titled
+**"macOS test report: <your Mac>"** (or one issue per bug) with:
+
+```text
+Commit: (git rev-parse --short HEAD)
+macOS version: (Apple menu > About This Mac, e.g. 15.1)
+Mac: (e.g. MacBook Air M2 / iMac 2019 Intel)
+Displays: (built-in Retina; external monitors and their scaling)
+Input: (trackpad / Magic Mouse / wheel mouse)
+Keyboard layout: (e.g. U.S., German)
+Tools: clang --version | cmake --version | python3.12 --version | cargo --version
+
+Build: OK / failed (attach the error)
+ctest: N/N passed (attach the output if not all passed)
+
+Checklist (section 5): what worked, what didn't
+For each problem: what you did, what you expected, what happened,
+ screenshot or recording, terminal log, crash report
+```
+
+Even "everything worked" is a useful report. Thank you!
diff --git a/docs/publishing.md b/docs/publishing.md
index 5646292..52baef6 100644
--- a/docs/publishing.md
+++ b/docs/publishing.md
@@ -70,8 +70,9 @@ Remove the source tree from `sys.path` and keep `examples/` on it for
2. Do the same on TestPyPI with environment `testpypi`.
3. In the GitHub repository settings, create the environments `pypi` and
`testpypi` (optionally with required reviewers).
-4. Replace `OWNER` in `pyproject.toml` `[project.urls]` with the GitHub
- owner.
+
+`pyproject.toml` `[project.urls]` already points at
+`github.com/ppmpreetham/BUI`.
No API tokens are stored anywhere.
@@ -85,32 +86,36 @@ No API tokens are stored anywhere.
## Known gaps before 1.0
-- Linux wheels: the native X11 window host is compiled only when CMake finds
- the X11 headers, and the cibuildwheel build doesn't install them, so wheels
- from PyPI use the stdlib Tk window on Linux (built from source with
- `libx11-dev` / `libX11-devel`, BUI uses its native X11 window). Installing
- `libX11-devel` in `[tool.cibuildwheel.linux] before-all` would give the
- wheels the native host.
+- Linux wheels get the native X11 window host: `[tool.cibuildwheel.linux]
+ before-all` installs the X11 headers (`libX11-devel` / `libx11-dev`), and
+ libX11 itself is loaded at run time, so the wheels still import on servers
+ without it. (This used to be a gap; it's fixed.)
- macOS: the native Cocoa window host is new and hasn't been run on a Mac
yet. With `BUI_HOST=tk` the wheels use the stdlib Tk window instead, which
needs `tkinter` (for example from python.org or `brew install python-tk`).
- MSVC builds work (the Rust crate and the CMake build use Visual Studio's
toolchain), but the published Windows wheels are built with MinGW.
- No `musllinux` or 32-bit wheels yet (skipped in `[tool.cibuildwheel]`).
-- The README's images use relative paths. PyPI shows them once
- `[project.urls]` points to the public repository and the paths are made
- absolute (or the images are hosted).
+- The README's images use absolute `raw.githubusercontent.com` URLs, so
+ PyPI shows them.
# Publishing the Rust crates (crates.io)
-The four crates are published in dependency order:
-
-| Crate | What it is | Depends on |
-|---|---|---|
-| `blenderui-tailwind` | Tailwind v4 class compiler (std only) | none |
-| `blenderui-macros` | `rsx!` / `view!`, `#[component]`, `css!`, `tw!` | `blenderui-tailwind` |
-| `blenderui-sys` | FFI over the C kit; builds it with CMake | none (`cmake` at build time) |
-| `blenderui` | the framework | all three |
+`blenderui` is on [crates.io](https://crates.io/crates/blenderui)
+(`cargo add blenderui`). The workspace in `bindings/rust/` has eight crates;
+four are published to crates.io, in dependency order, and the rest stay in
+the repository:
+
+| Crate | What it is | Depends on | crates.io |
+|---|---|---|---|
+| `blenderui-tailwind` | Tailwind v4 class compiler (std only) | none | Published |
+| `blenderui-macros` | `rsx!` / `view!`, `#[component]`, `css!`, `tw!` | `blenderui-tailwind` | Published |
+| `blenderui-sys` | FFI over the C kit; builds it with CMake | none (`cmake` at build time) | Published |
+| `blenderui` | the framework | all three | Published |
+| `blenderui-imgui` | Dear ImGui on BUI (`blender-widgets` feature for Blender's widgets) | `blenderui-sys` (`imgui` feature) | Not yet: use it as a git dependency |
+| `blenderui-jsview` | The JavaScript view of a window, shared by the Node.js addon and the QuickJS runtime | `blenderui` | `publish = false` |
+| `blenderui-node` | The napi-rs addon behind `@blender-ui/native` | `blenderui`, `blenderui-jsview` | `publish = false` (ships on npm) |
+| `blenderui-qjs` | `bui-runtime`: BUI with embedded QuickJS, for `bui build` | `blenderui`, `blenderui-jsview` | `publish = false` (ships on npm) |
`blenderui-sys` must carry the C sources, because a published crate can't
reach `../../..`. Vendor them first. They're git-ignored and listed in the
@@ -131,7 +136,8 @@ cargo package --workspace --allow-dirty # builds each packaged crate i
1. Bump `version` in `bindings/rust/Cargo.toml` (`[workspace.package]`). The
crates share one version. Then update the `version = "..."` of the path
- dependencies in `blenderui/Cargo.toml` and `blenderui-macros/Cargo.toml`.
+ dependencies in `blenderui/Cargo.toml`, `blenderui-macros/Cargo.toml` and
+ `blenderui-imgui/Cargo.toml`.
2. `cargo login` once with a crates.io API token.
3. Vendor, then publish in order. `cargo publish --workspace` does the
ordering itself on Cargo 1.90+:
@@ -146,6 +152,10 @@ cargo publish --workspace --allow-dirty # or, one by one:
# cargo publish -p blenderui
```
+`cargo publish --workspace` skips the `publish = false` crates. To publish
+`blenderui-imgui` too (once it's ready), run `cargo publish -p blenderui-imgui`
+after `blenderui-sys`.
+
`--allow-dirty` is needed because `csrc/` is untracked. Users need CMake and
a C compiler (MSVC, MinGW, gcc or clang) to build `blenderui-sys`.
`bench/` is excluded from the workspace and is never published.
diff --git a/docs/qt.md b/docs/qt.md
index 3f4c820..47e4cf4 100644
--- a/docs/qt.md
+++ b/docs/qt.md
@@ -5,8 +5,8 @@ layouts, `clicked.connect(...)`) that runs on BUI's C kit, with Blender's
look. Neither Qt nor PySide is needed.
> **Status: partial.** The everyday subset below works and is tested.
-> Measured against Qt's widget headers, about a quarter of the method names
-> on the main widget classes exist. See [Coverage](#coverage) for what's
+> Measured against Qt's widget headers, about 24% of the method names
+> on the main widget classes exist (about 220 of 920). See [Coverage](#coverage) for what's
> missing and the plan.
![Qt syntax on BUI](images/qt.png)
@@ -144,7 +144,8 @@ public method names** across 25 core widget classes (~24%).
**Plan.** Reach parity with the tkinter layer:
1. Measure against PySide6 itself, and run the same programs on real Qt
- and on BUI to compare, as `test_tk_compat.py` does for tkinter.
+ and on BUI to compare, as `bindings/python/tests/test_tk_compat.py` does
+ for tkinter.
2. Make widgets wrap kit nodes instead of being them (as `bui.tksyntax`
does), which removes name clashes like `rect()` and `children()`.
3. Fill in the classes above, then add `install()` so `import PySide6`
diff --git a/docs/rust.md b/docs/rust.md
index 5768750..289d93a 100644
--- a/docs/rust.md
+++ b/docs/rust.md
@@ -27,11 +27,16 @@ capitalized Blender components.
## Install
-```toml
-[dependencies]
-blenderui = { git = "https://github.com/ppmpreetham/BUI" }
+`blenderui` is on [crates.io](https://crates.io/crates/blenderui):
+
+```sh
+cargo add blenderui
```
+or, by hand, `blenderui = "0.1"` under `[dependencies]`. (The Dear ImGui crate,
+`blenderui-imgui`, isn't on crates.io yet: use
+`blenderui-imgui = { 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
@@ -47,7 +52,9 @@ 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 workspace uses edition 2024 (Rust 1.88 or newer, the `rust-version` in
+`bindings/rust/Cargo.toml`). On Linux, building also needs the X11 headers
+(`libx11-dev` / `libX11-devel`).
## The app model
@@ -171,7 +178,7 @@ fn profile(username: &str) {
let (likes, set_likes) = use_state(0); // `likes()`, `set_likes(..)`: no cx
use_effect!(move || println!("{} likes", likes()), [likes()]);
let theme: Theme = use_context();
- rsx! { <div class="p-2" onClick={move || set_likes(likes() + 1)}>{username} {likes()}</div> }
+ rsx! { <div class="p-2" onClick={move || set_likes(likes() + 1)}>{username.to_string()} " " {likes().to_string()}</div> }
}
#[component] // Leptos style
@@ -179,7 +186,7 @@ fn Counter(start: i32) {
let (count, set_count) = signal(start);
let doubled = Memo::new(move || count.get() * 2); // recomputed when `count` changes
Effect::new(move || println!("count is {}", count.get())); // re-runs when `count` changes
- rsx! { <button onClick={move || set_count.update(|c| *c += 1)}>{doubled.get()}</button> }
+ rsx! { <button onClick={move || set_count.update(|c| *c += 1)}>{doubled.get().to_string()}</button> }
}
// in a view: provide_context(Theme(..)); rsx! { <profile username="Ada" /> <Counter start={1} /> }
@@ -200,7 +207,8 @@ These are the hooks and their counterparts in other frameworks:
How it behaves:
- **Signals:** signals are `Copy` handles. They don't need `cx`, and writing one re-renders its window.
- **Hook identity:** like React, a hook's state is tied to its call site and to the order in which components render. In lists, give components a `key` (`<Row key={item.id} ../>`) so their state follows the item: without keys, removing an item from the middle shifts the state of the ones after it.
-- **Components:** `#[component]` turns `fn name(props)` into a props struct with that name. Uppercase and lowercase names both work in `rsx!`, as does a body that ends in markup.
+- **Components:** `#[component]` turns `fn name(props)` into a props struct with that name. Uppercase and lowercase names both work in `rsx!`. The body is a normal block that ends in markup, usually an `rsx!`.
+- **Text children:** `{expr}` in markup takes anything that turns into an element: text (`&'static str`, `String`, `SharedString`), an element or a component. Numbers and borrowed `&str` props aren't text on their own, so write `{count().to_string()}` and `{label.to_string()}`.
- **Optional props:** `Option<T>` props (and `children`) may be left out in `rsx!`; they are `None`. Leaving out any other prop is a compile error naming it (`a required prop is missing: ... Row_missing_name`). Struct components get the same with `#[derive(Props)]`.
- **Lifetime:** a component's state is freed when it stops rendering.
- **Implementation:** there is no `Rc` or `RefCell` anywhere in it.
@@ -256,6 +264,14 @@ div().styled().child(div().attr("styled", "false")) // opt a subtree back out
Your own CSS still wins over either set of defaults. From JavaScript use
`el.setAttribute('styled', '')`, or `<div styled>` in JSX.
+**Dark or light.** `styled` follows Blender's theme, which is Dark by default.
+Switch every window to Blender's Light preset with
+`Application::new().theme("light")`, `blenderui::set_theme("light")` at run
+time (open windows redraw), or `BUI_THEME=light` without code changes. The
+widgets, panels and the `styled` sheet all follow; plain HTML keeps the
+browser's look in both. `blenderui::theme_name()` and
+`blenderui::theme_color("region_bg")` read the active theme.
+
### Blender components
The capitalized components are Blender's widgets, always, inside `styled` or
@@ -331,8 +347,9 @@ window.
(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`,
+color, size and display properties). Custom properties (`--name`) inherit,
+and `var()` (with fallbacks, `var(--missing, 20px)`) and `env()` are
+substituted, also inside other functions (`calc(var(--gap) * 2)`). Units: `px`, `em`, `rem`, `%`, `vw`,
`vh`, `vmin`, `vmax`, `ch`, `ex`, `pt`, `pc`, `in`, `cm`, `mm`, `Q`, and
`calc()`, `min()`, `max()`, `clamp()`.
@@ -348,15 +365,16 @@ Layout is computed with [taffy](https://github.com/DioxusLabs/taffy):
`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`,
+- **Flexbox** and **grid**: every property of both modules, including
+ `grid-template-areas`, named lines, `repeat()`, `minmax()`, `fr`,
`auto-fill` / `auto-fit`, spans and line placement.
- **Tables**: columns are as wide as their widest content and line up across
rows; a table with an auto width shrinks to its columns (up to its
container), like a browser's auto layout. `table-layout: fixed` takes the
first row's widths. `colspan`, `border-spacing`, `border-collapse`,
`caption-side` and `empty-cells` apply.
-- **Positioning**: `relative`, `absolute` (and `fixed` as absolute), `inset`
+- **Positioning**: `relative`, `absolute`, `fixed` (laid out like `absolute`,
+ placed against the window), `inset`
properties, `z-index` for painting and hit testing, and every 2D transform
(`translate`, `scale`, `rotate`, `skew`, `matrix`, `transform-origin`, the
individual `rotate` / `scale` / `translate` properties).
@@ -498,7 +516,7 @@ the result is cached, so a page that doesn't change costs nothing.
Also rendered: every `border-style` and `outline-style` (`dashed`, `dotted`, `double`, `groove`, `ridge`, `inset`, `outset`, following rounded corners with Blender's corner tessellation), `text-decoration-style` (including `wavy`), `-thickness` and `text-underline-offset`, `background-clip` / `background-origin` (`border-box`, `padding-box`, `content-box`), `background-attachment: fixed`, `clip: rect()` on absolutely positioned boxes, counters (`counter-reset` / `-increment` / `-set` with `counter()` and `counters()` in `content`), `empty-cells`, `list-style-image`, `word-break: break-all`, `overflow-wrap: anywhere | break-word` and `tab-size`.
-Also supported: `background-image: url()` (PNG) with `background-size` / `-position` (`-x` / `-y`) / `-repeat`, `object-fit` / `object-position`, logical border longhands (`border-inline-width` ...), `text-wrap-mode`, `white-space-collapse`, `scale`, `all`, `@container` size queries (`container-type`, `container-name`), `@font-face` (local font files) and `@property` initial values.
+Also supported: `background-image: url()` (PNG) with `background-size` / `-position` (`-x` / `-y`) / `-repeat`, `object-fit` / `object-position`, logical border longhands (`border-inline-width` ...), `text-wrap-mode`, `white-space-collapse`, `scale`, `@container` size queries (`container-type`, `container-name`), `@font-face` (local font files) and `@property` initial values.
How much is left, against all 745 properties in the
[W3C index](https://www.w3.org/Style/CSS/all-properties.en.html):
@@ -547,7 +565,8 @@ Not done yet:
- **Animations:** no `animationend` / `transitionend` events, no animations on `::before` / `::after`, and an element starts transitions only when it already had a `transition` in the previous frame (e.g. not when `transition` appears only under `:hover` on the first hover). Lengths mixing units that resolve differently (`50%` to `100px`, `auto`) flip at 50% instead of going through `calc()`.
- **`@container` timing:** queries use the container's size from the previous layout; when it changes, the window renders once more.
- **Effects:** `filter: url(#svg)`, `clip-path: path()`, and `mix-blend-mode` across stacking contexts (it blends with what was painted before it).
-- **The rest of the W3C property index:** about 360 entries this engine doesn't know, mostly drafts, speech, paged media and SVG.
+- **The rest of the W3C property index:** 355 entries this engine doesn't know, mostly drafts, speech, paged media and SVG.
+- **`all`:** counted as parsed-only. Its CSS-wide keywords (`all: initial`, `inherit`, `unset`, `revert`) reset an element's computed style; there's nothing else it can take.
- **Box sizing:** the default is `border-box` (like Tailwind's preflight), not CSS's `content-box`.
## Performance vs gpui
@@ -630,7 +649,7 @@ The `gdi-text` feature uses Windows' GDI engine and system fonts.
- **Images**: PNG only, nearest-neighbour scaling. `video`, `audio`,
`iframe` show a placeholder.
- **Windows** are native on Windows (Win32), Linux (X11) and macOS (Cocoa,
- new and not yet tested on a Mac; it needs the main thread). The GPU
+ new and not yet tried by hand on a Mac; it needs the main thread). The GPU
renderer runs on Windows and Linux.
- `text-align: justify` aligns left. Table columns are sized from their
widest single-line content, a simpler version of browsers' auto layout.
diff --git a/docs/tkinter.md b/docs/tkinter.md
index 3f181fd..9787548 100644
--- a/docs/tkinter.md
+++ b/docs/tkinter.md
@@ -112,7 +112,7 @@ the software raster.
| `tkinter.ttk` | `bui.tksyntax.ttk` | Themed widgets including `Treeview`, `Notebook`, `Progressbar`, `Combobox`, `Separator`, `Sizegrip`, `LabeledScale`, `Panedwindow`, `Style`. `state()` / `instate()` work. |
| `tkinter.messagebox` | `.messagebox` | Blender-styled modal dialogs with the same return values (`"ok"`, `True`, `None` ...) |
| `tkinter.simpledialog` | `.simpledialog` | `Dialog` (override `body` / `validate` / `apply`), `SimpleDialog`, `askstring`, `askinteger`, `askfloat` |
-| `tkinter.filedialog` | `.filedialog` | The operating system's file dialogs, as with Tk on Windows and macOS |
+| `tkinter.filedialog` | `.filedialog` | Blender's File Browser in its own window, with the same functions and return values; `BUI_FILEDIALOG=native` uses the operating system's dialogs instead |
| `tkinter.colorchooser` | `.colorchooser` | `askcolor` with Blender's color picker; returns `((r, g, b), "#rrggbb")` |
| `tkinter.font` | `.font` | `Font`, named fonts (`TkDefaultFont` ...), `measure` / `metrics` through the native text engine |
| `tkinter.scrolledtext` | `.scrolledtext` | `ScrolledText`, as in tkinter |
@@ -203,7 +203,7 @@ Ctrl+Z / Ctrl+Shift+Z undo edits, and Tab moves to the next field.
## Behaviour
BUI follows Tk's semantics, checked against the stdlib by
-`tests/test_tk_compat.py`. Some of them are easy to miss:
+`bindings/python/tests/test_tk_compat.py`. Some of them are easy to miss:
- `textvariable` overrides `text`, and `cget("text")` returns the
variable's value.
@@ -234,7 +234,7 @@ BUI follows Tk's semantics, checked against the stdlib by
## Testing your app against tkinter
-`tests/test_tk_compat.py` runs programs on both the stdlib and BUI and
+`bindings/python/tests/test_tk_compat.py` runs programs on both the stdlib and BUI and
compares what they observe:
```python
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index ed94e0b..fa66315 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -9,3 +9,13 @@ target_link_libraries(bui_svg_demo PRIVATE bui_api bui_gpu)
# The C kit from C: nodes, geometry, events, native window (docs/c-api.md).
add_executable(bui_kit_hello kit_hello.c)
target_link_libraries(bui_kit_hello PRIVATE bui::kit)
+
+# The website's screenshot apps (examples/site/; tools/gen_doc_images.py --site):
+# a modifier stack from C, and a scene inspector in Dear ImGui (C++). Both take
+# --screenshot out.png (off-screen, BUI_THEME and BUI_UI_SCALE apply).
+add_executable(bui_site_kit_app site/kit_modifiers.c)
+target_link_libraries(bui_site_kit_app PRIVATE bui::kit)
+if(TARGET bui_imgui)
+ add_executable(bui_site_imgui site/imgui_inspector.cpp)
+ target_link_libraries(bui_site_imgui PRIVATE bui::imgui)
+endif()
diff --git a/examples/kit_hello.c b/examples/kit_hello.c
index 8de5480..dee6832 100644
--- a/examples/kit_hello.c
+++ b/examples/kit_hello.c
@@ -43,13 +43,13 @@ int main(void)
host.emit = on_event; /* callbacks; the window adds the rest */
BK_context_set_host(ctx, &host);
- if (BK_window_supported()) { /* Windows: a native window */
+ if (BK_window_supported()) { /* Win32, X11 or Cocoa (experimental) */
BKWindow *win = BK_window_new(ctx, "BUI from C", 320, 120);
BK_window_show(win);
BK_window_run();
BK_window_free(win);
}
- else { /* elsewhere: render a frame into a raster */
+ else { /* no window system (headless): render a frame into a raster */
BuiRaster *r = BUI_raster_create(320, 120);
BK_render(ctx, r, 320, 120, 1);
BUI_raster_free(r);
diff --git a/examples/site/__pycache__/geometry_nodes.cpython-314.pyc b/examples/site/__pycache__/geometry_nodes.cpython-314.pyc
new file mode 100644
index 0000000..af6d4dd
Binary files /dev/null and b/examples/site/__pycache__/geometry_nodes.cpython-314.pyc differ
diff --git a/examples/site/__pycache__/imgui_inspector.cpython-314.pyc b/examples/site/__pycache__/imgui_inspector.cpython-314.pyc
new file mode 100644
index 0000000..1aa9140
Binary files /dev/null and b/examples/site/__pycache__/imgui_inspector.cpython-314.pyc differ
diff --git a/examples/site/__pycache__/qt_material.cpython-314.pyc b/examples/site/__pycache__/qt_material.cpython-314.pyc
new file mode 100644
index 0000000..992c801
Binary files /dev/null and b/examples/site/__pycache__/qt_material.cpython-314.pyc differ
diff --git a/examples/site/__pycache__/render_props.cpython-314.pyc b/examples/site/__pycache__/render_props.cpython-314.pyc
new file mode 100644
index 0000000..5916f1b
Binary files /dev/null and b/examples/site/__pycache__/render_props.cpython-314.pyc differ
diff --git a/examples/site/__pycache__/tk_export.cpython-314.pyc b/examples/site/__pycache__/tk_export.cpython-314.pyc
new file mode 100644
index 0000000..ffbaf33
Binary files /dev/null and b/examples/site/__pycache__/tk_export.cpython-314.pyc differ
diff --git a/examples/site/__pycache__/ttk_queue.cpython-314.pyc b/examples/site/__pycache__/ttk_queue.cpython-314.pyc
new file mode 100644
index 0000000..4f610f4
Binary files /dev/null and b/examples/site/__pycache__/ttk_queue.cpython-314.pyc differ
diff --git a/examples/site/geometry_nodes.py b/examples/site/geometry_nodes.py
new file mode 100644
index 0000000..42b8e25
--- /dev/null
+++ b/examples/site/geometry_nodes.py
@@ -0,0 +1,75 @@
+"""Blender components: a Geometry Nodes editor (scatter rocks on a terrain).
+
+ python examples/site/geometry_nodes.py
+
+Drag sockets to link, Ctrl+right-drag to cut, middle-drag to pan, wheel to zoom.
+
+SPDX-License-Identifier: GPL-2.0-or-later
+"""
+
+import os
+import sys
+
+sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..",
+ "bindings", "python"))
+
+from bui.components import (App, Area, Column, Label, MenuButton, MenuItem, Node, # noqa: E402
+ NodeEditor, PieMenu, Spacer)
+
+
+def build(size=(760, 400)) -> App:
+ status = Label("Geometry Nodes · 7 nodes, 8 links", align="left", icon="GEOMETRY_NODES")
+ grp_in = Node("Group Input", outputs=[("Geometry", "geometry"), ("Density", "float")],
+ location=(-560, 40), kind="group")
+ distribute = Node("Distribute Points on Faces",
+ inputs=[("Mesh", "geometry"), ("Density", "float", 10.0),
+ ("Seed", "int", 7)],
+ outputs=[("Points", "geometry"), ("Normal", "vector"),
+ ("Rotation", "rotation")],
+ location=(-330, 40), kind="geometry", width=190)
+ rock = Node("Object Info", inputs=[("As Instance", "bool")],
+ outputs=[("Location", "vector"), ("Geometry", "geometry")],
+ location=(-330, -170), kind="input")
+ rand = Node("Random Value", inputs=[("Min", "float", 0.4), ("Max", "float", 1.6)],
+ outputs=[("Value", "float")], location=(-90, -190), kind="converter")
+ inst = Node("Instance on Points",
+ inputs=[("Points", "geometry"), ("Instance", "geometry"),
+ ("Rotation", "rotation"), ("Scale", "vector")],
+ outputs=[("Instances", "geometry")], location=(-60, 40), kind="geometry",
+ width=170)
+ join = Node("Join Geometry", inputs=[("Geometry", "geometry")],
+ outputs=[("Geometry", "geometry")], location=(160, 40), kind="geometry")
+ grp_out = Node("Group Output", inputs=[("Geometry", "geometry")], location=(350, 40),
+ kind="group")
+ ed = NodeEditor([grp_in, distribute, rock, rand, inst, join, grp_out],
+ links=[(grp_in, 0, distribute, 0), (grp_in, 1, distribute, 1),
+ (distribute, 0, inst, 0), (distribute, 2, inst, 2),
+ (rock, 1, inst, 1), (rand, 0, inst, 3), (inst, 0, join, 0),
+ (join, 0, grp_out, 0)])
+ area = Area("Geometry Node Editor", ed,
+ header=[MenuButton("View", ["Frame All", "Frame Selected"]),
+ MenuButton("Select", ["All", "None", "Invert"]),
+ MenuButton("Add", ["Input", "Output", "Geometry", "Instances",
+ "Mesh", "Point", "Utilities"]),
+ MenuButton("Node", ["Group", "Ungroup", "Mute"]), Spacer()])
+ app = App("Geometry Nodes", size, area, Column(status, padding=6),
+ padding=0, spacing=0)
+ app.editor = ed
+
+ def pie():
+ PieMenu.show(app.ctx, [
+ MenuItem("Wireframe", icon="SHADING_WIRE"),
+ MenuItem("Rendered", icon="SHADING_RENDERED"),
+ MenuItem("Solid", icon="SHADING_SOLID"),
+ MenuItem("Material Preview", icon="SHADING_TEXTURE"),
+ MenuItem("Toggle X-Ray", icon="XRAY"),
+ MenuItem("Toggle Overlays", icon="OVERLAY"),
+ ], "Shading")
+
+ app.pie = pie
+ app.bind("z", pie)
+ return app
+
+
+if __name__ == "__main__":
+ build().run()
diff --git a/examples/site/imgui_inspector.cpp b/examples/site/imgui_inspector.cpp
new file mode 100644
index 0000000..d566301
--- /dev/null
+++ b/examples/site/imgui_inspector.cpp
@@ -0,0 +1,152 @@
+// Dear ImGui on BUI from C++: a scene inspector (the same app as
+// examples/site/imgui_inspector.py).
+//
+// bui_site_imgui native window, Blender widgets + style
+// bui_site_imgui --stock Dear ImGui's own widgets and colors
+// bui_site_imgui --screenshot out.png off-screen (BUI_THEME, BUI_UI_SCALE)
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+
+#include "BUI_kit.h"
+#include "GPU_raster.h"
+#include "imgui.h"
+#include "imgui_impl_bui.h"
+extern "C" {
+#include "site_png.h"
+}
+
+struct Object
+{
+ const char* name;
+ const char* type;
+ int faces;
+};
+
+static const Object kObjects[] = {{"Camera", "CAMERA", 1}, {"Key Light", "LIGHT", 1}, {"Robot Arm", "MESH", 48210},
+ {"Floor", "MESH", 2}, {"Backdrop", "MESH", 512}};
+
+struct State
+{
+ float loc[3] = {0.0f, 1.25f, 0.4f};
+ float rot[3] = {0.0f, 0.0f, 90.0f};
+ float color[3] = {0.80f, 0.33f, 0.18f};
+ float metal = 0.9f, rough = 0.35f;
+ int engine = 0, samples = 128, selected = 2;
+ bool denoise = true, shadows = true;
+ float frame_ms[90];
+};
+
+static void Frame(void* user)
+{
+ State& s = *(State*)user;
+ const ImVec2 size = ImGui::GetIO().DisplaySize;
+ ImGui::SetNextWindowPos(ImVec2(0, 0));
+ ImGui::SetNextWindowSize(size);
+ ImGui::Begin("Scene Inspector", nullptr, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize);
+ if (ImGui::BeginTable("objects", 3, ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter))
+ {
+ ImGui::TableSetupColumn("Object");
+ ImGui::TableSetupColumn("Type");
+ ImGui::TableSetupColumn("Faces");
+ ImGui::TableHeadersRow();
+ for (int i = 0; i < IM_COUNTOF(kObjects); i++)
+ {
+ ImGui::TableNextRow();
+ ImGui::TableNextColumn();
+ if (ImGui::Selectable(kObjects[i].name, s.selected == i, ImGuiSelectableFlags_SpanAllColumns))
+ s.selected = i;
+ ImGui::TableNextColumn();
+ ImGui::TextUnformatted(kObjects[i].type);
+ ImGui::TableNextColumn();
+ ImGui::Text(kObjects[i].faces >= 1000 ? "%d,%03d" : "%d", kObjects[i].faces >= 1000 ? kObjects[i].faces / 1000 : kObjects[i].faces,
+ kObjects[i].faces % 1000);
+ }
+ ImGui::EndTable();
+ }
+ ImGui::Spacing();
+ if (ImGui::CollapsingHeader("Transform", ImGuiTreeNodeFlags_DefaultOpen))
+ {
+ ImGui::DragFloat3("Location", s.loc, 0.01f);
+ ImGui::DragFloat3("Rotation", s.rot, 1.0f);
+ }
+ if (ImGui::CollapsingHeader("Material", ImGuiTreeNodeFlags_DefaultOpen))
+ {
+ ImGui::ColorEdit3("Base Color", s.color);
+ ImGui::SliderFloat("Metallic", &s.metal, 0.0f, 1.0f);
+ ImGui::SliderFloat("Roughness", &s.rough, 0.0f, 1.0f);
+ }
+ if (ImGui::CollapsingHeader("Render", ImGuiTreeNodeFlags_DefaultOpen))
+ {
+ const char* engines[] = {"Cycles", "EEVEE", "Workbench"};
+ ImGui::Combo("Engine", &s.engine, engines, IM_COUNTOF(engines));
+ ImGui::SliderInt("Samples", &s.samples, 1, 4096);
+ ImGui::Checkbox("Denoise", &s.denoise);
+ ImGui::SameLine();
+ ImGui::Checkbox("Soft Shadows", &s.shadows);
+ ImGui::ProgressBar(0.62f, ImVec2(-1, 0), "Rendering 62%");
+ ImGui::PlotLines("##ms", s.frame_ms, IM_COUNTOF(s.frame_ms), 0, "Frame time (ms)", 0.0f, 30.0f, ImVec2(-1, 60));
+ ImGui::Button("Render Image");
+ ImGui::SameLine();
+ ImGui::Button("Cancel");
+ }
+ ImGui::End();
+}
+
+int main(int argc, char** argv)
+{
+ const char* shot = nullptr;
+ bool stock = false;
+ for (int i = 1; i < argc; i++)
+ {
+ if (!strcmp(argv[i], "--screenshot") && i + 1 < argc)
+ shot = argv[++i];
+ else if (!strcmp(argv[i], "--stock"))
+ stock = true;
+ }
+ State state;
+ for (int i = 0; i < IM_COUNTOF(state.frame_ms); i++)
+ state.frame_ms[i] = 16.6f + 2.5f * sinf(i * 0.45f) + (i % 17 == 0 ? 6.0f : 0.0f);
+
+ IMGUI_CHECKVERSION();
+ ImGui::CreateContext();
+ ImGui::GetIO().IniFilename = nullptr;
+ ImGui_ImplBUI_Config config;
+ config.BlenderStyle = !stock;
+ if (stock)
+ {
+ // Dear ImGui's own look: its widgets and its dark / light colors, following BUI_THEME
+ if (strcmp(BK_theme_name(), "light") == 0)
+ ImGui::StyleColorsLight();
+ else
+ ImGui::StyleColorsDark();
+ }
+ const int W = 520, H = 490;
+ if (shot == nullptr && BK_window_supported())
+ {
+ ImGui_ImplBUI_App* app = ImGui_ImplBUI_CreateApp("Scene Inspector", W, H, Frame, &state, &config);
+ ImGui_ImplBUI_SetBlenderWidgets(!stock && ImGui_ImplBUI_HasBlenderWidgets());
+ ImGui_ImplBUI_RunApp(app);
+ ImGui_ImplBUI_DestroyApp(app);
+ }
+ else
+ {
+ BK_set_scale(site_scale());
+ const int w = (int)(W * BK_scale()), h = (int)(H * BK_scale());
+ ImGui_ImplBUI_App* app = ImGui_ImplBUI_CreateHeadlessApp(Frame, &state, &config);
+ ImGui_ImplBUI_SetBlenderWidgets(!stock && ImGui_ImplBUI_HasBlenderWidgets());
+ BuiRaster* r = BUI_raster_create(w, h);
+ BKContext* ctx = ImGui_ImplBUI_AppContext(app);
+ for (int i = 0; i < 8; i++)
+ BK_render(ctx, r, w, h, i == 0);
+ if (shot)
+ site_write_png(shot, BUI_raster_pixels(r), w, h);
+ BUI_raster_free(r);
+ ImGui_ImplBUI_DestroyApp(app);
+ }
+ ImGui::DestroyContext();
+ return 0;
+}
diff --git a/examples/site/imgui_inspector.py b/examples/site/imgui_inspector.py
new file mode 100644
index 0000000..6fd139f
--- /dev/null
+++ b/examples/site/imgui_inspector.py
@@ -0,0 +1,80 @@
+"""Dear ImGui on BUI from Python: a scene inspector (the same app as
+examples/site/imgui_inspector.cpp).
+
+ python examples/site/imgui_inspector.py # Blender widgets + style
+ python examples/site/imgui_inspector.py --stock # Dear ImGui's own look
+
+SPDX-License-Identifier: GPL-2.0-or-later
+"""
+
+import math
+import os
+import sys
+
+sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..",
+ "bindings", "python"))
+
+import bui.imgui as imgui # noqa: E402
+
+OBJECTS = [("Camera", "CAMERA", 1), ("Key Light", "LIGHT", 1), ("Robot Arm", "MESH", 48210),
+ ("Floor", "MESH", 2), ("Backdrop", "MESH", 512)]
+FRAME_MS = [16.6 + 2.5 * math.sin(i * 0.45) + (6 if i % 17 == 0 else 0) for i in range(90)]
+
+state = {"loc": (0.0, 1.25, 0.4), "rot": (0.0, 0.0, 90.0), "color": (0.80, 0.33, 0.18),
+ "rough": 0.35, "metal": 0.9, "engine": 0, "samples": 128, "denoise": True,
+ "selected": 2, "shadows": True}
+
+
+def frame(width=520, height=600):
+ s = imgui.get_io().display_size
+ imgui.set_next_window_pos((0, 0))
+ imgui.set_next_window_size((s[0], s[1]))
+ imgui.begin("Scene Inspector", None, imgui.WINDOW_NO_COLLAPSE | imgui.WINDOW_NO_MOVE |
+ imgui.WINDOW_NO_RESIZE)
+ if imgui.begin_table("objects", 3, imgui.TABLE_BORDERS_INNER_V | imgui.TABLE_ROW_BG |
+ imgui.TABLE_BORDERS_OUTER):
+ imgui.table_setup_column("Object")
+ imgui.table_setup_column("Type")
+ imgui.table_setup_column("Faces")
+ imgui.table_headers_row()
+ for i, (name, kind, faces) in enumerate(OBJECTS):
+ imgui.table_next_row()
+ imgui.table_next_column()
+ if imgui.selectable(name, state["selected"] == i,
+ imgui.SELECTABLE_SPAN_ALL_COLUMNS):
+ state["selected"] = i
+ imgui.table_next_column()
+ imgui.text(kind)
+ imgui.table_next_column()
+ imgui.text("{:,}".format(faces))
+ imgui.end_table()
+ imgui.spacing()
+ if imgui.collapsing_header("Transform", imgui.TREE_NODE_DEFAULT_OPEN):
+ _, state["loc"] = imgui.drag_float3("Location", state["loc"], 0.01)
+ _, state["rot"] = imgui.drag_float3("Rotation", state["rot"], 1.0)
+ if imgui.collapsing_header("Material", imgui.TREE_NODE_DEFAULT_OPEN):
+ _, state["color"] = imgui.color_edit3("Base Color", state["color"])
+ _, state["metal"] = imgui.slider_float("Metallic", state["metal"], 0.0, 1.0)
+ _, state["rough"] = imgui.slider_float("Roughness", state["rough"], 0.0, 1.0)
+ if imgui.collapsing_header("Render", imgui.TREE_NODE_DEFAULT_OPEN):
+ _, state["engine"] = imgui.combo("Engine", state["engine"], ["Cycles", "EEVEE",
+ "Workbench"])
+ _, state["samples"] = imgui.slider_int("Samples", state["samples"], 1, 4096)
+ _, state["denoise"] = imgui.checkbox("Denoise", state["denoise"])
+ imgui.same_line()
+ _, state["shadows"] = imgui.checkbox("Soft Shadows", state["shadows"])
+ imgui.progress_bar(0.62, (-1, 0), "Rendering 62%")
+ imgui.plot_lines("##ms", FRAME_MS, 0, "Frame time (ms)", 0.0, 30.0, (-1, 60))
+ imgui.button("Render Image")
+ imgui.same_line()
+ imgui.button("Cancel")
+ imgui.end()
+
+
+def main():
+ stock = "--stock" in sys.argv
+ imgui.run(frame, title="Scene Inspector", size=(520, 600), blender_style=not stock)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/examples/site/js/shoot.mjs b/examples/site/js/shoot.mjs
new file mode 100644
index 0000000..d4ed3b6
--- /dev/null
+++ b/examples/site/js/shoot.mjs
@@ -0,0 +1,61 @@
+// Screenshots of the JavaScript examples for the website (run by
+// tools/gen_doc_images.py --site): node examples/site/js/shoot.mjs OUT_DIR THEME
+// Headless windows, BUI_UI_SCALE for the resolution scale.
+import { createRequire } from 'node:module'
+import fs from 'node:fs'
+import path from 'node:path'
+import zlib from 'node:zlib'
+
+const require = createRequire(import.meta.url)
+const { App } = require('../../../bindings/node')
+const [out = '.', theme = process.env.BUI_THEME || 'dark'] = process.argv.slice(2)
+
+function crc32 (buf) {
+ let c, crc = 0xffffffff
+ for (let n = 0; n < buf.length; n++) {
+ c = (crc ^ buf[n]) & 0xff
+ for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1
+ crc = (crc >>> 8) ^ c
+ }
+ return (crc ^ 0xffffffff) >>> 0
+}
+
+function png ({ width, height, data }) {
+ const raw = Buffer.alloc((width * 3 + 1) * height)
+ for (let y = 0; y < height; y++) {
+ raw[y * (width * 3 + 1)] = 0
+ for (let x = 0; x < width; x++) {
+ const s = (y * width + x) * 4, d = y * (width * 3 + 1) + 1 + x * 3
+ raw[d] = data[s]; raw[d + 1] = data[s + 1]; raw[d + 2] = data[s + 2]
+ }
+ }
+ const chunk = (type, body) => {
+ const len = Buffer.alloc(4); len.writeUInt32BE(body.length)
+ const tb = Buffer.concat([Buffer.from(type), body])
+ const crc = Buffer.alloc(4); crc.writeUInt32BE(crc32(tb))
+ return Buffer.concat([len, tb, crc])
+ }
+ const ihdr = Buffer.alloc(13)
+ ihdr.writeUInt32BE(width, 0); ihdr.writeUInt32BE(height, 4)
+ ihdr[8] = 8; ihdr[9] = 2
+ return Buffer.concat([Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]), chunk('IHDR', ihdr),
+ chunk('IDAT', zlib.deflateSync(raw, { level: 9 })), chunk('IEND', Buffer.alloc(0))])
+}
+
+const settle = () => new Promise(resolve => setTimeout(resolve, 120))
+
+async function save (win, name) {
+ await settle()
+ const shot = await win.screenshot()
+ const file = path.join(out, `${name}-${theme}.png`)
+ fs.writeFileSync(file, png(shot))
+ console.log(`saved ${path.basename(file)} ${shot.width}x${shot.height}`)
+}
+
+const app = new App({ headless: true, theme })
+const dom = require('./todo_dom.js')
+await save(dom.build(app), 'js-dom-tasks')
+const react = require('./todo_react.js')
+const r = react.build({ app })
+await save(r.window, 'js-react-tasks')
+app.quit()
diff --git a/examples/site/js/todo_dom.js b/examples/site/js/todo_dom.js
new file mode 100644
index 0000000..daf91cd
--- /dev/null
+++ b/examples/site/js/todo_dom.js
@@ -0,0 +1,84 @@
+// A task list with @blender-ui/native's DOM-like API (createElement,
+// appendChild, className, addEventListener), in Blender's theme.
+// node examples/site/js/todo_dom.js (or: bun ...)
+// The same app with React: todo_react.js.
+'use strict'
+const path = require('node:path')
+const { App } = require(path.join(__dirname, '../../../bindings/node'))
+const { TASKS, TAG_COLORS, CSS } = require('./todo_style')
+
+function build (app, size = { width: 440, height: 370 }) {
+ const win = app.window({ title: 'Tasks', ...size })
+ const doc = win
+ const el = (tag, cls, text) => {
+ const e = doc.createElement(tag)
+ if (cls) e.className = cls
+ if (text !== undefined) e.appendChild(doc.createTextNode(String(text)))
+ return e
+ }
+ win.body.setAttribute('styled', '')
+ const style = el('style', null, CSS)
+ win.body.appendChild(style)
+
+ const head = el('div', 'head')
+ head.appendChild(el('h1', null, 'Robot Arm · Sprint 4'))
+ const count = el('span', 'muted')
+ head.appendChild(count)
+ win.body.appendChild(head)
+
+ const add = el('div', 'add')
+ const input = doc.createElement('TextField')
+ input.setAttribute('placeholder', 'Add a task…')
+ add.appendChild(input)
+ const addBtn = el('Button', null, 'Add')
+ add.appendChild(addBtn)
+ win.body.appendChild(add)
+
+ const filters = el('div', 'filters')
+ for (const [i, f] of ['All', 'Active', 'Done'].entries()) filters.appendChild(el('span', i === 0 ? 'filter on' : 'filter', f))
+ win.body.appendChild(filters)
+
+ const list = el('div', 'list')
+ win.body.appendChild(list)
+ const foot = el('div', 'foot')
+ const progress = doc.createElement('ProgressBar')
+ progress.className = 'bar'
+ progress.setAttribute('max', '100')
+ foot.appendChild(progress)
+ const pct = el('span', 'muted')
+ foot.appendChild(pct)
+ win.body.appendChild(foot)
+
+ const tasks = TASKS.map(t => ({ ...t }))
+ const refresh = () => {
+ for (const c of [...list.childNodes]) { list.removeChild(c); c.destroy() }
+ for (const t of tasks) {
+ const row = el('div', t.done ? 'item done' : 'item')
+ const box = doc.createElement('Checkbox')
+ if (t.done) box.setAttribute('checked', '')
+ box.addEventListener('change', e => { t.done = e.target.checked; refresh() })
+ row.appendChild(box)
+ row.appendChild(el('span', 'text', t.text))
+ const tag = el('span', 'tag', t.tag)
+ tag.style = { backgroundColor: TAG_COLORS[t.tag] }
+ row.appendChild(tag)
+ list.appendChild(row)
+ }
+ const done = tasks.filter(t => t.done).length
+ count.textContent = `${tasks.length - done} open · ${done} done`
+ progress.setAttribute('value', String(Math.round(100 * done / tasks.length)))
+ pct.textContent = `${Math.round(100 * done / tasks.length)}% complete`
+ }
+ addBtn.addEventListener('click', () => {
+ if (input.value) { tasks.push({ text: input.value, tag: 'Modeling', done: false }); refresh() }
+ })
+ refresh()
+ return win
+}
+
+module.exports = { build }
+
+if (require.main === module) {
+ const app = new App({ theme: process.env.BUI_THEME })
+ build(app)
+}
diff --git a/examples/site/js/todo_react.js b/examples/site/js/todo_react.js
new file mode 100644
index 0000000..857b60f
--- /dev/null
+++ b/examples/site/js/todo_react.js
@@ -0,0 +1,50 @@
+// The task list of todo_dom.js written with React (@blender-ui/react), no
+// build step (createElement); state with React's hooks.
+// node examples/site/js/todo_react.js (or: bun ...)
+'use strict'
+const path = require('node:path')
+const { render, createElement: h, useState, Button, Checkbox, ProgressBar, TextField } =
+ require(path.join(__dirname, '../../../bindings/react'))
+const { TASKS, TAG_COLORS, CSS } = require('./todo_style')
+
+function Task ({ task, onToggle }) {
+ return h('div', { className: task.done ? 'item done' : 'item' },
+ h(Checkbox, { checked: task.done, onChange: onToggle }),
+ h('span', { className: 'text' }, task.text),
+ h('span', { className: 'tag', style: { backgroundColor: TAG_COLORS[task.tag] } }, task.tag))
+}
+
+function Tasks () {
+ const [tasks, setTasks] = useState(TASKS)
+ const [filter, setFilter] = useState('All')
+ const [draft, setDraft] = useState('')
+ const all = tasks.value ?? tasks
+ const done = all.filter(t => t.done).length
+ const pct = Math.round(100 * done / all.length)
+ const shown = all.filter(t => filter.value === 'All' || (filter.value === 'Done') === t.done)
+ return h('div', null,
+ h('style', null, CSS),
+ h('div', { className: 'head' },
+ h('h1', null, 'Robot Arm · Sprint 4'),
+ h('span', { className: 'muted' }, `${all.length - done} open · ${done} done`)),
+ h('div', { className: 'add' },
+ h(TextField, { placeholder: 'Add a task…', value: draft, onChange: e => setDraft(e.target.value) }),
+ h(Button, { onClick: () => draft.value && setTasks(ts => [...ts, { text: draft.value, tag: 'Modeling', done: false }]) }, 'Add')),
+ h('div', { className: 'filters' }, ['All', 'Active', 'Done'].map(f =>
+ h('span', { key: f, className: filter.value === f ? 'filter on' : 'filter', onClick: () => setFilter(f) }, f))),
+ h('div', { className: 'list' }, shown.map(t =>
+ h(Task, { key: t.text, task: t, onToggle: () => setTasks(ts => ts.map(x => x === t ? { ...x, done: !x.done } : x)) }))),
+ h('div', { className: 'foot' },
+ h(ProgressBar, { className: 'bar', max: '100', value: String(pct) }),
+ h('span', { className: 'muted' }, `${pct}% complete`)))
+}
+
+function build (options = {}) {
+ const r = render(h(Tasks), { title: 'Tasks (React)', width: 440, height: 370, ...options })
+ r.window.body.setAttribute('styled', '')
+ return r
+}
+
+module.exports = { build }
+
+if (require.main === module) build({ theme: process.env.BUI_THEME })
diff --git a/examples/site/js/todo_style.js b/examples/site/js/todo_style.js
new file mode 100644
index 0000000..b224e4f
--- /dev/null
+++ b/examples/site/js/todo_style.js
@@ -0,0 +1,40 @@
+// The task list's data and stylesheet, shared by todo_dom.js and todo_react.js.
+// Colours are translucent over the `styled` background (Blender's theme), so
+// the page follows BUI_THEME=dark|light.
+'use strict'
+
+const TASKS = [
+ { text: 'Retopologize the robot arm', tag: 'Modeling', done: true },
+ { text: 'Bake normal maps (4K)', tag: 'Texturing', done: true },
+ { text: 'Rig the gripper fingers', tag: 'Rigging', done: false },
+ { text: 'Key the pick-and-place loop', tag: 'Animation', done: false },
+ { text: 'Light the studio turntable', tag: 'Lighting', done: false },
+ { text: 'Render 240 frames on the farm', tag: 'Rendering', done: false }
+]
+
+const TAG_COLORS = {
+ Modeling: '#4772b3', Texturing: '#b36b47', Rigging: '#8a5cc2',
+ Animation: '#3a9b7a', Lighting: '#c29a3c', Rendering: '#c2475f'
+}
+
+const CSS = `
+body { margin: 0; padding: 16px 18px; min-height: 100vh; box-sizing: border-box; }
+h1 { font-size: 20px; margin: 0; }
+.head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
+.muted { opacity: 0.6; font-size: 12px; }
+.add { display: flex; gap: 6px; margin-bottom: 10px; }
+.add input { flex: 1; }
+.filters { display: flex; gap: 4px; margin-bottom: 8px; }
+.filter { padding: 2px 12px; border-radius: 10px; font-size: 12px; background: rgba(128, 128, 128, 0.18); }
+.filter.on { background: #4772b3; color: white; }
+.list { border-radius: 8px; background: rgba(128, 128, 128, 0.12); padding: 4px 0; }
+.item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; }
+.item + .item { border-top: 1px solid rgba(128, 128, 128, 0.18); }
+.item .text { flex: 1; }
+.item.done .text { opacity: 0.5; text-decoration: line-through; }
+.tag { font-size: 10px; padding: 1px 8px; border-radius: 8px; color: white; }
+.foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
+.foot .bar { flex: 1; }
+`
+
+module.exports = { TASKS, TAG_COLORS, CSS }
diff --git a/examples/site/kit_modifiers.c b/examples/site/kit_modifiers.c
new file mode 100644
index 0000000..ad47a0b
--- /dev/null
+++ b/examples/site/kit_modifiers.c
@@ -0,0 +1,193 @@
+/* BUI kit from C: a modifier stack (Blender's Properties editor, Modifiers tab).
+ *
+ * cmake -S . -B build -DBUI_BUILD_EXAMPLES=ON && cmake --build build --target bui_site_kit_app
+ * bui_site_kit_app (native window)
+ * bui_site_kit_app --screenshot out.png (off-screen; BUI_THEME, BUI_UI_SCALE)
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "BUI_kit.h"
+#include "GPU_raster.h"
+#include "site_png.h"
+
+static BKNode *add(BKNode *parent, const char *type)
+{
+ BKNode *n = BK_node_new(type);
+ BK_node_add(parent, n, -1);
+ return n;
+}
+
+/* Blender's property row: right-aligned label (40%) | value. */
+static BKNode *prop(BKNode *parent, const char *label, BKNode *value)
+{
+ BKNode *row = add(parent, "split");
+ BKNode *l = add(row, "label");
+ BK_set_str(l, "text", label);
+ BK_set_str(l, "text_align", "right");
+ BK_set_num(l, "weight", 0.4);
+ BK_node_add(row, value, -1);
+ BK_set_num(value, "weight", 0.6);
+ return row;
+}
+
+static BKNode *number(double value, double min, double max, int integer, const char *suffix)
+{
+ BKNode *n = BK_node_new("number");
+ if (integer) {
+ BK_set_num(n, "integer", 1);
+ }
+ BK_set_num(n, "min", min);
+ BK_set_num(n, "max", max);
+ BK_set_num(n, "step", integer ? 1 : 0.1);
+ BK_set_num(n, "precision", integer ? 0 : 3);
+ BK_set_num(n, "value", value);
+ if (suffix) {
+ BK_set_str(n, "suffix", suffix);
+ }
+ return n;
+}
+
+static BKNode *slider(double value, double min, double max)
+{
+ BKNode *s = BK_node_new("slider");
+ BK_set_num(s, "min", min);
+ BK_set_num(s, "max", max);
+ BK_set_num(s, "step", 0.05);
+ BK_set_num(s, "precision", 3);
+ BK_set_num(s, "value", value);
+ return s;
+}
+
+static BKNode *enumrow(const char **items, int n, int current)
+{
+ BKNode *e = BK_node_new("enum");
+ BK_set_strs(e, "items", items, n);
+ BK_set_num(e, "value", current);
+ return e;
+}
+
+static BKNode *dropdown(const char **items, int n, int current)
+{
+ BKNode *e = BK_node_new("dropdown");
+ BK_set_strs(e, "items", items, n);
+ BK_set_num(e, "value", current);
+ return e;
+}
+
+static BKNode *checkbox(BKNode *parent, const char *label, int on)
+{
+ BKNode *c = add(parent, "checkbox");
+ BK_set_str(c, "label", label);
+ BK_set_num(c, "value", on);
+ return c;
+}
+
+/* A collapsible panel; returns its body (the panel's first child), where its rows go. */
+static BKNode *panel(BKNode *parent, const char *title, const char *icon, BKNode **r_panel)
+{
+ BKNode *p = add(parent, "panel");
+ BK_set_str(p, "text", title);
+ BK_set_str(p, "icon", icon);
+ if (r_panel) {
+ *r_panel = p;
+ }
+ return BK_node_child(p, 0);
+}
+
+static void on_event(void *data, BKNode *node, int kind, void *ref, double a, double b)
+{
+ (void)data, (void)ref, (void)a, (void)b;
+ if (kind == BK_EV_CLICK) {
+ printf("clicked %s\n", BK_get_str(node, "text"));
+ }
+}
+
+static BKNode *build(void)
+{
+ BKNode *root = BK_node_new("column");
+ BK_set_num(root, "padding", 8);
+ BK_set_num(root, "spacing", 2);
+
+ BKNode *top = add(root, "row");
+ BKNode *addb = add(top, "button");
+ BK_set_str(addb, "text", "Add Modifier");
+ BK_set_str(addb, "icon", "ADD");
+ BKNode *opts = add(top, "button");
+ BK_set_str(opts, "icon", "DOWNARROW_HLT");
+ BK_set_num(opts, "weight", 0);
+
+ BKNode *sub = panel(root, "Subdivision", "MOD_SUBSURF", NULL);
+ const char *algo[] = {"Catmull-Clark", "Simple"};
+ BK_node_add(sub, enumrow(algo, 2, 0), -1);
+ prop(sub, "Levels Viewport", number(2, 0, 6, 1, NULL));
+ prop(sub, "Render", number(3, 0, 6, 1, NULL));
+ checkbox(sub, "Optimal Display", 1);
+
+ BKNode *bevel = panel(root, "Bevel", "MOD_BEVEL", NULL);
+ const char *affect[] = {"Vertices", "Edges"};
+ BK_node_add(bevel, enumrow(affect, 2, 1), -1);
+ const char *width_type[] = {"Offset", "Width", "Depth", "Percent", "Absolute"};
+ prop(bevel, "Width Type", dropdown(width_type, 5, 0));
+ prop(bevel, "Amount", number(0.02, 0, 1, 0, " m"));
+ prop(bevel, "Segments", number(3, 1, 100, 1, NULL));
+ prop(bevel, "Shape", slider(0.5, 0, 1));
+ checkbox(bevel, "Harden Normals", 1);
+ checkbox(bevel, "Clamp Overlap", 1);
+
+ BKNode *array = panel(root, "Array", "MOD_ARRAY", NULL);
+ const char *fit[] = {"Fixed Count", "Fit Length", "Fit Curve"};
+ prop(array, "Fit Type", dropdown(fit, 3, 0));
+ prop(array, "Count", number(6, 1, 1000, 1, NULL));
+ checkbox(array, "Relative Offset", 1);
+ prop(array, "Factor X", number(1.1, -10, 10, 0, NULL));
+ checkbox(array, "Merge", 0);
+
+ BKNode *weld;
+ panel(root, "Weld", "AUTOMERGE_OFF", &weld);
+ BK_set_num(weld, "collapsed", 1);
+
+ BKNode *apply = add(root, "row");
+ BKNode *b1 = add(apply, "button");
+ BK_set_str(b1, "text", "Apply All");
+ BKNode *b2 = add(apply, "button");
+ BK_set_str(b2, "text", "Copy to Selected");
+ return root;
+}
+
+int main(int argc, char **argv)
+{
+ const char *shot = NULL;
+ for (int i = 1; i + 1 < argc; i++) {
+ if (strcmp(argv[i], "--screenshot") == 0) {
+ shot = argv[i + 1];
+ }
+ }
+ BKNode *root = build();
+ BKContext *ctx = BK_context_new(root);
+ BKHost host = {0};
+ host.emit = on_event;
+ BK_context_set_host(ctx, &host);
+ const int W = 420, H = 528;
+ if (!shot && BK_window_supported()) {
+ BKWindow *win = BK_window_new(ctx, "Modifiers", W, H);
+ BK_window_show(win);
+ BK_window_run();
+ BK_window_free(win);
+ }
+ else {
+ BK_set_scale(site_scale());
+ const int w = (int)(W * BK_scale()), h = (int)(H * BK_scale());
+ BuiRaster *r = BUI_raster_create(w, h);
+ BK_render(ctx, r, w, h, 1);
+ if (shot) {
+ site_write_png(shot, BUI_raster_pixels(r), w, h);
+ }
+ BUI_raster_free(r);
+ }
+ BK_context_free(ctx);
+ BK_node_free(root);
+ return 0;
+}
diff --git a/examples/site/qt_material.py b/examples/site/qt_material.py
new file mode 100644
index 0000000..2b19be3
--- /dev/null
+++ b/examples/site/qt_material.py
@@ -0,0 +1,110 @@
+"""Qt syntax: a material editor (QListWidget, QFormLayout, QGroupBox ...).
+
+ python examples/site/qt_material.py
+
+SPDX-License-Identifier: GPL-2.0-or-later
+"""
+
+import os
+import sys
+
+sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..",
+ "bindings", "python"))
+
+from bui.qtsyntax import (QApplication, QCheckBox, QComboBox, QDoubleSpinBox, # noqa: E402
+ QFormLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit,
+ QListWidget, QProgressBar, QPushButton, QSlider, QVBoxLayout,
+ QWidget)
+
+MATERIALS = ["Brushed Steel", "Car Paint", "Frosted Glass", "Oak Veneer", "Rubber",
+ "Ceramic Glaze", "Neon Tube"]
+
+
+def slider_row(value, maximum=100):
+ row = QHBoxLayout()
+ s = QSlider()
+ s.setRange(0, maximum)
+ s.setValue(value)
+ spin = QDoubleSpinBox()
+ spin.setRange(0.0, 1.0)
+ spin.setSingleStep(0.05)
+ spin.setValue(value / maximum)
+ s.valueChanged.connect(lambda v: spin.setValue(v / maximum))
+ row.addWidget(s, 3)
+ row.addWidget(spin, 1)
+ return row
+
+
+def build():
+ window = QWidget()
+ window.setWindowTitle("Material Editor")
+ window.resize(560, 340)
+ root = QHBoxLayout()
+
+ left = QVBoxLayout()
+ search = QLineEdit()
+ search.setPlaceholderText("Filter materials")
+ left.addWidget(search)
+ mats = QListWidget()
+ mats.addItems(MATERIALS)
+ mats.setCurrentRow(1)
+ left.addWidget(mats)
+ add = QHBoxLayout()
+ add.addWidget(QPushButton("New"))
+ add.addWidget(QPushButton("Duplicate"))
+ left.addLayout(add)
+ root.addLayout(left, 2)
+
+ right = QVBoxLayout()
+ name = QLineEdit("Car Paint")
+ right.addWidget(name)
+ surface = QGroupBox("Surface")
+ form = QFormLayout()
+ shader = QComboBox()
+ shader.addItems(["Principled BSDF", "Diffuse BSDF", "Glossy BSDF", "Emission"])
+ form.addRow("Shader", shader)
+ form.addRow("Metallic", slider_row(85))
+ form.addRow("Roughness", slider_row(22))
+ form.addRow("Coat", slider_row(100))
+ ior = QDoubleSpinBox()
+ ior.setRange(1.0, 3.0)
+ ior.setSingleStep(0.01)
+ ior.setValue(1.5)
+ form.addRow("IOR", ior)
+ blend = QComboBox()
+ blend.addItems(["Opaque", "Alpha Clip", "Alpha Blend"])
+ form.addRow("Blend Mode", blend)
+ surface.setLayout(form)
+ right.addWidget(surface)
+
+ flags = QHBoxLayout()
+ cull = QCheckBox("Backface Culling")
+ cull.setChecked(True)
+ flags.addWidget(cull)
+ flags.addWidget(QCheckBox("Show Backface"))
+ right.addLayout(flags)
+
+ bar = QProgressBar()
+ bar.setRange(0, 100)
+ bar.setValue(74)
+ bar.setFormat("Compiling shaders %p%")
+ right.addWidget(bar)
+ buttons = QHBoxLayout()
+ buttons.addWidget(QLabel("Used by 12 objects"))
+ buttons.addWidget(QPushButton("Revert"))
+ buttons.addWidget(QPushButton("Apply"))
+ right.addLayout(buttons)
+ root.addLayout(right, 3)
+ window.setLayout(root)
+ return window
+
+
+def main() -> int:
+ app = QApplication(sys.argv)
+ w = build()
+ w.show()
+ return app.exec()
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/examples/site/render_props.py b/examples/site/render_props.py
new file mode 100644
index 0000000..465a03e
--- /dev/null
+++ b/examples/site/render_props.py
@@ -0,0 +1,177 @@
+"""Blender components: a render-settings editor (Blender's Properties editor).
+
+ python examples/site/render_props.py
+
+Also provides the feature shots for the website (tools/gen_doc_images.py
+--site): the File menu with a search typed, the mode pie menu, a tooltip and
+the color picker all open on top of this window.
+
+SPDX-License-Identifier: GPL-2.0-or-later
+"""
+
+import os
+import sys
+
+sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..",
+ "bindings", "python"))
+
+from bui.components import (App, Button, Checkbox, ColorSwatch, Column, Decorator, # noqa: E402
+ Dropdown, EnumRow, IconButton, Label, MenuBar, MenuItem,
+ NumberField, NumberSlider, Panel, PieMenu, ProgressBar, Row,
+ SideTabs, Split, Toggle, VectorField)
+
+
+def prop(label, component, decorate=True):
+ """A Blender property row: right-aligned label | value | keyframe dot."""
+ right = Row(component, Decorator(weight=0)) if decorate else component
+ return Split(Label(label, align="right"), right, factor=0.4)
+
+
+def page(*children):
+ return Column(*children, padding=8, spacing=2)
+
+
+def render_page(status):
+ denoise = Dropdown(items=["OpenImageDenoise", "OptiX"],
+ description="Denoise the final render with AI denoising")
+ status.denoise = denoise
+ sampling = Panel(
+ "Sampling",
+ Panel("Viewport",
+ prop("Noise Threshold", NumberSlider("", 0.1, min=0, max=1, step=0.01)),
+ prop("Max Samples", NumberField("", 1024, min=1, max=65536)),
+ header=[Checkbox("", True)]),
+ Panel("Render",
+ prop("Noise Threshold", NumberSlider("", 0.01, min=0, max=1, step=0.001)),
+ prop("Max Samples", NumberField("", 4096, min=1, max=65536)),
+ prop("Time Limit", NumberField("", 0, suffix=" s", min=0)),
+ prop("Denoise", denoise),
+ header=[Checkbox("", True)]),
+ icon="RENDER_STILL",
+ )
+ light_paths = Panel(
+ "Light Paths",
+ prop("Total", NumberField("", 12, min=0, max=1024)),
+ prop("Diffuse", NumberField("", 4, min=0, max=1024)),
+ prop("Glossy", NumberField("", 4, min=0, max=1024)),
+ prop("Transmission", NumberField("", 12, min=0, max=1024)),
+ Row(Checkbox("Caustics Reflective", True), Checkbox("Refractive", True)),
+ collapsed=False,
+ )
+ background = ColorSwatch(value=(0.16, 0.38, 0.62, 1.0), description="World background color")
+ status.background = background
+ color = Panel(
+ "Color Management",
+ prop("View", Dropdown(items=["AgX", "Filmic", "Standard", "Khronos PBR Neutral"])),
+ prop("Look", Dropdown(items=["Medium High Contrast", "None", "Punchy"])),
+ prop("Exposure", NumberSlider("", 0.35, min=-10, max=10, step=0.05)),
+ prop("Background", background),
+ collapsed=False,
+ )
+ return page(
+ Split(Label("Render Engine", align="right"),
+ Dropdown(items=["Cycles", "EEVEE", "Workbench"],
+ icons=["SHADING_RENDERED", "SHADING_RENDERED", "SHADING_SOLID"]),
+ factor=0.4),
+ prop("Device", EnumRow(items=["CPU", "GPU Compute"], value="GPU Compute"), False),
+ sampling, light_paths, color,
+ )
+
+
+def output_page():
+ return page(
+ Panel("Format",
+ VectorField("Resolution", (1920, 1080), axes="XY", suffix=" px",
+ step=1),
+ prop("Scale", NumberSlider("", 100, min=1, max=100, suffix=" %", step=1)),
+ prop("Frame Rate", Dropdown(items=["24 fps", "25 fps", "30 fps", "60 fps"])),
+ icon="OUTPUT"),
+ Panel("Output",
+ prop("File Format", Dropdown(items=["PNG", "OpenEXR", "JPEG", "FFmpeg Video"])),
+ prop("Color", EnumRow(items=["BW", "RGB", "RGBA"], value="RGBA"), False),
+ prop("Color Depth", EnumRow(items=["8", "16"], value="16"), False)),
+ )
+
+
+def build(size=(500, 640)) -> App:
+ status = Label("Rendering frame 42 / 120 · Time 00:01:37", align="left", icon="INFO")
+ progress = ProgressBar(0.62, "Path Tracing Sample 2540/4096")
+
+ def say(text):
+ return lambda: setattr(status, "text", text)
+
+ menubar = MenuBar(
+ ("File", [MenuItem("New", say("New"), icon="FILE", shortcut="Ctrl N"),
+ MenuItem("Open...", say("Open"), icon="FILE_FOLDER", shortcut="Ctrl O"),
+ MenuItem("Open Recent", submenu=[MenuItem("robot_arm.blend"),
+ MenuItem("forest.blend")],
+ shortcut="Shift Ctrl O"),
+ "-",
+ MenuItem("Save", say("Saved"), icon="FILE", shortcut="Ctrl S"),
+ MenuItem("Save As...", shortcut="Shift Ctrl S"),
+ "-",
+ MenuItem("Import", submenu=[MenuItem("glTF 2.0 (.glb/.gltf)"),
+ MenuItem("FBX (.fbx)"),
+ MenuItem("Wavefront (.obj)")], icon="IMPORT"),
+ MenuItem("Export", submenu=[MenuItem("glTF 2.0 (.glb/.gltf)"),
+ MenuItem("Universal Scene Description"),
+ MenuItem("Stanford PLY (.ply)")],
+ icon="EXPORT"),
+ MenuItem("Export Image", icon="IMAGE_DATA"),
+ "-",
+ MenuItem("Quit", shortcut="Ctrl Q")]),
+ ("Edit", [MenuItem("Undo", icon="LOOP_BACK", shortcut="Ctrl Z"),
+ MenuItem("Redo", icon="LOOP_FORWARDS", shortcut="Shift Ctrl Z"),
+ "-", MenuItem("Preferences...", icon="PREFERENCES")]),
+ ("Render", [MenuItem("Render Image", say("Render"), icon="RENDER_STILL",
+ shortcut="F12"),
+ MenuItem("Render Animation", icon="RENDER_ANIMATION",
+ shortcut="Ctrl F12"),
+ "-", MenuItem("View Render", shortcut="F11")]),
+ ("Window", [MenuItem("New Window"), MenuItem("Toggle Fullscreen")]),
+ ("Help", [MenuItem("Manual", icon="HELP")]),
+ right=[IconButton("PLAY", description="Play animation"),
+ IconButton("SEARCH", description="Search (F3)")],
+ )
+ def stub(title, *rows):
+ return page(Panel(title, *rows))
+
+ pages = SideTabs([
+ ("TOOL_SETTINGS", "Tool", stub("Options", Checkbox("Auto Merge", False))),
+ ("SCENE", "Render", render_page(status)),
+ ("OUTPUT", "Output", output_page()),
+ ("RENDERLAYERS", "View Layer", stub("View Layer", Checkbox("Use for Rendering", True))),
+ ("SCENE_DATA", "Scene", stub("Scene", prop("Camera", Dropdown(items=["Camera"])))),
+ ("WORLD", "World", stub("Surface", prop("Color", ColorSwatch(value=(0.05, 0.05, 0.05, 1))))),
+ ("OBJECT_DATA", "Object", stub("Transform", VectorField("Location", (0.0, 0.0, 1.2)))),
+ ("MODIFIER", "Modifiers", stub("Modifiers", Button("Add Modifier", icon="ADD"))),
+ ("PARTICLES", "Particles", stub("Particles", Checkbox("Enabled"))),
+ ("PHYSICS", "Physics", stub("Physics", Checkbox("Enabled"))),
+ ("MATERIAL", "Material", stub("Surface", prop("Base Color", ColorSwatch(
+ value=(0.8, 0.3, 0.2, 1))))),
+ ], current=1)
+ app = App("Render Properties", size, pages,
+ Column(progress, status, padding=8, spacing=4),
+ header=menubar, padding=0, spacing=0)
+ app.menubar, app.status, app.progress = menubar, status, progress
+ app.denoise, app.background = status.denoise, status.background
+
+ def pie():
+ PieMenu.show(app.ctx, [
+ MenuItem("Object Mode", say("Object Mode"), icon="OBJECT_DATAMODE"),
+ MenuItem("Edit Mode", say("Edit Mode"), icon="EDITMODE_HLT"),
+ MenuItem("Sculpt Mode", say("Sculpt Mode"), icon="SCULPTMODE_HLT"),
+ MenuItem("Vertex Paint", say("Vertex Paint"), icon="VPAINT_HLT"),
+ MenuItem("Weight Paint", say("Weight Paint"), icon="WPAINT_HLT"),
+ MenuItem("Texture Paint", say("Texture Paint"), icon="TPAINT_HLT"),
+ MenuItem("Pose Mode", say("Pose Mode"), icon="POSE_HLT"),
+ MenuItem("Draw Mode", say("Draw Mode"), icon="GREASEPENCIL"),
+ ], "Mode")
+
+ app.pie = pie
+ app.bind("q", pie)
+ return app
+
+
+if __name__ == "__main__":
+ build().run()
diff --git a/examples/site/site_png.h b/examples/site/site_png.h
new file mode 100644
index 0000000..f4a9e93
--- /dev/null
+++ b/examples/site/site_png.h
@@ -0,0 +1,119 @@
+/* A minimal PNG writer for the site examples' --screenshot (stored deflate
+ * blocks, no zlib; tools/pngopt.py recompresses the files losslessly).
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later */
+#pragma once
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static uint32_t site_crc_table[256];
+
+static uint32_t site_crc(uint32_t crc, const unsigned char *p, size_t n)
+{
+ if (!site_crc_table[1]) {
+ for (uint32_t i = 0; i < 256; i++) {
+ uint32_t c = i;
+ for (int k = 0; k < 8; k++) {
+ c = (c & 1) ? 0xedb88320u ^ (c >> 1) : c >> 1;
+ }
+ site_crc_table[i] = c;
+ }
+ }
+ crc = ~crc;
+ for (size_t i = 0; i < n; i++) {
+ crc = site_crc_table[(crc ^ p[i]) & 0xff] ^ (crc >> 8);
+ }
+ return ~crc;
+}
+
+static void site_be32(unsigned char *p, uint32_t v)
+{
+ p[0] = (unsigned char)(v >> 24), p[1] = (unsigned char)(v >> 16);
+ p[2] = (unsigned char)(v >> 8), p[3] = (unsigned char)v;
+}
+
+static void site_chunk(FILE *f, const char *type, const unsigned char *body, uint32_t n)
+{
+ unsigned char hdr[8];
+ site_be32(hdr, n);
+ for (int i = 0; i < 4; i++) {
+ hdr[4 + i] = (unsigned char)type[i];
+ }
+ fwrite(hdr, 1, 8, f);
+ if (n) {
+ fwrite(body, 1, n, f);
+ }
+ uint32_t crc = site_crc(0, hdr + 4, 4);
+ crc = site_crc(crc, body, n);
+ unsigned char c[4];
+ site_be32(c, crc);
+ fwrite(c, 1, 4, f);
+}
+
+/* `px`: 0x00RRGGBB (BUI_raster_pixels), `w` x `h`. Returns 0 on success. */
+static int site_write_png(const char *path, const uint32_t *px, int w, int h)
+{
+ const size_t stride = (size_t)w * 3 + 1, raw_n = stride * (size_t)h;
+ unsigned char *raw = (unsigned char *)malloc(raw_n);
+ for (int y = 0; y < h; y++) {
+ unsigned char *row = raw + y * stride;
+ row[0] = 0;
+ for (int x = 0; x < w; x++) {
+ const uint32_t p = px[(size_t)y * w + x];
+ row[1 + x * 3] = (unsigned char)(p >> 16);
+ row[2 + x * 3] = (unsigned char)(p >> 8);
+ row[3 + x * 3] = (unsigned char)p;
+ }
+ }
+ /* zlib stream of stored blocks */
+ const size_t nblocks = (raw_n + 65534) / 65535;
+ const size_t z_n = 2 + raw_n + nblocks * 5 + 4;
+ unsigned char *z = (unsigned char *)malloc(z_n);
+ size_t o = 0;
+ z[o++] = 0x78, z[o++] = 0x01;
+ uint32_t a = 1, b = 0;
+ for (size_t i = 0; i < raw_n; i++) {
+ a = (a + raw[i]) % 65521u;
+ b = (b + a) % 65521u;
+ }
+ for (size_t done = 0; done < raw_n;) {
+ const size_t n = raw_n - done > 65535 ? 65535 : raw_n - done;
+ z[o++] = done + n == raw_n ? 1 : 0;
+ z[o++] = (unsigned char)n, z[o++] = (unsigned char)(n >> 8);
+ z[o++] = (unsigned char)~n, z[o++] = (unsigned char)(~n >> 8);
+ for (size_t i = 0; i < n; i++) {
+ z[o++] = raw[done + i];
+ }
+ done += n;
+ }
+ site_be32(z + o, (b << 16) | a);
+ o += 4;
+ FILE *f = fopen(path, "wb");
+ if (!f) {
+ free(raw), free(z);
+ return 1;
+ }
+ static const unsigned char sig[8] = {137, 80, 78, 71, 13, 10, 26, 10};
+ fwrite(sig, 1, 8, f);
+ unsigned char ihdr[13] = {0};
+ site_be32(ihdr, (uint32_t)w);
+ site_be32(ihdr + 4, (uint32_t)h);
+ ihdr[8] = 8, ihdr[9] = 2;
+ site_chunk(f, "IHDR", ihdr, 13);
+ site_chunk(f, "IDAT", z, (uint32_t)o);
+ site_chunk(f, "IEND", NULL, 0);
+ fclose(f);
+ free(raw), free(z);
+ printf("wrote %s (%dx%d)\n", path, w, h);
+ return 0;
+}
+
+/* BUI_UI_SCALE for off-screen renders (no monitor DPI); 1 without it. */
+static float site_scale(void)
+{
+ const char *s = getenv("BUI_UI_SCALE");
+ const float v = s ? (float)atof(s) : 1.0f;
+ return v > 0.0f ? v : 1.0f;
+}
diff --git a/examples/site/tk_export.py b/examples/site/tk_export.py
new file mode 100644
index 0000000..13ca8bf
--- /dev/null
+++ b/examples/site/tk_export.py
@@ -0,0 +1,76 @@
+"""An unchanged tkinter program (classic Tk widgets): a mesh export dialog.
+
+ python -m bui.tksyntax examples/site/tk_export.py # Blender look
+ python examples/site/tk_export.py # stdlib Tk
+
+SPDX-License-Identifier: GPL-2.0-or-later
+"""
+
+import tkinter as tk
+
+
+def build(root):
+ root.title("Export glTF 2.0")
+
+ top = tk.Frame(root)
+ top.pack(fill="x", padx=10, pady=(10, 4))
+ tk.Label(top, text="File").pack(side="left")
+ path = tk.Entry(top)
+ path.insert(0, "//renders/robot_arm.glb")
+ path.pack(side="left", fill="x", expand=True, padx=6)
+ tk.Button(top, text="Browse...").pack(side="left")
+
+ body = tk.Frame(root)
+ body.pack(fill="both", expand=True, padx=10)
+
+ # left: what to include
+ include = tk.LabelFrame(body, text="Include", padx=6, pady=4)
+ include.pack(side="left", fill="both", expand=True)
+ for label, on in (("Selected Objects", True), ("Visible Objects", False),
+ ("Active Collection", False), ("Custom Properties", True),
+ ("Cameras", True), ("Punctual Lights", False)):
+ v = tk.BooleanVar(value=on)
+ tk.Checkbutton(include, text=label, variable=v, anchor="w").pack(fill="x")
+ tk.Label(include, text="Format", anchor="w").pack(fill="x", pady=(6, 0))
+ fmt = tk.StringVar(value="glb")
+ for text, value in (("glTF Binary (.glb)", "glb"), ("glTF Separate (.gltf)", "gltf"),
+ ("glTF Embedded", "embedded")):
+ tk.Radiobutton(include, text=text, value=value, variable=fmt, anchor="w").pack(fill="x")
+
+ # right: mesh options
+ mesh = tk.LabelFrame(body, text="Mesh", padx=6, pady=4)
+ mesh.pack(side="left", fill="both", expand=True, padx=(8, 0))
+ mesh.columnconfigure(1, weight=1)
+ tk.Label(mesh, text="Scale").grid(row=0, column=0, sticky="e", padx=(0, 6))
+ scale = tk.Spinbox(mesh, from_=0.01, to=100, increment=0.1, format="%.2f",
+ textvariable=tk.StringVar(root, "1.00"))
+ scale.grid(row=0, column=1, sticky="we", pady=2)
+ tk.Label(mesh, text="Forward").grid(row=1, column=0, sticky="e", padx=(0, 6))
+ axis = tk.StringVar(value="-Z Forward")
+ tk.OptionMenu(mesh, axis, "-Z Forward", "X Forward", "Y Forward", "Z Forward").grid(
+ row=1, column=1, sticky="we", pady=2)
+ tk.Label(mesh, text="Compression").grid(row=2, column=0, sticky="e", padx=(0, 6))
+ level = tk.Scale(mesh, from_=0, to=10, orient="horizontal", showvalue=True)
+ level.set(6)
+ level.grid(row=2, column=1, sticky="we")
+ tk.Label(mesh, text="UV Maps").grid(row=3, column=0, sticky="ne", padx=(0, 6), pady=2)
+ uvs = tk.Listbox(mesh, height=4, exportselection=False)
+ for name in ("UVMap", "Lightmap", "Decals", "Detail"):
+ uvs.insert("end", name)
+ uvs.selection_set(0)
+ uvs.grid(row=3, column=1, sticky="we", pady=2)
+ for i, (label, on) in enumerate((("Apply Modifiers", True), ("Tangents", False),
+ ("Vertex Colors", True))):
+ v = tk.BooleanVar(value=on)
+ tk.Checkbutton(mesh, text=label, variable=v).grid(row=4 + i, column=1, sticky="w")
+
+ bottom = tk.Frame(root)
+ bottom.pack(fill="x", padx=10, pady=10)
+ tk.Label(bottom, text="3 objects, 48,210 triangles").pack(side="left")
+ tk.Button(bottom, text="Export", width=10, default="active").pack(side="right")
+ tk.Button(bottom, text="Cancel", width=10).pack(side="right", padx=6)
+ return root
+
+
+if __name__ == "__main__":
+ build(tk.Tk()).mainloop()
diff --git a/examples/site/ttk_queue.py b/examples/site/ttk_queue.py
new file mode 100644
index 0000000..c9f3edd
--- /dev/null
+++ b/examples/site/ttk_queue.py
@@ -0,0 +1,86 @@
+"""An unchanged tkinter program (ttk widgets): a render farm queue.
+
+ python -m bui.tksyntax examples/site/ttk_queue.py # Blender look
+ python examples/site/ttk_queue.py # stdlib Tk
+
+SPDX-License-Identifier: GPL-2.0-or-later
+"""
+
+import tkinter as tk
+from tkinter import ttk
+
+JOBS = [
+ ("robot_arm.blend", "Cycles", "1-240", "Active", 62),
+ ("forest_flyby.blend", "EEVEE", "1-1200", "Queued", 0),
+ ("product_shot.blend", "Cycles", "1", "Done", 100),
+ ("studio_lighting.blend", "Cycles", "1-48", "Done", 100),
+ ("ocean_sim.blend", "EEVEE", "1-500", "Paused", 35),
+ ("title_card.blend", "EEVEE", "1-90", "Queued", 0),
+]
+
+
+def build(root):
+ root.title("Render Queue")
+
+ bar = ttk.Frame(root, padding=(8, 8, 8, 4))
+ bar.pack(fill="x")
+ ttk.Label(bar, text="Farm").pack(side="left")
+ farm = ttk.Combobox(bar, values=("Studio (8 nodes)", "Local GPU", "Cloud"), width=16,
+ state="readonly")
+ farm.current(0)
+ farm.pack(side="left", padx=(6, 12))
+ ttk.Label(bar, text="Priority").pack(side="left")
+ prio = ttk.Spinbox(bar, from_=1, to=10, width=4)
+ prio.set(5)
+ prio.pack(side="left", padx=6)
+ ttk.Button(bar, text="Add Job...").pack(side="right")
+
+ nb = ttk.Notebook(root)
+ nb.pack(fill="both", expand=True, padx=8, pady=4)
+ jobs = ttk.Frame(nb, padding=6)
+ nb.add(jobs, text="Jobs")
+ nb.add(ttk.Frame(nb), text="Nodes")
+ nb.add(ttk.Frame(nb), text="Log")
+
+ tree = ttk.Treeview(jobs, columns=("engine", "frames", "status", "done"),
+ show="tree headings", height=6)
+ tree.heading("#0", text="File")
+ tree.heading("engine", text="Engine")
+ tree.heading("frames", text="Frames")
+ tree.heading("status", text="Status")
+ tree.heading("done", text="Done")
+ tree.column("#0", width=170)
+ for c, w in (("engine", 90), ("frames", 70), ("status", 95), ("done", 50)):
+ tree.column(c, width=w, anchor="center" if c != "engine" else "w")
+ first = None
+ for name, engine, frames, status, pct in JOBS:
+ iid = tree.insert("", "end", text=name, values=(engine, frames, status, "%d%%" % pct))
+ first = first or iid
+ tree.selection_set(first)
+ tree.pack(fill="both", expand=True)
+
+ detail = ttk.LabelFrame(jobs, text="robot_arm.blend", padding=6)
+ detail.pack(fill="x", pady=(6, 0))
+ detail.columnconfigure(1, weight=1)
+ ttk.Label(detail, text="Frame 149 / 240").grid(row=0, column=0, sticky="w")
+ pb = ttk.Progressbar(detail, maximum=100, value=62)
+ pb.grid(row=0, column=1, sticky="we", padx=8)
+ ttk.Label(detail, text="ETA 00:18:40").grid(row=0, column=2, sticky="e")
+ opts = ttk.Frame(detail)
+ opts.grid(row=1, column=0, columnspan=3, sticky="we", pady=(6, 0))
+ ttk.Checkbutton(opts, text="Notify when done", variable=tk.BooleanVar(root, True)).pack(
+ side="left")
+ ttk.Checkbutton(opts, text="Shut down nodes", variable=tk.BooleanVar(root, False)).pack(
+ side="left", padx=10)
+ ttk.Button(opts, text="Cancel").pack(side="right")
+ ttk.Button(opts, text="Pause").pack(side="right", padx=6)
+
+ status = ttk.Frame(root, padding=(8, 2, 8, 8))
+ status.pack(fill="x")
+ ttk.Label(status, text="6 jobs · 2 done · 8 of 8 nodes online").pack(side="left")
+ ttk.Sizegrip(status).pack(side="right")
+ return root
+
+
+if __name__ == "__main__":
+ build(tk.Tk()).mainloop()
diff --git a/kit/CMakeLists.txt b/kit/CMakeLists.txt
index 40b573c..4463ebf 100644
--- a/kit/CMakeLists.txt
+++ b/kit/CMakeLists.txt
@@ -7,6 +7,7 @@
add_library(bui_kit STATIC
intern/kit_core.c
intern/kit_draw.c
+ intern/kit_theme_presets.c
intern/kit_icons_data.c
intern/kit_widgets.c
intern/kit_views.c
diff --git a/kit/include/BUI_kit.h b/kit/include/BUI_kit.h
index f1c89c8..c57f0ed 100644
--- a/kit/include/BUI_kit.h
+++ b/kit/include/BUI_kit.h
@@ -90,6 +90,24 @@ void BK_set_scale(float scale); /* Blender's resolution scale (1 = 20 px widgets
float BK_scale(void);
int BK_unit(void); /* U.widget_unit in pixels */
void BK_set_font(const char *family);
+/* Themes: Blender's two presets, "dark" (Blender_Dark.xml = the built-in
+ * default) and "light" (Blender_Light.xml), any case ("Blender Light" works
+ * too). Every context relayouts and redraws (its host gets a request).
+ * Returns 0 for an unknown name (the theme stays). Without a call the
+ * BUI_THEME environment variable (dark|light) picks the first theme. */
+int BK_set_theme(const char *name);
+const char *BK_theme_name(void); /* "dark" or "light" */
+/* A color of the active theme as RGBA 0..1: "region_bg", "header_bg",
+ * "tabs_bg", "panel_header", "panel_back", "panel_sub_back", "panel_outline",
+ * "text", "text_hi", "emboss", "cursor", "selection", "file_back",
+ * "file_text", "file_header", "file_row_alternate", "node_back", "node_grid",
+ * "node_wire", "node_body", "node_outline", "node_selected", "node_active",
+ * "area_header", or
+ * "<set>.<color>" for a widget color set (regular tool toggle radio option
+ * textfield num numslider menu pulldown menu_back menu_item list_item box
+ * scroll progress tooltip tab pie_menu curve; outline outline_sel inner
+ * inner_sel item text text_sel), e.g. "regular.inner". 0 when unknown. */
+int BK_theme_color(const char *key, float r_rgba[4]);
int BK_icon_id(const char *name); /* 0 when unknown */
int BK_icon_count(void);
const char *BK_icon_name(int id);
diff --git a/kit/intern/kit_core.c b/kit/intern/kit_core.c
index 7a95cf3..67d98d1 100644
--- a/kit/intern/kit_core.c
+++ b/kit/intern/kit_core.c
@@ -23,6 +23,10 @@
#include "BUI_blender_c.h"
#include "blender/bk_blender.h"
#include "kit_intern.h"
+#include <stddef.h>
+
+int bk_theme_gen = 0;
+static BKContext *g_contexts = NULL; /* every live context (themes redraw them) */
/* Blender's UTF-8 cursor stepping (blenlib, linked from bui_core). */
typedef enum { STRCUR_JUMP_NONE, STRCUR_JUMP_DELIM, STRCUR_JUMP_ALL } eStrCursorJumpType;
@@ -1378,6 +1382,9 @@ BKContext *BK_context_new(BKNode *root)
if (root) {
root->ctx_root = ctx;
}
+ bk_theme_env_init();
+ ctx->next_ctx = g_contexts;
+ g_contexts = ctx;
return ctx;
}
@@ -1396,9 +1403,156 @@ void BK_context_free(BKContext *ctx)
if (ctx->header) {
ctx->header->ctx_root = NULL;
}
+ for (BKContext **p = &g_contexts; *p; p = &(*p)->next_ctx) {
+ if (*p == ctx) {
+ *p = ctx->next_ctx;
+ break;
+ }
+ }
free(ctx);
}
+/* -------------------------------------------------------------------- */
+/* Themes: Blender's Dark (default) and Light presets (kit_theme_presets.c) */
+
+static int g_theme_light = 0, g_theme_set = 0;
+
+static int theme_from_name(const char *name)
+{
+ /* "dark" / "light", any case; Blender's preset names work too */
+ char buf[32];
+ int n = 0;
+ for (; name && name[n] && n < (int)sizeof(buf) - 1; n++) {
+ buf[n] = (char)tolower((unsigned char)name[n]);
+ }
+ buf[n] = 0;
+ const char *s = buf;
+ if (strncmp(s, "blender", 7) == 0) {
+ s += 7;
+ while (*s == ' ' || *s == '_' || *s == '-') {
+ s++;
+ }
+ }
+ if (strcmp(s, "dark") == 0 || strcmp(s, "default") == 0) {
+ return 0;
+ }
+ if (strcmp(s, "light") == 0) {
+ return 1;
+ }
+ return -1;
+}
+
+static void theme_apply(int light)
+{
+ g_theme_light = light;
+ bk_theme = light ? bk_theme_light : bk_theme_dark;
+ bk_theme_gen++;
+ for (BKContext *c = g_contexts; c; c = c->next_ctx) {
+ c->layout_dirty = true; /* shadow widths size popups */
+ c->full_dirty = true;
+ if (c->host.request) {
+ c->host.request(c->host.data);
+ }
+ }
+}
+
+void bk_theme_env_init(void)
+{
+ if (g_theme_set) {
+ return;
+ }
+ g_theme_set = 1;
+ const char *env = getenv("BUI_THEME");
+ const int t = env && *env ? theme_from_name(env) : -1;
+ if (t > 0) {
+ theme_apply(t);
+ }
+}
+
+int BK_set_theme(const char *name)
+{
+ const int t = theme_from_name(name ? name : "dark");
+ if (t < 0) {
+ return 0;
+ }
+ g_theme_set = 1;
+ if (t != g_theme_light) {
+ theme_apply(t);
+ }
+ return 1;
+}
+
+const char *BK_theme_name(void)
+{
+ bk_theme_env_init();
+ return g_theme_light ? "light" : "dark";
+}
+
+#define TH_FIELD(f) {#f, offsetof(BKTheme, f)}
+static const struct {
+ const char *name;
+ size_t off;
+} k_theme_colors[] = {
+ TH_FIELD(region_bg), TH_FIELD(header_bg), TH_FIELD(tabs_bg),
+ TH_FIELD(panel_header), TH_FIELD(panel_back), TH_FIELD(panel_sub_back),
+ TH_FIELD(panel_outline), TH_FIELD(text), TH_FIELD(text_hi),
+ TH_FIELD(emboss), TH_FIELD(cursor), TH_FIELD(selection),
+ TH_FIELD(file_back), TH_FIELD(file_text), TH_FIELD(file_header),
+ TH_FIELD(file_row_alternate), TH_FIELD(node_back), TH_FIELD(node_grid),
+ TH_FIELD(node_wire), TH_FIELD(node_body), TH_FIELD(node_outline),
+ TH_FIELD(node_selected), TH_FIELD(node_active), TH_FIELD(area_header),
+},
+ k_theme_wcols[] = {
+ TH_FIELD(regular), TH_FIELD(tool), TH_FIELD(toggle), TH_FIELD(radio),
+ TH_FIELD(option), TH_FIELD(textfield), TH_FIELD(num), TH_FIELD(numslider),
+ TH_FIELD(menu), TH_FIELD(pulldown), TH_FIELD(menu_back), TH_FIELD(menu_item),
+ TH_FIELD(list_item), TH_FIELD(box), TH_FIELD(scroll), TH_FIELD(progress),
+ TH_FIELD(tooltip), TH_FIELD(tab), TH_FIELD(pie_menu), TH_FIELD(curve),
+},
+ k_wcol_fields[] = {
+ {"outline", offsetof(BKWCol, outline)}, {"outline_sel", offsetof(BKWCol, outline_sel)},
+ {"inner", offsetof(BKWCol, inner)}, {"inner_sel", offsetof(BKWCol, inner_sel)},
+ {"item", offsetof(BKWCol, item)}, {"text", offsetof(BKWCol, text)},
+ {"text_sel", offsetof(BKWCol, text_sel)},
+};
+#undef TH_FIELD
+
+int BK_theme_color(const char *key, float r_rgba[4])
+{
+ bk_theme_env_init();
+ if (!key) {
+ return 0;
+ }
+ const uchar *c = NULL;
+ const char *dot = strchr(key, '.');
+ if (!dot) {
+ for (size_t i = 0; i < sizeof(k_theme_colors) / sizeof(k_theme_colors[0]); i++) {
+ if (strcmp(key, k_theme_colors[i].name) == 0) {
+ c = (const uchar *)&bk_theme + k_theme_colors[i].off;
+ }
+ }
+ }
+ else {
+ const size_t n = (size_t)(dot - key);
+ for (size_t i = 0; i < sizeof(k_theme_wcols) / sizeof(k_theme_wcols[0]); i++) {
+ if (strlen(k_theme_wcols[i].name) == n && strncmp(key, k_theme_wcols[i].name, n) == 0) {
+ for (size_t j = 0; j < sizeof(k_wcol_fields) / sizeof(k_wcol_fields[0]); j++) {
+ if (strcmp(dot + 1, k_wcol_fields[j].name) == 0) {
+ c = (const uchar *)&bk_theme + k_theme_wcols[i].off + k_wcol_fields[j].off;
+ }
+ }
+ }
+ }
+ }
+ if (!c) {
+ return 0;
+ }
+ if (r_rgba) {
+ bk_rgba(c, r_rgba);
+ }
+ return 1;
+}
+
void BK_context_set_host(BKContext *ctx, const BKHost *host)
{
ctx->host = *host;
diff --git a/kit/intern/kit_draw.c b/kit/intern/kit_draw.c
index 8084a13..58e84a1 100644
--- a/kit/intern/kit_draw.c
+++ b/kit/intern/kit_draw.c
@@ -16,56 +16,8 @@
void rgb_to_hsl_v(const float rgb[3], float r_hsl[3]);
void hsl_to_rgb_v(const float hsl[3], float r_rgb[3]);
-/* -------------------------------------------------------------------- */
-/** \name Theme: Blender 5.x defaults (release/datafiles/userdef/userdef_default_theme.c)
- * \{ */
-
-#define RGBA(v) {(uchar)((v) >> 24), (uchar)((v) >> 16), (uchar)((v) >> 8), (uchar)(v)}
-#define WCOL(outline_, outline_sel_, inner_, inner_sel_, item_, text_, text_sel_, round_) \
- {RGBA(outline_), RGBA(outline_sel_), RGBA(inner_), RGBA(inner_sel_), RGBA(item_), \
- RGBA(text_), RGBA(text_sel_), 0, 0, 0, round_}
-
-BKTheme bk_theme = {
- /* regular */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x545454ffu, 0x4772b3ffu, 0x1d1d1d80u, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* tool */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x545454ffu, 0x4772b3ffu, 0xffffffffu, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* toggle */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x545454ffu, 0x4772b3ffu, 0x252525ffu, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* radio */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x545454ffu, 0x4772b3ffu, 0x252525ffu, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* option */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x545454ffu, 0x4772b3ffu, 0xffffffffu, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* text */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x1d1d1dffu, 0x181818ffu, 0xffffff33u, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* num */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x545454ffu, 0x222222ffu, 0x4772b3ffu, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* numslider */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x545454ffu, 0x222222ffu, 0x4772b3ffu, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* menu */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x282828ffu, 0x4772b3b3u, 0xd9d9d9ffu, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* pulldown */ WCOL(0x3d3d3d00u, 0x3d3d3d00u, 0x22222200u, 0xffffff1au, 0xffffff8fu, 0xd9d9d9ffu, 0xffffffffu, 0.2f),
- /* menu_back */ WCOL(0x242424ffu, 0x242424ffu, 0x181818ffu, 0x4772b3ffu, 0xd9d9d9ffu, 0x999999ffu, 0xffffffffu, 0.2f),
- /* menu_item */ WCOL(0x3d3d3d00u, 0x3d3d3d00u, 0x18181800u, 0x4772b3ffu, 0xffffff8fu, 0xddddddffu, 0xffffffffu, 0.2f),
- /* list_item */ WCOL(0x2d2d2d00u, 0x2d2d2dffu, 0xffffff00u, 0x4772b3ffu, 0xffffff33u, 0xccccccffu, 0xffffffffu, 0.2f),
- /* box */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x1d1d1d80u, 0x545454ffu, 0x191919ffu, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* scroll */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x22222200u, 0xffffffffu, 0x545454ffu, 0xe6e6e6ffu, 0xffffffffu, 0.5f),
- /* progress */ WCOL(0x3d3d3dffu, 0x3d3d3dffu, 0x222222ffu, 0x4772b3ffu, 0x4772b3ffu, 0xe6e6e6ffu, 0xffffffffu, 0.2f),
- /* tooltip */ WCOL(0x242424ffu, 0x242424ffu, 0x1d1d1dffu, 0x4772b3ffu, 0xd9d9d9ffu, 0xd9d9d9ffu, 0xffffffffu, 0.2f),
- /* tab */ WCOL(0x1d1d1dffu, 0x1d1d1dffu, 0x1d1d1dffu, 0x303030ffu, 0x1d1d1dffu, 0x989898ffu, 0xffffffffu, 0.2f),
- /* pie_menu */ WCOL(0x242424ffu, 0x242424ffu, 0x181818ffu, 0x4772b3ffu, 0x545454ffu, 0xd9d9d9ffu, 0xffffffffu, 0.2f),
- /* curve (wcol_curve) */ WCOL(0x727272ffu, 0x9a9a9affu, 0x545454ffu, 0x000000ffu, 0x00000059u, 0x08080800u, 0xc9c9c900u, 0.2f),
- RGBA(0x303030ff), /* region_bg */
- RGBA(0x181818ff), /* header_bg (top bar) */
- RGBA(0x181818ff), /* tabs_bg (navigation bar: regions.sidebars.tab_back) */
- RGBA(0x3d3d3dff), /* panel_header */
- RGBA(0x3d3d3dff), /* panel_back */
- RGBA(0x0000001fu), /* panel_sub_back */
- RGBA(0xffffff11u), /* panel_outline */
- RGBA(0xe6e6e6ff), /* text */
- RGBA(0xffffffff), /* text_hi */
- RGBA(0x00000026u), /* widget_emboss */
- RGBA(0x71a8ffff), /* text cursor */
- RGBA(0x4772b380u), /* text selection */
- 0.2f, /* menu_shadow_fac */
- 6, /* menu_shadow_width */
- 0.4f, /* panel_roundness */
- RGBA(0x282828ffu), /* space_file.back */
- RGBA(0xe6e6e6ffu), /* space_file.text */
- RGBA(0x303030b3u), /* space_file.header */
- RGBA(0xffffff04u), /* space_file.row_alternate */
-};
+/* The theme tables (bk_theme, bk_theme_dark, bk_theme_light) live in
+ * kit_theme_presets.c, generated by tools/gen_theme.py; BK_set_theme is in kit_core.c. */
float bk_scale_fac = 1.0f;
static char g_font_family[64] = "";
diff --git a/kit/intern/kit_filebrowser_posix.c b/kit/intern/kit_filebrowser_posix.c
index 0c20e9f..36966d0 100644
--- a/kit/intern/kit_filebrowser_posix.c
+++ b/kit/intern/kit_filebrowser_posix.c
@@ -213,6 +213,7 @@ static bool read_volumes(FBData *f)
fb_path_join(p, sizeof(p), "/Volumes", de->d_name);
if (de->d_name[0] != '.') {
fb_place_add(f, FB_CAT_VOLUMES, p, de->d_name, "DISK_DRIVE", true);
+ found = true; /* the boot volume is listed here too: no extra "/" entry */
}
}
if (d) {
diff --git a/kit/intern/kit_intern.h b/kit/intern/kit_intern.h
index a143ca4..707833d 100644
--- a/kit/intern/kit_intern.h
+++ b/kit/intern/kit_intern.h
@@ -55,9 +55,18 @@ typedef struct BKTheme {
float panel_roundness;
/* space_file */
uchar file_back[4], file_text[4], file_header[4], file_row_alternate[4];
+ /* space_node */
+ uchar node_back[4], node_grid[4], node_wire[4], node_body[4], node_outline[4],
+ node_selected[4], node_active[4];
+ uchar area_header[4]; /* editor headers (TH_HEADER) */
} BKTheme;
+/* The active theme and the presets (kit_theme_presets.c, generated by
+ * tools/gen_theme.py from Blender's interface_theme presets). BK_set_theme
+ * copies a preset into bk_theme and bumps bk_theme_gen (contexts redraw). */
extern BKTheme bk_theme;
+extern const BKTheme bk_theme_dark, bk_theme_light;
+extern int bk_theme_gen;
/* Metrics (U.widget_unit, U.pixelsize, UI text size). */
extern float bk_scale_fac;
@@ -530,8 +539,13 @@ struct BKContext {
int next_button; /* the button the next in_BK_press / in_BK_release is for (0 = 1) */
int in_custom_frame; /* inside custom frame callbacks: no host requests */
double custom_timer_due; /* armed BK_TIMER_CUSTOM (bk_time), 0 = none */
+ /* every live context (BK_set_theme redraws them all) */
+ BKContext *next_ctx;
};
+/* Applies BUI_THEME the first time a theme is needed (unless BK_set_theme ran). */
+void bk_theme_env_init(void);
+
/* Custom nodes (kit_custom.c). The host timer that wakes them. */
#define BK_TIMER_CUSTOM (-1)
extern const BKClass bk_cls_custom;
diff --git a/kit/intern/kit_menus.c b/kit/intern/kit_menus.c
index 56dc2a4..a0b66e2 100644
--- a/kit/intern/kit_menus.c
+++ b/kit/intern/kit_menus.c
@@ -20,6 +20,8 @@
#include "blender/bk_blender.h"
#include "kit_intern.h"
+static void menu_text_path(float x, float baseline, float cy, const char *s, const uchar c[4]);
+
static int u(void)
{
return bk_unit();
@@ -722,7 +724,7 @@ static void menu_draw(BKNode *n)
}
bk_clip_push(row.xmin, row.ymin, bk_rw(&row), rh);
BKRect lr = bk_rect(row.xmin, ry, bk_rw(&row), rh);
- bk_text(tx, bk_text_baseline(&lr), it->text, -1, w.text, false);
+ menu_text_path(tx, bk_text_baseline(&lr), ry + rh * 0.5f, it->text, w.text);
if (it->shortcut) {
uchar sc[4];
memcpy(sc, w.text, 4);
@@ -742,6 +744,29 @@ static void menu_draw(BKNode *n)
}
}
+/* Search results read "Menu > Item" (UI_MENU_ARROW_SEP). The UI font has no
+ * U+25B8, so the separators are drawn as small triangles (Blender's glyph). */
+static void menu_text_path(float x, float baseline, float cy, const char *s, const uchar c[4])
+{
+ static const char sep[] = " \xe2\x96\xb8 ";
+ const int sl = (int)sizeof(sep) - 1;
+ float fc[4];
+ bk_rgba(c, fc);
+ for (;;) {
+ const char *hit = strstr(s, sep);
+ const int len = hit ? (int)(hit - s) : (int)strlen(s);
+ bk_text(x, baseline, s, len, c, false);
+ if (!hit) {
+ return;
+ }
+ x += bk_text_width(s, len, false);
+ const float gap = bk_text_width(" ", 1, false), tri = 0.3f * bk_font_size();
+ bk_tria(x + gap + tri * 0.4f, cy, 'h', fc, tri * 0.5f);
+ x += 2.0f * gap + tri;
+ s = hit + sl;
+ }
+}
+
static void menu_free(BKNode *n)
{
MenuData *m = MENU(n);
diff --git a/kit/intern/kit_nodes.c b/kit/intern/kit_nodes.c
index 21ec015..2fc09a0 100644
--- a/kit/intern/kit_nodes.c
+++ b/kit/intern/kit_nodes.c
@@ -379,14 +379,6 @@ const BKClass bk_cls_graphnode = {.name = "graphnode",
/** \name Drawing (node_draw.cc)
* \{ */
-static void color_u(uint32_t rgba, float c[4])
-{
- c[0] = ((rgba >> 24) & 255) / 255.0f;
- c[1] = ((rgba >> 16) & 255) / 255.0f;
- c[2] = ((rgba >> 8) & 255) / 255.0f;
- c[3] = (rgba & 255) / 255.0f;
-}
-
/* view2d_dot_grid_draw (view2d.cc), called by node_draw_space with min_step =
* NODE_GRID_STEP_SIZE (20 * UI_SCALE_FAC view units) and the theme's grid_levels (3). View units
* are graph units * UI_SCALE_FAC, so zoom_x (px per view unit) is the editor zoom. Each level is
@@ -396,7 +388,7 @@ static void draw_grid(BKNode *e)
{
const int grid_subdivisions = 3; /* space_node.grid_levels */
float c[4];
- color_u(0x303030ff, c); /* space_node.grid */
+ bk_rgba(bk_theme.node_grid, c); /* space_node.grid */
const float zoom = BK_MAX(1e-4f, ed(e)->zoom), px = bk_px();
const float min_point_size = 2.0f * px, max_point_size = 1.5f * min_point_size;
const float view_level = logf(NODE_DY * bk_scale_fac / zoom) / logf(5.0f);
@@ -464,7 +456,7 @@ static void draw_noodle(float x0, float y0, float x3, float y3, const float colo
const float link_w = 2.5f * BK_MAX(bk_scale_fac * zoom, 1.0f);
const float th = 2.0f * link_w * 0.65f, outline_w = 2.0f * link_w;
float wire[4];
- color_u(0x1a1a1aff, wire); /* space_node.wire */
+ bk_rgba(bk_theme.node_wire, wire); /* space_node.wire */
float inner[4];
memcpy(inner, color, sizeof(inner));
if (hi) { /* edge_select: links of selected nodes brighten */
@@ -484,7 +476,8 @@ static void draw_socket(float x, float y, const char *type, float s)
{
/* node_socket_outline_color_get: the theme wire color, opaque */
float c[4], o[4];
- color_u(0x1a1a1aff, o);
+ bk_rgba(bk_theme.node_wire, o);
+ o[3] = 1.0f;
socket_color(type, c);
const float r = NODE_SOCKSIZE * s;
bk_circle(x, y, r + BK_MAX(1.0f, bk_scale_fac), o);
@@ -520,14 +513,16 @@ static void draw_node(BKNode *e, BKNode *node, int index)
bk_roundbox(x - 1.0f * s, y + 1.0f * s, w + 2.0f * s, h + 2.0f * s, rad + s, CNR_ALL, shadow);
/* body (TH_NODE) and header (the node class color) */
float body[4], head[4];
- color_u(0x303030ff, body); /* space_node.syntaxl */
+ bk_rgba(bk_theme.node_body, body); /* space_node.syntaxl (node_backdrop) */
memcpy(head, node->color, sizeof(head));
head[3] = 1.0f;
bk_roundbox(x, y, w, h, rad, CNR_ALL, body);
bk_roundbox(x, y, w, hh, rad, g->collapsed ? CNR_ALL : (CNR_TL | CNR_TR), head);
/* the outline: node_outline, or select / active */
float line[4];
- color_u(g->active && selected ? 0xffffffff : (selected ? 0xed5700ff : 0xffffff26), line);
+ bk_rgba(g->active && selected ? bk_theme.node_active
+ : (selected ? bk_theme.node_selected : bk_theme.node_outline),
+ line);
BuiWidgetBase wb = {{x, y, w, h}, rad, rad - 1.0f, CNR_ALL};
memcpy(wb.outline, line, sizeof(line));
wb.pixelsize = selected ? 1.5f * bk_scale_fac : 1.0f;
@@ -583,7 +578,7 @@ static void link_ends(const BKNode *e, const Link *l, float *x0, float *y0, floa
static void editor_draw(BKNode *e)
{
float back[4];
- color_u(0x1a1a1aff, back); /* space_node.back */
+ bk_rgba(bk_theme.node_back, back); /* space_node.back */
bk_fill_f((float)e->x, (float)e->y, (float)e->w, (float)e->h, back);
bk_clip_push(e->x, e->y, e->w, e->h);
draw_grid(e);
diff --git a/kit/intern/kit_regions.c b/kit/intern/kit_regions.c
index c8c6017..88630c1 100644
--- a/kit/intern/kit_regions.c
+++ b/kit/intern/kit_regions.c
@@ -371,8 +371,7 @@ static void areaheader_arrange(BKNode *n)
static void areaheader_draw(BKNode *n)
{
/* TH_HEADER of the editors (space_view3d.header and friends) */
- const uchar c[4] = {0x30, 0x30, 0x30, 0xff};
- bk_fill(n->x, n->y, n->w, n->h, c);
+ bk_fill(n->x, n->y, n->w, n->h, bk_theme.area_header);
}
const BKClass bk_cls_areaheader = {.name = "areaheader",
diff --git a/kit/intern/kit_theme_presets.c b/kit/intern/kit_theme_presets.c
new file mode 100644
index 0000000..6a38c10
--- /dev/null
+++ b/kit/intern/kit_theme_presets.c
@@ -0,0 +1,160 @@
+/* Generated by tools/gen_theme.py from Blender's interface theme presets
+ * (scripts/presets/interface_theme/Blender_Dark.xml, Blender_Light.xml) over
+ * the built-in defaults (userdef_default_theme.c). Do not edit.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "kit_intern.h"
+
+#define RGBA(v) {(uchar)((v) >> 24), (uchar)((v) >> 16), (uchar)((v) >> 8), (uchar)(v)}
+
+/* The active theme (starts as Blender's default, dark). */
+BKTheme bk_theme = {
+ /* regular */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x4772b3ffu), RGBA(0x1d1d1d80u), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* tool */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x4772b3ffu), RGBA(0xffffffffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* toggle */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x4772b3ffu), RGBA(0x252525ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* radio */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x4772b3ffu), RGBA(0x252525ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* option */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x4772b3ffu), RGBA(0xffffffffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* textfield */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x1d1d1dffu), RGBA(0x181818ffu), RGBA(0xffffff33u), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* num */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x222222ffu), RGBA(0x4772b3ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* numslider */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x222222ffu), RGBA(0x4772b3ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* menu */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x282828ffu), RGBA(0x4772b3b3u), RGBA(0xd9d9d9ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* pulldown */ {RGBA(0x3d3d3d00u), RGBA(0x3d3d3d00u), RGBA(0x22222200u), RGBA(0xffffff1au), RGBA(0xffffff8fu), RGBA(0xd9d9d9ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* menu_back */ {RGBA(0x242424ffu), RGBA(0x242424ffu), RGBA(0x181818ffu), RGBA(0x4772b3ffu), RGBA(0xd9d9d9ffu), RGBA(0x999999ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* menu_item */ {RGBA(0x3d3d3d00u), RGBA(0x3d3d3d00u), RGBA(0x18181800u), RGBA(0x4772b3ffu), RGBA(0xffffff8fu), RGBA(0xddddddffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* list_item */ {RGBA(0x2d2d2d00u), RGBA(0x2d2d2dffu), RGBA(0xffffff00u), RGBA(0x4772b3ffu), RGBA(0xffffff33u), RGBA(0xccccccffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* box */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x1d1d1d80u), RGBA(0x545454ffu), RGBA(0x191919ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* scroll */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x22222200u), RGBA(0xffffffffu), RGBA(0x545454ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.5f},
+ /* progress */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x222222ffu), RGBA(0x4772b3ffu), RGBA(0x4772b3ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* tooltip */ {RGBA(0x242424ffu), RGBA(0x242424ffu), RGBA(0x1d1d1dffu), RGBA(0x4772b3ffu), RGBA(0xd9d9d9ffu), RGBA(0xd9d9d9ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* tab */ {RGBA(0x1d1d1dffu), RGBA(0x1d1d1dffu), RGBA(0x1d1d1dffu), RGBA(0x303030ffu), RGBA(0x1d1d1dffu), RGBA(0x989898ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* pie_menu */ {RGBA(0x242424ffu), RGBA(0x242424ffu), RGBA(0x181818ffu), RGBA(0x4772b3ffu), RGBA(0x545454ffu), RGBA(0xd9d9d9ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* curve */ {RGBA(0x727272ffu), RGBA(0x9a9a9affu), RGBA(0x545454ffu), RGBA(0x000000ffu), RGBA(0x00000059u), RGBA(0x08080800u), RGBA(0xc9c9c900u), 0, 0, 0, 0.2f},
+ RGBA(0x303030ffu), /* region_bg */
+ RGBA(0x181818ffu), /* header_bg */
+ RGBA(0x181818ffu), /* tabs_bg */
+ RGBA(0x3d3d3dffu), /* panel_header */
+ RGBA(0x3d3d3dffu), /* panel_back */
+ RGBA(0x0000001fu), /* panel_sub_back */
+ RGBA(0xffffff11u), /* panel_outline */
+ RGBA(0xe6e6e6ffu), /* text */
+ RGBA(0xffffffffu), /* text_hi */
+ RGBA(0x00000026u), /* emboss */
+ RGBA(0x71a8ffffu), /* cursor */
+ RGBA(0x4772b380u), /* selection */
+ 0.2f, /* menu_shadow_fac */
+ 6, /* menu_shadow_width */
+ 0.4f, /* panel_roundness */
+ RGBA(0x282828ffu), /* file_back */
+ RGBA(0xe6e6e6ffu), /* file_text */
+ RGBA(0x303030b3u), /* file_header */
+ RGBA(0xffffff04u), /* file_row_alternate */
+ RGBA(0x1a1a1affu), /* node_back */
+ RGBA(0x303030ffu), /* node_grid */
+ RGBA(0x1a1a1affu), /* node_wire */
+ RGBA(0x303030ffu), /* node_body */
+ RGBA(0xffffff26u), /* node_outline */
+ RGBA(0xed5700ffu), /* node_selected */
+ RGBA(0xffffffffu), /* node_active */
+ RGBA(0x303030ffu), /* area_header */
+};
+
+const BKTheme bk_theme_dark = {
+ /* regular */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x4772b3ffu), RGBA(0x1d1d1d80u), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* tool */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x4772b3ffu), RGBA(0xffffffffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* toggle */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x4772b3ffu), RGBA(0x252525ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* radio */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x4772b3ffu), RGBA(0x252525ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* option */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x4772b3ffu), RGBA(0xffffffffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* textfield */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x1d1d1dffu), RGBA(0x181818ffu), RGBA(0xffffff33u), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* num */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x222222ffu), RGBA(0x4772b3ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* numslider */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x545454ffu), RGBA(0x222222ffu), RGBA(0x4772b3ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* menu */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x282828ffu), RGBA(0x4772b3b3u), RGBA(0xd9d9d9ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* pulldown */ {RGBA(0x3d3d3d00u), RGBA(0x3d3d3d00u), RGBA(0x22222200u), RGBA(0xffffff1au), RGBA(0xffffff8fu), RGBA(0xd9d9d9ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* menu_back */ {RGBA(0x242424ffu), RGBA(0x242424ffu), RGBA(0x181818ffu), RGBA(0x4772b3ffu), RGBA(0xd9d9d9ffu), RGBA(0x999999ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* menu_item */ {RGBA(0x3d3d3d00u), RGBA(0x3d3d3d00u), RGBA(0x18181800u), RGBA(0x4772b3ffu), RGBA(0xffffff8fu), RGBA(0xddddddffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* list_item */ {RGBA(0x2d2d2d00u), RGBA(0x2d2d2dffu), RGBA(0xffffff00u), RGBA(0x4772b3ffu), RGBA(0xffffff33u), RGBA(0xccccccffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* box */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x1d1d1d80u), RGBA(0x545454ffu), RGBA(0x191919ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* scroll */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x22222200u), RGBA(0xffffffffu), RGBA(0x545454ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.5f},
+ /* progress */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x222222ffu), RGBA(0x4772b3ffu), RGBA(0x4772b3ffu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* tooltip */ {RGBA(0x242424ffu), RGBA(0x242424ffu), RGBA(0x1d1d1dffu), RGBA(0x4772b3ffu), RGBA(0xd9d9d9ffu), RGBA(0xd9d9d9ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* tab */ {RGBA(0x1d1d1dffu), RGBA(0x1d1d1dffu), RGBA(0x1d1d1dffu), RGBA(0x303030ffu), RGBA(0x1d1d1dffu), RGBA(0x989898ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* pie_menu */ {RGBA(0x242424ffu), RGBA(0x242424ffu), RGBA(0x181818ffu), RGBA(0x4772b3ffu), RGBA(0x545454ffu), RGBA(0xd9d9d9ffu), RGBA(0xffffffffu), 0, 0, 0, 0.2f},
+ /* curve */ {RGBA(0x727272ffu), RGBA(0x9a9a9affu), RGBA(0x545454ffu), RGBA(0x000000ffu), RGBA(0x00000059u), RGBA(0x08080800u), RGBA(0xc9c9c900u), 0, 0, 0, 0.2f},
+ RGBA(0x303030ffu), /* region_bg */
+ RGBA(0x181818ffu), /* header_bg */
+ RGBA(0x181818ffu), /* tabs_bg */
+ RGBA(0x3d3d3dffu), /* panel_header */
+ RGBA(0x3d3d3dffu), /* panel_back */
+ RGBA(0x0000001fu), /* panel_sub_back */
+ RGBA(0xffffff11u), /* panel_outline */
+ RGBA(0xe6e6e6ffu), /* text */
+ RGBA(0xffffffffu), /* text_hi */
+ RGBA(0x00000026u), /* emboss */
+ RGBA(0x71a8ffffu), /* cursor */
+ RGBA(0x4772b380u), /* selection */
+ 0.2f, /* menu_shadow_fac */
+ 6, /* menu_shadow_width */
+ 0.4f, /* panel_roundness */
+ RGBA(0x282828ffu), /* file_back */
+ RGBA(0xe6e6e6ffu), /* file_text */
+ RGBA(0x303030b3u), /* file_header */
+ RGBA(0xffffff04u), /* file_row_alternate */
+ RGBA(0x1a1a1affu), /* node_back */
+ RGBA(0x303030ffu), /* node_grid */
+ RGBA(0x1a1a1affu), /* node_wire */
+ RGBA(0x303030ffu), /* node_body */
+ RGBA(0xffffff26u), /* node_outline */
+ RGBA(0xed5700ffu), /* node_selected */
+ RGBA(0xffffffffu), /* node_active */
+ RGBA(0x303030ffu), /* area_header */
+};
+
+const BKTheme bk_theme_light = {
+ /* regular */ {RGBA(0x4d4d4dffu), RGBA(0x3d3d3dffu), RGBA(0xdbdbdbffu), RGBA(0x668cccffu), RGBA(0x191919ffu), RGBA(0x1a1a1affu), RGBA(0xffffffffu), 0, 0, -5, 0.4f},
+ /* tool */ {RGBA(0x4d4d4dffu), RGBA(0x3d3d3dffu), RGBA(0xdbdbdbffu), RGBA(0x5680c2ffu), RGBA(0x191919ffu), RGBA(0x000000ffu), RGBA(0xffffffffu), 0, 0, -5, 0.4f},
+ /* toggle */ {RGBA(0x4d4d4dffu), RGBA(0x3d3d3dffu), RGBA(0xdbdbdbffu), RGBA(0x5680c2ffu), RGBA(0x191919ffu), RGBA(0x000000ffu), RGBA(0xffffffffu), 0, 0, 0, 0.4f},
+ /* radio */ {RGBA(0x4d4d4dffu), RGBA(0x3d3d3dffu), RGBA(0x3b3b3bffu), RGBA(0x5680c2e6u), RGBA(0xffffffffu), RGBA(0xd9d9d9ffu), RGBA(0xffffffffu), 0, 5, -5, 0.4f},
+ /* option */ {RGBA(0x4d4d4dffu), RGBA(0x3d3d3dffu), RGBA(0x3c3c3cffu), RGBA(0x5680c2ffu), RGBA(0xffffffffu), RGBA(0x1a1a1affu), RGBA(0x000000ffu), 1, -5, 0, 0.4f},
+ /* textfield */ {RGBA(0x4d4d4dffu), RGBA(0x3d3d3dffu), RGBA(0x282828ffu), RGBA(0x333333ffu), RGBA(0xffffff33u), RGBA(0xddddddffu), RGBA(0xffffffffu), 1, -8, 0, 0.4f},
+ /* num */ {RGBA(0x4d4d4dffu), RGBA(0x3d3d3dffu), RGBA(0xd3d3d3ffu), RGBA(0x5680c2ffu), RGBA(0x80b1ffffu), RGBA(0x1a1a1affu), RGBA(0xffffffffu), 1, 3, 0, 0.4f},
+ /* numslider */ {RGBA(0x4d4d4dffu), RGBA(0x3d3d3dffu), RGBA(0x999999ffu), RGBA(0xb0b0b0ffu), RGBA(0xe6e6e6ffu), RGBA(0x1a1a1affu), RGBA(0x000000ffu), 1, -3, 0, 0.4f},
+ /* menu */ {RGBA(0x3d3d3dffu), RGBA(0x3d3d3dffu), RGBA(0x3b3b3bffu), RGBA(0x767676ffu), RGBA(0x808080ffu), RGBA(0xd9d9d9ffu), RGBA(0xffffffffu), 0, 10, -10, 0.4f},
+ /* pulldown */ {RGBA(0x4d4d4dffu), RGBA(0x3d3d3d00u), RGBA(0xb3b3b3ccu), RGBA(0x5680c2e6u), RGBA(0x727272ffu), RGBA(0x1a1a1affu), RGBA(0xffffffffu), 0, 25, -20, 0.4f},
+ /* menu_back */ {RGBA(0xa6a6a6ffu), RGBA(0x242424ffu), RGBA(0xc0c0c0ffu), RGBA(0xcdcdcdffu), RGBA(0x727272ffu), RGBA(0x4d4d4dffu), RGBA(0x1a1a1affu), 0, 25, -20, 0.4f},
+ /* menu_item */ {RGBA(0x00000000u), RGBA(0x3d3d3d00u), RGBA(0x00000000u), RGBA(0x5680c2e6u), RGBA(0xffffff8fu), RGBA(0x1a1a1affu), RGBA(0xffffffffu), 0, 38, 0, 0.4f},
+ /* list_item */ {RGBA(0xe6e6e600u), RGBA(0x2d2d2dffu), RGBA(0x1a1a1a00u), RGBA(0x668cccffu), RGBA(0xffffff33u), RGBA(0x1a1a1affu), RGBA(0xffffffffu), 0, 0, 0, 0.4f},
+ /* box */ {RGBA(0x4d4d4dffu), RGBA(0x3d3d3dffu), RGBA(0x80808080u), RGBA(0x5680c2ffu), RGBA(0x191919ffu), RGBA(0x333333ffu), RGBA(0xffffffffu), 0, 0, 0, 0.4f},
+ /* scroll */ {RGBA(0x999999ffu), RGBA(0x3d3d3dffu), RGBA(0x50505000u), RGBA(0x646464b3u), RGBA(0x303030ffu), RGBA(0x000000ffu), RGBA(0xffffffffu), 0, 5, -5, 1.0f},
+ /* progress */ {RGBA(0xb3b3b3ffu), RGBA(0x3d3d3dffu), RGBA(0xccccccffu), RGBA(0x646464b4u), RGBA(0x5094ffffu), RGBA(0x000000ffu), RGBA(0xffffffffu), 0, 0, 0, 0.4f},
+ /* tooltip */ {RGBA(0x19191affu), RGBA(0x242424ffu), RGBA(0x19191aefu), RGBA(0x19191aefu), RGBA(0x19191aefu), RGBA(0xe6e6e6ffu), RGBA(0xffffffffu), 0, 25, -20, 0.4f},
+ /* tab */ {RGBA(0x33333300u), RGBA(0x1d1d1dffu), RGBA(0x808080ccu), RGBA(0xb3b3b3ffu), RGBA(0x28292dffu), RGBA(0x1a1a1affu), RGBA(0x000000ffu), 0, 0, 0, 0.4f},
+ /* pie_menu */ {RGBA(0x333333ffu), RGBA(0x242424ffu), RGBA(0x212121efu), RGBA(0x5680c2e6u), RGBA(0x585858ffu), RGBA(0xd9d9d9ffu), RGBA(0xffffffffu), 0, 10, -10, 0.4f},
+ /* curve */ {RGBA(0x727272ffu), RGBA(0x9a9a9affu), RGBA(0x545454ffu), RGBA(0x000000ffu), RGBA(0x00000059u), RGBA(0x08080800u), RGBA(0xc9c9c900u), 0, 0, 0, 0.2f},
+ RGBA(0xb3b3b3ffu), /* region_bg */
+ RGBA(0x999999ffu), /* header_bg */
+ RGBA(0xb3b3b3ffu), /* tabs_bg */
+ RGBA(0xccccccffu), /* panel_header */
+ RGBA(0xccccccffu), /* panel_back */
+ RGBA(0x0000001fu), /* panel_sub_back */
+ RGBA(0xffffff22u), /* panel_outline */
+ RGBA(0x000000ffu), /* text */
+ RGBA(0xffffffffu), /* text_hi */
+ RGBA(0x00000026u), /* emboss */
+ RGBA(0x3399e6ffu), /* cursor */
+ RGBA(0x668ccc80u), /* selection */
+ 0.3f, /* menu_shadow_fac */
+ 4, /* menu_shadow_width */
+ 0.4f, /* panel_roundness */
+ RGBA(0x999999ffu), /* file_back */
+ RGBA(0x000000ffu), /* file_text */
+ RGBA(0xadadadffu), /* file_header */
+ RGBA(0xffffff0fu), /* file_row_alternate */
+ RGBA(0x1d1d1dffu), /* node_back */
+ RGBA(0x282828ffu), /* node_grid */
+ RGBA(0x1a1a1affu), /* node_wire */
+ RGBA(0x666666ffu), /* node_body */
+ RGBA(0x00000026u), /* node_outline */
+ RGBA(0xed5700ffu), /* node_selected */
+ RGBA(0xffffffffu), /* node_active */
+ RGBA(0xb3b3b3ffu), /* area_header */
+};
diff --git a/public/Logo.png b/public/Logo.png
new file mode 100644
index 0000000..38a9491
Binary files /dev/null and b/public/Logo.png differ
diff --git a/public/Logo.psd b/public/Logo.psd
new file mode 100644
index 0000000..fb3c956
Binary files /dev/null and b/public/Logo.psd differ
diff --git a/pyproject.toml b/pyproject.toml
index 30085ab..26338ef 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -40,6 +40,7 @@ qt = ["PySide6>=6.5"] # only for bui.qt.BuiCanvas (embedding in a rea
test = []
[project.urls]
+Homepage = "https://bui.preetham.top"
Documentation = "https://github.com/ppmpreetham/BUI/tree/main/docs"
Source = "https://github.com/ppmpreetham/BUI"
Issues = "https://github.com/ppmpreetham/BUI/issues"
@@ -51,7 +52,9 @@ blenderui-tk = "bui.tksyntax.__main__:main" # blenderui-tk app.py == python -m
[tool.scikit-build]
minimum-version = "build-system.requires"
cmake.version = ">=3.20"
-build.targets = ["buipy"]
+# the core extension and Dear ImGui's (_buiimgui, behind blenderui.imgui): both are
+# installed by bindings/python/CMakeLists.txt, so both must be built
+build.targets = ["buipy", "_buiimgui"]
wheel.packages = [] # CMake installs bui/, blenderui/ and buipy
wheel.exclude = ["**/__pycache__/**"]
sdist.exclude = ["reference/", "build*/", ".github/", "**/__pycache__/", "*.pyd", "*.so"]
@@ -62,6 +65,7 @@ BUI_BUILD_EXAMPLES = "OFF"
BUI_BUILD_UI = "OFF"
BUI_BUILD_QT_BACKEND = "OFF"
BUI_BUILD_PYTHON_BINDINGS = "ON"
+BUI_BUILD_IMGUI = "ON"
[tool.scikit-build.metadata.version]
provider = "scikit_build_core.metadata.regex"
@@ -70,7 +74,13 @@ input = "bindings/python/bui/_version.py"
[tool.cibuildwheel]
build = "cp311-* cp312-* cp313-* cp314-*"
skip = "*-musllinux_* *-win32 *_i686"
-test-command = "python -c \"import blenderui, buipy, blenderui.tksyntax, blenderui.components; print(blenderui.__version__)\""
+test-command = "python -c \"import blenderui, buipy, blenderui.tksyntax, blenderui.components, blenderui.imgui; print(blenderui.__version__)\""
+
+[tool.cibuildwheel.macos]
+# macOS 11+ on Intel too (Apple Silicon's minimum; cibuildwheel's Intel default is
+# 10.13): newer libc++ C++20 than 10.13 has stays usable, and the Cocoa host
+# (kit_window_cocoa.m) needs 10.12+.
+environment = { MACOSX_DEPLOYMENT_TARGET = "11.0" }
[tool.cibuildwheel.linux]
# The X11 headers, so Linux wheels get the native window host. libX11 itself
diff --git a/tests/theme_test.c b/tests/theme_test.c
new file mode 100644
index 0000000..ede2ed5
--- /dev/null
+++ b/tests/theme_test.c
@@ -0,0 +1,113 @@
+/* Themes: BK_set_theme switches between Blender's Dark and Light presets,
+ * every context redraws, and switching back to dark gives the same pixels.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "BUI_kit.h"
+#include "GPU_raster.h"
+
+static int g_fail = 0;
+static int g_requests = 0;
+#define CHECK(c) \
+ do { \
+ if (!(c)) { \
+ printf("FAIL %s:%d: %s\n", __FILE__, __LINE__, #c); \
+ g_fail = 1; \
+ } \
+ } while (0)
+
+static void on_request(void *data)
+{
+ (void)data;
+ g_requests++;
+}
+
+static int near(const float c[4], float r, float g, float b, float a)
+{
+ return fabsf(c[0] - r) < 1e-3f && fabsf(c[1] - g) < 1e-3f && fabsf(c[2] - b) < 1e-3f &&
+ fabsf(c[3] - a) < 1e-3f;
+}
+
+static uint32_t *render(BKContext *ctx, BuiRaster *r, int w, int h)
+{
+ BK_render(ctx, r, w, h, 1);
+ uint32_t *copy = (uint32_t *)malloc(sizeof(uint32_t) * (size_t)(w * h));
+ memcpy(copy, BUI_raster_pixels(r), sizeof(uint32_t) * (size_t)(w * h));
+ return copy;
+}
+
+int main(void)
+{
+ const int W = 240, H = 160;
+ float c[4];
+
+ /* the default is Blender's dark theme */
+ CHECK(strcmp(BK_theme_name(), "dark") == 0);
+ CHECK(BK_theme_color("region_bg", c) && near(c, 48 / 255.0f, 48 / 255.0f, 48 / 255.0f, 1));
+ CHECK(BK_theme_color("regular.inner", c) && near(c, 84 / 255.0f, 84 / 255.0f, 84 / 255.0f, 1));
+ CHECK(BK_theme_color("text", c) && near(c, 230 / 255.0f, 230 / 255.0f, 230 / 255.0f, 1));
+ CHECK(!BK_theme_color("nope", c));
+ CHECK(!BK_theme_color("regular.nope", c));
+ CHECK(!BK_theme_color("nope.inner", c));
+
+ BKNode *col = BK_node_new("column");
+ const char *types[] = {"button", "number", "checkbox", "text", "slider", "dropdown"};
+ for (int i = 0; i < 6; i++) {
+ BKNode *n = BK_node_new(types[i]);
+ BK_set_str(n, "text", "Widget");
+ BK_node_add(col, n, -1);
+ }
+ BKContext *ctx = BK_context_new(col);
+ BKHost host = {0};
+ host.request = on_request;
+ BK_context_set_host(ctx, &host);
+ BuiRaster *r = BUI_raster_create(W, H);
+
+ uint32_t *dark = render(ctx, r, W, H);
+ CHECK((dark[(H - 2) * W + W / 2] & 0xffffffu) == 0x303030u); /* region background */
+ CHECK(BK_render(ctx, r, W, H, 0) == 0); /* nothing to redraw */
+
+ /* light: Blender_Light.xml */
+ CHECK(BK_set_theme("light") == 1);
+ CHECK(strcmp(BK_theme_name(), "light") == 0);
+ CHECK(g_requests >= 1); /* the host was asked to redraw */
+ CHECK(BK_theme_color("region_bg", c) && near(c, 179 / 255.0f, 179 / 255.0f, 179 / 255.0f, 1));
+ CHECK(BK_theme_color("regular.inner", c) && near(c, 219 / 255.0f, 219 / 255.0f, 219 / 255.0f, 1));
+ CHECK(BK_theme_color("text", c) && near(c, 0, 0, 0, 1));
+ CHECK(BK_render(ctx, r, W, H, 0) != 0); /* the theme change damaged the frame */
+ uint32_t *light = render(ctx, r, W, H);
+ CHECK((light[(H - 2) * W + W / 2] & 0xffffffu) == 0xb3b3b3u);
+ int differ = 0;
+ for (int i = 0; i < W * H; i++) {
+ differ += dark[i] != light[i];
+ }
+ CHECK(differ > W * H / 2);
+
+ /* unknown names keep the theme; Blender's preset names and any case work */
+ CHECK(BK_set_theme("solarized") == 0);
+ CHECK(strcmp(BK_theme_name(), "light") == 0);
+ CHECK(BK_set_theme("Blender Dark") == 1);
+ CHECK(strcmp(BK_theme_name(), "dark") == 0);
+ CHECK(BK_set_theme("LIGHT") == 1 && BK_set_theme(NULL) == 1); /* NULL: dark */
+ CHECK(strcmp(BK_theme_name(), "dark") == 0);
+
+ /* back to dark: pixel-identical to the first frame */
+ uint32_t *dark2 = render(ctx, r, W, H);
+ CHECK(memcmp(dark, dark2, sizeof(uint32_t) * (size_t)(W * H)) == 0);
+
+ free(dark);
+ free(light);
+ free(dark2);
+ BUI_raster_free(r);
+ BK_context_free(ctx);
+ BK_node_free(col);
+ if (!g_fail) {
+ printf("theme tests passed\n");
+ }
+ return g_fail;
+}
diff --git a/tools/__pycache__/pngopt.cpython-314.pyc b/tools/__pycache__/pngopt.cpython-314.pyc
new file mode 100644
index 0000000..e1c858c
Binary files /dev/null and b/tools/__pycache__/pngopt.cpython-314.pyc differ
diff --git a/tools/__pycache__/site_shots_py.cpython-314.pyc b/tools/__pycache__/site_shots_py.cpython-314.pyc
new file mode 100644
index 0000000..3f9f395
Binary files /dev/null and b/tools/__pycache__/site_shots_py.cpython-314.pyc differ
diff --git a/tools/gen_doc_images.py b/tools/gen_doc_images.py
index 8f0ccc8..d9b87af 100644
--- a/tools/gen_doc_images.py
+++ b/tools/gen_doc_images.py
@@ -1,70 +1,233 @@
-"""Render the examples into docs/images/ (headless, no window shown).
+"""Render the examples into images (headless, no window shown).
- python tools/gen_doc_images.py
+ python tools/gen_doc_images.py # docs/images/*.png (README / docs)
+ python tools/gen_doc_images.py --site # website/public/images/shots/, dark + light,
+ # every language (see INDEX.md there)
+ python tools/gen_doc_images.py --site --only python # one producer:
+ python | rust | js | imgui | c (--theme dark|light for one theme)
+
+The site shots are 2x (BUI_UI_SCALE=2, crisp on high-DPI screens), in Blender's
+dark and light themes (BUI_THEME), and losslessly recompressed (tools/pngopt.py).
+Producers outside Python run as subprocesses and are skipped (with a note)
+when their toolchain or build is missing:
+
+* rust: cargo run --release -j 1 -p blenderui --example <name> -- --screenshot
+* js: node examples/site/js/shoot.mjs (needs bindings/node's built addon)
+* imgui: the C++ examples from the CMake build (BUI_BUILD_DIR, built with
+ BUI_BUILD_EXAMPLES=ON BUI_BUILD_IMGUI=ON) and the Python bindings
+* c: bui_site_kit_app from the same build
+
+Set BUIPY_BUILD_DIR to the build's bindings/python and BUI_BUILD_DIR to the
+CMake build directory.
SPDX-License-Identifier: GPL-2.0-or-later
"""
-import os, sys
+import argparse
+import os
+import shutil
+import subprocess
+import sys
+
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-OUT = os.path.join(ROOT, "docs", "images")
-sys.path.insert(0, os.path.join(ROOT, "bindings", "python"))
-sys.path.insert(0, os.path.join(ROOT, "examples"))
-import bui, buipy
-from bui.tksyntax._images import _encode_png
-
-def save(raster, w, h, name):
- px = b"".join(bytes(raster.pixel(x, y)) + b"\xff" for y in range(h) for x in range(w))
- with open(os.path.join(OUT, name), "wb") as fh:
- fh.write(_encode_png(w, h, px))
- print("saved", name, w, h)
-
-def ctx_shot(ctx, w, h, name):
- r = buipy.Raster(w, h)
- ctx.render(w, h, r, True)
- save(r, w, h, name)
-
-# 1. components demo
-import components_demo
-app = components_demo.build()
-r = app.render_raster(520, 690, True)
-save(r, 520, 690, "components.png")
-
-# 2. unchanged tkinter app (+ each tab)
-import bui.tksyntax as tks
-tks.install()
-import tkinter as tk
-import tk_unchanged_app
-for i, name in enumerate(("tkinter_items.png", "tkinter_notes.png", "tkinter_canvas.png")):
- root = tk_unchanged_app.build(tk.Tk())
- nb = [w for w in root.winfo_children() if w.winfo_class() == "TNotebook"][0]
- nb.select(i)
+DOCS_OUT = os.path.join(ROOT, "docs", "images")
+SITE_OUT = os.path.join(ROOT, "website", "public", "images", "shots")
+sys.path.insert(0, os.path.join(ROOT, "tools"))
+THEMES = ("dark", "light")
+SCALE = 2
+
+
+# --------------------------------------------------------------------------------
+# docs/images (1x, dark): the README and docs pages
+
+
+def docs_images():
+ sys.path.insert(0, os.path.join(ROOT, "bindings", "python"))
+ sys.path.insert(0, os.path.join(ROOT, "examples"))
+ import buipy
+ from bui.tksyntax._images import _encode_png
+
+ def save(raster, w, h, name):
+ px = b"".join(bytes(raster.pixel(x, y)) + b"\xff" for y in range(h) for x in range(w))
+ with open(os.path.join(DOCS_OUT, name), "wb") as fh:
+ fh.write(_encode_png(w, h, px))
+ print("saved", name, w, h)
+
+ def ctx_shot(ctx, w, h, name):
+ r = buipy.Raster(w, h)
+ ctx.render(w, h, r, True)
+ save(r, w, h, name)
+
+ # 1. components demo
+ import components_demo
+ app = components_demo.build()
+ r = app.render_raster(520, 690, True)
+ save(r, 520, 690, "components.png")
+
+ # 2. unchanged tkinter app (+ each tab)
+ import bui.tksyntax as tks
+ tks.install()
+ import tkinter as tk
+ import tk_unchanged_app
+ for i, name in enumerate(("tkinter_items.png", "tkinter_notes.png", "tkinter_canvas.png")):
+ root = tk_unchanged_app.build(tk.Tk())
+ nb = [w for w in root.winfo_children() if w.winfo_class() == "TNotebook"][0]
+ nb.select(i)
+ root.update()
+ ctx_shot(root._ctx, *root._window.size, name)
+ root.destroy()
+
+ # 3. messagebox
+ from tkinter import messagebox
+ from bui.tksyntax import _core
+ root = tk.Tk()
+ tk.Label(root, text=" ").pack()
root.update()
- ctx_shot(root._ctx, *root._window.size, name)
+
+ def shoot():
+ top = [w for w in _core._windows() if w is not root][-1]
+ ctx_shot(top._ctx, *top._window.size, "tkinter_messagebox.png")
+ for d in top._descendants():
+ if isinstance(d, tk.Button) and d.cget("text") == "No":
+ d.invoke()
+ root.after(150, shoot)
+ messagebox.askyesno("Unsaved changes", "Save changes to the inventory before closing?",
+ detail="Your changes will be lost if you don't save them.")
root.destroy()
-# 3. messagebox
-from tkinter import messagebox
-from bui.tksyntax import _core
-root = tk.Tk(); tk.Label(root, text=" ").pack(); root.update()
-def shoot():
- top = [w for w in _core._windows() if w is not root][-1]
- ctx_shot(top._ctx, *top._window.size, "tkinter_messagebox.png")
- for d in top._descendants():
- if isinstance(d, tk.Button) and d.cget("text") == "No":
- d.invoke()
-root.after(150, shoot)
-messagebox.askyesno("Unsaved changes", "Save changes to the inventory before closing?",
- detail="Your changes will be lost if you don't save them.")
-root.destroy()
-
-# 4. Qt demo
-import bui.qtsyntax as qt
-import qt_syntax_demo
-def fake_exec(self):
- w = [o for o in qt._custom_or_top()][-1]
- w._window.render_now()
- ctx_shot(w._ctx, w._window.size[0], 222, "qt.png")
- w.close()
- return 0
-qt.QApplication.exec = fake_exec
-qt_syntax_demo.main()
+ # 4. Qt demo
+ import bui.qtsyntax as qt
+ import qt_syntax_demo
+
+ def fake_exec(self):
+ w = [o for o in qt._custom_or_top()][-1]
+ w._window.render_now()
+ ctx_shot(w._ctx, w._window.size[0], 222, "qt.png")
+ w.close()
+ return 0
+ qt.QApplication.exec = fake_exec
+ qt_syntax_demo.main()
+
+
+# --------------------------------------------------------------------------------
+# website shots
+
+
+def run(cmd, env=None, cwd=ROOT):
+ print("+", " ".join(cmd), flush=True)
+ return subprocess.run(cmd, env=env, cwd=cwd).returncode
+
+
+def child_env(theme):
+ env = dict(os.environ, BUI_THEME=theme, BUI_UI_SCALE=str(SCALE))
+ env.setdefault("RUSTC_WRAPPER", "")
+ return env
+
+
+def site_python(theme):
+ """Every Python shot, in this process (BUI_THEME / BUI_UI_SCALE already set)."""
+ sys.path.insert(0, os.path.join(ROOT, "tools"))
+ import site_shots_py
+ site_shots_py.main(SITE_OUT, theme)
+
+
+def site_rust(theme):
+ rust = os.path.join(ROOT, "bindings", "rust")
+ if not shutil.which("cargo"):
+ print("rust: cargo not found, skipped")
+ return
+ shots = [ # (example, output name)
+ ("site_dashboard", "rust-rsx-dashboard"),
+ ("site_dashboard_builder", "rust-builder-dashboard"),
+ ("site_plain_html", "rust-html-plain"),
+ ("site_styled", "rust-html-styled"),
+ ("site_components", "rust-components"),
+ ("site_effects", "feature-html-effects"),
+ ("site_grid", "feature-css-grid"),
+ ("site_animation", "feature-animation"),
+ ]
+ for ex, name in shots:
+ out = os.path.join(SITE_OUT, "%s-%s.png" % (name, theme))
+ run(["cargo", "run", "--release", "-j", "1", "-q", "-p", "blenderui", "--example", ex,
+ "--", "--screenshot", out], env=child_env(theme), cwd=rust)
+
+
+def site_js(theme):
+ node = shutil.which("node")
+ addon = [f for f in os.listdir(os.path.join(ROOT, "bindings", "node"))
+ if f.endswith(".node")]
+ if not node or not addon:
+ print("js: node or the built addon (bindings/node: npm run build) missing, skipped")
+ return
+ run([node, os.path.join(ROOT, "examples", "site", "js", "shoot.mjs"), SITE_OUT, theme],
+ env=child_env(theme))
+
+
+def site_native(theme, which):
+ """C / C++ examples from the CMake build (BUI_BUILD_DIR)."""
+ build = os.environ.get("BUI_BUILD_DIR", os.path.join(ROOT, "build"))
+ exes = {
+ "imgui": [("bui_site_imgui", "imgui-cpp-stock", ["--stock"]),
+ ("bui_site_imgui", "imgui-cpp-blender", [])],
+ "c": [("bui_site_kit_app", "c-kit-app", [])],
+ }[which]
+ for exe, name, args in exes:
+ path = None
+ for sub in ("examples/Release", "examples", "bindings/imgui/Release", "bindings/imgui"):
+ p = os.path.join(build, sub, exe + (".exe" if os.name == "nt" else ""))
+ if os.path.exists(p):
+ path = p
+ break
+ if not path:
+ print("%s: %s not built in %s, skipped" % (which, exe, build))
+ continue
+ out = os.path.join(SITE_OUT, "%s-%s.png" % (name, theme))
+ run([path, "--screenshot", out] + args, env=child_env(theme))
+
+
+def site(only, themes):
+ os.makedirs(SITE_OUT, exist_ok=True)
+ before = set(os.listdir(SITE_OUT))
+ for theme in themes:
+ if only in (None, "python"):
+ # a fresh interpreter per theme: the theme and scale are set before
+ # the first window exists
+ run([sys.executable, os.path.abspath(__file__), "--site-python", theme],
+ env=child_env(theme))
+ if only in (None, "rust"):
+ site_rust(theme)
+ if only in (None, "js"):
+ site_js(theme)
+ if only in (None, "imgui"):
+ site_native(theme, "imgui")
+ if only in (None, "c"):
+ site_native(theme, "c")
+ # lossless recompression of what other toolchains wrote
+ import pngopt
+ for f in sorted(os.listdir(SITE_OUT)):
+ if f.endswith(".png") and any(f.endswith("-%s.png" % t) for t in themes):
+ p = os.path.join(SITE_OUT, f)
+ n = pngopt.recompress(p)
+ flag = " (over 300 KB)" if n > 300 * 1024 else ""
+ print("%-48s %7d bytes%s" % (f, n, flag))
+ new = sorted(set(os.listdir(SITE_OUT)) - before)
+ if new:
+ print("new files:", ", ".join(new))
+
+
+def main():
+ ap = argparse.ArgumentParser()
+ ap.add_argument("--site", action="store_true")
+ ap.add_argument("--only", choices=("python", "rust", "js", "imgui", "c"))
+ ap.add_argument("--theme", choices=THEMES)
+ ap.add_argument("--site-python", choices=THEMES, help=argparse.SUPPRESS)
+ a = ap.parse_args()
+ if a.site_python:
+ site_python(a.site_python)
+ elif a.site:
+ site(a.only, [a.theme] if a.theme else list(THEMES))
+ else:
+ docs_images()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/gen_theme.py b/tools/gen_theme.py
new file mode 100644
index 0000000..0df65df
--- /dev/null
+++ b/tools/gen_theme.py
@@ -0,0 +1,246 @@
+"""Generate kit/intern/kit_theme_presets.c from Blender's interface theme presets.
+
+ py -3 tools/gen_theme.py [BLENDER_SCRIPTS_PRESETS_DIR]
+
+Blender ships its themes as XML presets (scripts/presets/interface_theme/
+Blender_Dark.xml, Blender_Light.xml). Loading a preset first resets the theme
+to the built-in defaults (userdef_default_theme.c, which is what Blender_Dark
+.xml amounts to: it is empty) and then applies the XML on top, so this script
+does the same: it starts from BUI's copy of the defaults (the dark table
+below, identical to what kit_draw.c shipped before themes became switchable)
+and overlays each preset's values onto the fields of BKTheme
+(kit/intern/kit_intern.h). Stdlib only. Without an argument the presets are
+looked up in ../geometry-nodes/geometry-nodes/blender/scripts/presets and,
+failing that, the BLENDER_PRESETS environment variable.
+
+SPDX-License-Identifier: GPL-2.0-or-later
+"""
+from __future__ import annotations
+
+import os
+import sys
+import xml.etree.ElementTree as ET
+
+ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+OUT = os.path.join(ROOT, "kit", "intern", "kit_theme_presets.c")
+
+# BKTheme's widget color sets, in struct order, and the ThemeUserInterface
+# element each one is read from.
+WCOLS = [
+ ("regular", "wcol_regular"), ("tool", "wcol_tool"), ("toggle", "wcol_toggle"),
+ ("radio", "wcol_radio"), ("option", "wcol_option"), ("textfield", "wcol_text"),
+ ("num", "wcol_num"), ("numslider", "wcol_numslider"), ("menu", "wcol_menu"),
+ ("pulldown", "wcol_pulldown"), ("menu_back", "wcol_menu_back"),
+ ("menu_item", "wcol_menu_item"), ("list_item", "wcol_list_item"), ("box", "wcol_box"),
+ ("scroll", "wcol_scroll"), ("progress", "wcol_progress"), ("tooltip", "wcol_tooltip"),
+ ("tab", "wcol_tab"), ("pie_menu", "wcol_pie_menu"), ("curve", "wcol_curve"),
+]
+WCOL_COLORS = ["outline", "outline_sel", "inner", "inner_sel", "item", "text", "text_sel"]
+
+# The built-in (dark) defaults as BUI draws them: outline, outline_sel, inner,
+# inner_sel, item, text, text_sel, roundness. shaded/shadetop/shadedown are 0
+# (Blender 5.x's default theme draws every widget flat).
+DARK_WCOL = {
+ "regular": (0x3d3d3dff, 0x3d3d3dff, 0x545454ff, 0x4772b3ff, 0x1d1d1d80, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "tool": (0x3d3d3dff, 0x3d3d3dff, 0x545454ff, 0x4772b3ff, 0xffffffff, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "toggle": (0x3d3d3dff, 0x3d3d3dff, 0x545454ff, 0x4772b3ff, 0x252525ff, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "radio": (0x3d3d3dff, 0x3d3d3dff, 0x545454ff, 0x4772b3ff, 0x252525ff, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "option": (0x3d3d3dff, 0x3d3d3dff, 0x545454ff, 0x4772b3ff, 0xffffffff, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "textfield": (0x3d3d3dff, 0x3d3d3dff, 0x1d1d1dff, 0x181818ff, 0xffffff33, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "num": (0x3d3d3dff, 0x3d3d3dff, 0x545454ff, 0x222222ff, 0x4772b3ff, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "numslider": (0x3d3d3dff, 0x3d3d3dff, 0x545454ff, 0x222222ff, 0x4772b3ff, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "menu": (0x3d3d3dff, 0x3d3d3dff, 0x282828ff, 0x4772b3b3, 0xd9d9d9ff, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "pulldown": (0x3d3d3d00, 0x3d3d3d00, 0x22222200, 0xffffff1a, 0xffffff8f, 0xd9d9d9ff, 0xffffffff, 0.2),
+ "menu_back": (0x242424ff, 0x242424ff, 0x181818ff, 0x4772b3ff, 0xd9d9d9ff, 0x999999ff, 0xffffffff, 0.2),
+ "menu_item": (0x3d3d3d00, 0x3d3d3d00, 0x18181800, 0x4772b3ff, 0xffffff8f, 0xddddddff, 0xffffffff, 0.2),
+ "list_item": (0x2d2d2d00, 0x2d2d2dff, 0xffffff00, 0x4772b3ff, 0xffffff33, 0xccccccff, 0xffffffff, 0.2),
+ "box": (0x3d3d3dff, 0x3d3d3dff, 0x1d1d1d80, 0x545454ff, 0x191919ff, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "scroll": (0x3d3d3dff, 0x3d3d3dff, 0x22222200, 0xffffffff, 0x545454ff, 0xe6e6e6ff, 0xffffffff, 0.5),
+ "progress": (0x3d3d3dff, 0x3d3d3dff, 0x222222ff, 0x4772b3ff, 0x4772b3ff, 0xe6e6e6ff, 0xffffffff, 0.2),
+ "tooltip": (0x242424ff, 0x242424ff, 0x1d1d1dff, 0x4772b3ff, 0xd9d9d9ff, 0xd9d9d9ff, 0xffffffff, 0.2),
+ "tab": (0x1d1d1dff, 0x1d1d1dff, 0x1d1d1dff, 0x303030ff, 0x1d1d1dff, 0x989898ff, 0xffffffff, 0.2),
+ "pie_menu": (0x242424ff, 0x242424ff, 0x181818ff, 0x4772b3ff, 0x545454ff, 0xd9d9d9ff, 0xffffffff, 0.2),
+ "curve": (0x727272ff, 0x9a9a9aff, 0x545454ff, 0x000000ff, 0x00000059, 0x08080800, 0xc9c9c900, 0.2),
+}
+
+# Plain colors: (BKTheme field, default, XML source, opaque). The source is a
+# path of element tags below <Theme> ending in an attribute; None derives the
+# value (see derived()). `opaque` drops the alpha (Blender ignores it for
+# editor backgrounds).
+COLORS = [
+ ("region_bg", 0x303030ff, "properties/ThemeProperties/space/ThemeSpaceGeneric@back", True),
+ ("header_bg", 0x181818ff, None, True), # the top bar: header over back
+ ("tabs_bg", 0x181818ff, "regions/ThemeRegions/sidebars/ThemeRegionsSidebars@tab_back", True),
+ ("panel_header", 0x3d3d3dff, "user_interface/ThemeUserInterface@panel_header", False),
+ ("panel_back", 0x3d3d3dff, "user_interface/ThemeUserInterface@panel_back", False),
+ ("panel_sub_back", 0x0000001f, "user_interface/ThemeUserInterface@panel_sub_back", False),
+ ("panel_outline", 0xffffff11, "user_interface/ThemeUserInterface@panel_outline", False),
+ ("text", 0xe6e6e6ff, "properties/ThemeProperties/space/ThemeSpaceGeneric@text", False),
+ ("text_hi", 0xffffffff, "properties/ThemeProperties/space/ThemeSpaceGeneric@text_hi", False),
+ ("emboss", 0x00000026, "user_interface/ThemeUserInterface@widget_emboss", False),
+ ("cursor", 0x71a8ffff, "user_interface/ThemeUserInterface@widget_text_cursor", False),
+ ("selection", 0x4772b380, None, False), # wcol_regular.inner_sel at 50%
+]
+SCALARS = [
+ ("menu_shadow_fac", 0.2, "user_interface/ThemeUserInterface@menu_shadow_fac", "f"),
+ ("menu_shadow_width", 6, "user_interface/ThemeUserInterface@menu_shadow_width", "i"),
+ ("panel_roundness", 0.4, "user_interface/ThemeUserInterface@panel_roundness", "f"),
+]
+FILE_COLORS = [
+ ("file_back", 0x282828ff, "file_browser/ThemeFileBrowser/space/ThemeSpaceGeneric@back", True),
+ ("file_text", 0xe6e6e6ff, "file_browser/ThemeFileBrowser/space/ThemeSpaceGeneric@text", False),
+ ("file_header", 0x303030b3, "file_browser/ThemeFileBrowser/space/ThemeSpaceGeneric@header", False),
+ ("file_row_alternate", 0xffffff04, "file_browser/ThemeFileBrowser@row_alternate", False),
+]
+NODE = "node_editor/ThemeNodeEditor"
+NODE_COLORS = [
+ ("node_back", 0x1a1a1aff, NODE + "/space/ThemeSpaceGeneric@back", True),
+ ("node_grid", 0x303030ff, NODE + "@grid", True),
+ ("node_wire", 0x1a1a1aff, NODE + "@wire", False),
+ ("node_body", 0x303030ff, NODE + "@node_backdrop", False),
+ ("node_outline", 0xffffff26, NODE + "@node_outline", False),
+ ("node_selected", 0xed5700ff, NODE + "@node_selected", False),
+ ("node_active", 0xffffffff, NODE + "@node_active", False),
+]
+TOPBAR = "topbar/ThemeTopBar/space/ThemeSpaceGeneric"
+PROPS = "properties/ThemeProperties/space/ThemeSpaceGeneric"
+# derived: (field, default); computed in build()
+EXTRA = [("area_header", 0x303030ff)] # editor headers: space header over the region back
+
+
+def parse_color(s: str, default: int) -> int:
+ s = s.strip().lstrip("#")
+ if len(s) == 6: # RGB-only properties keep the default's alpha
+ return (int(s, 16) << 8) | (default & 0xff)
+ return int(s[:8], 16)
+
+
+def lookup(theme, path: str):
+ elem_path, attr = path.split("@")
+ e = theme.find(elem_path)
+ return None if e is None else e.get(attr)
+
+
+def over(top: int, back: int) -> int:
+ a = (top & 0xff) / 255.0
+ out = 0
+ for sh in (24, 16, 8):
+ t, b = (top >> sh) & 0xff, (back >> sh) & 0xff
+ out |= int(round(t * a + b * (1.0 - a))) << sh
+ return out | 0xff
+
+
+def build(theme) -> dict:
+ """Defaults + the preset's overrides (theme: the <Theme> element or None)."""
+ t = {"wcol": {}}
+ for name, xml_name in WCOLS:
+ d = DARK_WCOL[name]
+ w = {k: d[i] for i, k in enumerate(WCOL_COLORS)}
+ w.update(shaded=0, shadetop=0, shadedown=0, roundness=d[7])
+ e = theme.find("user_interface/ThemeUserInterface/%s/ThemeWidgetColors" % xml_name) \
+ if theme is not None else None
+ if e is not None:
+ for k in WCOL_COLORS:
+ if e.get(k) is not None:
+ w[k] = parse_color(e.get(k), w[k])
+ if e.get("show_shaded") is not None:
+ w["shaded"] = 1 if e.get("show_shaded").upper() == "TRUE" else 0
+ for k in ("shadetop", "shadedown"):
+ if e.get(k) is not None:
+ w[k] = int(e.get(k))
+ if e.get("roundness") is not None:
+ w["roundness"] = float(e.get("roundness"))
+ t["wcol"][name] = w
+ for field, default, path, opaque in COLORS + FILE_COLORS + NODE_COLORS:
+ v = default
+ if path and theme is not None and lookup(theme, path) is not None:
+ v = parse_color(lookup(theme, path), default)
+ t[field] = (v | 0xff) if opaque else v
+ for field, default, path, kind in SCALARS:
+ v = default
+ if theme is not None and lookup(theme, path) is not None:
+ v = (float if kind == "f" else int)(lookup(theme, path))
+ t[field] = v
+ if theme is not None and lookup(theme, TOPBAR + "@header") is not None:
+ back = parse_color(lookup(theme, TOPBAR + "@back"), 0xff)
+ t["header_bg"] = over(parse_color(lookup(theme, TOPBAR + "@header"), 0xff), back | 0xff)
+ t["selection"] = (t["wcol"]["regular"]["inner_sel"] & 0xffffff00) | 0x80
+ t["area_header"] = 0x303030ff
+ if theme is not None and lookup(theme, PROPS + "@header") is not None:
+ t["area_header"] = over(parse_color(lookup(theme, PROPS + "@header"), 0xff),
+ t["region_bg"])
+ return t
+
+
+def c_float(v: float) -> str:
+ s = repr(float(v))
+ return s + "f"
+
+
+def emit(name: str, t: dict, const: bool) -> str:
+ out = ["%sBKTheme %s = {" % ("const " if const else "", name)]
+ for wname, _ in WCOLS:
+ w = t["wcol"][wname]
+ cols = ", ".join("RGBA(0x%08xu)" % w[k] for k in WCOL_COLORS)
+ out.append(" /* %s */ {%s, %d, %d, %d, %s}," % (
+ wname, cols, w["shaded"], w["shadetop"], w["shadedown"], c_float(w["roundness"])))
+ for field, *_ in COLORS:
+ out.append(" RGBA(0x%08xu), /* %s */" % (t[field], field))
+ out.append(" %s, /* menu_shadow_fac */" % c_float(t["menu_shadow_fac"]))
+ out.append(" %d, /* menu_shadow_width */" % t["menu_shadow_width"])
+ out.append(" %s, /* panel_roundness */" % c_float(t["panel_roundness"]))
+ for field, *_ in FILE_COLORS + NODE_COLORS + EXTRA:
+ out.append(" RGBA(0x%08xu), /* %s */" % (t[field], field))
+ out.append("};")
+ return "\n".join(out)
+
+
+def find_presets(argv) -> str:
+ cands = argv[1:2] + [
+ os.environ.get("BLENDER_PRESETS", ""),
+ os.path.join(ROOT, "..", "geometry-nodes", "geometry-nodes", "blender", "scripts",
+ "presets"),
+ ]
+ for c in cands:
+ if c and os.path.isdir(os.path.join(c, "interface_theme")):
+ return os.path.join(c, "interface_theme")
+ if c and os.path.isfile(os.path.join(c, "Blender_Light.xml")):
+ return c
+ sys.exit("gen_theme.py: Blender's scripts/presets directory not found (pass it)")
+
+
+def load(path: str):
+ root = ET.parse(path).getroot()
+ return root.find("Theme")
+
+
+def main(argv) -> None:
+ d = find_presets(argv)
+ themes = [("dark", load(os.path.join(d, "Blender_Dark.xml"))),
+ ("light", load(os.path.join(d, "Blender_Light.xml")))]
+ built = {name: build(th) for name, th in themes}
+ parts = [
+ "/* Generated by tools/gen_theme.py from Blender's interface theme presets",
+ " * (scripts/presets/interface_theme/Blender_Dark.xml, Blender_Light.xml) over",
+ " * the built-in defaults (userdef_default_theme.c). Do not edit.",
+ " *",
+ " * SPDX-License-Identifier: GPL-2.0-or-later */",
+ "",
+ '#include "kit_intern.h"',
+ "",
+ "#define RGBA(v) {(uchar)((v) >> 24), (uchar)((v) >> 16), (uchar)((v) >> 8), (uchar)(v)}",
+ "",
+ "/* The active theme (starts as Blender's default, dark). */",
+ emit("bk_theme", built["dark"], False),
+ "",
+ ]
+ for name, _ in themes:
+ parts += [emit("bk_theme_%s" % name, built[name], True), ""]
+ text = "\n".join(parts)
+ with open(OUT, "w", newline="\n") as fh:
+ fh.write(text)
+ print("wrote", os.path.relpath(OUT, ROOT))
+
+
+if __name__ == "__main__":
+ main(sys.argv)
diff --git a/tools/pngopt.py b/tools/pngopt.py
new file mode 100644
index 0000000..3f766bc
--- /dev/null
+++ b/tools/pngopt.py
@@ -0,0 +1,151 @@
+"""Lossless PNG writing / re-encoding with the standard library only.
+
+ python tools/pngopt.py image.png [...] # recompress in place
+
+write_png(path, width, height, rgb_bytes) writes 8-bit RGB; recompress(path)
+decodes any 8-bit RGB/RGBA PNG, drops an all-opaque alpha channel, picks the
+best of several row-filter strategies and deflates at zlib level 9.
+
+SPDX-License-Identifier: GPL-2.0-or-later
+"""
+from __future__ import annotations
+
+import struct
+import sys
+import zlib
+
+
+def _chunk(kind: bytes, body: bytes) -> bytes:
+ return struct.pack(">I", len(body)) + kind + body + struct.pack(">I", zlib.crc32(kind + body))
+
+
+def _paeth_row(row: bytes, prev: bytes, bpp: int) -> bytes:
+ out = bytearray(len(row))
+ for i in range(len(row)):
+ a = row[i - bpp] if i >= bpp else 0
+ b = prev[i]
+ c = prev[i - bpp] if i >= bpp else 0
+ p = a + b - c
+ pa, pb, pc = abs(p - a), abs(p - b), abs(p - c)
+ pr = a if pa <= pb and pa <= pc else (b if pb <= pc else c)
+ out[i] = (row[i] - pr) & 255
+ return bytes(out)
+
+
+def _filter_rows(pix: bytes, w: int, h: int, bpp: int):
+ """Each row in filters 0 (None), 1 (Sub), 2 (Up), 4 (Paeth)."""
+ stride = w * bpp
+ prev = bytes(stride)
+ rows = []
+ for y in range(h):
+ row = pix[y * stride:(y + 1) * stride]
+ sub = bytes((row[i] - (row[i - bpp] if i >= bpp else 0)) & 255 for i in range(stride))
+ up = bytes((row[i] - prev[i]) & 255 for i in range(stride))
+ if row == prev:
+ paeth = up # identical rows: Up is all zeros, Paeth too
+ else:
+ paeth = _paeth_row(row, prev, bpp)
+ rows.append({0: row, 1: sub, 2: up, 4: paeth})
+ prev = row
+ return rows
+
+
+def _encode(pix: bytes, w: int, h: int, bpp: int) -> bytes:
+ rows = _filter_rows(pix, w, h, bpp)
+
+ def cost(r: bytes) -> int: # the usual minimum-sum-of-absolute-differences heuristic
+ return sum(v if v < 128 else 256 - v for v in r)
+
+ candidates = []
+ for f in (0, 1, 2, 4):
+ candidates.append(b"".join(bytes([f]) + r[f] for r in rows))
+ adaptive = bytearray()
+ for r in rows:
+ f = min((0, 1, 2, 4), key=lambda k: cost(r[k]))
+ adaptive += bytes([f]) + r[f]
+ candidates.append(bytes(adaptive))
+ best = min((zlib.compress(c, 9) for c in candidates), key=len)
+ return best
+
+
+def encode_png(w: int, h: int, pix: bytes, channels: int = 3) -> bytes:
+ ctype = {3: 2, 4: 6}[channels]
+ ihdr = struct.pack(">IIBBBBB", w, h, 8, ctype, 0, 0, 0)
+ return (b"\x89PNG\r\n\x1a\n" + _chunk(b"IHDR", ihdr) +
+ _chunk(b"IDAT", _encode(pix, w, h, channels)) + _chunk(b"IEND", b""))
+
+
+def write_png(path: str, w: int, h: int, rgb: bytes) -> int:
+ data = encode_png(w, h, rgb, 3)
+ with open(path, "wb") as fh:
+ fh.write(data)
+ return len(data)
+
+
+def read_png(path: str):
+ """(width, height, channels, pixel bytes) of an 8-bit RGB / RGBA PNG."""
+ data = open(path, "rb").read()
+ assert data[:8] == b"\x89PNG\r\n\x1a\n", path
+ i, idat = 8, b""
+ while i < len(data):
+ n, kind = struct.unpack(">I4s", data[i:i + 8])
+ body = data[i + 8:i + 8 + n]
+ if kind == b"IHDR":
+ w, h, depth, ctype, _, _, interlace = struct.unpack(">IIBBBBB", body)
+ assert depth == 8 and interlace == 0 and ctype in (2, 6), (path, depth, ctype)
+ bpp = 3 if ctype == 2 else 4
+ elif kind == b"IDAT":
+ idat += body
+ i += 12 + n
+ raw = zlib.decompress(idat)
+ stride = w * bpp
+ out = bytearray()
+ prev = bytearray(stride)
+ p = 0
+ for _ in range(h):
+ f = raw[p]
+ line = bytearray(raw[p + 1:p + 1 + stride])
+ p += 1 + stride
+ if f == 1:
+ for x in range(bpp, stride):
+ line[x] = (line[x] + line[x - bpp]) & 255
+ elif f == 2:
+ for x in range(stride):
+ line[x] = (line[x] + prev[x]) & 255
+ elif f == 3:
+ for x in range(stride):
+ a = line[x - bpp] if x >= bpp else 0
+ line[x] = (line[x] + (a + prev[x]) // 2) & 255
+ elif f == 4:
+ for x in range(stride):
+ a = line[x - bpp] if x >= bpp else 0
+ b = prev[x]
+ c = prev[x - bpp] if x >= bpp else 0
+ pp = a + b - c
+ pa, pb, pc = abs(pp - a), abs(pp - b), abs(pp - c)
+ pr = a if pa <= pb and pa <= pc else (b if pb <= pc else c)
+ line[x] = (line[x] + pr) & 255
+ out += line
+ prev = line
+ return w, h, bpp, bytes(out)
+
+
+def recompress(src: str, dst: str = None) -> int:
+ w, h, ch, pix = read_png(src)
+ if ch == 4 and all(a == 255 for a in pix[3::4]):
+ rgb = bytearray(w * h * 3)
+ rgb[0::3], rgb[1::3], rgb[2::3] = pix[0::4], pix[1::4], pix[2::4]
+ pix, ch = bytes(rgb), 3
+ data = encode_png(w, h, pix, ch)
+ old = open(src, "rb").read()
+ if dst is None and len(data) >= len(old):
+ return len(old)
+ with open(dst or src, "wb") as fh:
+ fh.write(data)
+ return len(data)
+
+
+if __name__ == "__main__":
+ for p in sys.argv[1:]:
+ before = len(open(p, "rb").read())
+ print("%s: %d -> %d bytes" % (p, before, recompress(p)))
diff --git a/tools/site_shots_py.py b/tools/site_shots_py.py
new file mode 100644
index 0000000..416322e
--- /dev/null
+++ b/tools/site_shots_py.py
@@ -0,0 +1,212 @@
+"""The website's Python screenshots (run by tools/gen_doc_images.py --site).
+
+Each shot builds an example from examples/site/ headlessly, at the scale and in
+the theme of the environment (BUI_UI_SCALE, BUI_THEME), and writes
+<area>-<name>-<theme>.png.
+
+SPDX-License-Identifier: GPL-2.0-or-later
+"""
+from __future__ import annotations
+
+import os
+import sys
+from types import SimpleNamespace
+
+ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+sys.path.insert(0, os.path.join(ROOT, "bindings", "python"))
+sys.path.insert(0, os.path.join(ROOT, "examples", "site"))
+sys.path.insert(0, os.path.join(ROOT, "tools"))
+
+import bui # noqa: E402,F401
+import buipy # noqa: E402
+import pngopt # noqa: E402
+
+OUT, THEME = ".", "dark"
+S = float(os.environ.get("BUI_UI_SCALE", "2"))
+buipy.kit_set_scale(S) # off-screen: no window sets the resolution scale
+
+
+def save_raster(r, name, x=0, y=0, w=None, h=None):
+ rw, rh = r.size
+ x, y = max(0, min(x, rw - 1)), max(0, min(y, rh - 1))
+ w, h = min(w or rw - x, rw - x), min(h or rh - y, rh - y)
+ ppm = r.ppm(x, y, w, h)
+ # P6\n<w> <h>\n255\n<rgb>
+ parts = ppm.split(b"\n", 3)
+ rgb = parts[3]
+ path = os.path.join(OUT, "%s-%s.png" % (name, THEME))
+ n = pngopt.write_png(path, w, h, rgb)
+ print("saved %s %dx%d %d bytes" % (os.path.basename(path), w, h, n), flush=True)
+
+
+def mods(**kw):
+ return SimpleNamespace(shift=kw.get("shift", False), ctrl=kw.get("ctrl", False),
+ alt=kw.get("alt", False), button1=kw.get("button1", False))
+
+
+class Driver:
+ """A components App driven headlessly (like tests/test_components.py)."""
+
+ def __init__(self, app, size):
+ self.app = app
+ self.w, self.h = int(size[0] * S), int(size[1] * S)
+ self.timers = []
+ app.ctx.set_host(schedule=lambda ms, tid: self.timers.append(tid), cursor=lambda c: None,
+ warp=lambda x, y: None)
+ self.frame()
+
+ def frame(self):
+ return self.app.render_raster(self.w, self.h)
+
+ @staticmethod
+ def center(c):
+ x, y, w, h = c.rect
+ return (x + w // 2, y + h // 2)
+
+ def click(self, c=None, at=None):
+ x, y = at or self.center(c)
+ self.app.motion(x, y, mods())
+ self.app.press(x, y, mods())
+ self.app.release(x, y, mods())
+ self.frame()
+
+ def hover(self, c=None, at=None):
+ self.app.motion(*(at or self.center(c)), mods())
+ self.frame()
+
+ def key(self, keysym, char=""):
+ self.app.key(char, keysym, 0, mods())
+ self.frame()
+
+ def type(self, text):
+ for ch in text:
+ self.key(ch, ch)
+
+ def fire_timers(self):
+ while self.timers:
+ self.app.ctx.timer(self.timers.pop(0))
+ self.frame()
+
+ def shot(self, name, crop=None):
+ r = self.app.render_raster(self.w, self.h, True)
+ if crop:
+ x, y, w, h = (int(v * S) for v in crop)
+ save_raster(r, name, x, y, w, h)
+ else:
+ save_raster(r, name)
+
+
+# --------------------------------------------------------------------------------
+# Blender components
+
+
+def components():
+ import render_props
+ size = (500, 640)
+ d = Driver(render_props.build((int(size[0] * S), int(size[1] * S))), size)
+ d.shot("python-components")
+
+ # the File menu, with "exp" typed: Blender's fuzzy menu search
+ d = Driver(render_props.build((int(size[0] * S), int(size[1] * S))), size)
+ d.click(d.app.menubar.buttons[0])
+ d.type("exp")
+ d.shot("feature-menu-search", crop=(0, 0, 500, 330))
+
+ # a tooltip (hover, then the tooltip timer fires)
+ d = Driver(render_props.build((int(size[0] * S), int(size[1] * S))), size)
+ target = d.app.denoise
+ d.hover(target)
+ d.fire_timers()
+ x, y, w, h = (v / S for v in target.rect)
+ d.shot("feature-tooltip", crop=(40, y - 50, 460, 130))
+
+ # the color picker of a swatch
+ d = Driver(render_props.build((int(size[0] * S), int(size[1] * S))), size)
+ d.click(d.app.background)
+ x, y, w, h = (v / S for v in d.app.background.rect)
+ d.shot("feature-color-picker", crop=(115, 250, 380, 330))
+
+
+def nodes():
+ import geometry_nodes
+ size = (760, 400)
+ d = Driver(geometry_nodes.build((int(size[0] * S), int(size[1] * S))), size)
+ d.shot("feature-node-editor")
+ d.hover(at=(int(400 * S), int(205 * S)))
+ d.app.pie()
+ d.frame()
+ d.hover(at=(int(470 * S), int(195 * S))) # toward "Rendered" (E)
+ d.shot("feature-pie-menu", crop=(150, 26, 500, 344))
+
+
+# --------------------------------------------------------------------------------
+# tkinter / ttk / Qt syntax
+
+
+def tk_shot(module, name, pad=0):
+ import bui.tksyntax as tks
+ tks.install()
+ import tkinter as tk
+ mod = __import__(module)
+ root = mod.build(tk.Tk())
+ root.update()
+ w, h = root.winfo_reqwidth() + int(pad * S), root.winfo_reqheight()
+ r = buipy.Raster(w, h)
+ root._ctx.render(w, h, r, True)
+ save_raster(r, name)
+ root.destroy()
+
+
+def qt_shot(module, name):
+ import bui.qtsyntax as qt
+ mod = __import__(module)
+ app = qt.QApplication.instance() if hasattr(qt.QApplication, "instance") else None
+ app = app or qt.QApplication([])
+ w = mod.build()
+ w.show()
+ w._window.render_now()
+ ww, hh = w._window.size
+ r = buipy.Raster(ww, hh)
+ w._ctx.render(ww, hh, r, True)
+ save_raster(r, name)
+ w.close()
+
+
+def imgui_shots():
+ import bui.imgui as imgui
+ import imgui_inspector
+ w, h = int(520 * S), int(490 * S)
+ imgui.set_ui_scale(S) # (the extension has its own kit: its own scale)
+ for stock in (True, False):
+ app = imgui.HeadlessApp(imgui_inspector.frame, (w, h), blender_style=not stock,
+ blender_font=True)
+ imgui.set_blender_widgets(not stock and imgui.has_blender_widgets())
+ if stock:
+ (imgui.style_colors_light if THEME == "light" else imgui.style_colors_dark)()
+ app.render(6)
+ pw, ph, px = app.pixels()
+ rgb = bytearray(pw * ph * 3)
+ rgb[0::3], rgb[1::3], rgb[2::3] = px[2::4], px[1::4], px[0::4]
+ path = os.path.join(OUT, "%s-%s.png" % ("imgui-python-" + ("stock" if stock else "blender"),
+ THEME))
+ n = pngopt.write_png(path, pw, ph, bytes(rgb))
+ print("saved %s %dx%d %d bytes" % (os.path.basename(path), pw, ph, n), flush=True)
+ app.close()
+
+
+def main(out, theme):
+ global OUT, THEME
+ OUT, THEME = out, theme
+ assert bui.theme_name() == theme, (bui.theme_name(), theme)
+ only = os.environ.get("SITE_ONLY", "")
+ for name, fn in (("components", components), ("nodes", nodes),
+ ("tk", lambda: tk_shot("tk_export", "python-tkinter")),
+ ("ttk", lambda: tk_shot("ttk_queue", "python-ttk")),
+ ("qt", lambda: qt_shot("qt_material", "python-qt")),
+ ("imgui", imgui_shots)):
+ if not only or only == name:
+ fn()
+
+
+if __name__ == "__main__":
+ main(sys.argv[1] if len(sys.argv) > 1 else ".", os.environ.get("BUI_THEME", "dark"))
diff --git a/website/.gitignore b/website/.gitignore
new file mode 100644
index 0000000..16d54bb
--- /dev/null
+++ b/website/.gitignore
@@ -0,0 +1,24 @@
+# build output
+dist/
+# generated types
+.astro/
+
+# dependencies
+node_modules/
+
+# logs
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+
+
+# environment variables
+.env
+.env.production
+
+# macOS-specific files
+.DS_Store
+
+# jetbrains setting folder
+.idea/
diff --git a/website/.vscode/extensions.json b/website/.vscode/extensions.json
new file mode 100644
index 0000000..22a1505
--- /dev/null
+++ b/website/.vscode/extensions.json
@@ -0,0 +1,4 @@
+{
+ "recommendations": ["astro-build.astro-vscode"],
+ "unwantedRecommendations": []
+}
diff --git a/website/.vscode/launch.json b/website/.vscode/launch.json
new file mode 100644
index 0000000..d642209
--- /dev/null
+++ b/website/.vscode/launch.json
@@ -0,0 +1,11 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "command": "./node_modules/.bin/astro dev",
+ "name": "Development server",
+ "request": "launch",
+ "type": "node-terminal"
+ }
+ ]
+}
diff --git a/website/AGENTS.md b/website/AGENTS.md
new file mode 100644
index 0000000..0d4c280
--- /dev/null
+++ b/website/AGENTS.md
@@ -0,0 +1,11 @@
+# Notes for agents working on the website
+
+- Writing or editing docs pages: follow [WRITING.md](WRITING.md). Pages are
+ `src/content/docs/**.mdx`; sections are defined in `src/config/nav.ts`.
+- Check facts against the repository (one level up), not memory. List the
+ files you checked in the page's `sources:` frontmatter.
+- Only change files inside `website/`.
+- `pnpm build` must pass without warnings. Astro 7 needs Node 22.23+; with an
+ older Node use `bun --bun run build`.
+- Start the dev server in the background (`astro dev --background`; manage it
+ with `astro dev stop | status | logs`). Astro's docs: https://docs.astro.build
diff --git a/website/README.md b/website/README.md
new file mode 100644
index 0000000..3217ca9
--- /dev/null
+++ b/website/README.md
@@ -0,0 +1,140 @@
+# BUI website
+
+The documentation site for [BUI](https://github.com/ppmpreetham/BUI): an
+[Astro](https://astro.build) static site with MDX content, Tailwind CSS 4 and
+a little vanilla JavaScript (tabs, search, theme toggle, the landing-page
+demos). No framework runtime ships to the browser.
+
+**Writing docs?** Read [WRITING.md](WRITING.md): voice, page template,
+components, and the list of planned pages to claim.
+
+## Develop
+
+Astro 7 needs **Node.js 22.23 or newer** (or Bun).
+
+```sh
+cd website
+pnpm install # or: npm install
+pnpm dev # http://localhost:4321
+```
+
+With an older Node, run Astro on Bun instead: `bun --bun run dev`.
+
+| Command | What it does |
+| --- | --- |
+| `pnpm dev` | Dev server with live reload |
+| `pnpm build` | Static site in `dist/` |
+| `pnpm preview` | Serve `dist/` locally |
+| `pnpm check` | Type-check components, pages and content frontmatter |
+
+## Deploy
+
+`pnpm build` writes a plain static site to `dist/`. Upload it to any static
+host (GitHub Pages, Cloudflare Pages, Netlify, an S3 bucket …). Set the
+address at build time:
+
+```sh
+SITE_URL=https://example.org pnpm build # served at the root
+SITE_URL=https://user.github.io BASE_PATH=/BUI pnpm build # served under /BUI/
+```
+
+`SITE_URL` is used for canonical links, Open Graph images and the sitemap
+(default: `https://bui.preetham.top`, see `astro.config.mjs`). Every internal
+link goes through `href()` in `src/lib/docs.ts`, so a sub-path deploy works.
+The host should serve `404.html` for unknown paths (most do by default).
+
+### bui.preetham.top
+
+The production site is `https://bui.preetham.top`, which is already the
+default `SITE_URL`, so a plain `pnpm build` produces the right canonical
+links, Open Graph URLs, `sitemap-index.xml` and `robots.txt`. The output is a
+static `dist/` folder: any static host works. Settings for the two common
+ones:
+
+| Setting | Cloudflare Pages | Netlify |
+| --- | --- | --- |
+| Root / base directory | `website` | `website` |
+| Build command | `pnpm install --frozen-lockfile && pnpm build` | same |
+| Output / publish directory | `dist` | `dist` |
+| Node.js | `NODE_VERSION=22.23.4` or newer (`engines` in `package.json`) | same |
+| Package manager | pnpm (from `pnpm-lock.yaml`; both hosts detect it) | same |
+| Environment | none needed; set `SITE_URL` only for a preview domain | same |
+
+With an older Node on the host, build with Bun instead (`bun install && bun --bun run build`; tested with Bun 1.4).
+
+Then point the `bui.preetham.top` DNS record at the host (a CNAME to the
+Pages / Netlify site) and enable HTTPS there. No redirects or headers are
+required: `/docs` redirects to the introduction through a generated HTML page,
+and unknown paths get `404.html`.
+
+## How it's put together
+
+```
+website/
+ astro.config.mjs site URL, integrations (MDX, sitemap, Expressive Code), Tailwind
+ ec.config.mjs code block themes and colors (Expressive Code)
+ WRITING.md the writers' guide
+ public/ favicon, OG image, screenshots (images/ copied from ../docs/images)
+ src/
+ config/nav.ts ★ the docs sections, their order, the language list, top links
+ config/site.ts name, description, repository links
+ content.config.ts the docs schema (frontmatter fields)
+ content/docs/**.mdx ★ the pages: one file = one page
+ components/docs/ MDX components (Callout, LangTabs, Steps, Figure, StatusTable …)
+ components/site/ header, sidebar, table of contents, search palette, footer, icons
+ components/landing/ the landing page sections and demos
+ layouts/ Base (head, theme) and DocsLayout (sidebar, TOC, prev/next)
+ lib/docs.ts ordering, prev/next, links, last-updated dates
+ lib/string-search.ts Blender's fuzzy search, ported (docs search, landing demo)
+ lib/shots.ts finds light/dark screenshot pairs in public/images/shots/
+ data/bench.ts every benchmark number (charts and tables read it)
+ components/charts/ BenchChart, BarChart, GroupedBarChart, LineChart, BenchTable
+ pages/ index (landing), docs/[...slug], search.json, 404
+ styles/global.css design tokens, prose styles, the hatch
+```
+
+- **Sidebar, breadcrumbs, previous/next, search and "Soon" badges** are
+ generated from the content collection. Adding a page is adding one `.mdx`
+ file.
+- **Search** is a static index (`/search.json`) built with the site and
+ searched in the browser with a port of Blender's menu search
+ (`src/lib/string-search.ts`): <kbd>Ctrl</kbd>+<kbd>K</kbd>, <kbd>Cmd</kbd>+<kbd>K</kbd>
+ or <kbd>/</kbd>.
+- **Last updated** comes from the page's last git commit (or the file's
+ modification time before it's committed).
+- **Theme**: light and dark follow the system until the reader picks one with
+ the toggle (stored in `localStorage` as `bui:theme`).
+
+## Design tokens
+
+Defined once in `src/styles/global.css` and exposed to Tailwind (`bg-surface`,
+`text-muted`, `border-border`, `text-link`, `bg-primary` …).
+
+| Token | Light | Dark | Use |
+| --- | --- | --- | --- |
+| `--primary` | `#4772b3` | `#4772b3` | Blender's selection blue: active nav, buttons, BUI's bars in charts |
+| `--primary-soft` | `#e3ebf6` | `#253041` | Quiet blue surface: selected search result |
+| `--accent` | `#c94a00` | `#ed5700` | Blender's active orange; sparingly |
+| `--link` | `#2f5896` | `#8cb0ea` | Link text (contrast-safe blue) |
+| `--background` | `#fbfbfa` | `#1b1b1b` | Page |
+| `--surface` / `--surface-2` | `#f2f2f0` / `#e8e8e5` | `#222222` / `#2b2b2b` | Panels, table heads, inline code |
+| `--foreground` / `--muted` | `#161616` / `#545452` | `#e8e8e8` / `#a6a6a6` | Text / secondary text |
+| `--border` / `--border-strong` / `--border-soft` | `#d3d3cf` / `#b4b4b0` / `#e5e5e1` | `#383838` / `#4c4c4c` / `#2d2d2d` | Structure lines / emphasis / row dividers |
+| `--hatch` | blue 24% | blue 42% | The 135° hatch dividers (`.hatch`) |
+| `--stage` | `#eceeef` | `#141414` | Behind screenshots |
+| `--code-bg` | `#f6f6f4` | `#171717` | Code blocks |
+| `--chart-*` | greys and blues | same, darker | Charts (`src/styles/charts.css`) |
+| `--status-*` | stable, preview, experimental, soon, warn | lighter in dark | Status icons and callouts |
+| `--bl-*` | Blender's default theme (`region #303030`, `widget #545454` …) | same | Demos that imitate Blender widgets |
+
+Icons are [Phosphor](https://phosphoricons.com) (MIT), inlined at build time by
+`src/components/site/Icon.astro` from `@phosphor-icons/core`. No emoji in the UI.
+
+Motion: `[data-reveal]` elements and charts fade or grow in when scrolled
+into view (Base.astro), only with JavaScript and without
+`prefers-reduced-motion`. <kbd>Ctrl</kbd>+<kbd>Z</kbd> outside a text field
+goes back a page.
+
+Type: Inter Variable (Blender's UI font) for text, JetBrains Mono Variable for
+code, both self-hosted through Fontsource. Corners are square; only the
+Blender-widget demos use Blender's 4 px rounding.
diff --git a/website/WRITING.md b/website/WRITING.md
new file mode 100644
index 0000000..27b90ee
--- /dev/null
+++ b/website/WRITING.md
@@ -0,0 +1,644 @@
+# Writing BUI's docs
+
+This is the guide for everyone writing pages for the BUI website. Read it once
+before your first page; keep the [cheat-sheet](#component-cheat-sheet) open
+while you write.
+
+The four pages already written set the bar. Read them first, and copy their
+shape:
+
+- `src/content/docs/start/introduction.mdx`: a concept page
+- `src/content/docs/start/installation.mdx`: a task page with `<LangTabs>`
+- `src/content/docs/tutorials/first-app-python.mdx`: a tutorial with `<Steps>`
+- `src/content/docs/project/roadmap.mdx`: a status page with `<StatusTable>`
+
+---
+
+## 1. Who we're writing for
+
+From newcomers to experts, on the same page:
+
+- **Newcomers** may never have used Blender, a UI toolkit or a terminal
+ much. They need the first two paragraphs to make sense on their own, and
+ every new term defined the first time it appears.
+- **Experienced developers** skim. They need headings that say what's in the
+ section, code they can copy, and exact names (`NumberSlider`, `BUI_GPU=1`).
+- **Experts** want limits and edge cases. Put them in their own section
+ ("Limitations", "How it works") near the end, not sprinkled through the
+ tutorial.
+
+When the two pull apart, write the main path for the newcomer and link the
+expert to the detail.
+
+### Per-language pages: one language, one reader
+
+Pages that belong to one language (`tutorials/first-app-*`,
+`tutorials/tkinter-app`, `python/*`, `rust/*`, `javascript/*`, `imgui/*`,
+`c/*`) are read by someone who knows **only that language** and is coming
+from it.
+
+- Explain concepts in that language's own terms and idioms.
+- No comparisons with other languages or their libraries ("like React's
+ `useState`", "unlike Python…", "the same as the Rust crate"). No cards
+ that send the reader to another language's page.
+- Don't assume knowledge of other ecosystems. A Rust page may mention Rust
+ crates (gpui, Leptos, taffy); a Python page may mention tkinter and Qt.
+ Dear ImGui pages may map from ImGui's C++ names, because that's how
+ ImGui's own docs are written.
+- Shared pages (`start/`, `concepts/`, `reference/`, `performance/`,
+ `project/`) may compare languages.
+
+### Rust: both syntaxes, always
+
+BUI's Rust crate has two first-class syntaxes: **`rsx!`** (HTML-like
+markup, components and hooks) and **gpui builders** (`div().flex().gap_2()
+.child(...)`, `Render`, `cx.listener`, state in the view's fields). Wherever
+a Rust page shows a UI example, show **both**, side by side:
+
+````mdx
+<Tabs sync="rust-syntax" label="Rust syntax">
+<Tab label="rsx!">
+
+```rust
+rsx! { <div flex gap-2>"Hi"</div> }
+```
+
+</Tab>
+<Tab label="gpui builders">
+
+```rust
+div().flex().gap_2().child("Hi")
+```
+
+</Tab>
+</Tabs>
+````
+
+Always use exactly these labels and `sync="rust-syntax"`, so the reader's
+choice carries across pages. Never present the builder syntax as a
+footnote or an "advanced" alternative. Say "HTML-like markup" for `rsx!`,
+not "JSX".
+
+### Rust is on crates.io
+
+`blenderui` is published on crates.io: install with `cargo add blenderui`.
+Never write "not published yet" or tell readers to use a git dependency for
+it. The exception is `blenderui-imgui`, which isn't on crates.io yet: for
+that crate only, show the git dependency.
+
+### No recaps, no emoji
+
+- **No `<Recap>` blocks.** End a page with next-step cards only.
+- **No emoji anywhere in content** (no checkmarks, colored dots, test
+ tubes, arrows-as-emoji). For status, use `<StatusTable>` status keys
+ (`done`, `partial`, `experimental`, `planned`), `<Badge>`, or plain words
+ ("Works", "Partial", "Experimental"). The components draw the icons.
+
+### Demo tricks: once, and only where they're true
+
+Drag-to-scrub, <Kbd keys="Ctrl+Z" /> undo and typing `2*pi` into a field are
+BUI's party tricks. Mention each **at most once per page**, and only where
+it's relevant. Typed math works only in **Blender number fields and
+sliders** (Blender components, tkinter `Spinbox` / `Scale`, `QSlider`,
+form controls inside `styled`, ImGui's Blender-widgets build). Never imply
+it works in plain text inputs: an HTML `<input>` outside `styled`,
+tkinter's `Entry`, `QLineEdit` or ImGui's `InputText`.
+
+## 2. Voice
+
+**Warm, confident, precise.** Like a friend who knows the code well and is
+happy you're here.
+
+- **Second person, active voice.** "Drag the slider", not "the slider can be
+ dragged". "BUI redraws only the widget", not "only the widget is redrawn".
+- **Short sentences.** One idea each. If a sentence has two commas and an
+ "and", split it.
+- **Plain words.** "Use", not "utilize". "Start", not "initialize" (unless
+ it's the API's name).
+- **Define terms on first use**, in the same sentence: "the **kit**, BUI's
+ runtime written in C, …". Add new terms to the glossary page.
+- **Lead with what the reader gets**, then how. "You get Blender's color
+ picker: click the swatch." not "ColorSwatch opens a picker on click."
+- **Be honest about status.** If something is partial, say so in the first
+ place the reader would trip over it. Never imply something works when it
+ doesn't. Unbuilt features get `<ComingSoon />` (see below).
+- **Never invent numbers.** Every number (timings, counts, sizes) must come
+ from the repository, with the same rounding. Benchmarks come with their
+ context (machine, renderer, what was measured). If you can't find a source,
+ leave the number out.
+- **No fake quotes, testimonials or users.**
+- **Headings** are sentence case, no trailing period: "Drag across
+ checkboxes", not "Drag Across Checkboxes."
+- **Write "BUI"** for the project, `blenderui` for the Python and Rust
+ package names, and `@blender-ui/react` / `@blender-ui/native` for npm.
+ In Python code, import `blenderui` (not `bui`): it's the published name.
+- **Keyboard keys** use `<Kbd>`: <Kbd>Ctrl</Kbd>, `<Kbd keys="Ctrl+Shift+Z" />`.
+ Write "Ctrl" (not "Control" or "^") and add "(Cmd on macOS)" only where
+ it's true.
+
+### Jokes
+
+**One gentle joke per page, at most**, and it's optional. Put it in
+`<Callout type="joke">` or a short aside in the text. Good jokes are about
+Blender culture (the default cube, pressing <Kbd>Q</Kbd>, render noise) or
+about software. Never about the reader, their skill, other projects or
+people. If you have to explain it, cut it.
+
+## 3. Page template
+
+Copy this into a new `.mdx` file and fill it in:
+
+```mdx
+---
+title: Number fields and sliders # sentence case, no period
+description: One sentence that says what the reader will get from this page.
+section: Concepts # one of the sections in src/config/nav.ts
+order: 30 # position in the section; leave gaps
+status: stable # stable | preview | coming-soon
+languages: ["python", "rust"] # optional: python rust javascript c cpp imgui
+badges: ["Windows only"] # optional, short
+sources: ["docs/components.md", "kit/intern/kit_widgets.c"] # repo files you checked
+---
+
+A hook: one or two sentences that tell the reader why this matters to them,
+in their terms. What will they be able to do after reading?
+
+## First section
+
+Plain explanation, then a small, runnable example.
+
+## …
+
+## Next steps
+
+<CardGrid>
+ <Card title="…" href="docs/…/" icon="arrow-right">One sentence.</Card>
+</CardGrid>
+```
+
+Rules of thumb:
+
+- **The hook** is the first lines, before any heading. No "In this page we
+ will…". Say what the reader gets.
+- **Examples are small and runnable.** Copy-paste into a file and run. Show
+ the imports. Prefer 5 to 25 lines. Give the file a name with `title=`.
+- **Every page ends with next-step cards** (two to four). No `<Recap>`.
+- **Length:** tutorials can be long; guides should be skimmable; reference
+ pages are tables. Split a page when it has more than about eight `##`
+ sections.
+- **Don't repeat other pages.** Link to them. The installation page owns
+ installation; the reference pages own full tables.
+
+## 4. Adding a page or a section
+
+**Add a page:** create one `.mdx` file under `src/content/docs/<folder>/`.
+That's all. The sidebar, breadcrumbs, previous/next links, search index and
+"Soon" badges are generated from the frontmatter. The URL follows the path:
+`src/content/docs/rust/hooks.mdx` → `/docs/rust/hooks/`.
+
+- `section` decides the sidebar group (the folder is just for tidiness; keep
+ them matching).
+- `order` decides the position inside the group (ties sort by title).
+- `draft: true` keeps a page out of the build while you work on it.
+- The build fails if the frontmatter doesn't match the schema in
+ `src/content.config.ts`, so typos in `section` are caught for you.
+
+**Add a section:** add an entry to `sections` in `src/config/nav.ts`, in the
+order it should appear. Nothing else changes.
+
+**Components need no imports.** Every component in `src/components/docs/` is
+available in every `.mdx` page.
+
+**Links between pages:** in Markdown, use relative links with a trailing
+slash: from `/docs/start/installation/`, write
+`[the tutorial](../../tutorials/first-app-python/)`. In `<Card href>`, use the
+site path without a leading slash: `href="docs/tutorials/first-app-python/"`.
+Both keep working if the site moves to a sub-path.
+
+**Check your work:**
+
+```sh
+pnpm dev # http://localhost:4321, live reload
+pnpm build # must finish with no errors or warnings
+pnpm check # type-checks components and frontmatter
+```
+
+## 5. Component cheat-sheet
+
+All components live in `src/components/docs/` and are documented at the top
+of each file.
+
+### Callout
+
+```mdx
+<Callout type="tip">Hold Shift while dragging for fine control.</Callout>
+<Callout type="warning" title="Windows only">The npm packages are prebuilt for Windows x64.</Callout>
+<Callout type="joke">BUI is Blender's UI, minus the default cube.</Callout>
+```
+
+`type`: `note` (default), `tip`, `warning`, `joke`, `coming-soon`. Optional
+`title`. One or two per page; if everything is a callout, nothing is.
+
+### ComingSoon
+
+For features that **aren't built yet**. It links to the roadmap and to
+GitHub issues.
+
+```mdx
+<ComingSoon feature="WebAssembly" />
+
+<ComingSoon feature="Per-glyph font fallback">
+ Characters missing from Inter show as boxes for now. Blender's BLF fallback is next.
+</ComingSoon>
+
+Works on Linux and Windows; macOS GPU rendering is <ComingSoon inline />.
+```
+
+If a whole page describes something unbuilt, also set `status: coming-soon`
+in the frontmatter: the sidebar shows "Soon" and the roadmap lists it.
+
+### LangTabs, Tabs and Tab
+
+`<LangTabs>` remembers the reader's language across pages. Use the labels
+**Python, Rust, JavaScript, C, C++, Dear ImGui** so the choice carries over.
+Leave blank lines around Markdown inside a `<Tab>`.
+
+````mdx
+<LangTabs>
+<Tab label="Python">
+
+```py
+bui.set_gpu(True)
+```
+
+</Tab>
+<Tab label="Rust">
+
+```rust
+Application::new().gpu(true)
+```
+
+</Tab>
+</LangTabs>
+````
+
+`<Tabs>` is the same without the language memory; `<Tabs sync="pkg">`
+syncs all tab groups with the same key (for example npm / pnpm / bun). Don't
+nest tabs.
+
+### Steps
+
+Wrap a normal numbered list. Each step starts with a bold sentence that says
+what to do.
+
+```mdx
+<Steps>
+
+1. **Install BUI.**
+
+ ```sh
+ pip install blenderui
+ ```
+
+2. **Run the demo.**
+
+</Steps>
+```
+
+The bold first sentence becomes the step's title: it stays pinned under the
+header while the reader is in that step, and a rail fills as they go. Keep it
+short (one line).
+
+### Figure
+
+```mdx
+<Figure
+ src="images/qt.png"
+ alt="A Qt-syntax form on BUI: text field, dropdown, slider and buttons"
+ caption="Qt syntax, drawn by BUI (<code>examples/qt_syntax_demo.py</code>)"
+ width={520}
+ height={222}
+/>
+```
+
+`alt` says what's in the picture; `caption` says why it matters. `width` and
+`height` are read from the file when you leave them out. `variant="bleed"`
+drops the hatched stage for wide images.
+
+**Light and dark screenshots.** The reader sees the one that matches the
+site's theme:
+
+```mdx
+<Figure light="images/shots/qt-form-light.png" dark="images/shots/qt-form-dark.png" alt="…" />
+<Figure shot="qt-form" src="images/qt.png" alt="…" /> {/* the pair from images/shots/, src until it exists */}
+<ThemedImage shot="qt-form" fallback="images/qt.png" alt="…" /> {/* the bare image, no frame */}
+```
+
+### Charts: BenchChart, BarChart, GroupedBarChart, LineChart
+
+Every published benchmark number lives in `src/data/bench.ts` (copied from
+README.md "Performance"). Use it instead of retyping numbers:
+
+```mdx
+<BenchChart id="first-frame" /> {/* chart + "Open bench" with the exact table */}
+<BenchTable id="startup" /> {/* just the exact table */}
+```
+
+Chart ids: `first-frame`, `idle-all`, `start-time`, `start-cpu`, `idle-cpu`,
+`memory-start`, `start-all`, `fps`, `cpu-per-frame`, `ram`,
+`cpu-per-frame-cells`, `uncapped-fps`, `frame-times`, `js-first-frame`,
+`js-cpu-3000`. Table ids: `startup`, `cells3000`, `cellsFull`, `frameTimes`,
+`jsStartup`, `jsAnim3000`, `jsAnim1000`, plus one-language views for per-language
+pages: `startupGpui` (the same gpui code only), `jsStartupJs`, `jsAnim3000Js`,
+`jsAnim1000Js` (no Rust rows). Optional `title`, `subtitle`, `plain` (no headline
+number) and `table` (a different table id under "Open bench").
+
+Your own numbers (still from the repository, with their source):
+
+```mdx
+<BarChart
+ title="Wheel size" unit="MB" better="lower"
+ bars={[
+ { label: "blenderui", value: 4.2, ours: true },
+ { label: "PySide6", value: 180 },
+ ]}
+/>
+<GroupedBarChart title="…" unit="ms" series={[{ name: "CPU", ours: true }, { name: "GPU" }]}
+ groups={[{ label: "Rust", values: [38, 42] }]} />
+<LineChart title="…" unit="fps" x={[100, 1000, 3000]} xLabel="cells"
+ lines={[{ name: "GPU", ours: true, values: [1491, 309, 94] }]} />
+```
+
+`ours: true` draws BUI's bars in Blender blue; the rest are hatched grey with
+an automatic "N× more" note. Add `table={{ caption, columns, rows }}` for an
+"Open bench" disclosure.
+
+### StatusTable
+
+```mdx
+<StatusTable rows={[
+ ["tkinter syntax", "done", "Every public name: 7,846 of 7,846"],
+ ["Qt syntax", "partial", "About 25% of the main classes' methods"],
+ ["macOS host", "experimental", "Written, not yet run on a Mac"],
+ ["WebAssembly", "planned", "The kit in a <code>&lt;canvas&gt;</code>"],
+]} />
+```
+
+Status: `done`, `partial`, `experimental`, `planned` (the component draws
+the icon and label; never type emoji yourself). Optional
+`columns={["Feature", "Status", "Notes"]}`, `legend={false}`.
+
+### CardGrid and Card
+
+`<Recap>` still exists as a component, but don't use it: pages have no
+recaps.
+
+```mdx
+<CardGrid>
+ <Card title="Hooks" href="docs/rust/hooks/" icon="layers" kicker="Rust">use_state, signals and effects.</Card>
+ <Card title="egui" soon>BUI panels inside egui.</Card>
+</CardGrid>
+```
+
+`<CardGrid cols={3}>` for three columns. Card icons: any
+[Phosphor](https://phosphoricons.com) name (`rocket-launch`, `gauge`,
+`file-py`, `terminal-window` …) or a short alias (`terminal`, `book`,
+`sparkles`, `flag`, `layers`, `zap`, `cpu`, `monitor`, `undo`, `github`).
+A misspelled name fails the build. The same icons work inline:
+`<Icon name="flask" weight="duotone" />`.
+
+### Compare
+
+```mdx
+<Compare left="Standard tkinter" right="On BUI">
+ <div slot="left">
+
+ Text, code or a `<Figure />`.
+
+ </div>
+ <div slot="right">
+
+ The other side.
+
+ </div>
+</Compare>
+```
+
+### Kbd, Badge, Hatch, PageStatusList
+
+```mdx
+Press <Kbd>Q</Kbd>, or <Kbd keys="Ctrl+Shift+Z" />.
+<Badge>New</Badge> <Badge tone="preview">Preview</Badge> <Badge tone="soon">Soon</Badge>
+<Hatch /> {/* a divider between big parts of a long page */}
+<PageStatusList status="coming-soon" /> {/* pages by status, from the collection */}
+```
+
+### Code blocks
+
+Code blocks use [Expressive Code](https://expressive-code.com): copy
+buttons, light and dark themes, and these extras:
+
+````mdx
+```py title="app.py" {3} ← file name tab, line 3 highlighted
+```rust ins={2} del={1} ← added / removed lines
+```sh frame="terminal" title="PowerShell" ← a terminal window
+```js "useState" ← highlight a word
+````
+
+Use `py`, `rust`, `js`/`jsx`/`ts`, `c`, `cpp`, `cmake`, `toml`, `sh` (for
+commands; no `$` prompts), `text` for output.
+
+### Tables
+
+Plain Markdown tables. They get borders and scroll sideways on phones. Align
+numbers right with `| ---: |`.
+
+## 6. Images
+
+- **Screenshots of BUI** come from the repository: `docs/images/*.png`,
+ regenerated by `python tools/gen_doc_images.py`. Copy the ones you use into
+ `website/public/images/` with the same file name, and reference them as
+ `images/<name>.png`.
+- Don't edit, crop or upscale screenshots; they show real pixels. Never
+ present a mock-up as a screenshot. If no screenshot exists, say so, or ask
+ for one in your PR.
+- **Diagrams**: prefer a short list or table. If you need a picture, use an
+ inline SVG in the site's colors (`currentColor`, `var(--primary)`), with
+ text in the SVG for accessibility.
+- File names: lowercase, dashes, what it shows: `rust-forms.png`.
+- Keep PNGs under about 200 KB.
+
+Images available now in `public/images/`: `c-kit-hello.png`, `components.png`,
+`components-layout.png`, `components-nodes.png`, `components-values.png`,
+`components-views.png`, `first-app-python.png`, `imgui-blender.png`,
+`imgui-python-hello.png`, `imgui-python-hello-blender.png`, `imgui-stock.png`,
+`qt.png`, `qt-export.png`, `qt-gauge.png`, `react-counter.png`,
+`rust-forms.png`, `rust-hello.png`, `rust-showcase.png`, `tkinter_canvas.png`,
+`tkinter_items.png`, `tkinter_messagebox.png`, `tkinter_notes.png`,
+`tkinter-render-settings.png`. New screenshots go in `public/images/shots/` as `-dark.png` / `-light.png` pairs,
+listed in `public/images/shots/INDEX.md`. They're rendered at 2x and shown at
+half their pixel size.
+
+- **Show the result.** Wherever a page shows a UI result, add a `<Figure>`
+ with a real screenshot. If none exists yet, leave a placeholder comment for
+ the image pass, naming the file and what it must show:
+
+ ```mdx
+ {/* IMAGE: shots/<area>-<name>-dark.png — what it should show */}
+ ```
+
+## 7. Getting the facts right
+
+The repository is the source of truth; the website explains it. Before you
+write a claim, find it.
+
+1. **Start with the existing guides**: `README.md`, `docs/*.md`,
+ `INTEGRATION.md`, `ARCHITECTURE.md`, `CHANGELOG.md`,
+ `bindings/imgui/README.md`, `bindings/imgui/blender/README.md`,
+ `bindings/rust/bench/README.md`, `SYNTAX_COVERAGE.md`.
+2. **Check names against the code**: Python in `bindings/python/bui/`, Rust
+ in `bindings/rust/*/src/`, JavaScript in `bindings/node/` and
+ `bindings/react/`, the C API in `kit/include/BUI_kit.h`, CMake options in
+ `CMakeLists.txt`, Python packaging in `pyproject.toml`.
+3. **Prefer runnable examples from `examples/` and the tests.** The tests
+ (`bindings/python/tests/`, `bindings/rust/*/tests/`, `tests/`) show real,
+ working usage.
+4. **List what you checked** in the `sources:` frontmatter. They appear as
+ links at the bottom of the page, so readers (and the next writer) can
+ verify.
+5. **When the docs disagree with the code, the code wins.** Note the
+ mismatch in your PR. Known ones so far:
+ - `docs/rust.md` says Rust 1.85; `bindings/rust/Cargo.toml` says
+ `rust-version = "1.88"`. The site says 1.88.
+ - `docs/publishing.md` says Linux wheels use the Tk window; `pyproject.toml`
+ now installs the X11 headers for cibuildwheel, so Linux wheels get the
+ native host (as `README.md` says).
+6. **Don't run heavy builds to check a claim** (no parallel C or Rust
+ builds; the maintainers' machine doesn't like it). Read the code instead.
+
+## 8. Planned pages
+
+About 50 pages, grouped by section. **Claim one** by opening an issue or a
+draft PR titled `docs: <path>`, then write it. Keep the file path, so links
+from other pages keep working. Orders leave gaps for later pages.
+
+Already written: `start/introduction`, `start/installation`,
+`tutorials/first-app-python`, `project/roadmap`.
+
+### Tutorials (`src/content/docs/tutorials/`)
+
+| File | Order | Scope |
+| --- | --- | --- |
+| `tkinter-app.mdx` | 20 | Run an existing tkinter app unchanged (`blenderui-tk`, `install()`, import by name), then use the Blender look (`LabelFrame` as panels, `Spinbox` as number fields). Sources: `docs/tkinter.md`, `examples/tk_unchanged_app.py` |
+| `first-app-qt.mdx` | 30 | A small Qt-syntax form: `QApplication`, layouts, signals, a slider driving a progress bar. Be upfront that Qt is partial. Sources: `docs/qt.md`, `examples/qt_syntax_demo.py` |
+| `first-app-rust.mdx` | 40 | The `hello.rs` counter in both syntaxes: `rsx!` with a `#[component]`, `use_state` and Tailwind attributes, and gpui builders with state in the view; a `<NumberSlider>`. Sources: `docs/rust.md`, `bindings/rust/blenderui/examples/hello.rs` |
+| `first-app-react.mdx` | 50 | A React counter on Node or Bun, signals in JSX, then `bui build` to a 5 MB executable. Sources: `docs/javascript.md`, `bindings/react/examples/counter.jsx` |
+| `first-app-imgui.mdx` | 60 | Dear ImGui's demo on BUI from Python and C++, then the Blender-widgets build. Sources: `docs/imgui.md`, `examples/imgui_demo.cpp` |
+| `first-app-c.mdx` | 70 | `kit_hello.c` line by line: nodes, properties, the packer, the host callback, the window loop. Sources: `docs/c-api.md`, `examples/kit_hello.c` |
+
+### Python (`src/content/docs/python/`)
+
+| File | Order | Scope |
+| --- | --- | --- |
+| `tkinter.mdx` | 10 | tkinter compatibility: the three ways in, module map, what you get, the Blender look, behaviour notes, limitations, testing your app against stdlib tkinter. Source: `docs/tkinter.md` |
+| `qt-syntax.mdx` | 20 | Qt syntax: how it maps, supported classes, signals, layouts, custom painting with `QPainter`, coverage (~25%) and what's missing. Source: `docs/qt.md` |
+| `components.mdx` | 30 | The Blender components: `App`, the common API (`value`, `on_change`, `description`, `weight`), layout with `Column`/`Row`/`Panel`/`Split`, menus and pie menus. Source: `docs/components.md` |
+| `components-reference.mdx` | 40 | Every component's signature in tables: layout, values, buttons, views, menus, color and editors, node editor and areas. Source: `docs/components.md`, `bindings/python/bui/components/` |
+| `headless-testing.mdx` | 50 | Testing Python UIs without a window: `render_raster`, `press`/`motion`/`release`, pixels, frame budgets. Sources: `docs/components.md`, `bindings/python/tests/test_components.py` |
+
+### Rust (`src/content/docs/rust/`)
+
+| File | Order | Scope |
+| --- | --- | --- |
+| `rsx-and-components.mdx` | 10 | `rsx!` / `view!` markup, control flow in markup, `#[component]` with optional props and `key`, three component styles (zopra, React, Leptos). Source: `docs/rust.md` |
+| `hooks.mdx` | 20 | `use_state`, `signal`, `Memo`, `Effect`, context; React, Leptos and zopra spellings; limits (no `use_resource` yet). Source: `docs/rust.md` |
+| `html-elements.mdx` | 30 | All 113 HTML elements, what they draw like, `<details>`, lists, tables, inline text. Source: `docs/rust.md#elements` |
+| `css-and-tailwind.mdx` | 40 | `<style>` sheets, selectors, the cascade, `var()`, colors, at-rules; Tailwind v4 classes and bare attributes; "did you mean" errors; `tw!`. Source: `docs/rust.md#styling`, `CHANGELOG.md` |
+| `styled-and-blender-components.mdx` | 50 | The three looks: plain HTML, `styled`, and Blender components (`Button`, `Checkbox`, `NumberSlider` …); form controls. Sources: `docs/rust.md`, `examples/forms.rs` |
+| `layout.mdx` | 55 | Flexbox, grid with named areas, tables, `calc()`, taffy under the hood. Source: `docs/rust.md#layout` |
+| `effects-and-animations.mdx` | 60 | `@keyframes`, transitions, filters, `backdrop-filter`, blend modes, `clip-path`, masks, 2D transforms. Source: `docs/rust.md` |
+| `events.mdx` | 70 | Listeners, `cx.listener`, closures without parameters, painting your own content. Source: `docs/rust.md#events` |
+| `headless-testing.mdx` | 80 | `Application::headless()`, screenshots to PNG, tests. Source: `docs/rust.md#headless-rendering-and-tests` |
+| `gpui-syntax.mdx` | 90 | The gpui-compatible app model (`Application`, `Render`, `WindowHandle`, `div().flex()`), compiling gpui code unchanged. Sources: `docs/rust.md#the-app-model`, `bindings/rust/bench/common/settings.rs` |
+
+### JavaScript & React (`src/content/docs/javascript/`)
+
+| File | Order | Scope |
+| --- | --- | --- |
+| `native-api.mdx` | 10 | `@blender-ui/native`: `App`, windows, `createElement`, attributes, events, `requestAnimationFrame`, headless mode. Source: `docs/javascript.md#plain-javascript` |
+| `react.mdx` | 20 | `@blender-ui/react`: `render`, JSX setup (`jsxImportSource`), host components, Blender components, Suspense and transitions. Source: `docs/javascript.md#react` |
+| `signals.mdx` | 30 | Hooks that hold signals: pass `{count}` to update one node, read `count.value` to re-render; the conformance suite. Source: `docs/javascript.md#hooks-and-signals` |
+| `standalone-executables.mdx` | 40 | `bui build` (QuickJS, ~5 MB), `--bun`, `--console`, `--dev`, `bui run`. Source: `docs/javascript.md#standalone-apps` |
+
+### Dear ImGui (`src/content/docs/imgui/`)
+
+| File | Order | Scope |
+| --- | --- | --- |
+| `cpp.mdx` | 10 | `imgui.h` + `imgui_impl_bui.h`, `ImGui_ImplBUI_CreateApp`, linking `bui::imgui`. Source: `docs/imgui.md#c` |
+| `c.mdx` | 20 | `cimgui.h`, all 399 functions, the C app helpers. Source: `docs/imgui.md` |
+| `python.mdx` | 30 | `blenderui.imgui`, pyimgui-style returns, `imgui.run`. Source: `docs/imgui.md#python` |
+| `rust.mdx` | 40 | The `blenderui-imgui` crate, the safe API and the FFI. Source: `docs/imgui.md#rust` |
+| `blender-widgets.mdx` | 50 | `BUI_IMGUI_BLENDER_WIDGETS` / `blender-widgets`: what changes, the mapping table, behaviour differences, gaps. Sources: `bindings/imgui/blender/README.md` |
+| `coverage.mdx` | 60 | What's covered per language, what's skipped and why, regenerating the bindings, the Blender style. Sources: `docs/imgui.md#coverage`, `bindings/imgui/README.md` |
+
+### C & C++ (`src/content/docs/c/`)
+
+| File | Order | Scope |
+| --- | --- | --- |
+| `c-api.mdx` | 10 | The kit API: nodes, properties, geometry managers, the context and host, windows, events. Source: `docs/c-api.md`, `kit/include/BUI_kit.h` |
+| `embedding.mdx` | 20 | BUI drawing inside your own renderer: render sinks, the stable C ABI (`api/`), the Qt/QPainter backend, PySide, SVG output. Source: `INTEGRATION.md` |
+
+### Concepts (`src/content/docs/concepts/`)
+
+| File | Order | Scope |
+| --- | --- | --- |
+| `how-it-works.mdx` | 10 | The layers: your code → bindings → kit → renderer → window. What's ported from Blender. Sources: `README.md#how-it-works`, `ARCHITECTURE.md` |
+| `blender-widgets.mdx` | 20 | Blender's widgets and interactions in depth: number-field dragging rules, Ctrl snapping, sliders, multi-field drags, drag-toggle, menus, search, undo. Sources: `docs/components.md#interactions`, `CHANGELOG.md` |
+| `rendering.mdx` | 30 | CPU raster vs GPU (Direct3D 11, OpenGL 3.3): turning it on, pixel parity, memory trade-offs, Slug text. Sources: `docs/getting-started.md#gpu-rendering`, `ARCHITECTURE.md` |
+| `damage-rendering.mdx` | 40 | Why idle costs nothing: damage rects, tiles, frame pacing. Sources: `README.md`, `ARCHITECTURE.md` |
+| `window-hosts.mdx` | 50 | Native Win32 / X11 / Cocoa hosts, the Tk fallback (`BUI_HOST=tk`), headless mode, HiDPI, Linux without X11. Source: `docs/getting-started.md#window-hosts` |
+| `text-and-fonts.mdx` | 60 | Inter embedded, FreeType rendering like Blender's BLF, Slug on the GPU, `BUI_FONT`, limits (no fallback, no IME, bidi without shaping). Sources: `CHANGELOG.md`, `README.md` |
+| `theming.mdx` | 70 | Blender's theme in BUI: where colors come from (`userdef_default_theme.c`), icons, what you can change today. Verify in `kit/` before writing; mark anything unbuilt with `<ComingSoon>`. |
+
+### Performance (`src/content/docs/performance/`)
+
+| File | Order | Scope |
+| --- | --- | --- |
+| `benchmarks.mdx` | 10 | The published results with their context: start time and battery, frame times, Rust vs gpui, JavaScript startup and animation. Source: `README.md#performance` |
+| `run-benchmarks.mdx` | 20 | How to rerun every benchmark, one at a time. Sources: `README.md#run-the-benchmarks-yourself`, `bindings/rust/bench/README.md` |
+| `profiling.mdx` | 30 | `BUI_PROFILE=1`, choosing a renderer, keeping lists on signals, common slow paths. Sources: `README.md`, `docs/javascript.md#performance` |
+
+### Reference (`src/content/docs/reference/`)
+
+| File | Order | Scope |
+| --- | --- | --- |
+| `environment-variables.mdx` | 10 | Every `BUI_*` variable, what it does, defaults. Source: `docs/getting-started.md#environment-variables` |
+| `cmake-options.mdx` | 20 | Every CMake option with default and effect. Sources: `docs/getting-started.md#build-options`, `CMakeLists.txt` |
+| `platforms.mdx` | 30 | The full platform matrix and per-platform notes. Source: `README.md#platforms` |
+| `coverage.mdx` | 40 | Coverage numbers in one place: tkinter, Qt, HTML, CSS, Tailwind, ImGui. Sources: `SYNTAX_COVERAGE.md`, `docs/rust.md#coverage`, `docs/qt.md#coverage` |
+| `glossary.mdx` | 50 | Kit, binding, node, host, render sink, damage rendering, raster, Slug, signal, `styled` … one or two sentences each. |
+
+### Project (`src/content/docs/project/`)
+
+| File | Order | Scope |
+| --- | --- | --- |
+| `faq.mdx` | 20 | The README FAQ, expanded: Blender not needed, unchanged tkinter, not a browser, real ImGui, vs Electron, macro cost, why GPL. Source: `README.md#faq` |
+| `contributing.mdx` | 30 | How to help: issues, PRs, tests, the code of conduct, security reports, writing docs (link this guide). Sources: `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, `SECURITY.md` |
+| `publishing.mdx` | 40 | Releasing to PyPI, npm and crates.io (for maintainers). Source: `docs/publishing.md` |
+| `changelog.mdx` | 50 | A readable summary of `CHANGELOG.md` with a link to the full file; don't copy it wholesale. |
+| `license-and-credits.mdx` | 60 | GPL-2.0-or-later and why, third-party licenses, acknowledgments. Source: `README.md#license` |
+
+## 9. Before you open a PR
+
+- [ ] Frontmatter complete: `title`, `description`, `section`, `order`, `sources`.
+- [ ] A hook in the first lines and next-step cards. No `<Recap>`, no emoji.
+- [ ] Per-language page: no comparisons with other languages.
+- [ ] Rust page: every UI example in both `rsx!` and gpui builders.
+- [ ] Demo tricks mentioned at most once; typed math only for number fields.
+- [ ] A `<Figure>` (or an `IMAGE:` placeholder) wherever a UI result is shown.
+- [ ] Every number and name checked against the repository.
+- [ ] Unbuilt features marked with `<ComingSoon>` (and `status` if the whole page is).
+- [ ] Code examples are complete and runnable as shown.
+- [ ] At most one joke.
+- [ ] `pnpm build` passes with no warnings; the page looks right in light
+ and dark, on a phone and a desktop.
diff --git a/website/astro.config.mjs b/website/astro.config.mjs
new file mode 100644
index 0000000..b3b372b
--- /dev/null
+++ b/website/astro.config.mjs
@@ -0,0 +1,31 @@
+// @ts-check
+import { defineConfig } from "astro/config";
+import mdx from "@astrojs/mdx";
+import sitemap from "@astrojs/sitemap";
+import expressiveCode from "astro-expressive-code";
+import tailwindcss from "@tailwindcss/vite";
+
+// Where the site is deployed. Override at build time:
+// SITE_URL=https://example.org BASE_PATH=/docs pnpm build
+const SITE_URL = process.env.SITE_URL ?? "https://bui.preetham.top";
+const BASE_PATH = process.env.BASE_PATH ?? "/";
+
+export default defineConfig({
+ site: SITE_URL,
+ base: BASE_PATH,
+ // "ignore": /docs/x and /docs/x/ both work, and unknown paths get our 404
+ // page in dev too (with "always", Astro answers a missing slash with its own
+ // error page). The build still writes /docs/x/index.html.
+ trailingSlash: "ignore",
+ redirects: {
+ "/docs": "/docs/start/introduction/",
+ },
+ integrations: [
+ expressiveCode(),
+ mdx(),
+ sitemap(),
+ ],
+ vite: {
+ plugins: [tailwindcss()],
+ },
+});
diff --git a/website/ec.config.mjs b/website/ec.config.mjs
new file mode 100644
index 0000000..ed6294f
--- /dev/null
+++ b/website/ec.config.mjs
@@ -0,0 +1,56 @@
+// @ts-check
+// Expressive Code (code blocks): themes, frames and colors. Read by astro.config.mjs and by
+// the <Code> component on the landing page.
+import { defineEcConfig } from "astro-expressive-code";
+
+export default defineEcConfig({
+ themes: ["github-dark-default", "github-light-default"],
+ // <html data-theme="dark|light"> picks the theme; the media query covers no-JS readers.
+ customizeTheme: (theme) => {
+ theme.name = theme.type;
+ },
+ useDarkModeMediaQuery: true,
+ themeCssSelector: (theme) => `[data-theme='${theme.type}']`,
+ defaultProps: { wrap: false, frame: "code" },
+ styleOverrides: {
+ borderRadius: "0",
+ borderColor: "var(--border)",
+ borderWidth: "1px",
+ codeBackground: "var(--code-bg)",
+ codeFontFamily: "'JetBrains Mono Variable', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
+ codeFontSize: "0.8125rem",
+ codeLineHeight: "1.65",
+ uiFontFamily: "'Inter Variable', Inter, system-ui, sans-serif",
+ uiFontSize: "0.8125rem",
+ focusBorder: "var(--primary)",
+ scrollbarThumbColor: "var(--scrollbar)",
+ scrollbarThumbHoverColor: "var(--muted)",
+ frames: {
+ shadowColor: "transparent",
+ frameBoxShadowCssValue: "none",
+ editorBackground: "var(--code-bg)",
+ editorTabBarBackground: "var(--surface-2)",
+ editorActiveTabBackground: "var(--code-bg)",
+ editorActiveTabForeground: "var(--foreground)",
+ editorActiveTabIndicatorTopColor: "var(--primary)",
+ editorActiveTabIndicatorBottomColor: "transparent",
+ editorTabBorderRadius: "0",
+ editorTabBarBorderBottomColor: "var(--border)",
+ terminalBackground: "var(--code-bg)",
+ terminalTitlebarBackground: "var(--surface-2)",
+ terminalTitlebarForeground: "var(--muted)",
+ terminalTitlebarBorderBottomColor: "var(--border)",
+ terminalTitlebarDotsForeground: "var(--muted)",
+ terminalTitlebarDotsOpacity: "0.5",
+ inlineButtonBackground: "var(--foreground)",
+ inlineButtonForeground: "var(--foreground)",
+ inlineButtonBorder: "var(--border)",
+ tooltipSuccessBackground: "var(--primary)",
+ tooltipSuccessForeground: "#ffffff",
+ },
+ textMarkers: {
+ markBackground: "color-mix(in oklab, var(--primary) 16%, transparent)",
+ markBorderColor: "var(--primary)",
+ },
+ },
+});
diff --git a/website/package.json b/website/package.json
new file mode 100644
index 0000000..a0d15f8
--- /dev/null
+++ b/website/package.json
@@ -0,0 +1,31 @@
+{
+ "name": "bui-website",
+ "type": "module",
+ "version": "0.0.1",
+ "engines": {
+ "node": ">=22.23.4"
+ },
+ "scripts": {
+ "dev": "astro dev",
+ "build": "astro build",
+ "preview": "astro preview",
+ "check": "astro check",
+ "astro": "astro"
+ },
+ "dependencies": {
+ "@astrojs/mdx": "8.1.2",
+ "@astrojs/sitemap": "3.7.4",
+ "@fontsource-variable/inter": "5.3.0",
+ "@fontsource-variable/jetbrains-mono": "5.3.0",
+ "@phosphor-icons/core": "2.1.1",
+ "@tailwindcss/vite": "4.3.4",
+ "astro": "7.4.5",
+ "astro-expressive-code": "0.44.3",
+ "tailwindcss": "4.3.4"
+ },
+ "devDependencies": {
+ "@astrojs/check": "0.9.12",
+ "typescript": "^6.0.3"
+ },
+ "private": true
+}
diff --git a/website/pnpm-lock.yaml b/website/pnpm-lock.yaml
new file mode 100644
index 0000000..acd7099
--- /dev/null
+++ b/website/pnpm-lock.yaml
@@ -0,0 +1,3533 @@
+lockfileVersion: '9.0'
+
+settings:
+ autoInstallPeers: true
+ excludeLinksFromLockfile: false
+
+importers:
+
+ .:
+ dependencies:
+ '@astrojs/mdx':
+ specifier: 8.1.2
+ '@astrojs/sitemap':
+ specifier: 3.7.4
+ version: 3.7.4
+ '@fontsource-variable/inter':
+ specifier: 5.3.0
+ version: 5.3.0
+ '@fontsource-variable/jetbrains-mono':
+ specifier: 5.3.0
+ version: 5.3.0
+ '@phosphor-icons/core':
+ specifier: 2.1.1
+ version: 2.1.1
+ '@tailwindcss/vite':
+ specifier: 4.3.4
+ astro:
+ specifier: 7.4.5
+ astro-expressive-code:
+ specifier: 0.44.3
+ tailwindcss:
+ specifier: 4.3.4
+ version: 4.3.4
+ devDependencies:
+ '@astrojs/check':
+ specifier: 0.9.12
+ typescript:
+ specifier: ^6.0.3
+ version: 6.0.3
+
+packages:
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-GMDC7Eo0myBUA/QLBl0u+OcegJ8LiBhccmNZR34KmprQNP8gQUJlWlOOZWUsxNA2rNS6GuPYcGDyLoPnjmn4/Q==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-hazpqxIfZWj2VhyPyR0pOEQ/IhFDM/2nIApL96zMXABdD8NrUKYDmhxTy7h+drTDl9MQG/Sd1ET/4amadVJUUA==}
+ hasBin: true
+ peerDependencies:
+ typescript: ^5.0.0 || ^6.0.0
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-kckIxon6Rm/Bxzh9mGPYpRRqUbToUQoHptCmpMmE+Yt0Xumq8CqrKUidyYhrBsrHVO7bxuRzzWUUqvpf+iYceQ==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [android]
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-1ZG5Ar3dD8HtodX9XH1mRmE0qBXZlvjYXSFfpgFwocqfWnvhFuqtGUNseL8wgfImiRMztIjpQqlogQFQQtgiag==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-+kl35S7hiHJ2cb7eujwEsPFYYuSgE11uEE2Z20lAJ+undpgulMcW+weQqFPOSSZccEKHOiLIY+kQHkb4e4092w==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [darwin]
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-BqlR0EHNQLPLwgL9+xogjsAc7zGf0cHho2CPdhv0P1yqbVMwGVaGAqrANP6VYAXCqSC43AF4Czcxc2n+oqdesg==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-GRGyby3AZWw5d6JQzidyxPyvGgHWsSusrpgKyFVpDTKctABF7L3Pd5V1cRJbV36/rcu+Eh292/wL7pF7MkmGkQ==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-9XAqGTMQAtIslMsjK3xdyY6OI9d59OZqcLBB6pvD/DcoR0daYswfrKx2azdDERDY4AqAnWPC7odVM1BmxYv3Vw==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-jOViewGeTh9bSfS8vK72ECxoy2yvmA+Pd/ZcEvBI5c7+7IcfHwZ5qA4L9fRYuOhSrAifvQ2dV4vm1XAtloaWBw==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-Z7p64doar1uvR5C9Xs6j1CV9lGlPVQX7OQ2aAtZ/xKC5aGS6GB13nyc2UfQXTQLvZrvVwsyaflTQy6ziY5Bekw==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [wasm32]
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-Tr13bh+ahTWsjXjzctK7pFpWV+dUU4FtBfETlR7gO+ueex0F+RDch7eRr0YfKysaRhk9tWm14lsCJ5uWyFPNHQ==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [win32]
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-SfKkI+jOQYLh6wojPvVPV0lFfQnxisweN9B+qCzRvZp7DHAuGif8Y0WcC5PUgN4jb8VKy57LggQDtggR46Du1g==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [win32]
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-lEn76+0JcMQ5RDXU0wSMWJg2ZppiZvSULpghC29cfv4o9bhvWFDbQjsCtvjjXN9iVLFQ7fL3wTR2L2UU13mP8g==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-IvwYLB8t1M86rKO4oPdBi9GP4gzXcgrVlNgocjwos1jeeUuEIV8d9Crn1PvYD/5IKteWOxpIHomf7e8iYlkE+Q==}
+ engines: {node: '>=22.12.0'}
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-20jxQqnSmpskcGyad7N5l6Xf1gz0UCa6lNde44bEBdaXGpncEYfAZJ142r2ZgzBaG4dUyzGmhqZWv1INU2eiHQ==}
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-QIAFu1e/4quJMTPdmBOm+ZPXc5NDGZE4/YQjgR3EgjhGLl/tdidaWJDr5WmO2lesVc+BW1qN/xNBURmuePDG2A==}
+ hasBin: true
+ peerDependencies:
+ prettier: ^3.0.0
+ prettier-plugin-astro: '>=0.11.0'
+ peerDependenciesMeta:
+ prettier:
+ optional: true
+ prettier-plugin-astro:
+ optional: true
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-6biKp2lEAYycF3jhv91br+Otyf4EgDFkF1oRL9ks0u/m/YRGmI7XkGQ2MgaM35DslT03f7NtozKtlqfBNkp6bw==}
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-ZIUVfosVtK4SKcFrGOH+1+HwG0encjxQOxu76M9VuTqeQNZWQ//2eY2Iz+W1eq87AOT5JD4wOHyZ8xFwlcFteg==}
+ engines: {node: '>=22.23.4'}
+ peerDependencies:
+ '@astrojs/markdown-remark': ^7.3.0
+ '@astrojs/markdown-satteri': ^0.4.0
+ astro: ^7.2.10
+ peerDependenciesMeta:
+ '@astrojs/markdown-remark':
+ optional: true
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-jMrUEpFDarDO1KWPvVc9eSa8DSfwBlwEOHwX+8zvZQpiqXRGDxFnOXHsYqV6DP7w+0qIgTr98gS1GdQlm8ypWg==}
+ engines: {node: '>=22.23.4'}
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-LbKNC24bdUWcQf/pThB6qLlSqHojxGjZDURIzFocY8rlWnAn2t74nnhnK6S5x0NHriHoAduLEpVjRykmeGiVvA==}
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-2JOMRUxJrBSfiVDfeKLv1wBmvSIx1Y6u2YEO8awZ9qSq3u/rNAiUyFdOYi8dHv91kHrmYEQX7pRDw0J4xyj3UA==}
+ engines: {node: '>=22.23.4'}
+
+ '@astrojs/[email protected]':
+ resolution: {integrity: sha512-8oddpOae35pJsXPQXhTkM0ypfKPskVsh2bCxRtbf7e+/Epw2nReakFYpLKjZMEr75CsoF203PMnCocpfz0s69A==}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-fWegr+WsEsiMVW4KUNdIIzzMTZSzNiqhy0//6+2MRi2d5NFNsL/AYwBQW8eBnRbTBVRnDVzjaJEUqKaCWjMMdQ==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==}
+ engines: {node: '>=6.9.0'}
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-fJM50YYjlTiBhgdkGmC1tBpv+FMAyo4annf2X6Aks+0yRlaiVkYW/3f07xAfVVkYIoZ9fFZp+mEThUFnuybhkQ==}
+ engines: {node: '>=6.0.0'}
+ hasBin: true
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ==}
+ engines: {node: '>=6.9.0'}
+
+ '@bruits/[email protected]':
+ resolution: {integrity: sha512-27KTVl4TJkVahMy/ohyA7qd4938G5UNneFUz/PsScYfpIhj0IVAS23mpcJXdPF44sa6nva198lmV/cKIb2YPyA==}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@bruits/[email protected]':
+ resolution: {integrity: sha512-IjnLe3nKspq6qaeqGgjT7MT8VrTV74yWRlaag7ZdNsI8TDAYZ0iPxMCo+9KQZHUk5EyVB+reBI/PFWL5KuFw9Q==}
+ cpu: [x64]
+ os: [darwin]
+
+ '@bruits/[email protected]':
+ resolution: {integrity: sha512-glkYXZCJywjP13v67eAyAMSJdF+ncvEbYvgi/wOtffL9tQ27lr/zsyzUfgs+ovjJ9d8JNQKiXeiArJcX8PJL9w==}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ '@bruits/[email protected]':
+ resolution: {integrity: sha512-yWdgG1g17Nh2QyGVlFUxGRa3FEFwiMcpZEyMNWkbM3deC94cmVc+/i9OuyFpdKuWo3GkgoCtYVOoxk1uCnCZIA==}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ '@bruits/[email protected]':
+ resolution: {integrity: sha512-FVaLoPT1fBgGl0J+AYebyyXJYBachGl8Oyyrf1lye4RTqCB4S0Gwkj1uM9RJyThUOvx5VUmAT1CnNh1SFHA+kw==}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ '@bruits/[email protected]':
+ resolution: {integrity: sha512-EHpVAx2bqW3GINHTKkljtxVfQmVDGWIuwOYOP5YghTj+0PkBa2o8oKPRtQ9Kbsr1Fye8jtUcDjhwj2jMNugZKg==}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ '@bruits/[email protected]':
+ resolution: {integrity: sha512-ypz8c/Zmipxp4IoeDa228Gstv6TLzVmNs3yC6wKCoNSOjx1iwpgzu87Y3hTkXFdwChVGU85qeUDuOIarGUZQLw==}
+ engines: {node: '>=14.0.0'}
+ cpu: [wasm32]
+
+ '@bruits/[email protected]':
+ resolution: {integrity: sha512-siTV88nb0LRqNpkL2gXboqCwVdq95sLtzMHS1/3eONV2gLbB3NAK46wmSMvCO/yquBvI2lvaFIfd8P12ecsxBw==}
+ cpu: [arm64]
+ os: [win32]
+
+ '@bruits/[email protected]':
+ resolution: {integrity: sha512-C3IfPvfvMXmlzBxaMPKFS1XiuV9pu2mC7YqkPk7PSvTgPZ8gbdASIpHpztDLvTTQjqZ0z1Ol8tK5X+V6XXC0wQ==}
+ cpu: [x64]
+ os: [win32]
+
+ '@capsizecss/[email protected]':
+ resolution: {integrity: sha512-CuNiSqg7+e1cO/GjffyMOm5Tt2jUF9CWHHnvQ/UkqvtkGfHdgwEC0wpmq7fkN3gxwpRnrAN0WzO3vREKmNolMQ==}
+ engines: {node: '>=18'}
+
+ '@clack/[email protected]':
+ resolution: {integrity: sha512-iHTrHA8MtVuLl2TfZySmcKv1qO2PoyC9Z7pfSDozEuV5vtY3/wcOPKJXlqJ5Oq2Cx5DDGQGAMVx6HZfRRoVEbQ==}
+ engines: {node: '>= 20.12.0'}
+
+ '@clack/[email protected]':
+ resolution: {integrity: sha512-dlT1m5e/0yUL0kRNcQn7yGLVThkgbB0Ga/1AmfDDC/8ik6AIiSf2QLQO2zPYvefsHP0aFgxO93cVLCCfDp7kzQ==}
+ engines: {node: '>= 20.12.0'}
+
+ resolution: {integrity: sha512-9rQHijqB2Rq6qOEC/xHaA6aPlsKGi5kmCQW50O1asn9g63XFeD5NmBwysriistW5Xx0JPafyD/TA7yk2S3pXGQ==}
+ engines: {node: '>=14'}
+
+ '@emmetio/[email protected]':
+ resolution: {integrity: sha512-mgv58UrU3rh4YgbE/TzgLQwJ3pFsHHhCLqY20aJq+9comytTXUDNGG/SMtSeMJdkpxgXSXunBGLD8Boka3JyVA==}
+
+ '@emmetio/[email protected]':
+ resolution: {integrity: sha512-s9yjhJ6saOO/uk1V74eifykk2CBYi01STTK3WlXWGOepyKa23ymJ053+DNQjpFcy1ingpaO7AxCcwLvHFY9tuw==}
+
+ '@emmetio/[email protected]':
+ resolution: {integrity: sha512-2bC6m0MV/voF4CTZiAbG5MWKbq5EBmDPKu9Sb7s7nVcEzNQlrZP6mFFFlIaISM8X6514H9shWMme1fCm8cWAfQ==}
+
+ '@emmetio/[email protected]':
+ resolution: {integrity: sha512-NTbsvppE5eVyBMuyGfVu2CRrLvo7J4YHb6t9sBFLyY03WYhXET37qA4zOYUjBWFCRHO7pS1B9khERtY0f5JXPQ==}
+
+ '@emmetio/[email protected]':
+ resolution: {integrity: sha512-IqRuJtQff7YHHBk4G8YZ45uB9BaAGcwQeVzgj/zj8/UdOhtQpEIupUhSk8dys6spFIWVZVeK20CzGEnqR5SbqA==}
+
+ '@emmetio/[email protected]':
+ resolution: {integrity: sha512-ZsZ2I9Vzso3Ho/pjZFsmmZ++FWeEd/txqybHTm4OgaZzdS8V9V/YYWQwg5TC38Z7uLWUV1vavpLLbjJtKubR1A==}
+
+ '@emmetio/[email protected]':
+ resolution: {integrity: sha512-fXVXEyFA5Yv3M3n8sUGT7+fvecGrZP4k6FnWWMSZVQf69kAq0LLpaBQLGcPR30m3zMmKYhECP4k/ZkzvhEW5kw==}
+
+ '@emnapi/[email protected]':
+ resolution: {integrity: sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==}
+
+ '@emnapi/[email protected]':
+ resolution: {integrity: sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==}
+
+ '@emnapi/[email protected]':
+ resolution: {integrity: sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==}
+
+ '@emnapi/[email protected]':
+ resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==}
+
+ '@emnapi/[email protected]':
+ resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==}
+
+ '@emnapi/[email protected]':
+ resolution: {integrity: sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==}
+
+ '@expressive-code/[email protected]':
+ resolution: {integrity: sha512-pffktF0TJoxC08dgNcutl/0LcSnTrjF6vXR39qVpwZ0EyxpwO9zjI7dbni6sO7w3yHpRBO0voLFvhzB+EPJRsA==}
+
+ '@expressive-code/[email protected]':
+ resolution: {integrity: sha512-ysW4VXk9vXEliA99Ur6ApUepVtx74sPolp6o/j45BRjZQoL5O6kXKMhSP4koQLih8HbC5B3ImIvO+HKKhkv/oA==}
+
+ '@expressive-code/[email protected]':
+ resolution: {integrity: sha512-jAibAZPG7lDmi61EFJADZjoSZzjHiwZZdbbgR/mTlWXM4ON/Pyo/9tB2vrqQNKylsci6jqtCi6idrwqQXF53xA==}
+
+ '@expressive-code/[email protected]':
+ resolution: {integrity: sha512-4Ae2xRSDV5kdWPsi40xWbOtoihbzM0zLVjQKkDAnD5KzFXl+6/kd+VhuWOlTRVaJ5cqGk++vCbAaf0MR1XbZlw==}
+
+ '@fontsource-variable/[email protected]':
+ resolution: {integrity: sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA==}
+
+ '@fontsource-variable/[email protected]':
+ resolution: {integrity: sha512-F32xpS2NsGYoQi2ADSkKTgpJj7ozajsGgDJ8woTnqjmIB+dxDIqImjl4pXZVEExu8UFZ2ndhmX18EBS/hdz3Lw==}
+
+ resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==}
+ engines: {node: '>=20.9.0'}
+ cpu: [arm64]
+ os: [darwin]
+
+ resolution: {integrity: sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==}
+ engines: {node: '>=20.9.0'}
+ cpu: [x64]
+ os: [darwin]
+
+ resolution: {integrity: sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==}
+ engines: {node: '>=20.9.0'}
+ os: [freebsd]
+
+ resolution: {integrity: sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==}
+ cpu: [arm64]
+ os: [darwin]
+
+ resolution: {integrity: sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==}
+ cpu: [x64]
+ os: [darwin]
+
+ resolution: {integrity: sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==}
+ cpu: [arm]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==}
+ cpu: [ppc64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==}
+ cpu: [riscv64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==}
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ resolution: {integrity: sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ resolution: {integrity: sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==}
+ engines: {node: '>=20.9.0'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==}
+ engines: {node: '>=20.9.0'}
+ cpu: [arm]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==}
+ engines: {node: '>=20.9.0'}
+ cpu: [ppc64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==}
+ engines: {node: '>=20.9.0'}
+ cpu: [riscv64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==}
+ engines: {node: '>=20.9.0'}
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==}
+ engines: {node: '>=20.9.0'}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==}
+ engines: {node: '>=20.9.0'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ resolution: {integrity: sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==}
+ engines: {node: '>=20.9.0'}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ resolution: {integrity: sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==}
+ engines: {node: '>=20.9.0'}
+
+ resolution: {integrity: sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==}
+ engines: {node: '>=20.9.0'}
+ cpu: [wasm32]
+
+ resolution: {integrity: sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==}
+ engines: {node: '>=20.9.0'}
+ cpu: [arm64]
+ os: [win32]
+
+ resolution: {integrity: sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==}
+ engines: {node: ^20.9.0}
+ cpu: [ia32]
+ os: [win32]
+
+ resolution: {integrity: sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==}
+ engines: {node: '>=20.9.0'}
+ cpu: [x64]
+ os: [win32]
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
+ engines: {node: '>=6.0.0'}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==}
+
+ '@jridgewell/[email protected]':
+ resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
+
+ '@napi-rs/[email protected]':
+ resolution: {integrity: sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g==}
+ engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}
+ peerDependencies:
+ '@emnapi/core': ^1.7.1 || ^2.0.0-alpha.4
+ '@emnapi/runtime': ^1.7.1 || ^2.0.0-alpha.4
+
+ '@napi-rs/[email protected]':
+ resolution: {integrity: sha512-zJccwplOAbgfZju95IUHazLnx9RAPtPN2YGJXI6UbrgeaR9QfPjGrQL6ERkSAtnVCA4Q+83ApGyaX5zdpCaKkQ==}
+ engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}
+ peerDependencies:
+ '@emnapi/core': ^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3
+ '@emnapi/runtime': ^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3
+
+ '@oslojs/[email protected]':
+ resolution: {integrity: sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ==}
+
+ '@oxc-project/[email protected]':
+ resolution: {integrity: sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==}
+
+ '@phosphor-icons/[email protected]':
+ resolution: {integrity: sha512-v4ARvrip4qBCImOE5rmPUylOEK4iiED9ZyKjcvzuezqMaiRASCHKcRIuvvxL/twvLpkfnEODCOJp5dM4eZilxQ==}
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm]
+ os: [android]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [android]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [darwin]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [freebsd]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm]
+ os: [linux]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [ppc64]
+ os: [linux]
+ libc: [glibc]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [openharmony]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [win32]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [win32]
+
+ '@rolldown/[email protected]':
+ resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==}
+
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-bfd4OKgvoyXYiYmMRuleA656P4V7M/Du9lcTl38Ngm6KszMj7bq4J1IGZwSYR4c95Tv5UQALtYNWUwaI9UT3xw==}
+ engines: {node: '>=20'}
+
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-K0oqxFoL+kEMdz89mHLFO15Tsbv3kFZ6WR1cXZKMvLSc+oqaM00A6pyga1qSeXB22dP0tTiSApRcGBaKWsEccg==}
+ engines: {node: '>=20'}
+
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-aggd6Q7SuJOXNnsUbfG2XesxBJKBMAw/PDTUo9PyRjMaaJJ2dNrI+q0C+25ARXAK9yLHAlwxc9oRT2u68YKZ7w==}
+ engines: {node: '>=20'}
+
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-1yMEX3oCVV54LUq/ovfpRkDQoYDkcvjSWFFa/YLUDMiSoRzMi2uxLJYbv41ahT8Lu9lFMaa7hecd3Q39trqUyg==}
+ engines: {node: '>=20'}
+
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-c54+TQEo9ToqgfL/AU8FpjnV09+GA9Oa7M5ROkkXteZfp5XzpAJGXjjvZQFQioJOwm/w/6Z3lIzQstAkl8coag==}
+ engines: {node: '>=20'}
+
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-qHAVAs80RiGD+IRuH9G+JPDOEc9A/kHsng4EzCUCwB9bLzW6Z0y9WETh2YyCcADJBmfrIaJ1Jp7KBNP6FHkgtQ==}
+ engines: {node: '>=20'}
+
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-+ENG1adsKt/X7cRYw1Nl7BEpBmPOjmQ7bR/eGmHuMlT8gtOFf3KEi5l31DJYyAWhW6Y6bjP1plU7FmaxWGENFw==}
+ engines: {node: '>=20'}
+
+ '@shikijs/[email protected]':
+ resolution: {integrity: sha512-cVBuhDQjBZaNMTwBquYfPydrUP+E3hE6oYGasx8h6ZrODIM7/r+gxLDXdd66oszbrggZHEntdE6j+5gYIVyMWQ==}
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-b7QK/QG04v3j04NbpG82XLCedRyulnkuwUDwRa9oK/ypnJIzMapz2Wg+0TltVczjUzDaJJHIa1+jj9aMUOFMTQ==}
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-qkjxt+EFocOi3mtsUS3ndlj6yj4SHubwBdvBynLnS8T4mvSzX0Enn0CpypJKmBEtczUAXOHVZKA2zTGzSNU2Sg==}
+ engines: {node: '>= 20'}
+ cpu: [arm64]
+ os: [android]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-i/awUA/7mJQAbA3AzCW8aQtUh5goMieUdF1zOoclLaJUCxDvsXQ8VJqpQZY3dfcHS6PJjd3tw25nNneD/mEviQ==}
+ engines: {node: '>= 20'}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-q56V9U6AnoYz/yj/alkDLhSQ9AZoXQSEl93f7WETa0+32CudbqM57BXdYXfMYPKudueXKaA+MG6L/0KRseF7Jg==}
+ engines: {node: '>= 20'}
+ cpu: [x64]
+ os: [darwin]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-r0W7A+Z9HTHh7bwihJl45E/zZKLjxD50/jToVF/E/RZHSl8+EWO+4yKKJpPMcUooT9hdoip3Zx1uWnbMg4N79g==}
+ engines: {node: '>= 20'}
+ cpu: [x64]
+ os: [freebsd]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-3aih/sRxzeYfi2Bkh+bGYNf2YU9Llamb2mpA7BNF1obYzdgEeWDAMQzK6BSwzLhs/eTdOaSur92qrGfchagUtQ==}
+ engines: {node: '>= 20'}
+ cpu: [arm]
+ os: [linux]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-ktJSrPGQou4OqL88rDEx5CkeM9BjzrwZvYo8u7B7VL1zkBa2XBm351o4MQrek95qikb2M++26Y7w7vbH6Mgl8g==}
+ engines: {node: '>= 20'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-rt3hjUxT7utAtcB+df6wHyaXDyxhE7Zd1x7L/nvB5Jb2qBb8dZwFUoWqeRja1BaF5OlSqkKSjBmVXj9OsevmCQ==}
+ engines: {node: '>= 20'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-XE3jO2yOOWjttpeGvpwf3/b274NMi3QapQSAI/EzsgrmYNan1Tw8dXT9JQkN7K0OgvuqiC8mcCyNvGzEkpVJPQ==}
+ engines: {node: '>= 20'}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-PaAZ2FjJaZk9SQLYtKIfQWiFm/xtl7pX2MKPgCzn0mS/VU54yu+vP457AJdB2XFLxU3gO2abLCt8N7Lg4EbKNg==}
+ engines: {node: '>= 20'}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-bjO9WmoM687p8AoCIyw1DUqzpAs4JICLvNmIPxIWDmhw8IOsdubtWQLShyJmISnDKtRy1BBApHVOUl6sNFQQJA==}
+ engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0}
+ bundledDependencies:
+ - '@napi-rs/wasm-runtime'
+ - '@emnapi/core'
+ - '@emnapi/runtime'
+ - '@tybys/wasm-util'
+ - '@emnapi/wasi-threads'
+ - tslib
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-jCrwCvWVtt7ruMXp6dFPd5KBNU8o1tWtEdZbTL/w/hvD3lUYZA0E2mmfvTzW4QLHIx5wGQU9HeY7997R1QTrEg==}
+ engines: {node: '>= 20'}
+ cpu: [arm64]
+ os: [win32]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-cge1wcedn1FrRSXL22lF5sNDYr8c9+VImk7zFYLPs12jkDmchSrZNfzWqOKub+5Hb/aYRdDEqERGGDKONBlOzQ==}
+ engines: {node: '>= 20'}
+ cpu: [x64]
+ os: [win32]
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-riqsRw2sLF7B1sNCCkTl3KYXEqvhTiABzZ/4oxxHfZ3c3Td60bCBfOrUuUGOiHagd3E7V+zG46c+XBDWZGFBcg==}
+ engines: {node: '>= 20'}
+
+ '@tailwindcss/[email protected]':
+ resolution: {integrity: sha512-wGukGWb8SVuN7+FJvSS7M5eSJWDIWwVSvUvj1q41eTIhGPsS2DAgFWjA7YURJNwjHSgty59Hz8iMUiyO+YMHBQ==}
+ peerDependencies:
+ vite: ^5.2.0 || ^6 || ^7 || ^8
+
+ '@tybys/[email protected]':
+ resolution: {integrity: sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==}
+
+ '@ungap/[email protected]':
+ resolution: {integrity: sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==}
+
+ '@volar/[email protected]':
+ resolution: {integrity: sha512-VocLtumfXnqnPQEWc9Yx7uC1uOh9gyjVNlrn2+6Zx/z9aM6yTLhPK8lSqM9Ilu81XRa48I00lcYJWLi2BLxx8Q==}
+ peerDependencies:
+ typescript: <7
+
+ '@volar/[email protected]':
+ resolution: {integrity: sha512-73fjwEV8wat6aOZ6U/y/hqtE30ocrIWECg67b0txGczOMNw+MffLmvJ5fnFfN9drVUEYZzLdaNo6VAy6G6avMw==}
+
+ '@volar/[email protected]':
+ resolution: {integrity: sha512-tcP9fzzUBbsLIFHhgnRU4ncQjMn9G9Vax0ffkQmdCrXVEYqRroUepmyC5AVgiju5bCiLD6a55qen5iOTQHkb3g==}
+ peerDependencies:
+ typescript: <7
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
+ '@volar/[email protected]':
+ resolution: {integrity: sha512-w/xDsASiqC71ggCOm7sTDXDNk/l72XEptodeRC68tgZ0e5QM4hM3zAqBGC7mBctvhrpYwKfMG+t9xcUo2hEFtA==}
+ peerDependencies:
+ typescript: <7
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
+ '@volar/[email protected]':
+ resolution: {integrity: sha512-zym1ob/KwDDyN+0jGVtxwbxJSRRnUvv5HspCtz3yEfVVdCG4/dzxJktMGPAgemqRuVs81O0o/y0q3qOUErR8kg==}
+
+ '@volar/[email protected]':
+ resolution: {integrity: sha512-/DgA5tgYFPfrLFuSjIMXMGHk1LQv2+P8eny6+BhGNzFJELWIW7UZlc56ZLIRFhLsPpMfIFxM8/HvOPBggrjTZg==}
+ peerDependencies:
+ typescript: <7
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
+ '@vscode/[email protected]':
+ resolution: {integrity: sha512-QLxjQR3imPZPQltfbWRnHU6JecWTF1QSWhx3GAKQpslx7y3Dp6sIIXhKjiUJ/BR9FX8PVthjr9PD6pNwOJfAzw==}
+
+ '@vscode/[email protected]':
+ resolution: {integrity: sha512-KYSIHVmslkaCDyw013pphY+d7x1qV8IZupYfeIfzNA+nsaWHbn5uPuQRvdRFsa9zFzGeudPuoGoZ1Op4jrJXIQ==}
+
+ resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==}
+ peerDependencies:
+ ajv: ^8.5.0
+ peerDependenciesMeta:
+ ajv:
+ optional: true
+
+ resolution: {integrity: sha512-v/ei2UkCEeuKNXh8RToiFsUclmU+G57LO1Oo22OagNMENIw+Yb8eMwvHu7Vn9fmkjJyv6XclhJ8TbuigSglPkg==}
+ peerDependencies:
+ ajv: ^8.0.0-beta.0
+
+ resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==}
+
+ resolution: {integrity: sha512-KLcsDhqf1XRrJmJr+9I/C0EX2K+sGrAGZFgkmd84c8TJO9zJBu+/kFInjazu1KfJWFhWDKdRWkpBzEs7s35DVA==}
+ hasBin: true
+
+ resolution: {integrity: sha512-zhvbbbdt1kbw7EJ9OQoxmQcuaNR9P5kTj7e/YdmOSU10aHWbycofJxA6jKfoEy3vlLdctOF9ZHaxLtmSm998wQ==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
+ engines: {node: '>= 8'}
+
+ resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==}
+
+ resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-LUpQmmvzr90JXP5QIAopgdjlOKLuT3x0wlPAUpc4OZtPtFS8sbflPcGPpL/lG3pQuUCQV2CXUFgYNBYNu9tphA==}
+ peerDependencies:
+ astro: ^4.0.0-beta || ^5.0.0-beta || ^3.3.0 || ^6.0.0-beta || ^7.0.0
+
+ resolution: {integrity: sha512-n5lET11/qnrOWn4wNpXxD9g2VKkTIa162hHgrkMPChMQC5q/xh2lY2OerK5mpsEAFCNmXsYA7NISE+9Uo7Cxxg==}
+ engines: {node: '>=22.23.4', npm: '>=9.6.5', pnpm: '>=7.1.0'}
+ hasBin: true
+ peerDependencies:
+ '@astrojs/markdown-remark': ^7.3.0
+ peerDependenciesMeta:
+ '@astrojs/markdown-remark':
+ optional: true
+
+ resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}
+ engines: {node: '>= 0.4'}
+
+ resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}
+
+ resolution: {integrity: sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==}
+
+ resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
+
+ resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}
+
+ resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==}
+
+ resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==}
+
+ resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==}
+ engines: {node: '>= 20.19.0'}
+
+ resolution: {integrity: sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==}
+ engines: {node: '>=20'}
+
+ resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}
+
+ resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==}
+ engines: {node: '>=16'}
+
+ resolution: {integrity: sha512-dnN3ibLeoRf2HNC+OlCiNc5d2zxbLJXOtiZUudNFSXZrNSydxcCsSpRzXwfu7BBWCIfHPw+xTayeBvJCP/D8Ng==}
+ engines: {node: '>= 18'}
+
+ resolution: {integrity: sha512-lXVyvUvrNXblMqzIRrxHb57UUVmqsSWlxqt3XIjCkUP0wDAf6uicO6KMbEgYrMNtEvWgWHwe42CKxPu9MYAnWw==}
+
+ resolution: {integrity: sha512-yuToqVvRrj6pfDXREyQAAv8SkAEk/8GS3jQRTiUMm66TVtBYmqQeoEjL2Lmq8Rpo6271vH76InTChTitEAm65w==}
+ engines: {node: '>=22'}
+
+ resolution: {integrity: sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA==}
+
+ resolution: {integrity: sha512-rZZVSLle8v0+EY8QAkDWrKhpgt6SA5OtHsgBnsj6ZaLb5dmDVOWUDtQitd9ydxxvEjhewNudS6eTVU7uOyzvXw==}
+
+ resolution: {integrity: sha512-Y2asgMGFqJKF4fq4xHDSlFYIkeVfRsm69lQC1q9kbEsH5XtnINTMrweLkjYMeaUgiXBy/uvKeO/a1JHTNnmB2g==}
+
+ resolution: {integrity: sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==}
+ engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'}
+
+ resolution: {integrity: sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==}
+ engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0}
+
+ resolution: {integrity: sha512-wD5oz5xibMOPHzy13CyGmogB3phdvcDaB5t0W/Nr5Z2O/agcB8YwOz6e2Lsp10pNDzBoDO9nVa3RGs/2BttpHQ==}
+ engines: {node: '>= 6'}
+
+ resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==}
+ engines: {node: '>=4'}
+ hasBin: true
+
+ resolution: {integrity: sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==}
+ engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'}
+
+ resolution: {integrity: sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==}
+
+ resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==}
+
+ resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-3woMEITftG1wKeO/4d/QXH1DVKctTSZg3jNGPpjp9hNr5Hos8MCFF5McTML5ZtgKDObm2R591B0spRp2IVernA==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==}
+
+ resolution: {integrity: sha512-svtcdpS8CgJyqAjEQIXdb3OjhFVVYjzGAPO8WGCmRbrml64SPw/jJD4GoE98aR7r25A0XcgrK3F02yw9R/vhQw==}
+ engines: {node: '>=0.3.1'}
+
+ resolution: {integrity: sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA==}
+ hasBin: true
+
+ resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==}
+
+ resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==}
+
+ resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==}
+ engines: {node: '>= 4'}
+
+ resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==}
+
+ resolution: {integrity: sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-23QPJB3moh/U9sT4rQzGgeyyGIrcM+GH5uVYg2C6wZIxAIJq7Ng3QLT79tl8FUwDXhyq9SusfknOrofAKqvgyQ==}
+
+ resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==}
+
+ resolution: {integrity: sha512-PPnnSJq3azKOIewXR/uppBV/6h98dprBJ/WaQ9Qgj10xX1lJLNfg+XShpbsrSqcDSy2yYYyhfXM1wWhftqgyzw==}
+ engines: {node: '>=10.13.0'}
+
+ resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
+ engines: {node: '>=0.12'}
+
+ resolution: {integrity: sha512-BldNY5mwkVu+cQ5Ymn3e6hB9Sx8XHx4ZevWbiUyZbfKxJxYO27Hf0wfzkxIaD5CAJMaGl3YspKELj0ff/7nCMA==}
+
+ resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==}
+
+ resolution: {integrity: sha512-7RGslhJTNt01pdn5I3QmVh5C8ZIiSm0A+ORQ9j9r39oOgJVKjn/7dXl9rMT/SqmFLE6pJkTYI7UjW0BxJnW7OQ==}
+
+ resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}
+
+ resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
+
+ resolution: {integrity: sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==}
+
+ resolution: {integrity: sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==}
+
+ resolution: {integrity: sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==}
+
+ resolution: {integrity: sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==}
+
+ resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==}
+ engines: {node: '>=12.0.0'}
+ peerDependencies:
+ picomatch: ^3 || ^4
+ peerDependenciesMeta:
+ picomatch:
+ optional: true
+
+ resolution: {integrity: sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-mJbcILTPybAR1jdOwt/lVv8N2cffeJFFP+gVbSAwLEx1ujXH27RpPd8Rokec/KX9c76UYIB6Co+H4lQzxPnJfA==}
+
+ resolution: {integrity: sha512-lDMvbAzSnHmbYMTEld5qdtvNH2/pWpICOqpean9IgC7vUbUJc3k+k5Dokp85CegamqQpFbXf0rAVkbzpyTA8aw==}
+
+ resolution: {integrity: sha512-Wp1zXWPVUPBmfoa3Cqc9ctaKuzKAV6uLstRqlR56kSjplf5uAce+qeyYym7F+PHbGTk+tCEdkCW6RD7DX/gBZw==}
+ engines: {node: '>=20'}
+
+ resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
+ os: [darwin]
+
+ resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
+ engines: {node: 6.* || 8.* || >= 10.*}
+
+ resolution: {integrity: sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-X6fBC0pmImC70gvX2zm56go9hx0MyoGVdG0tUCkg/D+Xnh5TJsOZ7iDbOdI3PvmtrDxnu1YdDufpK2QJX1Meqw==}
+ engines: {node: '>=20.20.0'}
+
+ resolution: {integrity: sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==}
+
+ resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
+
+ resolution: {integrity: sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg==}
+
+ resolution: {integrity: sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA==}
+
+ resolution: {integrity: sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==}
+
+ resolution: {integrity: sha512-RqGS1ZgI0MwxLaKLDxjprynNzINEkRHY2i8ln4DDjgv9ZhcYVIHN9rlpiYsqtFwrgpYU361SyWDQcGNIBVu3lw==}
+
+ resolution: {integrity: sha512-1SZUxCN3TtJAE7e2BQN2MBHsoZ1gnmi9GoCP5Di59CSWptIezSAW09yDZyVbanb78V9eCwrKqdQsjtfVTxYHWA==}
+
+ resolution: {integrity: sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A==}
+
+ resolution: {integrity: sha512-5yrlWOvGFs6CqHriUpSsNrjzT/Tdo+IOQudbznxOn8K5qblp18MJyzOg8IgDOKQ8MYgQcJA7SusuCjSpDr8mSA==}
+
+ resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==}
+
+ resolution: {integrity: sha512-1ALZXSmCGmW3h8AMz4R4+QKSKFi7sNgXLVwmwB8FYVtl1CwQ3WDkSAEY/d5tp1g/vbQgq2s1WlHgfO3jbw1TsA==}
+
+ resolution: {integrity: sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==}
+
+ resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}
+
+ resolution: {integrity: sha512-M5t5LlJpS1UHMjvwRQVdFHvPISGeLAxNcrWuJkeGh0KxsqCHZ1O3NXZU/8x7cD0BDcGW8kapxMKTvwlqrNkHkA==}
+
+ resolution: {integrity: sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg==}
+
+ resolution: {integrity: sha512-LHE+wROyG/Y/0ZnbktRCoTix2c1RhgWaZraMZ8o1Q7zCh0VSrICJQO5oqIIISrcSBtrXv0o233w1IYwsWCjTzA==}
+ engines: {node: '>=20'}
+ hasBin: true
+
+ resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==}
+ hasBin: true
+
+ resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==}
+
+ resolution: {integrity: sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg==}
+
+ resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==}
+
+ resolution: {integrity: sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [arm64]
+ os: [android]
+
+ resolution: {integrity: sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [arm64]
+ os: [darwin]
+
+ resolution: {integrity: sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [x64]
+ os: [darwin]
+
+ resolution: {integrity: sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [x64]
+ os: [freebsd]
+
+ resolution: {integrity: sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [arm]
+ os: [linux]
+
+ resolution: {integrity: sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ resolution: {integrity: sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ resolution: {integrity: sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ resolution: {integrity: sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [arm64]
+ os: [win32]
+
+ resolution: {integrity: sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==}
+ engines: {node: '>= 12.0.0'}
+ cpu: [x64]
+ os: [win32]
+
+ resolution: {integrity: sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==}
+ engines: {node: '>= 12.0.0'}
+
+ resolution: {integrity: sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==}
+ engines: {node: 20 || >=22}
+
+ resolution: {integrity: sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==}
+
+ resolution: {integrity: sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA==}
+
+ resolution: {integrity: sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==}
+
+ resolution: {integrity: sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==}
+
+ resolution: {integrity: sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==}
+
+ resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==}
+
+ resolution: {integrity: sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==}
+
+ resolution: {integrity: sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==}
+
+ resolution: {integrity: sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==}
+
+ resolution: {integrity: sha512-oxB2Ik03hI0gv+VNn9tnh1t1YEe9MDPptViAEgfdf3YQHsn0pzGTgCdlSCJXcwhqm8phaEuM7zeEu3QQzVBrPg==}
+
+ resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==}
+
+ resolution: {integrity: sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==}
+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
+ hasBin: true
+
+ resolution: {integrity: sha512-WmmLty1YWwJl9yZi77v2dVIV6X2kuYV8YYBI/G3LWGKdGHmHUvL1z7FW0iDvEvGAwNEoc5x1tOOOyDnf5jJw/w==}
+ engines: {node: '>= 10'}
+
+ resolution: {integrity: sha512-YKLBCcUYKAg0FNlOBT6aI91qFmSiFKiluk655WzPF+DDMA02qIyy8uiRqI8QXtcFpEvll12LpL5MXqEmAZ+dcA==}
+
+ resolution: {integrity: sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==}
+
+ resolution: {integrity: sha512-KQyt/wLjG3TAc7DOUhpqWzgd4ERxR80JOlTK5VE5R1S12IaPVN5qkj4klBce9HPG1Njuup4Sb5bljaT34lIyjw==}
+
+ resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
+
+ resolution: {integrity: sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==}
+ engines: {node: '>=12.20.0'}
+
+ resolution: {integrity: sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA==}
+
+ resolution: {integrity: sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==}
+
+ resolution: {integrity: sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==}
+
+ resolution: {integrity: sha512-SKgVvDU5TNIxQ4r30U75BNLC6a+6GOEjngrk/ysM5+Zu3oJuk1SC5ApzIzY/7PjCEjoVPMWJ0zho/4QUiEB7TQ==}
+ engines: {node: '>=20'}
+
+ resolution: {integrity: sha512-Lki/zhXFVmDhesBUn/yHRLW9Bte7mE7xoFHzTR8sIomV7a2z+LxYAPkGvdfidNiu4fKSfjtawixxSHcZci5QcQ==}
+ engines: {node: '>=20'}
+
+ resolution: {integrity: sha512-prbX4Z3YszrFNgH+MW5Zoeq3baXrMtP/MQnFeET90UB/GtGcGDQ5Usg9OCy6ETjTTntOw1SL2z9fMPUppN3Guw==}
+ engines: {node: '>=20'}
+
+ resolution: {integrity: sha512-zAMfbta9nPA8AKkA4WdmNAT8R8s6Dk0/xwPsqNnRidMFcLo1YkLuPDTgs2f64XdzS8vbLNnoJ+uUIkgbz7oRHA==}
+
+ resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
+
+ resolution: {integrity: sha512-o8bTeDWjE086iwKrROaDf31K0qC/BENdm15/uH9usSC/uZjJOKb2YGiVHfLY4GhwsERiPI1jmwI2XrA7ACOxVw==}
+
+ resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
+
+ resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==}
+ engines: {node: '>=8.6'}
+
+ resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-5osppouFc0VR9/VYzYxO03VaDa3e8F23Kfd6/9qcZTUI8P58GIYlArOET2Wq0ywSl2o2PjELhYOFI4W7l5QHKw==}
+ engines: {node: '>=18.0'}
+ peerDependencies:
+ postcss: ^8.2.14
+
+ resolution: {integrity: sha512-wWBro/7hJ40ye6TPiXkUQoXKCw23xSsjriUvqd7Uls9Sso3oLiON1flc18cCdnjgCRXw4fBVqUJJeOdDTh3P3g==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==}
+ engines: {node: ^10 || ^12 || >=14}
+
+ resolution: {integrity: sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==}
+ engines: {node: '>=14'}
+ hasBin: true
+
+ resolution: {integrity: sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-tGqJW/UnclpYASFcM6Xh8D8l/BMtaQ9+CSG0vlJSJTcdMM4lDRv4c6H0Pdcsfted+bVczdYSfk2fdukg2gQkZg==}
+ engines: {node: '>=18.0.0'}
+
+ resolution: {integrity: sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==}
+
+ resolution: {integrity: sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA==}
+
+ resolution: {integrity: sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==}
+ engines: {node: '>= 20.19.0'}
+
+ resolution: {integrity: sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==}
+
+ resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==}
+
+ resolution: {integrity: sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==}
+
+ resolution: {integrity: sha512-vaVuQPobFXvmtcHXQ5uqXZlzuuPnLyIuZcX/03sX1U/Qfj9fZrPYI9w66OSr/PUx6alzRYmreEwgYBbsVx8HsA==}
+
+ resolution: {integrity: sha512-3Zjgh+8b5fhRJBQZoy+zbVKpAQGLyka0MPgW3zruTF4dFFJ8Fqcfu9YsAvi/rvdcaTeWG3MkbZv4WKxAn/84Lg==}
+
+ resolution: {integrity: sha512-lMbBMrDoxgsyO+yB3sDcrDuX85yYt7sS8BfQd11jtbW/z5ZWgLZRcEGLsLoYw7I0WSUGQBs8CC8ScIxkTX1+6Q==}
+
+ resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==}
+
+ resolution: {integrity: sha512-kk0jOU7+zGv//kfjXEBjdIryL1Acl4i9XNkHxtM7Tm5lFiCog576fjNC9hjoR7LTKQ0DsPWy09JummSsH1uqfQ==}
+
+ resolution: {integrity: sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ hasBin: true
+
+ resolution: {integrity: sha512-Ao1LKpAEa9Wdg0otgbVKViZHEq9ebdXe4DMrp3s9vQAU0HNIuHnFEuMuOcm0ZIXyV0Yzxj91NvhLpvXZJO/5ZQ==}
+
+ resolution: {integrity: sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==}
+ engines: {node: '>=11.0.0'}
+
+ resolution: {integrity: sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==}
+ engines: {node: '>=10'}
+ hasBin: true
+
+ resolution: {integrity: sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==}
+ engines: {node: '>=20.9.0'}
+ peerDependencies:
+ '@types/node': '*'
+ peerDependenciesMeta:
+ '@types/node':
+ optional: true
+
+ resolution: {integrity: sha512-imjLsVHgPuWhvpU3P+zOekvMYqnel7QmKsFC4Sn0fCuAvaaalBsxwKEsrU8Ko5BdFnZA6Go/8a0RzahS634UgA==}
+ engines: {node: '>=20'}
+
+ resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==}
+
+ resolution: {integrity: sha512-S6hzjGJSG3d6if0YoF5kTyeRJvia6FSTBroE5fQ0bu1QNxyJqhhinfUsXi9fH3MgtXODWvwo2BDyQSnhPQ88uQ==}
+ engines: {node: '>=20.19.5', npm: '>=10.8.2'}
+ hasBin: true
+
+ resolution: {integrity: sha512-j7WyPdf0CJoutMzMoPLF/bVXHtKZIT9Rb4eGeEbWw8X2t5oirjPgpL+OpaENZrILYaXqYwnVH+qgUwVbl+pUJQ==}
+ engines: {node: '>= 18'}
+
+ resolution: {integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==}
+ engines: {node: '>=0.10.0'}
+
+ resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}
+
+ resolution: {integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==}
+
+ resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-ZbmZM0JCihQN91dWnxoipT2KOEyHqEyfRXUyjuRhW8b/xnqPDoq4gWEVApTVa9db2wN8mmoikgFBbjh71+cGeQ==}
+ engines: {node: '>=20'}
+
+ resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==}
+
+ resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==}
+ engines: {node: '>=12'}
+
+ resolution: {integrity: sha512-bkxnTg1kSU0guhIBmibA6UUhrQmPVA1XsQLN+ylCd+UWzbnLkySOcXpyk1mrl05f+pcaCx2eHb+sp6BgMZWX+Q==}
+ engines: {node: '>=16'}
+ hasBin: true
+
+ resolution: {integrity: sha512-PCJZTFFdG+sL3gvnP1Do9o6GbkvH2q0p04xSs3f7cSvmAeK+sttG+/7ncK1fdRwKFfC7n+wDDJaOMBSefkI9ow==}
+
+ resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==}
+
+ resolution: {integrity: sha512-nTv2raKFMzGG6JJp0lpNDsRPdfFE6UHlu2rVEjXo8vkx1ZS3LW2CVXqIaLu8xZlu+6tbFs9V58Qc/Jmk/Ii7wA==}
+ engines: {node: ^16.14.0 || >= 17.3.0}
+
+ resolution: {integrity: sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==}
+ engines: {node: '>=12.0.0'}
+
+ resolution: {integrity: sha512-B6Ykif5HflC3AdDkS4Zst/2muYVfeXoVMy+KorqH80s/1x4vunIORpNySH681X7fjj+dFM9MDKD6/Hsccjb87Q==}
+
+ resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
+
+ resolution: {integrity: sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==}
+
+ resolution: {integrity: sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==}
+
+ resolution: {integrity: sha512-OJabfkAg1WLZSqJAJ0Z6Sdt3utnbzr/jh+NAHoyWHJe8CMSy79Gm085094M9nvTPy22KzTVn5Zq5mbapCI/hPA==}
+
+ resolution: {integrity: sha512-RpuHXrknHdVdK7wv/8ug3Fr0WNsNi5l5aB8MYYuXhq2UH5lnEB1htJ1smhtD5VeCsGr2p8mUDtd83LCQDFVgjQ==}
+
+ resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==}
+ engines: {node: '>=14.17'}
+ hasBin: true
+
+ resolution: {integrity: sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==}
+
+ resolution: {integrity: sha512-2xRd0VHoAQE4M+vF/DvFFB7pUV0ZxTW1TLi7lHQWnF/Sb5TPeEUV/l+hxcNnGO00ZXGnR0voCMmYRKQf+rvJ2g==}
+
+ resolution: {integrity: sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==}
+
+ resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==}
+
+ resolution: {integrity: sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw==}
+ engines: {node: '>=22.19.0'}
+
+ resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==}
+
+ resolution: {integrity: sha512-XGnEwj5sWdCbiBX01mWLSBncS0yMRjnLygau3IfdOlfjMacNIQvTGW4VH7pWBq+gGWArfSef/CensMLjMmIr/A==}
+
+ resolution: {integrity: sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==}
+
+ resolution: {integrity: sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==}
+
+ resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==}
+
+ resolution: {integrity: sha512-vKXxz6O38sKDj1mtx/k2cWvkkFBuYGx6uGrlzBkVeWCRF/F8sdI0j3Wbkz/5rVNRRuVc8UrgRdbCxNhmYXgP3w==}
+
+ resolution: {integrity: sha512-fpsYs/VVoZxfGY9/j3FQpZmN8wdLJaV1Pt38AaJNZu9uKIHcFU3halCdBveEq1HGKO1OEfJY65w1zvoFV1b3qQ==}
+
+ resolution: {integrity: sha512-gjKtcmn/KwZuJZO9o2sc0esAQnhmTw0LviDHwevTXbJMYs0dRTp8ZEEWXHU0vTpzbN3cA0yxlTeyXssMp3zDqw==}
+ peerDependencies:
+ '@azure/app-configuration': ^1.8.0
+ '@azure/cosmos': ^4.2.0
+ '@azure/data-tables': ^13.3.0
+ '@azure/identity': ^4.6.0
+ '@azure/keyvault-secrets': ^4.9.0
+ '@azure/storage-blob': ^12.26.0
+ '@capacitor/preferences': ^6 || ^7 || ^8
+ '@deno/kv': '>=0.9.0'
+ '@netlify/blobs': ^6.5.0 || ^7.0.0 || ^8.1.0 || ^9.0.0 || ^10.0.0 || ^11.0.0
+ '@planetscale/database': ^1.19.0
+ '@upstash/redis': ^1.34.3
+ '@vercel/blob': '>=0.27.1'
+ '@vercel/functions': ^2.2.12 || ^3.0.0
+ '@vercel/kv': ^1 || ^2 || ^3
+ aws4fetch: ^1.0.20
+ db0: '>=0.2.1'
+ idb-keyval: ^6.2.1
+ ioredis: ^5.4.2
+ uploadthing: ^7.4.4
+ peerDependenciesMeta:
+ '@azure/app-configuration':
+ optional: true
+ '@azure/cosmos':
+ optional: true
+ '@azure/data-tables':
+ optional: true
+ '@azure/identity':
+ optional: true
+ '@azure/keyvault-secrets':
+ optional: true
+ '@azure/storage-blob':
+ optional: true
+ '@capacitor/preferences':
+ optional: true
+ '@deno/kv':
+ optional: true
+ '@netlify/blobs':
+ optional: true
+ '@planetscale/database':
+ optional: true
+ '@upstash/redis':
+ optional: true
+ '@vercel/blob':
+ optional: true
+ '@vercel/functions':
+ optional: true
+ '@vercel/kv':
+ optional: true
+ aws4fetch:
+ optional: true
+ db0:
+ optional: true
+ idb-keyval:
+ optional: true
+ ioredis:
+ optional: true
+ uploadthing:
+ optional: true
+
+ resolution: {integrity: sha512-8tzwTeXFPuX/5PHuCDQE5Dd9Ts4rwoq2t9aIT+HS4iAVpmj5l4Ao7Q+BuuFjvWRqrLswBhQDk8O96ZicgCqQqw==}
+ engines: {node: '>=20'}
+
+ resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
+
+ resolution: {integrity: sha512-u4J1hr6Y+C/hit34GwL3eIcUf3wngT8TlYUjK7tk0jxydKLAq3sYvifjdTDA6U3KCKRcQCQDGf/srjxfZF3l7g==}
+ engines: {node: '>=18.12.0'}
+
+ resolution: {integrity: sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==}
+
+ resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}
+
+ resolution: {integrity: sha512-UI7dK29NnS54Fk+mmo7o+jI6U8Fp7hDl+X5Q1k45WH+d4dSlbLVUETGQ+hfkNgvLQGyoElPj837nZyv4MBc0VA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ hasBin: true
+ peerDependencies:
+ '@types/node': ^20.19.0 || >=22.12.0
+ '@vitejs/devtools': ^0.7.1 || ^0.8.0
+ esbuild: ^0.27.0 || ^0.28.0
+ jiti: '>=1.21.0'
+ less: ^4.0.0
+ sass: ^1.70.0
+ sass-embedded: ^1.70.0
+ stylus: '>=0.54.8'
+ sugarss: ^5.0.0
+ terser: ^5.16.0
+ tsx: ^4.8.1
+ yaml: ^2.4.2
+ peerDependenciesMeta:
+ '@types/node':
+ optional: true
+ '@vitejs/devtools':
+ optional: true
+ esbuild:
+ optional: true
+ jiti:
+ optional: true
+ less:
+ optional: true
+ sass:
+ optional: true
+ sass-embedded:
+ optional: true
+ stylus:
+ optional: true
+ sugarss:
+ optional: true
+ terser:
+ optional: true
+ tsx:
+ optional: true
+ yaml:
+ optional: true
+
+ resolution: {integrity: sha512-ub4okH7Z5KLjb6hDyjqrGXqWtWvoYdU3IGm/NorpgHncKoLTCfRIbvlhBm7r0YstIaQRYlp4yEbFqDcKSzXSSg==}
+ peerDependencies:
+ vite: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0
+ peerDependenciesMeta:
+ vite:
+ optional: true
+
+ resolution: {integrity: sha512-wRRFt9BpjMKCazcgOh67MSjUjiWUCAh99DyYSDIOTuxaRjEtDC7PpB0k1Y1wbJIW/pVtMUSVbpPo3UGSm0Byxw==}
+ peerDependencies:
+ '@volar/language-service': ~2.4.0
+ peerDependenciesMeta:
+ '@volar/language-service':
+ optional: true
+
+ resolution: {integrity: sha512-zqjzt6bN95e3CUstBm0PBFAJnrfz0ZAARka87fart46/gNCLLuP3Vujy8V/J8HEziTFLnfkgIASLFYPUhonJcA==}
+ peerDependencies:
+ '@volar/language-service': ~2.4.0
+ peerDependenciesMeta:
+ '@volar/language-service':
+ optional: true
+
+ resolution: {integrity: sha512-e8tHPhgQ7ooLfudAEIku+kgd9pWkq3SSz8RbnQDI1+Eb8wbenkLGHqoirLqz5ORLV6wIMr2Iv08RWBG5eOcgpw==}
+ peerDependencies:
+ '@volar/language-service': ~2.4.0
+ peerDependenciesMeta:
+ '@volar/language-service':
+ optional: true
+
+ resolution: {integrity: sha512-Rz7JVH3qD108UCdmIEiZvOBNljMt2nLFdbN8AXcDfn7xD9F5I2aCIsDVqBbXw21PsnxG0b7MfwtNF+zPS/NKUg==}
+ peerDependencies:
+ '@volar/language-service': ~2.4.0
+ prettier: ^2.2 || ^3.0
+ peerDependenciesMeta:
+ '@volar/language-service':
+ optional: true
+ prettier:
+ optional: true
+
+ resolution: {integrity: sha512-9K2k72s4n7rV9s4bX0MyjbX9iBribvKZbBJKuEmTCZfeWJXs6Yh7bGpY4eoc7UufAjvpheBqwyZCOIPBvxCv0A==}
+ peerDependencies:
+ '@volar/language-service': ~2.4.0
+ peerDependenciesMeta:
+ '@volar/language-service':
+ optional: true
+
+ resolution: {integrity: sha512-yTtM/BVT6hoyEYnDtaCyAtNhdNeS/mhTTABlBOdw3NNiRBUin3IznFJpgfjer4c6RYopiPjjQjc9VFhxVl1mLw==}
+ peerDependencies:
+ '@volar/language-service': ~2.4.0
+ peerDependenciesMeta:
+ '@volar/language-service':
+ optional: true
+
+ resolution: {integrity: sha512-qYGWGuVpUTnZGu5P/CR4KLK4aIR8RrcVnmfZ2eRcj9q/I8VZCoC5yy9FtEvfNvnDp4MU17yhdJcvpQPIqhJS2Q==}
+ peerDependencies:
+ '@volar/language-service': ~2.4.0
+ peerDependenciesMeta:
+ '@volar/language-service':
+ optional: true
+
+ resolution: {integrity: sha512-eq5N9Er3fC4vA9zd9EFhyBG90wtCCuXgRSpAndaOgXMh1Wgep5lBgRIeDgjZBW9pa+332yC9+49cZMW8jcL3MA==}
+
+ resolution: {integrity: sha512-ulCrSnFnfQ16YzvwnYUgEbUEl/ZG7u2eV27YhvLObSHKkb8fw1Z9cgsnUwjTEeDIdJDoTDTDpxuhQwoenoLNMg==}
+
+ resolution: {integrity: sha512-0vSpg6Xd9hfV+eZAaYN63xVVMOTmJ4GgHxXnkLCh+9RsQBkWKIghzLhW2B9ebfG+LQQg8uLtsQ2aUKjTgE+QOg==}
+ engines: {npm: '>=7.0.0'}
+
+ resolution: {integrity: sha512-USSfxg0vDIpTQqlQBGxF3mBARyoS8cU7LHLpbYNh6dOJt32dlskxPWB0Irrh5TllTmyf7oNLAvqDqzklbwwnpA==}
+ engines: {node: '>=14.17.0'}
+
+ resolution: {integrity: sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==}
+ engines: {node: '>=14.0.0'}
+
+ resolution: {integrity: sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==}
+
+ resolution: {integrity: sha512-FW4fBMzZ99N8xeob4py0l050wgCoRgTpEq5Xcsb9lM1bc29UKGR/wSV+4knaqFxssFHajy7OzNiKP/m3U1ZEuA==}
+
+ resolution: {integrity: sha512-qeNEuOi9a3qkqRf7Gfez2WL2VwlBTLCNekHBGO9kxPVUp9XuY15yfTJ9jwvOwKI0I2MhUUfZq95NSp+LK1CLQg==}
+
+ resolution: {integrity: sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==}
+
+ resolution: {integrity: sha512-kPd6+JQNz3HMJvjKlqUxERSlZHAntl/aGpsk7ImwIh0ewDKDcjgAEyVSYciPiOJD3ftbK9IrfiqUeTZLSbCizw==}
+
+ resolution: {integrity: sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g==}
+ hasBin: true
+
+ resolution: {integrity: sha512-RAaHx7B14ZU04EU31pT+rKz2/zSl7xMsfIZuo8pd+KZO6PXtQmpevpq3vxvWNcrGbdmhM/rr5Uw5Mz+NBfhVng==}
+
+ resolution: {integrity: sha512-m2gXo3bn0G1kT9InzMf07fTbqMbGtyckj3bH5ktLO+1Ssv+yiATZ4dhwaQv9UZWxJh6E9IFGnQyjgWVDWVBDrg==}
+
+ resolution: {integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==}
+ engines: {node: '>=18'}
+
+ resolution: {integrity: sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA==}
+
+ resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-3qVyCOexLCWw06PQa5kRPwvMWMZ/eZeCRWUvgD6a0OkqL/4iCnxy2WumbWifa937Uo5xhyWJ0uxlU39ljhNh7A==}
+ hasBin: true
+
+ resolution: {integrity: sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==}
+ engines: {node: '>= 14.6'}
+ hasBin: true
+
+ resolution: {integrity: sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==}
+ engines: {node: '>= 14.6'}
+ hasBin: true
+
+ resolution: {integrity: sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==}
+ engines: {node: ^20.19.0 || ^22.12.0 || >=23}
+
+ resolution: {integrity: sha512-9OpKOLeaoNFecEp7P6iYbzze/5CqWoH7N3SMs/6y1XF4nMvFMspEGZzJ6uFi9MmQwXhyzqYoSEKO3tvA3Z/o2w==}
+ engines: {node: ^20.19.0 || ^22.12.0 || >=23}
+
+ resolution: {integrity: sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==}
+ engines: {node: '>=12.20'}
+
+ resolution: {integrity: sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==}
+
+ resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
+
+snapshots:
+
+ '@astrojs/[email protected](@emnapi/[email protected])':
+ dependencies:
+ '@emnapi/core': 1.11.3
+ '@napi-rs/wasm-runtime': 1.2.4(@emnapi/[email protected])(@emnapi/[email protected])
+ transitivePeerDependencies:
+ - '@emnapi/runtime'
+
+ dependencies:
+ '@astrojs/language-server': 2.17.3(@emnapi/[email protected])([email protected])([email protected])
+ chokidar: 5.0.0
+ kleur: 4.1.5
+ typescript: 6.0.3
+ yargs: 18.2.0
+ transitivePeerDependencies:
+ - '@emnapi/runtime'
+ - prettier
+ - prettier-plugin-astro
+
+ '@astrojs/[email protected]':
+ optional: true
+
+ '@astrojs/[email protected]':
+ optional: true
+
+ '@astrojs/[email protected]':
+ optional: true
+
+ '@astrojs/[email protected]':
+ optional: true
+
+ '@astrojs/[email protected]':
+ optional: true
+
+ '@astrojs/[email protected]':
+ optional: true
+
+ '@astrojs/[email protected]':
+ optional: true
+
+ '@astrojs/[email protected]':
+ dependencies:
+ '@emnapi/core': 1.11.3
+ '@emnapi/runtime': 1.11.3
+ '@napi-rs/wasm-runtime': 1.2.7(@emnapi/[email protected])(@emnapi/[email protected])
+ optional: true
+
+ '@astrojs/[email protected]':
+ optional: true
+
+ '@astrojs/[email protected]':
+ optional: true
+
+ '@astrojs/[email protected]':
+ optionalDependencies:
+ '@astrojs/compiler-binding-android-arm64': 0.5.2
+ '@astrojs/compiler-binding-darwin-arm64': 0.5.2
+ '@astrojs/compiler-binding-darwin-x64': 0.5.2
+ '@astrojs/compiler-binding-linux-arm64-gnu': 0.5.2
+ '@astrojs/compiler-binding-linux-arm64-musl': 0.5.2
+ '@astrojs/compiler-binding-linux-x64-gnu': 0.5.2
+ '@astrojs/compiler-binding-linux-x64-musl': 0.5.2
+ '@astrojs/compiler-binding-wasm32-wasi': 0.5.2
+ '@astrojs/compiler-binding-win32-arm64-msvc': 0.5.2
+ '@astrojs/compiler-binding-win32-x64-msvc': 0.5.2
+
+ '@astrojs/[email protected]':
+ dependencies:
+ '@astrojs/compiler-binding': 0.5.2
+
+ '@astrojs/[email protected]':
+ dependencies:
+ '@types/hast': 3.0.5
+ '@types/mdast': 4.0.4
+ picomatch: 4.0.7
+ retext-smartypants: 6.2.0
+ shiki: 4.6.0
+ smol-toml: 1.9.1
+ unified: 11.0.5
+ yaml: 2.9.1
+
+ dependencies:
+ '@astrojs/astro2tsx': 0.1.3(@emnapi/[email protected])
+ '@astrojs/yaml2ts': 0.2.4
+ '@volar/kit': 2.4.30([email protected])
+ '@volar/language-core': 2.4.30
+ '@volar/language-server': 2.4.30([email protected])
+ '@volar/language-service': 2.4.30([email protected])
+ muggle-string: 0.4.1
+ tinyglobby: 0.2.17
+ volar-service-css: 0.0.71(@volar/[email protected]([email protected]))
+ volar-service-emmet: 0.0.71(@volar/[email protected]([email protected]))
+ volar-service-html: 0.0.71(@volar/[email protected]([email protected]))
+ volar-service-prettier: 0.0.71(@volar/[email protected]([email protected]))([email protected])
+ volar-service-typescript: 0.0.71(@volar/[email protected]([email protected]))
+ volar-service-typescript-twoslash-queries: 0.0.71(@volar/[email protected]([email protected]))
+ volar-service-yaml: 0.0.71(@volar/[email protected]([email protected]))
+ vscode-html-languageservice: 5.6.2
+ vscode-uri: 3.2.0
+ optionalDependencies:
+ prettier: 3.9.10
+ transitivePeerDependencies:
+ - '@emnapi/runtime'
+ - typescript
+
+ '@astrojs/[email protected]':
+ dependencies:
+ '@astrojs/internal-helpers': 0.13.0
+ '@astrojs/prism': 4.1.2
+ github-slugger: 2.0.0
+ satteri: 0.10.5
+
+ dependencies:
+ '@astrojs/internal-helpers': 0.13.0
+ '@astrojs/markdown-satteri': 0.4.6
+ es-module-lexer: 3.0.4
+
+ '@astrojs/[email protected]':
+ dependencies:
+ prismjs: 1.30.0
+
+ '@astrojs/[email protected]':
+ dependencies:
+ sitemap: 9.0.1
+ zod: 4.6.7
+
+ '@astrojs/[email protected]':
+ dependencies:
+ ci-info: 4.4.0
+ dset: 3.1.4
+ is-docker: 4.0.0
+ package-manager-detector: 1.9.0
+
+ '@astrojs/[email protected]':
+ dependencies:
+ yaml: 2.9.1
+
+ '@babel/[email protected]': {}
+
+ '@babel/[email protected]': {}
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/types': 7.29.11
+
+ '@babel/[email protected]':
+ dependencies:
+ '@babel/helper-string-parser': 7.29.13
+ '@babel/helper-validator-identifier': 7.29.7
+
+ '@bruits/[email protected]':
+ optional: true
+
+ '@bruits/[email protected]':
+ optional: true
+
+ '@bruits/[email protected]':
+ optional: true
+
+ '@bruits/[email protected]':
+ optional: true
+
+ '@bruits/[email protected]':
+ optional: true
+
+ '@bruits/[email protected]':
+ optional: true
+
+ '@bruits/[email protected]':
+ dependencies:
+ '@emnapi/core': 1.11.1
+ '@emnapi/runtime': 1.11.1
+ '@napi-rs/wasm-runtime': 1.2.7(@emnapi/[email protected])(@emnapi/[email protected])
+ optional: true
+
+ '@bruits/[email protected]':
+ optional: true
+
+ '@bruits/[email protected]':
+ optional: true
+
+ '@capsizecss/[email protected]':
+ dependencies:
+ fontkitten: 1.0.3
+
+ '@clack/[email protected]':
+ dependencies:
+ fast-wrap-ansi: 0.2.2
+ sisteransi: 1.0.5
+
+ '@clack/[email protected]':
+ dependencies:
+ '@clack/core': 1.5.1
+ fast-string-width: 3.0.2
+ fast-wrap-ansi: 0.2.2
+ sisteransi: 1.0.5
+
+ '@ctrl/[email protected]': {}
+
+ '@emmetio/[email protected]':
+ dependencies:
+ '@emmetio/scanner': 1.0.4
+
+ '@emmetio/[email protected]':
+ dependencies:
+ '@emmetio/scanner': 1.0.4
+
+ '@emmetio/[email protected]':
+ dependencies:
+ '@emmetio/stream-reader': 2.2.0
+ '@emmetio/stream-reader-utils': 0.1.0
+
+ '@emmetio/[email protected]':
+ dependencies:
+ '@emmetio/scanner': 1.0.4
+
+ '@emmetio/[email protected]': {}
+
+ '@emmetio/[email protected]': {}
+
+ '@emmetio/[email protected]': {}
+
+ '@emnapi/[email protected]':
+ dependencies:
+ '@emnapi/wasi-threads': 1.2.2
+ tslib: 2.9.1
+ optional: true
+
+ '@emnapi/[email protected]':
+ dependencies:
+ '@emnapi/wasi-threads': 1.2.3
+ tslib: 2.9.1
+
+ '@emnapi/[email protected]':
+ dependencies:
+ tslib: 2.9.1
+ optional: true
+
+ '@emnapi/[email protected]':
+ dependencies:
+ tslib: 2.9.1
+
+ '@emnapi/[email protected]':
+ dependencies:
+ tslib: 2.9.1
+ optional: true
+
+ '@emnapi/[email protected]':
+ dependencies:
+ tslib: 2.9.1
+
+ '@expressive-code/[email protected]':
+ dependencies:
+ '@ctrl/tinycolor': 4.2.2
+ hast-util-select: 6.0.4
+ hast-util-to-html: 9.0.6
+ hast-util-to-text: 4.0.3
+ hastscript: 9.0.3
+ postcss: 8.5.32
+ postcss-nested: 7.0.2([email protected])
+ unist-util-visit: 5.2.0
+ unist-util-visit-parents: 6.1.0
+
+ '@expressive-code/[email protected]':
+ dependencies:
+ '@expressive-code/core': 0.44.3
+
+ '@expressive-code/[email protected]':
+ dependencies:
+ '@expressive-code/core': 0.44.3
+ shiki: 4.6.0
+
+ '@expressive-code/[email protected]':
+ dependencies:
+ '@expressive-code/core': 0.44.3
+
+ '@fontsource-variable/[email protected]': {}
+
+ '@fontsource-variable/[email protected]': {}
+
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-darwin-arm64': 1.3.4
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-darwin-x64': 1.3.4
+ optional: true
+
+ dependencies:
+ '@img/sharp-wasm32': 0.35.5
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-linux-arm64': 1.3.4
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-linux-arm': 1.3.4
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-linux-ppc64': 1.3.4
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-linux-riscv64': 1.3.4
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-linux-s390x': 1.3.4
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-linux-x64': 1.3.4
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-linuxmusl-arm64': 1.3.4
+ optional: true
+
+ optionalDependencies:
+ '@img/sharp-libvips-linuxmusl-x64': 1.3.4
+ optional: true
+
+ dependencies:
+ '@emnapi/runtime': 1.11.3
+ optional: true
+
+ dependencies:
+ '@img/sharp-wasm32': 0.35.5
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ '@jridgewell/[email protected]':
+ dependencies:
+ '@jridgewell/sourcemap-codec': 1.6.0
+ '@jridgewell/trace-mapping': 0.3.31
+
+ '@jridgewell/[email protected]':
+ dependencies:
+ '@jridgewell/gen-mapping': 0.3.13
+ '@jridgewell/trace-mapping': 0.3.31
+
+ '@jridgewell/[email protected]': {}
+
+ '@jridgewell/[email protected]': {}
+
+ '@jridgewell/[email protected]':
+ dependencies:
+ '@jridgewell/resolve-uri': 3.1.2
+ '@jridgewell/sourcemap-codec': 1.6.0
+
+ dependencies:
+ '@emnapi/core': 1.11.3
+ '@emnapi/runtime': 1.11.3
+ '@tybys/wasm-util': 0.10.4
+
+ dependencies:
+ '@emnapi/core': 1.11.1
+ '@emnapi/runtime': 1.11.1
+ '@tybys/wasm-util': 0.10.4
+ optional: true
+
+ dependencies:
+ '@emnapi/core': 1.11.3
+ '@emnapi/runtime': 1.11.3
+ '@tybys/wasm-util': 0.10.4
+ optional: true
+
+ '@oslojs/[email protected]': {}
+
+ '@oxc-project/[email protected]': {}
+
+ '@phosphor-icons/[email protected]': {}
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]':
+ optional: true
+
+ '@rolldown/[email protected]': {}
+
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/primitive': 4.6.0
+ '@shikijs/types': 4.6.0
+ '@shikijs/vscode-textmate': 10.1.0
+ '@types/hast': 3.0.5
+ hast-util-to-html: 9.0.6
+
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 4.6.0
+ '@shikijs/vscode-textmate': 10.1.0
+ oniguruma-to-es: 4.3.6
+
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 4.6.0
+ '@shikijs/vscode-textmate': 10.1.0
+
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 4.6.0
+
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 4.6.0
+ '@shikijs/vscode-textmate': 10.1.0
+ '@types/hast': 3.0.5
+
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/types': 4.6.0
+
+ '@shikijs/[email protected]':
+ dependencies:
+ '@shikijs/vscode-textmate': 10.1.0
+ '@types/hast': 3.0.5
+
+ '@shikijs/[email protected]': {}
+
+ '@tailwindcss/[email protected]':
+ dependencies:
+ '@jridgewell/remapping': 2.3.5
+ enhanced-resolve: 5.26.1
+ jiti: 2.7.0
+ lightningcss: 1.33.0
+ magic-string: 1.4.5
+ source-map-js: 1.2.2
+ tailwindcss: 4.3.4
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optional: true
+
+ '@tailwindcss/[email protected]':
+ optionalDependencies:
+ '@tailwindcss/oxide-android-arm64': 4.3.4
+ '@tailwindcss/oxide-darwin-arm64': 4.3.4
+ '@tailwindcss/oxide-darwin-x64': 4.3.4
+ '@tailwindcss/oxide-freebsd-x64': 4.3.4
+ '@tailwindcss/oxide-linux-arm-gnueabihf': 4.3.4
+ '@tailwindcss/oxide-linux-arm64-gnu': 4.3.4
+ '@tailwindcss/oxide-linux-arm64-musl': 4.3.4
+ '@tailwindcss/oxide-linux-x64-gnu': 4.3.4
+ '@tailwindcss/oxide-linux-x64-musl': 4.3.4
+ '@tailwindcss/oxide-wasm32-wasi': 4.3.4
+ '@tailwindcss/oxide-win32-arm64-msvc': 4.3.4
+ '@tailwindcss/oxide-win32-x64-msvc': 4.3.4
+
+ dependencies:
+ '@tailwindcss/node': 4.3.4
+ '@tailwindcss/oxide': 4.3.4
+ tailwindcss: 4.3.4
+
+ '@tybys/[email protected]':
+ dependencies:
+ tslib: 2.9.1
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/estree': 1.0.10
+
+ '@types/[email protected]': {}
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/unist': 3.0.3
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/unist': 3.0.3
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/unist': 3.0.3
+
+ '@types/[email protected]':
+ dependencies:
+ undici-types: 7.24.6
+
+ '@types/[email protected]':
+ dependencies:
+ '@types/node': 24.19.2
+
+ '@types/[email protected]': {}
+
+ '@ungap/[email protected]': {}
+
+ dependencies:
+ '@volar/language-service': 2.4.30([email protected])
+ '@volar/typescript': 2.4.30([email protected])
+ typesafe-path: 0.2.2
+ typescript: 6.0.3
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-uri: 3.2.0
+
+ '@volar/[email protected]':
+ dependencies:
+ '@volar/source-map': 2.4.30
+
+ dependencies:
+ '@volar/language-core': 2.4.30
+ '@volar/language-service': 2.4.30([email protected])
+ '@volar/typescript': 2.4.30([email protected])
+ path-browserify: 1.0.1
+ request-light: 0.7.0
+ vscode-languageserver: 9.0.1
+ vscode-languageserver-protocol: 3.18.5
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-uri: 3.2.0
+ optionalDependencies:
+ typescript: 6.0.3
+
+ dependencies:
+ '@volar/language-core': 2.4.30
+ vscode-languageserver-protocol: 3.18.5
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-uri: 3.2.0
+ optionalDependencies:
+ typescript: 6.0.3
+
+ '@volar/[email protected]': {}
+
+ dependencies:
+ '@volar/language-core': 2.4.30
+ '@volar/language-service': 2.4.30([email protected])
+ path-browserify: 1.0.1
+ vscode-uri: 3.2.0
+ optionalDependencies:
+ typescript: 6.0.3
+
+ '@vscode/[email protected]':
+ dependencies:
+ emmet: 2.4.11
+ jsonc-parser: 2.3.1
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-languageserver-types: 3.18.5
+ vscode-uri: 3.2.0
+
+ '@vscode/[email protected]': {}
+
+ optionalDependencies:
+ ajv: 8.20.0
+
+ dependencies:
+ ajv: 8.20.0
+
+ dependencies:
+ fast-deep-equal: 3.1.3
+ fast-uri: 3.1.9
+ json-schema-traverse: 1.0.0
+ require-from-string: 2.0.2
+
+ dependencies:
+ process-ancestry: 0.1.0
+
+
+
+ dependencies:
+ normalize-path: 3.0.0
+ picomatch: 2.3.2
+
+
+
+ dependencies:
+ rehype-expressive-code: 0.44.3
+ url-extras: 0.1.0
+
+ dependencies:
+ '@astrojs/compiler-rs': 0.5.2
+ '@astrojs/internal-helpers': 0.13.0
+ '@astrojs/markdown-satteri': 0.4.6
+ '@astrojs/telemetry': 3.4.2
+ '@capsizecss/unpack': 4.0.1
+ '@clack/prompts': 1.8.1
+ '@oslojs/encoding': 1.1.0
+ am-i-vibing: 0.5.0
+ aria-query: 5.3.2
+ axobject-query: 4.1.0
+ ci-info: 4.4.0
+ clsx: 2.1.1
+ common-ancestor-path: 2.0.0
+ cookie: 2.0.1
+ devalue: 6.0.3
+ diff: 9.0.0
+ dset: 3.1.4
+ es-module-lexer: 3.0.4
+ flattie: 1.1.1
+ fontace: 0.4.1
+ get-tsconfig: 5.0.0-beta.6
+ github-slugger: 2.0.0
+ html-escaper: 3.0.3
+ http-cache-semantics: 4.3.0
+ jsonc-parser: 3.3.1
+ magic-string: 1.4.5
+ magicast: 0.5.5
+ mrmime: 2.0.1
+ neotraverse: 1.0.1
+ obug: 3.0.0
+ p-limit: 7.3.3
+ p-queue: 9.3.5
+ package-manager-detector: 1.9.0
+ piccolore: 0.1.3
+ picomatch: 4.0.7
+ rolldown: 1.2.16
+ shiki: 4.6.0
+ smol-toml: 1.9.1
+ svgo: 4.1.0
+ tinyclip: 1.0.3
+ tinyexec: 1.3.1
+ tinyglobby: 0.2.17
+ tinyps: 0.5.1
+ ultrahtml: 1.7.0
+ unifont: 1.0.3
+ unstorage: 1.17.6
+ verkit: 0.5.0
+ xxhash-wasm: 1.1.0
+ yargs-parser: 22.0.0
+ zod: 4.6.7
+ optionalDependencies:
+ sharp: 0.35.5(@types/[email protected])
+ transitivePeerDependencies:
+ - '@azure/app-configuration'
+ - '@azure/cosmos'
+ - '@azure/data-tables'
+ - '@azure/identity'
+ - '@azure/keyvault-secrets'
+ - '@azure/storage-blob'
+ - '@capacitor/preferences'
+ - '@deno/kv'
+ - '@netlify/blobs'
+ - '@planetscale/database'
+ - '@types/node'
+ - '@upstash/redis'
+ - '@vercel/blob'
+ - '@vercel/functions'
+ - '@vercel/kv'
+ - '@vitejs/devtools'
+ - aws4fetch
+ - db0
+ - esbuild
+ - idb-keyval
+ - ioredis
+ - jiti
+ - less
+ - sass
+ - sass-embedded
+ - stylus
+ - sugarss
+ - terser
+ - tsx
+ - uploadthing
+ - yaml
+
+
+
+
+
+
+
+
+ dependencies:
+ readdirp: 5.1.1
+
+
+ dependencies:
+ string-width: 7.2.0
+ strip-ansi: 7.2.0
+ wrap-ansi: 9.0.2
+
+
+
+
+
+
+
+ dependencies:
+ uncrypto: 0.1.3
+
+ dependencies:
+ boolbase: 1.0.0
+ css-what: 7.0.0
+ domhandler: 5.0.3
+ domutils: 3.2.2
+ nth-check: 2.1.1
+
+
+ dependencies:
+ mdn-data: 2.0.28
+ source-map-js: 1.2.2
+
+ dependencies:
+ mdn-data: 2.27.1
+ source-map-js: 1.2.2
+
+
+
+ dependencies:
+ css-tree: 2.2.1
+
+
+
+
+
+
+ dependencies:
+ dequal: 2.0.3
+
+
+
+ dependencies:
+ domelementtype: 2.3.0
+ domhandler: 5.0.3
+ entities: 4.5.0
+
+
+ dependencies:
+ domelementtype: 2.3.0
+
+ dependencies:
+ dom-serializer: 2.0.0
+ domelementtype: 2.3.0
+ domhandler: 5.0.3
+
+
+ dependencies:
+ '@emmetio/abbreviation': 2.3.3
+ '@emmetio/css-abbreviation': 2.1.8
+
+
+ dependencies:
+ graceful-fs: 4.2.11
+ tapable: 2.3.3
+
+
+
+
+
+ dependencies:
+ '@expressive-code/core': 0.44.3
+ '@expressive-code/plugin-frames': 0.44.3
+ '@expressive-code/plugin-shiki': 0.44.3
+ '@expressive-code/plugin-text-markers': 0.44.3
+
+
+
+
+ dependencies:
+ fast-string-truncated-width: 3.0.3
+
+
+ dependencies:
+ fast-string-width: 3.0.2
+
+ optionalDependencies:
+ picomatch: 4.0.7
+
+
+
+ dependencies:
+ fontkitten: 1.0.3
+
+ dependencies:
+ tiny-inflate: 1.0.3
+
+ optional: true
+
+
+
+ dependencies:
+ resolve-pkg-maps: 1.0.0
+
+
+
+ dependencies:
+ cookie-es: 1.2.3
+ crossws: 0.3.5
+ defu: 6.1.7
+ destr: 2.0.5
+ iron-webcrypto: 1.2.1
+ node-mock-http: 1.0.5
+ radix3: 1.1.2
+ ufo: 1.6.4
+ uncrypto: 0.1.3
+
+ dependencies:
+ '@types/hast': 3.0.5
+
+ dependencies:
+ '@types/hast': 3.0.5
+
+ dependencies:
+ '@types/hast': 3.0.5
+ '@types/unist': 3.0.3
+ bcp-47-match: 2.0.3
+ comma-separated-tokens: 2.0.3
+ css-selector-parser: 3.3.0
+ devlop: 1.1.0
+ direction: 2.0.1
+ hast-util-has-property: 3.0.0
+ hast-util-to-string: 3.0.1
+ hast-util-whitespace: 3.0.0
+ nth-check: 2.1.1
+ property-information: 7.2.0
+ space-separated-tokens: 2.0.2
+ unist-util-visit: 5.2.0
+ zwitch: 2.0.4
+
+ dependencies:
+ '@types/hast': 3.0.5
+ '@types/unist': 3.0.3
+ ccount: 2.0.1
+ comma-separated-tokens: 2.0.3
+ hast-util-whitespace: 3.0.0
+ html-void-elements: 3.0.0
+ mdast-util-to-hast: 13.2.1
+ property-information: 7.2.0
+ space-separated-tokens: 2.0.2
+ stringify-entities: 4.0.4
+ zwitch: 2.0.4
+
+ dependencies:
+ '@types/hast': 3.0.5
+
+ dependencies:
+ '@types/hast': 3.0.5
+
+ dependencies:
+ '@types/hast': 3.0.5
+
+ dependencies:
+ '@types/hast': 3.0.5
+ comma-separated-tokens: 2.0.3
+ hast-util-parse-selector: 4.0.0
+ property-information: 7.2.0
+ space-separated-tokens: 2.0.2
+
+
+
+
+
+
+
+
+
+
+
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ optional: true
+
+ dependencies:
+ detect-libc: 2.1.2
+ optionalDependencies:
+ lightningcss-android-arm64: 1.33.0
+ lightningcss-darwin-arm64: 1.33.0
+ lightningcss-darwin-x64: 1.33.0
+ lightningcss-freebsd-x64: 1.33.0
+ lightningcss-linux-arm-gnueabihf: 1.33.0
+ lightningcss-linux-arm64-gnu: 1.33.0
+ lightningcss-linux-arm64-musl: 1.33.0
+ lightningcss-linux-x64-gnu: 1.33.0
+ lightningcss-linux-x64-musl: 1.33.0
+ lightningcss-win32-arm64-msvc: 1.33.0
+ lightningcss-win32-x64-msvc: 1.33.0
+
+
+ dependencies:
+ '@jridgewell/sourcemap-codec': 1.6.0
+
+ dependencies:
+ '@babel/parser': 7.29.13
+ '@babel/types': 7.29.11
+ source-map-js: 1.2.2
+
+ dependencies:
+ '@types/hast': 3.0.5
+ '@types/mdast': 4.0.4
+ '@ungap/structured-clone': 1.4.0
+ devlop: 1.1.0
+ micromark-util-sanitize-uri: 2.0.1
+ trim-lines: 3.0.1
+ unist-util-position: 5.0.0
+ unist-util-visit: 5.2.0
+ vfile: 6.0.3
+
+
+
+ dependencies:
+ micromark-util-symbol: 2.0.1
+ micromark-util-types: 2.0.3
+
+
+ dependencies:
+ micromark-util-character: 2.1.1
+ micromark-util-encode: 2.0.1
+ micromark-util-symbol: 2.0.1
+
+
+
+
+
+
+
+ dependencies:
+ '@types/nlcst': 2.0.3
+
+
+
+
+ dependencies:
+ boolbase: 1.0.0
+
+
+ dependencies:
+ destr: 2.0.5
+ node-fetch-native: 1.6.7
+ ufo: 1.6.4
+
+
+ dependencies:
+ oniguruma-parser: 0.12.2
+ regex: 6.1.0
+ regex-recursion: 6.0.2
+
+ dependencies:
+ yocto-queue: 1.2.2
+
+ dependencies:
+ eventemitter3: 5.0.4
+ p-timeout: 7.0.2
+
+
+
+
+
+
+
+
+ dependencies:
+ postcss: 8.5.32
+ postcss-selector-parser: 7.1.7
+
+ dependencies:
+ cssesc: 3.0.0
+ util-deprecate: 1.0.2
+
+ dependencies:
+ nanoid: 3.3.20
+ picocolors: 1.1.1
+ source-map-js: 1.2.2
+
+
+
+
+
+
+
+ dependencies:
+ regex-utilities: 2.3.0
+
+
+ dependencies:
+ regex-utilities: 2.3.0
+
+ dependencies:
+ expressive-code: 0.44.3
+
+
+
+
+
+ dependencies:
+ '@types/nlcst': 2.0.3
+ nlcst-to-string: 4.0.0
+ unist-util-visit: 5.2.0
+
+ dependencies:
+ '@oxc-project/types': 0.156.0
+ '@rolldown/pluginutils': 1.0.1
+ optionalDependencies:
+ '@rolldown/binding-android-arm-eabi': 1.2.16
+ '@rolldown/binding-android-arm64': 1.2.16
+ '@rolldown/binding-darwin-arm64': 1.2.16
+ '@rolldown/binding-darwin-x64': 1.2.16
+ '@rolldown/binding-freebsd-x64': 1.2.16
+ '@rolldown/binding-linux-arm-gnueabihf': 1.2.16
+ '@rolldown/binding-linux-arm64-gnu': 1.2.16
+ '@rolldown/binding-linux-arm64-musl': 1.2.16
+ '@rolldown/binding-linux-ppc64-gnu': 1.2.16
+ '@rolldown/binding-linux-s390x-gnu': 1.2.16
+ '@rolldown/binding-linux-x64-gnu': 1.2.16
+ '@rolldown/binding-linux-x64-musl': 1.2.16
+ '@rolldown/binding-openharmony-arm64': 1.2.16
+ '@rolldown/binding-win32-arm64-msvc': 1.2.16
+ '@rolldown/binding-win32-x64-msvc': 1.2.16
+
+ dependencies:
+ '@types/estree-jsx': 1.0.5
+ '@types/hast': 3.0.5
+ '@types/mdast': 4.0.4
+ '@types/unist': 3.0.3
+ optionalDependencies:
+ '@bruits/satteri-darwin-arm64': 0.10.5
+ '@bruits/satteri-darwin-x64': 0.10.5
+ '@bruits/satteri-linux-arm64-gnu': 0.10.5
+ '@bruits/satteri-linux-arm64-musl': 0.10.5
+ '@bruits/satteri-linux-x64-gnu': 0.10.5
+ '@bruits/satteri-linux-x64-musl': 0.10.5
+ '@bruits/satteri-wasm32-wasi': 0.10.5
+ '@bruits/satteri-win32-arm64-msvc': 0.10.5
+ '@bruits/satteri-win32-x64-msvc': 0.10.5
+
+
+
+ dependencies:
+ '@img/colour': 1.1.0
+ detect-libc: 2.1.2
+ semver: 7.8.6
+ optionalDependencies:
+ '@img/sharp-darwin-arm64': 0.35.5
+ '@img/sharp-darwin-x64': 0.35.5
+ '@img/sharp-freebsd-wasm32': 0.35.5
+ '@img/sharp-libvips-darwin-arm64': 1.3.4
+ '@img/sharp-libvips-darwin-x64': 1.3.4
+ '@img/sharp-libvips-linux-arm': 1.3.4
+ '@img/sharp-libvips-linux-arm64': 1.3.4
+ '@img/sharp-libvips-linux-ppc64': 1.3.4
+ '@img/sharp-libvips-linux-riscv64': 1.3.4
+ '@img/sharp-libvips-linux-s390x': 1.3.4
+ '@img/sharp-libvips-linux-x64': 1.3.4
+ '@img/sharp-libvips-linuxmusl-arm64': 1.3.4
+ '@img/sharp-libvips-linuxmusl-x64': 1.3.4
+ '@img/sharp-linux-arm': 0.35.5
+ '@img/sharp-linux-arm64': 0.35.5
+ '@img/sharp-linux-ppc64': 0.35.5
+ '@img/sharp-linux-riscv64': 0.35.5
+ '@img/sharp-linux-s390x': 0.35.5
+ '@img/sharp-linux-x64': 0.35.5
+ '@img/sharp-linuxmusl-arm64': 0.35.5
+ '@img/sharp-linuxmusl-x64': 0.35.5
+ '@img/sharp-webcontainers-wasm32': 0.35.5
+ '@img/sharp-win32-arm64': 0.35.5
+ '@img/sharp-win32-ia32': 0.35.5
+ '@img/sharp-win32-x64': 0.35.5
+ '@types/node': 24.19.2
+ optional: true
+
+ dependencies:
+ '@shikijs/core': 4.6.0
+ '@shikijs/engine-javascript': 4.6.0
+ '@shikijs/engine-oniguruma': 4.6.0
+ '@shikijs/langs': 4.6.0
+ '@shikijs/themes': 4.6.0
+ '@shikijs/types': 4.6.0
+ '@shikijs/vscode-textmate': 10.1.0
+ '@types/hast': 3.0.5
+
+
+ dependencies:
+ '@types/node': 24.19.2
+ '@types/sax': 1.2.7
+ arg: 5.0.2
+ sax: 1.6.1
+
+
+
+
+
+ dependencies:
+ emoji-regex: 10.6.0
+ get-east-asian-width: 1.7.0
+ strip-ansi: 7.2.0
+
+ dependencies:
+ get-east-asian-width: 1.7.0
+ strip-ansi: 7.2.0
+
+ dependencies:
+ character-entities-html4: 2.1.0
+ character-entities-legacy: 3.0.0
+
+ dependencies:
+ ansi-regex: 6.5.0
+
+ dependencies:
+ commander: 11.1.0
+ css-select: 6.0.0
+ css-tree: 3.2.1
+ css-what: 7.0.0
+ csso: 5.0.5
+ picocolors: 1.1.1
+ sax: 1.6.1
+
+
+
+
+
+
+ dependencies:
+ fdir: 6.5.0([email protected])
+ picomatch: 4.0.7
+
+
+
+
+
+
+ dependencies:
+ semver: 7.8.6
+
+
+
+
+
+
+
+ dependencies:
+ '@types/unist': 3.0.3
+ bail: 2.0.2
+ devlop: 1.1.0
+ extend: 3.0.2
+ is-plain-obj: 4.1.0
+ trough: 2.2.0
+ vfile: 6.0.3
+
+ dependencies:
+ css-tree: 3.2.1
+ fnv1a-64: 0.1.2
+ std-env: 4.3.0
+ undici: 8.12.3
+
+ dependencies:
+ '@types/unist': 3.0.3
+
+ dependencies:
+ '@types/unist': 3.0.3
+
+ dependencies:
+ '@types/unist': 3.0.3
+
+ dependencies:
+ '@types/unist': 3.0.3
+ unist-util-is: 6.0.1
+
+ dependencies:
+ '@types/unist': 3.0.3
+ unist-util-is: 6.0.1
+ unist-util-visit-parents: 6.1.0
+
+ dependencies:
+ anymatch: 3.1.3
+ chokidar: 5.0.0
+ destr: 2.0.5
+ h3: 1.15.11
+ lru-cache: 11.5.3
+ node-fetch-native: 1.6.7
+ ofetch: 1.5.1
+ ufo: 1.6.4
+
+
+
+
+ dependencies:
+ '@types/unist': 3.0.3
+ unist-util-stringify-position: 4.0.0
+
+ dependencies:
+ '@types/unist': 3.0.3
+ vfile-message: 4.0.3
+
+ dependencies:
+ lightningcss: 1.33.0
+ picomatch: 4.0.7
+ postcss: 8.5.32
+ rolldown: 1.2.16
+ tinyglobby: 0.2.17
+ optionalDependencies:
+ '@types/node': 24.19.2
+ fsevents: 2.3.3
+ jiti: 2.7.0
+ yaml: 2.9.1
+
+ optionalDependencies:
+
+ dependencies:
+ vscode-css-languageservice: 6.3.10
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-uri: 3.2.0
+ optionalDependencies:
+ '@volar/language-service': 2.4.30([email protected])
+
+ dependencies:
+ '@emmetio/css-parser': 0.4.1
+ '@emmetio/html-matcher': 1.3.0
+ '@vscode/emmet-helper': 2.11.0
+ vscode-uri: 3.2.0
+ optionalDependencies:
+ '@volar/language-service': 2.4.30([email protected])
+
+ dependencies:
+ vscode-html-languageservice: 5.6.2
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-uri: 3.2.0
+ optionalDependencies:
+ '@volar/language-service': 2.4.30([email protected])
+
+ dependencies:
+ vscode-uri: 3.2.0
+ optionalDependencies:
+ '@volar/language-service': 2.4.30([email protected])
+ prettier: 3.9.10
+
+ dependencies:
+ vscode-uri: 3.2.0
+ optionalDependencies:
+ '@volar/language-service': 2.4.30([email protected])
+
+ dependencies:
+ path-browserify: 1.0.1
+ semver: 7.8.6
+ typescript-auto-import-cache: 0.3.6
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-nls: 5.2.0
+ vscode-uri: 3.2.0
+ optionalDependencies:
+ '@volar/language-service': 2.4.30([email protected])
+
+ dependencies:
+ vscode-uri: 3.2.0
+ yaml-language-server: 1.23.0
+ optionalDependencies:
+ '@volar/language-service': 2.4.30([email protected])
+
+ dependencies:
+ '@vscode/l10n': 0.0.18
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-languageserver-types: 3.17.5
+ vscode-uri: 3.2.0
+
+ dependencies:
+ '@vscode/l10n': 0.0.18
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-languageserver-types: 3.18.5
+ vscode-uri: 3.2.0
+
+ dependencies:
+ jsonc-parser: 3.3.1
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-languageserver-types: 3.18.5
+ vscode-nls: 5.2.0
+ vscode-uri: 3.2.0
+
+
+
+ dependencies:
+ vscode-jsonrpc: 8.2.0
+ vscode-languageserver-types: 3.17.5
+
+ dependencies:
+ vscode-jsonrpc: 10.0.0
+ vscode-languageserver-types: 3.18.5
+
+
+
+
+ dependencies:
+ vscode-languageserver-protocol: 3.17.5
+
+
+
+ dependencies:
+ ansi-styles: 6.2.3
+ string-width: 7.2.0
+ strip-ansi: 7.2.0
+
+
+
+ dependencies:
+ '@vscode/l10n': 0.0.18
+ ajv: 8.20.0
+ ajv-draft-04: 1.0.0([email protected])
+ ajv-i18n: 4.2.0([email protected])
+ prettier: 3.9.10
+ request-light: 0.5.8
+ vscode-json-languageservice: 4.1.8
+ vscode-languageserver: 9.0.1
+ vscode-languageserver-textdocument: 1.0.16
+ vscode-languageserver-types: 3.18.5
+ vscode-uri: 3.2.0
+ yaml: 2.8.3
+
+
+
+
+ dependencies:
+ cliui: 9.0.1
+ escalade: 3.2.0
+ get-caller-file: 2.0.5
+ string-width: 8.3.0
+ y18n: 5.0.8
+ yargs-parser: 22.0.0
+
+
+
diff --git a/website/public/apple-touch-icon.png b/website/public/apple-touch-icon.png
new file mode 100644
index 0000000..7536586
Binary files /dev/null and b/website/public/apple-touch-icon.png differ
diff --git a/website/public/favicon-16.png b/website/public/favicon-16.png
new file mode 100644
index 0000000..d481caf
Binary files /dev/null and b/website/public/favicon-16.png differ
diff --git a/website/public/favicon-32.png b/website/public/favicon-32.png
new file mode 100644
index 0000000..c6938bd
Binary files /dev/null and b/website/public/favicon-32.png differ
diff --git a/website/public/favicon-48.png b/website/public/favicon-48.png
new file mode 100644
index 0000000..2b5e07b
Binary files /dev/null and b/website/public/favicon-48.png differ
diff --git a/website/public/images/c-kit-hello.png b/website/public/images/c-kit-hello.png
new file mode 100644
index 0000000..ce41d4f
Binary files /dev/null and b/website/public/images/c-kit-hello.png differ
diff --git a/website/public/images/components-layout.png b/website/public/images/components-layout.png
new file mode 100644
index 0000000..17206e5
Binary files /dev/null and b/website/public/images/components-layout.png differ
diff --git a/website/public/images/components-nodes.png b/website/public/images/components-nodes.png
new file mode 100644
index 0000000..75da39f
Binary files /dev/null and b/website/public/images/components-nodes.png differ
diff --git a/website/public/images/components-values.png b/website/public/images/components-values.png
new file mode 100644
index 0000000..8cc5c26
Binary files /dev/null and b/website/public/images/components-values.png differ
diff --git a/website/public/images/components-views.png b/website/public/images/components-views.png
new file mode 100644
index 0000000..541f471
Binary files /dev/null and b/website/public/images/components-views.png differ
diff --git a/website/public/images/components.png b/website/public/images/components.png
new file mode 100644
index 0000000..258e9f9
Binary files /dev/null and b/website/public/images/components.png differ
diff --git a/website/public/images/first-app-python.png b/website/public/images/first-app-python.png
new file mode 100644
index 0000000..4fb7d91
Binary files /dev/null and b/website/public/images/first-app-python.png differ
diff --git a/website/public/images/imgui-blender.png b/website/public/images/imgui-blender.png
new file mode 100644
index 0000000..433cb1d
Binary files /dev/null and b/website/public/images/imgui-blender.png differ
diff --git a/website/public/images/imgui-python-hello-blender.png b/website/public/images/imgui-python-hello-blender.png
new file mode 100644
index 0000000..c7f81be
Binary files /dev/null and b/website/public/images/imgui-python-hello-blender.png differ
diff --git a/website/public/images/imgui-python-hello.png b/website/public/images/imgui-python-hello.png
new file mode 100644
index 0000000..9632a31
Binary files /dev/null and b/website/public/images/imgui-python-hello.png differ
diff --git a/website/public/images/imgui-stock.png b/website/public/images/imgui-stock.png
new file mode 100644
index 0000000..c5cc5a8
Binary files /dev/null and b/website/public/images/imgui-stock.png differ
diff --git a/website/public/images/qt-export.png b/website/public/images/qt-export.png
new file mode 100644
index 0000000..502e220
Binary files /dev/null and b/website/public/images/qt-export.png differ
diff --git a/website/public/images/qt-gauge.png b/website/public/images/qt-gauge.png
new file mode 100644
index 0000000..def2014
Binary files /dev/null and b/website/public/images/qt-gauge.png differ
diff --git a/website/public/images/qt.png b/website/public/images/qt.png
new file mode 100644
index 0000000..e475ed8
Binary files /dev/null and b/website/public/images/qt.png differ
diff --git a/website/public/images/react-counter.png b/website/public/images/react-counter.png
new file mode 100644
index 0000000..2ea865b
Binary files /dev/null and b/website/public/images/react-counter.png differ
diff --git a/website/public/images/rust-forms.png b/website/public/images/rust-forms.png
new file mode 100644
index 0000000..f8919b3
Binary files /dev/null and b/website/public/images/rust-forms.png differ
diff --git a/website/public/images/rust-hello.png b/website/public/images/rust-hello.png
new file mode 100644
index 0000000..e55648a
Binary files /dev/null and b/website/public/images/rust-hello.png differ
diff --git a/website/public/images/rust-showcase.png b/website/public/images/rust-showcase.png
new file mode 100644
index 0000000..8b24766
Binary files /dev/null and b/website/public/images/rust-showcase.png differ
diff --git a/website/public/images/shots/INDEX.md b/website/public/images/shots/INDEX.md
new file mode 100644
index 0000000..3c99c32
--- /dev/null
+++ b/website/public/images/shots/INDEX.md
@@ -0,0 +1,64 @@
+# Site screenshots
+
+Every image here exists twice: `-dark.png` (Blender's default theme) and
+`-light.png` (Blender's Light preset, `BUI_THEME=light`). All are rendered
+off-screen at 2x (`BUI_UI_SCALE=2`) and recompressed losslessly
+(`tools/pngopt.py`). Regenerate them all with one command:
+
+```sh
+BUIPY_BUILD_DIR=<build>/bindings/python BUI_BUILD_DIR=<build> python tools/gen_doc_images.py --site
+# --only python|rust|js|imgui|c one producer; --theme dark|light one theme
+```
+
+The CMake build needs `BUI_BUILD_EXAMPLES=ON`, `BUI_BUILD_IMGUI=ON` and the
+Python bindings; the JavaScript shots need the addon (`npm run build` in
+bindings/node).
+
+## Python
+
+| Image | Shows | Source |
+| --- | --- | --- |
+| `python-components-{dark,light}.png` | Blender components: a Render Properties editor (top bar menus, side tabs, panels and sub-panels with header checkboxes, number fields, sliders, dropdowns, enum row, color swatch, progress bar, status line) | `examples/site/render_props.py` |
+| `python-tkinter-{dark,light}.png` | An unchanged tkinter program (classic Tk widgets): a glTF export dialog with Entry, Button, LabelFrame, Checkbutton, Radiobutton, Spinbox, OptionMenu, Scale and Listbox | `examples/site/tk_export.py` |
+| `python-ttk-{dark,light}.png` | An unchanged tkinter program (ttk widgets): a render-farm queue with Combobox, Spinbox, Notebook, Treeview, Progressbar, Checkbutton | `examples/site/ttk_queue.py` |
+| `python-qt-{dark,light}.png` | Qt syntax: a material editor with QListWidget, QLineEdit, QGroupBox + QFormLayout, QComboBox, QSlider + QDoubleSpinBox, QCheckBox, QProgressBar | `examples/site/qt_material.py` |
+| `imgui-python-stock-{dark,light}.png` | Dear ImGui from Python with ImGui's own widgets and its StyleColorsDark / StyleColorsLight: a scene inspector (table, drag fields, color edit, sliders, combo, checkboxes, progress bar, plot) | `examples/site/imgui_inspector.py` |
+| `imgui-python-blender-{dark,light}.png` | The same inspector with Blender widgets and Blender's style (following the theme) | `examples/site/imgui_inspector.py` |
+
+## Rust
+
+| Image | Shows | Source |
+| --- | --- | --- |
+| `rust-rsx-dashboard-{dark,light}.png` | A render-farm dashboard in `rsx!`: CSS grid of stat cards, job rows with Blender progress bars, node list, a Blender dropdown, button and checkbox, inside `styled` | `bindings/rust/blenderui/examples/site_dashboard.rs` (+ `site/dashboard_data.rs`) |
+| `rust-builder-dashboard-{dark,light}.png` | The same dashboard in gpui's builder syntax (identical pixels) | `bindings/rust/blenderui/examples/site_dashboard_builder.rs` |
+| `rust-html-plain-{dark,light}.png` | Plain HTML: a form and a table with a browser's default look (the same in both themes) | `bindings/rust/blenderui/examples/site_plain_html.rs` (+ `site/form_page.rs`) |
+| `rust-html-styled-{dark,light}.png` | The same markup inside `styled`: Blender's theme and widgets | `bindings/rust/blenderui/examples/site_styled.rs` |
+| `rust-components-{dark,light}.png` | Blender components from Rust (`NumberField`, `NumberSlider`, `Dropdown`, `Checkbox`, `TextField`, `ColorSwatch`, `ProgressBar`, `Button`): camera properties | `bindings/rust/blenderui/examples/site_components.rs` |
+
+## JavaScript
+
+| Image | Shows | Source |
+| --- | --- | --- |
+| `js-dom-tasks-{dark,light}.png` | A task list with the native DOM-like API (createElement, appendChild, addEventListener), Blender TextField / Button / Checkbox / ProgressBar | `examples/site/js/todo_dom.js` (+ `todo_style.js`; shot by `shoot.mjs`) |
+| `js-react-tasks-{dark,light}.png` | The same task list in React (@blender-ui/react, hooks) | `examples/site/js/todo_react.js` |
+
+## C / C++
+
+| Image | Shows | Source |
+| --- | --- | --- |
+| `c-kit-app-{dark,light}.png` | The C kit API: a modifier stack (panels, enum rows, number fields, dropdowns, slider, checkboxes, buttons) | `examples/site/kit_modifiers.c` (target `bui_site_kit_app`) |
+| `imgui-cpp-stock-{dark,light}.png` | Dear ImGui from C++, ImGui's own widgets and colors: the scene inspector | `examples/site/imgui_inspector.cpp --stock` (target `bui_site_imgui`) |
+| `imgui-cpp-blender-{dark,light}.png` | The same with Blender widgets and Blender's style | `examples/site/imgui_inspector.cpp` |
+
+## Features
+
+| Image | Shows | Source |
+| --- | --- | --- |
+| `feature-menu-search-{dark,light}.png` | The File menu with `exp` typed: Blender's fuzzy menu search through submenus | `examples/site/render_props.py` (`tools/site_shots_py.py`) |
+| `feature-pie-menu-{dark,light}.png` | A pie menu (Shading) open over a node editor, the pointer toward "Rendered" | `examples/site/geometry_nodes.py` |
+| `feature-tooltip-{dark,light}.png` | A tooltip on the Denoise dropdown | `examples/site/render_props.py` |
+| `feature-color-picker-{dark,light}.png` | The color picker of a swatch (HSV wheel, value strip, HSV sliders, hex field, eyedropper) | `examples/site/render_props.py` |
+| `feature-node-editor-{dark,light}.png` | A Geometry Nodes editor: scatter instances on a surface (7 nodes, typed sockets, links, header menus) | `examples/site/geometry_nodes.py` |
+| `feature-html-effects-{dark,light}.png` | CSS effects on a gradient landscape: filters (grayscale, sepia, hue-rotate, blur, drop-shadow), clip-path (circle, polygon, star), transforms (rotate, skew, scale), mix-blend-mode (multiply, screen, difference), backdrop-filter | `bindings/rust/blenderui/examples/site_effects.rs` |
+| `feature-css-grid-{dark,light}.png` | CSS grid: a material library with `repeat(auto-fill, minmax())`, row/column spans and `grid-auto-flow: dense` | `bindings/rust/blenderui/examples/site_grid.rs` |
+| `feature-animation-{dark,light}.png` | CSS `@keyframes`: three moments (0.25 s, 0.6 s, 1.0 s) of a spinner, a progress sweep, a bouncing ball and a fading toast, side by side | `bindings/rust/blenderui/examples/site_animation.rs` |
diff --git a/website/public/images/shots/c-kit-app-dark.png b/website/public/images/shots/c-kit-app-dark.png
new file mode 100644
index 0000000..cec21c9
Binary files /dev/null and b/website/public/images/shots/c-kit-app-dark.png differ
diff --git a/website/public/images/shots/c-kit-app-light.png b/website/public/images/shots/c-kit-app-light.png
new file mode 100644
index 0000000..9689664
Binary files /dev/null and b/website/public/images/shots/c-kit-app-light.png differ
diff --git a/website/public/images/shots/feature-animation-dark.png b/website/public/images/shots/feature-animation-dark.png
new file mode 100644
index 0000000..dbfadef
Binary files /dev/null and b/website/public/images/shots/feature-animation-dark.png differ
diff --git a/website/public/images/shots/feature-animation-light.png b/website/public/images/shots/feature-animation-light.png
new file mode 100644
index 0000000..12c0115
Binary files /dev/null and b/website/public/images/shots/feature-animation-light.png differ
diff --git a/website/public/images/shots/feature-color-picker-dark.png b/website/public/images/shots/feature-color-picker-dark.png
new file mode 100644
index 0000000..071e07d
Binary files /dev/null and b/website/public/images/shots/feature-color-picker-dark.png differ
diff --git a/website/public/images/shots/feature-color-picker-light.png b/website/public/images/shots/feature-color-picker-light.png
new file mode 100644
index 0000000..f915193
Binary files /dev/null and b/website/public/images/shots/feature-color-picker-light.png differ
diff --git a/website/public/images/shots/feature-css-grid-dark.png b/website/public/images/shots/feature-css-grid-dark.png
new file mode 100644
index 0000000..bdd16ae
Binary files /dev/null and b/website/public/images/shots/feature-css-grid-dark.png differ
diff --git a/website/public/images/shots/feature-css-grid-light.png b/website/public/images/shots/feature-css-grid-light.png
new file mode 100644
index 0000000..e070600
Binary files /dev/null and b/website/public/images/shots/feature-css-grid-light.png differ
diff --git a/website/public/images/shots/feature-html-effects-dark.png b/website/public/images/shots/feature-html-effects-dark.png
new file mode 100644
index 0000000..72a858d
Binary files /dev/null and b/website/public/images/shots/feature-html-effects-dark.png differ
diff --git a/website/public/images/shots/feature-html-effects-light.png b/website/public/images/shots/feature-html-effects-light.png
new file mode 100644
index 0000000..9106f87
Binary files /dev/null and b/website/public/images/shots/feature-html-effects-light.png differ
diff --git a/website/public/images/shots/feature-menu-search-dark.png b/website/public/images/shots/feature-menu-search-dark.png
new file mode 100644
index 0000000..5d4c616
Binary files /dev/null and b/website/public/images/shots/feature-menu-search-dark.png differ
diff --git a/website/public/images/shots/feature-menu-search-light.png b/website/public/images/shots/feature-menu-search-light.png
new file mode 100644
index 0000000..7946c5f
Binary files /dev/null and b/website/public/images/shots/feature-menu-search-light.png differ
diff --git a/website/public/images/shots/feature-node-editor-dark.png b/website/public/images/shots/feature-node-editor-dark.png
new file mode 100644
index 0000000..eb4c6f2
Binary files /dev/null and b/website/public/images/shots/feature-node-editor-dark.png differ
diff --git a/website/public/images/shots/feature-node-editor-light.png b/website/public/images/shots/feature-node-editor-light.png
new file mode 100644
index 0000000..ccf2454
Binary files /dev/null and b/website/public/images/shots/feature-node-editor-light.png differ
diff --git a/website/public/images/shots/feature-pie-menu-dark.png b/website/public/images/shots/feature-pie-menu-dark.png
new file mode 100644
index 0000000..ab07dba
Binary files /dev/null and b/website/public/images/shots/feature-pie-menu-dark.png differ
diff --git a/website/public/images/shots/feature-pie-menu-light.png b/website/public/images/shots/feature-pie-menu-light.png
new file mode 100644
index 0000000..a3a56e9
Binary files /dev/null and b/website/public/images/shots/feature-pie-menu-light.png differ
diff --git a/website/public/images/shots/feature-tooltip-dark.png b/website/public/images/shots/feature-tooltip-dark.png
new file mode 100644
index 0000000..85dd4b6
Binary files /dev/null and b/website/public/images/shots/feature-tooltip-dark.png differ
diff --git a/website/public/images/shots/feature-tooltip-light.png b/website/public/images/shots/feature-tooltip-light.png
new file mode 100644
index 0000000..b3b73fc
Binary files /dev/null and b/website/public/images/shots/feature-tooltip-light.png differ
diff --git a/website/public/images/shots/imgui-cpp-blender-dark.png b/website/public/images/shots/imgui-cpp-blender-dark.png
new file mode 100644
index 0000000..a370b1c
Binary files /dev/null and b/website/public/images/shots/imgui-cpp-blender-dark.png differ
diff --git a/website/public/images/shots/imgui-cpp-blender-light.png b/website/public/images/shots/imgui-cpp-blender-light.png
new file mode 100644
index 0000000..d32069d
Binary files /dev/null and b/website/public/images/shots/imgui-cpp-blender-light.png differ
diff --git a/website/public/images/shots/imgui-cpp-stock-dark.png b/website/public/images/shots/imgui-cpp-stock-dark.png
new file mode 100644
index 0000000..f2d9a62
Binary files /dev/null and b/website/public/images/shots/imgui-cpp-stock-dark.png differ
diff --git a/website/public/images/shots/imgui-cpp-stock-light.png b/website/public/images/shots/imgui-cpp-stock-light.png
new file mode 100644
index 0000000..4de2c18
Binary files /dev/null and b/website/public/images/shots/imgui-cpp-stock-light.png differ
diff --git a/website/public/images/shots/imgui-python-blender-dark.png b/website/public/images/shots/imgui-python-blender-dark.png
new file mode 100644
index 0000000..a370b1c
Binary files /dev/null and b/website/public/images/shots/imgui-python-blender-dark.png differ
diff --git a/website/public/images/shots/imgui-python-blender-light.png b/website/public/images/shots/imgui-python-blender-light.png
new file mode 100644
index 0000000..d32069d
Binary files /dev/null and b/website/public/images/shots/imgui-python-blender-light.png differ
diff --git a/website/public/images/shots/imgui-python-stock-dark.png b/website/public/images/shots/imgui-python-stock-dark.png
new file mode 100644
index 0000000..f2d9a62
Binary files /dev/null and b/website/public/images/shots/imgui-python-stock-dark.png differ
diff --git a/website/public/images/shots/imgui-python-stock-light.png b/website/public/images/shots/imgui-python-stock-light.png
new file mode 100644
index 0000000..4de2c18
Binary files /dev/null and b/website/public/images/shots/imgui-python-stock-light.png differ
diff --git a/website/public/images/shots/js-dom-tasks-dark.png b/website/public/images/shots/js-dom-tasks-dark.png
new file mode 100644
index 0000000..3d2b22e
Binary files /dev/null and b/website/public/images/shots/js-dom-tasks-dark.png differ
diff --git a/website/public/images/shots/js-dom-tasks-light.png b/website/public/images/shots/js-dom-tasks-light.png
new file mode 100644
index 0000000..90e833e
Binary files /dev/null and b/website/public/images/shots/js-dom-tasks-light.png differ
diff --git a/website/public/images/shots/js-react-tasks-dark.png b/website/public/images/shots/js-react-tasks-dark.png
new file mode 100644
index 0000000..3d2b22e
Binary files /dev/null and b/website/public/images/shots/js-react-tasks-dark.png differ
diff --git a/website/public/images/shots/js-react-tasks-light.png b/website/public/images/shots/js-react-tasks-light.png
new file mode 100644
index 0000000..90e833e
Binary files /dev/null and b/website/public/images/shots/js-react-tasks-light.png differ
diff --git a/website/public/images/shots/python-components-dark.png b/website/public/images/shots/python-components-dark.png
new file mode 100644
index 0000000..0d98eef
Binary files /dev/null and b/website/public/images/shots/python-components-dark.png differ
diff --git a/website/public/images/shots/python-components-light.png b/website/public/images/shots/python-components-light.png
new file mode 100644
index 0000000..587d2b6
Binary files /dev/null and b/website/public/images/shots/python-components-light.png differ
diff --git a/website/public/images/shots/python-qt-dark.png b/website/public/images/shots/python-qt-dark.png
new file mode 100644
index 0000000..465baf6
Binary files /dev/null and b/website/public/images/shots/python-qt-dark.png differ
diff --git a/website/public/images/shots/python-qt-light.png b/website/public/images/shots/python-qt-light.png
new file mode 100644
index 0000000..c198505
Binary files /dev/null and b/website/public/images/shots/python-qt-light.png differ
diff --git a/website/public/images/shots/python-tkinter-dark.png b/website/public/images/shots/python-tkinter-dark.png
new file mode 100644
index 0000000..6345ea0
Binary files /dev/null and b/website/public/images/shots/python-tkinter-dark.png differ
diff --git a/website/public/images/shots/python-tkinter-light.png b/website/public/images/shots/python-tkinter-light.png
new file mode 100644
index 0000000..f500c46
Binary files /dev/null and b/website/public/images/shots/python-tkinter-light.png differ
diff --git a/website/public/images/shots/python-ttk-dark.png b/website/public/images/shots/python-ttk-dark.png
new file mode 100644
index 0000000..fbbb7e5
Binary files /dev/null and b/website/public/images/shots/python-ttk-dark.png differ
diff --git a/website/public/images/shots/python-ttk-light.png b/website/public/images/shots/python-ttk-light.png
new file mode 100644
index 0000000..68a898b
Binary files /dev/null and b/website/public/images/shots/python-ttk-light.png differ
diff --git a/website/public/images/shots/rust-builder-dashboard-dark.png b/website/public/images/shots/rust-builder-dashboard-dark.png
new file mode 100644
index 0000000..98c6452
Binary files /dev/null and b/website/public/images/shots/rust-builder-dashboard-dark.png differ
diff --git a/website/public/images/shots/rust-builder-dashboard-light.png b/website/public/images/shots/rust-builder-dashboard-light.png
new file mode 100644
index 0000000..d1e9684
Binary files /dev/null and b/website/public/images/shots/rust-builder-dashboard-light.png differ
diff --git a/website/public/images/shots/rust-components-dark.png b/website/public/images/shots/rust-components-dark.png
new file mode 100644
index 0000000..59f45d6
Binary files /dev/null and b/website/public/images/shots/rust-components-dark.png differ
diff --git a/website/public/images/shots/rust-components-light.png b/website/public/images/shots/rust-components-light.png
new file mode 100644
index 0000000..16f9bf6
Binary files /dev/null and b/website/public/images/shots/rust-components-light.png differ
diff --git a/website/public/images/shots/rust-html-plain-dark.png b/website/public/images/shots/rust-html-plain-dark.png
new file mode 100644
index 0000000..3484b77
Binary files /dev/null and b/website/public/images/shots/rust-html-plain-dark.png differ
diff --git a/website/public/images/shots/rust-html-plain-light.png b/website/public/images/shots/rust-html-plain-light.png
new file mode 100644
index 0000000..3484b77
Binary files /dev/null and b/website/public/images/shots/rust-html-plain-light.png differ
diff --git a/website/public/images/shots/rust-html-styled-dark.png b/website/public/images/shots/rust-html-styled-dark.png
new file mode 100644
index 0000000..09bb212
Binary files /dev/null and b/website/public/images/shots/rust-html-styled-dark.png differ
diff --git a/website/public/images/shots/rust-html-styled-light.png b/website/public/images/shots/rust-html-styled-light.png
new file mode 100644
index 0000000..5d58602
Binary files /dev/null and b/website/public/images/shots/rust-html-styled-light.png differ
diff --git a/website/public/images/shots/rust-rsx-dashboard-dark.png b/website/public/images/shots/rust-rsx-dashboard-dark.png
new file mode 100644
index 0000000..98c6452
Binary files /dev/null and b/website/public/images/shots/rust-rsx-dashboard-dark.png differ
diff --git a/website/public/images/shots/rust-rsx-dashboard-light.png b/website/public/images/shots/rust-rsx-dashboard-light.png
new file mode 100644
index 0000000..d1e9684
Binary files /dev/null and b/website/public/images/shots/rust-rsx-dashboard-light.png differ
diff --git a/website/public/images/tkinter-render-settings.png b/website/public/images/tkinter-render-settings.png
new file mode 100644
index 0000000..457958b
Binary files /dev/null and b/website/public/images/tkinter-render-settings.png differ
diff --git a/website/public/images/tkinter_canvas.png b/website/public/images/tkinter_canvas.png
new file mode 100644
index 0000000..c352afe
Binary files /dev/null and b/website/public/images/tkinter_canvas.png differ
diff --git a/website/public/images/tkinter_items.png b/website/public/images/tkinter_items.png
new file mode 100644
index 0000000..23fa6dc
Binary files /dev/null and b/website/public/images/tkinter_items.png differ
diff --git a/website/public/images/tkinter_messagebox.png b/website/public/images/tkinter_messagebox.png
new file mode 100644
index 0000000..67843df
Binary files /dev/null and b/website/public/images/tkinter_messagebox.png differ
diff --git a/website/public/images/tkinter_notes.png b/website/public/images/tkinter_notes.png
new file mode 100644
index 0000000..960120a
Binary files /dev/null and b/website/public/images/tkinter_notes.png differ
diff --git a/website/public/logo.png b/website/public/logo.png
new file mode 100644
index 0000000..8a48835
Binary files /dev/null and b/website/public/logo.png differ
diff --git a/website/public/og.png b/website/public/og.png
new file mode 100644
index 0000000..7b0176b
Binary files /dev/null and b/website/public/og.png differ
diff --git a/website/src/components/charts/BarChart.astro b/website/src/components/charts/BarChart.astro
new file mode 100644
index 0000000..ae08a3c
--- /dev/null
+++ b/website/src/components/charts/BarChart.astro
@@ -0,0 +1,79 @@
+---
+/**
+ * Horizontal bars, drawn on the server. BUI's bars are Blender blue; the others are hatched grey.
+ *
+ * <BarChart
+ * title="First frame" unit="ms" better="lower"
+ * headline={{ value: "40×", text: "sooner than gpui-fast" }}
+ * bars={[
+ * { label: "blenderui", sub: "GPU", value: 5, display: "~5 ms", ours: true },
+ * { label: "gpui", value: 220, display: "~220 ms" },
+ * ]}
+ * table="cells3000" // optional: an "Open bench" table (id from src/data/bench.ts, or a table object)
+ * />
+ *
+ * For the published benchmarks use <BenchChart id="…" />, which reads src/data/bench.ts.
+ */
+import ChartFrame from "./ChartFrame.astro";
+import type { Bar, Table, TableId } from "../../data/bench";
+
+interface Props {
+ title: string;
+ subtitle?: string;
+ unit: string;
+ better?: "lower" | "higher";
+ headline?: { value: string; text: string };
+ bars: Bar[];
+ table?: TableId | Table;
+ source?: string;
+ /** Show "N× slower" next to the other bars. Default true. */
+ ratios?: boolean;
+ bare?: boolean;
+ class?: string;
+}
+
+const { bars, unit, better = "lower", ratios = true, ...frame } = Astro.props;
+
+const max = Math.max(...bars.map((b) => b.value), 0) || 1;
+const fmt = (v: number) => `${v.toLocaleString("en-US")} ${unit}`;
+const oursValues = bars.filter((b) => b.ours && b.value > 0).map((b) => b.value);
+const best = oursValues.length ? (better === "lower" ? Math.min(...oursValues) : Math.max(...oursValues)) : 0;
+
+function ratioText(b: Bar): string | null {
+ if (!ratios || b.ours || !best || b.value <= 0) return null;
+ const r = better === "lower" ? b.value / best : best / b.value;
+ if (r < 1.15) return null;
+ const n = r >= 10 ? Math.round(r) : Math.round(r * 10) / 10;
+ return `${n}× ${better === "lower" ? "more" : "fewer"}`;
+}
+const legend = [
+ { name: "BUI", color: "var(--primary)" },
+ ...(bars.some((b) => !b.ours) ? [{ name: "Others", color: "var(--chart-other)", hatch: true }] : []),
+];
+---
+
+<ChartFrame {...frame} better={better} legend={bars.some((b) => !b.ours) ? legend : undefined}>
+ <ul class="chart-rows flex flex-col gap-2.5">
+ {
+ bars.map((b, i) => {
+ const pct = (b.value / max) * 100;
+ const r = ratioText(b);
+ return (
+ <li class="grid grid-cols-[minmax(6.5rem,9.5rem)_minmax(0,1fr)] items-center gap-3 sm:grid-cols-[minmax(8rem,11rem)_minmax(0,1fr)]" style={`--i:${i}`}>
+ <span class="flex min-w-0 flex-col leading-tight">
+ <span class:list={["truncate text-[13px]", b.ours ? "font-semibold" : "text-muted"]}>{b.label}</span>
+ {b.sub && <span class="truncate text-[11.5px] text-muted">{b.sub}</span>}
+ </span>
+ <span class="chart-track">
+ <span class:list={["chart-bar", b.ours ? "is-ours" : "is-other"]} style={`--p:${Math.max(pct, 0.4).toFixed(2)}%`} />
+ <span class="chart-value" style={`--p:${pct.toFixed(2)}%`}>
+ <span class:list={["tabular", b.ours ? "font-semibold text-foreground" : "text-muted"]}>{b.display ?? fmt(b.value)}</span>
+ {r && <span class="chart-ratio">{r}</span>}
+ </span>
+ </span>
+ </li>
+ );
+ })
+ }
+ </ul>
+</ChartFrame>
diff --git a/website/src/components/charts/BenchChart.astro b/website/src/components/charts/BenchChart.astro
new file mode 100644
index 0000000..5bb45fc
--- /dev/null
+++ b/website/src/components/charts/BenchChart.astro
@@ -0,0 +1,44 @@
+---
+/**
+ * A published benchmark, as a chart with an "Open bench" table underneath.
+ * Numbers come from src/data/bench.ts (which follows README.md "Performance").
+ *
+ * <BenchChart id="first-frame" />
+ * <BenchChart id="cpu-per-frame" title="Override the title" />
+ *
+ * <BenchChart id="js-first-frame" table="jsStartupJs" /> (a narrower table under "Open bench")
+ *
+ * Ids: first-frame, idle-all, start-time, start-cpu, idle-cpu, memory-start, start-all, fps,
+ * cpu-per-frame, ram, cpu-per-frame-cells, uncapped-fps, frame-times, js-first-frame, js-cpu-3000.
+ */
+import BarChart from "./BarChart.astro";
+import GroupedBarChart from "./GroupedBarChart.astro";
+import LineChart from "./LineChart.astro";
+import { charts, type ChartId, type ChartSpec, type TableId } from "../../data/bench";
+
+interface Props {
+ id: ChartId;
+ title?: string;
+ subtitle?: string;
+ /** Show a different table from src/data/bench.ts under "Open bench" (e.g. one language's rows). */
+ table?: TableId;
+ /** Hide the headline number. */
+ plain?: boolean;
+ bare?: boolean;
+ class?: string;
+}
+
+const { id, plain = false, ...rest } = Astro.props;
+const spec = charts[id] as ChartSpec | undefined;
+if (!spec) throw new Error(`<BenchChart>: unknown id "${id}". Ids: ${Object.keys(charts).join(", ")}`);
+const { kind, ...props } = spec;
+const merged = {
+ ...props,
+ ...Object.fromEntries(Object.entries(rest).filter(([, v]) => v !== undefined)),
+ headline: plain ? undefined : props.headline,
+};
+---
+
+{kind === "bars" && <BarChart {...(merged as any)} />}
+{kind === "groups" && <GroupedBarChart {...(merged as any)} />}
+{kind === "line" && <LineChart {...(merged as any)} />}
diff --git a/website/src/components/charts/BenchTable.astro b/website/src/components/charts/BenchTable.astro
new file mode 100644
index 0000000..4ba6877
--- /dev/null
+++ b/website/src/components/charts/BenchTable.astro
@@ -0,0 +1,64 @@
+---
+/**
+ * The exact numbers behind a chart, as a table.
+ *
+ * <BenchTable id="startup" /> a table from src/data/bench.ts (`tables`)
+ * <BenchTable table={{ caption, columns, rows }} />
+ *
+ * Ids: startup, cells3000, cellsFull, frameTimes, jsStartup, jsAnim3000, jsAnim1000.
+ */
+import { tables, type Table, type TableId } from "../../data/bench";
+
+interface Props {
+ id?: TableId;
+ table?: Table;
+ /** Hide the caption visually (it stays for screen readers). */
+ quiet?: boolean;
+}
+
+const { id, table: given, quiet = false } = Astro.props;
+const table: Table | undefined = given ?? (id ? tables[id] : undefined);
+if (!table) throw new Error(`<BenchTable>: unknown table "${id}". Ids: ${Object.keys(tables).join(", ")}`);
+const numeric = new Set(table.numeric ?? []);
+---
+
+<div class="bench-table not-prose">
+ <div class="scroll-x relative overflow-x-auto border border-border">
+ <table class="w-full min-w-[520px] border-collapse text-[13px] leading-5">
+ <caption class:list={["px-3.5 py-2.5 text-left text-[12.5px] text-muted", quiet && "sr-only"]}>{table.caption}</caption>
+ <thead>
+ <tr class="bg-surface">
+ {
+ table.columns.map((c, i) => (
+ <th scope="col" class:list={["border-y border-border px-3.5 py-2 font-semibold whitespace-nowrap", numeric.has(i) ? "text-right" : "text-left"]}>
+ {c}
+ </th>
+ ))
+ }
+ </tr>
+ </thead>
+ <tbody class="tabular">
+ {
+ table.rows.map((row) => (
+ <tr class="border-b border-border-soft last:border-b-0 hover:bg-surface/70">
+ {row.map((cell, i) =>
+ i === 0 ? (
+ <th scope="row" class="px-3.5 py-2 text-left font-medium [&_strong]:font-semibold" set:html={cell} />
+ ) : (
+ <td
+ class:list={[
+ "px-3.5 py-2 text-muted [&_strong]:font-semibold [&_strong]:text-foreground",
+ numeric.has(i) ? "text-right whitespace-nowrap" : "",
+ ]}
+ set:html={cell}
+ />
+ ),
+ )}
+ </tr>
+ ))
+ }
+ </tbody>
+ </table>
+ </div>
+ {table.note && <p class="mt-2 text-[12.5px] leading-5 text-muted">{table.note}</p>}
+</div>
diff --git a/website/src/components/charts/ChartFrame.astro b/website/src/components/charts/ChartFrame.astro
new file mode 100644
index 0000000..67f385f
--- /dev/null
+++ b/website/src/components/charts/ChartFrame.astro
@@ -0,0 +1,90 @@
+---
+/**
+ * The frame every chart sits in: title, takeaway, the plot (slot), and an "Open bench"
+ * disclosure with the exact table. Used by BarChart, GroupedBarChart and LineChart.
+ */
+import Icon from "../site/Icon.astro";
+import BenchTable from "./BenchTable.astro";
+import { machine, tables, type Table, type TableId } from "../../data/bench";
+import { repoFile } from "../../lib/docs";
+
+interface Props {
+ title: string;
+ subtitle?: string;
+ better: "lower" | "higher";
+ headline?: { value: string; text: string };
+ table?: TableId | Table;
+ source?: string;
+ /** Landing-page variant: no outer border (the section draws it). */
+ bare?: boolean;
+ legend?: { name: string; color: string; hatch?: boolean }[];
+ class?: string;
+}
+
+const { title, subtitle, better, headline, table, source, bare = false, legend, class: className } = Astro.props;
+const tableData: Table | undefined = typeof table === "string" ? tables[table] : table;
+---
+
+<figure class:list={["chart not-prose", !bare && "border border-border", className]} data-chart>
+ <figcaption class="flex flex-col gap-3 px-4 pt-4 sm:flex-row sm:items-start sm:justify-between sm:gap-6 sm:px-5 sm:pt-5">
+ <div class="flex min-w-0 flex-col gap-1">
+ <p class="text-[15px] font-semibold leading-6 tracking-[-0.005em]">{title}</p>
+ {subtitle && <p class="text-[13px] leading-5 text-muted">{subtitle}</p>}
+ <p class="mt-1 inline-flex items-center gap-1.5 text-[11.5px] text-muted">
+ <Icon name={better === "lower" ? "arrow-down" : "arrow-up"} size={12} weight="bold" />
+ {better === "lower" ? "Lower is better" : "Higher is better"}
+ </p>
+ </div>
+ {
+ headline && (
+ <p class="chart-headline flex shrink-0 items-baseline gap-2 sm:max-w-[16rem] sm:flex-col sm:items-end sm:gap-0.5 sm:text-right">
+ <span class="tabular text-[1.75rem] font-light leading-none tracking-[-0.03em] text-link sm:text-[2.1rem]">{headline.value}</span>
+ <span class="text-[12.5px] leading-5 text-muted">{headline.text}</span>
+ </p>
+ )
+ }
+ </figcaption>
+
+ {
+ legend && legend.length > 0 && (
+ <ul class="flex flex-wrap gap-x-4 gap-y-1.5 px-4 pt-3 text-[12px] text-muted sm:px-5" aria-label="Legend">
+ {legend.map((l) => (
+ <li class="inline-flex items-center gap-1.5">
+ <span class:list={["inline-block size-2.5", l.hatch && "chart-hatch"]} style={`background-color:${l.color}`} aria-hidden="true" />
+ {l.name}
+ </li>
+ ))}
+ </ul>
+ )
+ }
+
+ <div class="px-4 pt-4 pb-4 sm:px-5">
+ <slot />
+ </div>
+
+ {
+ tableData && (
+ <details class="chart-details group border-t border-border">
+ <summary class="flex cursor-pointer list-none items-center gap-2 px-4 py-2.5 text-[13px] font-medium text-muted transition-colors duration-150 hover:bg-surface hover:text-foreground sm:px-5 [&::-webkit-details-marker]:hidden">
+ <Icon name="table" size={15} />
+ <span class="group-open:hidden">Open bench</span>
+ <span class="hidden group-open:inline">Close bench</span>
+ <span class="ml-auto hidden text-[12px] font-normal sm:inline">{machine}</span>
+ <Icon name="caret-down" size={13} class="transition-transform duration-200 group-open:rotate-180" />
+ </summary>
+ <div class="flex flex-col gap-3 px-4 pt-1 pb-4 sm:px-5">
+ <BenchTable table={tableData} />
+ {source && (
+ <p class="text-[12.5px] text-muted">
+ Source:{" "}
+ <a class="font-mono text-link underline-offset-4 hover:underline" href={repoFile(source)}>
+ {source}
+ </a>
+ <span class="sm:hidden"> · {machine}</span>
+ </p>
+ )}
+ </div>
+ </details>
+ )
+ }
+</figure>
diff --git a/website/src/components/charts/GroupedBarChart.astro b/website/src/components/charts/GroupedBarChart.astro
new file mode 100644
index 0000000..1f45a4c
--- /dev/null
+++ b/website/src/components/charts/GroupedBarChart.astro
@@ -0,0 +1,87 @@
+---
+/**
+ * Grouped horizontal bars: one group per category, one bar per series.
+ *
+ * <GroupedBarChart
+ * title="Start time, every way in" unit="ms" better="lower"
+ * series={[{ name: "CPU renderer", ours: true }, { name: "GPU renderer" }]}
+ * groups={[
+ * { label: "Rust", values: [38, 42] },
+ * { label: "Qt syntax", sub: "Python", values: [156, 161] },
+ * ]}
+ * table="startup"
+ * />
+ *
+ * `null` in `values` means "not measured" and is drawn as a dash.
+ */
+import ChartFrame from "./ChartFrame.astro";
+import type { Group, Series, Table, TableId } from "../../data/bench";
+
+interface Props {
+ title: string;
+ subtitle?: string;
+ unit: string;
+ better?: "lower" | "higher";
+ headline?: { value: string; text: string };
+ series: Series[];
+ groups: Group[];
+ table?: TableId | Table;
+ source?: string;
+ bare?: boolean;
+ class?: string;
+}
+
+const { series, groups, unit, better = "lower", ...frame } = Astro.props;
+
+const all = groups.flatMap((g) => g.values.filter((v): v is number => v !== null));
+const max = Math.max(...all, 0) || 1;
+
+// BUI's series in blues, others in greys (hatched), each a step lighter.
+let ours = 0;
+let other = 0;
+const colors = series.map((s) => {
+ if (s.ours) {
+ const c = ["var(--primary)", "var(--chart-ours-2)", "var(--chart-ours-3)"][Math.min(ours++, 2)];
+ return { color: c, hatch: false };
+ }
+ const c = ["var(--chart-other)", "var(--chart-other-2)", "var(--chart-other-3)"][Math.min(other++, 2)];
+ return { color: c, hatch: true };
+});
+const legend = series.map((s, i) => ({ name: s.name, ...colors[i] }));
+let n = 0;
+---
+
+<ChartFrame {...frame} better={better} legend={legend}>
+ <ul class="flex flex-col gap-4">
+ {
+ groups.map((g) => (
+ <li class="grid grid-cols-[minmax(6.5rem,9.5rem)_minmax(0,1fr)] items-start gap-3 sm:grid-cols-[minmax(8rem,11rem)_minmax(0,1fr)]">
+ <span class="flex min-w-0 flex-col pt-0.5 leading-tight">
+ <span class="truncate text-[13px] font-medium">{g.label}</span>
+ {g.sub && <span class="truncate text-[11.5px] text-muted">{g.sub}</span>}
+ </span>
+ <ul class="flex flex-col gap-1">
+ {g.values.map((v, i) => {
+ const pct = v === null ? 0 : (v / max) * 100;
+ const text = g.display?.[i] ?? (v === null ? "–" : `${v.toLocaleString("en-US")} ${unit}`);
+ return (
+ <li class="chart-track is-thin" style={`--i:${n++}`}>
+ <span class="sr-only">{series[i].name}: </span>
+ {v !== null && (
+ <span
+ class:list={["chart-bar", colors[i].hatch ? "is-other" : "is-ours"]}
+ style={`--p:${Math.max(pct, 0.4).toFixed(2)}%;--c:${colors[i].color}`}
+ />
+ )}
+ <span class="chart-value" style={`--p:${pct.toFixed(2)}%`}>
+ <span class:list={["tabular", series[i].ours ? "font-medium text-foreground" : "text-muted"]}>{text}</span>
+ </span>
+ </li>
+ );
+ })}
+ </ul>
+ </li>
+ ))
+ }
+ </ul>
+</ChartFrame>
diff --git a/website/src/components/charts/LineChart.astro b/website/src/components/charts/LineChart.astro
new file mode 100644
index 0000000..2aa0bfc
--- /dev/null
+++ b/website/src/components/charts/LineChart.astro
@@ -0,0 +1,93 @@
+---
+/**
+ * A small line chart (SVG), for a value measured at a few sizes.
+ *
+ * <LineChart
+ * title="Uncapped frame rate" unit="fps" better="higher"
+ * x={[100, 1000, 3000]} xLabel="animated cells"
+ * lines={[
+ * { name: "blenderui GPU", ours: true, values: [1491, 309, 94] },
+ * { name: "blenderui CPU", values: [649, 202, 76] },
+ * ]}
+ * />
+ *
+ * x values are spaced evenly (they're categories, like scene sizes).
+ */
+import ChartFrame from "./ChartFrame.astro";
+import type { Table, TableId } from "../../data/bench";
+
+interface Props {
+ title: string;
+ subtitle?: string;
+ unit: string;
+ better?: "lower" | "higher";
+ headline?: { value: string; text: string };
+ x: number[];
+ xLabel: string;
+ lines: { name: string; ours?: boolean; values: number[] }[];
+ table?: TableId | Table;
+ source?: string;
+ bare?: boolean;
+ class?: string;
+}
+
+const { x, xLabel, lines, unit, better = "higher", ...frame } = Astro.props;
+
+const W = 520, H = 230, L = 48, R = 20, T = 22, B = 40;
+const raw = Math.max(...lines.flatMap((l) => l.values), 1);
+const mag = 10 ** Math.floor(Math.log10(raw));
+const top = Math.ceil(raw / mag / (raw / mag > 5 ? 2 : 1)) * mag * (raw / mag > 5 ? 2 : 1);
+const ticks = [0, 0.25, 0.5, 0.75, 1].map((f) => f * top);
+const px = (i: number) => L + (x.length === 1 ? (W - L - R) / 2 : (i / (x.length - 1)) * (W - L - R));
+const py = (v: number) => T + (1 - v / top) * (H - T - B);
+const colors = lines.map((l, i) => (l.ours ? "var(--primary)" : i % 2 ? "var(--chart-ours-2)" : "var(--chart-other)"));
+const legend = lines.map((l, i) => ({ name: l.name, color: colors[i] }));
+const summary = lines.map((l) => `${l.name}: ${l.values.map((v, i) => `${v} ${unit} at ${x[i]} ${xLabel}`).join(", ")}`).join(". ");
+---
+
+<ChartFrame {...frame} better={better} legend={legend}>
+ <svg viewBox={`0 0 ${W} ${H}`} class="chart-line block h-auto w-full" role="img" aria-label={summary}>
+ {
+ ticks.map((t) => (
+ <g>
+ <line x1={L} x2={W - R} y1={py(t)} y2={py(t)} class="chart-grid" />
+ <text x={L - 8} y={py(t)} dy="0.32em" text-anchor="end" class="chart-axis">
+ {t.toLocaleString("en-US")}
+ </text>
+ </g>
+ ))
+ }
+ {
+ x.map((v, i) => (
+ <text x={px(i)} y={H - B + 18} text-anchor="middle" class="chart-axis">
+ {v.toLocaleString("en-US")}
+ </text>
+ ))
+ }
+ <text x={(L + W - R) / 2} y={H - 4} text-anchor="middle" class="chart-axis">{xLabel} · {unit}</text>
+ {
+ lines.map((l, li) => (
+ <g style={`--c:${colors[li]};--i:${li}`}>
+ <polyline
+ points={l.values.map((v, i) => `${px(i)},${py(v)}`).join(" ")}
+ pathLength="1"
+ class="chart-path"
+ fill="none"
+ stroke="var(--c)"
+ stroke-width={l.ours ? 2.5 : 2}
+ stroke-linejoin="round"
+ stroke-linecap="square"
+ />
+ {l.values.map((v, i) => (
+ <g class="chart-point" style={`--j:${i}`}>
+ <rect x={px(i) - 3.5} y={py(v) - 3.5} width="7" height="7" fill="var(--c)" />
+ <text x={px(i) + (i === l.values.length - 1 ? -8 : 8)} y={py(v) - 9} text-anchor={i === l.values.length - 1 ? "end" : "start"} class:list={["chart-label", l.ours && "is-ours"]}>
+ {v.toLocaleString("en-US")}
+ </text>
+ </g>
+ ))}
+ </g>
+ ))
+ }
+ </svg>
+</ChartFrame>
diff --git a/website/src/components/docs/Badge.astro b/website/src/components/docs/Badge.astro
new file mode 100644
index 0000000..c3998b0
--- /dev/null
+++ b/website/src/components/docs/Badge.astro
@@ -0,0 +1,41 @@
+---
+/**
+ * A small inline label. <Badge>New</Badge>, <Badge tone="primary">GPU</Badge>
+ * tone: neutral (default) | primary | accent | stable | preview | experimental | soon
+ * Status tones get a Phosphor icon automatically; pass icon="…" (any Phosphor name) to
+ * choose one, or icon="" for none.
+ */
+import Icon from "../site/Icon.astro";
+
+type Tone = "neutral" | "primary" | "accent" | "stable" | "preview" | "experimental" | "soon";
+
+interface Props {
+ tone?: Tone;
+ icon?: string;
+}
+const { tone = "neutral", icon } = Astro.props;
+const tones: Record<Tone, string> = {
+ neutral: "border-border text-muted",
+ primary: "border-primary bg-primary text-white",
+ accent: "border-accent text-accent",
+ stable: "border-(--status-stable)/50 text-(--status-stable)",
+ preview: "border-(--status-preview)/50 text-(--status-preview)",
+ experimental: "border-(--status-experimental)/50 text-(--status-experimental)",
+ soon: "border-(--status-soon)/50 text-(--status-soon)",
+};
+const auto: Partial<Record<Tone, string>> = {
+ stable: "check-circle",
+ preview: "circle-half",
+ experimental: "flask",
+ soon: "hourglass-medium",
+};
+const iconName = icon === undefined ? auto[tone] : icon || undefined;
+---
+
+<span
+ class:list={[
+ "inline-flex translate-y-[-1px] items-center gap-1 border px-1.5 align-middle text-[11px] font-medium uppercase leading-[18px] tracking-[0.08em]",
+ tones[tone],
+ ]}
+ >{iconName && <Icon name={iconName} weight="bold" size={11} />}<slot /></span
+>
diff --git a/website/src/components/docs/Callout.astro b/website/src/components/docs/Callout.astro
new file mode 100644
index 0000000..f73e5dc
--- /dev/null
+++ b/website/src/components/docs/Callout.astro
@@ -0,0 +1,103 @@
+---
+/**
+ * <Callout type="tip" title="Optional title">Body in Markdown.</Callout>
+ *
+ * type: note (default) | tip | warning | joke | coming-soon
+ * Use sparingly: one or two per page. A "joke" callout is the place for the page's one joke.
+ */
+import Icon from "../site/Icon.astro";
+
+type Kind = "note" | "tip" | "warning" | "joke" | "coming-soon";
+
+interface Props {
+ type?: Kind;
+ title?: string;
+}
+
+const { type = "note", title } = Astro.props;
+
+const kinds: Record<Kind, { icon: string; label: string; tone: string }> = {
+ note: { icon: "info", label: "Note", tone: "var(--primary)" },
+ tip: { icon: "lightbulb", label: "Tip", tone: "var(--status-stable)" },
+ warning: { icon: "warning", label: "Careful", tone: "var(--status-warn)" },
+ joke: { icon: "smiley", label: "Aside", tone: "var(--muted)" },
+ "coming-soon": { icon: "hourglass-medium", label: "Coming soon", tone: "var(--status-soon)" },
+};
+
+const k = kinds[type];
+---
+
+<aside class:list={["callout not-prose", `callout-${type}`]} style={`--tone:${k.tone}`} aria-label={title ?? k.label}>
+ <p class="callout-label">
+ <Icon name={k.icon} weight="duotone" size={16} />
+ <span>{title ?? k.label}</span>
+ </p>
+ <div class="callout-body">
+ <slot />
+ </div>
+</aside>
+
+<style>
+ .callout {
+ position: relative;
+ padding: 0.85rem 1.1rem 1rem;
+ border: 1px solid var(--border);
+ background: color-mix(in oklab, var(--tone) 5%, var(--background));
+ }
+ /* The hatched corner: a quiet marker that says "aside" without a colored bar. */
+ .callout::after {
+ content: "";
+ position: absolute;
+ top: -1px;
+ right: -1px;
+ width: 2.75rem;
+ height: 2.75rem;
+ background-image: repeating-linear-gradient(135deg, color-mix(in oklab, var(--tone) 55%, transparent) 0 1px, transparent 1px 5px);
+ clip-path: polygon(0 0, 100% 0, 100% 100%);
+ pointer-events: none;
+ }
+ .callout-joke {
+ background: var(--surface);
+ }
+ .callout-coming-soon {
+ background: var(--background);
+ }
+ .callout-label {
+ display: flex;
+ align-items: center;
+ gap: 0.45rem;
+ padding-right: 2.5rem;
+ font-size: 11.5px;
+ font-weight: 600;
+ letter-spacing: 0.12em;
+ text-transform: uppercase;
+ color: color-mix(in oklab, var(--tone) 82%, var(--foreground));
+ }
+ .callout-body {
+ margin-top: 0.4rem;
+ font-size: 15px;
+ line-height: 1.7;
+ }
+ .callout-body :global(> * + *) {
+ margin-top: 0.6rem;
+ }
+ .callout-body :global(a) {
+ color: var(--link);
+ text-decoration: underline;
+ text-underline-offset: 3px;
+ }
+ .callout-body :global(code) {
+ font-family: var(--font-mono);
+ font-size: 0.85em;
+ padding: 0.1em 0.3em;
+ background: var(--surface-2);
+ }
+ .callout-body :global(ul) {
+ list-style: square;
+ padding-left: 1.2rem;
+ }
+ .callout-body :global(ol) {
+ list-style: decimal;
+ padding-left: 1.3rem;
+ }
+</style>
diff --git a/website/src/components/docs/Card.astro b/website/src/components/docs/Card.astro
new file mode 100644
index 0000000..dd538d0
--- /dev/null
+++ b/website/src/components/docs/Card.astro
@@ -0,0 +1,53 @@
+---
+/**
+ * <Card title="…" href="docs/…/" icon="book" kicker="Tutorial">One or two sentences.</Card>
+ * Without `href` it's a plain cell. Internal links are site-relative (no leading slash).
+ * icon: any Phosphor name (https://phosphoricons.com) or an alias from src/components/site/Icon.astro.
+ */
+import Icon, { type IconName } from "../site/Icon.astro";
+import { href as link } from "../../lib/docs";
+
+interface Props {
+ title: string;
+ href?: string;
+ icon?: IconName;
+ kicker?: string;
+ soon?: boolean;
+}
+
+const { title, href, icon, kicker, soon = false } = Astro.props;
+const url = href ? link(href) : undefined;
+const external = href ? /^https?:/.test(href) : false;
+const Tag = url ? "a" : "div";
+---
+
+<Tag
+ href={url}
+ class:list={[
+ "group relative flex flex-col gap-2 bg-background p-5 transition-colors duration-150 ease-out",
+ url && "hover:bg-surface focus-visible:z-10",
+ ]}
+>
+ <span class="flex items-center gap-2.5">
+ {
+ icon && (
+ <span class="inline-flex size-8 items-center justify-center border border-border text-link transition-colors group-hover:border-primary group-hover:bg-primary group-hover:text-white">
+ <Icon name={icon} weight="duotone" size={17} />
+ </span>
+ )
+ }
+ <span class="flex flex-col">
+ {kicker && <span class="kicker text-muted">{kicker}</span>}
+ <span class="font-semibold leading-6 group-hover:text-link">{title}</span>
+ </span>
+ {soon && <span class="ml-auto border border-primary px-1 text-[10px] font-medium uppercase leading-4 tracking-[0.08em] text-link">Soon</span>}
+ {
+ url && !soon && (
+ <span class="ml-auto text-muted transition-transform duration-150 ease-out group-hover:translate-x-0.5 group-hover:text-link">
+ <Icon name={external ? "arrow-up-right" : "arrow-right"} size={16} />
+ </span>
+ )
+ }
+ </span>
+ <div class="text-[14.5px] leading-6 text-muted [&_code]:font-mono [&_code]:text-[0.85em] [&_p+p]:mt-2"><slot /></div>
+</Tag>
diff --git a/website/src/components/docs/CardGrid.astro b/website/src/components/docs/CardGrid.astro
new file mode 100644
index 0000000..8ea55aa
--- /dev/null
+++ b/website/src/components/docs/CardGrid.astro
@@ -0,0 +1,20 @@
+---
+/**
+ * A bordered grid of <Card>s. Cards share borders, like cells of one table.
+ *
+ * <CardGrid>
+ * <Card title="Install" href="docs/start/installation/" icon="terminal">Get BUI for your language.</Card>
+ * <Card title="Your first app" href="docs/tutorials/first-app-python/">Ten lines, one window.</Card>
+ * </CardGrid>
+ *
+ * cols: 2 (default) or 3 on wide screens.
+ */
+interface Props {
+ cols?: 2 | 3;
+}
+const { cols = 2 } = Astro.props;
+---
+
+<div class:list={["card-grid not-prose grid gap-px border border-border bg-border", cols === 3 ? "sm:grid-cols-2 lg:grid-cols-3" : "sm:grid-cols-2"]}>
+ <slot />
+</div>
diff --git a/website/src/components/docs/ComingSoon.astro b/website/src/components/docs/ComingSoon.astro
new file mode 100644
index 0000000..e5a5240
--- /dev/null
+++ b/website/src/components/docs/ComingSoon.astro
@@ -0,0 +1,66 @@
+---
+/**
+ * Marks a feature that isn't built yet. Friendly, honest, and links to the roadmap.
+ *
+ * <ComingSoon /> generic banner
+ * <ComingSoon feature="WebAssembly" /> names the feature
+ * <ComingSoon feature="egui">Optional details in Markdown.</ComingSoon>
+ * <ComingSoon inline /> a small "Coming soon" chip inside a sentence or table
+ */
+import Icon from "../site/Icon.astro";
+import { href } from "../../lib/docs";
+
+interface Props {
+ feature?: string;
+ inline?: boolean;
+}
+
+const { feature, inline = false } = Astro.props;
+const hasBody = Astro.slots.has("default");
+---
+
+{
+ inline ? (
+ <span class="inline-flex translate-y-[-1px] items-center gap-1 border border-primary px-1.5 align-middle text-[11px] font-medium uppercase leading-[18px] tracking-[0.08em] text-link">
+ <Icon name="hourglass-medium" weight="bold" size={11} /> Coming soon
+ </span>
+ ) : (
+ <aside class="soon not-prose border border-border" aria-label={feature ? `${feature}: coming soon` : "Coming soon"}>
+ <div class="hatch h-2.5 border-b border-border" aria-hidden="true" />
+ <div class="flex flex-col gap-3 px-4 py-4 sm:flex-row sm:items-start sm:gap-4 sm:px-5">
+ <span class="inline-flex size-9 shrink-0 items-center justify-center bg-primary text-white">
+ <Icon name="rocket-launch" weight="duotone" size={19} />
+ </span>
+ <div class="min-w-0 flex-1 text-[15px] leading-7">
+ <p class="font-semibold">{feature ? `${feature} is coming soon` : "This part is coming soon"}</p>
+ <div class="soon-body text-muted">
+ {hasBody ? (
+ <slot />
+ ) : (
+ <p>It's planned, not built yet. Nothing on this page pretends otherwise.</p>
+ )}
+ </div>
+ <p class="mt-2 text-sm">
+ <a href={href("docs/project/roadmap/")} class="text-link underline underline-offset-4">
+ See the roadmap
+ </a>
+ <span class="text-muted"> · </span>
+ <a href="https://github.com/ppmpreetham/BUI/issues" class="text-link underline underline-offset-4">
+ Ask for it on GitHub
+ </a>
+ </p>
+ </div>
+ </div>
+ </aside>
+ )
+}
+
+<style>
+ .soon-body :global(> * + *) {
+ margin-top: 0.5rem;
+ }
+ .soon-body :global(code) {
+ font-family: var(--font-mono);
+ font-size: 0.85em;
+ }
+</style>
diff --git a/website/src/components/docs/Compare.astro b/website/src/components/docs/Compare.astro
new file mode 100644
index 0000000..61ccbd5
--- /dev/null
+++ b/website/src/components/docs/Compare.astro
@@ -0,0 +1,55 @@
+---
+/**
+ * Two columns side by side (stacked on phones): before/after, or option A/option B.
+ *
+ * <Compare left="Standard tkinter" right="On BUI">
+ * <div slot="left">
+ *
+ * Markdown, code or a <Figure /> …
+ *
+ * </div>
+ * <div slot="right">
+ *
+ * …
+ *
+ * </div>
+ * </Compare>
+ *
+ * Keep the blank lines inside the slot divs so Markdown is parsed.
+ */
+interface Props {
+ left: string;
+ right: string;
+ /** Emphasize the right column (the "after"). Default true. */
+ highlightRight?: boolean;
+}
+const { left, right, highlightRight = true } = Astro.props;
+---
+
+<div class="compare grid border border-border md:grid-cols-2">
+ <section class="min-w-0 border-b border-border md:border-r md:border-b-0" aria-label={left}>
+ <p class="kicker border-b border-border bg-surface px-4 py-2 text-muted">{left}</p>
+ <div class="compare-body p-4"><slot name="left" /></div>
+ </section>
+ <section class="min-w-0" aria-label={right}>
+ <p class:list={["kicker border-b border-border px-4 py-2", highlightRight ? "bg-primary text-white" : "bg-surface text-muted"]}>
+ {right}
+ </p>
+ <div class="compare-body p-4"><slot name="right" /></div>
+ </section>
+</div>
+
+<style>
+ .compare-body :global(> * + *),
+ .compare-body :global(> div > * + *) {
+ margin-top: 0.75rem;
+ }
+ .compare-body {
+ font-size: 0.9375rem;
+ line-height: 1.7;
+ }
+ .compare-body :global(code:not(pre code)) {
+ font-family: var(--font-mono);
+ font-size: 0.85em;
+ }
+</style>
diff --git a/website/src/components/docs/Figure.astro b/website/src/components/docs/Figure.astro
new file mode 100644
index 0000000..7dd4a85
--- /dev/null
+++ b/website/src/components/docs/Figure.astro
@@ -0,0 +1,64 @@
+---
+/**
+ * <Figure src="images/components.png" alt="…" caption="…" width={520} />
+ *
+ * Light and dark screenshots: pass both, and the reader sees the one matching the site's theme.
+ * <Figure light="images/shots/components-light.png" dark="images/shots/components-dark.png" alt="…" />
+ * <Figure shot="components" src="images/components.png" alt="…" /> (pair from images/shots/, `src` until it exists)
+ *
+ * Paths are relative to website/public (no leading slash needed). Screenshots of BUI are
+ * shown at their natural size (up to the column width) on a hatched stage, so small
+ * windows don't get blown up and blurry. `alt` describes the picture; `caption` explains it.
+ * Width and height are read from the file when you leave them out.
+ */
+import ThemedImage from "./ThemedImage.astro";
+
+interface Props {
+ src?: string;
+ light?: string;
+ dark?: string;
+ shot?: string;
+ alt: string;
+ caption?: string;
+ /** Natural width in CSS pixels (usually the PNG's width). */
+ width?: number;
+ height?: number;
+ /** "stage" (default) puts the image on a hatched backdrop; "bleed" fills the column. */
+ variant?: "stage" | "bleed";
+ /**
+ * "eager" (default) or "lazy". Lazy images below the fold stay blank in full-page
+ * screenshots, print and some readers; docs pages have few images, so load them eagerly
+ * unless a page has many.
+ */
+ loading?: "eager" | "lazy";
+}
+
+const { src, light, dark, shot, alt, caption, width, height, variant = "stage", loading = "eager" } = Astro.props;
+if (!src && !light && !dark && !shot) throw new Error(`<Figure alt="${alt}">: give src, light/dark or shot.`);
+---
+
+<figure class="figure not-prose border border-border" data-reveal>
+ <div class:list={[variant === "stage" ? "figure-stage hatch flex justify-center px-4 py-6 sm:px-8 sm:py-9" : ""]}>
+ <ThemedImage
+ alt={alt}
+ light={light ?? src}
+ dark={dark ?? src}
+ shot={shot}
+ fallback={src}
+ width={width}
+ height={height}
+ loading={loading}
+ class:list={["img-outline h-auto max-w-full", variant === "stage" && "figure-img", variant === "bleed" && "w-full"]}
+ />
+ </div>
+ {caption && <figcaption class="border-t border-border bg-surface px-4 py-2.5 text-[13px] leading-5 text-muted [&_code]:font-mono [&_code]:text-[0.9em]" set:html={caption} />}
+</figure>
+
+<style>
+ .figure-stage {
+ background-color: var(--stage);
+ }
+ .figure-img {
+ box-shadow: var(--shadow);
+ }
+</style>
diff --git a/website/src/components/docs/Hatch.astro b/website/src/components/docs/Hatch.astro
new file mode 100644
index 0000000..a9997dd
--- /dev/null
+++ b/website/src/components/docs/Hatch.astro
@@ -0,0 +1,14 @@
+---
+/**
+ * The diagonal hatch divider. <Hatch /> or <Hatch size="lg" />.
+ * Use it to separate big movements of a page, not every section.
+ */
+interface Props {
+ size?: "sm" | "md" | "lg";
+ class?: string;
+}
+const { size = "md", class: className } = Astro.props;
+const h = { sm: "h-4", md: "h-8", lg: "h-14" }[size];
+---
+
+<div aria-hidden="true" class:list={["hatch not-prose border-y border-border", h, className]}></div>
diff --git a/website/src/components/docs/Kbd.astro b/website/src/components/docs/Kbd.astro
new file mode 100644
index 0000000..74f4307
--- /dev/null
+++ b/website/src/components/docs/Kbd.astro
@@ -0,0 +1,52 @@
+---
+/**
+ * Keyboard keys. <Kbd>Ctrl</Kbd>+<Kbd>Z</Kbd>, or the shorthand <Kbd keys="Ctrl+Shift+Z" />.
+ */
+interface Props {
+ keys?: string;
+}
+const { keys } = Astro.props;
+const parts = keys ? keys.split("+") : null;
+---
+
+{
+ parts ? (
+ <span class="kbd-combo">
+ {parts.map((k, i) => (
+ <>
+ {i > 0 && <span class="text-muted">+</span>}
+ <kbd class="kbd">{k}</kbd>
+ </>
+ ))}
+ </span>
+ ) : (
+ <kbd class="kbd">
+ <slot />
+ </kbd>
+ )
+}
+
+<style>
+ .kbd {
+ display: inline-block;
+ min-width: 1.5em;
+ padding: 0 0.4em;
+ font-family: var(--font-sans);
+ font-size: 0.78em;
+ font-weight: 500;
+ line-height: 1.6;
+ text-align: center;
+ color: var(--foreground);
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-bottom-width: 2px;
+ vertical-align: 0.08em;
+ white-space: nowrap;
+ }
+ .kbd-combo {
+ display: inline-flex;
+ align-items: baseline;
+ gap: 0.2em;
+ white-space: nowrap;
+ }
+</style>
diff --git a/website/src/components/docs/LangTabs.astro b/website/src/components/docs/LangTabs.astro
new file mode 100644
index 0000000..da21999
--- /dev/null
+++ b/website/src/components/docs/LangTabs.astro
@@ -0,0 +1,20 @@
+---
+/**
+ * Language tabs that remember the reader's choice across pages.
+ *
+ * <LangTabs>
+ * <Tab label="Python">…</Tab>
+ * <Tab label="Rust">…</Tab>
+ * <Tab label="JavaScript">…</Tab>
+ * </LangTabs>
+ *
+ * Use the labels from src/config/nav.ts (`languages`) so the choice carries over:
+ * Python, Rust, JavaScript, C, C++, Dear ImGui. Pages may also use other labels
+ * (e.g. "tkinter", "Components"); they sync with any other LangTabs that has them.
+ */
+import Tabs from "./Tabs.astro";
+---
+
+<Tabs sync="lang" label="Language">
+ <slot />
+</Tabs>
diff --git a/website/src/components/docs/PageStatusList.astro b/website/src/components/docs/PageStatusList.astro
new file mode 100644
index 0000000..ad558a0
--- /dev/null
+++ b/website/src/components/docs/PageStatusList.astro
@@ -0,0 +1,39 @@
+---
+/**
+ * Lists docs pages by status, straight from the content collection.
+ * <PageStatusList status="coming-soon" /> or status="preview"
+ * Used on the roadmap so it never drifts from the pages themselves.
+ */
+import { docHref, getDocs } from "../../lib/docs";
+import Icon from "../site/Icon.astro";
+
+interface Props {
+ status: "preview" | "coming-soon";
+ empty?: string;
+}
+const { status, empty = "Nothing here right now." } = Astro.props;
+const docs = (await getDocs()).filter((d) => d.data.status === status);
+---
+
+{
+ docs.length === 0 ? (
+ <p class="text-muted">{empty}</p>
+ ) : (
+ <ul class="not-prose grid gap-px border border-border bg-border sm:grid-cols-2">
+ {docs.map((d) => (
+ <li class="bg-background">
+ <a href={docHref(d)} class="group flex h-full items-start gap-3 p-4 hover:bg-surface">
+ <span class="mt-0.5 text-link">
+ <Icon name={status === "coming-soon" ? "hourglass-medium" : "circle-half"} weight="duotone" size={17} />
+ </span>
+ <span class="flex min-w-0 flex-col gap-0.5">
+ <span class="font-medium leading-6 group-hover:text-link">{d.data.title}</span>
+ <span class="text-[13.5px] leading-5 text-muted">{d.data.description}</span>
+ <span class="kicker mt-1 text-muted">{d.data.section}</span>
+ </span>
+ </a>
+ </li>
+ ))}
+ </ul>
+ )
+}
diff --git a/website/src/components/docs/Recap.astro b/website/src/components/docs/Recap.astro
new file mode 100644
index 0000000..6cbd0f3
--- /dev/null
+++ b/website/src/components/docs/Recap.astro
@@ -0,0 +1,60 @@
+---
+/**
+ * The end-of-page summary. Wrap a short Markdown list (3–5 points):
+ *
+ * <Recap>
+ * - BUI draws Blender's widgets in your app.
+ * - You pick the syntax: tkinter, Qt, components, Rust, React, ImGui or C.
+ * </Recap>
+ */
+import Icon from "../site/Icon.astro";
+
+interface Props {
+ title?: string;
+}
+const { title = "Recap" } = Astro.props;
+---
+
+<aside class="recap not-prose border border-border" aria-label={title}>
+ <div class="flex items-center gap-2 border-b border-border bg-surface px-4 py-2">
+ <Icon name="check-circle" weight="duotone" size={15} class="text-link" />
+ <p class="kicker text-muted">{title}</p>
+ </div>
+ <div class="recap-body px-4 py-3.5 text-[15px] leading-7 sm:px-5">
+ <slot />
+ </div>
+</aside>
+
+<style>
+ .recap-body :global(ul) {
+ list-style: none;
+ padding: 0;
+ }
+ .recap-body :global(li) {
+ position: relative;
+ padding-left: 1.5rem;
+ }
+ .recap-body :global(li + li) {
+ margin-top: 0.35rem;
+ }
+ .recap-body :global(li::before) {
+ content: "";
+ position: absolute;
+ left: 0.15rem;
+ top: 0.68em;
+ width: 0.55rem;
+ height: 0.55rem;
+ background: var(--primary);
+ }
+ .recap-body :global(code) {
+ font-family: var(--font-mono);
+ font-size: 0.85em;
+ padding: 0.1em 0.3em;
+ background: var(--surface-2);
+ }
+ .recap-body :global(a) {
+ color: var(--link);
+ text-decoration: underline;
+ text-underline-offset: 3px;
+ }
+</style>
diff --git a/website/src/components/docs/StatusMark.astro b/website/src/components/docs/StatusMark.astro
new file mode 100644
index 0000000..c1ae12b
--- /dev/null
+++ b/website/src/components/docs/StatusMark.astro
@@ -0,0 +1,42 @@
+---
+/**
+ * One status, as an icon and a word. Used by <StatusTable>; usable inline too:
+ * <StatusMark status="experimental" />
+ * status: done | partial | experimental | planned (also: stable, preview, coming-soon)
+ */
+import Icon from "../site/Icon.astro";
+
+export type Status = "done" | "partial" | "experimental" | "planned";
+type Alias = Status | "stable" | "preview" | "coming-soon";
+
+export const statusMeta: Record<Status, { icon: string; label: string; hint: string; color: string }> = {
+ done: { icon: "check-circle", label: "Works", hint: "Works today", color: "var(--status-stable)" },
+ partial: { icon: "circle-half", label: "Partial", hint: "Partly there", color: "var(--status-preview)" },
+ experimental: { icon: "flask", label: "Experimental", hint: "Written, not yet proven", color: "var(--status-experimental)" },
+ planned: { icon: "hourglass-medium", label: "Planned", hint: "Not built yet", color: "var(--status-soon)" },
+};
+
+const aliases: Record<Alias, Status> = {
+ done: "done",
+ partial: "partial",
+ experimental: "experimental",
+ planned: "planned",
+ stable: "done",
+ preview: "partial",
+ "coming-soon": "planned",
+};
+
+interface Props {
+ status: Alias;
+ /** Icon only (the label stays for screen readers). */
+ compact?: boolean;
+}
+
+const { status, compact = false } = Astro.props;
+const m = statusMeta[aliases[status] ?? "planned"];
+---
+
+<span class="inline-flex items-center gap-1.5 align-middle" style={`color:${m.color}`}>
+ <Icon name={m.icon} weight="duotone" size={compact ? 14 : 16} />
+ <span class:list={[compact ? "sr-only" : "text-[13px] font-medium"]}>{m.label}</span>
+</span>
diff --git a/website/src/components/docs/StatusTable.astro b/website/src/components/docs/StatusTable.astro
new file mode 100644
index 0000000..33b34b9
--- /dev/null
+++ b/website/src/components/docs/StatusTable.astro
@@ -0,0 +1,67 @@
+---
+/**
+ * A status table with a legend.
+ *
+ * <StatusTable
+ * columns={["Area", "Status", "Notes"]} // optional; these are the defaults
+ * rows={[
+ * ["tkinter syntax", "done", "Every public tkinter and ttk name"],
+ * ["Qt syntax", "partial", "About 25% of the common classes"],
+ * ["macOS window host", "experimental", "Written, not yet run on a Mac"],
+ * ["WebAssembly", "planned", "The kit in the browser"],
+ * ]}
+ * />
+ *
+ * Status values (Phosphor icons): done (check-circle) · partial (circle-half) ·
+ * experimental (flask) · planned (hourglass). Notes may contain inline HTML (e.g. <code>).
+ */
+import StatusMark, { statusMeta, type Status } from "./StatusMark.astro";
+
+interface Props {
+ rows: [string, Status, string?][];
+ columns?: [string, string, string?];
+ legend?: boolean;
+}
+
+const { rows, columns = ["Area", "Status", "Notes"], legend = true } = Astro.props;
+const hasNotes = rows.some((r) => r[2]);
+const used = (Object.keys(statusMeta) as Status[]).filter((s) => rows.some((r) => r[1] === s));
+---
+
+<div class="not-prose">
+ <div class="relative overflow-x-auto border border-border">
+ <table class="w-full border-collapse text-sm leading-6">
+ <thead>
+ <tr class="bg-surface text-left">
+ <th scope="col" class="border-b border-border px-3.5 py-2.5 font-semibold">{columns[0]}</th>
+ <th scope="col" class="border-b border-border px-3.5 py-2.5 font-semibold whitespace-nowrap">{columns[1]}</th>
+ {hasNotes && <th scope="col" class="border-b border-border px-3.5 py-2.5 font-semibold">{columns[2]}</th>}
+ </tr>
+ </thead>
+ <tbody>
+ {
+ rows.map(([area, status, note]) => (
+ <tr class="border-b border-border-soft transition-colors duration-150 last:border-b-0 hover:bg-surface/60">
+ <th scope="row" class="px-3.5 py-2.5 text-left align-top font-medium [&_code]:font-mono [&_code]:text-[0.85em]" set:html={area} />
+ <td class="px-3.5 py-2.5 align-top whitespace-nowrap">
+ <StatusMark status={status} />
+ </td>
+ {hasNotes && <td class="px-3.5 py-2.5 align-top text-muted [&_code]:font-mono [&_code]:text-[0.85em]" set:html={note ?? ""} />}
+ </tr>
+ ))
+ }
+ </tbody>
+ </table>
+ </div>
+ {
+ legend && used.length > 1 && (
+ <p class="mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted" aria-label="Legend">
+ {used.map((s) => (
+ <span class="inline-flex items-center gap-1">
+ <StatusMark status={s} compact /> {statusMeta[s].hint}
+ </span>
+ ))}
+ </p>
+ )
+ }
+</div>
diff --git a/website/src/components/docs/Steps.astro b/website/src/components/docs/Steps.astro
new file mode 100644
index 0000000..067e91e
--- /dev/null
+++ b/website/src/components/docs/Steps.astro
@@ -0,0 +1,190 @@
+---
+/**
+ * Numbered steps. Wrap a normal Markdown ordered list:
+ *
+ * <Steps>
+ *
+ * 1. **Install the package.**
+ *
+ * ```sh
+ * pip install blenderui
+ * ```
+ *
+ * 2. **Run the example.**
+ *
+ * </Steps>
+ *
+ * Leave a blank line after <Steps> and before </Steps>. Start each step with a bold
+ * sentence: it becomes the step's title, which stays pinned under the header while you
+ * read that step. A rail on the left fills as you go, and the step you're on is lit.
+ */
+---
+
+<div class="steps" data-steps>
+ <slot />
+</div>
+
+<style>
+ .steps :global(> ol) {
+ position: relative;
+ list-style: none;
+ padding-left: 0;
+ counter-reset: step;
+ --rail-x: 0.9rem;
+ }
+ /* the rail, and its progress fill */
+ .steps :global(> ol::before),
+ .steps :global(> ol::after) {
+ content: "";
+ position: absolute;
+ left: calc(var(--rail-x) - 0.5px);
+ top: 1rem;
+ width: 1px;
+ }
+ .steps :global(> ol::before) {
+ bottom: 1.5rem;
+ background: var(--border);
+ }
+ .steps :global(> ol::after) {
+ width: 2px;
+ left: calc(var(--rail-x) - 1px);
+ height: var(--progress, 0px);
+ max-height: calc(100% - 2.5rem);
+ background: var(--primary);
+ transition: height 160ms linear;
+ }
+
+ .steps :global(> ol > li) {
+ position: relative;
+ counter-increment: step;
+ padding-left: 2.85rem;
+ padding-bottom: 2rem;
+ }
+ .steps :global(> ol > li + li) {
+ margin-top: 0;
+ }
+ .steps :global(> ol > li > * + *) {
+ margin-top: 0.75rem;
+ }
+
+ /* The step's title: pinned under the site header while its step is on screen. */
+ .steps :global(> ol > li > :first-child) {
+ position: sticky;
+ top: var(--header-h);
+ z-index: 3;
+ margin-left: -2.85rem;
+ padding: 0.55rem 0.5rem 0.55rem 2.85rem;
+ font-weight: 500;
+ line-height: 1.5;
+ background: color-mix(in oklab, var(--background) 92%, transparent);
+ backdrop-filter: blur(8px);
+ -webkit-backdrop-filter: blur(8px);
+ }
+ .steps :global(> ol > li > :first-child strong) {
+ font-weight: 600;
+ }
+ .steps :global(> ol > li > :first-child::before) {
+ content: counter(step);
+ position: absolute;
+ left: calc(var(--rail-x) - 0.95rem);
+ top: 0.5rem;
+ display: grid;
+ place-items: center;
+ width: 1.9rem;
+ height: 1.9rem;
+ font-size: 0.8125rem;
+ font-weight: 600;
+ font-variant-numeric: tabular-nums;
+ color: var(--muted);
+ background: var(--background);
+ border: 1px solid var(--border-strong);
+ transition:
+ background-color 200ms ease-out,
+ color 200ms ease-out,
+ border-color 200ms ease-out,
+ box-shadow 200ms ease-out;
+ }
+ /* no JS, or steps already read: filled */
+ :global(html:not(.js)) .steps :global(> ol > li > :first-child::before),
+ .steps :global(> ol > li.is-done > :first-child::before),
+ .steps :global(> ol > li.is-current > :first-child::before) {
+ color: var(--primary-ink);
+ background: var(--primary);
+ border-color: var(--primary);
+ }
+ .steps :global(> ol > li.is-current > :first-child::before) {
+ box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 22%, transparent);
+ }
+ .steps :global(> ol > li.is-current > :first-child) {
+ box-shadow: 0 1px 0 var(--border-soft);
+ }
+ .steps :global(.steps-count) {
+ float: right;
+ margin-left: 0.75rem;
+ padding-top: 0.15rem;
+ font-size: 11px;
+ font-weight: 500;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--muted);
+ font-variant-numeric: tabular-nums;
+ }
+ .steps :global(> ol > li:not(.is-current) .steps-count) {
+ visibility: hidden;
+ }
+</style>
+
+<script>
+ // Lights the step you're reading and fills the rail up to it.
+ const roots = [...document.querySelectorAll<HTMLElement>("[data-steps]")];
+ const all = roots.map((root) => {
+ const ol = root.querySelector<HTMLOListElement>(":scope > ol");
+ const items = ol ? [...ol.querySelectorAll<HTMLLIElement>(":scope > li")] : [];
+ items.forEach((li, i) => {
+ const head = li.firstElementChild;
+ if (!head) return;
+ const count = document.createElement("span");
+ count.className = "steps-count";
+ count.setAttribute("aria-hidden", "true");
+ count.textContent = `${i + 1} / ${items.length}`;
+ head.prepend(count);
+ });
+ return { ol, items };
+ });
+
+ let queued = false;
+ const update = () => {
+ queued = false;
+ const headerH = parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--header-h")) * 16 || 56;
+ const line = headerH + window.innerHeight * 0.25;
+ for (const { ol, items } of all) {
+ if (!ol || !items.length) continue;
+ const olTop = ol.getBoundingClientRect().top;
+ let current = -1;
+ items.forEach((li, i) => {
+ if (li.getBoundingClientRect().top <= line) current = i;
+ });
+ // At the very bottom of the page, the last step is the one you're on.
+ if (window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 4 && items[items.length - 1].getBoundingClientRect().top < window.innerHeight) {
+ current = items.length - 1;
+ }
+ items.forEach((li, i) => {
+ li.classList.toggle("is-current", i === current);
+ li.classList.toggle("is-done", i < current);
+ });
+ const progress = Math.max(0, Math.min(line - olTop, ol.offsetHeight));
+ ol.style.setProperty("--progress", `${current < 0 ? 0 : progress}px`);
+ }
+ };
+ if (all.length) {
+ const queue = () => {
+ if (!queued) {
+ queued = true;
+ requestAnimationFrame(update);
+ }
+ };
+ addEventListener("scroll", queue, { passive: true });
+ addEventListener("resize", queue);
+ update();
+ }
+</script>
diff --git a/website/src/components/docs/Tab.astro b/website/src/components/docs/Tab.astro
new file mode 100644
index 0000000..41aa623
--- /dev/null
+++ b/website/src/components/docs/Tab.astro
@@ -0,0 +1,11 @@
+---
+/** One panel inside <Tabs> or <LangTabs>. `label` is the tab's text. */
+interface Props {
+ label: string;
+}
+const { label } = Astro.props;
+---
+
+<div data-tab-panel data-tab-label={label} role="tabpanel" class="tab-panel">
+ <slot />
+</div>
diff --git a/website/src/components/docs/Tabs.astro b/website/src/components/docs/Tabs.astro
new file mode 100644
index 0000000..fb5d430
--- /dev/null
+++ b/website/src/components/docs/Tabs.astro
@@ -0,0 +1,137 @@
+---
+/**
+ * <Tabs>
+ * <Tab label="pip">…</Tab>
+ * <Tab label="uv">…</Tab>
+ * </Tabs>
+ *
+ * `sync="key"` keeps every Tabs with the same key on the page (and on later pages) on the
+ * same label, remembered in localStorage. <LangTabs> is <Tabs sync="lang">.
+ * Don't nest Tabs inside Tabs.
+ */
+interface Props {
+ sync?: string;
+ /** Accessible name for the tab list, e.g. "Language". */
+ label?: string;
+}
+
+const { sync, label = "Choose one" } = Astro.props;
+
+const html = await Astro.slots.render("default");
+const labels = [...html.matchAll(/data-tab-label="([^"]*)"/g)].map((m) => m[1]);
+const uid = `t${Math.random().toString(36).slice(2, 8)}`;
+
+let i = 0;
+const panels = html.replace(/<div data-tab-panel/g, () => {
+ const n = i++;
+ return `<div id="${uid}-p${n}" aria-labelledby="${uid}-t${n}" tabindex="0"${n === 0 ? "" : " hidden"} data-tab-panel`;
+});
+
+const decode = (s: string) =>
+ s.replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">");
+---
+
+<div class="tabs border border-border" data-tabs data-sync={sync}>
+ <div role="tablist" aria-label={label} class="flex overflow-x-auto border-b border-border bg-surface [scrollbar-width:none]">
+ {
+ labels.map((l, n) => (
+ <button
+ type="button"
+ role="tab"
+ id={`${uid}-t${n}`}
+ aria-controls={`${uid}-p${n}`}
+ aria-selected={n === 0 ? "true" : "false"}
+ tabindex={n === 0 ? 0 : -1}
+ data-tab={decode(l)}
+ class="relative h-10 shrink-0 whitespace-nowrap px-4 text-sm text-muted transition-colors duration-150 ease-out hover:text-foreground aria-selected:bg-background aria-selected:font-medium aria-selected:text-foreground aria-selected:after:absolute aria-selected:after:inset-x-0 aria-selected:after:top-0 aria-selected:after:h-0.5 aria-selected:after:bg-primary"
+ >
+ {decode(l)}
+ </button>
+ ))
+ }
+ </div>
+ <div class="tab-panels" set:html={panels} />
+</div>
+
+<style>
+ .tab-panels :global([data-tab-panel]) {
+ padding: 1rem;
+ font-size: 0.9375rem;
+ line-height: 1.7;
+ }
+ .tab-panels :global([data-tab-panel] > * + *) {
+ margin-top: 0.9rem;
+ }
+ .tab-panels :global([data-tab-panel]:focus-visible) {
+ outline-offset: -2px;
+ }
+ .tab-panels :global(.expressive-code) {
+ margin-top: 0.9rem;
+ }
+ .tab-panels :global([data-tab-panel] > .expressive-code:first-child) {
+ margin-top: 0;
+ }
+</style>
+
+<script>
+ const KEY = (k: string) => `bui:tabs:${k}`;
+
+ function select(root: HTMLElement, label: string, focus = false) {
+ const tabs = [...root.querySelectorAll<HTMLButtonElement>(":scope > [role=tablist] > [role=tab]")];
+ const tab = tabs.find((t) => t.dataset.tab === label);
+ if (!tab) return false;
+ for (const t of tabs) {
+ const on = t === tab;
+ t.setAttribute("aria-selected", String(on));
+ t.tabIndex = on ? 0 : -1;
+ const panel = document.getElementById(t.getAttribute("aria-controls")!);
+ if (panel) panel.hidden = !on;
+ }
+ if (focus) tab.focus();
+ return true;
+ }
+
+ function choose(root: HTMLElement, label: string, focus = false) {
+ const sync = root.dataset.sync;
+ if (!sync) return void select(root, label, focus);
+ // Keep the clicked tab list where it is while panels above change height.
+ const before = root.getBoundingClientRect().top;
+ document.querySelectorAll<HTMLElement>(`[data-tabs][data-sync="${sync}"]`).forEach((r) => select(r, label, focus && r === root));
+ const after = root.getBoundingClientRect().top;
+ if (after !== before) window.scrollBy({ top: after - before, behavior: "instant" as ScrollBehavior });
+ try {
+ localStorage.setItem(KEY(sync), label);
+ } catch {}
+ document.dispatchEvent(new CustomEvent("bui:tabs", { detail: { sync, label } }));
+ }
+
+ document.querySelectorAll<HTMLElement>("[data-tabs]").forEach((root) => {
+ const list = root.querySelector<HTMLElement>(":scope > [role=tablist]")!;
+ list.addEventListener("click", (e) => {
+ const tab = (e.target as HTMLElement).closest<HTMLButtonElement>("[role=tab]");
+ if (tab) choose(root, tab.dataset.tab!);
+ });
+ list.addEventListener("keydown", (e) => {
+ const tabs = [...list.querySelectorAll<HTMLButtonElement>("[role=tab]")];
+ const at = tabs.indexOf(document.activeElement as HTMLButtonElement);
+ if (at < 0) return;
+ let next = -1;
+ if (e.key === "ArrowRight") next = (at + 1) % tabs.length;
+ else if (e.key === "ArrowLeft") next = (at - 1 + tabs.length) % tabs.length;
+ else if (e.key === "Home") next = 0;
+ else if (e.key === "End") next = tabs.length - 1;
+ if (next >= 0) {
+ e.preventDefault();
+ choose(root, tabs[next].dataset.tab!, true);
+ }
+ });
+ const sync = root.dataset.sync;
+ if (sync) {
+ let saved: string | null = null;
+ try {
+ saved = localStorage.getItem(KEY(sync));
+ } catch {}
+ if (saved) select(root, saved);
+ }
+ });
+</script>
diff --git a/website/src/components/docs/ThemedImage.astro b/website/src/components/docs/ThemedImage.astro
new file mode 100644
index 0000000..d1ee81d
--- /dev/null
+++ b/website/src/components/docs/ThemedImage.astro
@@ -0,0 +1,56 @@
+---
+/**
+ * An image with a light and a dark version; the reader sees the one that matches the site.
+ *
+ * <ThemedImage light="images/shots/tkinter-light.png" dark="images/shots/tkinter-dark.png" alt="…" />
+ * <ThemedImage shot="tkinter" fallback="images/tkinter_items.png" alt="…" />
+ *
+ * `shot` looks for images/shots/<shot>-light.png and -dark.png (falling back to `fallback`
+ * until they exist). Width and height are read from the files when not given.
+ */
+import { href } from "../../lib/docs";
+import { displaySize, shot as findShot } from "../../lib/shots";
+
+interface Props {
+ alt: string;
+ light?: string;
+ dark?: string;
+ shot?: string;
+ fallback?: string;
+ width?: number;
+ height?: number;
+ class?: string;
+ loading?: "eager" | "lazy";
+ fetchpriority?: "high" | "low" | "auto";
+}
+
+const { alt, light, dark, shot, fallback, width, height, class: className, loading = "lazy", fetchpriority } = Astro.props;
+
+let lightSrc: string, darkSrc: string;
+if (shot) {
+ const s = findShot(shot, fallback ?? light ?? dark ?? "");
+ lightSrc = s.light.src;
+ darkSrc = s.dark.src;
+} else {
+ lightSrc = light ?? dark ?? "";
+ darkSrc = dark ?? light ?? "";
+}
+if (!lightSrc) throw new Error("<ThemedImage>: give `light`/`dark` or `shot`.");
+
+const url = (s: string) => (/^https?:/.test(s) ? s : href(s));
+const sizeOf = (s: string) => (width && height ? { width, height } : /^https?:/.test(s) ? { width, height } : (displaySize(s) ?? { width, height }));
+const same = lightSrc === darkSrc;
+const ls = sizeOf(lightSrc);
+const ds = sizeOf(darkSrc);
+---
+
+{
+ same ? (
+ <img src={url(lightSrc)} alt={alt} width={ls.width} height={ls.height} loading={loading} decoding="async" fetchpriority={fetchpriority} class={className} />
+ ) : (
+ <>
+ <img src={url(lightSrc)} alt={alt} width={ls.width} height={ls.height} loading={loading} decoding="async" fetchpriority={fetchpriority} class:list={["themed-light", className]} />
+ <img src={url(darkSrc)} alt={alt} width={ds.width} height={ds.height} loading={loading} decoding="async" fetchpriority={fetchpriority} class:list={["themed-dark", className]} />
+ </>
+ )
+}
diff --git a/website/src/components/docs/index.ts b/website/src/components/docs/index.ts
new file mode 100644
index 0000000..5ac9ea4
--- /dev/null
+++ b/website/src/components/docs/index.ts
@@ -0,0 +1,27 @@
+// Every component here is available in every .mdx page without an import
+// (src/pages/docs/[...slug].astro passes them to <Content components>).
+export { default as Badge } from "./Badge.astro";
+export { default as Callout } from "./Callout.astro";
+export { default as Card } from "./Card.astro";
+export { default as CardGrid } from "./CardGrid.astro";
+export { default as ComingSoon } from "./ComingSoon.astro";
+export { default as Compare } from "./Compare.astro";
+export { default as Figure } from "./Figure.astro";
+export { default as Hatch } from "./Hatch.astro";
+export { default as Kbd } from "./Kbd.astro";
+export { default as LangTabs } from "./LangTabs.astro";
+export { default as Recap } from "./Recap.astro";
+export { default as StatusMark } from "./StatusMark.astro";
+export { default as StatusTable } from "./StatusTable.astro";
+export { default as Steps } from "./Steps.astro";
+export { default as Tab } from "./Tab.astro";
+export { default as Tabs } from "./Tabs.astro";
+export { default as ThemedImage } from "./ThemedImage.astro";
+export { default as PageStatusList } from "./PageStatusList.astro";
+export { default as Icon } from "../site/Icon.astro";
+// Charts: numbers from src/data/bench.ts, or your own.
+export { default as BenchChart } from "../charts/BenchChart.astro";
+export { default as BenchTable } from "../charts/BenchTable.astro";
+export { default as BarChart } from "../charts/BarChart.astro";
+export { default as GroupedBarChart } from "../charts/GroupedBarChart.astro";
+export { default as LineChart } from "../charts/LineChart.astro";
diff --git a/website/src/components/landing/Coming.astro b/website/src/components/landing/Coming.astro
new file mode 100644
index 0000000..8a9309b
--- /dev/null
+++ b/website/src/components/landing/Coming.astro
@@ -0,0 +1,30 @@
+---
+// From README.md "Partial or in progress" and "Planned". Nothing here works yet unless it says so.
+import Icon from "../site/Icon.astro";
+
+const items = [
+ { title: "macOS, tested", body: "The Cocoa host is written but untested. Next: running it on a real Mac (testers welcome), then the GPU renderer and JavaScript windows there.", tag: "In progress" },
+ { title: "WebAssembly", body: "The kit in the browser: the raster blits to a <canvas>, and React and the DOM-like API run on top, unchanged.", tag: "Planned" },
+ { title: "egui", body: "BUI panels inside egui apps, plus a Blender-styled egui theme.", tag: "Planned" },
+ { title: "More languages", body: "MyGo, C#, Go, Zig, Swift, Kotlin and Lua over the same C header; Godot, Unity, Bevy and Flutter.", tag: "Planned" },
+ { title: "Font fallback and IME", body: "Per-glyph fallback (Blender's BLF), input methods, units in number fields and widget drag and drop.", tag: "Planned" },
+ { title: "Vulkan and WebGPU", body: "More GPU backends drawing the same instance stream as Direct3D 11 and OpenGL.", tag: "Planned" },
+ { title: "blenderui-imgui on crates.io", body: "blenderui is on crates.io already. The Dear ImGui crate is next; until then it's a git dependency.", tag: "Soon" },
+ { title: "More Qt", body: "Model/view classes, docks, toolbars, splitters and Qt stylesheets, on top of today's everyday subset.", tag: "In progress" },
+];
+---
+
+<ul class="grid gap-px bg-border sm:grid-cols-2 lg:grid-cols-4">
+ {
+ items.map((it) => (
+ <li class="flex flex-col gap-2 bg-background p-5 sm:p-7">
+ <span class="kicker inline-flex items-center gap-1.5 text-link">
+ <Icon name={it.tag === "In progress" ? "circle-half" : "hourglass-medium"} weight="duotone" size={13} />
+ {it.tag}
+ </span>
+ <h3 class="text-[17px] font-semibold leading-6">{it.title}</h3>
+ <p class="text-[14.5px] leading-6 text-muted">{it.body}</p>
+ </li>
+ ))
+ }
+</ul>
diff --git a/website/src/components/landing/Components.astro b/website/src/components/landing/Components.astro
new file mode 100644
index 0000000..45b86a5
--- /dev/null
+++ b/website/src/components/landing/Components.astro
@@ -0,0 +1,141 @@
+---
+// Blender's own components, from Python: a try-it panel (the one place the landing page
+// demonstrates scrubbing, typing math like 2*pi, and Ctrl+Z), the code, and a gallery.
+import { Code } from "astro-expressive-code/components";
+import FeelPanel from "./FeelPanel.astro";
+import Icon from "../site/Icon.astro";
+import ThemedImage from "../docs/ThemedImage.astro";
+import { href } from "../../lib/docs";
+
+const code = `from blenderui.components import App, Panel, NumberSlider, VectorField, Checkbox, ColorSwatch, Button
+
+App("Object", (420, 520),
+ Panel("Transform",
+ VectorField("Location", (0.0, 1.25, 0.0)),
+ NumberSlider("Scale", 1.0, min=0, max=10, on_change=print)),
+ Panel("Shading",
+ Checkbox("Shadows", True),
+ ColorSwatch("Color", (0.8, 0.3, 0.1, 1.0))),
+ Button("Apply", on_click=lambda: print("apply")),
+).run()`;
+
+const steps = [
+ { keys: ["Drag"], text: "a number sideways to scrub it. Shift is finer, Ctrl snaps." },
+ { keys: ["Click"], text: "a field and type 2*pi or 90/4: Blender's expression evaluator." },
+ { keys: ["Ctrl", "Z"], text: "undoes it. A whole drag is one step." },
+];
+
+// Screenshot pairs in public/images/shots/ (see INDEX.md there).
+const gallery = [
+ { shot: "feature-color-picker", title: "Color picker", body: "HSV wheel, value strip, hex field and eyedropper" },
+ { shot: "feature-menu-search", title: "Menu search", body: "Type in any menu: Blender's fuzzy search" },
+ { shot: "feature-pie-menu", title: "Pie menus", body: "Choices in a ring around the pointer" },
+ { shot: "feature-node-editor", title: "Node editor", body: "Typed sockets, links and header menus" },
+];
+---
+
+<div class="grid lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
+ <div class="flex min-w-0 flex-col border-b border-border lg:border-r">
+ <div class="flex flex-col gap-4 border-b border-border px-5 py-6 sm:px-8">
+ <h3 class="text-xl font-semibold tracking-[-0.01em]">Try a Blender number field</h3>
+ <ol class="flex flex-col gap-2.5 text-[14.5px] leading-6 text-muted">
+ {
+ steps.map((s, i) => (
+ <li class="flex items-baseline gap-3">
+ <span class="tabular w-4 shrink-0 text-[12px] font-semibold text-link">{i + 1}</span>
+ <span>
+ {s.keys.map((k, j) => (
+ <>
+ {j > 0 && <span class="text-muted">+</span>}
+ <kbd class="kbd-key">{k}</kbd>
+ </>
+ ))}{" "}
+ {s.text}
+ </span>
+ </li>
+ ))
+ }
+ </ol>
+ </div>
+ <div class="components-stage flex flex-1 items-center justify-center px-4 py-10 sm:px-10 sm:py-14">
+ <FeelPanel />
+ </div>
+ <p class="flex items-center gap-2 border-t border-border px-5 py-2.5 text-xs leading-5 text-muted sm:px-8">
+ <Icon name="info" size={14} />
+ A browser sketch of the feel. In BUI these widgets are native, drawn by the C kit.
+ </p>
+ </div>
+
+ <div class="flex min-w-0 flex-col border-b border-border">
+ <div class="flex flex-col gap-2 px-5 pt-6 sm:px-8">
+ <h3 class="text-xl font-semibold tracking-[-0.01em]">45 widgets and editors, from Python</h3>
+ <p class="max-w-[60ch] text-[15px] leading-7 text-muted">
+ Panels, number sliders, the color picker, pie menus, tree views and a node editor: Blender's own, ported from{" "}
+ <code class="font-mono text-[0.88em]">interface_widgets.cc</code>.
+ </p>
+ </div>
+ <div class="px-5 pt-5 sm:px-8">
+ <Code code={code} lang="py" title="object.py" />
+ </div>
+ <div class="components-shot hatch mt-6 flex flex-1 items-center justify-center border-t border-border px-5 py-8 sm:px-8">
+ <ThemedImage
+ shot="python-components"
+ fallback="images/components.png"
+ alt="Blender components from Python: a Render Properties editor with panels, sub-panels with header checkboxes, number fields, sliders, dropdowns, a color swatch and a progress bar"
+ class="img-outline h-auto max-h-[460px] w-auto max-w-full shadow-(--shadow)"
+ />
+ </div>
+ </div>
+</div>
+
+<ul class="grid grid-cols-2 gap-px bg-border lg:grid-cols-4">
+ {
+ gallery.map((g, i) => (
+ <li class="bg-background" data-reveal style={`--reveal-i:${i}`}>
+ <a href={href("docs/python/components-reference/")} class="group flex h-full flex-col">
+ <div class="components-tile hatch flex h-56 items-center justify-center overflow-hidden border-b border-border p-4 sm:h-64">
+ <ThemedImage
+ shot={g.shot}
+ fallback={`images/shots/${g.shot}-dark.png`}
+ alt={`${g.title}: ${g.body}`}
+ class="img-outline h-auto max-h-full w-auto max-w-full object-contain shadow-(--shadow) transition-transform duration-500 ease-(--ease-out) group-hover:scale-[1.03]"
+ />
+ </div>
+ <div class="flex items-start justify-between gap-3 p-4 sm:p-5">
+ <span class="flex flex-col gap-0.5">
+ <span class="font-semibold group-hover:text-link">{g.title}</span>
+ <span class="text-[13px] leading-5 text-muted">{g.body}</span>
+ </span>
+ <Icon name="arrow-right" size={16} class="mt-1 text-muted transition-transform duration-200 group-hover:translate-x-0.5 group-hover:text-link" />
+ </div>
+ </a>
+ </li>
+ ))
+ }
+</ul>
+
+<style>
+ .components-stage {
+ background-color: var(--bl-stage);
+ background-image: repeating-linear-gradient(135deg, var(--bl-stage-hatch) 0 1px, transparent 1px 7px);
+ }
+ .components-shot,
+ .components-tile {
+ background-color: var(--stage);
+ }
+ .kbd-key {
+ display: inline-block;
+ min-width: 1.4em;
+ margin: 0 0.1em;
+ padding: 0 0.4em;
+ font-family: var(--font-sans);
+ font-size: 0.8em;
+ font-weight: 500;
+ line-height: 1.6;
+ text-align: center;
+ color: var(--foreground);
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-bottom-width: 2px;
+ }
+</style>
diff --git a/website/src/components/landing/Feel.astro b/website/src/components/landing/Feel.astro
new file mode 100644
index 0000000..7b02cf5
--- /dev/null
+++ b/website/src/components/landing/Feel.astro
@@ -0,0 +1,121 @@
+---
+// Blender's interaction habits beyond the number field (which the components section
+// demonstrates): pie menus, menu search, and the small keyboard habits.
+import PieTile from "./PieTile.astro";
+import SearchTile from "./SearchTile.astro";
+import Icon from "../site/Icon.astro";
+
+const habits = [
+ { keys: "Ctrl+Wheel", text: "steps a value" },
+ { keys: "Ctrl+C / Ctrl+V", text: "copy and paste values" },
+ { keys: "Backspace", text: "resets to the default" },
+ { keys: "Tab", text: "moves between fields" },
+];
+
+const cards = [
+ {
+ icon: "cursor-click",
+ title: "Press, drag, release",
+ body: "Menus open on press and pick on release, so a whole choice is one gesture. Drag across checkboxes to set them all.",
+ },
+ {
+ icon: "arrows-vertical",
+ title: "Multi-field drags",
+ body: "Drag down across X, Y and Z to edit all three at once. Panels collapse with Blender's own animation.",
+ },
+ {
+ icon: "code",
+ title: "Real Blender code",
+ body: "Widget drawing is a C port of interface_widgets.cc; interaction follows interface_handlers.cc.",
+ },
+];
+---
+
+<div class="grid lg:grid-cols-3">
+ <div class="flex flex-col border-b border-border lg:border-r" data-reveal>
+ <div class="flex flex-col gap-1 px-5 pt-6 sm:px-8">
+ <h3 class="text-lg font-semibold">Pie menus</h3>
+ <p class="text-[14.5px] leading-6 text-muted">Press a key, flick toward a choice, release. Point here to aim.</p>
+ </div>
+ <div class="feel-stage mx-5 my-5 flex flex-1 items-center sm:mx-8">
+ <PieTile />
+ </div>
+ </div>
+
+ <div class="flex flex-col border-b border-border lg:border-r" data-reveal style="--reveal-i:1">
+ <div class="flex flex-col gap-1 px-5 pt-6 sm:px-8">
+ <h3 class="text-lg font-semibold">Menu search that gets you</h3>
+ <p class="text-[14.5px] leading-6 text-muted">
+ “ad cu” finds Add Cube; typos are forgiven. It's Blender's search, ported, and it also runs this site's {" "}
+ <button type="button" data-search-open class="text-link underline underline-offset-4">docs search</button>.
+ </p>
+ </div>
+ <div class="feel-stage mx-5 my-5 flex flex-1 items-start justify-center px-4 py-6 sm:mx-8">
+ <SearchTile />
+ </div>
+ </div>
+
+ <div class="flex flex-col border-b border-border" data-reveal style="--reveal-i:2">
+ <div class="flex flex-col gap-1 px-5 pt-6 sm:px-8">
+ <h3 class="text-lg font-semibold">Your fingers already know it</h3>
+ <p class="text-[14.5px] leading-6 text-muted">The keyboard habits of Blender users, in every app.</p>
+ </div>
+ <ul class="mx-5 my-5 flex flex-1 flex-col border border-border sm:mx-8">
+ {
+ habits.map((h) => (
+ <li class="flex items-center justify-between gap-3 border-b border-border-soft px-4 py-3 text-[14px] last:border-b-0">
+ <span class="text-muted">{h.text}</span>
+ <span class="flex shrink-0 items-center gap-1">
+ {h.keys.split(" / ").map((combo, i) => (
+ <>
+ {i > 0 && <span class="text-muted">/</span>}
+ {combo.split("+").map((k, j) => (
+ <>
+ {j > 0 && <span class="text-[11px] text-muted">+</span>}
+ <kbd class="kbd-key">{k}</kbd>
+ </>
+ ))}
+ </>
+ ))}
+ </span>
+ </li>
+ ))
+ }
+ </ul>
+ </div>
+</div>
+
+<div class="grid sm:grid-cols-3">
+ {
+ cards.map((s, i) => (
+ <div class:list={["group flex flex-col gap-2 border-b border-border p-5 sm:border-b-0 sm:p-8", i < 2 && "sm:border-r"]} data-reveal style={`--reveal-i:${i}`}>
+ <span class="inline-flex size-9 items-center justify-center border border-border text-link transition-colors duration-200 group-hover:border-primary group-hover:bg-primary group-hover:text-white">
+ <Icon name={s.icon} weight="duotone" size={19} />
+ </span>
+ <h3 class="mt-1 text-lg font-semibold">{s.title}</h3>
+ <p class="text-[14.5px] leading-6 text-muted">{s.body}</p>
+ </div>
+ ))
+ }
+</div>
+
+<style>
+ .feel-stage {
+ background-color: var(--bl-stage);
+ background-image: repeating-linear-gradient(135deg, var(--bl-stage-hatch) 0 1px, transparent 1px 7px);
+ }
+ .kbd-key {
+ display: inline-block;
+ min-width: 1.5em;
+ padding: 0 0.4em;
+ font-family: var(--font-sans);
+ font-size: 11.5px;
+ font-weight: 500;
+ line-height: 1.6;
+ text-align: center;
+ color: var(--foreground);
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-bottom-width: 2px;
+ }
+</style>
diff --git a/website/src/components/landing/FeelPanel.astro b/website/src/components/landing/FeelPanel.astro
new file mode 100644
index 0000000..1863154
--- /dev/null
+++ b/website/src/components/landing/FeelPanel.astro
@@ -0,0 +1,571 @@
+---
+import Icon from "../site/Icon.astro";
+// A web sketch of how BUI's Blender widgets behave: drag to scrub (Shift for precision,
+// Ctrl to snap), click to type math, drag across checkboxes, Ctrl+Z / Ctrl+Shift+Z.
+// It imitates the feel in the browser; the real widgets are native and drawn by BUI.
+const fields = [
+ { axis: "X", value: 0 },
+ { axis: "Y", value: 1.25 },
+ { axis: "Z", value: 0 },
+];
+const toggles = [
+ { label: "Shadows", on: true },
+ { label: "Bloom", on: false },
+ { label: "Motion Blur", on: true },
+ { label: "Mist", on: false },
+];
+---
+
+<div class="feel-panel" data-feel>
+ <div class="fp-header">
+ <svg width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="M1.5 3.2 5 6.7l3.5-3.5" fill="none" stroke="currentColor" stroke-width="1.4"></path></svg>
+ <span>Transform</span>
+ <span class="fp-grip" aria-hidden="true">::::</span>
+ </div>
+ <div class="fp-body">
+ <p class="fp-label" id="fp-loc">Location</p>
+ <div class="fp-col" role="group" aria-labelledby="fp-loc">
+ {
+ fields.map((f) => (
+ <div
+ class="fp-num"
+ role="spinbutton"
+ tabindex="0"
+ aria-label={`Location ${f.axis}`}
+ aria-valuenow={f.value}
+ data-num
+ data-value={f.value}
+ data-step="0.1"
+ data-unit=" m"
+ >
+ <span class="fp-axis">{f.axis}</span>
+ <span class="fp-val" data-val />
+ </div>
+ ))
+ }
+ </div>
+
+ <div class="fp-row">
+ <span class="fp-label fp-right" id="fp-scale">Scale</span>
+ <div
+ class="fp-slider"
+ role="slider"
+ tabindex="0"
+ aria-labelledby="fp-scale"
+ aria-valuemin="0"
+ aria-valuemax="2"
+ aria-valuenow="1"
+ data-slider
+ data-value="1"
+ data-min="0"
+ data-max="2"
+ >
+ <span class="fp-fill" data-fill></span>
+ <span class="fp-val fp-center" data-val></span>
+ </div>
+ </div>
+
+ <p class="fp-label" id="fp-render">Render</p>
+ <div class="fp-checks" role="group" aria-labelledby="fp-render" data-checks>
+ {
+ toggles.map((t) => (
+ <button type="button" class="fp-check" role="checkbox" aria-checked={t.on ? "true" : "false"} data-check>
+ <span class="fp-box" aria-hidden="true">
+ <svg viewBox="0 0 12 12" width="10" height="10">
+ <path d="M2.2 6.3 4.8 8.8 9.8 3.4" fill="none" stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" />
+ </svg>
+ </span>
+ {t.label}
+ </button>
+ ))
+ }
+ </div>
+ </div>
+ <div class="fp-status" aria-live="polite">
+ <span data-status>Drag a number sideways.</span>
+ <span class="fp-undo">
+ <button type="button" data-undo aria-label="Undo (Ctrl+Z)" title="Undo · Ctrl+Z"><Icon name="arrow-counter-clockwise" weight="bold" size={12} /></button>
+ <button type="button" data-redo aria-label="Redo (Ctrl+Shift+Z)" title="Redo · Ctrl+Shift+Z"><Icon name="arrow-clockwise" weight="bold" size={12} /></button>
+ </span>
+ </div>
+</div>
+
+<style>
+ .feel-panel {
+ --w: var(--bl-widget);
+ --w-hi: var(--bl-widget-hover);
+ --txt: var(--bl-text);
+ --mut: var(--bl-muted);
+ width: 100%;
+ max-width: 400px;
+ background: var(--bl-region);
+ color: var(--txt);
+ font-family: var(--font-sans);
+ font-size: 12.5px;
+ border: 1px solid var(--bl-outline);
+ box-shadow: 0 30px 70px -30px var(--bl-shadow);
+ user-select: none;
+ -webkit-user-select: none;
+ }
+ .fp-header {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ height: 30px;
+ padding: 0 10px;
+ background: var(--bl-panel);
+ border-bottom: 1px solid var(--bl-panel-line);
+ font-weight: 500;
+ }
+ .fp-grip {
+ margin-left: auto;
+ color: var(--bl-muted);
+ letter-spacing: -1px;
+ font-size: 10px;
+ }
+ .fp-body {
+ padding: 8px 10px 12px;
+ background: var(--bl-panel);
+ }
+ .fp-label {
+ margin: 6px 2px 4px;
+ color: var(--txt);
+ }
+ .fp-right {
+ text-align: right;
+ margin: 0;
+ }
+ .fp-col {
+ display: flex;
+ flex-direction: column;
+ gap: 1px;
+ }
+ .fp-num,
+ .fp-slider {
+ position: relative;
+ display: flex;
+ align-items: center;
+ height: 22px;
+ padding: 0 9px;
+ background: var(--w);
+ cursor: ew-resize;
+ touch-action: none;
+ outline: none;
+ transition: background-color 80ms ease-out;
+ }
+ .fp-num:hover,
+ .fp-slider:hover {
+ background: var(--w-hi);
+ }
+ .fp-num:first-child {
+ border-radius: 4px 4px 0 0;
+ }
+ .fp-num:last-child {
+ border-radius: 0 0 4px 4px;
+ }
+ .fp-num:focus-visible,
+ .fp-slider:focus-visible,
+ .fp-check:focus-visible {
+ box-shadow: 0 0 0 1.5px #8cb0ea;
+ }
+ .fp-num[data-dragging] {
+ background: var(--bl-sel);
+ }
+ .fp-axis {
+ color: var(--mut);
+ }
+ .fp-val {
+ margin-left: auto;
+ font-variant-numeric: tabular-nums;
+ }
+ .fp-center {
+ position: relative;
+ margin: 0 auto;
+ }
+ .fp-row {
+ display: grid;
+ grid-template-columns: 30% 1fr;
+ align-items: center;
+ gap: 8px;
+ margin-top: 10px;
+ }
+ .fp-slider {
+ border-radius: 4px;
+ overflow: hidden;
+ padding: 0;
+ }
+ .fp-fill {
+ position: absolute;
+ inset: 0 auto 0 0;
+ background: var(--bl-sel);
+ }
+ .fp-checks {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 4px 10px;
+ touch-action: none;
+ }
+ .fp-check {
+ display: flex;
+ align-items: center;
+ gap: 7px;
+ height: 22px;
+ padding: 0 2px;
+ color: var(--txt);
+ font: inherit;
+ background: none;
+ border: 0;
+ cursor: default;
+ outline: none;
+ text-align: left;
+ }
+ .fp-box {
+ display: grid;
+ place-items: center;
+ width: 14px;
+ height: 14px;
+ border-radius: 3px;
+ background: var(--w);
+ }
+ .fp-box svg {
+ opacity: 0;
+ }
+ .fp-check:hover .fp-box {
+ background: var(--w-hi);
+ }
+ .fp-check[aria-checked="true"] .fp-box {
+ background: var(--bl-sel);
+ }
+ .fp-check[aria-checked="true"] .fp-box svg {
+ opacity: 1;
+ }
+ .fp-status {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-height: 28px;
+ padding: 4px 6px 4px 10px;
+ background: var(--bl-footer);
+ color: var(--mut);
+ font-size: 11.5px;
+ border-top: 1px solid var(--bl-outline);
+ }
+ .fp-undo {
+ margin-left: auto;
+ display: flex;
+ gap: 2px;
+ }
+ .fp-undo button {
+ display: grid;
+ place-items: center;
+ width: 24px;
+ height: 20px;
+ color: var(--txt);
+ background: var(--w);
+ border: 0;
+ border-radius: 3px;
+ font-size: 13px;
+ line-height: 1;
+ }
+ .fp-undo button:hover {
+ background: var(--w-hi);
+ }
+ .fp-undo button:disabled {
+ opacity: 0.4;
+ }
+ :global(.fp-edit) {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ padding: 0 9px;
+ color: var(--bl-field-text);
+ font: inherit;
+ background: var(--bl-field);
+ border: 0;
+ border-radius: inherit;
+ outline: 1.5px solid var(--bl-sel);
+ user-select: text;
+ }
+</style>
+
+<script>
+ // ---------- a tiny expression evaluator: 2*pi, (1+2)/4, sqrt(2), min(4, 3) ----------
+ function evaluate(src: string): number | null {
+ const toks = src.match(/\d*\.?\d+(?:e[+-]?\d+)?|[a-z_]+|[-+*/^(),]/gi);
+ if (!toks || toks.join("") !== src.replace(/\s+/g, "")) return null;
+ let i = 0;
+ const fns: Record<string, (...a: number[]) => number> = {
+ sqrt: Math.sqrt, sin: Math.sin, cos: Math.cos, tan: Math.tan, abs: Math.abs,
+ round: Math.round, floor: Math.floor, ceil: Math.ceil, min: Math.min, max: Math.max,
+ };
+ const consts: Record<string, number> = { pi: Math.PI, e: Math.E, tau: Math.PI * 2 };
+ const peek = () => toks[i];
+ const expr = (): number => {
+ let v = term();
+ while (peek() === "+" || peek() === "-") v = toks[i++] === "+" ? v + term() : v - term();
+ return v;
+ };
+ const term = (): number => {
+ let v = power();
+ while (peek() === "*" || peek() === "/") v = toks[i++] === "*" ? v * power() : v / power();
+ return v;
+ };
+ const power = (): number => {
+ const b = unary();
+ if (peek() === "^") {
+ i++;
+ return b ** power();
+ }
+ return b;
+ };
+ const unary = (): number => {
+ if (peek() === "-") return i++, -unary();
+ if (peek() === "+") return i++, unary();
+ return atom();
+ };
+ const atom = (): number => {
+ const t = toks[i++];
+ if (t === undefined) throw 0;
+ if (t === "(") {
+ const v = expr();
+ if (toks[i++] !== ")") throw 0;
+ return v;
+ }
+ if (/^[\d.]/.test(t)) return parseFloat(t);
+ const name = t.toLowerCase();
+ if (name in consts) return consts[name];
+ if (name in fns && toks[i] === "(") {
+ i++;
+ const args = [expr()];
+ while (peek() === ",") i++, args.push(expr());
+ if (toks[i++] !== ")") throw 0;
+ return fns[name](...args);
+ }
+ throw 0;
+ };
+ try {
+ const v = expr();
+ return i === toks.length && Number.isFinite(v) ? v : null;
+ } catch {
+ return null;
+ }
+ }
+
+ const fmt = (v: number, digits: number) => {
+ const s = v.toFixed(digits);
+ return digits === 3 ? s : s.replace(/\.?0+$/, "") || "0";
+ };
+
+ document.querySelectorAll<HTMLElement>("[data-feel]").forEach((root) => {
+ const status = root.querySelector<HTMLElement>("[data-status]")!;
+ const undoBtn = root.querySelector<HTMLButtonElement>("[data-undo]")!;
+ const redoBtn = root.querySelector<HTMLButtonElement>("[data-redo]")!;
+ type Change = { apply: () => void; revert: () => void };
+ const undo: Change[][] = [];
+ const redo: Change[][] = [];
+ const say = (s: string) => (status.textContent = s);
+ const refreshHistory = () => {
+ undoBtn.disabled = !undo.length;
+ redoBtn.disabled = !redo.length;
+ };
+ let hinted = false;
+ const push = (changes: Change[], msg: string) => {
+ if (!changes.length) return;
+ undo.push(changes);
+ redo.length = 0;
+ refreshHistory();
+ say(hinted ? msg : `${msg}. Ctrl+Z undoes it.`);
+ hinted = true;
+ };
+ const doUndo = () => {
+ const c = undo.pop();
+ if (!c) return say("Nothing to undo.");
+ [...c].reverse().forEach((x) => x.revert());
+ redo.push(c);
+ refreshHistory();
+ say(undo.length ? "Undone." : "Undone. Back where you started.");
+ };
+ const doRedo = () => {
+ const c = redo.pop();
+ if (!c) return say("Nothing to redo.");
+ c.forEach((x) => x.apply());
+ undo.push(c);
+ refreshHistory();
+ say("Redone.");
+ };
+ undoBtn.addEventListener("click", doUndo);
+ redoBtn.addEventListener("click", doRedo);
+ root.addEventListener("keydown", (e) => {
+ if (!(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== "z" && e.key.toLowerCase() !== "y") return;
+ if ((e.target as HTMLElement).closest("input")) return;
+ e.preventDefault();
+ if (e.shiftKey || e.key.toLowerCase() === "y") doRedo();
+ else doUndo();
+ });
+ refreshHistory();
+
+ // ---------- number fields and the slider ----------
+ type Valued = HTMLElement & { _v?: number };
+ const setValue = (el: Valued, v: number) => {
+ el._v = v;
+ const isSlider = el.hasAttribute("data-slider");
+ const val = el.querySelector<HTMLElement>("[data-val]")!;
+ if (isSlider) {
+ const min = +el.dataset.min!, max = +el.dataset.max!;
+ el.querySelector<HTMLElement>("[data-fill]")!.style.width = `${((v - min) / (max - min)) * 100}%`;
+ val.textContent = fmt(v, 3);
+ } else {
+ val.textContent = fmt(v, 4) + (el.dataset.unit ?? "");
+ }
+ el.setAttribute("aria-valuenow", String(+v.toFixed(4)));
+ el.setAttribute("aria-valuetext", val.textContent ?? "");
+ };
+ const clamp = (el: HTMLElement, v: number) =>
+ el.hasAttribute("data-slider") ? Math.min(+el.dataset.max!, Math.max(+el.dataset.min!, v)) : v;
+ const change = (el: Valued, from: number, to: number): Change => ({ apply: () => setValue(el, to), revert: () => setValue(el, from) });
+
+ const editors = root.querySelectorAll<Valued>("[data-num], [data-slider]");
+ editors.forEach((el) => {
+ setValue(el, +el.dataset.value!);
+ const isSlider = el.hasAttribute("data-slider");
+ let start = 0, startX = 0, moved = false, dragging = false;
+
+ const beginEdit = () => {
+ const input = document.createElement("input");
+ input.className = "fp-edit";
+ input.value = fmt(el._v!, isSlider ? 3 : 4);
+ input.setAttribute("aria-label", "Type a value or an expression like 2*pi");
+ el.append(input);
+ input.select();
+ say("Type a number or math, like 2*pi. Enter applies.");
+ const before = el._v!;
+ let done = false;
+ const finish = (commit: boolean) => {
+ if (done) return;
+ done = true;
+ const v = commit ? evaluate(input.value) : null;
+ input.remove();
+ el.focus();
+ if (v === null) {
+ if (commit) say(`“${input.value}” isn't a number I can read. Nothing changed.`);
+ return;
+ }
+ const after = clamp(el, v);
+ setValue(el, after);
+ if (after !== before) push([change(el, before, after)], `“${input.value}” = ${fmt(after, 4)}`);
+ };
+ input.addEventListener("keydown", (e) => {
+ if (e.key === "Enter") finish(true);
+ else if (e.key === "Escape") finish(false);
+ e.stopPropagation();
+ });
+ input.addEventListener("blur", () => finish(true));
+ input.addEventListener("pointerdown", (e) => e.stopPropagation());
+ };
+
+ el.addEventListener("pointerdown", (e) => {
+ if (e.button !== 0) return;
+ e.preventDefault();
+ el.focus();
+ el.setPointerCapture(e.pointerId);
+ start = el._v!;
+ startX = e.clientX;
+ moved = false;
+ dragging = true;
+ });
+ el.addEventListener("pointermove", (e) => {
+ if (!dragging) return;
+ const dx = e.clientX - startX;
+ if (!moved && Math.abs(dx) < 3) return; // Blender's drag threshold
+ if (!moved) el.toggleAttribute("data-dragging", !isSlider);
+ moved = true;
+ let v: number;
+ if (isSlider) {
+ const min = +el.dataset.min!, max = +el.dataset.max!;
+ v = start + (dx / el.clientWidth) * (max - min) * (e.shiftKey ? 0.05 : 1);
+ if (e.ctrlKey || e.metaKey) v = Math.round(v * 10) / 10;
+ } else {
+ v = start + dx * +el.dataset.step! * (e.shiftKey ? 0.1 : 1) * 0.1;
+ if (e.ctrlKey || e.metaKey) v = Math.round(v);
+ }
+ setValue(el, clamp(el, v));
+ });
+ const end = () => {
+ if (!dragging) return;
+ dragging = false;
+ el.removeAttribute("data-dragging");
+ if (!moved) return beginEdit();
+ if (el._v !== start) push([change(el, start, el._v!)], `${el.getAttribute("aria-label") ?? "Scale"}: ${fmt(el._v!, isSlider ? 3 : 4)}`);
+ };
+ el.addEventListener("pointerup", end);
+ el.addEventListener("pointercancel", end);
+ el.addEventListener("keydown", (e) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ beginEdit();
+ return;
+ }
+ if (e.key === "Backspace") {
+ const before = el._v!, after = +el.dataset.value!;
+ setValue(el, after);
+ if (before !== after) push([change(el, before, after)], "Reset to default");
+ return;
+ }
+ const dir = e.key === "ArrowRight" || e.key === "ArrowUp" ? 1 : e.key === "ArrowLeft" || e.key === "ArrowDown" ? -1 : 0;
+ if (!dir) return;
+ e.preventDefault();
+ const step = isSlider ? 0.1 : +el.dataset.step!;
+ const before = el._v!;
+ const after = clamp(el, +(before + dir * step * (e.shiftKey ? 0.1 : 1)).toFixed(4));
+ setValue(el, after);
+ push([change(el, before, after)], `Stepped to ${fmt(after, 4)}`);
+ });
+ });
+
+ // ---------- checkboxes: press one, drag across the rest ----------
+ const group = root.querySelector<HTMLElement>("[data-checks]")!;
+ const boxes = [...group.querySelectorAll<HTMLButtonElement>("[data-check]")];
+ let paint: boolean | null = null;
+ let stroke: Change[] = [];
+ const setChecked = (b: HTMLButtonElement, on: boolean) => b.setAttribute("aria-checked", String(on));
+ const paintBox = (b: HTMLButtonElement) => {
+ const now = b.getAttribute("aria-checked") === "true";
+ if (paint === null || now === paint) return;
+ setChecked(b, paint);
+ const to = paint;
+ stroke.push({ apply: () => setChecked(b, to), revert: () => setChecked(b, !to) });
+ };
+ group.addEventListener("pointerdown", (e) => {
+ const b = (e.target as HTMLElement).closest<HTMLButtonElement>("[data-check]");
+ if (!b || e.button !== 0) return;
+ e.preventDefault();
+ b.focus();
+ paint = b.getAttribute("aria-checked") !== "true";
+ stroke = [];
+ paintBox(b);
+ group.setPointerCapture(e.pointerId);
+ });
+ group.addEventListener("pointermove", (e) => {
+ if (paint === null) return;
+ const el = document.elementFromPoint(e.clientX, e.clientY)?.closest<HTMLButtonElement>("[data-check]");
+ if (el && boxes.includes(el)) paintBox(el);
+ });
+ const endStroke = () => {
+ if (paint === null) return;
+ const n = stroke.length;
+ push(stroke, `${n} checkbox${n === 1 ? "" : "es"} ${paint ? "on" : "off"} in one drag, one undo step`);
+ paint = null;
+ };
+ group.addEventListener("pointerup", endStroke);
+ group.addEventListener("pointercancel", endStroke);
+ group.addEventListener("click", (e) => {
+ // keyboard activation (Space / Enter); pointer clicks were handled on pointerdown
+ if ((e as PointerEvent).detail !== 0) return;
+ const b = (e.target as HTMLElement).closest<HTMLButtonElement>("[data-check]");
+ if (!b) return;
+ const to = b.getAttribute("aria-checked") !== "true";
+ setChecked(b, to);
+ push([{ apply: () => setChecked(b, to), revert: () => setChecked(b, !to) }], "Toggled");
+ });
+ });
+</script>
diff --git a/website/src/components/landing/Hero.astro b/website/src/components/landing/Hero.astro
new file mode 100644
index 0000000..0344015
--- /dev/null
+++ b/website/src/components/landing/Hero.astro
@@ -0,0 +1,98 @@
+---
+import Icon from "../site/Icon.astro";
+import InstallTabs from "./InstallTabs.astro";
+import ThemedImage from "../docs/ThemedImage.astro";
+import { href } from "../../lib/docs";
+---
+
+<section class="hero relative overflow-hidden bg-stage text-foreground" aria-labelledby="hero-title">
+ <div class="grid lg:grid-cols-[minmax(0,1.05fr)_minmax(0,1fr)]">
+ <div class="flex flex-col justify-center gap-7 px-5 py-14 sm:px-10 sm:py-20 lg:border-r lg:border-border lg:px-14 lg:py-24">
+ <p class="kicker inline-flex items-center gap-2 text-link">
+ <span class="inline-block size-2 bg-accent" aria-hidden="true"></span>
+ Blender's UI, as a library
+ </p>
+ <h1 id="hero-title" class="max-w-[15ch] text-balance text-[2.6rem] font-light leading-[1.04] tracking-[-0.035em] sm:text-6xl lg:text-[4.25rem]">
+ Blender's interface, for your app.
+ </h1>
+ <p class="max-w-[52ch] text-pretty text-[17px] leading-7 text-muted">
+ BUI lifts Blender's widgets and the way they feel out of Blender and into a small, fast C library. Keep the
+ syntax you know: <span class="text-foreground">tkinter, Qt, Rust, React, Dear ImGui or C</span>.
+ </p>
+
+ <div class="w-full max-w-xl">
+ <InstallTabs />
+ </div>
+
+ <div class="flex flex-wrap items-center gap-3">
+ <a
+ href={href("docs/start/introduction/")}
+ class="inline-flex h-11 items-center gap-2 bg-primary px-5 text-[15px] font-medium text-primary-ink transition-[background-color,transform] duration-150 ease-out hover:bg-primary-hover active:scale-[0.98]"
+ >
+ Start here <Icon name="arrow-right" size={16} />
+ </a>
+ <a
+ href={href("docs/tutorials/first-app-python/")}
+ class="inline-flex h-11 items-center gap-2 border border-border-strong px-5 text-[15px] text-foreground transition-[background-color,border-color] duration-150 ease-out hover:border-muted hover:bg-surface"
+ >
+ Build your first app
+ </a>
+ </div>
+
+ <a href="#performance" class="hero-speed group flex flex-wrap items-center gap-x-5 gap-y-2 border-t border-border pt-5 text-[13px] text-muted">
+ <span class="inline-flex items-center gap-1.5"><Icon name="lightning" weight="fill" size={14} class="text-accent" /><b class="tabular font-semibold text-foreground">~5 ms</b> first frame</span>
+ <span><b class="tabular font-semibold text-foreground">40×</b> sooner than gpui-fast</span>
+ <span><b class="tabular font-semibold text-foreground">0 ms</b> idle CPU</span>
+ <span class="inline-flex items-center gap-1 text-link">See the numbers <Icon name="arrow-down" size={13} class="transition-transform duration-200 group-hover:translate-y-0.5" /></span>
+ </a>
+ </div>
+
+ <div class="relative flex items-center justify-center border-t border-border px-5 py-12 sm:px-10 lg:border-t-0 lg:py-16">
+ <div class="hero-hatch absolute inset-0" aria-hidden="true"></div>
+ <figure class="relative">
+ <div class="relative">
+ <ThemedImage
+ shot="python-tkinter"
+ alt=""
+ class="absolute -left-10 top-14 hidden w-[300px] -rotate-[3deg] opacity-80 shadow-[0_24px_60px_-20px_var(--bl-shadow)] outline outline-1 -outline-offset-1 outline-[var(--outline)] xl:block"
+ loading="eager"
+ />
+ <ThemedImage
+ shot="c-kit-app"
+ alt="A real BUI window: a Blender modifier stack with collapsible panels, enum rows, number fields, dropdowns, a slider, checkboxes and buttons"
+ loading="eager"
+ fetchpriority="high"
+ class="hero-shot relative w-full max-w-[420px] shadow-[0_40px_90px_-30px_var(--bl-shadow)] outline outline-1 -outline-offset-1 outline-[var(--outline)] xl:translate-x-10"
+ />
+ </div>
+ </figure>
+ </div>
+ </div>
+</section>
+
+<style>
+ .hero-shot {
+ animation: hero-in 900ms var(--ease-out) both;
+ }
+ @keyframes hero-in {
+ from {
+ opacity: 0;
+ transform: translateY(18px);
+ }
+ }
+ @media (min-width: 1280px) {
+ @keyframes hero-in {
+ from {
+ opacity: 0;
+ transform: translate(2.5rem, 18px);
+ }
+ to {
+ transform: translate(2.5rem, 0);
+ }
+ }
+ }
+ .hero-hatch {
+ background-image: repeating-linear-gradient(135deg, rgb(71 114 179 / 0.22) 0 1.5px, transparent 1.5px 7px);
+ mask-image: radial-gradient(ellipse at center, black 30%, transparent 78%);
+ }
+</style>
diff --git a/website/src/components/landing/InstallTabs.astro b/website/src/components/landing/InstallTabs.astro
new file mode 100644
index 0000000..456dc81
--- /dev/null
+++ b/website/src/components/landing/InstallTabs.astro
@@ -0,0 +1,100 @@
+---
+const commands = [
+ { id: "pip", label: "pip", cmd: "pip install blenderui", note: "Python 3.11+: tkinter, Qt syntax, components, Dear ImGui" },
+ { id: "npm", label: "npm", cmd: "npm install @blender-ui/react react", note: "Node.js 18+ or Bun · prebuilt for Windows x64" },
+ { id: "bun", label: "bun", cmd: "bun add @blender-ui/react react", note: "Bun reads JSX directly: bun app.jsx" },
+ {
+ id: "cargo",
+ label: "cargo",
+ cmd: "cargo add blenderui",
+ note: "From crates.io · Rust 1.88+, CMake and a C compiler",
+ },
+ { id: "cmake", label: "cmake", cmd: "cmake -S . -B build && cmake --build build", note: "C, C++ and Dear ImGui, from a clone of the repo" },
+];
+---
+
+<div class="install overflow-hidden border border-border bg-code" data-install>
+ <div role="tablist" aria-label="Install with" class="flex overflow-x-auto border-b border-border px-2 [scrollbar-width:none]">
+ {
+ commands.map((c, i) => (
+ <button
+ type="button"
+ role="tab"
+ id={`install-tab-${c.id}`}
+ aria-controls="install-panel"
+ aria-selected={i === 0 ? "true" : "false"}
+ tabindex={i === 0 ? 0 : -1}
+ data-cmd={c.cmd}
+ data-note={c.note}
+ class="relative h-10 shrink-0 px-3 font-mono text-[13px] text-muted transition-colors duration-150 hover:text-foreground aria-selected:text-foreground aria-selected:after:absolute aria-selected:after:inset-x-2 aria-selected:after:bottom-0 aria-selected:after:h-0.5 aria-selected:after:bg-primary"
+ >
+ {c.label}
+ </button>
+ ))
+ }
+ </div>
+ <div id="install-panel" role="tabpanel" aria-labelledby="install-tab-pip" class="flex items-start gap-3 px-4 py-4">
+ <span class="select-none font-mono text-[13.5px] leading-6 text-accent" aria-hidden="true">$</span>
+ <code class="min-w-0 flex-1 break-all font-mono text-[13.5px] leading-6 text-foreground" data-cmd-text>{commands[0].cmd}</code>
+ <button
+ type="button"
+ data-copy
+ class="inline-flex size-8 shrink-0 items-center justify-center text-muted transition-colors hover:bg-surface-2 hover:text-foreground"
+ aria-label="Copy command"
+ >
+ <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" aria-hidden="true" data-icon-copy
+ ><rect x="8" y="8" width="13" height="13"></rect><path d="M16 8V3H3v13h5"></path></svg
+ >
+ <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true" class="hidden" data-icon-done
+ ><path d="m5 12 5 5L20 7"></path></svg
+ >
+ </button>
+ </div>
+ <p class="border-t border-border-soft px-4 py-2 text-xs text-muted" data-note-text aria-live="polite">{commands[0].note}</p>
+</div>
+
+<script>
+ document.querySelectorAll<HTMLElement>("[data-install]").forEach((root) => {
+ const tabs = [...root.querySelectorAll<HTMLButtonElement>("[role=tab]")];
+ const text = root.querySelector<HTMLElement>("[data-cmd-text]")!;
+ const note = root.querySelector<HTMLElement>("[data-note-text]")!;
+ const panel = root.querySelector<HTMLElement>("[role=tabpanel]")!;
+ const pick = (tab: HTMLButtonElement, focus = false) => {
+ tabs.forEach((t) => {
+ t.setAttribute("aria-selected", String(t === tab));
+ t.tabIndex = t === tab ? 0 : -1;
+ });
+ text.textContent = tab.dataset.cmd!;
+ note.textContent = tab.dataset.note!;
+ panel.setAttribute("aria-labelledby", tab.id);
+ if (focus) tab.focus();
+ };
+ tabs.forEach((t) => t.addEventListener("click", () => pick(t)));
+ root.querySelector("[role=tablist]")!.addEventListener("keydown", (e) => {
+ const ev = e as KeyboardEvent;
+ const i = tabs.indexOf(document.activeElement as HTMLButtonElement);
+ if (i < 0) return;
+ const n = ev.key === "ArrowRight" ? (i + 1) % tabs.length : ev.key === "ArrowLeft" ? (i - 1 + tabs.length) % tabs.length : -1;
+ if (n >= 0) {
+ ev.preventDefault();
+ pick(tabs[n], true);
+ }
+ });
+ const copy = root.querySelector<HTMLButtonElement>("[data-copy]")!;
+ copy.addEventListener("click", async () => {
+ try {
+ await navigator.clipboard.writeText(text.textContent ?? "");
+ copy.querySelector("[data-icon-copy]")!.classList.add("hidden");
+ copy.querySelector("[data-icon-done]")!.classList.remove("hidden");
+ copy.setAttribute("aria-label", "Copied");
+ setTimeout(() => {
+ copy.querySelector("[data-icon-copy]")!.classList.remove("hidden");
+ copy.querySelector("[data-icon-done]")!.classList.add("hidden");
+ copy.setAttribute("aria-label", "Copy command");
+ }, 1600);
+ } catch {
+ /* clipboard blocked: the command is still selectable */
+ }
+ });
+ });
+</script>
diff --git a/website/src/components/landing/Performance.astro b/website/src/components/landing/Performance.astro
new file mode 100644
index 0000000..dd4ae06
--- /dev/null
+++ b/website/src/components/landing/Performance.astro
@@ -0,0 +1,97 @@
+---
+// Benchmark highlights and charts. Every number comes from src/data/bench.ts, which
+// follows README.md "Performance" (a Ryzen 7 5800U laptop, Windows 11, on AC power).
+import BenchChart from "../charts/BenchChart.astro";
+import Icon from "../site/Icon.astro";
+import { benchCaveat, highlights, machine } from "../../data/bench";
+import { href, repoFile } from "../../lib/docs";
+---
+
+<ul class="grid grid-cols-1 border-b border-border sm:grid-cols-2 xl:grid-cols-4">
+ {
+ highlights.map((h, i) => {
+ const max = Math.max(h.ours, h.theirs.value) || 1;
+ return (
+ <li
+ class:list={[
+ "speed-tile chart flex flex-col gap-3 border-border p-5 sm:p-7 [--scale:0.5]",
+ "border-b xl:border-b-0",
+ i % 2 === 0 && "sm:border-r",
+ i < 3 && "xl:border-r",
+ i >= 2 && "sm:border-b-0",
+ ]}
+ data-chart
+ style={`--reveal-i:${i}`}
+ >
+ <p class="flex items-baseline justify-between gap-3">
+ <span class="kicker text-muted">{h.label}</span>
+ <span class="speed-claim">{h.claim}</span>
+ </p>
+ <p class="tabular flex items-baseline gap-1.5 font-light tracking-[-0.04em]">
+ <span class="text-[3.4rem] leading-none sm:text-[3.9rem]">{h.value}</span>
+ <span class="text-xl text-muted">{h.unit}</span>
+ </p>
+ <div class="flex flex-col gap-1.5 text-[12px]" aria-label={`BUI ${h.value} ${h.unit}, ${h.theirs.name} ${h.theirs.display}`}>
+ <div class="grid grid-cols-[4.75rem_minmax(0,1fr)] items-center gap-2">
+ <span class="font-semibold">BUI</span>
+ <span class="chart-track is-thin" style="--i:0">
+ <span class="chart-bar is-ours" style={`--p:${Math.max((h.ours / max) * 100, 0.4).toFixed(2)}%`} />
+ <span class="chart-value" style={`--p:${((h.ours / max) * 100).toFixed(2)}%`}>
+ <span class="tabular font-medium">
+ {h.value} {h.unit}
+ </span>
+ </span>
+ </span>
+ </div>
+ <div class="grid grid-cols-[4.75rem_minmax(0,1fr)] items-center gap-2">
+ <span class="truncate text-muted">{h.theirs.name}</span>
+ <span class="chart-track is-thin" style="--i:1">
+ <span class="chart-bar is-other" style="--p:100%" />
+ <span class="chart-value" style="--p:100%">
+ <span class="tabular text-muted">{h.theirs.display}</span>
+ </span>
+ </span>
+ </div>
+ </div>
+ <p class="text-[12.5px] leading-5 text-muted">{h.note}</p>
+ </li>
+ );
+ })
+ }
+</ul>
+
+<div class="grid lg:grid-cols-2">
+ <div class="border-b border-border lg:border-r"><BenchChart id="first-frame" bare /></div>
+ <div class="border-b border-border"><BenchChart id="start-time" bare /></div>
+ <div class="border-b border-border lg:border-r"><BenchChart id="cpu-per-frame" bare /></div>
+ <div class="border-b border-border"><BenchChart id="ram" bare /></div>
+</div>
+
+<div class="flex flex-col gap-3 px-5 py-5 text-[13px] leading-6 text-muted sm:flex-row sm:items-center sm:justify-between sm:px-8">
+ <p class="max-w-[80ch]">
+ <Icon name="info" size={14} class="mr-1 inline -translate-y-px" />
+ {machine}. {benchCaveat} gpui figures don't include their GPU time.
+ </p>
+ <p class="flex shrink-0 flex-wrap gap-x-5 gap-y-1">
+ <a class="group inline-flex items-center gap-1.5 font-medium text-link" href={href("docs/performance/benchmarks/")}>
+ Every benchmark <Icon name="arrow-right" size={14} class="transition-transform duration-200 group-hover:translate-x-0.5" />
+ </a>
+ <a class="hover:text-foreground" href={repoFile("bindings/rust/bench/README.md")}>Method and raw data</a>
+ </p>
+</div>
+
+<style>
+ .speed-tile {
+ background: var(--background);
+ transition: background-color 200ms ease-out;
+ }
+ .speed-tile:hover {
+ background: var(--surface);
+ }
+ .speed-claim {
+ font-size: 12px;
+ font-weight: 600;
+ color: var(--link);
+ white-space: nowrap;
+ }
+</style>
diff --git a/website/src/components/landing/PieTile.astro b/website/src/components/landing/PieTile.astro
new file mode 100644
index 0000000..f82e8a9
--- /dev/null
+++ b/website/src/components/landing/PieTile.astro
@@ -0,0 +1,110 @@
+---
+// A pie menu, Blender style: items around the pointer; the direction you move picks one.
+// Decorative sketch; move the pointer over it to aim.
+const items = [
+ { label: "Object Mode", angle: 180 },
+ { label: "Edit Mode", angle: 0 },
+ { label: "Sculpt Mode", angle: 90 },
+ { label: "Vertex Paint", angle: 270 },
+ { label: "Weight Paint", angle: 225 },
+ { label: "Texture Paint", angle: 315 },
+ { label: "Pose Mode", angle: 135 },
+ { label: "Draw Mode", angle: 45 },
+];
+const R = { x: 118, y: 78 };
+---
+
+<div class="pie" data-pie role="img" aria-label="A Blender pie menu: eight modes arranged around the pointer; moving toward one highlights it">
+ <div class="pie-title">Mode</div>
+ <div class="pie-center" aria-hidden="true">
+ <svg width="44" height="44" viewBox="-22 -22 44 44">
+ <circle r="17" fill="none" stroke="var(--bl-pie-ring)" stroke-width="5"></circle>
+ <path d="M0 -17 A17 17 0 0 1 12 -12" fill="none" stroke="var(--bl-sel)" stroke-width="5" data-pie-arc></path>
+ </svg>
+ </div>
+ {
+ items.map((it, i) => {
+ const a = (it.angle * Math.PI) / 180;
+ const x = Math.cos(a) * R.x;
+ const y = -Math.sin(a) * R.y;
+ return (
+ <span class="pie-item" data-pie-item data-angle={it.angle} aria-hidden="true" style={`transform: translate(calc(-50% + ${x.toFixed(1)}px), calc(-50% + ${y.toFixed(1)}px))`} data-active={i === 0 ? "" : undefined}>
+ {it.label}
+ </span>
+ );
+ })
+ }
+</div>
+
+<style>
+ .pie {
+ position: relative;
+ width: 100%;
+ height: 250px;
+ font-family: var(--font-sans);
+ font-size: 12px;
+ color: var(--bl-pie-text);
+ touch-action: pan-y;
+ }
+ .pie-title {
+ position: absolute;
+ left: 50%;
+ top: 0;
+ transform: translateX(-50%);
+ color: var(--muted);
+ font-size: 11px;
+ letter-spacing: 0.12em;
+ text-transform: uppercase;
+ }
+ .pie-center {
+ position: absolute;
+ left: 50%;
+ top: calc(50% + 6px);
+ transform: translate(-50%, -50%);
+ }
+ .pie-item {
+ position: absolute;
+ left: 50%;
+ top: calc(50% + 6px);
+ padding: 3px 10px;
+ white-space: nowrap;
+ background: var(--bl-pie);
+ border: 1px solid var(--bl-pie-outline);
+ border-radius: 4px;
+ box-shadow: 0 6px 14px -6px var(--bl-shadow);
+ transition: background-color 90ms ease-out;
+ }
+ .pie-item[data-active] {
+ background: var(--bl-sel);
+ color: #fff;
+ }
+ [data-pie-arc] {
+ transform-origin: 0 0;
+ transition: transform 90ms ease-out;
+ }
+</style>
+
+<script>
+ document.querySelectorAll<HTMLElement>("[data-pie]").forEach((pie) => {
+ const items = [...pie.querySelectorAll<HTMLElement>("[data-pie-item]")];
+ const arc = pie.querySelector<SVGPathElement>("[data-pie-arc]")!;
+ const aim = (deg: number) => {
+ let best = items[0], bestD = 999;
+ for (const it of items) {
+ const d = Math.abs(((+it.dataset.angle! - deg + 540) % 360) - 180);
+ if (d < bestD) (bestD = d), (best = it);
+ }
+ items.forEach((it) => it.toggleAttribute("data-active", it === best));
+ // the arc starts at 12 o'clock (90°) and points the way you move
+ arc.style.transform = `rotate(${90 - +best.dataset.angle! - 17}deg)`;
+ };
+ aim(180);
+ pie.addEventListener("pointermove", (e) => {
+ const r = pie.getBoundingClientRect();
+ const dx = e.clientX - (r.left + r.width / 2);
+ const dy = e.clientY - (r.top + r.height / 2);
+ if (Math.hypot(dx, dy) < 12) return;
+ aim(((Math.atan2(-dy, dx) * 180) / Math.PI + 360) % 360);
+ });
+ });
+</script>
diff --git a/website/src/components/landing/Platforms.astro b/website/src/components/landing/Platforms.astro
new file mode 100644
index 0000000..7b52ece
--- /dev/null
+++ b/website/src/components/landing/Platforms.astro
@@ -0,0 +1,59 @@
+---
+// From README.md "Platforms". Works (check) · experimental (flask): written but not yet
+// tested on real hardware · partial (half circle).
+import StatusMark from "../docs/StatusMark.astro";
+import { repoFile } from "../../lib/docs";
+
+type Cell = { text?: string; status?: "done" | "experimental" | "partial" };
+const cols = ["Windows", "Linux", "macOS"];
+const rows: [string, Cell, Cell, Cell][] = [
+ ["Window", { text: "Native (Win32)" }, { text: "Native (X11; Wayland via XWayland)" }, { text: "Native (Cocoa)", status: "experimental" }],
+ ["Python (pip install)", { text: "Wheels", status: "done" }, { text: "Wheels", status: "done" }, { text: "Wheels", status: "done" }],
+ ["Rust", { status: "done" }, { text: "Build from source", status: "done" }, { status: "experimental" }],
+ ["JavaScript / React", { text: "Prebuilt on npm", status: "done" }, { text: "Build the addon from source", status: "done" }, { text: "Headless for now", status: "partial" }],
+ ["C, C++, Dear ImGui", { status: "done" }, { status: "done" }, { status: "experimental" }],
+ ["Renderer", { text: "CPU raster, or GPU (Direct3D 11)" }, { text: "CPU raster, or GPU (OpenGL 3.3)" }, { text: "CPU raster" }],
+ ["HiDPI", { text: "Per-monitor DPI" }, { text: "Xft.dpi" }, { text: "Retina" }],
+];
+---
+
+<div class="relative overflow-x-auto">
+ <table class="w-full min-w-[640px] border-collapse text-sm leading-6">
+ <caption class="sr-only">What runs where</caption>
+ <thead>
+ <tr>
+ <th scope="col" class="w-[22%] border-b border-border px-5 py-3 text-left font-medium text-muted sm:px-8"><span class="sr-only">Feature</span></th>
+ {cols.map((c) => <th scope="col" class="border-b border-l border-border px-4 py-3 text-left text-base font-semibold">{c}</th>)}
+ </tr>
+ </thead>
+ <tbody>
+ {
+ rows.map((r) => (
+ <tr class="border-b border-border-soft transition-colors duration-150 last:border-b-0 hover:bg-surface/60">
+ <th scope="row" class="px-5 py-3 text-left font-medium sm:px-8">{r[0]}</th>
+ {r.slice(1).map((c) => {
+ const cell = c as Cell;
+ return (
+ <td class="border-l border-border px-4 py-3 text-muted">
+ <span class="inline-flex flex-wrap items-center gap-x-2 gap-y-0.5">
+ {cell.status && <StatusMark status={cell.status} compact={Boolean(cell.text)} />}
+ {cell.text}
+ </span>
+ </td>
+ );
+ })}
+ </tr>
+ ))
+ }
+ </tbody>
+ </table>
+</div>
+<p class="flex gap-2 border-t border-border px-5 py-3 text-[13px] leading-6 text-muted sm:px-8">
+ <span class="mt-1"><StatusMark status="experimental" compact /></span>
+ <span>
+ The macOS window host is a port of Blender's Cocoa code (GHOST): written, but not yet run on a Mac. Python can use the
+ standard Tk window there meanwhile (<code class="font-mono">BUI_HOST=tk</code>). If you have a Mac and a free afternoon,
+ you could be the first: the <a class="text-link underline underline-offset-4" href={repoFile("docs/macos-testing.md")}>macOS testing guide</a>
+ walks you through it.
+ </span>
+</p>
diff --git a/website/src/components/landing/SearchTile.astro b/website/src/components/landing/SearchTile.astro
new file mode 100644
index 0000000..08e4575
--- /dev/null
+++ b/website/src/components/landing/SearchTile.astro
@@ -0,0 +1,134 @@
+---
+// Blender's menu search, running on the same port the docs search uses
+// (src/lib/string-search.ts): "ad cu" finds "Add Cube", "shsm" finds "Shade Smooth",
+// and "subdivde" still finds "Subdivide".
+const items = [
+ "Add Cube",
+ "Add Cylinder",
+ "Add Camera",
+ "Add Light",
+ "Apply Scale",
+ "Apply Rotation",
+ "Shade Smooth",
+ "Shade Flat",
+ "Duplicate Objects",
+ "Delete",
+ "Join",
+ "Set Origin to Geometry",
+ "Snap Cursor to Selected",
+ "Mark Seam",
+ "Subdivide",
+];
+---
+
+<div class="msearch" data-msearch>
+ <label class="msearch-field">
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" aria-hidden="true"
+ ><circle cx="11" cy="11" r="7"></circle><path d="m20 20-3.5-3.5"></path></svg
+ >
+ <span class="sr-only">Search the menu</span>
+ <input type="text" value="ad cu" autocomplete="off" spellcheck="false" data-msearch-input aria-controls="msearch-list" />
+ </label>
+ <ul id="msearch-list" class="msearch-list" data-msearch-list aria-live="polite">
+ {items.map((it) => <li data-item={it}>{it}</li>)}
+ </ul>
+</div>
+
+<style>
+ .msearch {
+ width: 100%;
+ max-width: 280px;
+ background: var(--bl-menu);
+ border: 1px solid var(--bl-menu-outline);
+ border-radius: 4px;
+ box-shadow: 0 18px 40px -18px var(--bl-shadow);
+ padding: 6px;
+ font-family: var(--font-sans);
+ font-size: 12.5px;
+ color: var(--bl-menu-text);
+ }
+ .msearch-field {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: 24px;
+ padding: 0 8px;
+ background: var(--bl-field);
+ border-radius: 4px;
+ color: #999;
+ outline: 1px solid var(--bl-sel);
+ }
+ .msearch-field input {
+ flex: 1;
+ min-width: 0;
+ background: transparent;
+ border: 0;
+ outline: none;
+ color: var(--bl-field-text);
+ font: inherit;
+ }
+ .msearch-list {
+ margin-top: 4px;
+ min-height: 120px;
+ }
+ .msearch-list :global(li) {
+ padding: 3px 8px;
+ border-radius: 3px;
+ }
+ .msearch-list :global(li[hidden]) {
+ display: none;
+ }
+ .msearch-list :global(li.first) {
+ background: var(--bl-sel);
+ color: #fff;
+ }
+ .msearch-list :global(b) {
+ font-weight: 600;
+ color: var(--bl-menu-match);
+ }
+ .msearch-list :global(li.first b) {
+ color: #fff;
+ text-decoration: underline;
+ text-underline-offset: 2px;
+ }
+ .msearch-list :global(.none) {
+ color: var(--bl-muted);
+ }
+</style>
+
+<script>
+ import { StringSearch } from "../../lib/string-search";
+
+ document.querySelectorAll<HTMLElement>("[data-msearch]").forEach((root) => {
+ const input = root.querySelector<HTMLInputElement>("[data-msearch-input]")!;
+ const list = root.querySelector<HTMLUListElement>("[data-msearch-list]")!;
+ const all = [...list.querySelectorAll<HTMLLIElement>("li")].map((li) => li.dataset.item!);
+ const engine = new StringSearch<string>("all");
+ all.forEach((item) => engine.add(item, item));
+ const esc = (s: string) => s.replace(/[&<>]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;" })[c]!);
+
+ // Bold the start of each word that a query word begins (or its initial).
+ function markup(item: string, words: string[]) {
+ return item
+ .split(" ")
+ .map((part) => {
+ const lower = part.toLowerCase();
+ const w = words.filter((q) => lower.startsWith(q)).sort((a, b) => b.length - a.length)[0];
+ const n = w ? w.length : words.some((q) => q[0] === lower[0]) ? 1 : 0;
+ return n ? `<b>${esc(part.slice(0, n))}</b>${esc(part.slice(n))}` : esc(part);
+ })
+ .join(" ");
+ }
+
+ const render = () => {
+ const q = input.value.trim();
+ const words = q.toLowerCase().split(/s+/).filter(Boolean);
+ const rows = (q ? engine.query(q) : all).slice(0, 6);
+ list.innerHTML = rows.length
+ ? rows.map((item, i) => `<li class="${i === 0 ? "first" : ""}">${q ? markup(item, words) : esc(item)}</li>`).join("")
+ : `<li class="none">No match. Try “sh sm”, “shsm” or “subdivde”.</li>`;
+ };
+ input.addEventListener("input", render);
+ render();
+ });
+</script>
diff --git a/website/src/components/landing/Section.astro b/website/src/components/landing/Section.astro
new file mode 100644
index 0000000..65281a5
--- /dev/null
+++ b/website/src/components/landing/Section.astro
@@ -0,0 +1,30 @@
+---
+import Icon from "../site/Icon.astro";
+
+interface Props {
+ id: string;
+ kicker: string;
+ title: string;
+ lede?: string;
+ /** A Phosphor icon next to the kicker. */
+ icon?: string;
+ class?: string;
+}
+const { id, kicker, title, lede, icon, class: className } = Astro.props;
+---
+
+<section id={id} aria-labelledby={`${id}-title`} class:list={["scroll-mt-16", className]}>
+ <header class="flex flex-col gap-3 border-b border-border px-5 py-10 sm:px-10 md:py-14 lg:flex-row lg:items-end lg:justify-between lg:gap-16" data-reveal>
+ <div class="flex flex-col gap-3">
+ <p class="kicker inline-flex items-center gap-2 text-link">
+ {icon && <Icon name={icon} weight="duotone" size={15} />}
+ {kicker}
+ </p>
+ <h2 id={`${id}-title`} class="max-w-[22ch] text-balance text-3xl font-medium uppercase leading-[1.05] tracking-[-0.02em] md:text-[2.6rem]">
+ {title}
+ </h2>
+ </div>
+ {lede && <p class="max-w-[48ch] text-pretty text-[16px] leading-7 text-muted lg:pb-1 lg:text-right">{lede}</p>}
+ </header>
+ <slot />
+</section>
diff --git a/website/src/components/landing/Ways.astro b/website/src/components/landing/Ways.astro
new file mode 100644
index 0000000..df1eb6d
--- /dev/null
+++ b/website/src/components/landing/Ways.astro
@@ -0,0 +1,260 @@
+---
+// "Write it the way you already write UI": a language picker, and inside each language a
+// syntax switcher (Python: tkinter / Qt; Rust: rsx! / gpui / HTML builder; …). Each
+// syntax shows real code and a screenshot (light or dark, following the site's theme).
+// The language choice is shared with the docs' <LangTabs> (localStorage "bui:tabs:lang").
+import { Code } from "astro-expressive-code/components";
+import Icon from "../site/Icon.astro";
+import ThemedImage from "../docs/ThemedImage.astro";
+import { languages } from "./snippets";
+import { href, repoFile } from "../../lib/docs";
+---
+
+<div class="ways" data-ways>
+ <div role="tablist" aria-label="Language" class="ways-langs grid grid-flow-col overflow-x-auto border-b border-border [scrollbar-width:none] lg:auto-cols-fr">
+ {
+ languages.map((l, i) => (
+ <button
+ type="button"
+ role="tab"
+ id={`lang-tab-${l.id}`}
+ aria-controls={`lang-${l.id}`}
+ aria-selected={i === 0 ? "true" : "false"}
+ tabindex={i === 0 ? 0 : -1}
+ data-lang={l.tab}
+ class:list={["ways-lang", i < languages.length - 1 && "border-r"]}
+ >
+ <Icon name={l.icon} size={18} weight="duotone" />
+ <span>{l.tab}</span>
+ {l.syntaxes.length > 1 && <span class="ways-count tabular">{l.syntaxes.length}</span>}
+ </button>
+ ))
+ }
+ </div>
+
+ {
+ languages.map((l, li) => (
+ <div id={`lang-${l.id}`} role="tabpanel" aria-labelledby={`lang-tab-${l.id}`} hidden={li !== 0} class="ways-lang-panel" data-lang-panel>
+ {l.syntaxes.length > 1 && (
+ <div class="flex flex-wrap items-center gap-3 border-b border-border px-5 py-3 sm:px-8">
+ <span class="kicker text-muted">Syntax</span>
+ <div role="tablist" aria-label={`${l.tab} syntax`} class="ways-syntaxes" data-syntaxes>
+ {l.syntaxes.map((s, si) => (
+ <button
+ type="button"
+ role="tab"
+ id={`syn-tab-${l.id}-${s.id}`}
+ aria-controls={`syn-${l.id}-${s.id}`}
+ aria-selected={si === 0 ? "true" : "false"}
+ tabindex={si === 0 ? 0 : -1}
+ class="ways-syntax"
+ >
+ {s.label}
+ </button>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {l.syntaxes.map((s, si) => (
+ <div
+ id={`syn-${l.id}-${s.id}`}
+ role={l.syntaxes.length > 1 ? "tabpanel" : undefined}
+ aria-labelledby={l.syntaxes.length > 1 ? `syn-tab-${l.id}-${s.id}` : undefined}
+ hidden={si !== 0}
+ class="ways-panel grid lg:grid-cols-[minmax(0,1.1fr)_minmax(0,1fr)]"
+ data-syntax-panel
+ >
+ <div class="flex min-w-0 flex-col gap-5 border-border p-5 sm:p-8 lg:border-r">
+ <div class="flex flex-col gap-2">
+ <h3 class="text-xl font-semibold tracking-[-0.01em]">{s.title}</h3>
+ <p class="max-w-[62ch] text-[15px] leading-7 text-muted">{s.blurb}</p>
+ </div>
+ <Code code={s.code} lang={s.lang} title={s.file} />
+ <div class="flex flex-wrap items-center gap-x-5 gap-y-2 text-sm">
+ <a href={href(s.docs)} class="group inline-flex items-center gap-1.5 font-medium text-link">
+ Read the guide <Icon name="arrow-right" size={14} class="transition-transform duration-200 group-hover:translate-x-0.5" />
+ </a>
+ <a href={repoFile(s.source)} class="inline-flex items-center gap-1.5 text-muted hover:text-foreground">
+ <Icon name="file-code" size={14} />
+ <span class="font-mono text-[12.5px]">{s.source}</span>
+ </a>
+ </div>
+ </div>
+ <div class="ways-stage hatch flex min-w-0 flex-col items-center justify-center gap-4 border-t border-border p-6 sm:p-10 lg:border-t-0">
+ <figure class="flex w-full flex-col items-center gap-3">
+ <ThemedImage
+ shot={s.shot}
+ fallback={s.fallback}
+ alt={s.alt}
+ loading={li === 0 && si === 0 ? "eager" : "lazy"}
+ class="ways-img img-outline h-auto max-h-[520px] w-auto max-w-full object-contain"
+ />
+ <figcaption class="bg-background px-2 py-0.5 font-mono text-xs text-muted">{s.caption}</figcaption>
+ </figure>
+ <p class="max-w-full truncate border border-border bg-background px-2.5 py-1 font-mono text-xs text-muted">
+ <span class="text-accent">$</span> {s.install}
+ </p>
+ </div>
+ </div>
+ ))}
+ </div>
+ ))
+ }
+</div>
+
+<style>
+ .ways-lang {
+ position: relative;
+ display: inline-flex;
+ height: 3.25rem;
+ min-width: 8.5rem;
+ align-items: center;
+ justify-content: center;
+ gap: 0.55rem;
+ padding: 0 1.1rem;
+ white-space: nowrap;
+ font-size: 14px;
+ color: var(--muted);
+ border-color: var(--border);
+ transition:
+ background-color 160ms ease-out,
+ color 160ms ease-out;
+ }
+ .ways-lang:hover {
+ color: var(--foreground);
+ background: color-mix(in oklab, var(--foreground) 4%, transparent);
+ }
+ .ways-lang[aria-selected="true"] {
+ color: var(--primary-ink);
+ font-weight: 500;
+ background: var(--primary);
+ }
+ .ways-count {
+ display: inline-grid;
+ min-width: 1.15rem;
+ height: 1.15rem;
+ place-items: center;
+ font-size: 10.5px;
+ font-weight: 600;
+ border: 1px solid currentColor;
+ opacity: 0.6;
+ }
+ .ways-syntaxes {
+ display: inline-flex;
+ flex-wrap: wrap;
+ border: 1px solid var(--border);
+ background: var(--surface);
+ }
+ .ways-syntax {
+ position: relative;
+ height: 2rem;
+ padding: 0 0.85rem;
+ font-size: 13px;
+ color: var(--muted);
+ transition:
+ color 150ms ease-out,
+ background-color 150ms ease-out;
+ }
+ .ways-syntax + .ways-syntax {
+ border-left: 1px solid var(--border);
+ }
+ .ways-syntax:hover {
+ color: var(--foreground);
+ }
+ .ways-syntax[aria-selected="true"] {
+ color: var(--foreground);
+ font-weight: 500;
+ background: var(--background);
+ box-shadow: inset 0 -2px 0 var(--primary);
+ }
+ .ways-stage {
+ background-color: var(--stage);
+ }
+ .ways-stage :global(.ways-img) {
+ box-shadow: var(--shadow);
+ }
+ /* Panels slide in, gently */
+ :global(.motion) .ways-panel:not([hidden]) {
+ animation: ways-in 380ms var(--ease-out);
+ }
+ :global(.motion) .ways-panel:not([hidden]) :global(.ways-img) {
+ animation: ways-img-in 520ms var(--ease-out);
+ }
+ @keyframes ways-in {
+ from {
+ opacity: 0;
+ transform: translateY(6px);
+ }
+ }
+ @keyframes ways-img-in {
+ from {
+ opacity: 0;
+ transform: translateY(10px) scale(0.985);
+ }
+ }
+</style>
+
+<script>
+ const KEY = "bui:tabs:lang";
+
+ function activate(tabs: HTMLButtonElement[], tab: HTMLButtonElement, focus = false) {
+ for (const t of tabs) {
+ const on = t === tab;
+ t.setAttribute("aria-selected", String(on));
+ t.tabIndex = on ? 0 : -1;
+ const panel = document.getElementById(t.getAttribute("aria-controls")!);
+ if (panel) panel.hidden = !on;
+ }
+ if (focus) tab.focus();
+ // Keep the picked tab visible in a tab strip that scrolls sideways (phones), without
+ // scrolling the page.
+ const strip = tab.parentElement;
+ if (strip && strip.scrollWidth > strip.clientWidth) strip.scrollLeft = tab.offsetLeft - (strip.clientWidth - tab.offsetWidth) / 2;
+ }
+
+ function keys(list: HTMLElement, tabs: HTMLButtonElement[], onPick: (t: HTMLButtonElement) => void) {
+ list.addEventListener("keydown", (e) => {
+ const i = tabs.indexOf(document.activeElement as HTMLButtonElement);
+ if (i < 0) return;
+ const n =
+ e.key === "ArrowRight" ? (i + 1) % tabs.length : e.key === "ArrowLeft" ? (i - 1 + tabs.length) % tabs.length : e.key === "Home" ? 0 : e.key === "End" ? tabs.length - 1 : -1;
+ if (n >= 0) {
+ e.preventDefault();
+ activate(tabs, tabs[n], true);
+ onPick(tabs[n]);
+ }
+ });
+ }
+
+ document.querySelectorAll<HTMLElement>("[data-ways]").forEach((root) => {
+ const langList = root.querySelector<HTMLElement>(":scope > [role=tablist]")!;
+ const langs = [...langList.querySelectorAll<HTMLButtonElement>("[role=tab]")];
+ const remember = (t: HTMLButtonElement) => {
+ try {
+ localStorage.setItem(KEY, t.dataset.lang!);
+ } catch {}
+ };
+ langs.forEach((t) =>
+ t.addEventListener("click", () => {
+ activate(langs, t);
+ remember(t);
+ }),
+ );
+ keys(langList, langs, remember);
+
+ root.querySelectorAll<HTMLElement>("[data-syntaxes]").forEach((list) => {
+ const tabs = [...list.querySelectorAll<HTMLButtonElement>("[role=tab]")];
+ tabs.forEach((t) => t.addEventListener("click", () => activate(tabs, t)));
+ keys(list, tabs, () => {});
+ });
+
+ // Start on the language the reader picked here or in the docs.
+ let saved: string | null = null;
+ try {
+ saved = localStorage.getItem(KEY);
+ } catch {}
+ const start = langs.find((t) => t.dataset.lang === saved);
+ if (start) activate(langs, start);
+ });
+</script>
diff --git a/website/src/components/landing/snippets.ts b/website/src/components/landing/snippets.ts
new file mode 100644
index 0000000..514ac61
--- /dev/null
+++ b/website/src/components/landing/snippets.ts
@@ -0,0 +1,437 @@
+// The landing page's "Write it the way you already write UI" picker. Every snippet is
+// taken from the repository's README or docs (see `source`), so it matches what BUI runs.
+//
+// Screenshots: `shot` names a light/dark pair in public/images/shots/ (<shot>-light.png and
+// <shot>-dark.png, listed in public/images/shots/INDEX.md). The screenshot is a fuller app in
+// the same syntax as the snippet; `caption` names its source. `fallback` is only used if a
+// pair goes missing; see src/lib/shots.ts.
+
+export interface Syntax {
+ id: string;
+ /** The syntax switcher's label. */
+ label: string;
+ title: string;
+ blurb: string;
+ lang: string;
+ file: string;
+ code: string;
+ install: string;
+ shot: string;
+ fallback: string;
+ alt: string;
+ caption: string;
+ docs: string;
+ source: string;
+}
+
+export interface Language {
+ id: string;
+ tab: string;
+ icon: string;
+ syntaxes: Syntax[];
+}
+
+const tkinter: Syntax = {
+ id: "tkinter",
+ label: "tkinter",
+ title: "Your tkinter app, unchanged",
+ blurb:
+ "Every public tkinter and ttk name is there: 7,846 of 7,846. Run an existing program with blenderui-tk and it wakes up looking like Blender.",
+ lang: "py",
+ file: "greet.py",
+ code: `import blenderui.tksyntax as tk
+from blenderui.tksyntax import ttk, messagebox
+
+root = tk.Tk()
+name = tk.StringVar(value="Cube")
+ttk.Entry(root, textvariable=name).pack(fill="x", padx=8, pady=8)
+ttk.Button(root, text="Greet",
+ command=lambda: messagebox.showinfo("Hi", "Hello " + name.get())).pack()
+root.mainloop()`,
+ install: "pip install blenderui && blenderui-tk my_app.py",
+ shot: "python-tkinter",
+ fallback: "images/shots/python-tkinter-dark.png",
+ alt: "An unmodified tkinter program on BUI: a glTF export dialog with entries, check and radio buttons, a spinbox, an option menu, a scale and a listbox, drawn with Blender's widgets",
+ caption: "examples/site/tk_export.py, unmodified tkinter",
+ docs: "docs/python/tkinter/",
+ source: "README.md",
+};
+
+const qt: Syntax = {
+ id: "qt",
+ label: "Qt syntax",
+ title: "Qt-style Python, no Qt required",
+ blurb: "QWidget, layouts, signals and clicked.connect, drawn by BUI. The everyday subset works today; more is on the way.",
+ lang: "py",
+ file: "form.py",
+ code: `from blenderui.qtsyntax import (QApplication, QMainWindow, QWidget, QVBoxLayout,
+ QFormLayout, QLineEdit, QSlider, QProgressBar, Qt)
+
+app = QApplication([])
+win = QMainWindow()
+central = QWidget()
+layout = QVBoxLayout(central)
+
+form = QFormLayout()
+level = QSlider(Qt.Horizontal)
+level.setRange(0, 100)
+bar = QProgressBar()
+level.valueChanged.connect(bar.setValue) # signals connect to any callable
+form.addRow("Name:", QLineEdit())
+form.addRow("Level:", level)
+form.addRow("Progress:", bar)
+layout.addLayout(form)
+
+win.setCentralWidget(central)
+win.show()
+app.exec()`,
+ install: "pip install blenderui",
+ shot: "python-qt",
+ fallback: "images/shots/python-qt-dark.png",
+ alt: "A Qt-syntax material editor on BUI: a list, a line edit, a group box with a form layout, a combo box, a slider with a spin box, a check box and a progress bar",
+ caption: "examples/site/qt_material.py",
+ docs: "docs/python/qt-syntax/",
+ source: "docs/qt.md",
+};
+
+const rsx: Syntax = {
+ id: "rsx",
+ label: "rsx!",
+ title: "HTML, CSS and Tailwind, natively",
+ blurb:
+ "rsx!, components and hooks, all 113 HTML elements and modern CSS. Add <NumberSlider> and you get Blender's real slider. Typos in Tailwind classes fail to compile, politely.",
+ lang: "rust",
+ file: "src/main.rs",
+ code: `use blenderui::prelude::*;
+
+struct Hello;
+
+impl Render for Hello {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ rsx! {
+ <body m-0 p-6 flex flex-col gap-4 bg-zinc-900 text-white>
+ <h1 text-2xl font-bold>"Hello, BUI"</h1>
+ <NumberSlider min={0.0} max={10.0} value="5" /> // a real Blender slider
+ </body>
+ }
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Hello)).unwrap();
+ });
+}`,
+ install: "cargo add blenderui",
+ shot: "rust-rsx-dashboard",
+ fallback: "images/shots/rust-rsx-dashboard-dark.png",
+ alt: "A render-farm dashboard written with rsx!: a CSS grid of stat cards, job rows with Blender progress bars, a node list, a Blender dropdown, button and checkbox",
+ caption: "examples/site_dashboard.rs, rsx!",
+ docs: "docs/rust/rsx-and-components/",
+ source: "README.md",
+};
+
+const gpui: Syntax = {
+ id: "gpui",
+ label: "gpui builders",
+ title: "gpui code compiles unchanged",
+ blurb:
+ "The same file builds against Zed's gpui, gpui-fast and blenderui. This is the benchmark's settings window: on blenderui it shows its first frame in 40 ms instead of 231 ms.",
+ lang: "rust",
+ file: "settings.rs",
+ code: `impl Render for Settings {
+ fn render(&mut self, window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
+ let field = |label: &'static str| {
+ div().flex().items_center().gap(px(8.0))
+ .child(div().w(px(70.0)).text_color(rgb(0xb8b8b8)).child(label))
+ .child(div().flex_1().h(px(20.0)).px(px(6.0)).rounded(px(4.0)).bg(rgb(0x1d1d1d))
+ .border_1().border_color(rgb(0x3d3d3d)).text_color(rgb(0xe6e6e6)).child("Cube"))
+ };
+ div()
+ .size_full().flex().flex_col().gap(px(8.0)).p(px(12.0))
+ .bg(rgb(0x303030)).text_color(rgb(0xe6e6e6)).text_size(px(13.0))
+ .child(div().text_size(px(16.0)).child("Settings"))
+ .child(field("Name"))
+ .child(div().w(px(80.0)).h(px(22.0)).rounded(px(4.0)).bg(rgb(0x545454))
+ .flex().items_center().justify_center().child("Apply"))
+ }
+}`,
+ install: "cargo add blenderui",
+ shot: "rust-builder-dashboard",
+ fallback: "images/shots/rust-builder-dashboard-dark.png",
+ alt: "The same render-farm dashboard written with gpui-style builders, drawn with identical pixels",
+ caption: "examples/site_dashboard_builder.rs, gpui builders",
+ docs: "docs/rust/gpui-syntax/",
+ source: "bindings/rust/bench/common/settings.rs",
+};
+
+const htmlBuilder: Syntax = {
+ id: "html",
+ label: "HTML builder",
+ title: "Plain HTML elements, as functions",
+ blurb:
+ "One constructor per HTML element (h2(), ul(), input(), button() …) and gpui's app model. Elements with an id keep their state across renders; cx.notify() re-renders.",
+ lang: "rust",
+ file: "src/todo.rs",
+ code: `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();
+ }))))
+ }
+}`,
+ install: "cargo add blenderui",
+ shot: "rust-html-plain",
+ fallback: "images/shots/rust-html-plain-dark.png",
+ alt: "An export form and a table built from plain HTML element functions, with a browser's default look",
+ caption: "examples/site_plain_html.rs, plain HTML",
+ docs: "docs/rust/html-elements/",
+ source: "docs/rust.md",
+};
+
+const react: Syntax = {
+ id: "react",
+ label: "React (JSX)",
+ title: "React, without a browser",
+ blurb:
+ "React 19.3 renders straight to BUI on Node.js or Bun. Hooks keep React's names but hold signals, so a change can update one node without a re-render.",
+ lang: "jsx",
+ file: "app.jsx",
+ code: `/** @jsxImportSource @blender-ui/react */
+import { render, useState, NumberSlider } from "@blender-ui/react"
+
+function Counter() {
+ const [count, setCount] = useState(0)
+ return (
+ <main styled className="p-6 flex flex-col gap-3">
+ <span>Clicks: {count}</span>
+ <button onClick={() => setCount((c) => c + 1)}>Add one</button>
+ <NumberSlider min={0} max={10} />
+ </main>
+ )
+}
+
+render(<Counter />, { title: "Counter", width: 360, height: 200, gpu: true })`,
+ install: "npm install @blender-ui/react react",
+ shot: "js-react-tasks",
+ fallback: "images/shots/js-react-tasks-dark.png",
+ alt: "A task list in React on BUI: a Blender text field and button, checkboxes and a progress bar",
+ caption: "examples/site/js/todo_react.js, React on BUI",
+ docs: "docs/javascript/react/",
+ source: "README.md",
+};
+
+const dom: Syntax = {
+ id: "dom",
+ label: "DOM-like API",
+ title: "A DOM you already know, minus the browser",
+ blurb:
+ "createElement, appendChild, addEventListener and className with Tailwind. Any attribute can be a signal: bind it once and the node follows.",
+ lang: "js",
+ file: "app.js",
+ code: `const { App, signal } = require('@blender-ui/native')
+
+const app = new App({ gpu: true })
+const win = app.window({ title: 'Hello', width: 360, height: 220 })
+win.body.setAttribute('styled', '') // Blender's look for the page
+win.body.className = 'm-0 p-6 flex flex-col gap-3 bg-[#2b2b2b] text-[#e6e6e6]'
+
+const clicks = signal(0)
+const label = win.createElement('span')
+label.textContent = clicks // bound: follows the signal
+const button = win.createElement('button')
+button.textContent = 'Add one'
+button.addEventListener('click', () => clicks.value++)
+win.body.appendChild(label)
+win.body.appendChild(button)`,
+ install: "npm install @blender-ui/native",
+ shot: "js-dom-tasks",
+ fallback: "images/shots/js-dom-tasks-dark.png",
+ alt: "The same task list built with createElement, appendChild and addEventListener",
+ caption: "examples/site/js/todo_dom.js, @blender-ui/native",
+ docs: "docs/javascript/native-api/",
+ source: "docs/javascript.md",
+};
+
+const imguiCpp: Syntax = {
+ id: "cpp",
+ label: "C++",
+ title: "The real Dear ImGui, in Blender's clothes",
+ blurb:
+ "Existing ImGui code compiles unchanged. Flip one build option (BUI_IMGUI_BLENDER_WIDGETS) and DragFloat becomes Blender's drag-to-scrub field.",
+ lang: "cpp",
+ file: "imgui_demo.cpp",
+ code: `#include "imgui.h"
+#include "imgui_impl_bui.h"
+
+static void frame(void*) { ImGui::ShowDemoWindow(); }
+
+int main() {
+ ImGui::CreateContext();
+ ImGui_ImplBUI_App* app = ImGui_ImplBUI_CreateApp("Dear ImGui on BUI", 1280, 800, frame, nullptr);
+ ImGui_ImplBUI_RunApp(app); // BUI's message loop until the window closes
+ ImGui_ImplBUI_DestroyApp(app);
+ ImGui::DestroyContext();
+}`,
+ install: "cmake -S . -B build -DBUI_IMGUI_BLENDER_WIDGETS=ON && cmake --build build",
+ shot: "imgui-cpp-blender",
+ fallback: "images/shots/imgui-cpp-blender-dark.png",
+ alt: "A Dear ImGui scene inspector drawn with Blender's widgets and style: a table, drag fields, a color edit, sliders, a combo, checkboxes, a progress bar and a plot",
+ caption: "examples/site/imgui_inspector.cpp, BUI_IMGUI_BLENDER_WIDGETS=ON",
+ docs: "docs/imgui/cpp/",
+ source: "docs/imgui.md",
+};
+
+const imguiC: Syntax = {
+ id: "c",
+ label: "C",
+ title: "All 399 functions, from C",
+ blurb: "cimgui conventions: ImGui::Button is ImGui_Button, references become pointers, every struct keeps its C++ layout.",
+ lang: "c",
+ file: "imgui_demo_c.c",
+ code: `#include "cimgui.h"
+#include "cimgui_impl_bui.h"
+
+static void frame(void* user)
+{
+ float* value = (float*)user;
+ ImGui_ShowDemoWindow();
+ ImGui_Begin("Hello");
+ ImGui_SliderFloat("Value", value, 0.0f, 1.0f);
+ ImGui_Text("%.2f", *value);
+ ImGui_End();
+}
+
+int main(void)
+{
+ float value = 0.5f;
+ ImGui_CreateContext();
+ cImGui_ImplBUI_App* app = cImGui_ImplBUI_CreateApp("Hello", 1280, 800, frame, &value, NULL);
+ cImGui_ImplBUI_RunApp(app);
+ cImGui_ImplBUI_DestroyApp(app);
+ ImGui_DestroyContext();
+}`,
+ install: "cmake -S . -B build && cmake --build build --target bui_imgui_demo_c",
+ shot: "imgui-cpp-stock",
+ fallback: "images/shots/imgui-cpp-stock-dark.png",
+ alt: "The same Dear ImGui scene inspector with ImGui's own widgets and its StyleColorsDark / StyleColorsLight colors",
+ caption: "ImGui's own widgets and colors (examples/site/imgui_inspector.cpp --stock)",
+ docs: "docs/imgui/c/",
+ source: "docs/imgui.md",
+};
+
+const imguiPy: Syntax = {
+ id: "python",
+ label: "Python",
+ title: "pyimgui-style Python",
+ blurb: "snake_case functions; an in/out value comes back after the result: changed, v = imgui.slider_float(…).",
+ lang: "py",
+ file: "hello_imgui.py",
+ code: `import blenderui.imgui as imgui
+
+state = {"value": 0.5}
+
+def frame():
+ imgui.show_demo_window()
+ imgui.begin("Hello")
+ _, state["value"] = imgui.slider_float("Value", state["value"], 0.0, 1.0)
+ imgui.end()
+
+imgui.run(frame, title="Hello", size=(1280, 800))`,
+ install: "pip install blenderui",
+ shot: "imgui-python-blender",
+ fallback: "images/shots/imgui-python-blender-dark.png",
+ alt: "The Dear ImGui scene inspector from Python, with Blender's widgets and style",
+ caption: "examples/site/imgui_inspector.py, blenderui.imgui",
+ docs: "docs/imgui/python/",
+ source: "docs/imgui.md",
+};
+
+const imguiRust: Syntax = {
+ id: "rust",
+ label: "Rust",
+ title: "A safe Rust API, and the raw FFI",
+ blurb: "&mut values for in/out arguments, &str for strings, slices for (pointer, count) pairs. imgui::sys has every C function.",
+ lang: "rust",
+ file: "src/main.rs",
+ code: `use blenderui_imgui as imgui;
+
+fn main() {
+ let mut value = 0.5f32;
+ imgui::run("Hello", [1280, 800], move || {
+ imgui::show_demo_window();
+ imgui::begin("Hello");
+ imgui::slider_float("Value", &mut value, 0.0, 1.0);
+ if imgui::button("Reset") {
+ value = 0.5;
+ }
+ imgui::text(&format!("value {value:.2}"));
+ imgui::end();
+ });
+}`,
+ install: "cargo run -p blenderui-imgui --example demo",
+ shot: "imgui-python-stock",
+ fallback: "images/shots/imgui-python-stock-dark.png",
+ alt: "The Dear ImGui scene inspector with ImGui's own widgets and colors",
+ caption: "The scene inspector, ImGui's own style (examples/site/imgui_inspector.py)",
+ docs: "docs/imgui/rust/",
+ source: "docs/imgui.md",
+};
+
+const c: Syntax = {
+ id: "kit",
+ label: "C kit",
+ title: "The kit itself, in C",
+ blurb: "Everything above sits on one C runtime. Build a node tree, set properties, and open a native window.",
+ lang: "c",
+ file: "hello.c",
+ code: `#include "BUI_kit.h"
+
+int main(void)
+{
+ BKNode *root = BK_node_new("frame");
+ BKNode *size = BK_node_new("slider");
+ BK_set_str(size, "label", "Size");
+ BK_set_num(size, "max", 10);
+ BK_set_num(size, "value", 2.5);
+ BK_node_add(root, size, -1); /* -1: append */
+ BK_geom_set_manager(size, BK_GEOM_PACK); /* Tk's packer */
+
+ BKContext *ctx = BK_context_new(root);
+ BKHost host = {0}; /* the window fills it in */
+ BK_context_set_host(ctx, &host);
+ BKWindow *win = BK_window_new(ctx, "BUI from C", 320, 120);
+ BK_window_show(win);
+ BK_window_run();
+ return 0;
+}`,
+ install: "cmake -S . -B build && cmake --build build",
+ shot: "c-kit-app",
+ fallback: "images/shots/c-kit-app-dark.png",
+ alt: "A modifier stack from the C kit: panels, enum rows, number fields, dropdowns, a slider, checkboxes and buttons",
+ caption: "examples/site/kit_modifiers.c, the C kit",
+ docs: "docs/c/c-api/",
+ source: "docs/c-api.md",
+};
+
+export const languages: Language[] = [
+ { id: "python", tab: "Python", icon: "file-py", syntaxes: [tkinter, qt] },
+ { id: "rust", tab: "Rust", icon: "file-rs", syntaxes: [rsx, gpui, htmlBuilder] },
+ { id: "javascript", tab: "JavaScript", icon: "file-js", syntaxes: [react, dom] },
+ { id: "imgui", tab: "Dear ImGui", icon: "squares-four", syntaxes: [imguiCpp, imguiC, imguiPy, imguiRust] },
+ { id: "c", tab: "C", icon: "file-c", syntaxes: [c] },
+];
diff --git a/website/src/components/site/Footer.astro b/website/src/components/site/Footer.astro
new file mode 100644
index 0000000..1deead4
--- /dev/null
+++ b/website/src/components/site/Footer.astro
@@ -0,0 +1,73 @@
+---
+import Logo from "./Logo.astro";
+import { site } from "../../config/site";
+import { href } from "../../lib/docs";
+
+const groups = [
+ {
+ title: "Learn",
+ links: [
+ ["Introduction", href("docs/start/introduction/")],
+ ["Installation", href("docs/start/installation/")],
+ ["Your first app", href("docs/tutorials/first-app-python/")],
+ ["Roadmap", href("docs/project/roadmap/")],
+ ],
+ },
+ {
+ title: "Packages",
+ links: [
+ ["blenderui on PyPI", site.pypi],
+ ["@blender-ui/react", site.npm],
+ ["@blender-ui/native", "https://www.npmjs.com/package/@blender-ui/native"],
+ ],
+ },
+ {
+ title: "Project",
+ links: [
+ ["Source on GitHub", site.repo],
+ ["Changelog", `${site.blobBase}CHANGELOG.md`],
+ ["Contributing", `${site.blobBase}CONTRIBUTING.md`],
+ ["Report an issue", `${site.repo}/issues`],
+ ],
+ },
+] as const;
+---
+
+<footer class="border-t border-border">
+ <div class="hatch h-10 border-b border-border" aria-hidden="true"></div>
+ <div class="grid grid-cols-2 md:grid-cols-[1.4fr_1fr_1fr_1fr]">
+ <section class="col-span-2 flex flex-col gap-4 border-b border-border p-6 md:col-span-1 md:border-r md:border-b-0 md:p-8">
+ <Logo size={30} />
+ <p class="max-w-xs text-balance text-sm leading-6 text-muted">
+ Blender's interface, as a library. Built on Blender's source, so it shares Blender's license:
+ {site.license}.
+ </p>
+ </section>
+ {
+ groups.map((group, i) => (
+ <section
+ class:list={[
+ "border-border p-6 md:p-8",
+ i < groups.length - 1 && "border-r",
+ i === groups.length - 1 && "col-span-2 border-t md:col-span-1 md:border-t-0",
+ ]}
+ >
+ <h2 class="kicker mb-4 text-muted">{group.title}</h2>
+ <ul class="flex flex-col gap-2.5 text-sm">
+ {group.links.map(([label, url]) => (
+ <li>
+ <a href={url} class="underline-offset-4 hover:text-link hover:underline">
+ {label}
+ </a>
+ </li>
+ ))}
+ </ul>
+ </section>
+ ))
+ }
+ </div>
+ <div class="flex flex-col gap-1 border-t border-border px-6 py-4 text-xs text-muted sm:flex-row sm:justify-between md:px-8">
+ <p>BUI is an independent project. Blender is a trademark of the Blender Foundation.</p>
+ <p>No default cubes were harmed in the making of this site.</p>
+ </div>
+</footer>
diff --git a/website/src/components/site/Header.astro b/website/src/components/site/Header.astro
new file mode 100644
index 0000000..5377ecb
--- /dev/null
+++ b/website/src/components/site/Header.astro
@@ -0,0 +1,159 @@
+---
+// The top bar: product-level areas (Docs, Tutorials, Benchmarks, Roadmap), search, theme
+// and GitHub. The pages themselves live in the docs sidebar, not here.
+import Logo from "./Logo.astro";
+import Icon from "./Icon.astro";
+import ThemeToggle from "./ThemeToggle.astro";
+import { topLinks } from "../../config/nav";
+import { site } from "../../config/site";
+import { href } from "../../lib/docs";
+
+interface Props {
+ /** On docs pages the menu button opens the sidebar; elsewhere it opens the top links. */
+ menuTarget?: string;
+ /** Label of the current top link, if any. */
+ current?: string;
+}
+
+const { menuTarget = "site-menu", current = "" } = Astro.props;
+---
+
+<header
+ class="site-header sticky top-0 z-40 flex h-(--header-h) items-center gap-1 border-b border-border bg-background/85 px-3 backdrop-blur-md sm:gap-2 sm:px-4"
+>
+ <button
+ type="button"
+ class="inline-flex size-10 items-center justify-center text-muted transition-[background-color,color] duration-150 ease-out hover:bg-foreground/6 hover:text-foreground md:hidden"
+ aria-label="Open menu"
+ aria-expanded="false"
+ aria-controls={menuTarget}
+ data-menu-toggle
+ >
+ <Icon name="list" size={20} class="menu-open" />
+ <Icon name="x" size={20} class="menu-close hidden" />
+ </button>
+
+ <a href={href("")} class="mr-3 inline-flex h-10 items-center px-1">
+ <Logo size={26} />
+ </a>
+
+ <nav aria-label="Main" class="hidden h-full items-stretch md:flex">
+ {
+ topLinks.map((link) => (
+ <a href={href(link.href)} aria-current={current === link.label ? "page" : undefined} class="top-link">
+ {link.label}
+ </a>
+ ))
+ }
+ </nav>
+
+ <button
+ type="button"
+ data-search-open
+ class="ml-auto inline-flex h-9 min-w-10 items-center justify-center gap-2 border border-border bg-background px-3 text-sm text-muted transition-[background-color,color,border-color] duration-150 ease-out hover:border-border-strong hover:text-foreground sm:min-w-60 sm:justify-start"
+ aria-label="Search the docs"
+ aria-keyshortcuts="Control+K Meta+K"
+ >
+ <Icon name="magnifying-glass" size={16} />
+ <span class="hidden sm:inline">Search docs</span>
+ <kbd class="ml-auto hidden border border-border bg-surface px-1.5 font-sans text-[11px] leading-5 sm:inline" data-mod-key>Ctrl K</kbd>
+ </button>
+
+ <ThemeToggle />
+
+ <a
+ href={site.repo}
+ class="inline-flex size-10 items-center justify-center text-muted transition-[background-color,color] duration-150 ease-out hover:bg-foreground/6 hover:text-foreground"
+ aria-label="BUI on GitHub"
+ >
+ <Icon name="github-logo" size={19} />
+ </a>
+</header>
+
+{
+ menuTarget === "site-menu" && (
+ <nav id="site-menu" aria-label="Main" class="fixed inset-x-0 top-(--header-h) bottom-0 z-30 bg-background md:hidden" data-menu>
+ <ul class="flex flex-col border-b border-border p-3">
+ {topLinks.map((link) => (
+ <li>
+ <a href={href(link.href)} class="flex min-h-12 items-center px-3 text-base hover:bg-foreground/6">
+ {link.label}
+ </a>
+ </li>
+ ))}
+ <li>
+ <a href={site.repo} class="flex min-h-12 items-center gap-2 px-3 text-base hover:bg-foreground/6">
+ <Icon name="github-logo" size={18} /> GitHub
+ </a>
+ </li>
+ </ul>
+ <div class="hatch h-10 border-b border-border" aria-hidden="true" />
+ </nav>
+ )
+}
+
+<style>
+ .top-link {
+ position: relative;
+ display: inline-flex;
+ align-items: center;
+ padding: 0 0.8rem;
+ font-size: 14px;
+ color: var(--muted);
+ transition: color 150ms ease-out;
+ }
+ .top-link::after {
+ content: "";
+ position: absolute;
+ left: 0.8rem;
+ right: 0.8rem;
+ bottom: -1px;
+ height: 2px;
+ background: var(--primary);
+ transform: scaleX(0);
+ transition: transform 220ms var(--ease-out);
+ }
+ .top-link:hover {
+ color: var(--foreground);
+ }
+ .top-link:hover::after {
+ transform: scaleX(0.35);
+ opacity: 0.6;
+ }
+ .top-link[aria-current="page"] {
+ color: var(--foreground);
+ font-weight: 500;
+ }
+ .top-link[aria-current="page"]::after {
+ transform: scaleX(1);
+ opacity: 1;
+ }
+</style>
+
+<script>
+ // Show the right shortcut on Macs.
+ if (/Mac|iPhone|iPad/.test(navigator.platform)) document.querySelectorAll("[data-mod-key]").forEach((k) => (k.textContent = "⌘ K"));
+
+ const toggle = document.querySelector<HTMLButtonElement>("[data-menu-toggle]");
+ if (toggle) {
+ const target = document.getElementById(toggle.getAttribute("aria-controls") ?? "");
+ const set = (open: boolean) => {
+ if (!target) return;
+ toggle.setAttribute("aria-expanded", String(open));
+ toggle.setAttribute("aria-label", open ? "Close menu" : "Open menu");
+ toggle.querySelector(".menu-open")?.classList.toggle("hidden", open);
+ toggle.querySelector(".menu-close")?.classList.toggle("hidden", !open);
+ target.toggleAttribute("data-open", open);
+ document.documentElement.classList.toggle("overflow-hidden", open);
+ if (open) target.querySelector("[aria-current=page]")?.scrollIntoView({ block: "center" });
+ };
+ toggle.addEventListener("click", () => set(toggle.getAttribute("aria-expanded") !== "true"));
+ document.addEventListener("keydown", (e) => {
+ if (e.key === "Escape" && toggle.getAttribute("aria-expanded") === "true") {
+ set(false);
+ toggle.focus();
+ }
+ });
+ matchMedia("(min-width: 768px)").addEventListener("change", (e) => e.matches && set(false));
+ }
+</script>
diff --git a/website/src/components/site/Icon.astro b/website/src/components/site/Icon.astro
new file mode 100644
index 0000000..b69c541
--- /dev/null
+++ b/website/src/components/site/Icon.astro
@@ -0,0 +1,92 @@
+---
+/**
+ * Phosphor icons (https://phosphoricons.com, MIT), inlined at build time from
+ * @phosphor-icons/core. No icon font, no runtime JavaScript.
+ *
+ * <Icon name="check-circle" /> any Phosphor name
+ * <Icon name="flask" weight="duotone" size={20} /> thin | light | regular | bold | fill | duotone
+ * <Icon name="github" label="GitHub" /> with `label` it's announced; without, it's decorative
+ *
+ * A few short aliases are kept for older pages (book, zap, layers, terminal …), see `aliases`.
+ * A misspelled name fails the build, so typos never ship as blank squares.
+ */
+import { readFileSync } from "node:fs";
+import { createRequire } from "node:module";
+
+export type IconWeight = "thin" | "light" | "regular" | "bold" | "fill" | "duotone";
+
+/** Short names used across the site and in MDX, mapped to Phosphor names. */
+const aliases = {
+ search: "magnifying-glass",
+ menu: "list",
+ github: "github-logo",
+ edit: "pencil-simple",
+ alert: "warning",
+ bulb: "lightbulb",
+ smile: "smiley",
+ "chevron-right": "caret-right",
+ "chevron-down": "caret-down",
+ book: "book-open-text",
+ terminal: "terminal-window",
+ sparkles: "sparkle",
+ zap: "lightning",
+ layers: "stack",
+ undo: "arrow-counter-clockwise",
+ redo: "arrow-clockwise",
+ soon: "hourglass-medium",
+ copy: "copy-simple",
+} as const;
+
+export type IconAlias = keyof typeof aliases;
+/** Any alias or Phosphor icon name (e.g. "check-circle", "flask", "rocket-launch"). */
+export type IconName = IconAlias | (string & {});
+
+interface Props {
+ name: IconName;
+ weight?: IconWeight;
+ size?: number;
+ class?: string;
+ label?: string;
+}
+
+const { name, weight = "regular", size = 16, class: className, label } = Astro.props;
+
+const require = createRequire(import.meta.url);
+const cache: Map<string, string> = ((globalThis as any).__buiIcons ??= new Map());
+
+function load(icon: string, w: IconWeight): string {
+ const key = `${w}/${icon}`;
+ let svg = cache.get(key);
+ if (svg === undefined) {
+ const file = w === "regular" ? `${icon}.svg` : `${icon}-${w}.svg`;
+ let path: string;
+ try {
+ path = require.resolve(`@phosphor-icons/core/assets/${w}/${file}`);
+ } catch {
+ throw new Error(`<Icon>: no Phosphor icon "${icon}" (${w}). Browse names at https://phosphoricons.com`);
+ }
+ svg = readFileSync(path, "utf8")
+ .replace(/^[\s\S]*?<svg[^>]*>/, "")
+ .replace(/<\/svg>\s*$/, "");
+ cache.set(key, svg);
+ }
+ return svg;
+}
+
+const resolved = (aliases as Record<string, string>)[name] ?? name;
+const inner = load(resolved, weight);
+---
+
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ width={size}
+ height={size}
+ viewBox="0 0 256 256"
+ fill="currentColor"
+ class:list={["icon shrink-0", className]}
+ aria-hidden={label ? undefined : "true"}
+ aria-label={label}
+ role={label ? "img" : undefined}
+ focusable="false"
+ set:html={inner}
+/>
diff --git a/website/src/components/site/Logo.astro b/website/src/components/site/Logo.astro
new file mode 100644
index 0000000..291327c
--- /dev/null
+++ b/website/src/components/site/Logo.astro
@@ -0,0 +1,14 @@
+---
+// BUI's mark: public/logo.png (generated from the repo's public/Logo.png).
+// The letters are the wordmark, so `size` is the logo's height.
+import { href } from "../../lib/docs";
+
+interface Props {
+ size?: number;
+ class?: string;
+}
+const { size = 24, class: className } = Astro.props;
+const width = Math.round((size * 940) / 769);
+---
+
+<img src={href("logo.png")} width={width} height={size} alt="BUI" class:list={["shrink-0 select-none", className]} draggable="false" />
diff --git a/website/src/components/site/SearchPalette.astro b/website/src/components/site/SearchPalette.astro
new file mode 100644
index 0000000..126c506
--- /dev/null
+++ b/website/src/components/site/SearchPalette.astro
@@ -0,0 +1,309 @@
+---
+// Ctrl+K / Cmd+K / "/" search. The index (/search.json) is fetched the first time it opens.
+// Matching is Blender's own menu search (src/lib/string-search.ts): word starts, initials
+// ("gs" finds "gpui syntax"), typos, and your recent picks first.
+import Icon from "./Icon.astro";
+import { href } from "../../lib/docs";
+---
+
+<dialog
+ id="search"
+ aria-label="Search the docs"
+ class="search-dialog m-0 h-full max-h-none w-full max-w-none bg-transparent p-0 backdrop:bg-black/45 backdrop:backdrop-blur-[3px] open:flex sm:items-start sm:justify-center sm:px-4 sm:pt-[11vh]"
+ data-index={href("search.json")}
+>
+ <div class="search-panel flex h-full w-full flex-col border-border bg-background text-foreground shadow-[0_32px_80px_-28px_rgb(0_0_0/0.55)] sm:h-auto sm:max-h-[74vh] sm:max-w-2xl sm:border" data-panel>
+ <div class="search-row flex items-center gap-3 border-b border-border px-4">
+ <Icon name="magnifying-glass" size={19} class="search-glass shrink-0 text-muted transition-colors duration-150" />
+ <label for="search-input" class="sr-only">Search</label>
+ <input
+ id="search-input"
+ type="search"
+ autocomplete="off"
+ spellcheck="false"
+ placeholder="Search the docs: “drag scrub”, “tw cls”, “instal”…"
+ class="h-14 min-w-0 flex-1 bg-transparent text-base caret-[var(--primary)] outline-none focus:outline-none focus-visible:outline-none placeholder:text-muted [&::-webkit-search-cancel-button]:hidden"
+ role="combobox"
+ aria-expanded="true"
+ aria-controls="search-results"
+ aria-autocomplete="list"
+ />
+ <button type="button" data-search-close class="inline-flex h-7 items-center border border-border px-2 text-xs text-muted transition-colors hover:text-foreground">
+ Esc
+ </button>
+ </div>
+ <ul id="search-results" role="listbox" aria-label="Results" class="min-h-0 flex-1 overflow-y-auto overscroll-contain p-2"></ul>
+ <div class="hidden items-center gap-4 border-t border-border bg-surface/60 px-4 py-2 text-xs text-muted sm:flex">
+ <span class="inline-flex items-center gap-1"><kbd class="sk">↑</kbd><kbd class="sk">↓</kbd> move</span>
+ <span class="inline-flex items-center gap-1"><kbd class="sk">Enter</kbd> open</span>
+ <span class="ml-auto inline-flex items-center gap-1.5">
+ <Icon name="lightning" size={13} />
+ Blender's menu search, ported: typos and initials welcome
+ </span>
+ </div>
+ </div>
+</dialog>
+<template id="sr-icons"
+ ><span data-k="page"><Icon name="file-text" size={16} /></span><span data-k="section"><Icon name="hash" size={16} /></span><span data-k="recent"
+ ><Icon name="clock-counter-clockwise" size={16} /></span
+ ><span data-k="go"><Icon name="arrow-elbow-down-left" size={14} /></span></template
+>
+
+<style>
+ .search-dialog:not([open]) {
+ display: none;
+ }
+ .search-dialog[open] .search-panel {
+ animation: search-in 180ms var(--ease-out);
+ }
+ @keyframes search-in {
+ from {
+ opacity: 0;
+ transform: translateY(-6px) scale(0.99);
+ }
+ }
+ /* Focus shows as a lit glass, not a ring around the field. */
+ .search-row:focus-within :global(.search-glass) {
+ color: var(--primary);
+ }
+ .sk {
+ min-width: 1.25rem;
+ padding: 0 0.3rem;
+ text-align: center;
+ font-family: var(--font-sans);
+ border: 1px solid var(--border);
+ background: var(--background);
+ }
+ :global(#search-results mark) {
+ background: none;
+ color: var(--link);
+ font-weight: 600;
+ }
+ :global(#search-results [aria-selected="true"] > a) {
+ background: var(--primary-soft);
+ }
+ :global(#search-results [aria-selected="true"] .sr-go) {
+ opacity: 1;
+ }
+</style>
+
+<script>
+ import { StringSearch, localRecentCache } from "../../lib/string-search";
+
+ interface Rec {
+ t: string;
+ h: string;
+ u: string;
+ s: string;
+ x: string;
+ st?: string;
+ }
+
+ const dialog = document.getElementById("search") as HTMLDialogElement | null;
+ const input = document.getElementById("search-input") as HTMLInputElement | null;
+ const list = document.getElementById("search-results") as HTMLUListElement | null;
+
+ const SEP = " ▸ ";
+ const key = (r: Rec) => [r.s, r.t, r.h].filter(Boolean).join(SEP);
+
+ if (dialog && input && list) {
+ const recent = localRecentCache("bui:search-recent", 30);
+ let index: Rec[] | null = null;
+ let engine: StringSearch<Rec> | null = null;
+ let loading: Promise<void> | null = null;
+ let results: { rec: Rec; recent?: boolean }[] = [];
+ let cursor = 0;
+ let opener: HTMLElement | null = null;
+
+ const build = () => {
+ if (!index) return;
+ engine = new StringSearch<Rec>("last", recent);
+ // Whole pages weigh more than their sections; unbuilt pages a little less.
+ for (const r of index) engine.add(key(r), r, (r.h ? 0 : 2) - (r.st === "coming-soon" ? 1 : 0));
+ };
+
+ const load = () =>
+ (loading ??= fetch(dialog.dataset.index!)
+ .then((r) => r.json())
+ .then((data: Rec[]) => {
+ index = data;
+ build();
+ })
+ .catch(() => {
+ index = [];
+ }));
+
+ const tpl = document.getElementById("sr-icons") as HTMLTemplateElement | null;
+ const icon = (k: string) => tpl?.content.querySelector(`[data-k="${k}"]`)?.innerHTML ?? "";
+ const esc = (s: string) => s.replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c]!);
+ const reEsc = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+
+ /** Marks the start of words that begin with a query word. */
+ function mark(text: string, words: string[]) {
+ let out = esc(text);
+ const ws = words.filter((w) => w.length > 0).sort((a, b) => b.length - a.length);
+ if (!ws.length) return out;
+ const re = new RegExp(`(^|[\\s\\-_/(.:,])(${ws.map((w) => reEsc(esc(w))).join("|")})`, "gi");
+ return out.replace(re, "$1<mark>$2</mark>");
+ }
+
+ function snippet(rec: Rec, words: string[]) {
+ const text = rec.x;
+ const lower = text.toLowerCase();
+ let at = -1;
+ for (const w of words) {
+ at = lower.indexOf(w);
+ if (at >= 0) break;
+ }
+ const start = Math.max(0, at - 40);
+ const body = (start > 0 ? "…" : "") + text.slice(start, start + 150) + (text.length > start + 150 ? "…" : "");
+ return mark(body, words);
+ }
+
+ function search(q: string) {
+ const words = q.toLowerCase().split(/[\s\-_/]+/).filter(Boolean);
+ if (!engine || !index) return { words, found: [] as { rec: Rec; recent?: boolean }[] };
+ if (!words.length) {
+ // Recent picks first (Blender's recent_searches), then every page once, in reading order.
+ const recents = recent
+ .list()
+ .map((k) => index!.find((r) => key(r) === k))
+ .filter((r): r is Rec => Boolean(r))
+ .slice(0, 5);
+ const pages = index.filter((r) => !r.h && !recents.includes(r)).slice(0, 10 - recents.length);
+ return { words, found: [...recents.map((rec) => ({ rec, recent: true })), ...pages.map((rec) => ({ rec }))] };
+ }
+ const titled = engine.query(q).slice(0, 18);
+ const seen = new Set(titled);
+ // Then pages whose text has every word, for things only the body mentions.
+ const inText = index.filter((r) => !seen.has(r) && words.every((w) => r.x.toLowerCase().includes(w))).slice(0, 24 - titled.length);
+ return { words, found: [...titled, ...inText].map((rec) => ({ rec })) };
+ }
+
+ function render() {
+ const q = input!.value.trim();
+ if (!index) {
+ list!.innerHTML = `<li class="px-3 py-8 text-center text-sm text-muted">Loading the index…</li>`;
+ return;
+ }
+ const { words, found } = search(q);
+ results = found;
+ cursor = 0;
+ if (!results.length) {
+ list!.innerHTML = `<li class="px-3 py-10 text-center text-sm text-muted">Nothing matches “${esc(q)}”. Try fewer words, or a language name like <em>Rust</em>.</li>`;
+ input!.removeAttribute("aria-activedescendant");
+ return;
+ }
+ let html = "";
+ let lastRecent: boolean | undefined;
+ results.forEach(({ rec: r, recent: isRecent }, i) => {
+ if (!q && isRecent !== lastRecent) {
+ html += `<li role="presentation" class="kicker px-3 pt-3 pb-1.5 text-muted">${isRecent ? "Recent" : "Pages"}</li>`;
+ lastRecent = isRecent;
+ }
+ html += `<li role="option" id="sr-${i}" data-i="${i}" aria-selected="false">
+ <a href="${esc(r.u)}" tabindex="-1" class="group flex items-start gap-3 px-3 py-2.5 transition-colors duration-100 hover:bg-foreground/4">
+ <span class="mt-0.5 shrink-0 text-muted">${icon(isRecent ? "recent" : r.h ? "section" : "page")}</span>
+ <span class="flex min-w-0 flex-1 flex-col gap-0.5">
+ <span class="flex items-baseline gap-2 text-sm">
+ <span class="truncate font-medium">${mark(r.h || r.t, words)}</span>
+ ${r.h ? `<span class="truncate text-xs text-muted">in ${mark(r.t, words)}</span>` : ""}
+ ${r.st === "coming-soon" ? `<span class="shrink-0 border border-current px-1 text-[10px] font-semibold uppercase tracking-[0.08em] text-(--status-soon)">Soon</span>` : ""}
+ <span class="ml-auto shrink-0 text-[10.5px] uppercase tracking-[0.12em] text-muted">${esc(r.s)}</span>
+ </span>
+ ${words.length ? `<span class="line-clamp-2 text-xs leading-5 text-muted">${snippet(r, words)}</span>` : `<span class="truncate text-xs text-muted">${esc(r.x.slice(0, 110))}</span>`}
+ </span>
+ <span class="sr-go mt-0.5 shrink-0 text-link opacity-0 transition-opacity">${icon("go")}</span>
+ </a>
+ </li>`;
+ });
+ list!.innerHTML = html;
+ sync();
+ }
+
+ function sync() {
+ list!.querySelectorAll<HTMLElement>("[role=option]").forEach((el) => {
+ const on = Number(el.dataset.i) === cursor;
+ el.setAttribute("aria-selected", String(on));
+ if (on) {
+ input!.setAttribute("aria-activedescendant", el.id);
+ el.scrollIntoView({ block: "nearest" });
+ }
+ });
+ }
+
+ const pick = (i: number) => {
+ const r = results[i]?.rec;
+ if (!r) return;
+ recent.remember(key(r));
+ close();
+ location.href = r.u;
+ };
+
+ function open() {
+ if (dialog!.open) return;
+ opener = document.activeElement as HTMLElement | null;
+ dialog!.showModal();
+ input!.select();
+ render();
+ load().then(render);
+ }
+
+ function close() {
+ dialog!.close();
+ }
+
+ dialog.addEventListener("close", () => opener?.focus());
+ input.addEventListener("input", render);
+ input.addEventListener("keydown", (e) => {
+ if (e.key === "Escape") {
+ // A search field would clear itself first; Escape closes the palette instead.
+ e.preventDefault();
+ close();
+ } else if (e.key === "ArrowDown") {
+ e.preventDefault();
+ cursor = Math.min(cursor + 1, results.length - 1);
+ sync();
+ } else if (e.key === "ArrowUp") {
+ e.preventDefault();
+ cursor = Math.max(cursor - 1, 0);
+ sync();
+ } else if (e.key === "Enter" && results[cursor]) {
+ e.preventDefault();
+ pick(cursor);
+ }
+ });
+ list.addEventListener("mousemove", (e) => {
+ const li = (e.target as HTMLElement).closest<HTMLElement>("[role=option]");
+ if (!li) return;
+ const i = Number(li.dataset.i);
+ if (i !== cursor) {
+ cursor = i;
+ sync();
+ }
+ });
+ list.addEventListener("click", (e) => {
+ const li = (e.target as HTMLElement).closest<HTMLElement>("[role=option]");
+ if (!li) return;
+ e.preventDefault();
+ pick(Number(li.dataset.i));
+ });
+ dialog.addEventListener("click", (e) => {
+ if (e.target === dialog) close(); // the backdrop
+ });
+ dialog.querySelector("[data-search-close]")?.addEventListener("click", close);
+ document.querySelectorAll("[data-search-open]").forEach((b) => b.addEventListener("click", open));
+ document.addEventListener("keydown", (e) => {
+ const typing = (e.target as HTMLElement).closest("input, textarea, select, [contenteditable]");
+ if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "k") {
+ e.preventDefault();
+ dialog.open ? close() : open();
+ } else if (e.key === "/" && !typing && !dialog.open) {
+ e.preventDefault();
+ open();
+ }
+ });
+ // Warm the index when the pointer heads for the button.
+ document.querySelectorAll("[data-search-open]").forEach((b) => b.addEventListener("pointerenter", () => load(), { once: true }));
+ }
+</script>
diff --git a/website/src/components/site/Sidebar.astro b/website/src/components/site/Sidebar.astro
new file mode 100644
index 0000000..67d97ce
--- /dev/null
+++ b/website/src/components/site/Sidebar.astro
@@ -0,0 +1,109 @@
+---
+// The docs' page list, grouped by section. The section you're in is lit; the page you're
+// on is filled with Blender's selection blue. On load the list keeps its scroll position
+// from the previous page and makes sure the current page is visible (centered, no jump).
+import Icon from "./Icon.astro";
+import { docHref, getGroups } from "../../lib/docs";
+
+interface Props {
+ currentId: string;
+}
+
+const { currentId } = Astro.props;
+const groups = await getGroups();
+---
+
+<nav aria-label="Documentation" class="sidebar flex flex-col px-3 pt-3 pb-14" data-sidebar>
+ {
+ groups.map((group) => {
+ const here = group.docs.some((d) => d.id === currentId);
+ return (
+ <div class:list={["sidebar-group flex flex-col", here && "is-here"]}>
+ <h2 class="sidebar-label flex items-center gap-2 px-3 pt-5 pb-1.5">
+ <Icon name={group.icon} weight={here ? "fill" : "regular"} size={14} />
+ <span class="kicker">{group.label}</span>
+ </h2>
+ <ul class="flex flex-col gap-px">
+ {group.docs.map((doc) => {
+ const active = doc.id === currentId;
+ const status = doc.data.status;
+ return (
+ <li>
+ <a href={docHref(doc)} aria-current={active ? "page" : undefined} class="sidebar-link group" data-active={active ? "" : undefined}>
+ <span class="min-w-0 flex-1">{doc.data.sidebarLabel ?? doc.data.title}</span>
+ {status === "coming-soon" && (
+ <span class="sidebar-tag" title="Coming soon">
+ <Icon name="hourglass-medium" weight="bold" size={10} />
+ Soon
+ </span>
+ )}
+ {status === "preview" && (
+ <span class="sidebar-tag" title="Preview: works, may change">
+ Preview
+ </span>
+ )}
+ </a>
+ </li>
+ );
+ })}
+ </ul>
+ </div>
+ );
+ })
+ }
+</nav>
+
+<style>
+ .sidebar-label {
+ color: var(--muted);
+ }
+ .sidebar-group.is-here .sidebar-label {
+ color: var(--link);
+ }
+ .sidebar-link {
+ position: relative;
+ display: flex;
+ min-height: 2.125rem;
+ align-items: center;
+ gap: 0.5rem;
+ padding: 0.35rem 0.75rem;
+ font-size: 13.5px;
+ line-height: 1.35;
+ color: var(--muted);
+ transition:
+ background-color 140ms ease-out,
+ color 140ms ease-out;
+ }
+ .sidebar-link:hover {
+ color: var(--foreground);
+ background: color-mix(in oklab, var(--foreground) 6%, transparent);
+ }
+ .sidebar-group.is-here .sidebar-link:not([data-active]) {
+ color: color-mix(in oklab, var(--foreground) 82%, var(--muted));
+ }
+ .sidebar-link[data-active] {
+ color: var(--primary-ink);
+ font-weight: 500;
+ background: var(--primary);
+ }
+ .sidebar-link[data-active]:hover {
+ background: var(--primary-hover);
+ }
+ .sidebar-link:focus-visible {
+ outline-offset: -2px;
+ }
+ .sidebar-tag {
+ display: inline-flex;
+ flex-shrink: 0;
+ align-items: center;
+ gap: 0.2rem;
+ padding: 0 0.3rem;
+ font-size: 9.5px;
+ font-weight: 600;
+ line-height: 1rem;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ border: 1px solid currentColor;
+ opacity: 0.75;
+ }
+</style>
diff --git a/website/src/components/site/ThemeToggle.astro b/website/src/components/site/ThemeToggle.astro
new file mode 100644
index 0000000..1341562
--- /dev/null
+++ b/website/src/components/site/ThemeToggle.astro
@@ -0,0 +1,55 @@
+---
+import Icon from "./Icon.astro";
+---
+
+<button
+ type="button"
+ data-theme-toggle
+ class="inline-flex size-10 items-center justify-center text-muted transition-[background-color,color] duration-150 ease-out hover:bg-foreground/6 hover:text-foreground"
+ aria-label="Switch to dark theme"
+ title="Toggle light and dark"
+>
+ <Icon name="moon" size={18} class="theme-icon-moon" />
+ <Icon name="sun" size={18} class="theme-icon-sun" />
+</button>
+
+<style>
+ :global(.theme-icon-sun) {
+ display: none;
+ }
+ :global([data-theme="dark"] .theme-icon-sun) {
+ display: block;
+ }
+ :global([data-theme="dark"] .theme-icon-moon) {
+ display: none;
+ }
+</style>
+
+<script>
+ const root = document.documentElement;
+ const buttons = document.querySelectorAll<HTMLButtonElement>("[data-theme-toggle]");
+ const label = () =>
+ buttons.forEach((b) => b.setAttribute("aria-label", root.dataset.theme === "dark" ? "Switch to light theme" : "Switch to dark theme"));
+ label();
+ buttons.forEach((button) =>
+ button.addEventListener("click", () => {
+ const next = root.dataset.theme === "dark" ? "light" : "dark";
+ root.dataset.theme = next;
+ try {
+ localStorage.setItem("bui:theme", next);
+ } catch {}
+ label();
+ }),
+ );
+ // Follow the system until the reader picks a theme themselves.
+ matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => {
+ let stored = null;
+ try {
+ stored = localStorage.getItem("bui:theme");
+ } catch {}
+ if (!stored) {
+ root.dataset.theme = e.matches ? "dark" : "light";
+ label();
+ }
+ });
+</script>
diff --git a/website/src/components/site/Toc.astro b/website/src/components/site/Toc.astro
new file mode 100644
index 0000000..5224e1b
--- /dev/null
+++ b/website/src/components/site/Toc.astro
@@ -0,0 +1,55 @@
+---
+import type { MarkdownHeading } from "astro";
+
+interface Props {
+ headings: MarkdownHeading[];
+}
+
+const items = Astro.props.headings.filter((h) => h.depth === 2 || h.depth === 3);
+---
+
+{
+ items.length > 1 && (
+ <nav aria-label="On this page" class="toc">
+ <p class="kicker mb-3 text-muted">On this page</p>
+ <ul class="flex flex-col border-l border-border">
+ {items.map((h) => (
+ <li>
+ <a
+ href={`#${h.slug}`}
+ data-toc-link={h.slug}
+ class:list={[
+ "-ml-px flex min-h-8 items-center border-l-2 border-transparent py-1 pr-2 text-[13px] leading-5 text-muted transition-[color,border-color] duration-150 ease-out hover:text-foreground",
+ "aria-[current=true]:border-primary aria-[current=true]:font-medium aria-[current=true]:text-foreground",
+ h.depth === 3 ? "pl-6" : "pl-3",
+ ]}
+ >
+ {h.text}
+ </a>
+ </li>
+ ))}
+ </ul>
+ </nav>
+ )
+}
+
+<script>
+ const links = [...document.querySelectorAll<HTMLAnchorElement>("[data-toc-link]")];
+ if (links.length) {
+ const targets = links
+ .map((l) => document.getElementById(l.dataset.tocLink!))
+ .filter((el): el is HTMLElement => Boolean(el));
+ const setActive = (id: string) =>
+ links.forEach((l) => (l.dataset.tocLink === id ? l.setAttribute("aria-current", "true") : l.removeAttribute("aria-current")));
+ const visible = new Set<string>();
+ const observer = new IntersectionObserver(
+ (entries) => {
+ for (const e of entries) e.isIntersecting ? visible.add(e.target.id) : visible.delete(e.target.id);
+ const first = targets.find((t) => visible.has(t.id));
+ if (first) setActive(first.id);
+ },
+ { rootMargin: "-72px 0px -62% 0px" },
+ );
+ targets.forEach((t) => observer.observe(t));
+ }
+</script>
diff --git a/website/src/config/nav.ts b/website/src/config/nav.ts
new file mode 100644
index 0000000..6c94d43
--- /dev/null
+++ b/website/src/config/nav.ts
@@ -0,0 +1,64 @@
+// The one place that defines the docs' sections and their order.
+//
+// A page joins a section through its frontmatter (`section: "Rust"`), and the
+// sidebar, breadcrumbs, prev/next links and search all follow this order.
+// To add a section, add it here; to add a page, add an .mdx file.
+// `icon` is any Phosphor icon name (https://phosphoricons.com).
+
+export const sections = [
+ { label: "Start here", blurb: "What BUI is and how to install it", icon: "compass" },
+ { label: "Tutorials", blurb: "Build a first app, one language at a time", icon: "graduation-cap" },
+ { label: "Python", blurb: "tkinter, Qt syntax and Blender components", icon: "file-py" },
+ { label: "Rust", blurb: "HTML, CSS, Tailwind, rsx! and hooks, natively", icon: "file-rs" },
+ { label: "JavaScript & React", blurb: "Node.js, Bun, React and standalone apps", icon: "file-js" },
+ { label: "Dear ImGui", blurb: "The real Dear ImGui, in Blender's theme", icon: "squares-four" },
+ { label: "C & C++", blurb: "The C kit and embedding BUI in your host", icon: "file-c" },
+ { label: "Concepts", blurb: "How BUI works under the hood", icon: "lightbulb-filament" },
+ { label: "Performance", blurb: "Numbers, and how to measure them yourself", icon: "gauge" },
+ { label: "Reference", blurb: "Variables, options, matrices and terms", icon: "books" },
+ { label: "Project", blurb: "Roadmap, contributing and credits", icon: "flag-banner" },
+] as const;
+
+export type SectionLabel = (typeof sections)[number]["label"];
+
+export const sectionLabels = sections.map((s) => s.label) as unknown as [SectionLabel, ...SectionLabel[]];
+
+/**
+ * Languages a page can be about, and the labels <LangTabs> understands.
+ * `id` is what gets stored when a reader picks a tab; `label` is what <Tab label="..."> uses.
+ */
+export const languages = [
+ { id: "python", label: "Python" },
+ { id: "rust", label: "Rust" },
+ { id: "javascript", label: "JavaScript" },
+ { id: "c", label: "C" },
+ { id: "cpp", label: "C++" },
+ { id: "imgui", label: "Dear ImGui" },
+] as const;
+
+export type LanguageId = (typeof languages)[number]["id"];
+export const languageIds = languages.map((l) => l.id) as unknown as [LanguageId, ...LanguageId[]];
+
+/**
+ * The header's product-level links. They name areas of the site, not pages: the sidebar
+ * lists the pages. `match` decides when a link shows as current: a docs section label, or
+ * a page id.
+ */
+export const topLinks = [
+ { label: "Docs", href: "docs/start/introduction/", match: {} },
+ { label: "Tutorials", href: "docs/tutorials/first-app-python/", match: { sections: ["Tutorials"] } },
+ { label: "Benchmarks", href: "docs/performance/benchmarks/", match: { sections: ["Performance"] } },
+ { label: "Roadmap", href: "docs/project/roadmap/", match: { pages: ["project/roadmap"] } },
+] as const;
+
+export type TopLink = (typeof topLinks)[number];
+
+/** Which top link is current for a docs page. */
+export function currentTopLink(section: string, pageId: string): string | undefined {
+ for (const l of topLinks) {
+ const m = l.match as { sections?: readonly string[]; pages?: readonly string[] };
+ if (m.pages?.includes(pageId)) return l.label;
+ if (m.sections?.includes(section)) return l.label;
+ }
+ return "Docs";
+}
diff --git a/website/src/config/site.ts b/website/src/config/site.ts
new file mode 100644
index 0000000..2d8bec6
--- /dev/null
+++ b/website/src/config/site.ts
@@ -0,0 +1,16 @@
+// Site-wide settings. Change the URL here (or with SITE_URL at build time).
+
+export const site = {
+ name: "BUI",
+ title: "BUI: Blender's interface, for your app",
+ description:
+ "BUI is Blender's user interface as a standalone library. Drive it from tkinter, Qt-style Python, Blender components, Rust, JavaScript and React, Dear ImGui or C.",
+ repo: "https://github.com/ppmpreetham/BUI",
+ /** Base for "Edit this page" links: the docs live in website/src/content/docs. */
+ editBase: "https://github.com/ppmpreetham/BUI/edit/main/website/src/content/docs/",
+ /** Base for links to files in the repository (use `repoFile()` in content). */
+ blobBase: "https://github.com/ppmpreetham/BUI/blob/main/",
+ pypi: "https://pypi.org/project/blenderui/",
+ npm: "https://www.npmjs.com/package/@blender-ui/react",
+ license: "GPL-2.0-or-later",
+} as const;
diff --git a/website/src/content.config.ts b/website/src/content.config.ts
new file mode 100644
index 0000000..abe9a92
--- /dev/null
+++ b/website/src/content.config.ts
@@ -0,0 +1,32 @@
+import { defineCollection } from "astro:content";
+import { glob } from "astro/loaders";
+import { z } from "astro/zod";
+import { languageIds, sectionLabels } from "./config/nav";
+
+const docs = defineCollection({
+ loader: glob({ pattern: "**/*.mdx", base: "./src/content/docs" }),
+ schema: z.object({
+ /** The page title: short, plain, no trailing period. */
+ title: z.string(),
+ /** One sentence for search results, link previews and the page lede. */
+ description: z.string(),
+ /** Which sidebar group the page belongs to (see src/config/nav.ts). */
+ section: z.enum(sectionLabels),
+ /** Position inside the section; lower comes first. Leave gaps (10, 20, 30). */
+ order: z.number().default(100),
+ /** stable: works today. preview: works, may change. coming-soon: not built yet. */
+ status: z.enum(["stable", "preview", "coming-soon"]).default("stable"),
+ /** Short tags shown next to the title, e.g. ["New"], ["Windows only"]. */
+ badges: z.array(z.string()).default([]),
+ /** Languages the page is about; shown as chips and used by search. */
+ languages: z.array(z.enum(languageIds)).default([]),
+ /** Optional shorter label for the sidebar. */
+ sidebarLabel: z.string().optional(),
+ /** Repository files this page is based on, shown as "Sources" at the bottom. */
+ sources: z.array(z.string()).default([]),
+ /** Work in progress: not built, not in the sidebar or search. */
+ draft: z.boolean().default(false),
+ }),
+});
+
+export const collections = { docs };
diff --git a/website/src/content/docs/c/c-api.mdx b/website/src/content/docs/c/c-api.mdx
new file mode 100644
index 0000000..4f8781b
--- /dev/null
+++ b/website/src/content/docs/c/c-api.mdx
@@ -0,0 +1,281 @@
+---
+title: The C kit API
+sidebarLabel: The kit API
+description: Use BUI's runtime directly from C. Nodes, properties, layout, the context and host, windows, events and custom nodes, all from one header.
+section: C & C++
+order: 10
+languages: ["c", "cpp"]
+sources: ["docs/c-api.md", "kit/include/BUI_kit.h", "gpu/include/GPU_raster.h", "examples/kit_hello.c", "examples/CMakeLists.txt", "kit/intern/kit_core.c", "CMakeLists.txt"]
+---
+
+**The kit is BUI's runtime, written in C, and `BUI_kit.h` is its whole public API.** Use it directly and you get Blender's widgets, layout, input handling and damage rendering with nothing in between: no interpreter, no garbage collector, one static library.
+
+It's a **retained-mode** API: you build a tree of widgets once, change their properties when your data changes, and the kit redraws only what changed.
+
+<Figure
+ src="images/c-kit-hello.png"
+ alt="A small dark window with a Size slider at 2.500 and an Apply button below it"
+ caption="The nodes from <code>examples/kit_hello.c</code>, rendered headless at 320 × 120."
+ width={320}
+ height={120}
+/>
+
+## Link it
+
+Add BUI to your CMake project and link `bui::kit` (it pulls in `bui::gpu` and `bui::core`):
+
+```cmake title="CMakeLists.txt"
+add_subdirectory(BUI)
+target_link_libraries(myapp PRIVATE bui::kit)
+```
+
+Then `#include "BUI_kit.h"`. The header is the reference: every function has a one-line comment. The [installation page](../../start/installation/) covers compilers and platforms.
+
+## The shape of a kit program
+
+Every kit program does the same five things. Here they are, from `examples/kit_hello.c`:
+
+```c title="kit_hello.c"
+#include <stdio.h>
+#include "BUI_kit.h"
+
+static void on_event(void *data, BKNode *node, int kind, void *ref, double a, double b)
+{
+ if (kind == BK_EV_CLICK) {
+ printf("clicked %s\n", BK_get_str(node, "text"));
+ }
+ else if (kind == BK_EV_CHANGE) {
+ printf("%s = %g\n", BK_get_str(node, "label"), BK_get_num(node, "value"));
+ }
+}
+
+int main(void)
+{
+ BKNode *root = BK_node_new("frame"); /* 1. build a tree */
+ BK_set_num(root, "padding", 8);
+
+ BKNode *size = BK_node_new("slider");
+ BK_set_str(size, "label", "Size"); /* 2. set properties */
+ BK_set_num(size, "min", 0);
+ BK_set_num(size, "max", 10);
+ BK_set_num(size, "value", 2.5);
+ BK_node_add(root, size, -1); /* -1: append */
+ BK_geom_set_manager(size, BK_GEOM_PACK); /* 3. lay it out: Tk's packer */
+ BK_geom_set(size, "fill", 1); /* fill x */
+
+ BKNode *apply = BK_node_new("button");
+ BK_set_str(apply, "text", "Apply");
+ BK_node_add(root, apply, -1);
+ BK_geom_set_manager(apply, BK_GEOM_PACK);
+ BK_geom_set(apply, "fill", 1);
+ BK_geom_set(apply, "pady0", 6);
+
+ BKContext *ctx = BK_context_new(root); /* 4. a context and a host */
+ BKHost host = {0};
+ host.emit = on_event; /* the window fills in the rest */
+ BK_context_set_host(ctx, &host);
+
+ if (BK_window_supported()) { /* 5. a window and its loop */
+ BKWindow *win = BK_window_new(ctx, "BUI from C", 320, 120);
+ BK_window_show(win);
+ BK_window_run();
+ BK_window_free(win);
+ }
+ else { /* no window system: render to a raster */
+ BuiRaster *r = BUI_raster_create(320, 120);
+ BK_render(ctx, r, 320, 120, 1);
+ BUI_raster_free(r);
+ }
+ BK_context_free(ctx);
+ BK_node_free(root);
+ return 0;
+}
+```
+
+Build it from a clone of BUI with `cmake -S . -B build -DBUI_BUILD_EXAMPLES=ON`, then `cmake --build build --target bui_kit_hello`. The [C tutorial](../../tutorials/first-app-c/) walks through it line by line. The rest of this page is the map.
+
+<Figure
+ shot="c-kit-app"
+ alt="A modifier stack built with the kit: panels, enum rows, number fields, dropdowns, a slider, checkboxes and buttons"
+ caption="A fuller kit program: <code>examples/site/kit_modifiers.c</code>."
+/>
+
+## Nodes
+
+A **node** is one thing in the interface: a button, a slider, a panel, a whole file browser. Create one by type name, then add it to a parent.
+
+```c
+BKNode *panel = BK_node_new("panel");
+BK_node_add(root, panel, -1); /* index -1 appends */
+```
+
+| Function | What it does |
+| --- | --- |
+| `BK_node_new(type)`, `BK_node_free(node)` | Create and free |
+| `BK_node_add(parent, child, index)`, `BK_node_remove(parent, child)` | Change the tree |
+| `BK_node_child_count`, `BK_node_child`, `BK_node_parent` | Walk it |
+| `BK_node_rect(node, rect)`, `BK_node_natural(node, size)` | Where it is, and the size it wants |
+| `BK_node_invalidate(node)` | Redraw it |
+| `BK_node_relayout(node)` | Its size or structure changed |
+
+The node types: `frame column row grid box panel tabs sidetabs scroll scrollbar label separator progress button toggle checkbox radio decorator text search hotkey number slider dropdown enum swatch popover menubutton menubar list tree gridview canvas textarea image ramp curve normal histogram meter filebrowser custom`.
+
+## Properties
+
+Nodes are configured by **named properties**, so the API stays small:
+
+```c
+BK_set_str(field, "label", "Width");
+BK_set_num(field, "value", 1.5);
+double w = BK_get_num(field, "value");
+
+const char *modes[] = { "Object", "Edit", "Sculpt" };
+BK_set_strs(dropdown, "items", modes, 3);
+```
+
+- **Setters and getters:** `BK_set_num`, `BK_set_str`, `BK_set_color`, `BK_set_strs`, and `BK_get_num`, `BK_get_str`, `BK_get_color`, `BK_strs_count`, `BK_strs_get`.
+- **Unknown keys** make a setter return 0, so typos don't pass silently if you check.
+- **`"value"` vs `"set_value"`:** setting `"value"` changes the value quietly. Setting `"set_value"` changes it *and* notifies your host, as if the user had done it.
+- **Common keys:** `"value"`, `"text"`, `"label"`, `"min"`, `"max"`, `"items"`, `"enabled"`, `"visible"`.
+- **The browser look:** `"html"` set to 1 draws a node like a browser's form control instead of Blender's. Values, events and the other properties behave the same.
+
+The full list of keys lives in `kit_props` in `kit/intern/kit_core.c`.
+
+## Layout
+
+The kit lays out the children of a `frame` (or `canvas`) with **three geometry managers**, ported from the Tk toolkit: `pack` stacks children along a side, `grid` puts them in rows and columns, and `place` positions them exactly:
+
+```c
+BK_geom_set_manager(child, BK_GEOM_GRID);
+BK_geom_set(child, "row", 0);
+BK_geom_set(child, "column", 1);
+BK_geom_set(child, "sticky", BK_ANCHOR_W | BK_ANCHOR_E);
+BK_frame_grid_weight(frame, 1, 1, 1.0, 0); /* column 1 stretches */
+```
+
+| Manager | Keys (numbers) |
+| --- | --- |
+| `BK_GEOM_PACK` | `side` (0 top, 1 bottom, 2 left, 3 right), `fill` (1 x, 2 y, 3 both), `expand`, `anchor`, `padx0`, `padx1`, `pady0`, `pady1`, `ipadx`, `ipady` |
+| `BK_GEOM_GRID` | `row`, `column`, `rowspan`, `columnspan`, `sticky` (`BK_ANCHOR_*` bits), plus the pads |
+| `BK_GEOM_PLACE` | `x`, `y`, `relx`, `rely`, `width`, `height`, `relwidth`, `relheight`, `anchor` |
+
+With any manager, `reqwidth` and `reqheight` override the natural size. `BK_frame_grid_weight(frame, column_axis, index, weight, minsize)` sets how grid rows and columns stretch.
+
+## The context and the host
+
+A **context** (`BKContext`) is one interface's live state: input, popups, focus and undo. A **host** (`BKHost`) is whoever shows it on screen: a native window, Qt, a game engine, a test.
+
+```c
+BKContext *ctx = BK_context_new(root);
+BKHost host = {0};
+host.data = my_state;
+host.emit = on_event;
+BK_context_set_host(ctx, &host);
+```
+
+The host is a struct of optional callbacks:
+
+| Callback | When the kit calls it |
+| --- | --- |
+| `request(data)` | It needs a render |
+| `set_cursor(data, cursor)` | The pointer shape should change (`BK_CURSOR_*`) |
+| `warp(data, x, y)` | The pointer should move (scrubbing a number field) |
+| `clipboard_get(data)`, `clipboard_set(data, text)` | Copy and paste |
+| `schedule(data, ms, timer)` | Call `BK_timer(ctx, timer)` in `ms` milliseconds |
+| `emit(data, node, kind, ref, a, b)` | Something happened that your app cares about |
+
+A `BKWindow` fills in all of them except `emit`, which you keep. If you host the kit yourself, the [embedding page](../embedding/) shows how.
+
+**Input goes in** through `BK_press`, `BK_release`, `BK_motion`, `BK_wheel`, `BK_scroll` (precise deltas), `BK_key`, `BK_key_release`, `BK_button` and `BK_context_menu`. Each returns non-zero when something changed.
+
+**Frames come out** of `BK_render(ctx, raster, w, h, full)`. It redraws only damaged regions (unless `full`) and returns how many it redrew: 0 means nothing changed.
+
+## Events
+
+Your `emit` callback gets `(data, node, kind, ref, a, b)`. The `kind`s you'll use most:
+
+| Kind | Meaning |
+| --- | --- |
+| `BK_EV_CHANGE` | A node's value changed |
+| `BK_EV_CLICK` | A button was pressed |
+| `BK_EV_CALL` | A menu item or hotkey fired: call `ref` |
+| `BK_EV_SUBMIT` | A text field was confirmed with <Kbd>Enter</Kbd> |
+| `BK_EV_RENAME`, `BK_EV_ACTIVATE`, `BK_EV_TOGGLE`, `BK_EV_BROWSE` | List and tree renames, double-clicks, toggle columns, path-field browse buttons |
+
+Set a node's `"events"` property to also get raw input: `PRESS`, `RELEASE`, `DOUBLE`, `MOTION`, `ENTER`, `LEAVE`, `KEY`, `KEYRELEASE`, `WHEEL` and `CONFIGURE`. Scroll views add `VIEW` (with `"viewevents"`) and `SCROLL`.
+
+Keyboard shortcuts are one line: `BK_bind(ctx, "ctrl+s", ref)` sends `BK_EV_CALL` with your `ref`.
+
+## Windows
+
+```c
+BKWindow *win = BK_window_new(ctx, "Tool", 640, 480);
+BK_window_show(win);
+BK_window_run(); /* until every window closes, or BK_window_quit() */
+BK_window_free(win);
+```
+
+- **Platforms:** native Win32, X11 and Cocoa windows. `BK_window_supported()` is 0 where there's no window host, and on macOS off the main thread (AppKit allows windows only there).
+- **Control:** `BK_window_close`, `set_title`, `set_size`, `get_size`, and `BK_window_wm(win, key, a, b)` for the rest: `"pos"`, `"minsize"`, `"maxsize"`, `"resizable"`, `"topmost"`, `"alpha"`, `"state"`, `"lift"`, `"lower"`, `"focus"`.
+- **Your own loop:** `BK_window_pump()` handles pending messages and returns the number of open windows. `BK_window_timer(win, ms)` sets a one-shot timer; `BK_window_set_callbacks` gets you `on_timer`, `on_close` and `on_frame`.
+- **Other threads:** `BK_window_wake_init(cb)` on the loop's thread, then `BK_window_wake()` from any thread makes the loop call `cb` soon. That's how Node.js drives BUI's UI thread.
+
+**On the GPU:** `BUI_gpu_set_default(1)` puts every new window on the GPU (Direct3D 11 on Windows, OpenGL 3.3 on Linux); `BK_window_set_gpu(win, 1)` does it for one window. The device starts in the background, so the first frames use the software raster, and `BK_window_gpu(win)` returns 1 once frames draw on the GPU. The `BUI_GPU=1` or `0` environment variable overrides both.
+
+## Custom nodes
+
+A `custom` node hands its drawing and input to you. Use it for your own editor, or to host another UI system: [Dear ImGui runs on one](../../imgui/cpp/#imgui-inside-a-bui-interface).
+
+```c
+static int my_event(void *data, BKNode *node, const BKCustomEvent *e) { return 0; }
+static void my_draw(void *data, BKNode *node, BuiRaster *r, const int rect[4])
+{
+ const float blue[4] = { 0.28f, 0.45f, 0.70f, 1.0f };
+ BUI_raster_fill_rect(r, rect[0], rect[1], rect[2], rect[3], blue);
+}
+
+BKCustomClass cls = {0};
+cls.event = my_event;
+cls.draw = my_draw;
+BKNode *node = BK_node_new("custom");
+BK_custom_set(node, &cls, my_data);
+```
+
+- **`event`** gets every pointer event over the node (all three buttons, with a grab while one is held), precise wheel deltas, and keys and text while it has focus. Return 1 if you used the event.
+- **`frame`** runs at the start of `BK_render` when you asked with `BK_custom_request_frame(node, ms)`: the place for immediate-mode UIs to build their frame.
+- **`draw`** gets the raster and the node's rect. It may be called several times per render, once per damaged region, so it must draw the current state without changing it.
+- **`BK_custom_set_cursor(node, cursor)`** sets the pointer shape over the node.
+
+## Everything else
+
+| Area | API |
+| --- | --- |
+| Menus and pie menus | `BK_open_menu`, `BK_open_pie`, `BK_menubutton_set_items`, all from a `BKMenuSpec` array |
+| Canvas | `BK_canvas_set_item`, `add_item`, `put_item`, `truncate`, `delete`, `raise` |
+| Text areas | `BK_textarea_insert`, `delete`, `caret`, `selection`, `set_spans` (coloured ranges), `index_at`, `see` |
+| Trees | `BK_tree_item_new`, `add`, `set_values`; `BK_tree_set_roots`, `BK_tree_selected` |
+| Colour ramps and curves | `BK_ramp_get` / `set` / `evaluate`, `BK_curve_get` / `set` / `evaluate`, `BK_histogram_set` |
+| Undo | `BK_undo(ctx)`, `BK_redo(ctx)`: Blender's <Kbd keys="Ctrl+Z" /> over UI value edits |
+| Number expressions | `BK_eval_number("2*pi", &v)`: Blender's expression evaluator |
+| File browser | `BK_node_new("filebrowser")` in any window, or `BK_file_dialog(...)` for a ready-made dialog |
+| Text | `BUI_text_measure`, `BUI_raster_text`, `BUI_text_add_font` |
+| Meshes and textures | `BUI_texture_create` / `update` / `free`, `BUI_raster_mesh`: indexed triangles, the same pixels on every renderer |
+| Scale | `BK_set_scale(s)`, `BK_scale()`: 1 means Blender's 20 px widgets |
+
+<Callout type="joke">
+`BK_eval_number` is the same expression evaluator that lets Blender users type `2*pi` into a rotation field. Now your C program can, too. Your calculator app may feel threatened.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Embedding BUI" href="docs/c/embedding/" icon="layers" kicker="C & C++">
+ Put BUI inside your own renderer, Qt app or engine.
+ </Card>
+ <Card title="Your first app in C" href="docs/tutorials/first-app-c/" icon="sparkles" kicker="Tutorial">
+ kit_hello.c, line by line.
+ </Card>
+ <Card title="Dear ImGui from C++" href="docs/imgui/cpp/" icon="cpu" kicker="Dear ImGui">
+ Prefer immediate mode? The real Dear ImGui runs on the kit.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/c/embedding.mdx b/website/src/content/docs/c/embedding.mdx
new file mode 100644
index 0000000..e4205d9
--- /dev/null
+++ b/website/src/content/docs/c/embedding.mdx
@@ -0,0 +1,210 @@
+---
+title: Embedding BUI in your own host
+sidebarLabel: Embedding
+description: Put BUI inside a game engine, a Qt app or your own renderer. Render the kit into a raster you upload, or receive BUI's primitives through a render sink.
+section: C & C++
+order: 20
+languages: ["c", "cpp", "python"]
+sources: ["INTEGRATION.md", "kit/include/BUI_kit.h", "gpu/include/GPU_raster.h", "gpu/include/GPU_backend_sink.h", "api/bui_c_api.h", "api/CMakeLists.txt", "backends/qt/BuiWidget.h", "backends/qt/BuiQtSink.h", "backends/qt/CMakeLists.txt", "bindings/python/bui/qt.py", "bindings/python/bui/svg.py", "examples/svg_demo.c", "examples/CMakeLists.txt"]
+---
+
+Your app already has a window, a render loop and opinions. That's fine. **BUI draws; you present.** The kit never insists on its own window: hand it input, take back pixels or primitives, and Blender's widgets live inside your engine, your Qt app or your test harness.
+
+There are a few ways in. Pick the one that matches what you already have:
+
+| You have | Use | Section |
+| --- | --- | --- |
+| Any renderer that can show an image (a game engine, OpenGL, Vulkan, SDL …) | The kit renders into a `BuiRaster`; you upload the pixels | [The kit in your loop](#the-kit-in-your-loop) |
+| A Qt Widgets app in C++ | `BUI::BuiWidget` from the Qt backend | [Qt from C++](#qt-from-c) |
+| A PySide6 or PyQt6 app | `BuiCanvas` | [Python](#python-pyside-pyqt-and-svg) |
+| Your own primitive renderer, or SVG output | A render sink through the stable C API | [Render sinks](#render-sinks-and-the-stable-c-api) |
+
+## The kit in your loop
+
+This is the path for the full widget kit. The kit draws a frame into a **raster** (a CPU frame buffer), tells you which rectangles changed, and you upload just those. You forward input the other way.
+
+<Steps>
+
+1. **Make a context and a host.**
+
+ The host's `request` callback is how the kit says "I need a frame". Keep a flag:
+
+ ```c
+ #include "BUI_kit.h"
+
+ static int needs_frame = 1;
+ static void request(void *data) { needs_frame = 1; }
+
+ BKContext *ctx = BK_context_new(root); /* root: the tree you built */
+ BKHost host = {0};
+ host.request = request;
+ host.emit = on_event; /* your callbacks */
+ BK_context_set_host(ctx, &host);
+ BuiRaster *raster = BUI_raster_create(width, height);
+ ```
+
+ The other host callbacks are optional: `set_cursor`, `warp` (move the pointer while scrubbing), `clipboard_get` / `clipboard_set`, and `schedule` (call `BK_timer(ctx, timer)` after `ms` milliseconds, for tooltips and the like).
+
+2. **Forward input.**
+
+ Coordinates are in raster pixels. Modifiers are `BK_SHIFT`, `BK_CTRL` and `BK_ALT`.
+
+ ```c
+ BK_motion(ctx, x, y, mods);
+ BK_press(ctx, x, y, mods);
+ BK_release(ctx, x, y, mods);
+ BK_scroll(ctx, x, y, dx, dy, mods); /* precise wheel, in notches */
+ BK_key(ctx, "a", "a", mods); /* typed text, X11 keysym name */
+ ```
+
+3. **Render only when needed.**
+
+ ```c
+ if (needs_frame || BK_animating(ctx)) {
+ needs_frame = 0;
+ if (BK_render(ctx, raster, width, height, 0) > 0) {
+ const uint32_t *pixels = BUI_raster_pixels(raster); /* 0x00RRGGBB, stride = width */
+ const int (*rects)[4];
+ int n = BUI_raster_damage(raster, &rects); /* {x, y, w, h} that changed */
+ /* upload those rectangles into your texture */
+ }
+ }
+ ```
+
+ `BK_render` returns how many regions it redrew; 0 means nothing changed, so you skip the upload entirely. `BK_animating(ctx)` stays non-zero while something animates, such as a panel opening.
+
+4. **Draw the texture** wherever you like: a full-screen quad, a side panel, a surface in a 3D scene.
+
+</Steps>
+
+The pixel layout is byte-compatible with a Win32 32-bpp DIB and Qt's `QImage::Format_RGB32`, so on those you can blit it with no conversion.
+
+**A GPU instead of pixels:** if your host is a Win32 or X11 window, `BUI_raster_gpu_attach(raster, handle, wait)` switches the raster to BUI's GPU renderer (Direct3D 11 or OpenGL 3.3) with the same API, clip and damage rules. With a `NULL` handle it renders off-screen and `BUI_raster_pixels` reads the frame back.
+
+## Qt from C++
+
+The Qt backend is a `QWidget` that hosts BUI's drawing. It needs Qt 5 or 6 with Widgets, and neither `moc` nor OpenGL.
+
+```sh
+cmake -S . -B build-qt -DBUI_BUILD_QT_BACKEND=ON
+cmake --build build-qt
+```
+
+Link `bui::qt`, then:
+
+```cpp title="main.cpp"
+#include "BuiWidget.h" // backends/qt
+
+BUI::BuiWidget *canvas = new BUI::BuiWidget(window);
+canvas->render_func = [&](int w, int h) {
+ // BUI draw calls; the primitives land on QPainter
+};
+canvas->mouse_button = [&](int x, int y, int button, bool pressed) { /* hit-test */ };
+```
+
+`BUI::BuiWidget` handles painting, resizing and the mouse. Underneath, `BUI::QtSink` maps BUI's primitives onto a `QPainter`. Per-vertex colours reduce to the first vertex's colour per primitive, which matches how the toolkit draws shapes. You can also install the sink yourself in any paint event:
+
+```cpp
+QPainter p(widget);
+BUI::QtSink sink(&p);
+bui_set_render_sink(sink.gpuSink());
+// ... draw BUI content ...
+bui_set_render_sink(nullptr);
+```
+
+## Python: PySide, PyQt and SVG
+
+The `buipy` extension, part of `pip install blenderui`, exposes the same plumbing to Python, with no third-party packages.
+
+**In a PySide6 or PyQt6 window:**
+
+```py title="qt_canvas.py"
+import sys
+from PySide6.QtWidgets import QApplication # PyQt6 works the same
+from blenderui.qt import BuiCanvas
+
+app = QApplication(sys.argv)
+canvas = BuiCanvas() # by default, renders the demo scene
+canvas.resize(800, 600)
+canvas.show()
+sys.exit(app.exec())
+```
+
+`BuiCanvas` renders each frame into one BUI raster in C and paints it with a single `QPainter.drawImage`. Set `canvas.render_func` to draw your own content, and `on_press`, `on_release`, `on_motion` and `on_key` to receive input.
+
+**Headless, to an SVG file** (handy in CI):
+
+```py title="to_svg.py"
+import buipy
+from blenderui.svg import SvgSink
+
+sink = SvgSink(640, 480)
+buipy.set_backend(sink)
+buipy.demo_scene(640, 480) # or your own draw calls
+sink.save("frame.svg")
+```
+
+## Render sinks and the stable C API
+
+At the lowest level, BUI's drawing layer (`gpu/`) turns everything drawn through it into flat lists of screen-space primitives and hands them to a **render sink**: a struct of callbacks you provide. This is what the Qt backend, `SvgSink` and the SVG demo use.
+
+The stable C API in `api/bui_c_api.h` is a small, ABI-stable facade for hosts that don't want to compile against the full toolkit headers: the library version, plus installing a sink.
+
+```c title="my_sink.c"
+#include "bui_c_api.h"
+
+static void my_triangles(void *user, const float (*coords)[2],
+ const float (*colors)[4], int count)
+{
+ /* rasterize, record or forward `count` vertices (3 per triangle) */
+}
+
+void install(void *my_renderer_state)
+{
+ BuiGpuSink sink = {0};
+ sink.user = my_renderer_state;
+ sink.triangles = my_triangles;
+ /* lines, points, text, scissor, begin_frame and end_frame are optional */
+ bui_set_render_sink(&sink);
+ bui_set_viewport(1280, 720); /* pixels */
+ /* ... drive BUI drawing ... */
+ bui_set_render_sink(NULL); /* back to the discarding backend */
+}
+```
+
+Link the `bui_api` target. `bui_get_version(&major, &minor, &patch)` and `bui_version_string()` tell you which BUI you're talking to.
+
+**The contract:** 2D positions transformed by the current model matrix (identity matrices give pixel coordinates), and colours as RGBA floats from 0 to 1, not premultiplied.
+
+| Callback | What you receive |
+| --- | --- |
+| `begin_frame(user, w, h)` | Start of a batch; the viewport in pixels |
+| `scissor(user, x, y, w, h)` | Clip rectangle; `w` or `h` ≤ 0 removes it |
+| `triangles(user, coords, colors, n)` | Non-indexed triangles, 3 vertices each |
+| `lines(user, coords, colors, n)` | A line list, endpoints in pairs |
+| `points(user, coords, colors, n, size)` | Points, `size` pixels across |
+| `text(user, x, y, text, size, rgba)` | A UTF-8 text run at its baseline |
+| `end_frame(user)` | End of the batch |
+
+The complete example is `examples/svg_demo.c`. It installs an SVG recorder and draws through the immediate-mode layer:
+
+```sh
+cmake -S . -B build -DBUI_BUILD_EXAMPLES=ON
+cmake --build build --target bui_svg_demo
+./build/examples/bui_svg_demo out.svg
+```
+
+<Callout type="note" title="Which path draws Blender's widgets?">
+The kit's widgets draw straight into a `BuiRaster`, so to embed the full kit (panels, fields, menus), use [the raster path](#the-kit-in-your-loop). Render sinks receive what's drawn through BUI's `gpu/` immediate-mode layer, as in the SVG demo.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="The kit API" href="docs/c/c-api/" icon="book" kicker="C & C++">
+ Nodes, properties, layout, the context and events.
+ </Card>
+ <Card title="Dear ImGui inside BUI" href="docs/imgui/cpp/" icon="cpu" kicker="Dear ImGui">
+ Host ImGui in a kit node, inside any of these hosts.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/concepts/blender-widgets.mdx b/website/src/content/docs/concepts/blender-widgets.mdx
new file mode 100644
index 0000000..cb7bf68
--- /dev/null
+++ b/website/src/content/docs/concepts/blender-widgets.mdx
@@ -0,0 +1,167 @@
+---
+title: Blender's widgets and interactions
+sidebarLabel: Blender's widgets
+description: Every drag rule, shortcut and menu trick BUI copies from Blender, so you know exactly what your users' hands will feel.
+section: Concepts
+order: 20
+sources: ["docs/components.md", "CHANGELOG.md", "README.md", "docs/tkinter.md", "kit/intern/kit_core.c", "bindings/imgui/blender/README.md"]
+---
+
+Blender's interface is famous for how it *feels*: number fields you scrub without lifting the mouse, math you can type into any number field, menus you can search by typing two letters. BUI gives your app all of it, with no extra code.
+
+This page lists each behaviour precisely, so you can tell your users what to expect, and so you know what to test.
+
+<Figure
+ shot="c-kit-app"
+ alt="A Blender modifier stack drawn by BUI: collapsible panels, enum rows, number fields, dropdowns, a slider, checkboxes and buttons"
+ caption="Every widget in this window follows the rules below (<code>examples/site/kit_modifiers.c</code>)."
+/>
+
+## Where these rules apply
+
+The rules live in the C kit, so they work the same in every API that draws Blender widgets:
+
+- **Python:** the Blender components, tkinter syntax (`Scale`, `Spinbox`, `Checkbutton` …) and Qt syntax.
+- **Rust and JavaScript:** the Blender components (`<NumberSlider>`, `<Checkbox>` …) and form controls inside `styled`. Plain HTML elements behave like a browser's.
+- **Dear ImGui:** the Blender-widgets build (`BUI_IMGUI_BLENDER_WIDGETS=ON`). `DragFloat` becomes Blender's number field, `SliderFloat` its slider, checkboxes drag-toggle, and menus and combos become Blender's menus.
+- **C:** every kit widget.
+
+## Number fields
+
+A **number field** shows a value you can drag, click or type into. Over one, the pointer turns into left-right arrows.
+
+**Drag to scrub.** Press and drag sideways. The cursor hides and wraps, so you never hit the edge of the screen. When you let go, the cursor comes back where the drag started.
+
+- A **float** moves one click step per pixel.
+- An **integer** moves 1, ½ or 1/16 per pixel, depending on its range.
+- Hold <Kbd>Shift</Kbd> to move at a tenth of the speed.
+- Movement inside the small drag threshold is ignored, so the value doesn't jump when the drag starts.
+- Past a limit (`min` or `max`), the drag's starting point moves with the pointer, so dragging back responds at once.
+- <Kbd>Esc</Kbd> cancels the drag and restores the value.
+
+**Snap with Ctrl.** Hold <Kbd>Ctrl</Kbd> while dragging, and BUI snaps by Blender's rules. <Kbd keys="Ctrl+Shift" /> snaps finer.
+
+| Kind of value | <Kbd>Ctrl</Kbd> snaps to |
+| --- | --- |
+| Unbounded float | Whole units |
+| Angle | 10° |
+| Slider | 0.1, 1 or 10, depending on its range |
+| Integer | Multiples of 10 |
+
+**Click to type.** Click the field, or <Kbd>Ctrl</Kbd>-click it, and type a new value. A drag that changed nothing counts as a click.
+
+## Math in number fields
+
+When you type into a Blender number field or slider, you can type an expression instead of a number. Text fields (plain HTML inputs, tkinter's `Entry`, `QLineEdit`, ImGui's `InputText`) keep what you type as text. BUI evaluates it with Blender's own expression evaluator (`expr_pylike_eval.cc`):
+
+```text
+2*pi → 6.283185…
+90/4 → 22.5
+1e3 → 1000
+min(4, 3) → 3
+round(1.7) → 2
+x if c else y → Python-style conditionals
+```
+
+From Python, `buipy.kit_eval_number("2*pi")` runs the same evaluator.
+
+<ComingSoon feature="Units in number fields">
+Blender shows units like "2 m" or "90°" and lets you type them. BUI already drops trailing zeros the way Blender does ("0 m", "90°"); typing values with units is on the roadmap.
+</ComingSoon>
+
+## Sliders
+
+A **slider** is a number field with a fill bar.
+
+- The value follows the pointer across the slider's width, from where the drag began.
+- <Kbd>Shift</Kbd> moves at 1/20 of the speed.
+- When the drag ends, the pointer is put back at the value's position.
+- <Kbd>Ctrl</Kbd> snaps to 0.1, 1 or 10, depending on the range.
+
+## Shortcuts on any value
+
+Hover a value (number, slider, checkbox, color …) and use these:
+
+| Keys | What happens |
+| --- | --- |
+| <Kbd keys="Ctrl+Wheel" /> | Steps the value up or down |
+| <Kbd keys="Ctrl+C" /> / <Kbd keys="Ctrl+V" /> | Copies or pastes the value |
+| <Kbd keys="Ctrl+Alt+C" /> / <Kbd keys="Ctrl+Alt+V" /> | Copies or pastes a whole vector (X, Y and Z together) |
+| <Kbd>Backspace</Kbd> | Resets to the default |
+| <Kbd>-</Kbd> | Negates a number |
+| Right-click | Opens the context menu: Copy, Paste, Reset |
+
+## Several fields at once
+
+**Drag down to collect.** Press a number field and drag *down* over the fields below it. Each one joins the drag. Then drag sideways to change them all together. It's how Blender users set X, Y and Z scale in one motion.
+
+**Alt for linked fields.** Hold <Kbd>Alt</Kbd> while editing one field of a linked group (like X/Y/Z), and all of them change.
+
+**Drag across toggles.** Press a checkbox and drag across its neighbours to set them all to the same state, in one stroke. Panel headers work the same way: drag across them to open or close them all.
+
+## Panels
+
+- Click a header to collapse or open the panel, with Blender's animation.
+- <Kbd>Ctrl</Kbd>-click a header to open that panel and close the others.
+- Drag a header's grip to reorder panels.
+- Sub-panels are indented and laid out as in Blender's properties editor.
+
+## Menus and search
+
+<Figure
+ shot="feature-menu-search"
+ alt="Blender's File menu with exp typed into it: the search lists matching items from the menu and its submenus, such as the export entries"
+ caption="Type while a menu is open and Blender's fuzzy search looks through the menu and its submenus (<code>examples/site/render_props.py</code>)."
+/>
+
+- **Press, drag, release.** Press a menu button, drag to an item and let go to pick it. A plain click works too.
+- **Hover to switch.** While one menu-bar menu is open, hovering another opens it. Hovering an item with a submenu opens the submenu.
+- **Type to search.** In an open menu, start typing to search every item. The search is Blender's fuzzy string search: "ad cu" finds "Add Cube", typos are forgiven, and your recent picks rank first.
+- **Pie menus.** A pie menu opens around the pointer. Flick toward an item to pick it.
+
+<ComingSoon feature="Search-as-you-type popups">
+Blender's search popups (the ones that open as a text field with a live list under it) aren't ported yet. Menu search, above, works today.
+</ComingSoon>
+
+## Undo
+
+<Kbd keys="Ctrl+Z" /> undoes the last UI edit and <Kbd keys="Ctrl+Shift+Z" /> (or <Kbd keys="Ctrl+Y" />) redoes it, in every widget.
+
+- A burst of typing is one step.
+- A multi-field drag is one step.
+- Inside a text field, undo works while you type, too.
+
+From Python, `app.ctx.undo()` and `app.ctx.redo()` do the same from code.
+
+## Keyboard and tooltips
+
+- While editing a field, <Kbd>Tab</Kbd> and <Kbd keys="Shift+Tab" /> move to the next or previous field. <Kbd>Esc</Kbd> cancels the edit.
+- Hover a widget for half a second (Blender's tooltip delay) to see its tooltip.
+
+<Callout type="tip" title="Testing these in your app">
+Every interaction runs in C, so you can drive it headlessly from a test: press, move and release at a widget's position, then check the value. [Headless testing](../../python/headless-testing/) shows how.
+</Callout>
+
+<ComingSoon feature="Widget drag and drop">
+Dragging a value from one widget and dropping it on another, as Blender allows, is planned.
+</ComingSoon>
+
+<Figure
+ shot="feature-tooltip"
+ alt="A tooltip under the Denoise dropdown, explaining the setting"
+ caption="A tooltip, shown after Blender's hover delay (<code>examples/site/render_props.py</code>)."
+/>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Your first app" href="docs/tutorials/first-app-python/" icon="sparkles" kicker="Tutorial">
+ Build a panel in Python and try each of these by hand.
+ </Card>
+ <Card title="How BUI works" href="docs/concepts/how-it-works/" icon="layers" kicker="Concepts">
+ Where these rules live, and why every language gets them.
+ </Card>
+ <Card title="Theming" href="docs/concepts/theming/" icon="bulb" kicker="Concepts">
+ Blender's colors and icons, and what you can change.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/concepts/damage-rendering.mdx b/website/src/content/docs/concepts/damage-rendering.mdx
new file mode 100644
index 0000000..80c2fba
--- /dev/null
+++ b/website/src/content/docs/concepts/damage-rendering.mdx
@@ -0,0 +1,107 @@
+---
+title: Damage rendering
+description: Why an idle BUI window uses no CPU, and why a hover redraws one widget instead of the whole window. The trick, step by step.
+section: Concepts
+order: 40
+sources: ["README.md", "ARCHITECTURE.md", "kit/intern/kit_core.c", "kit/intern/kit_intern.h", "gpu/include/GPU_raster.h", "gpu/intern/gpu_raster.c", "gpu/intern/gpu_d3d11.h", "kit/intern/kit_window_win32.c", "kit/intern/kit_window_x11.c", "kit/intern/kit_window_cocoa.m", "bindings/rust/bench/README.md"]
+---
+
+Leave a BUI window open and walk away: it uses **no CPU at all**. Hover a button, and BUI redraws that button, not the window. This is **damage rendering**, and it's the main reason BUI is easy on laptop batteries.
+
+The idea is simple: keep track of which parts of the screen are "damaged" (out of date), and redraw only those. Here's how BUI does it, from the widget all the way to the screen.
+
+## The short version
+
+- A change marks only its widget's rectangle as dirty.
+- If nothing is dirty, BUI doesn't render. The event loop sleeps until the next input or timer.
+- When something is dirty, BUI redraws only those rectangles.
+- The renderer then finds which pixels really changed, and only those reach the screen.
+
+On the full components demo (520×900, Ryzen 7 5800U laptop), that's the difference between about **0.7 ms** for a complete frame and about **0.05 ms** for a hover or number-scrub frame.
+
+<BenchChart id="frame-times" />
+
+## Step by step
+
+<Steps>
+
+1. **A widget marks itself dirty.**
+
+ When a value, text or state changes, the kit marks that node's rectangle as dirty, plus a few pixels of margin. Popups get a wider margin, to cover their shadow. Nothing is drawn yet.
+
+2. **Dirty rectangles merge.**
+
+ The kit keeps a short list of dirty rectangles per window: up to 24. A new rectangle that overlaps one already in the list is merged into it. If the list is full, everything merges into one rectangle.
+
+3. **The loop decides whether to render.**
+
+ On the next turn of the event loop, the kit checks for dirty rectangles. If there are none, and nothing needs a new layout, it returns without drawing anything. This is why an idle window costs nothing: there's no timer redrawing it "just in case".
+
+4. **Only the dirty regions are drawn.**
+
+ For each dirty rectangle, the kit draws the widgets that touch it, clipped to the rectangle. Everything outside keeps last frame's pixels.
+
+ If the layout changed (the window resized, or a widget was added), positions may have moved everywhere, so the whole window is redrawn once.
+
+5. **The renderer finds what actually changed.**
+
+ The software raster compares the new frame with the previous one in tiles of 64×32 pixels, but only the tiles under the redrawn area. Runs of changed tiles become the **damage list**. A redraw that produced the same pixels (a hover that didn't change a color) reports nothing.
+
+6. **Only damaged tiles reach the screen.**
+
+ The window host presents just the damage list:
+
+ - **Windows:** the damaged regions are copied straight to the window.
+ - **Linux (X11):** each damaged rectangle is sent with `XPutImage`.
+ - **macOS:** each damaged rectangle is invalidated on the view, which redraws it from the frame.
+ - **GPU renderer:** frames render into a persistent target, so only damaged regions are drawn on the GPU. On Windows, the flip-model swap chain gets dirty rectangles, so the system compositor only recomposes what changed.
+
+</Steps>
+
+## Animation and frame pacing
+
+Some things do need frames over time: a panel collapsing, a CSS transition, a React app calling `requestAnimationFrame`. BUI renders frames **only while something animates**, and stops as soon as it's done.
+
+- **Paced to the display.** On Windows, animation frames wait for the display's next refresh (`DwmFlush`), at its refresh rate. On Linux and macOS, the event loop paces them with a timer.
+- **Late frames don't wait.** A frame that's already late starts right away instead of waiting for another refresh.
+- **One rebuild per frame.** Rust and JavaScript rebuild the scene right before the render (`BK_window_request_frame` in C), so changes made in an animation callback join that same frame.
+- **Damage still applies.** If one cell of a grid animates, only that cell is redrawn each frame.
+
+Headless windows (tests and screenshots) run on a virtual clock that tests advance by hand, so animations step exactly and tests don't wait.
+
+## What it adds up to
+
+From the start-time benchmark, measured on a Ryzen 7 5800U laptop: the CPU each app used while its window sat idle, per minute.
+
+<BenchChart id="idle-all" />
+
+<BenchChart id="idle-cpu" />
+
+Node's own event loop accounts for the JavaScript idle figure. On the same gpui source, gpui itself keeps working while idle. The full table is on the [Benchmarks](../../performance/benchmarks/) page.
+
+## Keeping your app cheap
+
+Damage rendering works without any effort from you. A few habits keep it working well:
+
+- **Change values, not layouts.** Setting a value redraws one widget. Adding or removing widgets triggers a layout pass and a full redraw. Both are fast, but the first is nearly free.
+- **Don't poll.** A timer in your code that sets the same value every few milliseconds keeps the event loop awake. Prefer callbacks.
+- **Keep big lists on signals (JavaScript).** A signal updates one node; re-rendering a 3,000-item list re-renders everything. See [Profiling](../../performance/profiling/).
+- **Measure.** `BUI_PROFILE=1` prints per-phase frame times, so you can see whether frames are full or partial.
+
+<Callout type="joke">
+Damage rendering is the art of doing nothing, very precisely. Your laptop fan may start to wonder if you left.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Rendering" href="docs/concepts/rendering/" icon="cpu" kicker="Concepts">
+ The CPU raster and the GPU renderer in depth.
+ </Card>
+ <Card title="Benchmarks" href="docs/performance/benchmarks/" icon="zap" kicker="Performance">
+ Start time, idle cost and frame times, measured.
+ </Card>
+ <Card title="Window hosts" href="docs/concepts/window-hosts/" icon="monitor" kicker="Concepts">
+ The native windows that put the tiles on screen.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/concepts/how-it-works.mdx b/website/src/content/docs/concepts/how-it-works.mdx
new file mode 100644
index 0000000..d5101e4
--- /dev/null
+++ b/website/src/content/docs/concepts/how-it-works.mdx
@@ -0,0 +1,136 @@
+---
+title: How BUI works
+sidebarLabel: How it works
+description: The five layers between your code and the pixels on screen, what each one does, and which parts come straight from Blender.
+section: Concepts
+order: 10
+sources: ["README.md", "ARCHITECTURE.md", "SYNTAX_COVERAGE.md", "docs/rust.md", "docs/javascript.md", "kit/CMakeLists.txt", "kit/intern/kit_core.c", "kit/intern/kit_draw.c", "gpu/include/GPU_raster.h"]
+---
+
+Every BUI app, in every language, takes the same short trip from your code to the screen. Once you can picture that trip, a lot of things make sense: why an idle window costs nothing, why tkinter and Rust get the same slider, and where to look when something misbehaves.
+
+This page walks the trip one layer at a time. You don't need any of it to build an app, but it's a good read before you tune performance or dig into the source.
+
+## The five layers
+
+```text
+ your code tkinter · Qt syntax · components · Rust (rsx!, HTML, CSS) · JavaScript / React · Dear ImGui · C
+ │
+ binding a thin layer per language: turns your calls into kit nodes and properties
+ │
+ kit (C) one node tree · layout · input and interaction · Blender widget drawing · undo · animation
+ │
+ renderer software raster on the CPU (default) or GPU: Direct3D 11 / OpenGL 3.3
+ │
+ window native Win32 / X11 / Cocoa window · stdlib Tk window · headless (tests, screenshots)
+```
+
+| Layer | What it does | Where it lives |
+| --- | --- | --- |
+| **Your code** | Says what the window contains and what happens when values change | Your files |
+| **Binding** | Speaks your language's syntax and forwards everything else to the kit | `bindings/` |
+| **Kit** | Holds every widget, lays them out, handles the mouse and keyboard, draws Blender's widgets | `kit/` |
+| **Renderer** | Turns drawing calls into pixels, and works out which pixels changed | `gpu/` |
+| **Window** | Shows the pixels and feeds input back to the kit | `kit/intern/kit_window_*` |
+
+The important idea: **the bottom three layers are shared by every language.** That's why a number field drags the same way in tkinter, Rust and React. There's one implementation, written in C.
+
+## Your code and the bindings
+
+A **binding** is the thin layer that lets a language talk to the kit. Each one keeps only what its syntax needs:
+
+- **Python** has one compiled extension, `buipy`, plus pure-Python packages on top. The tkinter and Qt syntaxes are thin facades: each widget is one kit node, and `pack`, `grid` and `place` run in the kit's C port of Tk's packer and gridder. Signals, variables and traces stay in Python.
+- **Rust** (`blenderui`) does more work of its own, because HTML and CSS need it. It runs the CSS cascade and lays boxes out with [taffy](https://github.com/DioxusLabs/taffy), then paints one display list onto a kit canvas. Form controls and Blender components become real kit widget nodes, placed at their boxes.
+- **JavaScript and React** reuse the Rust crate through a napi-rs addon. BUI runs its own message loop on a separate UI thread, and only the changes cross over: one `Int32Array` of operations per tick.
+- **Dear ImGui** is the real Dear ImGui. Its BUI backend lives in a kit `custom` node and draws ImGui's triangles through the same renderer.
+- **C** uses the kit directly, through `kit/include/BUI_kit.h`.
+
+You can mix Python APIs in one process: windows, timers and the event loop are shared.
+
+## The kit
+
+The **kit** is BUI's runtime, written in C. It's the part that makes BUI feel like Blender. It owns:
+
+- **One node tree.** Every widget is one **node**: a button, a number field, a panel, a canvas. Nodes have properties (`value`, `text`, `min` …) that the bindings set.
+- **Layout.** Blender-style column and row layout, plus Tk's pack, grid and place geometry managers for the tkinter and Qt syntaxes.
+- **Input and interaction.** Hit testing, hover, focus, drags, menus, tooltips and keyboard shortcuts, following the rules in Blender's `interface_handlers.cc`. That's where dragging, Ctrl snapping and math in fields come from (see [Blender's widgets](../blender-widgets/)).
+- **Drawing.** A C port of Blender's `interface_widgets.cc`: the same rounded-box shapes, the same shading, the same theme colors.
+- **Everything around it.** Undo and redo, animation, the text area, canvases, scroll views, the color picker, the node editor, the file browser, Blender's fuzzy string search and its expression evaluator.
+
+When something changes, the kit marks just that widget's rectangle as needing a redraw. That's the start of [damage rendering](../damage-rendering/).
+
+## The renderer
+
+The kit draws through one small drawing API (`GPU_raster.h`). Behind it sit two renderers that produce the same pixels:
+
+- **The software raster** (the default) draws anti-aliased shapes into a frame buffer in memory, on the CPU.
+- **The GPU renderer** (opt-in) draws the same shapes with Direct3D 11 on Windows or OpenGL 3.3 on Linux.
+
+After each frame, the renderer works out which parts of the picture actually changed, so the window only has to update those. [Rendering](../rendering/) explains both renderers and how to switch.
+
+## The window
+
+The **window host** is the piece that talks to the operating system: it opens a window, shows the frame and turns OS input events into kit input. BUI has native hosts written in C for Windows (Win32), Linux (X11) and macOS (Cocoa, still experimental). Python can also use a standard Tk window, and every API can run **headless**, with no window at all, for tests and screenshots. See [Window hosts](../window-hosts/).
+
+## One frame, start to finish
+
+Here's what happens when you drag a slider in a native window:
+
+1. The window host receives a mouse-move event and passes it straight to the kit. Nothing on this path leaves C.
+2. The kit finds the slider under the pointer, applies Blender's drag rules and updates the value.
+3. The slider marks its own rectangle as dirty, and the kit calls your `on_change` callback with the new value.
+4. On the next turn of the event loop, the kit redraws only the dirty rectangle.
+5. The renderer compares the new frame with the last one, tile by tile, and the host puts only the changed tiles on screen.
+6. Nothing else is dirty, so the loop goes back to sleep.
+
+On the full components demo, a frame like this takes about 0.05 ms. From input event to screen is about 0.06 ms. (Measured on a Ryzen 7 5800U laptop; see [Benchmarks](../../performance/benchmarks/).)
+
+## What comes from Blender
+
+BUI isn't a look-alike. Most of what you see and feel is Blender's own code, ported to C or copied in:
+
+| In Blender | In BUI |
+| --- | --- |
+| Widget drawing: `interface_widgets.cc` (`round_box_edges`, `widgetbase_draw`, the shape tables) | The kit's drawing code, same names and same math |
+| Interaction rules: `interface_handlers.cc` | The kit's input handling: drags, snapping, menus, undo |
+| Panels: `interface_panel.cc` | Panel headers, sub-panels and the collapse animation |
+| The default theme: `userdef_default_theme.c` | The kit's built-in colors (see [Theming](../theming/)) |
+| Icons: `release/datafiles/icons_svg` | All 781 SVG icons, rasterized with Blender's nanosvg |
+| Text: `blenfont` (BLF) with FreeType | FreeType rendering with BLF's settings (see [Text and fonts](../text-and-fonts/)) |
+| `blenlib`: color math, rects, string search, `expr_pylike_eval.cc` | Copied into `core/` and `kit/intern/blender/` |
+| Window code: GHOST | The X11 and Cocoa hosts follow GHOST's code |
+| `space_file`, `space_node` | The file browser and the node editor |
+
+What BUI leaves out is everything that makes Blender an application: scenes, meshes, the depsgraph, operators, file loading and Python-in-Blender. BUI keeps only the interface.
+
+<Callout type="joke">
+No default cubes were harmed in the extraction. They just weren't invited.
+</Callout>
+
+## Where things live
+
+| Path | What's inside |
+| --- | --- |
+| `kit/` | The C runtime and the native window hosts. API: `kit/include/BUI_kit.h` |
+| `gpu/` | The software raster, the GPU renderer, Slug text, the text engine (FreeType and stb_truetype, with Inter embedded) |
+| `core/`, `types/` | Blender's `blenlib` subset and data types |
+| `ui/`, `compat/` | Blender's original interface sources, kept for reference (not compiled by default) |
+| `api/` | A small, stable C ABI for hosts that bring their own renderer |
+| `bindings/` | Python, Rust, JavaScript, React and Dear ImGui |
+| `backends/qt/` | A C++ Qt/QPainter backend for drawing BUI inside Qt |
+
+For the full module map, read [ARCHITECTURE.md](https://github.com/ppmpreetham/BUI/blob/main/ARCHITECTURE.md).
+
+## Next steps
+
+<CardGrid>
+ <Card title="Blender's widgets" href="docs/concepts/blender-widgets/" icon="sparkles" kicker="Concepts">
+ Every drag rule, shortcut and menu trick you get for free.
+ </Card>
+ <Card title="Rendering" href="docs/concepts/rendering/" icon="cpu" kicker="Concepts">
+ The CPU raster, the GPU renderer, and when to switch.
+ </Card>
+ <Card title="Damage rendering" href="docs/concepts/damage-rendering/" icon="zap" kicker="Concepts">
+ Why an idle BUI window uses no CPU at all.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/concepts/rendering.mdx b/website/src/content/docs/concepts/rendering.mdx
new file mode 100644
index 0000000..4aa064a
--- /dev/null
+++ b/website/src/content/docs/concepts/rendering.mdx
@@ -0,0 +1,157 @@
+---
+title: CPU and GPU rendering
+sidebarLabel: Rendering
+description: BUI draws on the CPU by default and on the GPU when you ask. Both draw the same pixels; here's how each works, how to switch, and which to pick.
+section: Concepts
+order: 30
+languages: ["python", "rust", "javascript", "c"]
+sources: ["docs/getting-started.md", "ARCHITECTURE.md", "README.md", "CHANGELOG.md", "gpu/include/GPU_raster.h", "gpu/intern/gpu_raster.c", "gpu/intern/gpu_d3d11.c", "gpu/intern/gpu_d3d11.h", "gpu/intern/gpu_gl.c", "gpu/CMakeLists.txt", "kit/intern/kit_frame.c", "bindings/python/bui/__init__.py", "bindings/rust/bench/README.md"]
+---
+
+BUI has two renderers, and they draw **the same pixels**. The CPU one is the default, needs nothing from your graphics card and uses the least memory. The GPU one takes the drawing off the CPU, which pays off on big, busy windows. Switching is one line, or one environment variable.
+
+## Pick one in ten seconds
+
+| Your app | Use |
+| --- | --- |
+| A tool window, a form, a settings panel | **CPU** (the default). It's the lightest on memory and idles at zero. |
+| A large or HiDPI window, lots of animation, thousands of items | **GPU**. It uses about half the CPU per frame, or less. |
+| A server, a container, a test | **CPU**. No GPU or OpenGL needed. |
+| macOS | **CPU**: the GPU renderer isn't available there yet. |
+
+Not sure? Start on the CPU, then try `BUI_GPU=1` and compare with [`BUI_PROFILE=1`](../../performance/profiling/).
+
+## Turn on the GPU
+
+<LangTabs>
+<Tab label="Python">
+
+```py
+import blenderui as bui
+bui.set_gpu(True) # before you create any window
+```
+
+With tkinter syntax, you can also ask per window: `tk.Tk(gpu=True)`.
+
+</Tab>
+<Tab label="Rust">
+
+```rust
+Application::new().gpu(true).run(|cx| { /* every window on the GPU */ });
+// or one window:
+cx.open_window(WindowOptions { gpu: Some(true), ..Default::default() }, build);
+```
+
+`window.is_gpu()` turns true a few frames in, once the device is ready.
+
+</Tab>
+<Tab label="JavaScript">
+
+```js
+render(<App />, { title: "My app", width: 360, height: 200, gpu: true }) // React
+const app = new App({ gpu: true }) // @blender-ui/native
+```
+
+</Tab>
+<Tab label="C">
+
+```c
+BUI_gpu_set_default(1); /* new windows draw on the GPU */
+BK_window_set_gpu(win, 1); /* or one window */
+```
+
+</Tab>
+</LangTabs>
+
+**Any app, no code change:** set `BUI_GPU=1`. `BUI_GPU=0` forces the CPU. The variable wins over the app-wide setting in code, which makes A/B tests easy:
+
+```sh
+BUI_GPU=1 python my_app.py # PowerShell: $env:BUI_GPU="1"; python my_app.py
+```
+
+Where no GPU device can start (no Direct3D 11, no OpenGL 3.3), BUI quietly stays on the CPU. Run with `BUI_GPU_DEBUG=1` to see why.
+
+## The CPU renderer: the software raster
+
+The **software raster** (`gpu/intern/gpu_raster.c`) draws the whole UI into one frame buffer in memory, then the window shows it with a single copy. It plays the part that Blender's GPU module and font library play in Blender.
+
+- **Shapes are math, not textures.** Rectangles, Blender's rounded widget boxes, circles and lines are drawn with signed-distance coverage, like Blender's widget shaders. Edges come out anti-aliased at any scale.
+- **Pixels are plain.** Each pixel is a 32-bit `0x00RRGGBB` value, rows top-down. That's the same layout as a Windows DIB and Qt's `QImage::Format_RGB32`, so hosts can show it without converting.
+- **It tracks damage.** After each frame it compares the new picture with the last one in 64×32-pixel tiles, and reports only the tiles that changed. See [Damage rendering](../damage-rendering/).
+- **Big canvases draw in parallel.** On Windows, a canvas with at least 64 items draws in horizontal bands on the system thread pool: up to 8 threads, three bands per thread, and only as many threads as it needs to meet the frame deadline. The pixels are identical to drawing on one thread. `BUI_RASTER_THREADS` sets the maximum; `BUI_RASTER_THREADS=1` forces one thread.
+
+The cost of the software raster grows with the number of pixels, which is why very large or high-DPI windows are where the GPU shines.
+
+## The GPU renderer
+
+The **GPU renderer** uses Direct3D 11 on Windows (`gpu_d3d11.c`) and OpenGL 3.3 on Linux (`gpu_gl.c`). It's modeled on how Blender batches its widgets (`GPU_SHADER_2D_WIDGET_BASE_INST` in `interface_widgets.cc`):
+
+- **One shader, many instances.** The kit makes the same drawing calls as on the CPU. In GPU mode, each call records one 128-byte **instance** instead of touching pixels. A single "uber-shader" draws them all, so a frame of thousands of widgets is a handful of instanced draw calls.
+- **Same formulas, same pixels.** The pixel shader evaluates the software raster's coverage formulas. The `gpu_parity` test draws every primitive both ways and finds 10 of 172,800 pixels that differ by more than 3/255, on both backends.
+- **Atlases.** Text and other coverage masks share one 8-bit atlas, and images share one color atlas, so they're uploaded once and reused. Polygons are covered on the CPU and uploaded as masks.
+- **Damage still counts.** Frames render into a persistent target, so only damaged regions are redrawn. On Windows, presentation uses a flip-model swap chain with dirty rectangles, so the system compositor only recomposes what changed.
+- **No waiting at startup.** On Windows, the device is created on a worker thread. The first frames are drawn on the CPU and the switch happens a few frames in. A lost device falls back to the CPU.
+- **No GL needed to build.** On Linux, `libGL`, `libEGL` and `libX11` are loaded when first used, never linked. Windows get a GLX context on the same X11 connection as the window; offscreen rendering (tests, screenshots) uses EGL, then a GLX pbuffer.
+- **No shader compiler needed.** The Direct3D shaders (`gpu/shaders/bui_ui.hlsl`) ship as precompiled bytecode, and the OpenGL side carries its GLSL translation in the source.
+
+**Textured meshes** are the one primitive that isn't a shape: indexed triangles with texture coordinates and colors. Dear ImGui draws everything this way. Both renderers support them, so ImGui runs on either.
+
+## Text on the GPU: Slug or atlas
+
+With the GPU renderer, text is drawn one quad per glyph, in one of two ways:
+
+- **Slug** (the default) uses Eric Lengyel's [Slug](https://github.com/EricLengyel/Slug) algorithm. Glyph outlines are uploaded once as curves, and the pixel shader computes exact coverage. Text is sharp at any size, and there are no glyph bitmaps.
+- **The glyph atlas** draws cached per-glyph bitmaps, as Blender does. It's about half the GPU work, but needs bitmaps per size.
+
+| Where | Slug (default) | Atlas |
+| --- | --- | --- |
+| Python | `bui.set_slug(True)` | `bui.set_slug(False)` |
+| Rust | `Application::new().slug(true)` or `blenderui::set_slug(true)` | `.slug(false)`, or build without the default `slug` feature |
+| C | `BUI_gpu_set_slug(1)` | `BUI_gpu_set_slug(0)`, or CMake `-DBUI_SLUG=OFF` |
+| Any app (wins over code) | `BUI_SLUG=1` | `BUI_SLUG=0` |
+
+The switch takes effect on the next frame. On the CPU, text is always drawn from cached glyph bitmaps; [Text and fonts](../text-and-fonts/) has the details.
+
+## What each one costs
+
+From the benchmark in `bindings/rust/bench`, on a Ryzen 7 5800U laptop (Windows 11, Direct3D 11), animating a grid of cells:
+
+| | GPU | CPU raster |
+| --- | ---: | ---: |
+| CPU per frame, 100 / 1,000 / 3,000 cells | **1.19 / 4.70 / 11.58 ms** | 4.62 / 10.20 / 21.98 ms |
+| RAM (working set), 100 / 1,000 / 3,000 cells | 28 / 35 / 40 MB | **21 / 24 / 30 MB** |
+| GPU memory | 19–22 MB | **none** |
+| First frame | 5–10 ms | 4–5 ms |
+
+In short: the GPU halves (or better) the CPU cost per frame. In exchange, the process needs about 10 MB more RAM, plus GPU memory, and starts a little slower. [Benchmarks](../../performance/benchmarks/) has the full picture.
+
+## Troubleshooting
+
+| Symptom | Try |
+| --- | --- |
+| `gpu=True` seems to do nothing | Run with `BUI_GPU_DEBUG=1`. It prints which step failed to stderr. |
+| No GPU in a Windows VM or CI | `BUI_GPU_WARP=1` creates the device on WARP, Windows' software Direct3D 11 driver. Handy for testing the GPU path. |
+| Headless OpenGL on Linux picks the wrong display | `BUI_GPU_EGL=surfaceless` or `BUI_GPU_EGL=default` picks the EGL platform. |
+| GPU text looks heavier than you'd like, or costs too much | Try the atlas: `BUI_SLUG=0`. |
+
+<ComingSoon feature="GPU rendering on macOS">
+On macOS, windows draw with the software raster for now. The plan is the GPU renderer on Metal (or the OpenGL backend).
+</ComingSoon>
+
+<ComingSoon feature="Vulkan and WebGPU">
+More GPU backends are planned, drawing the same instance stream as Direct3D 11 and OpenGL.
+</ComingSoon>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Damage rendering" href="docs/concepts/damage-rendering/" icon="zap" kicker="Concepts">
+ How both renderers redraw only what changed.
+ </Card>
+ <Card title="Profiling" href="docs/performance/profiling/" icon="clock" kicker="Performance">
+ Measure your own app and choose with numbers.
+ </Card>
+ <Card title="Environment variables" href="docs/reference/environment-variables/" icon="terminal" kicker="Reference">
+ Every <code>BUI_*</code> switch in one table.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/concepts/text-and-fonts.mdx b/website/src/content/docs/concepts/text-and-fonts.mdx
new file mode 100644
index 0000000..10048c0
--- /dev/null
+++ b/website/src/content/docs/concepts/text-and-fonts.mdx
@@ -0,0 +1,136 @@
+---
+title: Text and fonts
+description: How BUI draws text like Blender does, on every platform. Inter is built in, FreeType renders it with Blender's settings, and the GPU can draw glyphs from their outlines.
+section: Concepts
+order: 60
+languages: ["python", "rust", "c"]
+sources: ["CHANGELOG.md", "README.md", "ARCHITECTURE.md", "docs/getting-started.md", "docs/rust.md", "docs/tkinter.md", "gpu/CMakeLists.txt", "gpu/include/GPU_raster.h", "gpu/intern/gpu_raster.c", "gpu/extern/gen_font_header.py", "gpu/extern/Inter-LICENSE.txt", "kit/intern/kit_draw.c", "bindings/rust/blenderui/Cargo.toml"]
+---
+
+Text is most of what people read in a UI, so BUI takes it seriously. Your app's text looks the same on Windows, Linux and macOS, and it looks like Blender's: the same font, rendered with the same settings.
+
+You don't have to do anything for this. This page explains how it works, how to use other fonts, and the limits worth knowing.
+
+## Inter, built in
+
+BUI embeds **Inter**, the font Blender uses for its interface, right in the library. There's nothing to install, and no system font can change how your UI looks.
+
+- It's the variable version of Inter, with an optical-size axis (14 to 32) and a weight axis (100 to 900).
+- It's the default face everywhere: for widgets, for `sans-serif` and `system-ui` in CSS, and for any family BUI can't find.
+- UI text is 11 pt at scale 1, Blender's default, and grows with the [UI scale](../window-hosts/#hidpi-and-scaling).
+
+Inter is © The Inter Project Authors, under the SIL Open Font License 1.1 (`gpu/extern/Inter-LICENSE.txt`).
+
+## Rendered like Blender's BLF
+
+Blender draws text with its font library, **BLF**, on top of FreeType. BUI vendors **FreeType 2.13.3** (the version Blender uses) and renders glyphs the way `blf_glyph.cc` does:
+
+- **Light hinting**, so stems stay crisp without distorting the shapes.
+- **Blender's gamma-1.43 coverage table**, so strokes have Blender's weight.
+- **Optical size:** the variable Inter is set to the text's size, clamped to the axis as Blender does. UI text gets Inter's 14 pt design.
+- **Bold** is the font's weight-700 instance, not a smeared regular.
+- **No kerning**, matching Blender, whose FreeType is built without `GPOS` kerning.
+- **Shadows:** widget text gets Blender's 1 px drop shadow, and panel titles its soft 3×3 one.
+
+FreeType is on by default (CMake `BUI_TEXT_FREETYPE`). With it off, stb_truetype rasterizes glyphs instead; stb_truetype also reads character maps, metrics and kerning tables in both cases.
+
+Glyph bitmaps are cached per glyph, so text that changes every frame (a ticking number, say) stays cheap.
+
+## On the GPU: Slug
+
+With the [GPU renderer](../rendering/), text is drawn one quad per glyph. By default it uses **Slug**: glyph outlines are uploaded once as curves, and the pixel shader computes exact coverage. Text is sharp at any size, with no glyph bitmaps at all.
+
+The alternative is a per-glyph bitmap atlas, Blender's own approach: about half the GPU work, but bitmaps per size. Switch with `BUI_SLUG=0` (or the API calls on the [Rendering](../rendering/#text-on-the-gpu-slug-or-atlas) page).
+
+## Using other fonts
+
+Inter covers the UI. When you ask for another family (a monospace editor, a brand font), BUI finds it in this order:
+
+1. **Fonts you registered** from code, exact style first.
+2. **A file path**: a family name ending in `.ttf`, `.otf` or `.ttc` loads that file.
+3. **`BUI_FONT`**, if set, replaces the default face (Inter).
+4. **A known generic family** (`monospace`, `serif` …), then a file called `<family>.ttf`, in the font folders below. Anything else falls back to Inter.
+
+**Font folders** are searched in order: `BUI_FONT_DIR` first, if set, then the system's:
+
+| Platform | Folders |
+| --- | --- |
+| Windows | `%WINDIR%\Fonts`, then `%LOCALAPPDATA%\Microsoft\Windows\Fonts` |
+| macOS | `/System/Library/Fonts`, `/System/Library/Fonts/Supplemental`, `/Library/Fonts`, `~/Library/Fonts` |
+| Linux | The usual `/usr/share/fonts` folders (DejaVu, Liberation, Noto …), `/usr/local/share/fonts`, `~/.local/share/fonts`, `~/.fonts` |
+
+If a family has no bold or italic face, BUI synthesizes one.
+
+### Register a font from code
+
+<LangTabs>
+<Tab label="Rust">
+
+```rust
+blenderui::add_font("Brand", false, false, include_bytes!("Brand-Regular.ttf"));
+```
+
+In CSS, `@font-face` loads local font files, and `font-family` picks a face per element.
+
+</Tab>
+<Tab label="C">
+
+```c
+/* family, style flags (BUI_FONT_BOLD | BUI_FONT_ITALIC), data, length */
+BUI_text_add_font("Brand", 0, data, len); /* returns 0 on bad data */
+```
+
+The data is copied, so you can free your buffer afterwards.
+
+</Tab>
+<Tab label="Python">
+
+Python has no font-registration call. Point BUI at a file or a folder instead:
+
+```sh
+BUI_FONT=/path/to/Brand.ttf python my_app.py # replaces Inter as the UI font
+BUI_FONT_DIR=/path/to/fonts python my_app.py # an extra folder to search first
+```
+
+In tkinter syntax, `font=("Arial", 18, "bold")` sets a widget's family, size and weight.
+
+</Tab>
+</LangTabs>
+
+## Windows' GDI text (optional)
+
+On Windows, you can build BUI with Windows' own GDI text engine and system fonts instead: CMake `-DBUI_TEXT_GDI=ON`, or the `gdi-text` feature in Rust. Text then uses ClearType-style hinting and Windows' fonts, and the GPU renderer can't use Slug. Most apps should keep the default, which looks like Blender everywhere.
+
+## Limits worth knowing
+
+- **No per-glyph font fallback.** Characters that Inter (or the chosen face) doesn't have show as boxes. A family list in CSS picks one face per element; it doesn't mix faces within a line.
+- **No IME.** Input methods for Chinese, Japanese and Korean aren't supported yet.
+- **Right-to-left text** is reordered (bidi) but not shaped, so Arabic letters don't join.
+- **No OpenType features** (`font-feature-settings` and friends): the text engine doesn't shape, and Blender's doesn't either.
+- **Rust only:** text doesn't wrap around floats, and `text-align: justify` aligns left.
+
+<ComingSoon feature="Per-glyph font fallback and IME">
+Both are next on the list of things to port from Blender's source: BLF's fallback fonts, so missing characters find a face that has them, and input-method support.
+</ComingSoon>
+
+## Troubleshooting
+
+| Symptom | Fix |
+| --- | --- |
+| Monospace or serif text uses the UI font | Install a TrueType family such as DejaVu, Liberation or Noto, or set `BUI_FONT_DIR` to a folder that has one. Inter itself is always there. |
+| Boxes instead of characters | The face has no glyph for them, and there's no fallback yet. Use a face that covers your script with `BUI_FONT`, or register one. |
+| GPU text looks different from CPU text | Try `BUI_SLUG=0` to draw GPU text from the same glyph bitmaps the CPU uses. |
+
+## Next steps
+
+<CardGrid>
+ <Card title="Rendering" href="docs/concepts/rendering/" icon="cpu" kicker="Concepts">
+ The CPU raster, the GPU renderer and Slug.
+ </Card>
+ <Card title="Theming" href="docs/concepts/theming/" icon="bulb" kicker="Concepts">
+ Blender's colors, icons and metrics.
+ </Card>
+ <Card title="Environment variables" href="docs/reference/environment-variables/" icon="terminal" kicker="Reference">
+ <code>BUI_FONT</code>, <code>BUI_FONT_DIR</code>, <code>BUI_SLUG</code> and more.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/concepts/theming.mdx b/website/src/content/docs/concepts/theming.mdx
new file mode 100644
index 0000000..74a6b32
--- /dev/null
+++ b/website/src/content/docs/concepts/theming.mdx
@@ -0,0 +1,199 @@
+---
+title: Theming and colors
+sidebarLabel: Theming
+description: Blender's Dark and Light themes in BUI, how to switch between them from every language, where the colors come from, and what else you can change.
+section: Concepts
+order: 70
+sources: ["kit/include/BUI_kit.h", "kit/intern/kit_theme_presets.c", "kit/intern/kit_core.c", "kit/intern/kit_draw.c", "kit/intern/kit_intern.h", "kit/intern/kit_icons_svg.c", "bindings/python/bui/__init__.py", "bindings/python/bui/theme.py", "bindings/python/tests/test_theme.py", "bindings/rust/blenderui/src/lib.rs", "bindings/rust/blenderui/src/window.rs", "bindings/rust/blenderui/tests/theme.rs", "bindings/node/index.d.ts", "bindings/react/index.js", "bindings/imgui/imgui_bui_style.cpp", "docs/getting-started.md", "docs/tkinter.md", "docs/components.md"]
+---
+
+BUI looks like Blender because it uses Blender's themes: the same grays, the same blue for selection, the same rounded corners and the same icons. That's what makes a BUI tool feel instantly familiar to the millions of people who use Blender.
+
+This page shows how to switch between Blender's Dark and Light themes, where the colors come from, how widgets use them, and what else you can change.
+
+## Dark or light
+
+BUI has **both of Blender's built-in themes**: Blender Dark (the default) and Blender Light. Switch with one call and every open window redraws: widgets, panels, menus, the file browser, the node editor, and the `styled` parts of Rust and JavaScript pages.
+
+<Compare left="Dark (default)" right="Light">
+ <div slot="left">
+
+<Figure src="images/shots/python-components-dark.png" alt="A Render Properties editor in Blender's Dark theme: dark gray panels, lighter gray fields and blue slider bars" />
+
+ </div>
+ <div slot="right">
+
+<Figure src="images/shots/python-components-light.png" alt="The same editor in Blender's Light theme: light gray panels and fields, dark text and blue slider bars" />
+
+ </div>
+</Compare>
+
+<LangTabs>
+<Tab label="Python">
+
+```py
+import blenderui as bui
+
+bui.set_theme("light") # or "dark"
+bui.theme_name() # "light"
+bui.theme_color("region_bg") # (r, g, b, a), each 0..1
+```
+
+An unknown name raises `ValueError`. In a `blenderui.imgui` program, `set_theme` restyles ImGui as well.
+
+</Tab>
+<Tab label="Rust">
+
+```rust
+use blenderui::prelude::*;
+
+fn main() {
+ blenderui::set_theme("light"); // false for an unknown name
+ // or, when you build the app:
+ Application::new().theme("light").run(|cx| { /* open windows */ });
+}
+```
+
+`blenderui::theme_name()` and `blenderui::theme_color("region_bg")` read the active theme.
+
+</Tab>
+<Tab label="JavaScript">
+
+```js
+const { App } = require('@blender-ui/native')
+
+const app = new App({ theme: 'light' })
+app.setTheme('dark') // open windows redraw
+```
+
+With React, pass it to `render`: `render(<App />, { theme: 'light' })`.
+
+</Tab>
+<Tab label="C">
+
+```c
+BK_set_theme("light"); /* returns 0 for an unknown name */
+const char *name = BK_theme_name(); /* "dark" or "light" */
+float rgba[4];
+BK_theme_color("regular.inner", rgba);
+```
+
+</Tab>
+<Tab label="Dear ImGui">
+
+```cpp
+BK_set_theme("light");
+ImGui_ImplBUI_StyleBlender(); // re-read the theme's colors into ImGui's style
+```
+
+`ImGui_ImplBUI_StyleBlender()` copies the active theme's colors when you call it, so call it again after switching.
+
+</Tab>
+</LangTabs>
+
+**Without a call**, the `BUI_THEME` environment variable picks the theme: `BUI_THEME=light`. Names are case-insensitive, and Blender's preset names work too (`"Blender Light"`). An explicit call wins over the variable.
+
+## Where the colors come from
+
+Blender ships its default theme in `release/datafiles/userdef/userdef_default_theme.c`, plus two interface presets, `Blender_Dark.xml` and `Blender_Light.xml`. BUI compiles both **Blender 5.x** presets into the kit (`kit/intern/kit_theme_presets.c`, generated by `tools/gen_theme.py`), so every widget, in every language, reads the same values.
+
+A theme is a set of **widget color sets**, one per kind of widget. Blender calls each one a `wcol` (for "widget colors"). BUI has twenty:
+
+`regular`, `tool`, `toggle`, `radio`, `option`, `textfield`, `num`, `numslider`, `menu`, `pulldown`, `menu_back`, `menu_item`, `list_item`, `box`, `scroll`, `progress`, `tooltip`, `tab`, `pie_menu` and `curve`.
+
+Each color set has the same fields:
+
+| Field | What it colors |
+| --- | --- |
+| `outline`, `outline_sel` | The widget's border, normal and selected |
+| `inner`, `inner_sel` | The fill, normal and selected (or pressed) |
+| `item` | The part inside: a slider's bar, a checkmark, a menu arrow |
+| `text`, `text_sel` | The label, normal and selected |
+| `roundness` | Corner radius, as a fraction of the widget unit |
+| `shaded`, `shadetop`, `shadedown` | An optional top-to-bottom gradient on the fill |
+
+Besides the color sets, the theme has region and panel colors, text colors, the text cursor and selection, the menu shadow, and the file browser's and node editor's colors.
+
+## The colors you'll see most
+
+| Where | Dark | Light |
+| --- | --- | --- |
+| Window background (`region_bg`) | `#303030` | `#b3b3b3` |
+| Panel header and body | `#3d3d3d` | `#cccccc` |
+| Button fill (`regular.inner`) | `#545454` | `#dbdbdb` |
+| Text-field fill (`textfield.inner`) | `#1d1d1d` | `#282828` |
+| Selected or pressed (`regular.inner_sel`) | `#4772b3` | `#668ccc` |
+| Button text (`regular.text`) | `#e6e6e6` | `#1a1a1a` |
+| Text cursor (`cursor`) | `#71a8ff` | `#3399e6` |
+
+In the dark theme, widget corners are 0.2 widget units round (panels 0.4, scrollbars 0.5); the light preset rounds widgets more (0.4). `theme_color(key)` returns any of these from code: a plain key such as `"region_bg"`, or `"<set>.<field>"` such as `"regular.inner"`.
+
+## How widgets use them
+
+<Figure
+ shot="c-kit-app"
+ alt="A modifier stack: gray number fields, blue selected enum buttons, a blue slider bar and checked checkboxes"
+ caption="The theme's colors on real widgets: gray fills, blue for selected buttons and slider bars (<code>examples/site/kit_modifiers.c</code>). Switch this site's theme to see the light preset."
+/>
+
+A widget picks its color set by kind, then adjusts it for its state, exactly as `interface_widgets.cc` does:
+
+- **Selected or pressed:** the `_sel` colors replace the normal ones, and the gradient flips.
+- **Hovered:** the fill and text lighten a little (Blender's `widget_active_color`).
+- **Disabled:** the widget is drawn faded, at half strength.
+
+## Icons
+
+BUI includes **all 781 of Blender's SVG icons** (from `release/datafiles/icons_svg`). They're rasterized with Blender's own nanosvg code, the way Blender does it, so they're sharp at any UI scale.
+
+- **Mono icons** take the text color, or their theme color where Blender gives them one: object orange, modifier blue and so on.
+- **Color icons** keep their own colors.
+
+Use them by Blender's name: `Button("Add", icon="ADD")`. From Python, `buipy.kit_icon_names()` lists every name, and from C, `BK_icon_list_count()` and `BK_icon_list_name()`.
+
+## Sizes and the UI scale
+
+Blender sizes everything from one number, the **widget unit**: 20 pixels at scale 1. Button heights, paddings, indents and roundness are all fractions or multiples of it. UI text is 11 pt at scale 1.
+
+Change the scale, and the whole UI grows or shrinks together, like Blender's Resolution Scale preference:
+
+| Where | How |
+| --- | --- |
+| Any app | `BUI_UI_SCALE=1.5` |
+| Python | `buipy.kit_set_scale(1.5)` |
+| C | `BK_set_scale(1.5f)` |
+
+The scale is clamped to 0.5–4. By default it follows the display's DPI (see [Window hosts](../window-hosts/#hidpi-and-scaling)).
+
+## What else you can change
+
+Beyond picking Dark or Light, you can color individual things, and how much depends on the API:
+
+| API | What you can change |
+| --- | --- |
+| **tkinter syntax** | `bg` on frames, canvases and windows; `fg` on text; `font` (size and bold). Look-only Tk options (`relief`, `activebackground`, `ttk.Style` …) are accepted but don't change what's drawn. |
+| **Qt syntax** | `setStyleSheet` with `color`, `background` on containers and `font-weight: bold`; anything you paint yourself with `QPainter` |
+| **Blender components** | `Label(..., color=...)`, a node's header color with `Node(..., kind=...)` or `color=`, anything drawn on a `Canvas` |
+| **Rust and JavaScript** | Everything, with CSS and Tailwind, on plain HTML elements. Inside `styled`, and on Blender components, the Blender theme applies. |
+| **Dear ImGui** | Dear ImGui's own style (`ImGui::GetStyle().Colors`, `imgui.get_style().colors` …) for ImGui's widgets. BUI starts it from the active Blender theme. |
+| **C** | Per-node colors through `BK_set_color` where a node has a color property; anything on a canvas |
+
+The two presets are the whole theme system: BUI doesn't load Blender theme files (`.xml`), and there's no call to change a single theme color. `theme_color` reads colors; nothing writes them.
+
+<Callout type="note" title="A Python copy of the theme">
+`bui/theme.py` mirrors the active theme for Python code that draws things itself, and `set_theme` refreshes it. The kit's widgets read the C presets directly.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Blender's widgets" href="docs/concepts/blender-widgets/" icon="sparkles" kicker="Concepts">
+ How those widgets behave under your mouse.
+ </Card>
+ <Card title="Environment variables" href="docs/reference/environment-variables/" icon="terminal" kicker="Reference">
+ <code>BUI_THEME</code>, <code>BUI_UI_SCALE</code> and the rest.
+ </Card>
+ <Card title="Text and fonts" href="docs/concepts/text-and-fonts/" icon="book" kicker="Concepts">
+ Inter, FreeType and Slug.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/concepts/window-hosts.mdx b/website/src/content/docs/concepts/window-hosts.mdx
new file mode 100644
index 0000000..c4f96ae
--- /dev/null
+++ b/website/src/content/docs/concepts/window-hosts.mdx
@@ -0,0 +1,168 @@
+---
+title: Window hosts
+description: The native Win32, X11 and Cocoa windows, the Tk fallback, headless mode, HiDPI scaling, and running on Linux machines without X11.
+section: Concepts
+order: 50
+languages: ["python", "rust", "javascript", "c"]
+sources: ["docs/getting-started.md", "README.md", "ARCHITECTURE.md", "kit/CMakeLists.txt", "kit/intern/kit_window_win32.c", "kit/intern/kit_window_x11.c", "kit/intern/kit_window_cocoa.m", "bindings/python/bui/host.py", "bindings/rust/blenderui-sys/build.rs", "docs/javascript.md", "docs/rust.md", "docs/components.md"]
+---
+
+A **window host** is the small piece of BUI that talks to your operating system. It opens the window, shows the frame BUI drew, and passes the mouse and keyboard back to the kit. You rarely think about it, and that's the point: the right one is picked for you.
+
+This page explains each host, how to choose one yourself, and what to expect on each platform.
+
+## The hosts at a glance
+
+<StatusTable columns={["Host", "Status", "Where and what"]} rows={[
+ ["<strong>Win32</strong>", "done", "Windows. Native, written in C"],
+ ["<strong>X11</strong>", "done", "Linux (Wayland sessions through XWayland). Native, written in C"],
+ ["<strong>Cocoa</strong>", "experimental", "macOS. Native, written but not yet run on a Mac"],
+ ["<strong>Tk</strong>", "done", "Anywhere Python has <code>tkinter</code>. Python only; the fallback"],
+ ["<strong>Headless</strong>", "done", "Anywhere. No window: tests and screenshots"],
+]} />
+
+All of them run the same kit, so your UI looks and behaves the same in each. They differ in how pixels reach the screen and how input arrives.
+
+## Native windows
+
+The native hosts are written in C (`kit/intern/kit_window_win32.c`, `kit_window_x11.c`, `kit_window_cocoa.m`). Input goes straight into the kit, and only the changed tiles are put on screen. Nothing on the input → render → present path leaves C, which is why an input event reaches the screen in about 0.06 ms.
+
+Every native host gives you:
+
+- **HiDPI** that follows the display (see [below](#hidpi-and-scaling)).
+- **Clipboard** copy and paste.
+- **Cursors**, including the hidden cursor while you scrub a number field, and pointer warping so the drag never hits the screen edge.
+- **Frame-paced animation** and window-manager features (title, size limits, position).
+- **One event loop** for all windows and timers.
+
+### Windows (Win32)
+
+A plain Win32 window. Redraw requests coalesce into one render message, and the damaged regions are copied straight to the window. The process is per-monitor DPI aware, so moving a window to another monitor rescales it. Animation frames wait for the display's refresh (`DwmFlush`).
+
+### Linux (X11)
+
+The same API on Xlib. Button and key mapping follow Blender's `GHOST_SystemX11`. Damaged rectangles go to the window with `XPutImage`, or through GLX with the [GPU renderer](../rendering/). Timers, cross-thread wakes and frame pacing all run in one `select()` loop.
+
+Wayland sessions run it through XWayland, which every mainstream desktop provides.
+
+### macOS (Cocoa) <Badge tone="preview">Experimental</Badge>
+
+A port of Blender's own Cocoa code (GHOST's `GHOST_SystemCocoa.mm` and `GHOST_WindowCocoa.mm`), with Retina scaling. It's written, but it hasn't been run on a real Mac yet.
+
+- AppKit only works on the **main thread**, so every window call must come from it. On any other thread, the native host reports itself unavailable and Python falls back to Tk.
+- That's also why **JavaScript is headless on macOS** for now: Node runs BUI on its own UI thread, which isn't the main thread.
+- The renderer is the CPU raster; there's no GPU renderer on macOS yet.
+
+<Callout type="tip" title="Have a Mac?">
+Running the Cocoa host and reporting what happens is one of the most useful things you can do for BUI right now. See [Contributing](../../project/contributing/).
+</Callout>
+
+## The Tk window (Python)
+
+Python can also show BUI in a standard `tkinter` window. The Tk window displays the kit's frame and forwards input to it. The UI and the API are identical; presenting is just a little slower.
+
+BUI uses it automatically where no native host works. To force it:
+
+```sh
+BUI_HOST=tk python my_app.py
+```
+
+On macOS this needs a Python with `tkinter` (for example from python.org, or `brew install python-tk`). There, BUI also starts a hidden Tk root before the first Cocoa window, because Tk and the native host must share one `NSApplication`. `BUI_MAC_TK=0` skips that step.
+
+## Headless: no window at all
+
+**Headless** means BUI lays out, handles input and draws exactly as usual, into memory, with no window. It's what tests and screenshot tools use, and it works on servers without a display.
+
+<LangTabs>
+<Tab label="Python">
+
+```py
+from blenderui.components import App, NumberField
+
+app = App("Test", (400, 300), NumberField("Size", 1.0))
+raster = app.render_raster() # draws without a window
+```
+
+`app.press`, `app.motion` and `app.release` simulate input.
+
+</Tab>
+<Tab label="Rust">
+
+```rust
+Application::headless().run(|cx| { /* same code, off-screen */ });
+```
+
+</Tab>
+<Tab label="JavaScript">
+
+```js
+const app = new App({ headless: true }) // renders off-screen
+```
+
+Apps built with `bui build` run headless with `BUI_HEADLESS=1` or `--headless`.
+
+</Tab>
+<Tab label="C">
+
+Render a `BKContext` into a `BuiRaster` with `BK_render` and read the pixels with `BUI_raster_pixels`; no `BKWindow` needed.
+
+</Tab>
+</LangTabs>
+
+Headless windows run on a virtual clock that tests advance by hand, so animations step exactly.
+
+## HiDPI and scaling
+
+On a high-density display, BUI scales its widgets up so they stay a comfortable size. The scale comes from:
+
+| Platform | Source |
+| --- | --- |
+| Windows | The monitor's DPI, per monitor (DPI ÷ 96) |
+| Linux | `Xft.dpi` from the X resources, as Blender reads it (96 if unset) |
+| macOS | The window's Retina backing scale |
+
+At scale 1, a widget is 20 pixels tall (Blender's "widget unit") and text is 11 pt. To force a scale, set `BUI_UI_SCALE`:
+
+```sh
+BUI_UI_SCALE=1.5 python my_app.py
+```
+
+The scale is clamped to 0.5–4.
+
+## Linux without X11
+
+On Linux, `libX11` (and, for the GPU renderer, `libGL`) is loaded when the **first window opens**, not when BUI loads. So:
+
+- BUI imports and renders headless on servers and in containers without X11.
+- Where X11 is present, you get native windows.
+- Where OpenGL is missing, the GPU renderer falls back to the CPU raster.
+
+Building from source needs the X11 **headers** (`libx11-dev` on Debian and Ubuntu, `libX11-devel` on Fedora). No GL headers are needed. If CMake can't find the X11 headers, the build still works, without native Linux windows: Python then uses Tk or runs headless. The published Linux wheels are built with the headers, so they have the native host.
+
+<Callout type="note" title="Rust links libX11">
+The Rust crate's build script links `libX11` directly on Linux, so Rust binaries need it installed to start, even headless.
+</Callout>
+
+## Running the loop (Python)
+
+All Python windows share one event loop in `bui.host`:
+
+- `bui.host.run()` runs the loop for every window.
+- `bui.host.update()` processes pending events once and returns.
+- `bui.host.quit()` stops the loop.
+
+`mainloop()`, `app.exec()` and `App.run()` call into the same loop. If a window never appears, the loop probably isn't running.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Platforms" href="docs/reference/platforms/" icon="monitor" kicker="Reference">
+ The full matrix: languages, renderers and packages per OS.
+ </Card>
+ <Card title="Damage rendering" href="docs/concepts/damage-rendering/" icon="zap" kicker="Concepts">
+ How hosts put only the changed tiles on screen.
+ </Card>
+ <Card title="Environment variables" href="docs/reference/environment-variables/" icon="terminal" kicker="Reference">
+ <code>BUI_HOST</code>, <code>BUI_UI_SCALE</code> and the rest.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/imgui/blender-widgets.mdx b/website/src/content/docs/imgui/blender-widgets.mdx
new file mode 100644
index 0000000..c1243b0
--- /dev/null
+++ b/website/src/content/docs/imgui/blender-widgets.mdx
@@ -0,0 +1,169 @@
+---
+title: Blender widgets for Dear ImGui
+sidebarLabel: Blender widgets
+description: One build flag turns Dear ImGui's widgets into Blender's own, drawn by BUI and handled with Blender's rules. What changes, the full mapping, and the gaps.
+section: Dear ImGui
+order: 50
+languages: ["cpp", "c", "python", "rust", "imgui"]
+sources: ["bindings/imgui/blender/README.md", "docs/imgui.md", "bindings/imgui/README.md", "bindings/imgui/imgui_impl_bui.h", "bindings/imgui/CMakeLists.txt", "bindings/rust/blenderui-imgui/Cargo.toml", "examples/imgui_blender_compare.cpp"]
+---
+
+The Blender theme makes ImGui *look* like Blender. **The Blender-widgets build makes it *feel* like Blender.** Turn on one option and `ImGui::SliderFloat` becomes Blender's number slider: drag it relative to where you pressed, hold <Kbd>Shift</Kbd> for precision, hold <Kbd>Ctrl</Kbd> to snap, click to type a value. Your ImGui code doesn't change at all.
+
+These aren't look-alikes. BUI draws them with the same code as its own native widgets, a port of Blender's `interface_widgets.cc`, and a test checks they're **the same pixels**.
+
+<Compare left="Blender theme (default)" right="Blender widgets">
+ <div slot="left">
+
+ <Figure
+ src="images/imgui-stock.png"
+ alt="ImGui's demo with ImGui's own widgets in Blender's colours: separate vector fields, a slider with a small grab handle, square checkboxes with a large check mark"
+ width={1280}
+ height={1000}
+ variant="bleed"
+ />
+
+ </div>
+ <div slot="right">
+
+ <Figure
+ src="images/imgui-blender.png"
+ alt="The same demo with Blender's widgets: joined vector fields, sliders with a fill bar, Blender's checkboxes and radio buttons"
+ width={1280}
+ height={1000}
+ variant="bleed"
+ />
+
+ </div>
+</Compare>
+
+Look at the **Vector** row: three separate boxes on the left, one joined row on the right, the way Blender aligns X/Y/Z fields. The **Slider** has a fill bar instead of a grab handle, and the checkboxes and radio buttons are Blender's.
+
+## Turn it on
+
+<LangTabs>
+<Tab label="C++">
+
+```sh
+cmake -S . -B build -DBUI_IMGUI_BLENDER_WIDGETS=ON
+```
+
+The option is off by default. It changes `bui::imgui` and `bui::cimgui`, so link as usual.
+
+</Tab>
+<Tab label="C">
+
+```sh
+cmake -S . -B build -DBUI_IMGUI_BLENDER_WIDGETS=ON
+```
+
+The same option builds `bui::cimgui` with Blender's widgets.
+
+</Tab>
+<Tab label="Rust">
+
+```toml title="Cargo.toml"
+[dependencies]
+blenderui-imgui = { git = "https://github.com/ppmpreetham/BUI", features = ["blender-widgets"] }
+```
+
+</Tab>
+<Tab label="Python">
+
+Build BUI from source with `-DBUI_IMGUI_BLENDER_WIDGETS=ON`. The wheels on PyPI are built without it, so `pip install blenderui` gives you ImGui's own widgets in Blender's theme.
+
+</Tab>
+</LangTabs>
+
+When the build has them, they're on by default. You can switch at runtime, for example to compare:
+
+| | C++ | C | Python | Rust |
+| --- | --- | --- | --- | --- |
+| Built with them? | `ImGui_ImplBUI_HasBlenderWidgets()` | `cImGui_ImplBUI_HasBlenderWidgets()` | `imgui.has_blender_widgets()` | `has_blender_widgets()` |
+| In use? | `ImGui_ImplBUI_GetBlenderWidgets()` | `cImGui_ImplBUI_GetBlenderWidgets()` | `imgui.get_blender_widgets()` | `blender_widgets()` |
+| Switch | `ImGui_ImplBUI_SetBlenderWidgets(on)` | `cImGui_ImplBUI_SetBlenderWidgets(on)` | `imgui.set_blender_widgets(on)` | `set_blender_widgets(on)` |
+
+Switching off goes back to ImGui's own drawing and interaction.
+
+## What feels different
+
+If you know ImGui, these are the changes your hands will notice:
+
+- **Sliders don't jump.** A press doesn't move the value; dragging changes it relative to where you pressed. A click without a drag lets you type a value. (ImGui jumps to the pointer on press.)
+- **Number fields (`Drag*`) type on click.** A click without a drag types a value; ImGui needs <Kbd>Ctrl</Kbd>+click, a double-click or `io.ConfigDragClickToInputText`. The arrows at each end step the value. The drag starts after 0.25 widget units.
+- **<Kbd>Shift</Kbd> is slower, not faster.** It's Blender's precision mode, 10× slower on number fields and 20× on sliders. (ImGui: <Kbd>Shift</Kbd> faster, <Kbd>Alt</Kbd> slower.) <Kbd>Ctrl</Kbd> snaps while you drag.
+- **Checkboxes toggle on press,** and you can **drag across** several to give them all the same state. (ImGui toggles on release.)
+- **A quick second press is a new drag,** not a double-click.
+- **Text fields** put their text 0.4 widget units from the left edge, as Blender does.
+- **Menu check marks** are Blender's check box, in ImGui's mark column (Blender puts the box on the left).
+
+Logarithmic sliders and drags, reversed slider ranges, the keyboard and gamepads keep ImGui's interaction, drawn as Blender widgets.
+
+<Callout type="joke">
+Press <Kbd>Shift</Kbd> to go faster, said no Blender user ever.
+</Callout>
+
+## The mapping
+
+| ImGui | Drawn as | Interaction |
+| --- | --- | --- |
+| `Button`, `SmallButton` | Push button, label centred | ImGui's (press on release) |
+| `ArrowButton` | Push button with a triangle | ImGui's |
+| `InvisibleButton` | Nothing | ImGui's |
+| `Checkbox`, `CheckboxFlags` | Option box and label; a dash when mixed | Blender's: toggles on press, drag-toggle |
+| `RadioButton` | A round option with a dot (Blender's own "radio" is a segmented row) | ImGui's |
+| `Selectable` | List row; menu row in popups; pulldown in menu bars | ImGui's |
+| `DragFloat`, `DragInt`, `DragScalar` (and `N`, `Range2`) | Number field with step arrows on hover | Blender's: scrub, <Kbd>Shift</Kbd> 1/10, <Kbd>Ctrl</Kbd> snaps, arrows step, click types, <Kbd>Esc</Kbd> reverts |
+| `SliderFloat`, `SliderInt`, `SliderScalar` (and `N`), `SliderAngle` | Number slider: fill bar, value inside | Blender's: relative drag, <Kbd>Shift</Kbd> 1/20, <Kbd>Ctrl</Kbd> snaps, click types |
+| `VSliderFloat`, `VSliderInt`, `VSliderScalar` | ImGui's vertical slider (Blender has none), Blender colours | ImGui's |
+| `InputText`, `InputTextWithHint`, `InputFloat`, `InputInt` … | Text field; the +/- are Blender buttons | ImGui's text engine |
+| `InputTextMultiline` | Text field backdrop | ImGui's |
+| `Combo`, `BeginCombo` | Menu button with the pulldown arrows; the popup is Blender's menu, shadow included | ImGui's |
+| `ColorButton`, `ColorEdit3`, `ColorEdit4` | Colour swatch (checker under the alpha half); components as a joined row of number fields | Blender's number fields |
+| `ColorPicker3`, `ColorPicker4` | ImGui's picker, Blender colours | ImGui's |
+| `ProgressBar` | Progress bar, text centred | |
+| `CollapsingHeader`, framed `TreeNode` | Panel header: arrow icon, title with its soft shadow | ImGui's |
+| `TreeNode` | Tree row with a disclosure triangle | ImGui's |
+| `BeginTabBar`, `BeginTabItem` | Blender's tabs | ImGui's |
+| `BeginMenuBar`, `BeginMenu` | Pulldowns in the bar; Blender's menu with shadow, rows and submenu arrows | ImGui's |
+| `MenuItem` | Menu row, shortcut at 55% text alpha; `selected` shows Blender's check box | ImGui's |
+| `Separator`, `SeparatorText` | ImGui's line in Blender's separator colour | |
+| `Text`, `LabelText`, `BulletText`, `TextWrapped` … | BUI's text (Inter), ImGui's wrapping | |
+| Windows, title bars, tooltips, `BeginPopup` popups, tables, scrollbars, plots | ImGui's, in the Blender style | ImGui's |
+
+Two layout details:
+
+- **"Label: value" formats.** A number field or slider whose format contains a `:` (like `"Width: %.0f"`, or ColorEdit's `"R:%3d"`) shows Blender's way: label on the left, value on the right. Other formats are centred. ImGui's own `label` argument stays outside, on the right, so layouts and label columns keep working.
+- **Joined rows.** The components of `DragFloat2/3/4`, `DragInt*`, `SliderFloat2/3/4`, `SliderInt*`, `Drag*Range2` and `ColorEdit` join into one rounded row, as Blender aligns vectors.
+
+## How it works
+
+- **A drop-in copy.** `blender/imgui_widgets_blender.cpp` is a copy of ImGui's `imgui_widgets.cpp`, and CMake compiles it *instead of* the original. Same functions, same ABI, so every binding gets Blender widgets with no change. Every edit in it is marked `BUI:`.
+- **ImGui's logic is untouched.** Items, IDs, layout, navigation and the text-editing engine are ImGui's own. What changes is how each widget is drawn and, for number fields, sliders and checkboxes, how the mouse drives it.
+- **Drawn by the kit.** Each widget becomes a draw-list callback. While rendering, the backend hands it to the kit's `BK_draw_widget`, the same drawing BUI's native widgets use, clipped as ImGui asked.
+- **Same pixels, proven.** The test `imgui_blender_widgets_match_kit` renders nine kit widgets next to the same widgets through ImGui and requires them to match exactly at scale 1.
+- **Still idle when idle.** The callback data is part of the backend's change check, so "redraw only on change" still works, on the CPU and the GPU.
+
+## Gaps
+
+Honest list. These keep ImGui's behaviour or drawing for now:
+
+- **Blender's vertical multi-value drag** (drag down over fields, then sideways) and <Kbd>Alt</Kbd> (edit all linked fields) aren't implemented. The cursor isn't hidden and wrapped while you scrub. <ComingSoon inline />
+- **Window title bars and frames, tooltips, `BeginPopup` and context-menu backgrounds, table headers** keep ImGui's rendering in the Blender style. Only combos and `BeginMenu` menus get Blender's menu backdrop.
+- **`ColorPicker3/4`** keeps ImGui's drawing: the Blender-widgets build doesn't route it to Blender's color picker yet. So do `VSlider*`, `PlotLines`, `PlotHistogram`, `ImageButton`, `Bullet` and `TextLink`.
+- **Text being typed** uses ImGui's glyphs, because ImGui measures its cursor and selection with them.
+- **An indeterminate `ProgressBar`** (a negative fraction) shows the moving end of ImGui's segment.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Coverage" href="docs/imgui/coverage/" icon="check" kicker="Dear ImGui">
+ What each language binds, and the Blender style's colours.
+ </Card>
+ <Card title="From C++" href="docs/imgui/cpp/" icon="cpu" kicker="Dear ImGui">
+ Set up the backend, then flip the flag.
+ </Card>
+ <Card title="Blender's interactions" href="docs/concepts/blender-widgets/" icon="bulb" kicker="Concepts">
+ Number-field dragging, snapping and drag-toggle, in depth.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/imgui/c.mdx b/website/src/content/docs/imgui/c.mdx
new file mode 100644
index 0000000..d9ef9db
--- /dev/null
+++ b/website/src/content/docs/imgui/c.mdx
@@ -0,0 +1,145 @@
+---
+title: Dear ImGui from C
+sidebarLabel: C
+description: All 399 Dear ImGui functions from plain C through cimgui.h, with the naming rules, the app helpers and headless rendering for tests.
+section: Dear ImGui
+order: 20
+languages: ["c", "imgui"]
+sources: ["docs/imgui.md", "bindings/imgui/c/cimgui.h", "bindings/imgui/c/cimgui_impl_bui.h", "bindings/imgui/CMakeLists.txt", "bindings/imgui/gen/coverage.json", "examples/imgui_demo_c.c"]
+---
+
+C has no namespaces, no overloads and no default arguments, and Dear ImGui uses all three. **`cimgui.h` gives you every one of ImGui's 399 functions anyway**, plus every struct with its real C++ layout, so `io->DisplaySize` and `style->Colors[ImGuiCol_Text]` work just as they do in C++.
+
+It follows the conventions of cimgui and dear_bindings, so if you've used either, you already know the names. It's generated from `imgui.h`, which is why nothing is missing.
+
+## Hello from C
+
+```c title="main.c"
+#include "cimgui.h"
+#include "cimgui_impl_bui.h"
+
+static void frame(void* user)
+{
+ float* value = (float*)user;
+ ImGui_ShowDemoWindow();
+ ImGui_Begin("Hello");
+ ImGui_SliderFloat("Value", value, 0.0f, 1.0f);
+ ImGui_Text("%.2f", *value);
+ ImGui_End();
+}
+
+int main(void)
+{
+ float value = 0.5f;
+ ImGui_CreateContext();
+ cImGui_ImplBUI_App* app = cImGui_ImplBUI_CreateApp("Hello", 1280, 800, frame, &value, NULL);
+ cImGui_ImplBUI_RunApp(app);
+ cImGui_ImplBUI_DestroyApp(app);
+ ImGui_DestroyContext();
+}
+```
+
+Link `bui::cimgui` in CMake:
+
+```cmake title="CMakeLists.txt"
+add_subdirectory(BUI)
+add_executable(myapp main.c)
+target_link_libraries(myapp PRIVATE bui::cimgui)
+```
+
+The backend calls `ImGui_NewFrame()`, your `frame(user)` and `ImGui_Render()` itself, and Blender's style and font are on by default. BUI's own C demo is the `bui_imgui_demo_c` target (`examples/imgui_demo_c.c`).
+
+<Figure
+ shot="imgui-cpp-blender"
+ alt="A Dear ImGui scene inspector in Blender's style, with Blender widgets: a table, drag fields, a color edit, sliders, a combo, checkboxes, a progress bar and a plot"
+ caption="A larger Dear ImGui app on BUI, the scene inspector from <code>examples/site/imgui_inspector.cpp</code>, built with Blender widgets. A C program that makes the same calls draws the same pixels."
+/>
+
+## How the names work
+
+Six rules turn any C++ call into its C spelling:
+
+| C++ | C | Rule |
+| --- | --- | --- |
+| `ImGui::Button("OK")` | `ImGui_Button("OK")` | `ImGui::X` becomes `ImGui_X` |
+| `ImGui::Button("OK", size)` | `ImGui_ButtonEx("OK", size)` | The short name takes the required arguments; `Ex` takes all of them |
+| `ImGui::PushID(3)` | `ImGui_PushIDInt(3)` | Overloads get a suffix from the parameter types that differ: `PushID(str)`, `PushIDInt`, `PushIDPtr`, `MenuItemBoolPtr`, `PushStyleVarVec2` |
+| `draw_list->AddLine(p1, p2, col)` | `ImDrawList_AddLine(draw_list, p1, p2, col)` | Methods take the object first |
+| `ImGuiIO& io = ImGui::GetIO()` | `ImGuiIO* io = ImGui_GetIO()` | References become pointers; `const ImVec2&` is a plain `ImVec2` |
+| `ImGuiListClipper clipper;` | `ImGuiListClipper* c = ImGuiListClipper_New();` | Constructors are `X_New` / `X_NewEx(...)`; destroy with `X_Delete(obj)` |
+
+A few more details:
+
+- **printf-style functions keep their `...`:** `ImGui_Text("%d items", n)`. The `...V` variants take a `va_list`.
+- **Every struct has its C++ layout,** checked by `static_assert`s when BUI builds. Vectors are spelled out: `ImVector_ImDrawCmd` has `Size`, `Capacity` and `Data`.
+- **Vectors in literals:** `(ImVec2){ 20, 20 }` works anywhere an `ImVec2` goes.
+
+Here's a draw-list snippet from the C demo, to show the rules together:
+
+```c
+ImDrawList* dl = ImGui_GetWindowDrawList();
+const ImVec2 p = ImGui_GetCursorScreenPos();
+ImDrawList_AddRectFilled(dl, p, (ImVec2){ p.x + 60, p.y + 20 }, IM_COL32(71, 114, 179, 255));
+ImDrawList_AddCircle(dl, (ImVec2){ p.x + 90, p.y + 10 }, 9, IM_COL32_WHITE);
+ImGui_Dummy((ImVec2){ 100, 22 });
+```
+
+## The backend in C: `cimgui_impl_bui.h`
+
+The C backend's functions use a `cImGui_ImplBUI_` prefix:
+
+| Function | What it does |
+| --- | --- |
+| `cImGui_ImplBUI_CreateApp(title, w, h, frame, user, config)` | A window whose client area is ImGui |
+| `cImGui_ImplBUI_RunApp(app)` | BUI's message loop, until the window closes |
+| `cImGui_ImplBUI_CloseApp(app)` | Close the window (ends `RunApp`) |
+| `cImGui_ImplBUI_DestroyApp(app)` | Shut down |
+| `cImGui_ImplBUI_IsHeadless(app)` | True when there's no window system |
+| `cImGui_ImplBUI_Init(node, frame, user, config)` | ImGui inside a kit `custom` node of an existing BUI UI |
+| `cImGui_ImplBUI_RequestFrames(n)`, `RequestFrameIn(ms)` | Ask for frames when your data changes |
+| `cImGui_ImplBUI_StyleBlender(style, scale)` | Blender's theme on any `ImGuiStyle` |
+| `cImGui_ImplBUI_GetScale()`, `SetScale(scale)` | BUI's UI scale (DPI) |
+| `cImGui_ImplBUI_SetBlenderWidgets(on)` and friends | The [Blender-widgets](../blender-widgets/) switch |
+
+`config` may be `NULL` for the defaults. To change one field, start from the defaults:
+
+```c
+cImGui_ImplBUI_Config cfg = cImGui_ImplBUI_DefaultConfig();
+cfg.FontSize = 15.0f; /* pixels at scale 1; 0 is Blender's UI text size */
+cImGui_ImplBUI_App* app = cImGui_ImplBUI_CreateApp("Tool", 1280, 800, frame, &state, &cfg);
+```
+
+The fields are `BlenderStyle`, `BlenderFont`, `FontSize`, `FollowScale` and `SettleFrames`.
+
+## Headless rendering and tests
+
+The C backend can run ImGui without a window: frames render into an off-screen raster, and you feed input the way a window would. It's how BUI tests its own bindings.
+
+```c title="test_ui.c"
+cImGui_ImplBUI_App* app = cImGui_ImplBUI_CreateHeadlessApp(800, 600, frame, &state, NULL);
+cImGui_ImplBUI_Render(app, 3); /* run 3 frames */
+cImGui_ImplBUI_Click(app, 100, 40); /* a left click */
+cImGui_ImplBUI_TypeText(app, "hello");
+cImGui_ImplBUI_Key(app, "Return", 0); /* X11 key names */
+cImGui_ImplBUI_SavePNG(app, "shot.png");
+cImGui_ImplBUI_DestroyApp(app);
+```
+
+- **Input:** `MouseMove`, `MouseDown`, `MouseUp` (button 0 left, 1 right, 2 middle), `Click`, `Scroll`, `KeyDown`, `KeyUp`, `Key` and `TypeText`. Key names are X11 keysyms (`"Return"`, `"BackSpace"`, `"Left"`, `"a"`). Modifiers are `BK_SHIFT` 1, `BK_CTRL` 2 and `BK_ALT` 4.
+- **Output:** `cImGui_ImplBUI_Pixels(app, &w, &h)` returns the last frame as `0xAARRGGBB` values, row by row. `SavePNG` writes it to a file.
+
+The C demo uses exactly this for `bui_imgui_demo_c --screenshot out.png`.
+
+## Next steps
+
+<CardGrid>
+ <Card title="From C++" href="docs/imgui/cpp/" icon="cpu" kicker="Dear ImGui">
+ The backend in depth: config, idle frames, embedding in a node.
+ </Card>
+ <Card title="Blender widgets" href="docs/imgui/blender-widgets/" icon="sparkles" kicker="Dear ImGui">
+ The build where ImGui's widgets are Blender's.
+ </Card>
+ <Card title="Coverage" href="docs/imgui/coverage/" icon="check" kicker="Dear ImGui">
+ How the bindings are generated, and how to regenerate them.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/imgui/coverage.mdx b/website/src/content/docs/imgui/coverage.mdx
new file mode 100644
index 0000000..baa5c7c
--- /dev/null
+++ b/website/src/content/docs/imgui/coverage.mdx
@@ -0,0 +1,128 @@
+---
+title: Dear ImGui coverage
+sidebarLabel: Coverage
+description: Exactly how much of Dear ImGui each language binds, what's skipped and why, how the bindings are regenerated, and where the Blender style's colours come from.
+section: Dear ImGui
+order: 60
+languages: ["cpp", "c", "python", "rust", "imgui"]
+sources: ["docs/imgui.md", "bindings/imgui/README.md", "bindings/imgui/gen/coverage.json", "bindings/imgui/imgui_impl_bui.h", "bindings/imgui/blender/README.md"]
+---
+
+Before you pick a language, you'll want to know: **does it have the function I need?** This page answers that with exact numbers, counted by the generator itself, and tells you where to go for anything a binding skips.
+
+Short version: C++ and C have everything. Python and safe Rust have everything except functions that take a C `va_list`, an untyped `void*` or a C callback, and each of those has a typed alternative.
+
+## What's vendored
+
+BUI ships **Dear ImGui 1.93.1 WIP** (`IMGUI_VERSION_NUM 19302`) in `bindings/imgui/extern/imgui`, under its MIT license. Only the core files, `imconfig.h`, the `imstb_*.h` headers and `misc/cpp/imgui_stdlib.*` are vendored, not ImGui's own `backends/`: BUI brings its own.
+
+That version has **399 functions in `namespace ImGui`** (overloads counted separately, obsolete ones left out; 14 of them are `...V` functions taking a `va_list`) and **264 methods and constructors** on its structs (223 methods, 41 constructors). The bindings add a default constructor to the 9 structs that declare none, which makes 273.
+
+## Per language
+
+| | `namespace ImGui` | Methods and constructors | Notes |
+| --- | ---: | ---: | --- |
+| C++ | 399 / 399 | 273 / 273 | It's Dear ImGui itself |
+| C (`cimgui.h`) | 399 / 399 | 273 / 273 | 894 C functions with the `Ex` variants; all 41 structs with their layout, 5 opaque; 737 enum values |
+| Python | 366 / 399 | 264 / 273 | 366 of the 385 without `va_list`; 1,474 constants (both spellings); fields of all structs |
+| Rust FFI (`imgui::sys`) | 385 / 399 | 272 / 273 | Everything but `va_list`: 879 of the 894 C functions |
+| Rust safe layer | 366 / 399 | 264 / 273 | The rest is in `sys` |
+
+<StatusTable
+ columns={["Language", "Status", "Notes"]}
+ rows={[
+ ["C++", "done", "Every function: it's the real Dear ImGui"],
+ ["C", "done", "399 of 399 functions, every struct layout"],
+ ["Python", "partial", "366 of 399: skips <code>va_list</code>, <code>void*</code> and C-callback functions"],
+ ["Rust", "partial", "Safe layer 366 of 399; the FFI has all but the <code>va_list</code> functions"],
+ ]}
+/>
+
+## What Python and safe Rust skip, and what to use instead
+
+All of these are in C and in Rust's `sys`.
+
+| Skipped | Why | Use instead |
+| --- | --- | --- |
+| The 14 `...V` functions (`TextV`, `SetTooltipV` …) | They take a C `va_list` | The `...` versions, or format the string first |
+| `PushID(const void*)`, `GetID(const void*)`, `TreeNode` / `TreeNodeEx` / `TreePush(const void*, …)` | An untyped pointer as an ID | The string or integer overloads |
+| The 8 `*Scalar` / `*ScalarN` widgets (`DragScalar`, `SliderScalar`, `InputScalar` …) | An untyped `void*` value | The typed widgets: `drag_float`, `slider_int`, `input_int` … |
+| `MemFree`, `ImGuiStorage::SetVoidPtr`, `ImGuiStoragePair(key, void*)` | Untyped pointers | |
+| `ImFontAtlas::AddFontFromMemoryTTF`, `AddFontFromMemoryCompressedTTF` | Untyped pointers | `add_font_from_file_ttf` |
+| The getter overloads of `Combo`, `ListBox`, `PlotLines`, `PlotHistogram` | C callbacks | The list overloads, which are bound |
+| `SetAllocatorFunctions`, `GetAllocatorFunctions`, `ImDrawList::AddCallback` | C callbacks | |
+| `InputText`'s user callback | A C callback | The buffer callback is used internally to grow strings |
+| `ImFontGlyphRangesBuilder::AddRanges` / `BuildRanges`, `ImGuiSelectionBasicStorage::GetNextSelectedItem` | Pointer-to-pointer | |
+
+`bindings/imgui/gen/coverage.json` lists every skipped function per language, with its reason.
+
+## Regenerating the bindings
+
+The C, Python and Rust bindings are **generated** from `imgui.h`, so they never drift from ImGui. The generator is standard-library Python, with no other dependencies:
+
+```sh
+py -3 -I bindings/imgui/gen/gen.py
+```
+
+It parses `imgui.h` (declarations, enums and flags, typedefs, structs with their fields, methods and constructors, default arguments, overloads, `fmt, ...`, arrays and callbacks) into `bindings/imgui/gen/imgui_api.json`, then writes:
+
+| File | What it is |
+| --- | --- |
+| `bindings/imgui/c/cimgui.h`, `cimgui.cpp` | The C API |
+| `bindings/python/src/buiimgui_gen.inc` | The Python functions, types, field tables and constants |
+| `bindings/rust/blenderui-imgui/src/sys.rs`, `safe.rs` | The Rust FFI and safe layer |
+| `bindings/imgui/gen/coverage.json` | What each language binds, and why not |
+
+Hand-written, by contrast: the C backend API (`cimgui_impl_bui.h/.cpp`), the Python runtime and module, `blenderui.imgui`'s `run` and `HeadlessApp`, the Rust `lib.rs` (helpers, `Owned`, the runner), the examples and the tests.
+
+**Updating ImGui:** copy the same files from a newer checkout, run the generator, and rebuild. The C++ compiler checks every C struct layout (`static_assert`s in `cimgui.cpp`), and `imgui::sys::layout_mismatches()` checks the Rust ones. If you use the [Blender-widgets](../blender-widgets/) build, `bindings/imgui/blender/rebase.py` merges ImGui's changes into the widget copy.
+
+## The Blender style
+
+`ImGui_ImplBUI_StyleBlender` takes its colours from Blender's default theme (`userdef_default_theme.c`) and its metrics from Blender's widget unit (20 px at scale 1). A few of the mappings:
+
+| ImGui colour | From Blender's theme |
+| --- | --- |
+| `Text` | `wcol_regular.text`, #e6e6e6 |
+| `WindowBg` | Region background, #303030 |
+| `PopupBg` | `wcol_menu_back.inner`, #181818 |
+| `FrameBg` | `wcol_num.inner`, #545454 |
+| `Button` / `ButtonActive` | `wcol_regular.inner` #545454 / `inner_sel` #4772b3 |
+| `SliderGrab` | `wcol_numslider.item`, #4772b3 |
+| `CheckMark` | `wcol_option.item`, #ffffff |
+| `InputTextCursor` | `widget_text_cursor`, #71a8ff |
+| `TextLink` | Theme `link`, #6fa9e6 |
+
+"Hovered" colours use Blender's own rule: HSL saturation ×1.15, lightness ×1.2. The full table is in `bindings/imgui/README.md`.
+
+**Metrics,** scaled with the UI: frames are one widget unit tall, corners are rounded 4 px, scrollbars are 11 px with round ends, item spacing is (8, 2), and outlines are 1 px.
+
+**The font** is Inter, embedded in BUI, at Blender's UI text size: an 11 px em at scale 1. ImGui sizes fonts by ascent minus descent, so that's 13.3 px in ImGui's terms (`ImGui_ImplBUI_BlenderFontSize`).
+
+## Known gaps
+
+The backend's own gaps, in every language:
+
+- **IME** candidate window placement isn't forwarded. **Gamepads** and **multi-viewports** aren't supported. <ComingSoon inline />
+- **Punctuation keys on Windows** arrive only as text, so `ImGuiKey_Comma` and friends are pressed and released at once there. X11 sends real key names and releases.
+- **Losing window focus** isn't forwarded by the kit (clicking another BUI widget is). Held modifiers are corrected by the next input event.
+- **macOS** still feeds wheel steps, not precise deltas.
+
+And the binding-level limits:
+
+- **One thread.** Dear ImGui has one current context: create apps and call ImGui from one thread. Python and Rust references to ImGui objects (draw lists, IO, fonts) are borrowed, so don't keep them past their context.
+- **Assertions.** In release builds `IM_ASSERT` is off and ImGui recovers from most API misuse (`io.ConfigErrorRecovery`). With assertions on, misuse aborts the process, from every language.
+
+## Next steps
+
+<CardGrid>
+ <Card title="From Python" href="docs/imgui/python/" icon="book" kicker="Dear ImGui">
+ pyimgui-style calls on the 366 bound functions.
+ </Card>
+ <Card title="From Rust" href="docs/imgui/rust/" icon="book" kicker="Dear ImGui">
+ The safe layer, and sys for the rest.
+ </Card>
+ <Card title="Blender widgets" href="docs/imgui/blender-widgets/" icon="sparkles" kicker="Dear ImGui">
+ The build where ImGui's widgets are Blender's.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/imgui/cpp.mdx b/website/src/content/docs/imgui/cpp.mdx
new file mode 100644
index 0000000..cc9510e
--- /dev/null
+++ b/website/src/content/docs/imgui/cpp.mdx
@@ -0,0 +1,143 @@
+---
+title: Dear ImGui from C++
+sidebarLabel: C++
+description: Run your existing Dear ImGui code on BUI with one header and one CMake target, in Blender's theme, on the CPU or the GPU.
+section: Dear ImGui
+order: 10
+languages: ["cpp", "imgui"]
+sources: ["docs/imgui.md", "bindings/imgui/README.md", "bindings/imgui/imgui_impl_bui.h", "bindings/imgui/CMakeLists.txt", "CMakeLists.txt", "examples/imgui_demo.cpp"]
+---
+
+Already have a Dear ImGui app? Keep it. **BUI runs the real Dear ImGui (1.93.1 WIP), so your code compiles unchanged.** You swap the platform and renderer backend for one header, and your windows, sliders and tables come out in Blender's colours and font, drawn by BUI on the CPU or the GPU.
+
+A **backend**, in ImGui terms, is the glue that feeds ImGui input and draws its output. BUI's is `imgui_impl_bui.h`. It replaces the usual pair (say, `imgui_impl_win32` plus `imgui_impl_dx11`) on every platform BUI supports.
+
+<Figure
+ src="images/imgui-stock.png"
+ alt="Dear ImGui's demo window and a small custom window on BUI, in Blender's dark theme with the Inter font"
+ caption="ImGui's own demo on BUI, with Blender's theme. Every widget is still ImGui's."
+ width={1280}
+ height={1000}
+ variant="bleed"
+/>
+
+## Hello, ImGui on BUI
+
+```cpp title="main.cpp"
+#include "imgui.h"
+#include "imgui_impl_bui.h"
+
+static void frame(void*) { ImGui::ShowDemoWindow(); }
+
+int main() {
+ ImGui::CreateContext();
+ ImGui_ImplBUI_App* app = ImGui_ImplBUI_CreateApp("Dear ImGui on BUI", 1280, 800, frame, nullptr);
+ ImGui_ImplBUI_RunApp(app); // BUI's message loop until the window closes
+ ImGui_ImplBUI_DestroyApp(app);
+ ImGui::DestroyContext();
+}
+```
+
+That's the whole program. Notice what's missing: no `NewFrame()`, no `Render()`, no swap chain. You hand BUI a `frame` function, and the backend calls `ImGui::NewFrame()`, your function and `ImGui::Render()` itself, whenever a frame is due.
+
+- **`ImGui_ImplBUI_CreateApp(title, width, height, frame, user)`** opens a native window whose whole client area is ImGui. It needs a current ImGui context. An optional last argument takes a config (below).
+- **`ImGui_ImplBUI_RunApp(app)`** runs BUI's message loop until the window closes.
+- **`ImGui_ImplBUI_DestroyApp(app)`** shuts the backend down.
+- **`user`** is passed to `frame` unchanged: point it at your app's state.
+
+## Build it with CMake
+
+Add BUI to your project and link `bui::imgui`. It contains Dear ImGui's core, its demo, the BUI backend and the Blender style.
+
+```cmake title="CMakeLists.txt"
+cmake_minimum_required(VERSION 3.20)
+project(myapp C CXX)
+
+add_subdirectory(BUI)
+add_executable(myapp main.cpp)
+target_link_libraries(myapp PRIVATE bui::imgui)
+```
+
+The `BUI_BUILD_IMGUI` option is on whenever a C++ compiler is present. To try BUI's own demo first, build the `bui_imgui_demo` target from a clone of BUI:
+
+```sh
+cmake -S . -B build
+cmake --build build --target bui_imgui_demo
+```
+
+Run it as it is for a window, or with `--screenshot out.png` to render a few frames headless and save a PNG. Add `--gpu` to render that screenshot on the GPU.
+
+## On the GPU
+
+Set `BUI_GPU=1` before you start the app, and BUI draws ImGui with Direct3D 11 (Windows) or OpenGL 3.3 (Linux) instead of the software raster. Your code doesn't change.
+
+<Figure
+ shot="imgui-cpp-blender"
+ alt="A Dear ImGui scene inspector with Blender's widgets and style: a table, drag fields, a color edit, sliders, a combo, checkboxes, a progress bar and a plot"
+ caption="With <code>BUI_IMGUI_BLENDER_WIDGETS=ON</code>, ImGui's widgets become Blender's (<code>examples/site/imgui_inspector.cpp</code>). See <a href='../blender-widgets/'>Blender widgets</a>."
+/>
+
+## Configure the backend
+
+`CreateApp` and `Init` take an optional `ImGui_ImplBUI_Config`:
+
+```cpp
+ImGui_ImplBUI_Config cfg;
+cfg.BlenderStyle = false; // keep your own ImGuiStyle (it's still scaled)
+cfg.FontSize = 15.0f; // pixels at scale 1
+ImGui_ImplBUI_App* app = ImGui_ImplBUI_CreateApp("Tool", 1280, 800, frame, &state, &cfg);
+```
+
+| Field | Default | What it does |
+| --- | --- | --- |
+| `BlenderStyle` | `true` | Apply Blender's theme colours and metrics at the UI scale |
+| `BlenderFont` | `true` | Load Blender's UI font (Inter, embedded in BUI) into `io.Fonts` |
+| `FontSize` | `0` | Font size in pixels at scale 1; 0 means Blender's UI text size |
+| `FollowScale` | `true` | Re-apply the style and font size when the DPI scale changes |
+| `SettleFrames` | `3` | Extra frames after an input event, so hover states settle |
+
+The Blender style is also a function: `ImGui_ImplBUI_StyleBlender(&style, scale)` applies it to any `ImGuiStyle`. `ImGui_ImplBUI_AddBlenderFont(size)` adds Inter on its own, and `ImGui_ImplBUI_BlenderFontSize(scale)` tells you the size that matches Blender's text.
+
+## Idle costs nothing
+
+Most ImGui backends render 60 frames a second forever. BUI's doesn't. Input asks for a frame; after each frame the backend asks for another only while something can still change: a few settle frames after input, frames while the output keeps changing (animations, a held repeat button), timer wakes for the text cursor blink and tooltip delays. Then nothing runs, and an idle window uses no CPU. A frame whose draw data didn't change doesn't even redraw.
+
+If your app changes something the UI shows (a download finishes, a file reloads), ask for a frame yourself:
+
+```cpp
+ImGui_ImplBUI_RequestFrames(); // one frame now (or n back to back)
+ImGui_ImplBUI_RequestFrameIn(500); // one frame in about 500 ms
+```
+
+## ImGui inside a BUI interface
+
+ImGui doesn't have to own the window. It can live in one **custom node** of a larger BUI interface, next to the kit's native widgets:
+
+```cpp
+BKNode* node = BK_node_new("custom");
+BK_node_add(column, node, -1);
+BK_set_num(node, "fill", 1);
+ImGui::SetCurrentContext(my_ctx);
+ImGui_ImplBUI_Init(node, frame, user); // the backend runs NewFrame/frame/Render itself
+```
+
+Several nodes can each host their own ImGui context. Because the backend runs inside `BK_render`, it works in every BUI host: the native windows (Win32, X11, Cocoa), the Tk and Qt hosts, and headless rendering into a raster. The [C kit page](../../c/c-api/) explains nodes and contexts.
+
+## What the backend supports
+
+- **Input:** mouse (three buttons, held together), precise vertical and horizontal wheel, keyboard, typed UTF-8 text, modifiers and focus.
+- **Platform:** mouse cursor shapes, the host's clipboard, DPI scale, time.
+- **Rendering:** every BUI renderer (software, Direct3D 11, OpenGL 3.3), per-command clip rectangles, large meshes (`VtxOffset`), dynamic textures. `ImTextureID` is a BUI texture id from `BUI_texture_create`, so `ImGui::Image` works with your own pixels.
+
+Not supported yet: IME candidate window placement, gamepads and multi-viewports <ComingSoon inline />. The full list of small gaps is on the [coverage page](../coverage/#known-gaps).
+
+## Next steps
+
+<CardGrid>
+ <Card title="Blender widgets" href="docs/imgui/blender-widgets/" icon="sparkles" kicker="Dear ImGui">
+ One CMake flag, and ImGui's widgets become Blender's.
+ </Card>
+ <Card title="Coverage" href="docs/imgui/coverage/" icon="check" kicker="Dear ImGui">
+ What's bound, what's skipped, and the known gaps.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/imgui/python.mdx b/website/src/content/docs/imgui/python.mdx
new file mode 100644
index 0000000..d927981
--- /dev/null
+++ b/website/src/content/docs/imgui/python.mdx
@@ -0,0 +1,151 @@
+---
+title: Dear ImGui from Python
+sidebarLabel: Python
+description: The real Dear ImGui in Python with blenderui.imgui, pyimgui-style calls, a one-line window with imgui.run, and headless testing.
+section: Dear ImGui
+order: 30
+languages: ["python", "imgui"]
+sources: ["docs/imgui.md", "bindings/python/bui/imgui.py", "bindings/python/src/buiimgui_module.cpp", "bindings/imgui/gen/coverage.json", "bindings/python/tests/test_imgui.py", "pyproject.toml"]
+---
+
+Immediate-mode UI is wonderfully direct: every frame, you just say what's on screen. **`blenderui.imgui` brings the real Dear ImGui to Python**, in Blender's look, with a window in one call. It comes with `pip install blenderui`: nothing else to install, nothing to compile. (The very first wheels, 0.1.0, predate it; if `import blenderui.imgui` fails, run `pip install -U blenderui`.)
+
+If you've used pyimgui, the calls will feel familiar: snake_case names, and changed values come back as return values.
+
+<Figure
+ shot="imgui-python-stock"
+ alt="A Dear ImGui scene inspector from Python with ImGui's own widgets and colors: a table, drag fields, a color edit, sliders, a combo, checkboxes, a progress bar and a plot"
+ caption="A scene inspector in <code>blenderui.imgui</code>, with ImGui's own widgets and colors (<code>examples/site/imgui_inspector.py</code>)."
+/>
+
+## A window in 15 lines
+
+```py title="hello_imgui.py"
+import blenderui.imgui as imgui
+
+state = {"value": 0.5, "text": "Edit me", "opened": True}
+
+def frame():
+ imgui.show_demo_window()
+ expanded, state["opened"] = imgui.begin("Hello", state["opened"])
+ changed, state["value"] = imgui.slider_float("Value", state["value"], 0.0, 1.0)
+ changed, state["text"] = imgui.input_text("Text", state["text"])
+ if imgui.button("Reset"):
+ state["value"] = 0.5
+ imgui.text("value %.2f" % state["value"])
+ imgui.end()
+
+imgui.run(frame, title="Hello", size=(1280, 800))
+```
+
+Run it with `python hello_imgui.py`. You get ImGui's demo window and your own small window, with a slider, a text field and a button.
+
+- **`frame()`** runs once per ImGui frame. Everything you call inside it is on screen for that frame.
+- **`imgui.run(frame, title=..., size=...)`** opens a BUI window and calls `frame` until you close it. It creates the ImGui context for you if none exists.
+- **An exception in `frame`** closes the window and comes out of `imgui.run`, so you see the traceback as usual.
+
+`imgui.run` also takes `blender_style=`, `blender_font=`, `font_size=` and `ini_file=` (where ImGui saves window positions; `None`, the default, saves nothing).
+
+## How C++ calls become Python
+
+ImGui's C++ API passes values by pointer so widgets can change them. Python can't do that, so the new value comes back **after** the usual result:
+
+```py
+changed, value = imgui.slider_float("Value", value, 0.0, 1.0)
+changed, (r, g, b) = imgui.color_edit3("Color", (r, g, b))
+h, s, v = imgui.color_convert_rgb_to_hsv(1, 0, 0) # pure outputs are just returned
+```
+
+The rest follows a handful of rules:
+
+| C++ | Python |
+| --- | --- |
+| `ImGui::SliderFloat(...)` | `imgui.slider_float(...)`: snake_case |
+| `bool* p_open` (may be `NULL`) | Pass a value, or `None` for `NULL`: `imgui.begin("Window")` has no close button |
+| `ImVec2`, `ImVec4` arguments | Tuples: `(x, y)`. Results are `imgui.Vec2` / `imgui.Vec4` named tuples (`pos.x`) |
+| `ImGui::Text("%d items", n)` | One string: `imgui.text("%d items" % n)` |
+| A pointer and a count | A list: `imgui.combo("Combo", current, ["a", "b"])`, `imgui.plot_lines("Plot", values)` |
+| `char* buf, size_t size` in `InputText*` | A `str` of any length, returned changed: the buffer grows for you |
+| Overloads (`PushID(str)`, `PushID(int)`) | One name that tries each: `imgui.push_id("x")`, `imgui.push_id(3)`. Each also keeps its own name (`push_id_int`) |
+| `ImGuiWindowFlags_NoTitleBar` | `imgui.WINDOW_NO_TITLE_BAR`, or the C++ name `imgui.ImGuiWindowFlags_NoTitleBar` |
+
+Lost? `help(imgui.begin)` shows the Python signature and the C++ function it calls.
+
+## Structs, methods and constructors
+
+Structs are objects, and their fields have both snake_case and C++ names:
+
+```py
+# inside frame(), between imgui.begin() and imgui.end()
+io = imgui.get_io()
+io.config_flags |= imgui.CONFIG_NAV_ENABLE_KEYBOARD
+io.ini_filename = None
+print(io.display_size)
+
+imgui.get_style().colors[imgui.COL_TEXT] = (1, 1, 1, 1)
+
+draw_list = imgui.get_window_draw_list()
+draw_list.add_line((10, 10), (100, 50), imgui.im_col32(255, 0, 0))
+```
+
+- **Arrays and `ImVector`s** are indexable views: `style.colors[...]`, `io.fonts.fonts[0]`.
+- **Constructors** are classes: `imgui.ImGuiListClipper()`, `imgui.ImGuiTextFilter("x")`, `imgui.ImGuiStorage()`. They're deleted with the Python object.
+- **`imgui.im_col32(r, g, b, a=255)`** packs a colour, like C++'s `IM_COL32`.
+
+## Testing without a window
+
+`imgui.HeadlessApp` renders into an off-screen raster, and you feed it input as a window would. Perfect for tests and screenshots in CI:
+
+```py title="test_ui.py"
+import blenderui.imgui as imgui
+
+def frame():
+ imgui.begin("Test")
+ imgui.button("OK")
+ imgui.end()
+
+with imgui.HeadlessApp(frame, size=(800, 600)) as app:
+ app.render(3) # request and run 3 frames
+ app.click(100, 40) # also mouse_move, mouse_down, mouse_up, scroll
+ app.type_text("hello") # key("Return"), key("a", imgui.BK_CTRL)
+ w, h, pixels = app.pixels() # BGRA bytes
+ app.save_png("shot.png")
+```
+
+`bindings/python/tests/test_imgui.py` is a full example: widgets, drags, the wheel, typing, struct fields and the demo windows, all headless.
+
+## Blender widgets from Python
+
+The switch for [Blender widgets](../blender-widgets/) is there in Python too: `imgui.has_blender_widgets()`, `imgui.get_blender_widgets()` and `imgui.set_blender_widgets(on)`. The UI scale is `imgui.get_ui_scale()` and `imgui.set_ui_scale(scale)`.
+
+<Callout type="note" title="The PyPI wheel uses ImGui's own widgets">
+Blender widgets are a build option (`BUI_IMGUI_BLENDER_WIDGETS`), and it's off by default, so `pip install blenderui` gives you ImGui's widgets in Blender's theme. For Blender's widgets in Python, build BUI from source with the option on.
+</Callout>
+
+<Figure
+ shot="imgui-python-blender"
+ alt="The same inspector with Blender's widgets and style"
+ caption="The same inspector with Blender widgets: drag fields scrub like Blender's number fields."
+/>
+
+## What's not in Python
+
+Python binds 366 of ImGui's 399 functions. The rest need something Python can't pass safely: a C `va_list` (use the normal functions and format first), an untyped `void*` (use the typed versions: `drag_float`, `input_int` …) or a C callback. The [coverage page](../coverage/) lists every one.
+
+<Callout type="joke">
+Immediate mode means you redraw the whole UI every frame. On BUI, "every frame" includes zero frames when nothing moves. Your laptop fan says thank you.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Blender widgets" href="docs/imgui/blender-widgets/" icon="sparkles" kicker="Dear ImGui">
+ What changes when ImGui's widgets are Blender's.
+ </Card>
+ <Card title="Coverage" href="docs/imgui/coverage/" icon="check" kicker="Dear ImGui">
+ Exactly what Python binds, and why the rest isn't.
+ </Card>
+ <Card title="Blender components" href="docs/python/components/" icon="layers" kicker="Python">
+ Prefer retained mode? BUI's Python components map one-to-one to Blender's widgets.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/imgui/rust.mdx b/website/src/content/docs/imgui/rust.mdx
new file mode 100644
index 0000000..9c71dbd
--- /dev/null
+++ b/website/src/content/docs/imgui/rust.mdx
@@ -0,0 +1,160 @@
+---
+title: Dear ImGui from Rust
+sidebarLabel: Rust
+description: The blenderui-imgui crate gives you the real Dear ImGui in Rust, with a safe layer, the full FFI underneath, a one-call runner and headless tests.
+section: Dear ImGui
+order: 40
+languages: ["rust", "imgui"]
+sources: ["docs/imgui.md", "bindings/rust/blenderui-imgui/Cargo.toml", "bindings/rust/blenderui-imgui/src/lib.rs", "bindings/rust/blenderui-imgui/src/safe.rs", "bindings/rust/blenderui-imgui/examples/demo.rs", "bindings/rust/Cargo.toml", "bindings/imgui/gen/coverage.json"]
+---
+
+Want Dear ImGui in Rust without fighting `unsafe` or a pile of build scripts? **The `blenderui-imgui` crate gives you a safe, generated API over the real Dear ImGui**, drawn by BUI in Blender's look. A window is one function call, and the C++ is compiled for you by Cargo.
+
+You get two layers in one crate: a **safe layer** (`&str`, `&mut T`, slices) for everyday code, and the **raw FFI** (`imgui::sys`) for anything the safe layer doesn't cover.
+
+## Add the crate
+
+`blenderui-imgui` isn't on crates.io yet <ComingSoon inline /> (the main `blenderui` crate is). Until it is, use a git dependency:
+
+```toml title="Cargo.toml"
+[dependencies]
+blenderui-imgui = { git = "https://github.com/ppmpreetham/BUI" }
+```
+
+The first build compiles Dear ImGui, the BUI backend and BUI's C kit through CMake, so you need what the main crate needs: Rust 1.88 or newer, CMake and a C/C++ compiler. Nothing else is downloaded. The [installation page](../../start/installation/) has the details.
+
+## Hello from Rust
+
+```rust title="src/main.rs"
+use blenderui_imgui as imgui;
+
+fn main() {
+ let mut value = 0.5f32;
+ let mut text = String::from("Edit me");
+ imgui::run("Hello", [1280, 800], move || {
+ imgui::show_demo_window();
+ imgui::begin("Hello");
+ imgui::slider_float("Value", &mut value, 0.0, 1.0);
+ imgui::input_text("Text", &mut text);
+ if imgui::button("Reset") {
+ value = 0.5;
+ }
+ imgui::text(&format!("value {value:.2}"));
+ if let Some(dl) = imgui::get_window_draw_list() {
+ let p = imgui::get_cursor_screen_pos();
+ dl.add_circle_filled([p.x + 10.0, p.y + 10.0], 8.0, imgui::im_col32(71, 114, 179, 255));
+ }
+ imgui::end();
+ });
+}
+```
+
+`cargo run` opens a window with ImGui's demo and yours.
+
+Your closure owns its state (`move`), so there's no `static mut` and no `Rc<RefCell<…>>`.
+
+- **`imgui::run(title, size, frame)`** opens a BUI window and calls `frame` inside each ImGui frame until the window closes. It creates an ImGui context if none is current. Without a window system it returns at once.
+- **A panic in `frame`** closes the window and resumes from `run()`, so you get the usual panic message.
+
+BUI's own example is `cargo run -p blenderui-imgui --example demo` from `bindings/rust`; add `-- --screenshot demo.png` to render it headless.
+
+## The safe layer
+
+It's generated from `imgui.h`. Dear ImGui's own documentation and demo are written in C++, so here's how its names and types turn into Rust:
+
+| Dear ImGui (C++) | Rust |
+| --- | --- |
+| `ImGui::Button("OK")` / `ImGui::Button("OK", size)` | `button("OK")` / `button_ex("OK", size)`: optional arguments move to an `_ex` variant |
+| `const char*` | `&str` |
+| `float* v` (an in/out value) | `&mut f32`; `Option<&mut T>` where C++ accepts `NULL` |
+| `float col[3]` | `&mut [f32; 3]` |
+| A pointer and a count | A slice |
+| `char* buf, size_t size` in `InputText*` | `&mut String` (it grows as needed) |
+| `ImVec2` | `impl Into<ImVec2>`: `[x, y]` or `(x, y)` |
+| `draw_list->AddLine(...)` | `draw_list.add_line(...)`: methods on the structs |
+| `ImGuiTextFilter filter("x")` | `ImGuiTextFilter::new_ex("x")`, an `Owned<T>` that's deleted when dropped |
+
+**About lifetimes:** references ImGui returns (`get_io()`, `get_style()`, draw lists) are `'static` in the signatures, but they're only valid while their ImGui context lives. Don't keep them past it.
+
+## The FFI: `imgui::sys`
+
+Everything in `cimgui.h` is in `imgui::sys`, generated from the same description, with no bindgen or libclang:
+
+- **Every struct** with its C++ layout (`ImVector<T>`, unions, bit fields as storage words).
+- **Every enum value** as a constant.
+- **Every C function:** 879 of the 894 C functions. The 15 missing ones take a C `va_list`.
+
+`sys` is re-exported at the crate root, so `imgui::ImGuiWindowFlags_NoTitleBar` and `imgui::ImVec2` work directly. The names are those of `cimgui.h`, Dear ImGui's generated C API.
+
+## Configure and test: `imgui::App`
+
+`run` is a shortcut for `App`. Use `App` directly for options or for tests:
+
+```rust
+let frame = || imgui::show_demo_window();
+let mut config = imgui::Config::default();
+config.font_size = 15.0; // pixels at scale 1; 0 is Blender's UI text size
+let mut app = imgui::App::with_config(Some("Tool"), [1280, 800], config, frame);
+app.run();
+```
+
+`Config` has `blender_style`, `blender_font`, `font_size`, `follow_scale` and `settle_frames`.
+
+For tests, `App::headless(size, frame)` renders into an off-screen raster:
+
+```rust title="tests/ui.rs"
+use blenderui_imgui as imgui;
+
+#[test]
+fn renders_and_types() {
+ let mut name = String::new();
+ let mut app = imgui::App::headless([800, 600], move || {
+ imgui::begin("Test");
+ imgui::input_text("Name", &mut name);
+ imgui::end();
+ });
+ app.render(3); // request and run 3 frames
+ app.click(100.0, 60.0); // pixel coordinates in the app
+ app.type_text("hello");
+ assert!(app.save_png("shot.png"));
+}
+```
+
+The app also has `mouse_move`, `mouse_down`, `mouse_up`, `scroll`, `key`, `key_down`, `key_up`, `pixels()` and `frame_count()`. The crate's own tests (`tests/headless.rs`) are a fuller example: they check struct sizes against C++, widgets and input, owned objects and a panic in the frame.
+
+## Blender widgets
+
+Turn on the `blender-widgets` feature and ImGui's widgets become Blender's own:
+
+```toml title="Cargo.toml"
+[dependencies]
+blenderui-imgui = { git = "https://github.com/ppmpreetham/BUI", features = ["blender-widgets"] }
+```
+
+<Figure
+ shot="imgui-cpp-blender"
+ alt="A Dear ImGui scene inspector drawn with Blender's widgets: joined drag fields, sliders with a fill bar, Blender's checkboxes and dropdowns"
+ caption="Blender widgets in a Dear ImGui app (<code>examples/site/imgui_inspector.cpp</code>). The <code>blender-widgets</code> feature switches on the same widgets for your Rust code."
+/>
+
+At runtime, `imgui::has_blender_widgets()`, `imgui::blender_widgets()` and `imgui::set_blender_widgets(on)` check and switch them. [What changes](../blender-widgets/) has its own page.
+
+## Good to know
+
+- **One thread.** Dear ImGui has one current context: create apps and call `imgui` functions from one thread.
+- **The safe layer covers 366 of ImGui's 399 functions.** The rest (`va_list`, untyped `void*`, C callbacks) are in `sys`. See [coverage](../coverage/).
+- **UI scale:** `imgui::ui_scale()` and `imgui::set_ui_scale(scale)` read and set BUI's scale.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Blender widgets" href="docs/imgui/blender-widgets/" icon="sparkles" kicker="Dear ImGui">
+ The mapping, the behaviour changes and the gaps.
+ </Card>
+ <Card title="Coverage" href="docs/imgui/coverage/" icon="check" kicker="Dear ImGui">
+ What the safe layer and the FFI bind.
+ </Card>
+ <Card title="Your first Rust app" href="docs/tutorials/first-app-rust/" icon="sparkles" kicker="Tutorial">
+ Prefer retained UI? BUI's Rust framework speaks HTML, CSS and hooks.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/javascript/native-api.mdx b/website/src/content/docs/javascript/native-api.mdx
new file mode 100644
index 0000000..346da1c
--- /dev/null
+++ b/website/src/content/docs/javascript/native-api.mdx
@@ -0,0 +1,182 @@
+---
+title: The DOM-like API
+sidebarLabel: "@blender-ui/native"
+description: Build native windows from plain JavaScript with createElement, Tailwind classes, events and signals. No React, no browser, no build step.
+section: JavaScript & React
+order: 10
+languages: ["javascript"]
+badges: ["Node.js", "Bun"]
+sources: ["docs/javascript.md", "bindings/node/README.md", "bindings/node/index.js", "bindings/node/index.d.ts", "bindings/node/examples/counter.js", "bindings/node/package.json"]
+---
+
+If you've ever written `document.createElement`, you already know this API. **`@blender-ui/native` gives you the DOM's shape, Tailwind classes and signals, and draws the result in a native window** with BUI's engine. There's no browser underneath and no webview: just your script, Node.js or Bun, and a small native addon.
+
+It's also the layer the [React renderer](../react/) is built on, so everything here works there too.
+
+<Callout type="note" title="Before you start">
+You need Node.js 18 or newer, or Bun. Install with `npm install @blender-ui/native` (or `bun add @blender-ui/native`). The addon is prebuilt for Windows x64; on Linux, build it from source. The [installation page](../../start/installation/) has the details.
+</Callout>
+
+## A counter in 15 lines
+
+```js title="counter.js"
+const { App, signal } = require('@blender-ui/native')
+
+const app = new App({ gpu: true })
+const win = app.window({ title: 'Hello', width: 360, height: 220 })
+win.body.setAttribute('styled', '') // Blender's look for the whole page
+win.body.className = 'm-0 p-6 flex flex-col gap-3 bg-[#2b2b2b] text-[#e6e6e6]'
+
+const clicks = signal(0)
+const label = win.createElement('span')
+label.textContent = clicks // bound: the text follows the signal
+const button = win.createElement('button')
+button.textContent = 'Add one'
+button.addEventListener('click', () => clicks.value++)
+win.body.appendChild(label)
+win.body.appendChild(button)
+```
+
+Run it with `node counter.js` or `bun counter.js`. A window opens with a number and a button. Click the button and the number goes up.
+
+What's going on:
+
+- **`new App(...)`** starts BUI. It runs its own UI thread, so your script stays free.
+- **`app.window(...)`** opens a native window. Its `body` is the root element, like `document.body`.
+- **`setAttribute('styled', '')`** gives everything inside Blender's look. Without it, HTML elements look like a browser's defaults.
+- **`signal(0)`** is a value that remembers who's showing it. Assigning it to `textContent` binds the label to it, so `clicks.value++` updates that one text node and nothing else. [Signals](../signals/) have their own page.
+
+## The app and its windows
+
+```js
+const app = new App({ gpu: true, headless: false, quitOnLastWindowClosed: true })
+const win = app.window({ title: 'Tool', width: 400, height: 300, resizable: true })
+win.on('close', () => console.log('bye'))
+```
+
+| `new App(options)` | What it does |
+| --- | --- |
+| `gpu` | Draw on the GPU (Direct3D 11 on Windows, OpenGL on Linux). Off by default: the CPU renderer draws the same pixels. |
+| `slug` | GPU text from glyph outlines (Slug, the default) or a per-glyph atlas. `app.setSlug(on)` changes it later. |
+| `headless` | No native windows: renders off-screen, for tests and CI. |
+| `quitOnLastWindowClosed` | Quit when the last window closes. Default `true`. |
+
+`app.window(options)` takes `title`, `width`, `height`, `resizable` and `gpu` (to choose per window). `app.quit()` closes every window and ends the UI thread, so Node can exit.
+
+A window gives you `body`, `createElement(tag)`, `createTextNode(text)`, `requestAnimationFrame(cb)`, `screenshot()`, `click(x, y)`, `close()` and `on('close', fn)`.
+
+## Elements and attributes
+
+The tree behaves like the DOM: `appendChild`, `insertBefore`, `removeChild`, `remove()`, `parentNode`, `childNodes`, `firstChild`, `nextSibling` and friends.
+
+- **Moving a node:** `appendChild` or `insertBefore` on a node that already has a parent moves it.
+- **Mistakes throw:** inserting a node into itself, or before a node that isn't a child, throws an error, as in a browser.
+- **Freeing:** `destroy()` frees a removed subtree natively. Call it when you won't use the nodes again.
+
+Elements are HTML elements (`div`, `span`, `button`, `input`, `h1` …), laid out with CSS and drawn natively by BUI. They take the usual attributes:
+
+- **`class` / `className`**, including Tailwind classes: `'p-4 flex gap-2 bg-[#4772b3]'`.
+- **`style`**, as a CSS string (`'color: red'`) or an object (`{ backgroundColor: 'red', width: 40 }`).
+- **`id`, `href`, `value`, `src`** and the rest, through `setAttribute`.
+
+Any attribute, `style` and `textContent` can be a **signal**: the node then follows it. Setting a plain value later unbinds the signal.
+
+### Blender's widgets
+
+Capitalized tag names are Blender's own widgets, always drawn and handled the Blender way:
+
+```js
+const size = win.createElement('NumberSlider')
+size.setAttribute('min', 0)
+size.setAttribute('max', 10)
+size.setAttribute('value', 2.5)
+win.body.appendChild(size)
+```
+
+The names are `Button`, `Checkbox`, `Radio`, `NumberField`, `NumberSlider`, `TextField`, `TextArea`, `ColorSwatch`, `Dropdown` and `ProgressBar`. Each one is an HTML element underneath (`NumberSlider` is `<input type="range">`), so it takes the same attributes. Their lowercase twins look like a browser's form controls, except inside a `styled` element, where they look like Blender's too.
+
+<Figure
+ shot="js-dom-tasks"
+ alt="A task list built with createElement and appendChild: a Blender text field and Add button, tasks with Blender checkboxes, and a progress bar"
+ caption="Blender's widgets from plain JavaScript (<code>examples/site/js/todo_dom.js</code>)."
+/>
+
+## Events
+
+```js
+button.addEventListener('click', (event) => {
+ console.log(event.clientX, event.clientY, event.shiftKey)
+})
+```
+
+The events are `click`, `mousedown`, `mouseup`, `mousemove`, `mouseenter`, `mouseleave`, `wheel`, `keydown`, `keyup`, `input` and `change`. The event object carries `target`, `currentTarget`, `clientX`/`clientY`, `button`, `deltaY`, `key`, the modifier flags (`shiftKey`, `ctrlKey`, `altKey`, `metaKey`) and `timeStamp`.
+
+- **They bubble**, except `mouseenter` and `mouseleave`, as in the DOM. `stopPropagation()` and `stopImmediatePropagation()` work.
+- **`event.target`** is the deepest element listening for that event type.
+- **`preventDefault()` only marks the event.** Events reach JavaScript after BUI has already handled them, so it can't cancel what BUI did.
+- **Form controls** keep their latest value: read `el.value` or `el.checked` after an `input` or `change` event.
+
+## Frames and measuring
+
+```js
+let hue = 0
+function tick () {
+ hue = (hue + 2) % 360
+ box.style = { backgroundColor: `hsl(${hue} 60% 50%)` }
+ win.requestAnimationFrame(tick)
+}
+win.requestAnimationFrame(tick)
+```
+
+- **`win.requestAnimationFrame(cb)`** runs `cb` before the next frame, paced by the display. What you change inside it renders in that same frame. `cancelAnimationFrame(id)` stops it.
+- **`el.getBoundingClientRect()`** and **`win.screenshot()`** return promises, because the answer comes from the UI thread.
+- **Changes are sent once per tick.** `win.flush()` sends them right away, if you ever need to.
+
+## Testing without a window
+
+`new App({ headless: true })` renders off-screen. Combine it with `win.click(x, y)` and `win.screenshot()` to test a UI in CI:
+
+```js title="test.js"
+const { App } = require('@blender-ui/native')
+
+const app = new App({ headless: true })
+const win = app.window({ width: 200, height: 100 })
+const button = win.createElement('button')
+button.textContent = 'Go'
+let clicked = false
+button.addEventListener('click', () => { clicked = true })
+win.body.appendChild(button)
+
+button.getBoundingClientRect().then(async (r) => {
+ win.click(r.x + 5, r.y + 5)
+ const shot = await win.screenshot() // { width, height, data } in RGBA
+ console.log(shot.width, shot.height)
+ setTimeout(() => { console.log('clicked:', clicked); app.quit() }, 100)
+})
+```
+
+<Callout type="tip">
+On macOS, use `headless: true` for now. macOS only allows windows on the main thread, and BUI runs its own UI thread under Node. <ComingSoon inline />
+</Callout>
+
+## How it stays fast
+
+- **Its own UI thread.** BUI runs its message loop on a thread of its own. JavaScript is never blocked, and an idle window uses no CPU.
+- **Only changes cross.** Your script keeps the tree. Each tick, a window sends one `Int32Array` of operations plus a small string table to the UI thread.
+- **A retained mirror.** The UI thread keeps its own copy of the tree, so layout caches and form state persist, and a `style` string is parsed once, when you set it.
+
+The numbers, with their context, are on the [standalone executables](../standalone-executables/) page.
+
+## Next steps
+
+<CardGrid>
+ <Card title="React" href="docs/javascript/react/" icon="layers" kicker="JavaScript">
+ The same engine, written as JSX components with React's hooks.
+ </Card>
+ <Card title="Signals" href="docs/javascript/signals/" icon="zap" kicker="JavaScript">
+ How a signal updates one node without re-rendering anything.
+ </Card>
+ <Card title="Standalone executables" href="docs/javascript/standalone-executables/" icon="terminal" kicker="JavaScript">
+ Ship your app as one file of about 5 MB.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/javascript/react.mdx b/website/src/content/docs/javascript/react.mdx
new file mode 100644
index 0000000..801d900
--- /dev/null
+++ b/website/src/content/docs/javascript/react.mdx
@@ -0,0 +1,185 @@
+---
+title: React on the desktop
+sidebarLabel: React
+description: Render React 19 components into native BUI windows with JSX, Tailwind classes and Blender's widgets, on Node.js or Bun.
+section: JavaScript & React
+order: 20
+languages: ["javascript"]
+badges: ["React 19.3"]
+sources: ["docs/javascript.md", "bindings/react/README.md", "bindings/react/index.js", "bindings/react/index.d.ts", "bindings/react/package.json", "bindings/react/examples/counter.jsx", "bindings/react/examples/counter.js"]
+---
+
+Write the React you already know, and get a native desktop window instead of a browser tab. **`@blender-ui/react` is a React 19.3 renderer for BUI**: your components render HTML elements and Tailwind classes, BUI draws them on the CPU or the GPU, and Blender's widgets are one import away. No Electron, no webview.
+
+There's one twist, and it's a good one: the hooks hold **signals**, so a click can update a single text node without re-rendering your component. You can ignore that at first; your code works the React way either way.
+
+## Install
+
+```sh
+npm install @blender-ui/react react
+# or
+bun add @blender-ui/react react
+```
+
+It brings `@blender-ui/native` with it. React 19.3 is a peer dependency. The native addon is prebuilt for Windows x64; on Linux, [build it from source](../../start/installation/).
+
+## Your first component
+
+```jsx title="app.jsx"
+/** @jsxImportSource @blender-ui/react */
+import { render, useState } from '@blender-ui/react'
+
+function Counter () {
+ const [count, setCount] = useState(0)
+ return (
+ <main className="p-6 flex flex-col gap-3 bg-[#2b2b2b] text-[#e6e6e6]">
+ <span>Clicks: {count}</span>
+ <button onClick={() => setCount(c => c + 1)}>Add one</button>
+ </main>
+ )
+}
+
+render(<Counter />, { title: 'Counter', width: 360, height: 200, gpu: true })
+```
+
+Run it:
+
+```sh
+bun app.jsx
+```
+
+Bun reads JSX as it is. On Node, compile it first with your usual tool (esbuild, TypeScript, Babel) using the JSX setting below, or skip JSX entirely with `createElement`.
+
+Notice that the import comes from `@blender-ui/react`, not `react`. That's where the signal-backed hooks live. `setCount` works exactly as in React.
+
+## Set up JSX
+
+Tell your compiler where the JSX runtime is. In `tsconfig.json`:
+
+```json title="tsconfig.json"
+{
+ "compilerOptions": {
+ "jsx": "react-jsx",
+ "jsxImportSource": "@blender-ui/react"
+ }
+}
+```
+
+Or put `/** @jsxImportSource @blender-ui/react */` at the top of a file, as above. Your bundler's JSX options work too.
+
+The runtime does two things for you:
+
+- **Render tracking:** a component that reads a signal while rendering re-renders when that signal changes.
+- **Typing:** in TypeScript, host-element props accept signals of their type.
+
+### Without JSX
+
+The package exports its own `createElement`, with render tracking built in:
+
+```js title="counter.js"
+const { render, createElement: h, useState } = require('@blender-ui/react')
+
+function Counter () {
+ const [count, setCount] = useState(0)
+ return h('main', { className: 'p-6 flex flex-col gap-3' },
+ h('span', null, 'Clicks: ', count),
+ h('button', { onClick: () => setCount(c => c + 1) }, 'Add one'))
+}
+
+render(h(Counter), { title: 'BUI + React', width: 420, height: 260 })
+```
+
+## `render` and `createRoot`
+
+`render(element, options)` opens a window and renders into it. It returns `{ app, window, root }`.
+
+| Option | What it does |
+| --- | --- |
+| `title`, `width`, `height`, `resizable` | The window |
+| `gpu` | Draw on the GPU (Direct3D 11 on Windows, OpenGL on Linux) |
+| `slug` | GPU text from glyph outlines (default) or an atlas |
+| `headless` | Render off-screen: tests and CI |
+| `app` | Reuse an `App` you already made, to open several windows |
+
+`window` is a [`@blender-ui/native` window](../native-api/), so you can style its body directly:
+
+```jsx
+const { window } = render(<Counter />, { title: 'BUI + React', width: 420, height: 260 })
+window.body.setAttribute('styled', '') // Blender's look for every element
+window.body.className = 'm-0 bg-[#2b2b2b] text-[#e6e6e6]'
+```
+
+To render into a window you opened yourself, use `createRoot(window)`, then `root.render(<App />)` and `root.unmount()`. Closing the window unmounts its root. For tests, `act(fn)` runs `fn` and flushes React's work synchronously.
+
+## Host components
+
+Host components are HTML elements, as in React DOM:
+
+- **`className`** takes Tailwind classes. **`style`** takes a string, an object or a signal. **`htmlFor`** and boolean attributes work.
+- **Mouse, keyboard and form events** work: `onClick`, `onMouseDown`, `onMouseUp`, `onMouseMove`, `onMouseEnter`, `onMouseLeave`, `onWheel`, `onKeyDown`, `onKeyUp`, `onInput` and `onChange`. They bubble, and `stopPropagation` works.
+- **`onChange` follows React DOM:** on a text field it fires on every edit. On checkboxes, radios, selects and other controls it fires when the value changes, even if the control's `type` changes later.
+- **Handlers run as discrete updates,** so a click's state change commits immediately.
+
+## Blender's widgets
+
+Import Blender's widgets as components. They're always drawn and handled the Blender way: drag a number to change it, <Kbd>Ctrl</Kbd> to snap, and click to type a value or a sum such as `2*pi`. (Plain `<input>` elements outside `styled` stay browser-style and don't evaluate math.)
+
+```jsx title="panel.jsx"
+/** @jsxImportSource @blender-ui/react */
+import { render, useState, NumberSlider, Button } from '@blender-ui/react'
+
+function Panel () {
+ const [size, setSize] = useState(2.5)
+ return (
+ <main className="p-4 flex flex-col gap-2">
+ <NumberSlider min={0} max={10} value={size} onChange={e => setSize(Number(e.target.value))} />
+ <Button onClick={() => console.log('apply', size.value)}>Apply</Button>
+ </main>
+ )
+}
+
+render(<Panel />, { title: 'Blender widgets', width: 320, height: 160 })
+```
+
+<Figure
+ shot="js-react-tasks"
+ alt="A task list in React on BUI: a Blender text field and Add button, a list of tasks with Blender checkboxes, and a progress bar"
+ caption="Blender components in a React app: <code>TextField</code>, <code>Button</code>, <code>Checkbox</code> and <code>ProgressBar</code> (<code>examples/site/js/todo_react.js</code>)."
+/>
+
+The ten components are `Button`, `Checkbox`, `Radio`, `NumberField`, `NumberSlider`, `TextField`, `TextArea`, `ColorSwatch`, `Dropdown` and `ProgressBar`. Each is an HTML element underneath (`NumberSlider` is an `<input type="range">`), so it takes the same props. Their lowercase twins (`<button>`, `<input>`) look like a browser's controls, except inside a `styled` element.
+
+## Suspense, transitions and friends
+
+React 19.3's features work: `<Suspense>`, `<Activity>`, transitions, actions and `<ViewTransition>`. View transitions commit without animating, for now.
+
+- **Concurrent rendering, StrictMode and React's timing** come from React itself, because every hook is built from React's public hooks.
+- **Nothing leaks:** nodes React removes, or creates in a render it throws away (an interrupted or suspended render), are freed natively.
+- **One batch per commit:** only what changed crosses to BUI's UI thread.
+
+## A word on hooks
+
+Import hooks from `@blender-ui/react`. They have React's names, arguments and timing, but the state they hold is a signal. Two rules cover almost everything:
+
+- **Put it in JSX** (`<span>{count}</span>`) and a change updates that node alone.
+- **Read `.value`** when you need the value itself: in conditions (`{name.value && <p>Hi</p>}`), comparisons (`count.value === 0`) and arithmetic in TypeScript.
+
+The [signals page](../signals/) explains why, with every hook in a table.
+
+<Callout type="warning" title="Conditions need .value">
+A signal is an object, so it's always truthy. `{isPending && <Spinner />}` always shows the spinner. Write `{isPending.value && <Spinner />}`.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Signals" href="docs/javascript/signals/" icon="zap" kicker="JavaScript">
+ Every hook, what it returns, and when a component re-renders.
+ </Card>
+ <Card title="Standalone executables" href="docs/javascript/standalone-executables/" icon="terminal" kicker="JavaScript">
+ Turn app.jsx into one executable of about 5 MB.
+ </Card>
+ <Card title="The DOM-like API" href="docs/javascript/native-api/" icon="book" kicker="JavaScript">
+ The layer underneath: windows, elements, events and headless tests.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/javascript/signals.mdx b/website/src/content/docs/javascript/signals.mdx
new file mode 100644
index 0000000..c34c92a
--- /dev/null
+++ b/website/src/content/docs/javascript/signals.mdx
@@ -0,0 +1,154 @@
+---
+title: Hooks and signals
+sidebarLabel: Signals
+description: React's hooks by React's names, holding signals. Pass one into JSX to update a single node; read .value to re-render. Every hook, explained.
+section: JavaScript & React
+order: 30
+languages: ["javascript"]
+sources: ["docs/javascript.md", "bindings/react/README.md", "bindings/react/hooks.js", "bindings/react/index.d.ts", "bindings/node/index.d.ts", "bindings/react/test/hooks.test.js"]
+---
+
+Here's the trick that makes React on BUI fast: **the state your hooks hold is a signal.** Put it in JSX and a change updates that one node, without re-rendering your component. Read its value while rendering and you get plain React behaviour. You choose per use, and the code still looks like React.
+
+A **signal** is a box holding a value. It remembers who reads it, so when the value changes, BUI knows exactly what to update.
+
+## Two ways to use a signal
+
+```jsx title="counter.jsx" {5,9}
+/** @jsxImportSource @blender-ui/react */
+import { render, useState, useMemo } from '@blender-ui/react'
+
+function Counter () {
+ const [count, setCount] = useState(0)
+ const style = useMemo(() => ({ color: count.value > 9 ? '#e5a50a' : '#e6e6e6' }), [])
+ return (
+ <main className="p-6 flex flex-col gap-3">
+ <span style={style}>Clicks: {count}</span>
+ <button onClick={() => setCount(c => c + 1)}>Add one</button>
+ </main>
+ )
+}
+
+render(<Counter />, { title: 'Signals', width: 360, height: 200 })
+```
+
+- **Passed as a prop or child** (`{count}`, `style={style}`): a change updates that one node. The component doesn't re-render.
+- **Read while rendering** (`count.value`): the component re-renders when it changes, exactly as with React's own hooks.
+
+So in the example, a click updates one text node and one `style`, and `Counter` renders exactly once. The memo reads `count.value` *inside the memo*, not while rendering, so it recomputes on its own without touching the component.
+
+With no reconciler running on a click, there's no new element tree, no props diff and almost no garbage. That's why React with signals costs about what the plain DOM-like API does.
+
+<Callout type="warning" title="Conditions and === need .value">
+A signal is an object, so it's always truthy. Write `{isPending.value && <Spinner />}` and `count.value === 0`. TypeScript catches `===` mistakes, but not truthiness ones. In plain JavaScript, arithmetic and template strings read the value for you (`count + 1`, `count > 5`, a template string); TypeScript needs `.value` there too.
+</Callout>
+
+## Every hook
+
+The hooks that hold or react to state take React's arguments and run at React's moments:
+
+| Hook | Returns | Notes |
+| --- | --- | --- |
+| `useState(init)` | `[signal, setState]` | `setState(v)` or `setState(prev => next)`; setting the same value doesn't update |
+| `useReducer(reducer, arg, init?)` | `[signal, dispatch]` | Uses the latest render's reducer, as React does |
+| `useRef(v)` | a ref | Effects and memos see `.current` change (an element mounting re-runs them); reading it while rendering doesn't subscribe |
+| `useMemo(fn, deps?)` | a memo | Recomputes when the signals it read change; replaced when `deps` change; without deps, every render |
+| `useCallback(fn, deps?)` | a function | Identity follows `deps`; calls are batched and don't subscribe the caller |
+| `useEffectEvent(fn)` | a function | Calls the latest render's `fn`; batched and untracked |
+| `useEffect(fn, deps?)` | | React's timing, deps and cleanups; also re-runs when the signals it read change |
+| `useLayoutEffect(fn, deps?)` | | The same, at layout time |
+| `useInsertionEffect(fn, deps?)` | | The same, at insertion time |
+| `useSyncExternalStore(subscribe, get)` | a signal | Follows the store without re-rendering |
+| `useTransition()` | `[isPending, start]` | Updates caused by the writes in `start(action)` run after urgent ones, in 5 ms slices; `action` may be async |
+| `useDeferredValue(value, initial?)` | a signal | Follows a value or a signal at transition priority |
+| `useActionState(action, initial)` | `[state, dispatch, isPending]` | Actions queue and run in order; errors reach the error boundary |
+| `useOptimistic(state, reducer?)` | `[optimistic, add]` | Updates last until their transition or action ends |
+
+`use`, `useContext`, `useId`, `useDebugValue` and `useImperativeHandle` are React's own: they hold no state. For context, pass a signal as the value, and consumers bind to it without re-rendering.
+
+React's plain-value hooks are still there if you want them: import them from `react` and they work in this renderer too.
+
+### Extras
+
+- **`useSignal(v)` and `useComputed(fn)`** give a component its own signal or memo, kept for as long as the component is mounted.
+- **`useSignalValue(sig)`** re-renders its component when `sig` changes. Use it in components rendered without this package's JSX runtime or `createElement`.
+- **`batch(fn)`** turns several writes into one update. **`startTransition(fn)`** makes the writes in `fn` low priority.
+- **`computed`** is a standalone memo. (In `@blender-ui/native` it's called `memo`; here `memo` stays React's, for components.)
+
+## Reading and writing a signal
+
+| You want to | Write |
+| --- | --- |
+| Read, and subscribe the running memo or effect | `sig.value` or `sig.get()` |
+| Read without subscribing | `sig.peek()`, or `untrack(() => …)` |
+| Write | `sig.value = v`, `sig.set(v)` or `sig.update(fn)` |
+| Run code on every change | `sig.subscribe(fn)` (returns the unsubscribe function) |
+
+## Signals in plain JavaScript
+
+`@blender-ui/native` has the same core: `signal`, `memo`, `effect`, `batch`, `untrack` and `startTransition`.
+
+```js title="signals.js"
+const { signal, memo, effect } = require('@blender-ui/native')
+
+const price = signal(4)
+const qty = signal(3)
+const total = memo(() => price.value * qty.value)
+const stop = effect(() => console.log('total', total.value)) // prints 12
+
+qty.value = 5 // prints 20
+stop() // dispose the effect
+```
+
+- **Bind to the tree:** `el.setAttribute(name, sig)`, `el.style = sig`, `el.textContent = sig` or `win.createTextNode(sig)`.
+- **Unbind:** set a plain value. `destroy()` frees the bindings of a whole subtree.
+- **Without the addon:** `require('@blender-ui/native/signals')` gives you just the signals, in any JavaScript runtime.
+
+### The same ideas, two spellings
+
+| `@blender-ui/native` | `@blender-ui/react` |
+| --- | --- |
+| `signal(v)` | `useSignal(v)` / `useState(v)` |
+| `memo(f)` | `useComputed(f)` / `useMemo(f, deps)` |
+| `effect(f)` (returns `dispose`) | `useEffect(f, [])` |
+| `createSignal(v)` (`[get, set]`) | `useState(v)` |
+
+## How they behave
+
+The signals are **push-pull and glitch-free**. In plain words:
+
+- **Each memo or effect runs at most once per change,** after all of its sources have settled. You never see a half-updated state.
+- **Memos stop changes early.** If a memo's value didn't change, nothing downstream runs.
+- **Unread memos hold nothing.** A memo that nothing observes keeps no subscriptions, so it's garbage once you drop it.
+- **Writes inside an effect** to a signal the effect itself reads re-run it after the current run.
+- **Errors stay put.** A memo that throws rethrows on read, and recovers when its sources change.
+
+<Callout type="joke">
+A glitch-free signal never shows you a half-updated value. It's the opposite of a viewport while Cycles is still sampling.
+</Callout>
+
+## Keeping up with React
+
+Every hook is built from React's public hooks (`useState`, `useReducer`, `useRef`, `useMemo`, the effect hooks and `startTransition`), so StrictMode, concurrent rendering and React's timing come from React itself.
+
+A conformance suite, `bindings/react/test/hooks.test.js`, runs each hook beside React's original, in development and production builds and under StrictMode. It fails when a React release adds a hook that has neither a signal version nor an entry in its list of hooks used as they are (`NO_TWIN`). That's how it caught React 19.2's `useEffectEvent`.
+
+## When to use which
+
+- **Values that change often** (a counter, an animated colour, one cell in a big grid): pass the signal into JSX. Nothing re-renders.
+- **Values that change the structure** (show or hide a panel, switch a list): read `.value` while rendering. React re-renders, as usual.
+- **Big lists that change every frame:** keep the changing parts on signals. The [standalone page](../standalone-executables/#performance) shows what that saves: at 3,000 animated cells, about a quarter less CPU and memory than re-rendering.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Standalone executables" href="docs/javascript/standalone-executables/" icon="terminal" kicker="JavaScript">
+ Ship it, and see the performance numbers.
+ </Card>
+ <Card title="React" href="docs/javascript/react/" icon="layers" kicker="JavaScript">
+ render, createRoot, host components and Blender's widgets.
+ </Card>
+ <Card title="The DOM-like API" href="docs/javascript/native-api/" icon="book" kicker="JavaScript">
+ Bind signals to elements without React.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/javascript/standalone-executables.mdx b/website/src/content/docs/javascript/standalone-executables.mdx
new file mode 100644
index 0000000..4d0a31e
--- /dev/null
+++ b/website/src/content/docs/javascript/standalone-executables.mdx
@@ -0,0 +1,142 @@
+---
+title: Standalone executables
+sidebarLabel: Standalone executables
+description: Turn a JavaScript or React app into one executable of about 5 MB with bui build, or a full Bun executable with --bun. Plus the performance numbers behind the choice.
+section: JavaScript & React
+order: 40
+languages: ["javascript"]
+badges: ["Windows x64 prebuilt"]
+sources: ["docs/javascript.md", "bindings/node/cli.js", "bindings/node/README.md", "bindings/react/README.md", "bindings/node/bench/startup.js", "bindings/node/bench/cells.js"]
+---
+
+Your users shouldn't need Node.js to run your tool. **`bui build app.jsx` makes one executable of about 5 MB** that reaches its first frame in about 70 ms. Send them the file; they double-click it. That's the whole install.
+
+Under the hood it's BUI with a small JavaScript engine, [QuickJS](https://github.com/quickjs-ng/quickjs), built in. Your app's code is appended to it. Nothing is compiled per app, so a build takes well under a second.
+
+<Callout type="note" title="What you need">
+`bui` comes with `@blender-ui/native` (and so with `@blender-ui/react`). Bundling uses [Bun](https://bun.sh), so install Bun too, even if you develop on Node. The prebuilt runtime is for Windows x64; on other platforms, `npm run build` in `bindings/node` builds it from source.
+</Callout>
+
+## Build your app
+
+<Steps>
+
+1. **Start from a working app.**
+
+ Any entry file works: `.js`, `.jsx`, `.ts`. For example, the counter from the [React page](../react/), saved as `app.jsx`.
+
+2. **Build it.**
+
+ ```sh
+ npx bui build app.jsx
+ ```
+
+ `bui` prints the file it wrote, its size, the runtime (QuickJS) and how long the build took. The output is named after the entry file, with `.exe` on Windows.
+
+3. **Run it.**
+
+ Double-click `app.exe`, or run it from a terminal. No Node.js, no Bun, no browser, no webview.
+
+</Steps>
+
+## Commands and options
+
+```sh
+npx bui build app.jsx # app.exe: BUI + QuickJS, about 5 MB
+npx bui build app.jsx --bun # app.exe: a Bun executable, about 115 MB
+npx bui run app.jsx # run on the QuickJS runtime, no executable
+```
+
+| Option | What it does |
+| --- | --- |
+| `-o <file>`, `--out <file>` | The output file. Default: the entry's name. |
+| `--bun` | Compile with `bun build --compile` instead of QuickJS. |
+| `--console` | Keep a console window for logs. By default, Windows builds open none, as an app should. |
+| `--dev` | Use React's development build. The default is the production build. |
+
+`bui run` is handy while you work: it bundles your app and runs it on the same QuickJS runtime a build would use, so you see exactly what your users will.
+
+## QuickJS or Bun?
+
+**The default build** runs your code on QuickJS, on BUI's UI thread, the way a browser runs page scripts. Your code and both packages run unchanged.
+
+- **It provides** `console`, timers, `queueMicrotask`, `performance`, and a `process` with `env`, `argv`, `exit` and `platform`.
+- **It doesn't provide** Node's modules (`fs`, `net` …). Apps that need them use `--bun`.
+- **It has no JIT,** so heavy JavaScript runs several times slower than on Bun or Node.
+
+**With `--bun`** you get `bun build --compile`: the full Bun runtime with Node's APIs and a JIT, and `@blender-ui/native`'s addon embedded in the executable.
+
+<BenchChart id="js-first-frame" table="jsStartupJs" />
+
+The QuickJS executable is 4.9 MB against 114 MB for `--bun`, and it starts with less memory. The trade-off is speed: QuickJS is an interpreter, while Bun has a JIT.
+
+No JIT matters less than it sounds, for two reasons:
+
+- **The renderer is native.** Layout, painting and the GPU cost the same on either runtime.
+- **Signals keep JavaScript light.** A change updates a node without re-rendering components. Re-rendering a 3,000-element list every frame is where QuickJS falls behind, so keep that kind of list on [signals](../signals/), or use `--bun`.
+
+<Callout type="joke">
+68 ms to the first frame. That's less time than it takes to find the default cube and press <Kbd>X</Kbd>.
+</Callout>
+
+## How it works
+
+1. **Bundle.** Bun bundles your entry and its packages into one script, with React's production build (unless `--dev`).
+2. **Append.** `bui` copies the prebuilt `bui-runtime` (BUI plus QuickJS, 4.9 MB), appends your script and a small trailer that marks where it starts.
+3. **Mark it as an app.** On Windows, unless you pass `--console`, the executable is marked as a windowed app, so no console appears.
+
+When the executable starts, `bui-runtime` finds the script at its end and runs it.
+
+## Performance
+
+These are the repository's own measurements. They come with their context, because numbers without one aren't worth much.
+
+**Machine:** a Ryzen 7 5800U laptop, Windows 11, 60 Hz display, GPU renderer, React's production build, Node.js 22.17 and Bun 1.4.4.
+
+### Startup
+
+`node bench/startup.js` launches a small React app (`bench/first-frame.js`) that quits as soon as its first frame is on screen. It does that 12 times for each way to run an app, after one warm-up launch, and reports the medians. **First frame** is measured inside the app, from the runtime's start; **launch to exit** is wall time from outside, including process creation and teardown.
+
+<BenchTable id="jsStartupJs" />
+
+Timings vary by about ±20% between sessions on this laptop; the ranking doesn't change. The first launch of a newly written executable can take seconds while antivirus software scans it, which is why the warm-up launch isn't counted.
+
+### Animation
+
+The benchmark's `one` mode: a 1000×800 window with a grid of N cells, where one cell changes colour and label every frame, driven from `requestAnimationFrame`. Run it with `bench/cells.js N --gpu [--react [--signals]]` under `node`, `bun` or `node cli.js run` (QuickJS).
+
+- **React, signals:** cell 0's style and label are signals, so the grid renders once.
+- **React, state:** the grid re-renders every frame, as with React's `useState`.
+- **CPU** is the whole process (JavaScript, BUI's UI thread and the runtime), counted with the process cycle counter. Medians of 3 runs. Bun and Node ran in one session; QuickJS in a later one.
+
+<BenchChart id="js-cpu-3000" table="jsAnim3000Js" />
+
+<BenchTable id="jsAnim3000Js" />
+
+<BenchTable id="jsAnim1000Js" />
+
+What they show:
+
+- **Most of the extra memory is the runtime.** Node alone is about 32 MB; Bun is about 10 MB smaller.
+- **QuickJS is the leanest in memory,** 38–67 MB, about 20–40 MB below Bun and Node. Re-rendering 3,000 elements every frame drops it to 20 FPS, so keep big lists on signals, or build with `--bun`.
+- **React with signals costs what the plain API does.** At 3,000 cells it uses about a quarter less CPU and memory than re-rendering.
+- **Measure with `NODE_ENV=production`.** React's development build re-rendering 3,000 cells took about 184 MB.
+- **Bun vs Node:** Bun is slightly faster with plain JS and signals, and leaner everywhere. Node is faster when React re-renders every frame.
+
+## Platforms
+
+The prebuilt `bui-runtime` and addon are for **Windows x64**. On Linux, build both from a clone of the repository (`npm run build` in `bindings/node`; you need Rust, CMake and a C compiler). Prebuilt runtimes for more platforms are <ComingSoon inline />.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Signals" href="docs/javascript/signals/" icon="zap" kicker="JavaScript">
+ The habit that keeps QuickJS builds fast.
+ </Card>
+ <Card title="React" href="docs/javascript/react/" icon="layers" kicker="JavaScript">
+ Write the app you're about to ship.
+ </Card>
+ <Card title="Roadmap" href="docs/project/roadmap/" icon="flag" kicker="Project">
+ Prebuilt packages for more platforms, and WebAssembly.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/performance/benchmarks.mdx b/website/src/content/docs/performance/benchmarks.mdx
new file mode 100644
index 0000000..7d007ce
--- /dev/null
+++ b/website/src/content/docs/performance/benchmarks.mdx
@@ -0,0 +1,120 @@
+---
+title: Benchmarks
+description: "BUI's published numbers with their full context: start time and battery cost for every API, frame times, Rust against gpui, and JavaScript startup and animation."
+section: Performance
+order: 10
+badges: ["Ryzen 7 5800U", "Windows 11"]
+sources: ["README.md", "bindings/rust/bench/README.md", "docs/javascript.md", "bench/run.py", "bench/apps", "bindings/rust/bench/common/settings.rs", "bindings/node/bench/startup.js", "bindings/node/bench/cells.js"]
+---
+
+BUI is fast where it matters to people: it opens quickly, it sits at zero CPU while you're not touching it, and it stays smooth when thousands of things move. Here are the numbers, with everything you need to judge them.
+
+<Callout type="warning" title="Where these numbers come from">
+Every number on this page was measured on **one laptop: a Ryzen 7 5800U** (8 cores, 16 threads, AMD Radeon integrated GPU, 60 Hz display), running **Windows 11 on AC power**, with release builds. They were measured **before the latest features landed**: Dear ImGui support, the Linux GPU renderer, and Blender's search and expression code. Your machine will give different numbers; the comparisons are what carry over. [Run the benchmarks yourself](../run-benchmarks/) to check.
+</Callout>
+
+## Start time and battery
+
+**What was measured:** the same small settings window (a label, a text field, a checkbox, a slider and a button), written each of the five ways, from [`bench/apps`](https://github.com/ppmpreetham/BUI/tree/main/bench/apps). Each ran on BUI's CPU renderer (the default) and on its GPU renderer (`BUI_GPU=1`).
+
+The last rows are one gpui-syntax source file, [`settings.rs`](https://github.com/ppmpreetham/BUI/blob/main/bindings/rust/bench/common/settings.rs), compiled **unchanged** against blenderui, Zed's [gpui](https://crates.io/crates/gpui) and [gpui-fast](https://github.com/longbridge/gpui-fast). gpui has no form widgets, so there the controls are styled divs.
+
+**How:** the median of 10 launches, from process start until the first frame is on screen, with Python 3.14 and Node 22.
+
+<BenchChart id="start-all" />
+
+<BenchTable id="startup" />
+
+**What it means:**
+
+- On the same code, blenderui shows its first frame about **5× sooner** than gpui and gpui-fast, spends about **8× less CPU** getting there, and on the CPU renderer uses **half the memory**.
+- Idle, gpui keeps about 1.2% of a core busy. blenderui uses none.
+- The GPU renderer starts a little slower and uses more memory (the GPU device). It pays off on large, animated scenes, below.
+
+<BenchChart id="start-time" />
+
+<BenchChart id="idle-cpu" />
+
+**How battery cost is measured:** laptops can't report energy per app, so the benchmark uses CPU time as a proxy. It counts the CPU an app spends starting up, and the CPU it uses over 20 seconds while the window sits idle: that's what drains a battery while an app is open. BUI redraws only when something changes and otherwise sleeps, so idle use is near zero on either renderer.
+
+**Fine print:** Node's event loop accounts for the JavaScript idle figure. Python's times include starting the interpreter. Memory doesn't count GPU memory.
+
+## Frame times
+
+**What was measured:** the full Blender components demo (520×900), from Python and C.
+
+<BenchChart id="frame-times" />
+
+## Rust against gpui and gpui-fast
+
+**What was measured:** a 1000×800 window filled with N rounded, numbered cells, built with the same element tree in every framework. In this table, every cell changes every frame (the worst case), with 3,000 cells. All apps ran in the same session.
+
+<BenchChart id="fps" />
+
+<BenchChart id="cpu-per-frame" />
+
+<BenchTable id="cells3000" />
+
+More results, at 100 and 1,000 cells:
+
+<BenchChart id="uncapped-fps" />
+
+<BenchTable id="cellsFull" />
+
+**What it means:**
+
+- **The GPU renderer beats gpui-fast on every measurement.** It uses 2.2× less CPU per frame at 100 cells, 4.4× less at 1,000 and 2.8× less at 3,000, where it also runs at nearly twice the frame rate. It uses less RAM and the same GPU memory.
+- **The GPU renderer halves blenderui's own CPU cost** (22.0 to 11.6 ms at 3,000 cells). What stays on the CPU is the Rust side: cascade, layout and the paint list.
+- **The CPU raster stays the lightest on memory** and remains the default.
+
+**How:** each app measures its own CPU **cycles** across all threads (Windows' `QueryProcessCycleTime`), its frames and its memory, over a 10-second window after a 3-second warm-up. The runner adds GPU utilisation and GPU memory from Windows' performance counters, because GPU work isn't process CPU time. "+ GPU" means gpui's numbers exclude its GPU work, so read them with the GPU columns in the [full results](https://github.com/ppmpreetham/BUI/blob/main/bindings/rust/bench/README.md).
+
+**Fine print:** one laptop, one 60 Hz display (which caps every app), an integrated GPU.
+
+## JavaScript and React
+
+### Startup
+
+**What was measured:** a small React app (a counter) that quits as soon as its first frame is on screen. Each figure is the median of 12 launches after a warm-up launch (`node bench/startup.js`).
+
+<BenchChart id="js-first-frame" />
+
+<BenchTable id="jsStartup" />
+
+### Animation
+
+**What was measured:** the same scene as the Rust table, in `one` mode: one cell changes per frame, like a hover or a ticking value. GPU renderer, medians of 3 runs, React's production build. CPU is the whole process, counted with the cycle counter as for Rust.
+
+- **Plain JS** uses `@blender-ui/native`.
+- **React with signals** passes the changing values as signals, so the grid renders once.
+- **React with state** re-renders the grid every frame.
+
+<BenchChart id="js-cpu-3000" />
+
+<BenchTable id="jsAnim3000" />
+
+<BenchTable id="jsAnim1000" />
+
+**What it means:**
+
+- **JavaScript costs little over Rust:** 0.4–2.4 ms per frame, for sending changes to BUI's UI thread.
+- **Signals make React as cheap as the plain API:** the component doesn't re-render.
+- **QuickJS** starts fastest and uses the least memory, from a 5 MB file. It has no JIT, so re-rendering a 3,000-element list every frame drops it to 20 FPS. Keep big lists on signals, or build with `--bun`.
+
+<Callout type="joke">
+Unlike a Cycles render, these numbers don't get any less noisy if you leave them running overnight. Run each benchmark a few times instead.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Run the benchmarks" href="docs/performance/run-benchmarks/" icon="terminal" kicker="Performance">
+ Every command behind these tables, one at a time.
+ </Card>
+ <Card title="Profiling" href="docs/performance/profiling/" icon="clock" kicker="Performance">
+ Measure your own app and fix the slow parts.
+ </Card>
+ <Card title="Damage rendering" href="docs/concepts/damage-rendering/" icon="zap" kicker="Concepts">
+ Why the idle numbers are zero.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/performance/profiling.mdx b/website/src/content/docs/performance/profiling.mdx
new file mode 100644
index 0000000..f97dc08
--- /dev/null
+++ b/website/src/content/docs/performance/profiling.mdx
@@ -0,0 +1,133 @@
+---
+title: Profiling your app
+sidebarLabel: Profiling
+description: Find out where your frames go with BUI_PROFILE, choose a renderer with numbers, and avoid the few slow paths that matter.
+section: Performance
+order: 30
+languages: ["python", "rust", "javascript"]
+sources: ["README.md", "docs/javascript.md", "bindings/rust/blenderui/src/prof.rs", "bindings/rust/blenderui/src/window.rs", "bindings/rust/blenderui/src/layout.rs", "kit/intern/kit_window_win32.c", "kit/intern/kit_frame.c", "bindings/rust/bench/README.md", "CHANGELOG.md", "bindings/python/tests/test_components.py"]
+---
+
+Most BUI apps never need tuning: an idle window costs nothing, and a typical frame takes well under a millisecond. When an app does feel slow, it's usually one of a handful of causes, and BUI can tell you which.
+
+This page shows how to measure, how to read the numbers, and what to change.
+
+## Measure with BUI_PROFILE
+
+Run your app with `BUI_PROFILE` set, and BUI prints frame times to stderr, averaged over every 60 frames:
+
+```sh
+BUI_PROFILE=1 python my_app.py # PowerShell: $env:BUI_PROFILE="1"; python my_app.py
+BUI_PROFILE=1 cargo run --release
+BUI_PROFILE=1 node app.js
+```
+
+Any value turns it on, even `0`; unset it to turn it off. When it's off, it costs one check per phase.
+
+There are two kinds of output, depending on your app.
+
+### Rust and JavaScript: per-phase times
+
+Rust apps, and JavaScript apps (which run on the Rust crate), print a line like this every 60 frames:
+
+```text
+frame ms: frame interval … render … cascade … build … boxes … taffy … place … paint … flush … widgets+hover …
+```
+
+Each … is an average in milliseconds. Phases that took no time are left out. In frame order:
+
+| Phase | What it times |
+| --- | --- |
+| `frame interval` | Wall time between frames: rebuild, kit render and present together. While animating on a 60 Hz display, expect about 16.7 ms (one refresh). |
+| `render` | Your `render()` code building the element tree |
+| `cascade` | Matching CSS selectors and computing styles |
+| `build` | Turning elements into layout nodes |
+| `boxes` | Building the box tree (blocks, line boxes, flex and grid items) |
+| `taffy` | Layout, in [taffy](https://github.com/DioxusLabs/taffy) |
+| `place` | Placing laid-out boxes on the page |
+| `paint` | Building the display list |
+| `flush` | Handing the display list to the kit's canvas |
+| `widgets+hover` | Updating Blender widget nodes, and the rest of the frame |
+
+### Windows native window: raster and present
+
+Apps on the native Windows host print the kit's own times too (Python, C and Dear ImGui print only these):
+
+```text
+kit ms: raster … present … (width x height)
+```
+
+- **raster** is the time the kit spent rendering: any layout, then drawing the dirty regions.
+- **present** is the time to put the changed tiles on screen.
+
+On Linux and macOS, only Rust and JavaScript apps print profile lines.
+
+## Choose a renderer with numbers
+
+Run the same interaction twice, once per renderer, and compare:
+
+```sh
+BUI_PROFILE=1 BUI_GPU=0 python my_app.py
+BUI_PROFILE=1 BUI_GPU=1 python my_app.py
+```
+
+Rules of thumb, from the benchmarks:
+
+- **Small tool windows:** stay on the CPU. It's lighter on memory, and frames are already tiny.
+- **Large or HiDPI windows, or lots of animation:** try the GPU. The software raster's cost grows with the number of pixels; the GPU's barely does. At 3,000 animated cells, the GPU cut blenderui's CPU per frame from 22.0 to 11.6 ms.
+- **Memory-tight machines:** the GPU renderer needs about 10 MB more RAM, plus GPU memory.
+
+[Rendering](../../concepts/rendering/) explains the trade-offs in depth.
+
+## Common slow paths
+
+### Re-rendering big lists every frame (JavaScript)
+
+In React, a list held in `useState` re-renders every item when it changes. BUI's hooks hold **signals**: pass the signal itself into JSX (`{count}`), and a change updates that one node without re-rendering the component.
+
+At 3,000 cells with one changing per frame, React with signals costs about what the plain API does, while re-rendering costs more. On QuickJS, which has no JIT, re-rendering drops to 20 FPS (19.7 measured), against 58.7 with signals.
+
+- **Keep big lists on signals.**
+- **Or build with `--bun`** if you must re-render: Bun's JIT keeps it at 55.8 FPS.
+
+### Measuring React's development build
+
+React's development build is much heavier: re-rendering 3,000 cells took about 184 MB. Always measure with `NODE_ENV=production`, which is what your users run.
+
+### Layout changes instead of value changes
+
+Setting a widget's value redraws that widget. Adding, removing or resizing widgets runs a layout pass and redraws the whole window. Both are fast, but if something changes every frame, make it a value, not a structure.
+
+### Polling from your code
+
+A timer that sets the same value every few milliseconds keeps the event loop awake, even when nothing changes on screen. Prefer callbacks, `on_change`, and signals.
+
+### Big canvases on one thread
+
+On Windows, canvases with 64 or more items draw in parallel bands, using as few threads as meet the frame deadline (up to 8). If you suspect threading, compare with `BUI_RASTER_THREADS=1`: the pixels are identical either way, only the time changes. On Linux and macOS the canvas draws on one thread.
+
+### Debug builds
+
+C and Rust debug builds are far slower than release builds. Profile with `--release` (Rust) or a `Release` CMake build. The CMake build defaults to `Release` when you don't choose.
+
+## Headless checks in tests
+
+You can put a frame budget in your tests, so a slowdown fails the build. BUI's own Python suite does this: it renders the full components demo headlessly and requires full frames to fit a 120 Hz budget (under 8.3 ms). [Headless testing](../../python/headless-testing/) shows how.
+
+<Callout type="tip" title="Contributing a speed-up?">
+Run the benchmark in `bindings/rust/bench/` before and after, and include both numbers in your pull request. [Run the benchmarks](../run-benchmarks/) has the commands.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Benchmarks" href="docs/performance/benchmarks/" icon="zap" kicker="Performance">
+ What good numbers look like.
+ </Card>
+ <Card title="Damage rendering" href="docs/concepts/damage-rendering/" icon="layers" kicker="Concepts">
+ Why value changes are nearly free.
+ </Card>
+ <Card title="Environment variables" href="docs/reference/environment-variables/" icon="terminal" kicker="Reference">
+ <code>BUI_PROFILE</code>, <code>BUI_GPU</code>, <code>BUI_RASTER_THREADS</code> and more.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/performance/run-benchmarks.mdx b/website/src/content/docs/performance/run-benchmarks.mdx
new file mode 100644
index 0000000..f11d578
--- /dev/null
+++ b/website/src/content/docs/performance/run-benchmarks.mdx
@@ -0,0 +1,180 @@
+---
+title: Run the benchmarks yourself
+sidebarLabel: Run the benchmarks
+description: Every command behind BUI's published numbers, one benchmark at a time, with what each one needs and what it prints.
+section: Performance
+order: 20
+languages: ["python", "rust", "javascript"]
+sources: ["README.md", "bindings/rust/bench/README.md", "bindings/rust/bench/run.py", "bindings/rust/bench/common/measure.rs", "bench/run.py", "bindings/node/bench/cells.js", "bindings/node/bench/startup.js", "bindings/node/bench/first-frame.js", "bindings/python/bench/tk_canvas_bench.py", "docs/javascript.md"]
+---
+
+Don't take our word for it. Every number on the [Benchmarks](../benchmarks/) page comes from a script in the repository, and you can run each one on your own machine in a few minutes.
+
+This page lists them all, from the quickest to the most involved.
+
+## Before you start
+
+Benchmarks are only as good as the conditions they run in. For numbers you can trust:
+
+- **Build in release mode.** Debug builds are many times slower.
+- **Plug the laptop in**, and close other heavy apps (browsers, IDEs, video calls).
+- **Run one benchmark, and one build, at a time.** Parallel builds and benchmarks fight for the same cores and skew the results.
+- **Compare within one session.** Laptop clocks drift between sessions, so run the things you compare back to back.
+
+You need a clone of the repository:
+
+```sh
+git clone https://github.com/ppmpreetham/BUI && cd BUI
+```
+
+<Callout type="note" title="Windows command syntax">
+The commands below use `cmd.exe` syntax where they set variables (`set BUI_GPU=1`), as the README does. In PowerShell, write `$env:BUI_GPU = "1"` instead. On Linux and macOS, put the variable before the command: `BUI_GPU=1 ./app`.
+</Callout>
+
+## Inside any app: per-phase frame times
+
+The quickest benchmark is your own app. Run it with `BUI_PROFILE=1` to print frame times broken down by phase, and with `BUI_GPU=1` or `BUI_GPU=0` to pick the renderer:
+
+```sh
+BUI_PROFILE=1 BUI_GPU=0 python my_app.py
+BUI_PROFILE=1 BUI_GPU=1 python my_app.py
+```
+
+[Profiling](../profiling/) explains what each phase means.
+
+## tkinter: canvas frame cost
+
+**Any platform, headless, about a second.** Moves canvas items every frame through the tkinter syntax, renders (damage only), and prints the time per frame for Python (the tkinter layer) and render (the C kit), averaged over 120 frames.
+
+```sh
+py bindings/python/bench/tk_canvas_bench.py 3000 all # move 3,000 canvas items every frame
+py bindings/python/bench/tk_canvas_bench.py 3000 one # move one
+```
+
+The arguments are the item count (default 2000) and the mode, `all` or `one` (default `all`). Use `python` instead of `py` outside Windows. The script imports `bui`, so either install BUI (`pip install blenderui`) or build it and put `bindings/python` on `PYTHONPATH`.
+
+## JavaScript: animated cells and startup
+
+**From `bindings/node`, after building the addon** (`npm run build`). The cell benchmark is the Rust benchmark's `one` mode in JavaScript: a 1000×800 window with a grid of N cells, where one cell changes colour and label every frame. It prints frames per second, CPU per frame for the whole process, and resident memory.
+
+```sh
+cd bindings/node
+node bench/cells.js 3000 # DOM-like API, one cell changing per frame
+node bench/cells.js 3000 --react # React re-rendering the grid
+node bench/cells.js 3000 --react --signals # React with signals: no re-render
+node bench/cells.js 3000 --gpu # on the GPU renderer
+bun bench/cells.js 3000 # on Bun
+node cli.js run bench/cells.js -- 3000 # on the 5 MB QuickJS runtime
+node bench/startup.js # launch to first frame: Node, Bun and both executables
+```
+
+- `cells.js` runs React's production build; add `--dev` for the development build. `--seconds=N` changes the measured time (default 5, after a 3-second warm-up).
+- `startup.js` builds both executables, then launches each way of running the app 12 times after a warm-up launch, and prints one JSON line per runtime: median and best times, the app's own first-frame time, its memory then, and the file size. Pass a number to change the launch count. It needs Bun installed.
+
+<Callout type="tip">
+The first launch of a freshly built executable can take seconds while antivirus software scans it. That's why `startup.js` doesn't count the warm-up launch.
+</Callout>
+
+## Rust: blenderui against gpui and gpui-fast
+
+**Windows, about 12 minutes for the full run.** Three apps draw the same scene: a 1000×800 window filled with N rounded, numbered cells. `bui-bench` is blenderui, `gpui-bench` is Zed's gpui 0.2.2, and `gpui-fast-bench` is gpui-fast 0.1.13. Both gpui apps compile the identical source file.
+
+There are three modes:
+
+- **anim:** every cell changes every frame. The worst case.
+- **one:** one cell changes per frame, like a hover or a ticking value.
+- **idle:** nothing changes.
+
+<Steps>
+
+1. **Point gpui at the shader compiler.**
+
+ gpui needs `fxc.exe` from the Windows SDK:
+
+ ```sh
+ cd bindings/rust/bench
+ set GPUI_FXC_PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\fxc.exe
+ ```
+
+2. **Build all three apps.**
+
+ ```sh
+ cargo build --release
+ ```
+
+3. **Run them.**
+
+ ```sh
+ py run.py --reps 3 # all apps, 100 / 1000 / 3000 cells
+ py run.py --cells 3000 --apps blenderui,blenderui-gpu --reps 1
+ ```
+
+ `run.py` prints a Markdown table and writes `results.json`. Its options:
+
+ | Option | Default | Meaning |
+ | --- | --- | --- |
+ | `--reps` | `3` | Runs per configuration; the table shows medians |
+ | `--warmup` | `3` | Seconds before measuring |
+ | `--seconds` | `10` | Seconds measured |
+ | `--cells` | `100,1000,3000` | Cell counts to run |
+ | `--apps` | `gpui,gpui-fast,blenderui,blenderui-gpu` | Apps to run; `blenderui-gpu` is `bui-bench` with `BUI_GPU=1` |
+
+4. **Or run one by hand.**
+
+ ```sh
+ target\release\bui-bench --cells 3000 --mode anim # --mode one / idle, --uncapped
+ set BUI_GPU=1 && target\release\bui-bench --cells 3000 --mode anim # on the GPU renderer
+ ```
+
+ `--uncapped` animates without waiting for the display, to see the raw frame rate.
+
+</Steps>
+
+**How it measures.** Each app measures itself with the same code (`common/measure.rs`): process CPU **cycles** across all threads (`QueryProcessCycleTime`), converted to time with the clock frequency calibrated during warm-up; frames rendered; the working set, sampled every 100 ms; and private bytes at the end. `run.py` adds each process's GPU 3D-engine utilisation and GPU memory from Windows' performance counters, because GPU work isn't process CPU time.
+
+<Callout type="note" title="Why cycles, not GetProcessTimes">
+An earlier version used `GetProcessTimes`. Windows charges that per ~15.6 ms clock tick, which aliases with a 60 Hz frame loop and badly under-reported CPU: gpui at 1,000 cells showed 6.3 ms per frame when it really used 19 ms. Every published number uses the cycle counter.
+</Callout>
+
+## Start time and battery: the five ways and gpui
+
+**Windows, the most setup.** The same small settings window, written each of the five ways (Rust, JavaScript, Blender components, tkinter and Qt syntax), plus one gpui-syntax file compiled for blenderui, gpui and gpui-fast. Every BUI app runs twice, with `BUI_GPU=0` and `BUI_GPU=1`.
+
+For each app it measures the median time from launch until the first frame is on screen, the CPU used to get there, the memory then, and the CPU used while the window sits idle. It writes `bench/results.json`.
+
+<Steps>
+
+1. **Build everything it launches**, one build at a time, from the repository root:
+
+ ```sh
+ cmake -S . -B build && cmake --build build --config Release --target buipy # Python extension
+ cd bindings/node && npm run build && cd ../.. # Node addon
+ cd bindings/rust && cargo build --release --example bench_app && cd ../.. # Rust app
+ cd bindings/rust/bench && cargo build --release --bins && cd ../../.. # gpui comparison
+ ```
+
+2. **Run it.**
+
+ ```sh
+ py -3 bench/run.py 10 20
+ ```
+
+ The arguments are the launches per app (default 10) and the seconds of idle measurement (default 10). The published numbers used `10 20`.
+
+</Steps>
+
+The script uses the Windows API for process times, so it runs on Windows only.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Benchmarks" href="docs/performance/benchmarks/" icon="zap" kicker="Performance">
+ The published results to compare yours with.
+ </Card>
+ <Card title="Profiling" href="docs/performance/profiling/" icon="clock" kicker="Performance">
+ Read per-phase timings and fix slow paths.
+ </Card>
+ <Card title="Contributing" href="docs/project/contributing/" icon="github" kicker="Project">
+ Changing rendering? Include before and after numbers.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/project/changelog.mdx b/website/src/content/docs/project/changelog.mdx
new file mode 100644
index 0000000..b0a7eed
--- /dev/null
+++ b/website/src/content/docs/project/changelog.mdx
@@ -0,0 +1,89 @@
+---
+title: What's new
+sidebarLabel: Changelog
+description: A readable tour of what changed in BUI, from the first release to what's coming in the next one. The full list lives in CHANGELOG.md.
+section: Project
+order: 50
+sources: ["CHANGELOG.md", "bindings/python/bui/_version.py", "bindings/node/package.json", "bindings/react/package.json"]
+---
+
+Here's the story of BUI so far, in plain words: what the first release gave you, and what's waiting in the next one. For every detail, read the full [CHANGELOG.md](https://github.com/ppmpreetham/BUI/blob/main/CHANGELOG.md); it follows [Keep a Changelog](https://keepachangelog.com), and versions follow [Semantic Versioning](https://semver.org).
+
+## Coming in the next release
+
+These changes are on `main` and listed under **Unreleased** in the changelog.
+
+### Closer to Blender 5.x
+
+The biggest theme: BUI now looks and feels even more like the real thing.
+
+- **Text rendered like Blender's.** BUI vendors FreeType 2.13.3 and renders text as Blender's BLF does: light hinting, Blender's gamma, Inter's optical size, true bold and Blender's text shadows. [Text and fonts](../../concepts/text-and-fonts/) explains it.
+- **Blender's own icons.** All 781 of Blender's SVG icons, rasterized with Blender's nanosvg, in their theme colors.
+- **The Blender 5.x theme**, ported from `userdef_default_theme.c`.
+- **Panels, the properties navigation bar and many small widget details** ported from Blender, down to the checkmark's shape.
+- **Number fields and sliders drag exactly as in Blender:** per-pixel steps, Blender's Ctrl-snapping rules, limits, the drag threshold, and <Kbd>Esc</Kbd> to cancel. See [Blender's widgets](../../concepts/blender-widgets/).
+
+### New components and tools
+
+- **The node editor** (`NodeEditor` and `Node`), ported from Blender's `space_node`: nodes, sockets, bezier links, box select, cutting links and Blender's dot grid.
+- **Editor areas, sidebars and middle- and right-button input** for building editor-style tools.
+- **Blender's File Browser**, ported from `space_file`, with bookmarks, recent folders, sorting and Blender's keymap. `tkinter.filedialog` and `QFileDialog` now show it; `BUI_FILEDIALOG=native` brings back the system dialogs.
+
+### Native windows on Linux
+
+A native X11 window host, with the same API as on Windows. Wayland sessions run it through XWayland. The C libraries and the Python module now build and pass their tests on Linux.
+
+### JavaScript and React
+
+- **`@blender-ui/native` 0.2.0:** BUI from Node.js and Bun in native windows, with a DOM-like API and signals. BUI runs on its own UI thread, and only changes cross over.
+- **`@blender-ui/react` 0.1.0:** a React 19.3 renderer whose hooks (`useState`, `useMemo`, `useEffect` …) are backed by signals. A conformance suite checks each hook against React's own.
+- **`bui build`:** standalone executables of about 5 MB with an embedded QuickJS engine, or a Bun executable with `--bun`.
+
+### Rust
+
+- **Components and hooks** in zopra, React or Leptos style: `#[component]`, `use_state`, signals, `Memo`, `Effect` and context.
+- **`rsx!` and `view!` markup**, with Tailwind classes as bare attributes and "did you mean" compile errors for typos.
+- **Modern CSS:** `calc()` everywhere, every CSS math function, custom properties, CSS Color 4 and 5, Selectors Level 4, `@layer`, `@container`, `@font-face` and more. Layout moved to taffy 0.15.
+- **Tailwind CSS v4**, compiled on first use.
+
+### Rendering
+
+- **The GPU renderer** on Direct3D 11, opt-in, drawing the same pixels as the CPU raster.
+- **Slug GPU text**, from glyph outlines, switchable with `BUI_SLUG`.
+- **Inter embedded** as the default face everywhere, with the portable text engine now the default on Windows too.
+- **Parallel canvas rasterisation** on Windows, and many speed-ups across the kit and the Rust crate. For example, a tkinter canvas with 2,000 items and one moving went from 9.4 to 0.08 ms of render time per frame.
+
+### Not in the changelog yet
+
+Some work on `main` is described in the README but doesn't have a changelog entry yet: [Dear ImGui on BUI](../../imgui/cpp/), the OpenGL 3.3 GPU renderer on Linux, the macOS Cocoa window host, and Blender's string search and expression evaluator.
+
+### Fixed
+
+- GPU text read an environment variable on every text run, which pushed the GPU raster from 1.6 to 9.4 ms per frame at 3,000 cells. It now reads it once.
+- In Rust, `cx.notify()` inside `WindowHandle::update` didn't re-render that window.
+
+## 0.1.0: the first release
+
+The first release of `blenderui` on PyPI brought the foundations:
+
+- **The C kit:** Blender's UI as a C runtime, with the node tree, Tk's packer and gridder, Blender's interaction (hover, drag grabs, the continuous cursor, menus, tooltips), widget drawing ported from `interface_widgets.cc`, damage-driven rendering, undo and redo, animation, text areas, canvases and scroll views.
+- **A native Windows host**, DPI-aware, with vsync'd animation. Other platforms used a Tk window.
+- **tkinter syntax:** all 7,846 public names of tkinter and ttk, plus the dialogs and helper modules. Existing apps run unchanged with `blenderui-tk app.py`.
+- **Qt syntax:** a subset of Qt's widgets, layouts, signals, `QPainter`, menus and timers.
+- **45 Blender components**, from panels and sliders to pie menus, the color picker and editors.
+- **Packaging** as `blenderui`, with `import blenderui` as an alias of `bui`.
+
+<Callout type="tip" title="Follow along">
+Watch the [repository](https://github.com/ppmpreetham/BUI) on GitHub to hear about releases, or check the [Roadmap](../roadmap/) for what's planned next.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Full changelog" href="https://github.com/ppmpreetham/BUI/blob/main/CHANGELOG.md" icon="book" kicker="GitHub">
+ Every change, in detail.
+ </Card>
+ <Card title="Roadmap" href="docs/project/roadmap/" icon="flag" kicker="Project">
+ What's next.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/project/contributing.mdx b/website/src/content/docs/project/contributing.mdx
new file mode 100644
index 0000000..bddf655
--- /dev/null
+++ b/website/src/content/docs/project/contributing.mdx
@@ -0,0 +1,118 @@
+---
+title: Contributing
+description: "How to help BUI: report a bug, send a pull request, add a test, improve these docs, or report a security problem privately."
+section: Project
+order: 30
+sources: ["CONTRIBUTING.md", "CODE_OF_CONDUCT.md", "SECURITY.md", "SYNTAX_COVERAGE.md", "docs/getting-started.md", "website/WRITING.md"]
+---
+
+BUI gets better every time someone tries it and says what happened. You don't need to write C to help: a clear bug report, a missing tkinter behaviour, a docs fix or a test run on a Mac all move the project forward. Thank you for being here.
+
+## Ways to help
+
+| You have | You can |
+| --- | --- |
+| Five minutes | Report a bug, or something that behaves differently from stdlib tkinter or Qt |
+| A Mac | Run the Cocoa window host and report what happens: it's written but has never run on a Mac |
+| An afternoon | Add a missing tkinter or Qt method, a CSS property, or a test |
+| A way with words | Improve these docs (see [below](#write-docs)) |
+| A security finding | Report it privately (see [below](#report-a-security-problem)) |
+
+Bugs and features start with an [issue](https://github.com/ppmpreetham/BUI/issues), so we can agree on the approach before you spend time on code.
+
+## Set up
+
+<Steps>
+
+1. **Clone and build.**
+
+ ```sh
+ git clone https://github.com/ppmpreetham/BUI && cd BUI
+ cmake -S . -B build && cmake --build build
+ ```
+
+ You need CMake 3.20 or newer, a C compiler and Python 3.11+. On Windows, MSYS2 MinGW is the tested toolchain for the Python build. On Linux, install the X11 headers (`libx11-dev` or `libX11-devel`). Build with `-j 2` or less if your machine struggles.
+
+2. **Run the tests.**
+
+ ```sh
+ ctest --test-dir build --output-on-failure # C and Python suites
+ cd bindings/rust && cargo test # Rust crates
+ ```
+
+3. **Try the examples.**
+
+ ```sh
+ export PYTHONPATH=$PWD/bindings/python # Windows: set PYTHONPATH=%CD%\bindings\python
+ python examples/components_demo.py
+ ```
+
+</Steps>
+
+## Where things live
+
+| You want to change | Look in |
+| --- | --- |
+| Widget drawing, input, layout, rendering | `kit/` (C), `gpu/` (raster, GPU, text) |
+| tkinter or Qt behaviour | `bindings/python/bui/tksyntax/`, `bindings/python/bui/qtsyntax.py` |
+| Blender components | `bindings/python/bui/components/` |
+| Rust: CSS, layout, hooks | `bindings/rust/blenderui/src/` |
+| Rust: `rsx!`, `#[component]`, `tw!` | `bindings/rust/blenderui-macros/src/` |
+| Tailwind utilities and variants | `bindings/rust/blenderui-tailwind/src/lib.rs` |
+| These docs | `website/src/content/docs/` |
+
+[How BUI works](../../concepts/how-it-works/) and [ARCHITECTURE.md](https://github.com/ppmpreetham/BUI/blob/main/ARCHITECTURE.md) explain how the modules fit together.
+
+**Adding a tkinter or Qt member:** add it to the facade class in `bindings/python/bui/tksyntax/` or `bindings/python/bui/qtsyntax.py`, mapping it onto kit node properties, geometry, or the canvas and text-area calls. New drawing or interaction belongs in the C kit (`kit/intern/`).
+
+## Send a pull request
+
+- **One change per pull request**, with a test for it:
+ - C: a `ctest` suite.
+ - Python: `bindings/python/tests/`. For tkinter behaviour, add a program to the side-by-side suite (`tests/test_tk_compat.py`) that must behave exactly like the standard library.
+ - Rust: `bindings/rust/blenderui/tests/`.
+- **Don't let performance regress.** The test suite enforces frame budgets. For rendering or layout changes, run the benchmark in `bindings/rust/bench/` and include before and after numbers. [Run the benchmarks](../../performance/run-benchmarks/) has the commands.
+- **Keep the license header.** New files carry the SPDX header `GPL-2.0-or-later`, and contributions are accepted under that license.
+- **Update the docs.** Add your change to the Unreleased section of `CHANGELOG.md`, and to the relevant guide.
+- **Match the style around you.** C is formatted like Blender's sources. Rust uses `rustfmt` defaults with a maximum width of 120.
+
+## Write docs
+
+These docs live in `website/` and are written in MDX. Every page follows one guide, [WRITING.md](https://github.com/ppmpreetham/BUI/blob/main/website/WRITING.md): who we write for, the voice, the page template, the components and the list of pages still to write. A few rules from it matter most:
+
+- **Check every fact against the repository**, and list the files you checked in the page's `sources`.
+- **Never invent numbers.** Benchmarks come with their machine and method.
+- **Be honest about status.** Mark unbuilt features with `<ComingSoon>`.
+
+To claim a planned page, open an issue or a draft pull request titled `docs: <path>`.
+
+## Report a security problem
+
+**Please don't open a public issue for security problems.** Report them privately through [GitHub's private vulnerability reporting](https://github.com/ppmpreetham/BUI/security/advisories/new). Include steps to reproduce, the affected version and platform, and the impact.
+
+You'll get an acknowledgment within a week. Once a fix is released, you'll be credited in the changelog, unless you'd rather stay anonymous. Security fixes go into the latest `blenderui` release on PyPI and the `main` branch.
+
+## Code of conduct
+
+BUI follows the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). In short:
+
+- Be respectful, welcoming and patient.
+- Give and accept constructive feedback gracefully.
+- Focus on what is best for the project and its users.
+- No harassment, insults, or personal or political attacks.
+
+To report unacceptable behaviour, open a [private security advisory](https://github.com/ppmpreetham/BUI/security/advisories/new) with "Code of Conduct" in the title, or contact a maintainer directly. Reports are reviewed and kept confidential.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Open an issue" href="https://github.com/ppmpreetham/BUI/issues" icon="github" kicker="GitHub">
+ Report a bug or propose a change.
+ </Card>
+ <Card title="Roadmap" href="docs/project/roadmap/" icon="flag" kicker="Project">
+ Pick something that's partial or planned.
+ </Card>
+ <Card title="How BUI works" href="docs/concepts/how-it-works/" icon="layers" kicker="Concepts">
+ Find your way around the code.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/project/faq.mdx b/website/src/content/docs/project/faq.mdx
new file mode 100644
index 0000000..8c9eb97
--- /dev/null
+++ b/website/src/content/docs/project/faq.mdx
@@ -0,0 +1,84 @@
+---
+title: Frequently asked questions
+sidebarLabel: FAQ
+description: Straight answers to what people ask most about BUI. Do you need Blender, is it a browser, how it compares with Electron, and what the GPL means for you.
+section: Project
+order: 20
+sources: ["README.md", "docs/tkinter.md", "docs/imgui.md", "docs/rust.md", "docs/javascript.md", "LICENSE", "CHANGELOG.md", "bindings/python/bui/_version.py"]
+---
+
+Short, honest answers to the questions people ask most. If yours isn't here, [open an issue](https://github.com/ppmpreetham/BUI/issues): if one person asks, others are wondering too.
+
+## Do I need Blender installed?
+
+**No.** BUI contains the parts of Blender's UI code it needs and builds on its own. You don't need Blender installed, and you don't need to know Blender to use BUI. If you do know it, everything will feel familiar.
+
+## Is it really my unchanged tkinter app?
+
+**Yes.** Run it with `blenderui-tk app.py`, and `import tkinter` returns BUI's implementation, which covers every public tkinter and ttk name (7,846 of 7,846). Nine real programs are tested to behave identically on the standard library and on BUI.
+
+There are a few differences. Mainly, options that only change Tk's appearance (`relief`, `borderwidth`, `ttk.Style` …) are accepted but don't change the look, which always comes from Blender's theme. [tkinter compatibility](../../python/tkinter/) lists them.
+
+## Is it a web browser in Rust?
+
+**No.** There's no browser engine, no webview and no network. BUI takes HTML elements and CSS as a *UI language*: they're laid out with [taffy](https://github.com/DioxusLabs/taffy) and drawn by BUI's own engine, with Blender's widgets where you ask for them, in a native window.
+
+JavaScript is optional, too: the Rust crate needs none, and the JavaScript packages drive the same engine.
+
+## Is the Dear ImGui support a re-implementation?
+
+**No.** It's the real Dear ImGui (vendored, MIT-licensed), running on a BUI backend, so every function behaves as upstream. The optional Blender-widgets build changes only how ImGui's widgets are drawn and how they react to the mouse, by compiling an edited copy of `imgui_widgets.cpp`.
+
+## How is it different from Electron, Electrobun or GPUIX?
+
+- **Electron** ships Chromium with every app: on the order of 100 MB or more.
+- **Electrobun** runs on Bun and renders in the system's webview. It's small to download, but the UI is still a browser page.
+- **GPUIX**, like BUI, renders React natively: React drives Zed's GPUI.
+
+BUI also renders natively, with Blender's widgets, a much larger part of CSS, Tailwind, and hooks backed by signals. `bui build` makes a 5 MB executable that reaches its first frame in about 70 ms. (Measured on a Ryzen 7 5800U laptop; see [Benchmarks](../../performance/benchmarks/).)
+
+## Do the Rust macros cost performance?
+
+**No.** `rsx!`, `#[component]`, `css!` and `tw!` expand at compile time into the same builder calls you would write by hand. Tailwind classes are compiled to CSS once, on first use. Hooks cost a few nanoseconds per read or write.
+
+## Is it fast?
+
+Yes, in the ways people notice. An idle window uses no CPU, because BUI redraws only what changes and otherwise sleeps. A Rust app shows its first frame in about 38 ms. A hover redraws one widget, in about 0.05 ms on the components demo. The [Benchmarks](../../performance/benchmarks/) page has the numbers and how they were measured.
+
+## Which platforms does it run on?
+
+Windows and Linux fully; macOS with caveats. The macOS window host is written but hasn't been run on a Mac yet ([help test it](https://github.com/ppmpreetham/BUI/blob/main/docs/macos-testing.md)), JavaScript runs headless there, and there's no GPU renderer on macOS yet. See [Platforms](../../reference/platforms/).
+
+## Can I change the colors?
+
+You can color individual elements in every API, and Rust and JavaScript give you full CSS on plain HTML elements. You also get Blender's Light theme as well as its default Dark one: `bui.set_theme("light")`, `blenderui::set_theme("light")`, `new App({ theme: "light" })` or `BUI_THEME=light`. Custom theme files aren't supported. See [Theming](../../concepts/theming/).
+
+## Is it ready for production?
+
+BUI is young: its version is still 0.x. Much of it is complete and tested (the C kit, tkinter, the components, Rust, Dear ImGui, JavaScript), and some parts are partial or experimental (Qt syntax, parts of CSS and text, macOS). The [Roadmap](../roadmap/) shows which is which. Pin your version, and test on the platforms you ship.
+
+## Who wrote it?
+
+The README says it plainly: the repository is built entirely using LLMs, with no human-written code. The drawing and interaction code is ported from Blender's sources, and the behaviour is checked by tests (C, Python, Rust and JavaScript suites, the tkinter side-by-side programs and the GPU parity test).
+
+## Why GPL?
+
+BUI is derived from Blender's source code, which is licensed GPL-2.0-or-later, so BUI is too.
+
+## Can I use BUI in a commercial app?
+
+The GPL allows commercial use. What it asks is that when you distribute a program that includes BUI, you distribute it under the GPL too, with its source code available. If that doesn't fit your project, talk to a lawyer before you ship. (This is a summary, not legal advice.) [License and credits](../license-and-credits/) has the details.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Install BUI" href="docs/start/installation/" icon="terminal" kicker="Start here">
+ One command for Python and JavaScript.
+ </Card>
+ <Card title="Roadmap" href="docs/project/roadmap/" icon="flag" kicker="Project">
+ What works, what's partial, what's planned.
+ </Card>
+ <Card title="Ask a question" href="https://github.com/ppmpreetham/BUI/issues" icon="github" kicker="GitHub">
+ Not answered here? Open an issue.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/project/license-and-credits.mdx b/website/src/content/docs/project/license-and-credits.mdx
new file mode 100644
index 0000000..5bafc7a
--- /dev/null
+++ b/website/src/content/docs/project/license-and-credits.mdx
@@ -0,0 +1,78 @@
+---
+title: License and credits
+description: BUI is free software under GPL-2.0-or-later, because it's built from Blender. What that means, the licenses of the parts BUI includes, and the projects it stands on.
+section: Project
+order: 60
+sources: ["README.md", "LICENSE", "pyproject.toml", "bindings/rust/Cargo.toml", "bindings/node/package.json", "bindings/react/package.json", "gpu/extern/Inter-LICENSE.txt", "gpu/extern/stb_truetype.h", "gpu/extern/freetype/LICENSE.TXT", "kit/extern/nanosvg/README.blender", "bindings/imgui/extern/imgui/LICENSE.txt", "bindings/rust/blenderui-tailwind/src/theme.rs", "CONTRIBUTING.md"]
+---
+
+BUI is free software. You can use it, study it, change it and share it. It exists because thousands of people built Blender's interface over decades and shared it under a free license; BUI keeps that promise going.
+
+## BUI's license: GPL-2.0-or-later
+
+BUI is derived from Blender's source code, which is licensed under the **GNU General Public License, version 2 or later**, so BUI is too. Every source file keeps its SPDX header:
+
+```c
+SPDX-License-Identifier: GPL-2.0-or-later
+```
+
+The Python package (`pyproject.toml`), the Rust crates (`Cargo.toml`) and the npm packages (`package.json`) all declare `GPL-2.0-or-later`. The repository's `LICENSE` file holds the text of version 3 of the GNU GPL, one of the versions that "or later" covers.
+
+### What it means for you
+
+In plain words, and not as legal advice:
+
+- **Using BUI** to build and run your own programs is free, for any purpose, commercial included.
+- **Changing BUI** is free too.
+- **Distributing** a program that includes BUI (shipping an app, publishing a package) means distributing it under the GPL as well, with its source code available to the people you give it to.
+
+If you need different terms, ask a lawyer before you ship.
+
+### Contributing
+
+Contributions are accepted under the same license, and new files carry the same SPDX header. See [Contributing](../contributing/).
+
+## Third-party parts
+
+Some parts of BUI come from other projects and keep their own licenses:
+
+| Part | What it does in BUI | License |
+| --- | --- | --- |
+| [Blender](https://www.blender.org) sources | Widget drawing, interaction rules, theme, icons, `blenlib`, GHOST window code, the file browser and node editor | GPL-2.0-or-later |
+| [Dear ImGui](https://github.com/ocornut/imgui) by Omar Cornut | The immediate-mode GUI that runs on BUI | MIT |
+| [Inter](https://rsms.me/inter) by Rasmus Andersson | The embedded UI font, as in Blender (`gpu/extern/Inter-LICENSE.txt`) | SIL Open Font License 1.1 |
+| [FreeType](https://freetype.org) 2.13.3 | Glyph loading, hinting and rendering, like Blender's BLF | FreeType License or GPLv2 (dual-licensed) |
+| [stb_truetype](https://github.com/nothings/stb) by Sean Barrett | Font metrics, and the fallback text rasterizer | Public domain |
+| [NanoSVG](https://github.com/memononen/nanosvg) by Mikko Mononen, as edited by Blender | Rasterizing Blender's SVG icons | Zlib |
+| [Slug](https://github.com/EricLengyel/Slug) by Eric Lengyel | The GPU glyph coverage algorithm (shader code "Copyright 2017 by Eric Lengyel") | MIT |
+| [Tailwind CSS](https://tailwindcss.com) | The v4 default theme values behind the Tailwind support | MIT |
+
+The Rust and JavaScript bindings also depend on crates and packages such as taffy, napi-rs, React and QuickJS, each under its own license.
+
+## Acknowledgments
+
+BUI stands on the work of many people. Thank you to:
+
+- **[Blender](https://www.blender.org)** and its community: the UI this project is built from, including its GHOST window code and `blenlib`.
+- **[Dear ImGui](https://github.com/ocornut/imgui)** by Omar Cornut: the immediate-mode GUI that runs on BUI.
+- **[taffy](https://github.com/DioxusLabs/taffy)**: flexbox, grid and block layout for the Rust crate.
+- **[Tailwind CSS](https://tailwindcss.com)**: the v4 theme behind the Tailwind support.
+- **[stb_truetype](https://github.com/nothings/stb)**: the text engine.
+- **[Inter](https://rsms.me/inter)** by Rasmus Andersson: the embedded UI font, as in Blender.
+- **[Slug](https://github.com/EricLengyel/Slug)** by Eric Lengyel: the GPU glyph coverage algorithm.
+- **[gpui](https://github.com/zed-industries/zed)**, **[zopra](https://github.com/ppmpreetham/zopra)** and **[Leptos](https://leptos.dev)**: the APIs the Rust syntax follows.
+
+<Callout type="joke">
+The license is longer than most of our examples. That's fine: unlike a render, you only have to read it once.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="FAQ" href="docs/project/faq/" icon="info" kicker="Project">
+ More questions about BUI, answered.
+ </Card>
+ <Card title="Contributing" href="docs/project/contributing/" icon="github" kicker="Project">
+ Help make BUI better.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/project/publishing.mdx b/website/src/content/docs/project/publishing.mdx
new file mode 100644
index 0000000..18ff868
--- /dev/null
+++ b/website/src/content/docs/project/publishing.mdx
@@ -0,0 +1,167 @@
+---
+title: Publishing releases
+sidebarLabel: Publishing
+description: For maintainers. How BUI is packaged and released to PyPI, npm and crates.io, with the one-time setup and a checklist for each.
+section: Project
+order: 40
+badges: ["Maintainers"]
+sources: ["docs/publishing.md", "docs/javascript.md", "pyproject.toml", ".github/workflows/wheels.yml", "bindings/python/bui/_version.py", "bindings/rust/Cargo.toml", "bindings/rust/blenderui-sys/build.rs", "bindings/node/package.json", "bindings/react/package.json", "CHANGELOG.md"]
+---
+
+This page is for maintainers cutting a release. If you just want to use BUI, [Install BUI](../../start/installation/) is what you're after.
+
+BUI ships to three registries: **PyPI** (`blenderui`), **npm** (`@blender-ui/native` and `@blender-ui/react`) and **crates.io** (the `blenderui` crates). Each has its own version and its own steps.
+
+## At a glance
+
+| Registry | Package | Version lives in | How it's released |
+| --- | --- | --- | --- |
+| PyPI | `blenderui` | `bindings/python/bui/_version.py` | Push a `v*` tag; CI builds, tests and publishes |
+| npm | `@blender-ui/native`, `@blender-ui/react` | Each package's `package.json` | `npm publish`, by hand, native first |
+| crates.io | `blenderui-tailwind`, `blenderui-macros`, `blenderui-sys`, `blenderui` | `bindings/rust/Cargo.toml` (`[workspace.package]`) | `cargo publish`, by hand, after vendoring the C sources |
+
+## PyPI
+
+### What a wheel contains
+
+```text
+site-packages/
+ buipy.<abi>.pyd|.so the C kit + raster engine (one extension module)
+ _buiimgui.<abi>.pyd|.so Dear ImGui for blenderui.imgui (when CMake builds bui_cimgui)
+ bui/ tksyntax/, qtsyntax.py, components/, host.py ...
+ blenderui/ alias package: blenderui.X is bui.X
+ blenderui-<v>.dist-info/
+```
+
+Wheels are built with [scikit-build-core](https://scikit-build-core.readthedocs.io), which drives the project's CMake. The version comes from `bindings/python/bui/_version.py`, the single source that CMake reads too. The console script `blenderui-tk app.py` is the same as `python -m bui.tksyntax app.py`.
+
+On Windows, the extension is built with MinGW-w64 GCC (UCRT) and statically linked against the GCC runtime, so it depends only on system DLLs and Python's own. A wheel is about 0.4 MB compressed; the sdist is about 1.7 MB.
+
+### CI
+
+The `.github/workflows/wheels.yml` workflow has four jobs:
+
+| Job | Does |
+| --- | --- |
+| `wheels` | `cibuildwheel` for Linux (manylinux x86_64, with the X11 headers installed so wheels get the native host), Windows (MinGW, x86_64) and macOS (arm64 and x86_64), for CPython 3.11 to 3.14. Each wheel is imported as a smoke test. |
+| `sdist` | `python -m build --sdist` |
+| `tests` | A CMake build and `ctest` (all C and Python suites) on Windows |
+| `publish` | On a `v*` tag, uploads everything to PyPI with trusted publishing. A manual run with `testpypi` uploads to TestPyPI. |
+
+### One-time setup
+
+1. Create the `blenderui` project on PyPI and register it as a [pending trusted publisher](https://docs.pypi.org/trusted-publishers/) for this repository: workflow `wheels.yml`, environment `pypi`.
+2. Do the same on TestPyPI with the environment `testpypi`.
+3. In the GitHub repository settings, create the environments `pypi` and `testpypi` (optionally with required reviewers).
+
+No API tokens are stored anywhere.
+
+### Release checklist
+
+<Steps>
+
+1. **Bump the version** in `bindings/python/bui/_version.py`, following semantic versioning.
+
+2. **Add the release to `CHANGELOG.md`.**
+
+3. **Test locally.** `ctest --test-dir build` must pass. Optionally run the workflow by hand with `testpypi`, then:
+
+ ```sh
+ pip install -i https://test.pypi.org/simple blenderui
+ ```
+
+4. **Tag and push.** CI builds, tests and publishes.
+
+ ```sh
+ git tag v0.1.0 && git push --tags
+ ```
+
+</Steps>
+
+### Build a wheel locally
+
+```sh
+python -m pip install build
+python -m build # sdist + wheel in dist/
+```
+
+On Windows with MSYS2 MinGW (the tested toolchain), set `CMAKE_GENERATOR=MinGW Makefiles`, `CC=gcc` and `CXX=g++` first. Test the wheel in a clean virtual environment:
+
+```sh
+python -m venv /tmp/bui-venv
+/tmp/bui-venv/bin/pip install dist/blenderui-*.whl
+/tmp/bui-venv/bin/python -c "import blenderui, blenderui.tksyntax, blenderui.components; print(blenderui.__version__)"
+```
+
+## npm
+
+The packages are published under the [`@blender-ui`](https://www.npmjs.com/org/blender-ui) organization. `@blender-ui/react` depends on `@blender-ui/native` (`^0.2.0`), so **publish the native package first** whenever it has changed.
+
+```sh
+npm login # an account in the blender-ui org
+cd bindings
+npm install # link the workspace
+cd node && npm publish --access public # @blender-ui/native (builds the addon and runtime, runs the tests)
+cd ../react && npm publish --access public # @blender-ui/react (runs the tests)
+```
+
+- **`prepublishOnly`** runs the tests before uploading. For the native package it first builds the addon and `bui-runtime`, which needs Rust, CMake and a C compiler (with MinGW, put its `bin` folder on `PATH`).
+- **`prepack`** copies the repository's `LICENSE` into the package.
+- **Preview** with `npm pack --dry-run`, which lists what a package will contain.
+- **Releasing again:** bump `version` in the package's `package.json` first; npm refuses to publish the same version twice. When the native package changes in a way React needs, raise React's `@blender-ui/native` range to match.
+
+The native package ships `blenderui.win32-x64.node` and `bui-runtime.win32-x64.exe`, and its `os` and `cpu` fields limit it to Windows x64. More platforms would mean building both on each platform, typically in CI, and publishing optional per-platform packages, the napi-rs convention.
+
+## crates.io
+
+The four crates below are on crates.io (version 0.1.0 at the time of writing), and users add them with `cargo add blenderui`. They're published in dependency order:
+
+| Crate | What it is | Depends on |
+| --- | --- | --- |
+| `blenderui-tailwind` | Tailwind v4 class compiler (std only) | Nothing |
+| `blenderui-macros` | `rsx!` / `view!`, `#[component]`, `css!`, `tw!` | `blenderui-tailwind` |
+| `blenderui-sys` | FFI over the C kit; builds it with CMake | Nothing (CMake at build time) |
+| `blenderui` | The framework | All three |
+
+<Callout type="note" title="blenderui-imgui">
+The Dear ImGui crate, `blenderui-imgui`, isn't on crates.io yet; its users take it as a git dependency. It isn't marked `publish = false`, so `cargo publish --workspace` would include it: publish the four crates one by one (`cargo publish -p ...`) until it's meant to go out.
+</Callout>
+
+A published crate can't reach files outside itself, so `blenderui-sys` must carry the C sources. Its build script looks for them in three places, in order: `BUI_SOURCE_DIR` if set, the surrounding repository, then `csrc/`, the vendored copy a downloaded crate has.
+
+<Steps>
+
+1. **Bump the version** in `bindings/rust/Cargo.toml` (`[workspace.package]`); the crates share one version. Then update the `version = "..."` of the path dependencies in `blenderui/Cargo.toml` and `blenderui-macros/Cargo.toml`.
+
+2. **Log in once** with `cargo login` and a crates.io API token.
+
+3. **Vendor the C sources, then publish.** `cargo publish --workspace` orders the crates itself on Cargo 1.90 and newer:
+
+ ```sh
+ python bindings/rust/scripts/vendor_c.py # copies ~7 MB into blenderui-sys/csrc/
+ cd bindings/rust
+ cargo package --workspace --allow-dirty # optional: builds each packaged crate in isolation
+ cargo publish --workspace --allow-dirty
+ ```
+
+ `--allow-dirty` is needed because `csrc/` is untracked. Users need CMake and a C compiler to build `blenderui-sys`. The benchmark in `bench/` is excluded from the workspace and never published.
+
+</Steps>
+
+## Known gaps before 1.0
+
+- **macOS:** the native Cocoa host hasn't been run on a Mac yet. With `BUI_HOST=tk`, the wheels use the standard Tk window instead.
+- **Windows wheels** are built with MinGW. MSVC builds work (the Rust crate and the CMake build use it), but aren't what's published.
+- **No musllinux or 32-bit wheels** yet.
+- **npm:** prebuilt for Windows x64 only.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Changelog" href="docs/project/changelog/" icon="book" kicker="Project">
+ What's in the next release.
+ </Card>
+ <Card title="Contributing" href="docs/project/contributing/" icon="github" kicker="Project">
+ How changes get into a release.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/project/roadmap.mdx b/website/src/content/docs/project/roadmap.mdx
new file mode 100644
index 0000000..1819ec6
--- /dev/null
+++ b/website/src/content/docs/project/roadmap.mdx
@@ -0,0 +1,94 @@
+---
+title: Roadmap and status
+sidebarLabel: Roadmap
+description: What works today, what's partial, and what's coming next, straight from the repository's status tables.
+section: Project
+order: 10
+sources: ["README.md", "docs/qt.md", "docs/rust.md", "docs/imgui.md", "docs/javascript.md", "docs/publishing.md"]
+---
+
+Here's the honest picture. Most of BUI works today, a few parts are partial, and some are still plans. This page tells you which is which, so you never have to guess.
+
+Each row has a status: **Works** when it works and is tested, **Partial** when common cases work but pieces are missing, **Experimental** when it's written but not yet proven on real hardware, and **Planned** when it's planned but not built.
+
+## Done
+
+<StatusTable
+ rows={[
+ ["C runtime (the kit)", "done", "Nodes, Tk-style geometry managers, input, Blender widget drawing, damage rendering, undo, animation, text areas, canvases, scroll views, Blender's string search, expression evaluator, text-edit undo and float precision"],
+ ["Native windows", "done", "Windows (Win32) and Linux (X11; Wayland through XWayland): DPI-aware, frame-paced animation, clipboard, cursors"],
+ ["Themes", "done", "Blender's Dark (default) and Light presets, switchable at run time from every language, or with <code>BUI_THEME</code>"],
+ ["tkinter syntax", "done", "Every public tkinter and ttk name: 7,846 of 7,846"],
+ ["Blender components", "done", "45 components, including the color ramp, curve and node editors"],
+ ["Rust", "done", "All 113 HTML elements, flexbox, grid, CSS 2.1, modern CSS, animations, Tailwind v4, <code>rsx!</code> and gpui-style builders, <code>#[component]</code>, hooks, Blender components, headless testing"],
+ ["Dear ImGui", "done", "The real Dear ImGui 1.93 on BUI (CPU, Direct3D 11, OpenGL); C++, C (399 of 399 functions), Python and Rust; the Blender-widgets build"],
+ ["Rendering", "done", "Parallel, damage-tracked software raster; GPU renderer on Direct3D 11 (Windows) and OpenGL 3.3 (Linux)"],
+ ["JavaScript and React", "done", "<code>@blender-ui/native</code> and <code>@blender-ui/react</code> on Node.js and Bun; <code>bui build</code> standalone executables"],
+ ["Packaging", "done", "<code>blenderui</code> on PyPI with wheels for every platform; <code>blenderui</code> on crates.io; <code>@blender-ui/react</code> and <code>@blender-ui/native</code> on npm"],
+ ]}
+/>
+
+## Partial or in progress
+
+<StatusTable
+ rows={[
+ ["Qt syntax", "partial", "About 25% of Qt's methods on the main widget classes. Missing: model/view classes, docks, toolbars, splitters, Qt stylesheets"],
+ ["CSS (Rust, JavaScript)", "partial", "261 of 745 W3C properties render and 129 more parse. Missing: 3D transforms, OpenType font features, multi-column layout"],
+ ["Text", "partial", "No text wrapping around floats; right-to-left text is reordered but not shaped; no per-glyph font fallback yet; no IME"],
+ ["Rust components", "partial", "No async resources (<code>use_resource</code>) and no generic components yet"],
+ ["Dear ImGui", "partial", "Python and safe Rust skip the <code>va_list</code>, <code>void*</code> and C-callback functions; in the Blender-widgets build, title bars, tooltips, plain popups, tables and the color picker keep ImGui's drawing"],
+ ["npm packages", "partial", "Prebuilt for Windows x64 only; on Linux, build the addon from source"],
+ ["macOS", "experimental", "The Cocoa window host is written but not yet run on a Mac (<a href='https://github.com/ppmpreetham/BUI/blob/main/docs/macos-testing.md'>testing guide</a>); JavaScript is headless there; no GPU renderer yet"],
+ ["<code>blenderui-imgui</code> on crates.io", "partial", "The main <code>blenderui</code> crate is published; the Dear ImGui crate isn't yet, so use it as a git dependency"],
+ ]}
+/>
+
+## Planned
+
+<StatusTable
+ rows={[
+ ["WebAssembly", "planned", "The kit in the browser: the raster blits to a <code>&lt;canvas&gt;</code>, DOM events feed the kit, and the React and DOM-like APIs run on top, unchanged"],
+ ["egui", "planned", "BUI panels inside egui, plus a Blender-styled theme"],
+ ["More from Blender's source", "planned", "Per-glyph font fallback (BLF), IME, search-as-you-type popups, units in number fields, widget drag and drop"],
+ ["macOS GPU and JavaScript windows", "planned", "The GPU renderer on Metal (or the OpenGL backend), and Node windows on the main thread"],
+ ["More GPU backends", "planned", "Vulkan and WebGPU, drawing the same instance stream as Direct3D 11 and OpenGL"],
+ ["More languages", "planned", "MyGo, C#, Go, Zig, Swift, Kotlin and Lua over the same C header; Godot, Unity and Bevy; Flutter"],
+ ]}
+/>
+
+<ComingSoon feature="WebAssembly">
+
+This is the one people ask about most. The plan: BUI's software raster draws into a browser `<canvas>`, the browser's events feed the kit, and `@blender-ui/react` works unchanged. Nothing to try yet.
+
+</ComingSoon>
+
+## Docs pages on the way
+
+The documentation grows alongside BUI. These lists come straight from the pages themselves, so they're always current.
+
+### Coming soon
+
+<PageStatusList status="coming-soon" empty="Every planned page is written. Nice." />
+
+### In preview
+
+<PageStatusList status="preview" empty="No pages are in preview right now." />
+
+## Help make it happen
+
+The quickest wins are the experimental rows: if you have a Mac, running the Cocoa host and reporting what happens is enormously useful. The [macOS testing guide](https://github.com/ppmpreetham/BUI/blob/main/docs/macos-testing.md) walks you through it. Bug reports, missing tkinter or Qt behaviour, CSS features and docs are all welcome too. Start with [CONTRIBUTING.md](https://github.com/ppmpreetham/BUI/blob/main/CONTRIBUTING.md).
+
+<Callout type="joke">
+Our roadmap has no dates on it. Like a good render, it's done when the noise goes away.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Install BUI" href="docs/start/installation/" icon="terminal" kicker="Start here">
+ Try what works today.
+ </Card>
+ <Card title="Open an issue" href="https://github.com/ppmpreetham/BUI/issues" icon="github" kicker="Contribute">
+ Ask for a feature, report a bug, or claim a roadmap item.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/python/components-reference.mdx b/website/src/content/docs/python/components-reference.mdx
new file mode 100644
index 0000000..3c2d02e
--- /dev/null
+++ b/website/src/content/docs/python/components-reference.mdx
@@ -0,0 +1,250 @@
+---
+title: Components reference
+description: Every class and helper exported by blenderui.components, with its signature, its useful members and a small example, grouped the way you'll look for them.
+section: Python
+order: 40
+languages: ["python"]
+sources: ["bindings/python/bui/components/__init__.py", "bindings/python/bui/components/app.py", "bindings/python/bui/components/core.py", "bindings/python/bui/components/containers.py", "bindings/python/bui/components/widgets.py", "bindings/python/bui/components/views.py", "bindings/python/bui/components/menus.py", "bindings/python/bui/components/editors.py", "bindings/python/bui/components/templates.py", "bindings/python/bui/components/nodes.py", "docs/components.md", "examples/components_demo.py"]
+---
+
+This page lists everything `blenderui.components` exports, with the exact signatures from the source. When you know what you want and need the argument names, you're in the right place. For how the pieces fit together, start with the [components guide](../components/).
+
+**Reading the signatures:** arguments after `*` are keyword-only. Every component also accepts the [common keywords](#common-keywords) below, and every value component the [value keywords](#value-components).
+
+## Common keywords
+
+Every component takes these, and has them as properties:
+
+| Keyword | Default | Meaning |
+| --- | --- | --- |
+| `description` | `""` | Tooltip text, shown after hovering |
+| `enabled` | `True` | `False` greys it out and ignores input |
+| `visible` | `True` | `False` hides it |
+| `weight` | `1.0` | Share of the width in a `Row`; `0` keeps the natural width |
+| `fill` | `False` | In a column, grow into the spare height (an editor filling its area) |
+
+Properties after layout: `x`, `y`, `w`, `h` and `rect` (`(x, y, w, h)`). Containers have `add(*children)`, `remove(child)` and `children`.
+
+### Value components
+
+Components that hold a value take `label` and `value` as their first two arguments (except where noted), plus:
+
+| Keyword or member | Meaning |
+| --- | --- |
+| `on_change=fn` | Called as `fn(value)` when the user or your code changes the value |
+| `default=` | The value `reset()` returns to; defaults to the starting value. (`Dropdown`, `EnumRow` and `ColorSwatch` always use their starting value.) |
+| `.value` | Read or set the value; setting notifies `on_change` |
+| `.set_value(v, notify=True)` | Set, optionally without the callback |
+| `.reset()` | Back to the default; users press <Kbd>Backspace</Kbd> over the widget |
+| `.label` | The label text |
+
+## App and helpers
+
+| Name | Signature | Notes |
+| --- | --- | --- |
+| `App` | `App(title="BUI", size=(420, 640), *children, padding=None, spacing=None, header=None)` | The window. `children` go into `app.root`, a `Column`. `header` takes a `MenuBar`. |
+| `Component` | `Component(*, description="", enabled=True, visible=True, weight=1.0, fill=False)` | The base class of every component. |
+| `ValueComponent` | `ValueComponent(label="", value=None, *, default=None, on_change=None, **kw)` | The base class of value components. |
+| `unit()` | `unit() -> int` | Blender's widget unit in pixels: 20 at scale 1. Use it to size things like Blender does. |
+| `eval_number()` | `eval_number(text) -> float` | Blender-style number input: `eval_number("2*pi")`, `"1/3 + 2^2"`, `"sqrt(2)"`. |
+
+`App` members: `run(native=None)`, `open(native=None)`, `add(*components)`, `bind(combo, fn)`, `ctx`, `root`, `render_raster(w=None, h=None, full=False)`, and the input methods `press`, `release`, `motion`, `key`, `wheel` and `context_menu` ([headless testing](../headless-testing/)).
+
+## Layout
+
+| Component | Signature | Notes |
+| --- | --- | --- |
+| `Column` | `Column(*children, align=False, spacing=None, padding=0)` | Vertical stack. `align=True` joins widgets into one block. |
+| `Row` | `Row(*children, align=False, spacing=None, padding=0)` | Horizontal; children share the width by `weight`. |
+| `Split` | `Split(left, right, factor=0.4)` | `left` gets `factor` of the width. Blender's property rows. |
+| `Grid` | `Grid(*children, columns=2)` | Equal-width columns, filled row by row. |
+| `Box` | `Box(*children, align=False, spacing=None, padding=0)` | A padded column on Blender's box background. |
+| `Panel` | `Panel(title, *children, collapsed=False, icon=None, header=(), on_toggle=None, category=None)` | Collapsible; a panel inside a panel is a sub-panel. `header=[Checkbox("", True)]` puts components in the header. `category` picks its tab inside a `Sidebar`. Members: `collapsed`, `toggle()`, `title`, `body`. |
+| `Tabs` | `Tabs([("Title", component), ...], current=0, on_change=None)` | Pages with tabs. `on_change(index)`. Members: `current`, `select(i)`, `titles`. |
+| `SideTabs` | `SideTabs([("ICON", "Title", component), ...], current=0, on_change=None)` | The properties editor's icon tabs on the left; hover shows the name. `None` between pages starts a new group. Member: `page`. |
+| `Sidebar` | `Sidebar(*panels, current=0, on_change=None)` | An editor's N-panel: panels with a `category` show under one tab per category, along the right edge. <Kbd keys="Ctrl+Wheel" /> cycles tabs. |
+| `ScrollView` | `ScrollView(child, height=None, rows=8)` | A fixed-height viewport over a taller child, with the wheel and a draggable bar. Height is `height` pixels, or `rows` widget rows. |
+| `VectorField` | `VectorField(label="", value=(0.0, 0.0, 0.0), *, axes="XYZW", on_change=None, **number_kw)` | Aligned number fields, one per component. Extra keywords (`suffix`, `step`, `min` …) go to each field. <Kbd>Alt</Kbd>+drag edits all of them; <Kbd keys="Ctrl+Alt+C" /> / <Kbd keys="Ctrl+Alt+V" /> copy and paste the vector. |
+
+```py
+from blenderui.components import App, Panel, SideTabs, Tabs, ScrollView, Column, Label
+
+pages = SideTabs([("OBJECT_DATA", "Object", Panel("Transform", Label("…"))),
+ ("MATERIAL", "Material", Panel("Surface", Label("…")))])
+long_list = ScrollView(Column(*[Label("Row %d" % i) for i in range(50)]), rows=6)
+App("Layout", (420, 400), pages, Tabs([("List", long_list), ("Empty", Label(""))])).run()
+```
+
+## Values
+
+| Component | Signature | Notes |
+| --- | --- | --- |
+| `NumberField` | `NumberField(label="", value=0.0, *, min=None, max=None, step=None, precision=None, integer=None, suffix="")` | Drag to scrub, arrows to step, click to type math. `suffix` is shown after the number (`" m"`, `"°"`). Member: `editing`. |
+| `NumberSlider` | `NumberSlider(label="", value=0.0, *, min=0.0, max=1.0, **kw)` | A number field that fills with the value. Takes `NumberField`'s other keywords. |
+| `TextField` | `TextField(label="", value="", *, placeholder="", icon=None, live=False)` | Single-line text with Blender's editing. `live=True` reports every keystroke; otherwise `on_change` runs when you confirm. Member: `editing`. |
+| `SearchField` | `SearchField(value="", *, placeholder="Search")` | A search box with a magnifier icon. Note: no `label` argument. |
+| `HotkeyField` | `HotkeyField(label="", value="")` | Click, then press a key combination; <Kbd>Esc</Kbd> cancels. Member: `capturing`. |
+| `Checkbox` | `Checkbox(label="", value=False)` | Drag across several to set them all. Member: `toggle()`. |
+| `Toggle` | `Toggle(label="", value=False, *, icon=None, icon_on=None, emboss=True)` | A button that stays pressed. `icon_on` is shown while on; `emboss=False` draws Blender's flat header toggle. |
+| `Decorator` | `Decorator(label="", value=False)` | The keyframe dot next to a property; it turns into a diamond. |
+| `Dropdown` | `Dropdown(label="", items=(), value=None, *, icon_only=False, icons=None)` | A menu of `items` (strings); type to search. The value is the chosen string. `icons` is a list of icon names, one per item. Members: `items`, `index`. |
+| `EnumRow` | `EnumRow(label="", items=(), value=None, *, vertical=False, icon_only=False, icons=None)` | The same choice as joined buttons. `vertical=True` stacks them. |
+| `ColorSwatch` | `ColorSwatch(label="", value=(1.0, 1.0, 1.0, 1.0), *, picker="circle", alpha=True)` | RGBA, each 0 to 1. Click for Blender's color picker: `picker="circle"` (HSV wheel) or `"square"`, RGB / HSV / HSL sliders, hex and an eyedropper. <Kbd keys="Ctrl+C" /> copies the hex. |
+
+```py
+from blenderui.components import (App, Panel, NumberField, NumberSlider, VectorField,
+ TextField, SearchField, Row, Checkbox, Toggle,
+ Dropdown, EnumRow, ColorSwatch, HotkeyField,
+ Split, Label, ProgressBar)
+
+App("Gallery", (360, 380), Panel("Values",
+ NumberField("Count", 3, min=0, max=10, integer=True),
+ NumberField("Angle", 45.0, suffix="°", precision=1),
+ NumberSlider("Opacity", 0.8),
+ VectorField("Location", (0.0, 1.25, 0.0)),
+ TextField("Name", "Cube", placeholder="Name"),
+ SearchField(),
+ Row(Checkbox("Shadows", True), Toggle("Lock", icon="UNLOCKED", icon_on="LOCKED")),
+ Dropdown("Mode", ["Object Mode", "Edit Mode", "Sculpt Mode"]),
+ EnumRow("Pivot", ["Bounds", "Cursor", "Median"], "Median"),
+ ColorSwatch("Color", (0.8, 0.3, 0.1, 1.0)),
+ HotkeyField("Shortcut", "ctrl+s"),
+ Split(Label("Label"), ProgressBar(0.6, "Baking 60%")))).run()
+```
+
+<Figure
+ src="images/components-values.png"
+ alt="A Values panel: Count and Angle number fields, an Opacity slider, Location X Y Z fields, a Name text field, a search box, a Shadows checkbox and a Lock toggle, a Mode dropdown, a Pivot button row with Median selected, an orange color swatch, a Shortcut field and a progress bar at 60%"
+ caption="The gallery above, rendered by BUI."
+ width={360}
+ height={380}
+/>
+
+## Buttons, labels and feedback
+
+| Component | Signature | Notes |
+| --- | --- | --- |
+| `Button` | `Button(text="", on_click=None, *, icon=None, emboss=True)` | `on_click()` runs on release over the button. `emboss=False` draws it flat. Members: `text`, `click()`. |
+| `IconButton` | `IconButton(icon, on_click=None, *, emboss=False)` | Icon only; flat unless `emboss=True`. |
+| `Popover` | `Popover(text, *children, icon=None)` | A button that opens a panel of components. Member: `body`. |
+| `Label` | `Label(text="", *, icon=None, align="left", color=None, bold=False)` | `align` is `"left"`, `"center"` or `"right"`; `color` is RGBA. Member: `text`. |
+| `ProgressBar` | `ProgressBar(value=0.0, text=None)` | `value` from 0 to 1; `text` replaces the percentage. Members: `value`, `set_value(v)`, `text`. |
+| `Separator` | `Separator(factor=0.5, line=False)` | Vertical space of `factor` widget units, optionally with a line. |
+| `Spacer` | `Spacer()` | Empty space that takes its `weight` share of a `Row`; pushes what follows to the right. |
+
+`MenuButton` is under [Menus](#menus).
+
+## Views
+
+| Component | Signature | Notes |
+| --- | --- | --- |
+| `ListView` | `ListView(items=(), value=0, *, rows=5, on_rename=None, icons=None)` | Blender's UI list. The value is the selected index. Double-click or <Kbd>F2</Kbd> renames: `on_rename(index, name)`. Members: `items`, `scroll`, `editing`. |
+| `TreeView` | `TreeView(roots=(), *, rows=8, columns=(), on_toggle=None, on_rename=None)` | The outliner. The value is the selected `TreeItem`. `columns=("hide", "render")` adds toggle columns; `on_toggle(item, column, on)`. `on_rename(item, name)`. Members: `roots`, `row_count`, `rows_info`. |
+| `TreeItem` | `TreeItem(label, *children, icon=None, expanded=True, data=None, toggles=None)` | One row of a `TreeView`. `toggles={"hide": False}` sets its columns; `data` is yours. Members: `add(*items)`, `expanded`. |
+| `GridView` | `GridView(items=(), value=0, *, tile=4.0, rows=2.0, on_activate=None)` | Preview tiles. Items are `(label, preview)`, where `preview` is an icon name or an RGBA color. Double-click or <Kbd>Enter</Kbd>: `on_activate(index)`. Members: `items`, `tile_rect(i)`. |
+
+In lists and trees, arrow keys navigate, <Kbd>Left</Kbd> and <Kbd>Right</Kbd> collapse and expand (<Kbd>Shift</Kbd>+click an arrow for all children), and you can drag down a toggle column to set it on several rows.
+
+## Menus
+
+| Name | Signature | Notes |
+| --- | --- | --- |
+| `MenuItem` | `MenuItem(text, on_click=None, *, icon=None, shortcut=None, checked=None, submenu=None, enabled=True, description="")` | One entry. `checked=True` / `False` shows a checkbox; `submenu=[...]` opens another menu; `shortcut` is the text shown on the right. |
+| `MenuButton` | `MenuButton(text, items, *, icon=None)` | A pulldown button (`File`, `Edit` …). |
+| `MenuBar` | `MenuBar(("File", items), ("Edit", items), ..., right=())` | Blender's top bar, for `App(header=...)`. `right` holds components at the right end. |
+| `Menu` | `Menu.show(ctx, owner, items, title=None, at=None, on_pick=None)` | Opens a popup menu from code, by `owner` or at `at=(x, y)`. Plain-string items call `on_pick(text)`. |
+| `PieMenu` | `PieMenu.show(ctx, items, title="")` | A pie around the pointer: up to 8 items, placed W, E, S, N, NW, NE, SW, SE. Flick toward one and click, or press <Kbd>1</Kbd>–<Kbd>8</Kbd>. |
+
+Items in any menu are `MenuItem`s, plain strings, or `"-"` for a separator.
+
+```py
+from blenderui.components import App, Button, Menu
+
+add = Button("Add", icon="ADD")
+app = App("Menus", (300, 200), add)
+add.on_click = lambda: Menu.show(app.ctx, add, ["Cube", "Sphere", "-", "Monkey"],
+ "Add", on_pick=print)
+app.run()
+```
+
+## Color and editors
+
+| Component | Signature | Notes |
+| --- | --- | --- |
+| `ColorRamp` | `ColorRamp(stops=((0.0, (0, 0, 0, 1)), (1.0, (1, 1, 1, 1))), *, interpolation="Linear", on_change=None)` | Blender's color ramp. Click a stop to select it, drag to move, <Kbd>Ctrl</Kbd>+click to add, <Kbd>X</Kbd> or <Kbd>Delete</Kbd> to remove. `interpolation` is `"Linear"`, `"Ease"`, `"B-Spline"` or `"Constant"`. `on_change(stops)`. Members: `stops`, `sorted_stops()`, `active`, `interpolation`, `evaluate(t)`, `add_stop(pos=None)`, `remove_stop()`. |
+| `ColorStop` | `ColorStop(pos, color)` | One stop of a ramp, with `pos` and `color`. |
+| `CurveMapping` | `CurveMapping(points=((0.0, 0.0), (1.0, 1.0)), *, channels=(), height=8.0, on_change=None)` | Blender's curve widget. Click the curve to add a point, drag points (<Kbd>Ctrl</Kbd> snaps), <Kbd>X</Kbd> removes. `channels=("C", "R", "G", "B")` adds channel tabs. `on_change(channel, points)`. Members: `channel`, `points`, `evaluate(x, channel=None)`, `reset()`, `remove_selected()`. |
+| `NormalBall` | `NormalBall(label="", value=(0.0, 0.0, 1.0), *, size=4.0)` | A direction picker drawn as a lit sphere; drag to aim. |
+| `Histogram` | `Histogram(bins=(), *, height=5.0)` | Display only. `bins` are values or `(r, g, b)` triples, each 0 to 1. Member: `set_bins(bins)`. |
+| `IDSelector` | `IDSelector(items=(), value=None, *, icon="MESH_DATA", fake_user=False, on_change=None, on_new=None, on_unlink=None)` | Blender's data-block selector (`template_ID`). Members: `items`, `value`, `set_value(name, notify=True)`. |
+| `PathField` | `PathField(label="", value="", *, directory=False, on_browse=None, on_change=None)` | A path with a folder button. `on_browse()` may return a path; without it a dialog opens. Members: `value`, `set_value(path, notify=True)`, `browse()`. |
+
+<Figure
+ src="images/components-views.png"
+ alt="A Views panel with a list (Cube selected), an outliner tree with eye and camera toggle columns, and three preview tiles; an Editors panel with a color ramp, a curve, a lit normal ball and a histogram"
+ caption="Views and editors: <code>ListView</code>, <code>TreeView</code>, <code>GridView</code>, <code>ColorRamp</code>, <code>CurveMapping</code>, <code>NormalBall</code> and <code>Histogram</code>."
+ width={360}
+ height={660}
+/>
+
+<Figure
+ shot="feature-color-picker"
+ alt="The color picker opened from a swatch: an HSV wheel, a value strip, HSV sliders, a hex field and an eyedropper"
+ caption="Click a <code>ColorSwatch</code> and Blender's color picker opens."
+/>
+
+## Node editor and areas
+
+| Component | Signature | Notes |
+| --- | --- | --- |
+| `Node` | `Node(title="Node", *, inputs=(), outputs=(), location=(0.0, 0.0), width=140.0, kind="converter", color=None, collapsed=False, on_change=None)` | Inputs are `(name, type)` or `(name, type, value)`; a value draws a field while the input is unlinked. Outputs are `(name, type)`. `on_change(node, what, value)`. Members: `location`, `selected`, `collapsed`, `input_value(i)`. |
+| `NodeEditor` | `NodeEditor(nodes=(), *, links=(), on_links=None, on_delete=None)` | The node canvas. Links are `(from_node, output, to_node, input)`. `on_links(links)` runs after the user links, relinks or cuts; `on_delete(nodes)` on <Kbd>X</Kbd> / <Kbd>Delete</Kbd> (without it, the editor removes the selection itself). Members: `nodes`, `add_node()`, `remove_node()`, `links`, `selected`, `zoom`, `view_all()`. |
+| `Area` | `Area(editor, body, *, header=(), on_editor=None)` | A Blender area: a header with the editor-type menu (`editor` is its name), then `body` filling the rest. `on_editor(name)` when the user picks another editor type. |
+| `AreaHeader` | `AreaHeader(*children)` | An editor header row, 1.3 units tall. A `Spacer()` pushes later items to the right. |
+
+**Socket types** color the sockets: `float`, `int`, `bool`, `vector`, `color`, `shader`, `geometry`, `string`, `object`, `image`, `collection`, `texture`, `material`, `rotation`, `menu`, `matrix`.
+
+**Node kinds** pick the header color: `input`, `output`, `shader`, `texture`, `color`, `vector`, `converter`, `geometry`, `attribute`, `group`, `filter`, `script`, `matte`, `distort`, `layout`, `pattern`. Or pass `color=` yourself.
+
+```py
+from blenderui.components import App, Area, MenuButton, Node, NodeEditor, Spacer
+
+value = Node("Value", outputs=[("Value", "float")], location=(-180, 40), kind="input")
+math = Node("Math", inputs=[("A", "float", 0.5), ("B", "float", 0.5)],
+ outputs=[("Result", "float")], location=(20, 40), kind="converter")
+editor = NodeEditor([value, math], links=[(value, 0, math, 0)],
+ on_links=lambda links: print(links))
+area = Area("Geometry Node Editor", editor,
+ header=[MenuButton("View", ["Frame All"]), Spacer()], fill=True)
+App("Nodes", (480, 260), area, padding=0).run()
+```
+
+<Figure
+ src="images/components-nodes.png"
+ alt="A node editor area with a red Value node linked to a blue Math node that has A and B inputs, B showing 0.500"
+ caption="The node editor example, rendered by BUI."
+ width={480}
+ height={260}
+/>
+
+Editing works as in Blender: click selects (<Kbd>Shift</Kbd> toggles), drag moves the selection (<Kbd>Ctrl</Kbd> snaps), drag on empty space box-selects, drag from a socket to link, drag a linked input to pick its link up, and <Kbd>Ctrl</Kbd>+right-drag cuts links. Middle mouse pans, the wheel and <Kbd>Ctrl</Kbd>+middle mouse zoom, <Kbd>Ctrl</Kbd>+wheel and <Kbd>Shift</Kbd>+wheel pan, and <Kbd>Home</Kbd> frames everything.
+
+<Figure
+ shot="feature-node-editor"
+ alt="A Geometry Nodes editor: seven nodes that scatter instances on a surface, with typed, colored sockets, links and header menus"
+ caption="A larger node tree: <code>examples/site/geometry_nodes.py</code>."
+/>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Components guide" href="docs/python/components/" icon="book" kicker="Python">
+ The App, layout and menus, explained with examples.
+ </Card>
+ <Card title="Headless testing" href="docs/python/headless-testing/" icon="zap" kicker="Python">
+ Drive these components from tests.
+ </Card>
+ <Card title="Blender widgets" href="docs/concepts/blender-widgets/" icon="layers" kicker="Concepts">
+ Every drag, snap and shortcut, explained.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/python/components.mdx b/website/src/content/docs/python/components.mdx
new file mode 100644
index 0000000..b6a772d
--- /dev/null
+++ b/website/src/content/docs/python/components.mdx
@@ -0,0 +1,263 @@
+---
+title: Blender components
+description: Build Blender-style tools in Python from Blender's own widgets, layouts, menus and editors. Learn the App, the API every component shares, layout, and menus.
+section: Python
+order: 30
+languages: ["python"]
+sources: ["docs/components.md", "bindings/python/bui/components/__init__.py", "bindings/python/bui/components/app.py", "bindings/python/bui/components/core.py", "bindings/python/bui/components/containers.py", "bindings/python/bui/components/widgets.py", "bindings/python/bui/components/menus.py", "bindings/python/bui/filebrowser.py", "examples/components_demo.py"]
+---
+
+`blenderui.components` is Blender's interface as a Python library: the panels, number fields, sliders, menus and editors of Blender's properties editor and outliner, with Blender's rules for how they behave. If you're building a tool for people who know Blender, their hands will already know your UI.
+
+Each component **is** a node of BUI's C runtime, the **kit**. Python builds the tree and receives callbacks; layout, input and drawing all run in C. That's why an idle window costs nothing, and dragging a slider redraws only the slider.
+
+<Figure
+ shot="python-components"
+ alt="A Render Properties editor built from Blender components: menu bar, side tabs, panels and sub-panels with header checkboxes, number fields, sliders, dropdowns, an enum row, a color swatch, a progress bar and a status line"
+ caption="<code>examples/site/render_props.py</code>: Blender components, laid out like Blender's properties editor."
+/>
+
+## Hello, components
+
+```py title="hello_components.py"
+from blenderui.components import App, Panel, NumberSlider, Checkbox, Button
+
+def on_size(value):
+ print("size is now", value)
+
+App("Demo", (360, 260),
+ Panel("Object",
+ NumberSlider("Size", 1.0, min=0, max=10, on_change=on_size,
+ description="Object size"), # the tooltip
+ Checkbox("Smooth", True),
+ Button("Apply", on_click=lambda: print("apply"))),
+).run()
+```
+
+New to this? The [first-app tutorial](../../tutorials/first-app-python/) builds a window like this one line at a time.
+
+## The App
+
+`App` is the window and the root of your tree.
+
+```text
+App(title="BUI", size=(420, 640), *children, padding=None, spacing=None, header=None)
+```
+
+`children` go into a root `Column`. `padding` and `spacing` are in pixels; by default they're small margins scaled from Blender's widget unit. Pass a `MenuBar` as `header=` for a Blender top bar.
+
+| Member | What it does |
+| --- | --- |
+| `app.run(native=None)` | Opens the window and runs the event loop until it closes. `native=False` forces the Tk-hosted window. |
+| `app.open(native=None)` | Opens the window without running the loop; returns the window. |
+| `app.add(*components)` | Appends to the root column. |
+| `app.root` | The root `Column`. |
+| `app.bind("ctrl+s", fn)` | A window hotkey: `"q"`, `"shift+f3"`, `"ctrl+alt+z"` … |
+| `app.ctx` | The kit context: popups, focus, and undo with `app.ctx.undo()` / `app.ctx.redo()`. |
+| `app.render_raster(w, h)` | Draws a frame without a window, for tests and screenshots. |
+| `app.press`, `release`, `motion`, `key`, `wheel`, `context_menu` | Simulate input without a window. See [headless testing](../headless-testing/). |
+
+## What every component has
+
+These work on every component, as constructor keywords or properties:
+
+| Member | What it does |
+| --- | --- |
+| `description="..."` | The tooltip, shown after hovering for a moment |
+| `enabled`, `visible` | Grey out or hide the component |
+| `weight=` | Its share of the width in a `Row` (default 1; `0` keeps its natural width) |
+| `x`, `y`, `w`, `h`, `rect` | Where it ended up after layout |
+| `add(*children)`, `remove(child)`, `children` | Edit the tree (on containers) |
+
+**Value components** (`NumberField`, `NumberSlider`, `Checkbox`, `Toggle`, `TextField`, `Dropdown`, `EnumRow`, `ColorSwatch`, `VectorField` …) also have:
+
+| Member | What it does |
+| --- | --- |
+| `value` | The current value. Assigning it also calls `on_change`. |
+| `set_value(v, notify=True)` | Set the value; `notify=False` skips the callback. |
+| `reset()` | Back to the starting value (users can press <Kbd>Backspace</Kbd> over the widget). |
+| `on_change=fn` | Called as `fn(value)` whenever the user or your code changes it. |
+| `label` | The text shown with the value. |
+
+```py
+from blenderui.components import App, NumberField
+
+size = NumberField("Size", 1.0, on_change=lambda v: print("size", v))
+app = App("Values", (300, 100), size)
+
+size.value = 2.5 # prints "size 2.5"
+size.set_value(3.0, notify=False) # silent
+size.reset() # back to 1.0, prints "size 1.0"
+```
+
+Callbacks run once the component is part of an `App`; changes made to a component that isn't in a window yet are stored, but no one is told.
+
+<Figure
+ shot="feature-tooltip"
+ alt="A tooltip under the Denoise dropdown"
+ caption="A component's <code>description</code> becomes its tooltip."
+/>
+
+## Layout
+
+Components stack top to bottom by default. These containers arrange them:
+
+| Container | Use it for |
+| --- | --- |
+| `Column(*children, align=False, spacing=None, padding=0)` | A vertical stack. `align=True` joins the widgets into one block, like Blender's `column(align=True)`. |
+| `Row(*children, align=False, spacing=None, padding=0)` | Side by side. Each child's `weight` is its share of the width. |
+| `Split(left, right, factor=0.4)` | A label / value split: the left side gets `factor` of the width. Blender's property rows. |
+| `Grid(*children, columns=2)` | Equal-width columns, filled row by row. |
+| `Box(*children)` | A padded column on Blender's box background (`layout.box()`). |
+| `Panel(title, *children, ...)` | A collapsible panel. Put a panel in a panel for a sub-panel. |
+| `Tabs`, `SideTabs`, `ScrollView` | Pages with tabs, the properties editor's icon tabs, and a scrolling viewport. |
+| `VectorField(label, (x, y, z))` | Aligned X / Y / Z number fields under one label. |
+
+Here's how they combine into a typical Blender panel:
+
+```py title="layout_demo.py"
+from blenderui.components import (App, Panel, Row, Split, Label, NumberField,
+ NumberSlider, VectorField, Toggle, Checkbox,
+ Button, IconButton)
+
+def prop(label, widget):
+ """A Blender property row: right-aligned label, then the value."""
+ return Split(Label(label, align="right"), widget, factor=0.4)
+
+app = App("Layout", (360, 280),
+ Panel("Transform",
+ VectorField("Location", (0.0, 1.25, 0.0), suffix=" m"),
+ prop("Scale", NumberSlider("", 1.0, min=0, max=4)),
+ Row(Toggle("X"), Toggle("Y", True), Toggle("Z"), align=True),
+ icon="OBJECT_DATA"),
+ Panel("Motion Blur",
+ prop("Steps", NumberField("", 1, min=1, max=7)),
+ header=[Checkbox("", True)]),
+ Row(Button("Apply", icon="CHECKMARK"), IconButton("TRASH", weight=0)))
+
+if __name__ == "__main__":
+ app.run()
+```
+
+<Figure
+ src="images/components-layout.png"
+ alt="A Transform panel with Location X, Y and Z fields, a Scale slider and an aligned X Y Z toggle row with Y pressed; a Motion Blur panel with a checkbox in its header and a Steps field; an Apply button with a trash icon button beside it"
+ caption="<code>layout_demo.py</code>, rendered by BUI at its real size."
+ width={360}
+ height={280}
+/>
+
+A few things to notice:
+
+- `prop()` is a two-line helper, not part of BUI. The components demo uses the same pattern for every property row.
+- `Row(..., align=True)` joins the toggles into one segmented control.
+- `header=[Checkbox("", True)]` puts a checkbox in the panel's header, like Blender's Motion Blur panel.
+- `IconButton("TRASH", weight=0)` keeps its natural width while the Apply button takes the rest.
+- `VectorField` passes extra keywords, like `suffix`, to each of its number fields.
+
+### Panels behave like Blender's
+
+`Panel(title, *children, collapsed=False, icon=None, header=(), on_toggle=None)`:
+
+- Click the header to collapse or expand it, with Blender's animation. `on_toggle(collapsed)` tells you.
+- **Drag across several headers** to collapse or expand them all in one stroke.
+- <Kbd>Ctrl</Kbd>+click a header to **solo** it: that panel opens and the others close.
+- Drag the grip (the dots on the right) to **reorder** panels.
+- In code: `panel.collapsed = True`, or `panel.toggle()`.
+
+## Icons
+
+Many components take an `icon=` name, such as `"ADD"`, `"TRASH"`, `"OBJECT_DATA"` or `"MESH_DATA"`. The names are Blender's own icon names. To list every one available:
+
+```py
+import buipy
+print(buipy.kit_icon_names())
+```
+
+`Dropdown` and `EnumRow` take a matching list of icons for their items: `Dropdown("Mode", ["Object", "Edit"], icons=["OBJECT_DATAMODE", "EDITMODE_HLT"])`.
+
+## Menus and pie menus
+
+A menu is a list of items. An item is a `MenuItem`, a plain string, or `"-"` for a separator.
+
+```py title="menus.py"
+from blenderui.components import App, IconButton, Label, MenuBar, MenuItem, PieMenu
+
+def new_file(): print("new")
+def quit_app(): print("quit")
+def search(): print("search")
+
+menubar = MenuBar(
+ ("File", [MenuItem("New", new_file, icon="FILE", shortcut="Ctrl N"),
+ MenuItem("Open Recent", submenu=[MenuItem("a.blend"), MenuItem("b.blend")]),
+ "-", # separator
+ MenuItem("Auto Save", checked=True),
+ MenuItem("Quit", quit_app, shortcut="Ctrl Q")]),
+ right=[IconButton("SEARCH", search)])
+
+app = App("Tool", (480, 300), Label("Press Q for the pie menu."), header=menubar)
+app.bind("q", lambda: PieMenu.show(app.ctx, [MenuItem("Object Mode"),
+ MenuItem("Edit Mode")], "Mode"))
+app.run()
+```
+
+- **`MenuItem(text, on_click=None, *, icon=None, shortcut=None, checked=None, submenu=None, enabled=True, description="")`**. `checked=True` or `False` shows a checkbox; `submenu=[...]` opens another menu. `shortcut` is only the text shown on the right; bind the key itself with `app.bind`.
+- **`MenuBar(("File", items), ("Edit", items), right=[...])`** is Blender's top bar; `right` holds components at the right end.
+- **`MenuButton(text, items, *, icon=None)`** is a single pulldown button you can put anywhere.
+- **`Menu.show(app.ctx, owner, items, title=None, at=None, on_pick=None)`** opens a popup menu from code, next to the `owner` component or at `at=(x, y)`. Plain-string items call `on_pick(text)`.
+- **`PieMenu.show(app.ctx, items, title="")`** opens a pie menu around the pointer, with up to 8 items in Blender's order: W, E, S, N, NW, NE, SW, SE.
+
+Menus behave as in Blender. Press, drag to an item and release to pick it in one gesture. Hover switches between menu-bar menus and opens submenus. **Typing searches** every item in the menu. In a pie, flick toward an item and click, or press <Kbd>1</Kbd> to <Kbd>8</Kbd>.
+
+Every value also has a **right-click menu** for free, with Copy, Paste and Reset.
+
+<Figure
+ shot="feature-pie-menu"
+ alt="A Shading pie menu open over a node editor, with the pointer moving toward Rendered"
+ caption="<code>PieMenu</code>: the items sit in a ring and the one toward the pointer is highlighted. Release to pick it (<code>examples/site/geometry_nodes.py</code>)."
+/>
+
+## File dialogs
+
+`blenderui.filebrowser.ask` shows Blender's File Browser in its own window and waits for the answer:
+
+```py
+from blenderui import filebrowser
+
+path = filebrowser.ask("open", title="Open Image",
+ filetypes=[("Images", "*.png *.jpg"), ("All files", "*")])
+folder = filebrowser.ask("directory")
+paths = filebrowser.ask("open", multiple=True) # a list
+name = filebrowser.ask("save", defaultextension=".txt")
+```
+
+
+
+The kind is `"open"`, `"save"` or `"directory"`; cancelling returns `None`. `tkinter.filedialog` and `QFileDialog` use the same browser.
+
+## GPU rendering
+
+Call `blenderui.set_gpu(True)` before creating windows, or run with `BUI_GPU=1`, to draw on the GPU: Direct3D 11 on Windows, OpenGL 3.3 on Linux. The pixels are the same; the CPU does much less work.
+
+```py
+import blenderui
+blenderui.set_gpu(True)
+```
+
+## The interactions you get
+
+Every value component gets Blender's interaction rules without any code: drag to scrub with a hidden cursor, <Kbd>Shift</Kbd> for precision, <Kbd>Ctrl</Kbd> to snap, <Kbd>Alt</Kbd> to edit X, Y and Z together, typed math like `2*pi`, <Kbd keys="Ctrl+Wheel" /> to step, drag down over several fields to edit them at once, drag across checkboxes, and undo with <Kbd keys="Ctrl+Z" />. The [Blender widgets](../../concepts/blender-widgets/) page explains each one.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Components reference" href="docs/python/components-reference/" icon="book" kicker="Python">
+ Every component's signature, grouped, with small examples.
+ </Card>
+ <Card title="Headless testing" href="docs/python/headless-testing/" icon="zap" kicker="Python">
+ Click, drag and type in tests, without a window.
+ </Card>
+ <Card title="First app" href="docs/tutorials/first-app-python/" icon="sparkles" kicker="Tutorial">
+ Build a small tool step by step.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/python/headless-testing.mdx b/website/src/content/docs/python/headless-testing.mdx
new file mode 100644
index 0000000..4e65590
--- /dev/null
+++ b/website/src/content/docs/python/headless-testing.mdx
@@ -0,0 +1,172 @@
+---
+title: Testing without a window
+sidebarLabel: Headless testing
+description: Render Blender components into memory, drive them with simulated clicks, drags and keys, and check values, pixels and frame times in ordinary tests.
+section: Python
+order: 50
+languages: ["python"]
+sources: ["docs/components.md", "bindings/python/tests/test_components.py", "bindings/python/bui/components/app.py", "bindings/python/bui/components/core.py"]
+---
+
+A UI you can't test is a UI you're afraid to change. With BUI you can test yours like any other code: no window, no screen, no sleeping while a robot moves the mouse. You render into memory, press and drag with function calls, and assert on the results. It runs anywhere Python runs, including CI servers without a display.
+
+BUI's own test suite works this way: `bindings/python/tests/test_components.py` tests every component, and checks that frames stay inside a 120 Hz budget.
+
+## Render a frame
+
+`app.render_raster()` lays out and draws the whole window into a **raster**, an image in memory, without opening anything:
+
+```py
+from blenderui.components import App, NumberField
+
+size = NumberField("Size", 1.0)
+app = App("Test", (400, 300), size)
+
+raster = app.render_raster() # draws the window at its size, (400, 300)
+print(raster.size) # (400, 300)
+print(size.rect) # where the field ended up: (x, y, w, h)
+print(raster.pixel(10, 10)) # (r, g, b)
+```
+
+- `render_raster(w=None, h=None, full=False)` uses the app's size unless you give one.
+- After rendering, every component knows its place: `x`, `y`, `w`, `h` and `rect`.
+- The raster is kept between calls. Later calls **redraw only what changed**, exactly as in a window; pass `full=True` to redraw everything.
+
+## Simulate input
+
+The `App` has the same input methods a window uses. Coordinates are pixels in the window:
+
+| Method | Simulates |
+| --- | --- |
+| `app.press(x, y, mods=None)` | Pressing the left mouse button |
+| `app.motion(x, y, mods=None)` | Moving the pointer (hover, or drag while pressed) |
+| `app.release(x, y, mods=None)` | Releasing the button |
+| `app.key(char, keysym, keycode=0, mods=None)` | A key press: `char` is the typed text, `keysym` its name (`"a"`, `"Return"`, `"BackSpace"`, `"Tab"`) |
+| `app.wheel(x, y, delta, mods=None)` | The mouse wheel |
+| `app.context_menu(x, y, mods=None)` | A right-click |
+
+`mods` holds modifier keys as bits. Import them from `blenderui.components.core`: `SHIFT`, `CTRL`, `ALT`, and `BUTTON1` for "the left button is held". Combine them with `|`, for example `CTRL | SHIFT`. An object with `shift`, `ctrl`, `alt` and `button1` attributes works too.
+
+## A complete test file
+
+```py title="test_my_panel.py"
+from blenderui.components import App, Checkbox, NumberField, TextField
+from blenderui.components.core import CTRL
+
+def center(c):
+ x, y, w, h = c.rect
+ return x + w // 2, y + h // 2
+
+def test_dragging_scrubs_and_undo_restores():
+ size = NumberField("Size", 1.0)
+ app = App("test", (400, 300), size)
+ app.render_raster()
+ x, y = center(size)
+ app.press(x, y)
+ app.motion(x + 40, y) # drag to the right
+ app.release(x + 40, y)
+ assert size.value > 1.0
+ app.key("z", "z", mods=CTRL) # Ctrl+Z
+ assert size.value == 1.0
+
+def test_typing_a_name():
+ seen = []
+ name = TextField("Name", "Cube", on_change=seen.append)
+ app = App("test", (400, 300), name)
+ app.render_raster()
+ x, y = center(name)
+ app.press(x, y)
+ app.release(x, y) # click: start editing
+ app.render_raster()
+ app.key("a", "a", mods=CTRL) # select all
+ for ch in "Suzanne":
+ app.key(ch, ch)
+ app.key("", "Return")
+ assert name.value == "Suzanne"
+ assert seen == ["Suzanne"]
+
+def test_checkbox_click_changes_pixels():
+ box = Checkbox("Smooth", False)
+ app = App("test", (300, 100), box)
+ raster = app.render_raster()
+ x, y = box.x + 8, box.y + box.h // 2
+ before = raster.pixel(x, y)
+ app.press(x, y)
+ app.release(x, y)
+ raster = app.render_raster()
+ assert box.value is True
+ assert raster.pixel(x, y) != before
+```
+
+These are plain functions with `assert`, so pytest finds and runs them. Each test builds its own `App`, so they don't share state.
+
+<Callout type="tip" title="Turn off animations">
+Panels animate when they collapse. For tests that check sizes right after a click, switch animations off once at the top of the file: `import buipy; buipy.kit_set_animations(False)`. BUI's own tests do this.
+</Callout>
+
+## Check what was redrawn
+
+BUI only redraws the parts of the window that changed. Your tests can check that too, through the context's `render`, which returns **how many regions it redrew**:
+
+```py
+from blenderui.components import App, Column, NumberField, Button
+
+field = NumberField("N", 1.0)
+app = App("test", (400, 600), Column(field, *[Button("b%d" % i) for i in range(20)]))
+raster = app.render_raster()
+w, h = app.size
+
+assert app.ctx.render(w, h, raster) == 0 # idle: nothing to draw
+app.motion(field.x + 10, field.y + 5) # hover the field
+assert app.ctx.render(w, h, raster) >= 1 # something was redrawn
+print(raster.damage()) # the redrawn rectangles
+```
+
+`raster.damage()` lists the rectangles of the last frame. BUI's suite uses it to check that hovering a field redraws only that widget's tiles, never the whole window.
+
+## Frame budgets
+
+You can time frames the same way. BUI's own test renders the full components demo 50 times and requires:
+
+| Frame | Budget in `test_components.py` |
+| --- | ---: |
+| A full redraw of the components demo | under 8.3 ms (one frame at 120 Hz) |
+| A hover over a number field | under 1 ms |
+
+```py
+import time
+
+def test_frames_are_fast():
+ app = build_my_app() # your App
+ w, h = app.size
+ raster = app.render_raster()
+ t0 = time.perf_counter()
+ for _ in range(50):
+ app.ctx.render(w, h, raster, True) # full redraws
+ full_ms = (time.perf_counter() - t0) / 50 * 1000
+ assert full_ms < 8.3
+```
+
+Timing tests depend on the machine. Keep the budget generous enough for your slowest CI runner.
+
+## More from the context
+
+`app.ctx` is the kit context. A few of its methods are handy in tests:
+
+- `app.ctx.popup_count()`: how many menus or popups are open.
+- `app.ctx.undo()` and `app.ctx.redo()`: undo and redo without keys.
+- `app.ctx.set_host(schedule=..., cursor=..., warp=...)`: receive what a window would get, such as timer requests, cursor changes and pointer warps. The test suite uses it to check that the cursor hides and warps during a drag.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Components reference" href="docs/python/components-reference/" icon="book" kicker="Python">
+ Every component's members, for your assertions.
+ </Card>
+ <Card title="Damage rendering" href="docs/concepts/damage-rendering/" icon="zap" kicker="Concepts">
+ Why an idle window costs nothing, and how redraws stay small.
+ </Card>
+ <Card title="Blender components" href="docs/python/components/" icon="layers" kicker="Python">
+ The App, layout and menus your tests drive.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/python/qt-syntax.mdx b/website/src/content/docs/python/qt-syntax.mdx
new file mode 100644
index 0000000..2e19af2
--- /dev/null
+++ b/website/src/content/docs/python/qt-syntax.mdx
@@ -0,0 +1,192 @@
+---
+title: Qt syntax
+description: Write Qt-style Python (QApplication, QWidget, layouts, signals and QPainter) and BUI draws it in Blender's look, with no Qt installed. The common subset works today.
+section: Python
+order: 20
+status: preview
+languages: ["python"]
+badges: ["Partial"]
+sources: ["docs/qt.md", "SYNTAX_COVERAGE.md", "examples/qt_syntax_demo.py", "bindings/python/bui/qtsyntax.py", "bindings/python/bui/host.py", "docs/getting-started.md"]
+---
+
+If your hands already know Qt, `blenderui.qtsyntax` lets them keep typing: `QApplication`, `QWidget`, `QVBoxLayout`, `clicked.connect(...)`. BUI runs that code on its own C runtime and draws it with Blender's widgets. **Neither Qt nor PySide is needed.**
+
+<Callout type="warning" title="Status: partial">
+The everyday subset on this page works and is tested. But counted against Qt's own widget headers, about **220 of 920** public method names on 25 core widget classes exist (roughly a quarter). Anything that isn't there raises `AttributeError`, so nothing fails silently. See [what's missing](#whats-missing).
+</Callout>
+
+<Figure
+ shot="python-qt"
+ alt="A Qt-syntax material editor on BUI: a QListWidget, a QLineEdit, a QGroupBox with a QFormLayout, a QComboBox, a QSlider with a QDoubleSpinBox, a QCheckBox and a QProgressBar"
+ caption="<code>examples/site/qt_material.py</code>, drawn by BUI."
+/>
+
+## A first example
+
+```py title="hello_qt.py"
+import sys
+from blenderui.qtsyntax import (QApplication, QWidget, QVBoxLayout, QSlider,
+ QProgressBar, QPushButton, Qt)
+
+app = QApplication(sys.argv)
+window = QWidget()
+window.setWindowTitle("Hello, Qt syntax")
+
+layout = QVBoxLayout(window)
+slider = QSlider(Qt.Horizontal)
+slider.setRange(0, 100)
+bar = QProgressBar()
+slider.valueChanged.connect(bar.setValue) # signals connect to any callable
+quit_button = QPushButton("Quit")
+quit_button.clicked.connect(app.quit)
+layout.addWidget(slider)
+layout.addWidget(bar)
+layout.addWidget(quit_button)
+
+window.resize(320, 140)
+window.show()
+sys.exit(app.exec())
+```
+
+The only line that differs from PySide is the import. For a step-by-step build of a fuller form, follow the [Qt tutorial](../../tutorials/first-app-qt/).
+
+## How it maps
+
+There's no Qt underneath. Each piece of Qt maps onto something in BUI:
+
+| Qt | On BUI |
+| --- | --- |
+| `QWidget` | A node in BUI's C runtime (the **kit**). A subclass that overrides `paintEvent` becomes a kit canvas, and `QPainter` records into its display list. |
+| `QVBoxLayout`, `QHBoxLayout` | Tk's packer, ported to C, with Qt's rules: stretch factors, expanding size policies, spacing between items only, margins on top-level layouts only |
+| `QGridLayout`, `QFormLayout` | Tk's gridder, ported to C (`setColumnStretch` maps to column weights) |
+| Signals | Plain Python objects (`Signal`, also spelled `pyqtSignal`) |
+| `QApplication.exec()` | BUI's event loop: a native window (Win32, X11, Cocoa), or a Tk-hosted one with `BUI_HOST=tk` |
+| `QTimer`, `QPropertyAnimation` | Window timers; animations step at 120 Hz with easing curves |
+
+## Supported classes
+
+| Area | Classes |
+| --- | --- |
+| Application | `QApplication` (`exec`, `quit`, `processEvents`), `QTimer` (`singleShot`, `start`, `stop`, `timeout`), `QPropertyAnimation`, `QEasingCurve` |
+| Windows | `QWidget`, `QMainWindow` (`setCentralWidget`, `menuBar`, `statusBar`), `QDialog` (`exec`, `accept`, `reject`), `QFrame` |
+| Layouts | `QVBoxLayout`, `QHBoxLayout` (`addWidget(stretch)`, `addLayout`, `addStretch`, `addSpacing`, `insertWidget`, `setSpacing`, `setContentsMargins`), `QGridLayout` (spans, alignment, stretch), `QFormLayout.addRow`, `QStackedLayout` |
+| Widgets | `QLabel` (text, alignment, pixmap), `QPushButton`, `QToolButton`, `QCheckBox`, `QRadioButton` with `QButtonGroup` (auto-exclusive), `QLineEdit` (`textChanged`, `returnPressed`, `editingFinished`), `QTextEdit`, `QPlainTextEdit`, `QSlider`, `QDial`, `QSpinBox`, `QDoubleSpinBox`, `QProgressBar` (format), `QComboBox` (items, data, `currentIndexChanged`) |
+| Views | `QListWidget` and `QListWidgetItem`, `QTreeWidget` and `QTreeWidgetItem` (columns, expand), `QTableWidget` and `QTableWidgetItem` |
+| Containers | `QTabWidget`, `QGroupBox` (a Blender panel), `QScrollArea`, `QStatusBar` |
+| Menus | `QMenuBar`, `QMenu` (`addAction(text, slot, shortcut)`, submenus, separators, `popup`), `QAction` (checkable, shortcuts) |
+| Painting | `QPainter`, `QPen`, `QBrush`, `QColor`, `QFont`, `QPixmap`, `QImage` |
+| Events | Override `mousePressEvent`, `mouseReleaseEvent`, `mouseMoveEvent`, `mouseDoubleClickEvent`, `keyPressEvent`, `wheelEvent`, `enterEvent`, `leaveEvent`, `closeEvent` and `paintEvent` |
+| Values | `Qt` constants (alignment, keys, orientation, check states), `QPoint`, `QSize`, `QRect`, `QMargins`, `QSizePolicy`, `QIcon` |
+| Dialogs | `QFileDialog` (`getOpenFileName`, `getOpenFileNames`, `getSaveFileName`, `getExistingDirectory`) shows Blender's File Browser; `BUI_FILEDIALOG=native` uses the operating system's dialogs. `QMessageBox` is a stub, see below |
+
+The member-by-member list is in [`SYNTAX_COVERAGE.md`](https://github.com/ppmpreetham/BUI/blob/main/SYNTAX_COVERAGE.md#qt-syntax-buiqtsyntax).
+
+## Signals
+
+Signals work as in Qt: declare them on a class, `connect` any callable, `emit` to call them.
+
+```py
+from blenderui.qtsyntax import QWidget, Signal
+
+class Thermostat(QWidget):
+ changed = Signal(float) # pyqtSignal and Signal_ are the same thing
+
+t = Thermostat()
+t.changed.connect(lambda v: print("now", v))
+t.changed.connect(print)
+t.changed.emit(21.5)
+```
+
+- **Slots can take fewer arguments** than the signal sends: `QPushButton.clicked` sends a `bool`, but a slot with no parameters is called with none.
+- `disconnect(slot)` removes one slot; `disconnect()` removes them all.
+- Programmatic changes go through the kit, so in our testing a `setValue` made **before the window opens** doesn't emit `valueChanged`. Set dependent widgets yourself at startup, or make the change after `show()`.
+
+## Layouts
+
+Layouts behave like Qt's, including the parts people rely on without thinking:
+
+- `addWidget(widget, stretch)` and `addStretch()` share spare space by stretch factor.
+- Spacing goes **between** items only, and margins apply to top-level layouts only.
+- Line edits, sliders, combo boxes and progress bars expand **horizontally**; text edits, lists, trees, tabs and custom-painted widgets expand **vertically**.
+- `QGridLayout.addWidget(w, row, column, rowspan, colspan, alignment)` and `setRowStretch` / `setColumnStretch` work.
+
+## Custom painting
+
+Override `paintEvent` and draw with `QPainter`. On BUI, your drawing is recorded into a display list that BUI redraws for you; call `update()` when your data changes.
+
+```py title="gauge.py"
+import sys
+from blenderui.qtsyntax import (QApplication, QWidget, QVBoxLayout, QLabel,
+ QPainter, QColor, QPen)
+
+class Gauge(QWidget):
+ def __init__(self):
+ super().__init__()
+ self.value = 0.6
+
+ def paintEvent(self, event):
+ p = QPainter(self)
+ p.setBrush(QColor("#282828"))
+ p.drawRoundedRect(0, 0, self.width(), 24, 6, 6)
+ p.setBrush(QColor("#4772b3"))
+ p.drawRoundedRect(0, 0, int(self.width() * self.value), 24, 6, 6)
+ p.setPen(QPen(QColor("white")))
+ p.drawText(8, 17, "%d%%" % (self.value * 100))
+ p.end()
+
+ def mousePressEvent(self, e):
+ self.value = e.x() / max(1, self.width())
+ self.update() # repaint
+
+app = QApplication(sys.argv)
+window = QWidget()
+window.setWindowTitle("Gauge")
+layout = QVBoxLayout(window)
+layout.addWidget(QLabel("Click the gauge:"))
+layout.addWidget(Gauge())
+window.resize(300, 120)
+window.show()
+sys.exit(app.exec())
+```
+
+<Figure
+ src="images/qt-gauge.png"
+ alt="A window with the label Click the gauge and a rounded blue bar filled to 60 percent"
+ caption="<code>gauge.py</code>: a custom widget painted with <code>QPainter</code>. Click anywhere on it to set the value."
+ width={300}
+ height={120}
+/>
+
+`QPainter` supports `fillRect`, `drawRect`, `drawRoundedRect`, `drawEllipse`, `drawLine`, `drawPolyline`, `drawPolygon`, `drawPoint`, `drawArc`, `drawPie`, `drawText` and `drawPixmap`, plus `setPen`, `setBrush`, `setFont`, `setOpacity`, `translate`, `save` and `restore`.
+
+## Style sheets
+
+`setStyleSheet` understands three things: `color`, `background` (or `background-color`) on containers, and `font-weight: bold`. Everything else is Blender's theme. Qt style sheet selectors, pseudo-states and `QPalette` aren't supported.
+
+## What's missing
+
+Being upfront, so you don't find out the hard way:
+
+- **Model/view:** `QAbstractItemModel`, `QListView`, `QTreeView`, `QTableView` and delegates. Use the `*Widget` classes instead.
+- **Classes:** `QSplitter`, `QDockWidget`, `QToolBar`, `QStackedWidget` (as a real class), `QToolBox`, `QDateEdit` and friends, `QCalendarWidget`, `QGraphicsScene`, OpenGL widgets.
+- **Most of `QWidget`'s surface:** focus-policy details, `setWindowFlags`, geometry helpers, `grab`.
+- **Infrastructure:** `QSettings`, `QThread`, `QClipboard`, drag and drop, `QShortcut`, rich text.
+- **Drawn dialogs:** `QMessageBox` and `QInputDialog` aren't drawn yet. `QMessageBox.information`, `warning`, `critical` and `about` return `Ok` at once, and `question` returns `Yes` at once, without showing anything.
+
+<ComingSoon feature="Running PySide6 programs unchanged">
+The plan is to reach parity with the tkinter layer: measure against PySide6 itself, run the same programs on real Qt and on BUI to compare them, fill in the classes above, and then add an `install()` so `import PySide6` programs run unchanged, as tkinter programs already do.
+</ComingSoon>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Qt tutorial" href="docs/tutorials/first-app-qt/" icon="sparkles" kicker="Tutorial">
+ Build an export dialog, one step at a time.
+ </Card>
+ <Card title="tkinter on BUI" href="docs/python/tkinter/" icon="book" kicker="Python">
+ The complete layer, if you can choose: every tkinter name is there.
+ </Card>
+ <Card title="Roadmap" href="docs/project/roadmap/" icon="flag" kicker="Project">
+ Where Qt syntax is heading, and how to help.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/python/tkinter.mdx b/website/src/content/docs/python/tkinter.mdx
new file mode 100644
index 0000000..e40fbd3
--- /dev/null
+++ b/website/src/content/docs/python/tkinter.mdx
@@ -0,0 +1,183 @@
+---
+title: tkinter on BUI
+sidebarLabel: tkinter
+description: BUI implements the whole tkinter API. Run existing programs unchanged, or write new ones, and get Blender's look and interactions.
+section: Python
+order: 10
+languages: ["python"]
+sources: ["docs/tkinter.md", "SYNTAX_COVERAGE.md", "README.md", "pyproject.toml", "bindings/python/bui/tksyntax/__init__.py", "bindings/python/bui/tksyntax/__main__.py", "bindings/python/bui/tksyntax/filedialog.py", "bindings/python/bui/filebrowser.py", "bindings/python/tests/test_tk_compat.py", "docs/getting-started.md"]
+---
+
+tkinter is Python's built-in UI toolkit, and there's a lot of tkinter code in the world. BUI runs it. **Every public name in `tkinter` and `tkinter.ttk` exists on BUI**, 7,846 of 7,846 measured against the standard library, and nine real tkinter programs are tested to behave identically on both.
+
+Your code stays tkinter. What changes is what people see and feel: Blender's widgets, Blender's theme, and Blender's interactions on its fields.
+
+<Figure
+ src="images/tkinter_items.png"
+ alt="A plain tkinter Inventory program on BUI: menu bar, tabs, a New item panel with text, dropdown, number and slider fields, and a table"
+ caption="<code>examples/tk_unchanged_app.py</code>: plain tkinter, no BUI imports, run with <code>blenderui-tk</code>."
+ width={386}
+ height={408}
+/>
+
+## Three ways in
+
+| You want to | Do this |
+| --- | --- |
+| Run an existing program, unchanged | `blenderui-tk my_app.py [args...]` (the same as `python -m bui.tksyntax my_app.py`) |
+| Switch from inside a program | Call `blenderui.tksyntax.install()` before the first `import tkinter` |
+| Write new code for BUI | `import blenderui.tksyntax as tk` and `from blenderui.tksyntax import ttk, messagebox` |
+
+**Running unchanged.** `blenderui-tk` is installed with `pip install blenderui`. It points `tkinter` and its submodules at BUI, adds the script's folder to `sys.path`, and runs the script as `__main__`. Arguments after the script's name reach it in `sys.argv`.
+
+**Switching inside.** `install()` makes `import tkinter` return BUI's tkinter for the rest of the process. It covers the submodules too: `ttk`, `messagebox`, `filedialog`, `simpledialog`, `colorchooser`, `commondialog`, `dialog`, `font`, `scrolledtext` and `constants`.
+
+```py
+import blenderui.tksyntax
+blenderui.tksyntax.install() # before the first `import tkinter`
+
+import tkinter as tk
+from tkinter import ttk
+```
+
+**Importing by name** is the clearest choice for new code, and it unlocks BUI-only options such as `tk.Tk(gpu=True)`.
+
+The [tkinter tutorial](../../tutorials/tkinter-app/) walks through all three with a real program.
+
+## Module map
+
+| tkinter | On BUI | Notes |
+| --- | --- | --- |
+| `tkinter` | `blenderui.tksyntax` | `Tk`, `Toplevel`, every classic widget, the variables, `Event`, `PhotoImage`, `BitmapImage`, `mainloop`, constants |
+| `tkinter.ttk` | `.ttk` | Themed widgets, including `Treeview`, `Notebook`, `Progressbar`, `Combobox`, `Separator`, `Sizegrip`, `LabeledScale`, `Panedwindow` and `Style`; `state()` and `instate()` work |
+| `tkinter.messagebox` | `.messagebox` | Blender-styled modal dialogs, with tkinter's return values (`"ok"`, `True`, `None` …) |
+| `tkinter.simpledialog` | `.simpledialog` | `Dialog` (override `body`, `validate`, `apply`), `SimpleDialog`, `askstring`, `askinteger`, `askfloat` |
+| `tkinter.filedialog` | `.filedialog` | Blender's File Browser in its own window, with tkinter's options and return values. `BUI_FILEDIALOG=native` uses the operating system's dialogs instead |
+| `tkinter.colorchooser` | `.colorchooser` | `askcolor` with Blender's color picker; returns `((r, g, b), "#rrggbb")` |
+| `tkinter.font` | `.font` | `Font`, named fonts (`TkDefaultFont` …), `measure` and `metrics` through BUI's text engine |
+| `tkinter.scrolledtext` | `.scrolledtext` | `ScrolledText`, as in tkinter |
+| `tkinter.dialog`, `.commondialog`, `.constants` | the same names | |
+
+<Figure
+ src="images/tkinter_messagebox.png"
+ alt="A Blender-styled dialog asking Save changes to the inventory before closing, with Yes and No buttons"
+ caption="<code>messagebox.askyesno</code> on BUI."
+ width={330}
+ height={102}
+/>
+
+## What you get
+
+Everything below is tkinter behaviour, implemented on BUI's C runtime.
+
+- **Geometry managers.** `pack`, `grid` and `place` with every option: `in_`, `before` and `after`, `ipadx`, `sticky`, spans, `columnconfigure` weights and `minsize`, `grid_remove`, the `*_info` and `*_slaves` methods, `grid_bbox`, `grid_location`, `grid_size` and `pack_propagate(False)`. The packer and gridder are C ports of Tk's own algorithms.
+- **Scrolling.** `xview`, `yview`, `*_moveto`, `*_scroll` and `xscrollcommand` / `yscrollcommand` work on `Listbox`, `Text`, `Treeview` and `Canvas`. `Canvas` adds `scrollregion`, `confine`, scroll increments and `scan_*`. The classic scrollable frame (a `Canvas` with `create_window` and a `<Configure>` binding) works too.
+- **Bindings.** `bind`, `bind_all`, `bind_class`, `bindtags`, `unbind*`, `event_add` and `event_generate`, with modifiers, `Double-`, buttons 1 to 3, `<B1-Motion>`, `<KeyPress>` and `<KeyRelease>`, `<MouseWheel>` (Button-4 and Button-5 on X11), `<Enter>`, `<Leave>`, `<Configure>`, `<Map>`, `<Destroy>`, `<FocusIn>`, `<FocusOut>` and virtual events. Callbacks run once per bindtag and stop on `"break"`.
+- **Widgets.** `Entry` with `show="*"` and `validatecommand` (all the `%P %s %S %d %i %V %W` codes). `Listbox` with every `selectmode`, including Ctrl and Shift clicks. `Treeview` with sortable headings, `show="headings"` tables, `<<TreeviewOpen>>` and `<<TreeviewClose>>`, and `move`, `detach`, `reattach`. Also `Notebook`, `PanedWindow` with draggable sashes, `OptionMenu`, `Menubutton` and `Message`.
+- **Canvas.** All item types, including `window`, smoothed lines and arrowheads; tag expressions such as `"a&&!b"`; `find_*` and `addtag_*`; `tag_bind` with `current` and per-item `<Enter>` / `<Leave>`; shape-accurate hit tests; `move`, `moveto`, `scale` and `coords`; and editing text items in place.
+- **Text.** The full index grammar (`3.5`, `end-1c`, `insert lineend`, `@x,y`, `tag.first`, `+N lines`, `wordstart` …), tags with colors, priorities and `tag_bind`, marks with gravity, `search` (regexp, backwards, `count`), `dump`, `count`, the undo stack, `<<Modified>>` and peers.
+- **Windows.** `geometry`, `attributes` (`-topmost`, `-alpha`, `-fullscreen`, `-disabled`), `resizable`, `minsize` and `maxsize`, `overrideredirect`, `state`, `iconify`, `withdraw`, `transient`, `protocol("WM_DELETE_WINDOW")`, `grab_set`, the clipboard, `after`, `after_idle`, `after_info`, `wait_window`, `wait_variable` and every `winfo_*`.
+- **Images.** `PhotoImage` reads PNG, PPM and PGM in pure Python, and GIF through Tk. It supports `put`, `get`, `copy`, `zoom`, `subsample`, `copy_replace`, `data` and `write` (PNG, PPM). `BitmapImage` reads XBM.
+
+## The Blender look
+
+The look always comes from Blender's theme. Some widgets turn into their Blender twin:
+
+| tkinter | On BUI |
+| --- | --- |
+| `tk.Scale`, `ttk.Scale` | A Blender slider |
+| `Spinbox` | A Blender number field |
+| `ttk.Combobox`, `OptionMenu` | A Blender enum dropdown |
+| `LabelFrame` | A Blender panel |
+| `Checkbutton(indicatoron=0)` | A Blender toggle button |
+| `Menu` as the window's menu | A Blender menu bar |
+| `Scrollbar` | A Blender scroller |
+
+**Options that apply:** `bg` on `Frame`, `Canvas` and windows; `fg` on text; `font` (size and bold, for example `font=("Arial", 18, "bold")`); `cursor` (`"hand2"`, `"xterm"`, `"fleur"` …); `width` and `height` in characters or pixels, as in Tk; `image`; and `state`.
+
+**Options that are accepted but don't change the drawing:** the ones that only style Tk itself, such as `relief`, `borderwidth`, `highlightthickness`, `activebackground`, `selectcolor` and `ttk.Style` settings. `cget` returns what you set, so code that reads them keeps working.
+
+On top of that, the widgets get Blender's interactions. `Spinbox` and `Scale` become Blender number fields and sliders: drag them sideways to change the value, or click and type a number or a sum such as `2*pi`. `Entry` stays a text field and keeps what you type as text. Everywhere, <Kbd keys="Ctrl+Z" /> and <Kbd keys="Ctrl+Shift+Z" /> undo and redo edits, and <Kbd>Tab</Kbd> moves to the next field. The [Blender widgets](../../concepts/blender-widgets/) page covers them all.
+
+<Figure
+ shot="python-tkinter"
+ alt="An unchanged tkinter glTF export dialog on BUI: Entry, Button, LabelFrame, Checkbutton, Radiobutton, Spinbox, OptionMenu, Scale and Listbox drawn as Blender widgets"
+ caption="Classic Tk widgets, unchanged (<code>examples/site/tk_export.py</code>): the <code>Spinbox</code> is a number field and the <code>Scale</code> a slider."
+/>
+
+<Figure
+ shot="python-ttk"
+ alt="An unchanged ttk render-farm queue on BUI: Combobox, Spinbox, Notebook, Treeview, Progressbar and Checkbutton"
+ caption="ttk widgets, unchanged (<code>examples/site/ttk_queue.py</code>)."
+/>
+
+### GPU rendering
+
+```py
+import blenderui.tksyntax as tk
+
+root = tk.Tk(gpu=True) # Direct3D 11 on Windows, OpenGL 3.3 on Linux
+```
+
+For apps you run unchanged, set `BUI_GPU=1`, or call `blenderui.set_gpu(True)` before the first `Tk()`. The pixels are the same as on the CPU, but busy `Canvas` scenes cost far less CPU. The first frames draw on the CPU while the GPU starts, and without a usable GPU the window stays on the CPU renderer.
+
+## Behaviour notes
+
+BUI follows Tk's semantics, and its tests check them against the standard library. Some are easy to miss, on any tkinter:
+
+- `textvariable` overrides `text`, and `cget("text")` returns the variable's value.
+- A `Scale`'s `command` and `<<TreeviewSelect>>` run when the loop is idle, not inside `set()` or `selection_set()`.
+- `validatecommand` also sees programmatic `insert` and `delete`.
+- Generated key events (`event_generate("<Control-q>")`) go to the widget with keyboard focus.
+- Menus keep Tk's tear-off entry at index 0 unless you pass `tearoff=0`.
+- `Text` keeps the trailing newline: `get("1.0", "end")` ends with `"\n"`, so use `"end-1c"`.
+- `edit_undo()` does nothing while `undo` is off.
+- A `Notebook` asks for the size of its largest page.
+- A `Toplevel` appears when the loop is next idle, sized to its content.
+- `Checkbutton` and `Radiobutton` create a variable if you don't give one, as Tk does.
+
+## Limitations
+
+There are a few things BUI can't do, because nothing in it corresponds:
+
+- **No Tcl interpreter.** `root.tk.call(...)` handles a few common commands (`tk scaling`, `wm …`, `set`, `info patchlevel`) and raises `TclError` for the rest.
+- **`send`** raises `TclError`, as it does on Windows Tk.
+- **Images and windows embedded in a `Text`** (`image_create`, `window_create`) are kept and listed, but not drawn.
+- **Canvas `dash`, `stipple` and `postscript` output** are accepted but not rendered.
+
+## Test your app against tkinter
+
+If something behaves differently from standard tkinter, that's a bug, and there's a tool to prove it. `bindings/python/tests/test_tk_compat.py` runs small programs on both the standard library and BUI, and compares what they observe. A program is a function that takes the `tk` and `ttk` modules and returns a result:
+
+```py
+def prog_mine(tk, ttk):
+ root = tk.Tk()
+ lb = tk.Listbox(root)
+ lb.insert("end", "a", "b")
+ lb.selection_set(1)
+ result = {"sel": lb.curselection()}
+ root.destroy()
+ return result
+```
+
+Add your function to the `PROGRAMS` list in that file, then run it:
+
+```sh
+python bindings/python/tests/test_tk_compat.py
+```
+
+If the two results differ, you've found something worth [an issue](https://github.com/ppmpreetham/BUI/issues), and you already have the test case.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Run a tkinter app" href="docs/tutorials/tkinter-app/" icon="sparkles" kicker="Tutorial">
+ A real program, run unchanged, step by step.
+ </Card>
+ <Card title="Qt syntax" href="docs/python/qt-syntax/" icon="layers" kicker="Python">
+ The same engine with `QWidget`, layouts and signals.
+ </Card>
+ <Card title="Blender components" href="docs/python/components/" icon="book" kicker="Python">
+ Go beyond tkinter: pie menus, node editors and Blender's panels.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/css-and-tailwind.mdx b/website/src/content/docs/rust/css-and-tailwind.mdx
new file mode 100644
index 0000000..0832d29
--- /dev/null
+++ b/website/src/content/docs/rust/css-and-tailwind.mdx
@@ -0,0 +1,269 @@
+---
+title: CSS and Tailwind
+description: Style Rust UIs with typed methods, compile-checked CSS, stylesheets or Tailwind v4 classes, all flowing through one browser-style cascade.
+section: Rust
+order: 40
+languages: ["rust"]
+sources: ["docs/rust.md", "bindings/rust/blenderui/src/style.rs", "bindings/rust/blenderui/src/styled.rs", "bindings/rust/blenderui/src/color.rs", "bindings/rust/blenderui/src/lib.rs", "bindings/rust/blenderui-macros/src/lib.rs", "bindings/rust/blenderui-macros/src/rsx.rs", "bindings/rust/blenderui-tailwind/src/lib.rs", "bindings/rust/blenderui/tests/modern_css.rs", "bindings/rust/blenderui/tests/rsx.rs", "bindings/rust/blenderui/tests/parity.rs", "CHANGELOG.md"]
+---
+
+Whatever way you like to style, it works here. Chain typed methods, write a CSS block, drop in a `<style>` sheet, or reach for Tailwind classes. **They all feed one cascade, the same way a browser's does**, so you can mix them without surprises. And when you make a typo, the compiler usually catches it before you run anything.
+
+## Four ways to style, one cascade
+
+```rust
+// 1. gpui / Tailwind-style 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. a CSS block, checked at compile time (a misspelled property doesn't compile)
+div().style(css!("border-left: 3px solid #4772b3; padding: 4px 8px"))
+
+// 3. CSS built at run time
+div().css("grid-template-columns", format!("repeat({n}, 1fr)"))
+ .style(format!("width: {w}px"))
+
+// 4. stylesheets, anywhere in the tree
+style().child(".card:hover > h4 { color: #e6a23c } @media (max-width: 600px) { nav { display: none } }")
+```
+
+And the fifth, Tailwind classes: `div().class("p-4 md:flex hover:bg-sky-500/50")`. Each one is covered below.
+
+## Style methods
+
+The `Styled` trait has about 1,300 methods, generated from Tailwind's scales. If you know Tailwind, you know their names: replace `-` with `_`.
+
+- **Spacing and sizing** on the spacing scale: `p_4`, `mx_auto`, `w_64`, `h_full`, `w_1_3`, `gap_x_2`, or any length: `size(px(20.0))`, `w(px(40.0))`.
+- **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 and cursors:** `overflow_y_scroll`, `cursor_pointer`.
+
+Lengths come from `px(10.0)`, `rems(1.5)` or `relative(0.5)` (a fraction of the parent).
+
+**Colors** come from `rgb(0xRRGGBB)`, `rgba(0xRRGGBBAA)`, `hsla(h, s, l, a)`, the named helpers (`black()`, `white()`, `red()`, `green()`, `blue()`, `yellow()`, `transparent_black()`, `transparent_white()`), or any CSS color string.
+
+**State styles:** `.hover(|s| ...)`, `.active(|s| ...)` and `.focus(|s| ...)` take a refinement with the same methods. They're CSS `:hover`, `:active` and `:focus` rules for that one element.
+
+```rust
+div().px_3().py_1().bg(rgb(0x545454))
+ .hover(|s| s.bg(rgb(0x4772b3)))
+ .active(|s| s.opacity(0.8))
+```
+
+## CSS blocks
+
+- **`css!("...")`** splits the block into declarations when your program compiles. Every property name is resolved then, so `css!("colr: red")` is a compile error, and each value is tokenized once for the whole program. Custom properties (`--brand: …`) and `!important` work.
+- **`.style("a: b; c: d")`** takes CSS text at run time: a `&str`, a `String`, or `css!` output.
+- **`.css("property", value)`** sets one property, with the value built at run time.
+
+## Stylesheets
+
+`style().child("...")` puts a stylesheet anywhere in the tree, just like a `<style>` tag. Its rules apply to the whole window.
+
+```rust title="A stylesheet from the showcase example"
+const CSS: &str = r#"
+nav a { display: block; padding: 4px 14px; color: #c8c8c8; text-decoration: none; }
+nav a:hover { background: #4772b3; color: white; }
+.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
+.card.accent { background: linear-gradient(135deg, #4772b3, #7a4fb3); color: white; }
+tbody tr:nth-child(odd) { background: #353535; }
+"#;
+
+html().child(head().child(style().child(CSS))).child(body() /* … */)
+```
+
+### Selectors
+
+Selectors Level 4, the same ones you'd use on the web:
+
+- **Basics:** type, `*`, `#id`, `.class`, and attributes: `[a]`, `=`, `~=`, `|=`, `^=`, `$=`, `*=`, with the case-insensitive `i` flag.
+- **Combinators:** descendant, `>`, `+`, `~`.
+- **State:** `:hover`, `:active`, `:focus`, `:focus-within`, `:focus-visible`, `:checked`, `:disabled`, `:enabled`, `:link`, `:any-link`, `:required`, `:optional`, `:read-only`, `:read-write`, `:open`, `:placeholder-shown`.
+- **Structure:** `:first-child`, `:last-child`, `:only-child`, `:first-of-type`, `:last-of-type`, `:nth-child()`, `:nth-last-child()`, `:nth-of-type()`, `:nth-last-of-type()`, `:nth-child(2 of .on)`, `:empty`, `:root`.
+- **Logic:** `:not()`, `:is()`, `:where()` (no specificity) and `:has()`, including `:has(> img)`.
+- **Nesting:** `.card { & > h4 { … } .dark & { … } }`.
+- **Generated content:** `::before` and `::after` with `content`, including `attr()`, `counter()` and `counters()`.
+
+### At-rules
+
+- **`@media`** with Media Queries 4 ranges, evaluated against the window: `@media (400px <= width <= 600px)`.
+- **`@supports`**, **`@layer`** (later layers win; unlayered rules beat layered ones) and **`@scope (.panel) to (.stop)`**.
+- **`@container`** size queries, with `container-type` and `container-name`.
+- **`@font-face`** with local font files, and **`@property`** initial values.
+- **`@keyframes`**: see [Effects and animations](../effects-and-animations/).
+
+## The cascade
+
+Declarations are applied in this order, later winning:
+
+1. the built-in **user-agent sheet** (the browser defaults, or Blender's inside `styled`),
+2. your **stylesheets**,
+3. **inline** declarations: methods, `.css(...)`, `.style(...)`,
+4. **state refinements**: `.hover(...)`, `.active(...)`, `.focus(...)`.
+
+`!important` beats all of them. Within a level, specificity and then source order decide, as in a browser. `inherit`, `initial`, `unset` and `revert` are understood.
+
+<Callout type="note" title="Boxes are border-box">
+The default `box-sizing` is `border-box`, like Tailwind's preflight, not CSS's `content-box`. A `width: 100px` box with padding stays 100 pixels wide. Set `box-sizing: content-box` where you need the CSS default.
+</Callout>
+
+## Values, units and colors
+
+- **Units:** `px`, `em`, `rem`, `%`, `vw`, `vh`, `vmin`, `vmax`, `ch`, `ex`, `pt`, `pc`, `in`, `cm`, `mm`, `Q`, and the rest of CSS's length units.
+- **Math:** every CSS math function with mixed units: `calc`, `min`, `max`, `clamp`, `round`, `mod`, `rem`, `abs`, trigonometry, `pow`, `hypot` …
+- **Variables:** custom properties (`--gap: 10px`) with `var()`, fallbacks (`var(--missing, 20px)`) and inheritance, plus `env()`.
+- **Sizing keywords:** `fit-content` and `stretch`.
+- **Colors:** CSS Color 4 and 5: `oklch()`, `lab()`, `color()`, `color-mix()`, relative colors and `light-dark()`.
+
+```rust
+div().style("width: calc(100% - 2 * var(--gap)); background: color-mix(in oklch, var(--brand) 60%, white)")
+```
+
+## Tailwind CSS v4
+
+Class names work as Tailwind v4 utilities out of the box. There's no build step and no config file: each class compiles to CSS the first time it's used, like Tailwind's JIT engine, with the v4 default theme, and utilities sort the way Tailwind sorts them.
+
+```rust
+div().class("grid grid-cols-3 gap-4 md:grid-cols-6 hover:bg-sky-500/50")
+```
+
+What the engine understands:
+
+- **Utilities** with the v4 theme, including `animate-spin`, `animate-ping`, `animate-pulse`, `animate-bounce` and the `transition-*` and `ease-*` utilities.
+- **Arbitrary values:** `w-[calc(100%-2rem)]`, `h-[37px]`, `bg-[#4772b3]`.
+- **CSS variable shorthand:** `bg-(--brand)`.
+- **Negatives, opacity modifiers and important:** `-mt-2`, `bg-sky-500/50`, `text-sm/6`, `p-4!`.
+- **Variants:** states (`hover:`, `focus-visible:` …), pseudo-elements, `group-*` and `peer-*`, `has-*`, `data-*` (`data-[state=open]:`), `aria-*`, `nth-*`, breakpoints (`md:`, `2xl:`, `max-sm:`), container queries (`@md:`), `dark:`, `motion-*`, `supports-*`, `*:` and arbitrary variants like `[&>*]:`.
+
+If your own class names collide with Tailwind's, turn it off: `blenderui::set_tailwind(false)`.
+
+### Checked at compile time with tw!
+
+`.class("...")` accepts anything, so a typo silently does nothing. Wrap the string in `tw!` and the compiler checks every class:
+
+```rust
+div().class(tw!("grid grid-cols-3 gap-4 md:grid-cols-6 hover:bg-sky-500/50"))
+```
+
+### Tailwind attributes in rsx!
+
+In `rsx!`, utilities can be bare attributes (UnoCSS calls this "attributify"). They become classes at compile time, and they're checked like `tw!`:
+
+```rust
+rsx! { <div p-4 w-1/2 bg-[#4772b3] hover:bg-sky-500/50 md:flex -mt-2 text-sm/6 /> }
+```
+
+HTML boolean attributes (`disabled`, `checked`, `hidden`, `open` …) stay attributes.
+
+Every Tailwind variant also works as an **attribute prefix**, chained as deep as you like:
+
+```rust
+rsx! {
+ <button class="px-3 py-1 bg-zinc-800"
+ hover:class="bg-sky-600 text-white" // classes, prefixed
+ active:style="transform: scale(0.97)" // any CSS, as arbitrary properties
+ focus-visible:outline="2px solid white" // one CSS property
+ md:dark:hover:class="bg-sky-400" // chained variants
+ hover:bg={rgb(0x4772b3)}> // typed value via .hover(|s| ..)
+ "Save"
+ </button>
+}
+```
+
+`group-hover:`, `peer-checked:`, `data-[state=open]:`, `aria-expanded:`, `@md:`, `2xl:`, `max-sm:`, `*:` and every other variant work the same way, because they all go through the Tailwind engine. **Typed `{expr}` values work only under `hover`, `active` and `focus`**; with any other variant, use `variant:class` or `variant:style`.
+
+### "Did you mean?" errors
+
+Anything that looks like a utility but isn't one is a compile error with suggestions, in `rsx!` and in `tw!` alike:
+
+```text
+error: rsx!: `bg-sky-50O` is not a Tailwind utility; did you mean `bg-sky-500` or `bg-sky-50` or `bg-sky-100`?
+error: rsx!: `hovr:bg-red-500` is not a Tailwind utility; did you mean `hover:bg-red-500` or `odd:bg-red-500`?
+error: tw!: `roundd-lg` is not a Tailwind utility; did you mean `rounded-lg` or `rounded-s-lg` or `rounded-e-lg`?
+```
+
+The suggestions come from `blenderui_tailwind::suggest`, so misspelled variants, roots and values are all caught.
+
+## Coverage
+
+These numbers come from the repository's coverage test (`cargo test --test parity -- --nocapture`):
+
+| Area | Coverage |
+| --- | --- |
+| CSS properties | **271** change layout or rendering; **137** more parse but have no effect |
+| W3C property index (745 properties) | **261** rendered (35%), **129** parsed without effect (17%), **355** not recognized (48%) |
+| CSS 2.1, screen properties | **90 / 90** rendered, 90 / 90 parsed |
+| Flexbox | **12 / 12** |
+| Grid | **23 / 23**, including `grid-template-areas` and named lines |
+| Tailwind CSS v4 | Classes compile on first use (v4 theme, variants, arbitrary values); `tw!` checks them at compile time |
+
+The first row counts every name the engine knows, including aliases such as `-webkit-mask`; the second measures against the W3C's [list of all CSS properties](https://www.w3.org/Style/CSS/all-properties.en.html). Most of the 355 unrecognized properties are drafts, speech, paged media and SVG:
+
+| Group | Properties |
+| --- | ---: |
+| Draft border and corner shapes (`corner-shape`, `border-*-clip` …) | ~78 |
+| SVG fill, stroke and markers | ~40 |
+| Gap decorations (`row-rule-*` …) | 38 |
+| Speech and aural | 31 |
+| Animation triggers and scroll-driven animation | 26 |
+| Paged media, regions, rhythm and others | ~25 |
+| Everything else | ~100 |
+
+The everyday screen CSS is much further along: Flexbox 12/12, Grid 23/23 and CSS 2.1 90/90.
+
+### What renders
+
+Every property in this list changes layout or drawing (`style.rs`'s handler table):
+
+- **Box model:** `display`, `box-sizing`, `width`, `height`, `min-*` / `max-*`, the logical sizes (`inline-size`, `block-size` …), `aspect-ratio`, `margin` and `padding` with every side and logical longhand, `float`, `clear`, `contain`.
+- **Positioning:** `position`, `inset` and `top` / `right` / `bottom` / `left`, the logical `inset-*`, `z-index`.
+- **Flexbox, grid and alignment:** every property of both modules, `gap` / `row-gap` / `column-gap` (and the old `grid-gap` names), `place-*`, `justify-*`, `align-*`, `order`.
+- **Overflow and scrolling:** `overflow`, `overflow-x` / `-y` / `-inline` / `-block`, `scrollbar-width`, `text-overflow`, `scroll-snap-type`, `scroll-snap-align`.
+- **Backgrounds:** `background` and its longhands, including `background-image` (gradients and PNG `url()`), `-size`, `-position`, `-repeat`, `-clip`, `-origin` and `-attachment`; `object-fit`, `object-position`.
+- **Borders and outlines:** every `border-*` longhand (physical and logical), `border-radius` and its corners, `border-image` and its longhands, `outline` and `outline-offset`.
+- **Effects:** `opacity`, `visibility`, `box-shadow`, `transform`, `translate`, `rotate`, `scale`, `transform-origin`, `filter`, `backdrop-filter`, `mix-blend-mode`, `isolation`, `clip-path`, `clip`, `mask` and `mask-image` / `-mode` / `-size` / `-position` / `-repeat`.
+- **Text:** `color`, `font` and its longhands, `font-variant-caps`, `line-height`, `text-align`, `text-decoration` and its longhands, `text-underline-offset`, `text-shadow`, `text-transform`, `text-indent`, `letter-spacing`, `word-spacing`, `vertical-align`, `white-space`, `text-wrap`, `text-wrap-mode`, `white-space-collapse`, `word-break`, `overflow-wrap`, `tab-size`, `direction`, `unicode-bidi`.
+- **Lists, tables and generated content:** `list-style` and its longhands, `table-layout`, `border-collapse`, `border-spacing`, `caption-side`, `empty-cells`, `content`, `quotes`, `counter-reset`, `counter-set`, `counter-increment`.
+- **Containers:** `container`, `container-type`, `container-name`.
+- **Interaction:** `cursor`, `pointer-events`, `accent-color`.
+- **Motion:** `animation` and every `animation-*` longhand, `transition` and every `transition-*` longhand.
+
+### What parses, but has no effect yet
+
+These 137 are accepted and ignored for now, so stylesheets written for browsers still load:
+
+- **Fonts:** OpenType features and synthesis: `font-feature-settings`, `font-variant-numeric`, `font-variant-ligatures` and the other `font-variant-*`, `font-kerning`, `font-stretch`, `font-variation-settings`, `font-synthesis*` …
+- **Multi-column:** `columns`, `column-count`, `column-width`, `column-rule*`, `column-span`, `column-fill`.
+- **Writing modes:** `writing-mode`, `text-orientation`, `text-combine-upright`.
+- **3D:** `perspective`, `perspective-origin`, `backface-visibility`, `transform-style`, `transform-box`.
+- **Scrolling details:** every `scroll-margin-*` and `scroll-padding-*`, `scroll-snap-stop`, `scroll-behavior`, `overscroll-behavior*`, `scrollbar-color`, `scrollbar-gutter`.
+- **Paged media:** `orphans`, `widows`, `break-*`, `page-break-*`.
+- **Text details:** `hyphens`, `text-justify`, `line-break`, `line-clamp`, `text-emphasis*`, `text-align-last` …
+- **Hints and the rest:** `will-change`, `user-select`, `resize`, `appearance`, `caret-color`, `touch-action`, `image-rendering`, `shape-outside`, `zoom`, `background-blend-mode`, `mask-clip`, `mask-composite`, `mask-border*` …
+
+### Not done yet
+
+<ComingSoon feature="3D transforms, OpenType features and multi-column layout">
+These are the largest gaps among common properties. `perspective`, `rotateX` / `rotateY` and `matrix3d` have no effect. OpenType features need text shaping, which BUI's text engine doesn't have (and neither does Blender's). `columns`, `writing-mode`, `scroll-padding` and `scroll-margin` parse but aren't applied yet.
+</ComingSoon>
+
+Also on the list: `filter: url(#svg)`, `clip-path: path()`, and the rest of the W3C index. The [effects page](../effects-and-animations/#not-done-yet) has the animation-specific gaps.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Layout" href="docs/rust/layout/" icon="layers" kicker="Rust">
+ Block, inline, flexbox, grid, tables and scrolling.
+ </Card>
+ <Card title="Effects and animations" href="docs/rust/effects-and-animations/" icon="sparkles" kicker="Rust">
+ Filters, masks, blend modes, keyframes and transitions.
+ </Card>
+ <Card title="The three looks" href="docs/rust/styled-and-blender-components/" icon="monitor" kicker="Rust">
+ How the built-in stylesheets change inside styled subtrees.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/effects-and-animations.mdx b/website/src/content/docs/rust/effects-and-animations.mdx
new file mode 100644
index 0000000..7fc3110
--- /dev/null
+++ b/website/src/content/docs/rust/effects-and-animations.mdx
@@ -0,0 +1,195 @@
+---
+title: Effects and animations
+description: Filters, blur behind glass, blend modes, clip paths, masks, transforms, border images, keyframe animations and transitions, with W3C formulas and zero idle cost.
+section: Rust
+order: 60
+languages: ["rust"]
+sources: ["docs/rust.md", "bindings/rust/blenderui/src/effects.rs", "bindings/rust/blenderui/src/anim.rs", "bindings/rust/blenderui/src/window.rs", "bindings/rust/blenderui/tests/effects.rs", "bindings/rust/blenderui/tests/animation.rs", "bindings/rust/blenderui/tests/basic_css.rs", "bindings/rust/blenderui-tailwind/src/lib.rs"]
+---
+
+A frosted panel, a button that grows when you hover it, a spinner that never stops: **standard CSS effects, animations and transitions work on BUI's Rust side.** The math follows the W3C specs, and a page that isn't moving costs no CPU at all.
+
+## Effects at a glance
+
+<Figure
+ shot="feature-html-effects"
+ alt="CSS effects on a gradient landscape: grayscale, sepia, hue-rotate, blur and drop-shadow filters; circle, polygon and star clip-paths; rotate, skew and scale transforms; multiply, screen and difference blend modes; and a backdrop-filter panel"
+ caption="Filters, <code>clip-path</code>, 2D transforms, <code>mix-blend-mode</code> and <code>backdrop-filter</code>, drawn by BUI (<code>examples/site_effects.rs</code>)."
+/>
+
+```css
+.glass { backdrop-filter: blur(8px) brightness(1.2) }
+.dim { filter: grayscale(1) opacity(0.6) }
+.ink { mix-blend-mode: multiply }
+.avatar { clip-path: circle(40%) }
+.fade { mask-image: linear-gradient(to right, #000, transparent) }
+.tilted { transform: rotate(-3deg) scale(1.05) }
+.framed { border: 10px solid; border-image: linear-gradient(#4772b3, #7a4fb3) 10 }
+```
+
+Put any of these in a `style()` sheet, a `.style(...)` call, or the matching Tailwind classes, and they work as written.
+
+## Filters
+
+`filter` and `backdrop-filter` take a list of these functions:
+
+| Function | Effect |
+| --- | --- |
+| `blur(px)` | A Gaussian blur (three box-blur passes, the approximation browsers use) |
+| `brightness()`, `contrast()`, `saturate()` | Light, contrast and color intensity |
+| `grayscale()`, `sepia()`, `invert()` | Recoloring |
+| `hue-rotate(deg)` | Rotate every hue |
+| `opacity()` | Fade |
+| `drop-shadow(x y blur color)` | A shadow that follows the shape's pixels |
+
+`filter` changes the element itself. `backdrop-filter` (and `-webkit-backdrop-filter`) changes what's *behind* it: that's the frosted-glass look.
+
+## Blend modes
+
+`mix-blend-mode` supports all 16 modes, `normal`, `multiply`, `screen`, `overlay`, `darken`, `lighten`, `color-dodge`, `color-burn`, `hard-light`, `soft-light`, `difference`, `exclusion`, `hue`, `saturation`, `color` and `luminosity`, plus `plus-lighter`. `isolation` works too.
+
+An element blends with whatever was painted before it; blending across stacking contexts is <ComingSoon inline />.
+
+## Clip paths and masks
+
+- **`clip-path`:** `inset()`, `circle()`, `ellipse()`, `polygon()`, and reference boxes. `path()` is <ComingSoon inline />.
+- **`mask` / `mask-image`:** gradients and PNGs, as alpha or luminance, with `mask-size`, `mask-position` and `mask-repeat`.
+- **`clip: rect(...)`** works on absolutely positioned boxes, as in CSS 2.1.
+
+## Transforms
+
+Every 2D transform draws: `translate`, `scale`, `rotate`, `skew`, `matrix`, with `transform-origin`, and the individual `rotate`, `scale` and `translate` properties.
+
+```css
+#bar { transform: rotate(90deg) } /* about its center, by default */
+#badge { scale: 2 }
+#card { transform: skewX(12deg) }
+```
+
+<Callout type="warning" title="Clicks use the untransformed box">
+2D transforms change how an element looks, not where it's clicked: hit testing still uses the box before the transform. 3D transforms (`perspective`, `rotateX`, `rotateY`, `matrix3d`) have no effect yet.
+</Callout>
+
+## Borders, outlines and decorations
+
+These render too, beyond solid lines:
+
+- **Every `border-style` and `outline-style`:** `dashed`, `dotted`, `double`, `groove`, `ridge`, `inset`, `outset`. They follow rounded corners, using Blender's corner tessellation.
+- **`border-image`:** gradients and PNGs, with `slice`, `width`, `outset`, `stretch` / `repeat` / `round` / `space`, and `fill`. It draws the nine slices.
+- **Text decoration:** `text-decoration-style` (including `wavy`), `text-decoration-thickness` and `text-underline-offset`.
+- **Backgrounds:** `background-clip` and `background-origin` (`border-box`, `padding-box`, `content-box`), `background-attachment: fixed`, and `background-image: url()` (PNG) with `background-size`, `background-position` (and `-x` / `-y`) and `background-repeat`.
+- **Generated content:** counters (`counter-reset`, `counter-increment`, `counter-set`, with `counter()` and `counters()` in `content`), `empty-cells`, `list-style-image`.
+
+## How effects are drawn
+
+The element's subtree is drawn offscreen with the canvas' own drawing code, then filtered, clipped, masked and resampled (bilinear, like Blender's image transform), then composited back with the W3C formulas. This works the same on the CPU and GPU renderers.
+
+The result is cached by content, so **a page that doesn't change costs nothing**, however many effects it has.
+
+<Hatch />
+
+## Animations
+
+`@keyframes` animations run like a browser's:
+
+```rust title="src/main.rs"
+use blenderui::prelude::*;
+
+const CSS: &str = "
+@keyframes pulse { 50% { opacity: 0.4; transform: scale(0.95) } }
+.saving { animation: pulse 1.2s ease-in-out infinite }
+";
+
+struct Saving;
+
+impl Render for Saving {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ body().styled().child(style().child(CSS))
+ .child(div().class("saving").p_4().child("Saving…"))
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Saving)).unwrap();
+ });
+}
+```
+
+What's supported:
+
+- **Keyframes:** percentage lists, `from` / `to`, `@keyframes` inside `@media`, and a per-keyframe `animation-timing-function`. When a name is defined twice, the last matching block wins.
+- **Every `animation-*` longhand and the `animation` shorthand:** lists of animations, negative delays, `infinite`, every direction, fill mode and play state.
+- **Each element keeps its own clock.** Two elements with the same rule, added at different times, animate independently.
+- **Tailwind's** `animate-spin`, `animate-ping`, `animate-pulse` and `animate-bounce` come with their keyframes.
+
+<Figure
+ shot="feature-animation"
+ alt="Three moments of four CSS animations side by side, at 0.25, 0.6 and 1.0 seconds: a spinner, a progress sweep, a bouncing ball and a fading toast"
+ caption="<code>@keyframes</code> at 0.25 s, 0.6 s and 1.0 s, captured with the headless virtual clock (<code>examples/site_animation.rs</code>)."
+/>
+
+## Transitions
+
+`transition` and its longhands animate a property when its value changes, for example on `:hover`:
+
+```css
+#tile { width: 100px; background: rgb(255, 0, 0);
+ transition: width 1s linear, background-color 1s linear }
+#tile:hover { width: 200px; background: rgb(0, 0, 255) }
+```
+
+- **`all` or a list of properties**, and `transition-behavior: allow-discrete`.
+- **Interrupted transitions start from the current value.** Leave a hover halfway, and the box shrinks back from where it is.
+- **A transition sent back to where it came from takes only as long as it ran.** Half a second out means half a second back.
+
+## Easing
+
+`linear`, `ease`, `ease-in`, `ease-out`, `ease-in-out`, `cubic-bezier()`, `steps()` with every jump position (`jump-start`, `jump-end`, `jump-none`, `jump-both`), `step-start`, `step-end`, and `linear()` with points.
+
+## What animates smoothly
+
+These interpolate:
+
+- lengths, percentages and numbers,
+- colors (in premultiplied sRGB, as browsers do),
+- `box-shadow` and `text-shadow`,
+- `transform` (function by function), `rotate`, `scale`,
+- `filter` and `backdrop-filter` (function by function),
+- `visibility` and `z-index`.
+
+Every other property flips at the halfway point.
+
+## Zero cost when still
+
+A window renders frames **only while something moves**. Finished or paused animations cost no CPU, and transitions alone don't wake anything until a value actually changes. You can check from code: `window.is_animating()` is `true` while CSS animations or transitions run.
+
+Headless windows run on a **virtual clock** that moves only when you call `cx.advance_clock(duration)`, so tests can step animations exactly. [Headless testing](../headless-testing/#test-animations-with-a-virtual-clock) shows how.
+
+For animations driven by your own code instead of CSS, call `window.request_animation_frame()` from `render`: the window renders again on the next display refresh. See [Events](../events/#the-window-api).
+
+## Not done yet
+
+<ComingSoon feature="The rest of CSS effects and animation">
+
+- **Animation events:** no `animationend` or `transitionend` yet.
+- **Pseudo-elements:** no animations on `::before` / `::after`.
+- **Late transitions:** an element starts a transition only if it already had a `transition` in the previous frame. A `transition` that appears only under `:hover` doesn't run on the first hover; put it on the base rule instead.
+- **Mixed units:** lengths that resolve differently (`50%` to `100px`, or `auto`) flip at 50% instead of going through `calc()`.
+- **Effects:** `filter: url(#svg)`, `clip-path: path()`, `mix-blend-mode` across stacking contexts, and 3D transforms.
+
+</ComingSoon>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Headless testing" href="docs/rust/headless-testing/" icon="check" kicker="Rust">
+ Step animations frame by frame in a test.
+ </Card>
+ <Card title="CSS and Tailwind" href="docs/rust/css-and-tailwind/" icon="layers" kicker="Rust">
+ The cascade these effects plug into.
+ </Card>
+ <Card title="Events" href="docs/rust/events/" icon="zap" kicker="Rust">
+ Hover, clicks and request_animation_frame.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/events.mdx b/website/src/content/docs/rust/events.mdx
new file mode 100644
index 0000000..04abd68
--- /dev/null
+++ b/website/src/content/docs/rust/events.mdx
@@ -0,0 +1,169 @@
+---
+title: Events
+description: Respond to clicks, keys, the wheel and form changes, update your view with cx.listener, and paint your own content on a canvas.
+section: Rust
+order: 70
+languages: ["rust"]
+sources: ["docs/rust.md", "bindings/rust/blenderui/src/events.rs", "bindings/rust/blenderui/src/element.rs", "bindings/rust/blenderui/src/window.rs", "bindings/rust/blenderui/src/paint.rs", "bindings/rust/blenderui-macros/src/rsx.rs", "bindings/rust/blenderui/tests/headless.rs", "bindings/rust/blenderui/examples/showcase.rs"]
+---
+
+A UI that doesn't answer back is just a picture. **Events are how your code hears the user**: a click, a key, a dragged slider. Attach a listener to any element, change your state, and BUI redraws what changed.
+
+## Your first listener
+
+```rust title="src/main.rs"
+use blenderui::prelude::*;
+
+struct Counter { count: i32 }
+
+impl Render for Counter {
+ fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
+ div().styled().p_4().flex().gap_2()
+ .child(p().child(format!("Count: {}", self.count)))
+ .child(button().child("Add one").on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
+ this.count += 1;
+ cx.notify();
+ })))
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Counter { count: 0 })).unwrap();
+ });
+}
+```
+
+- **`cx.listener(...)`** turns a method-like closure into a listener. You get `this` (your view, mutable), the event, the `Window` and the `Context`.
+- **`cx.notify()`** asks for a re-render. Without it, your state changes but the window doesn't know.
+
+If you use [hooks](../hooks/) instead, you don't need either: writing a signal re-renders for you.
+
+## Every listener
+
+| Listener | Event | Bubbles |
+| --- | --- | --- |
+| `on_click` | `ClickEvent { down, up }`: a press and release on the element | Yes |
+| `on_mouse_down(button, f)`, `on_any_mouse_down(f)` | `MouseDownEvent { button, position, modifiers, click_count }` | Yes |
+| `on_mouse_up(button, f)` | `MouseUpEvent { button, position, modifiers }` | Yes |
+| `on_mouse_move` | `MouseMoveEvent { position, pressed_button, modifiers }` | Yes |
+| `on_hover` | `bool`: `true` when the pointer enters, `false` when it leaves | No |
+| `on_scroll_wheel` | `ScrollWheelEvent { position, delta, modifiers }` | Yes |
+| `on_key_down`, `on_key_up` | `KeyDownEvent` / `KeyUpEvent { keystroke }` | Yes, from the focused element |
+| `on_change`, `on_input` | `ChangeEvent { value, checked, number }` | Yes |
+
+The details:
+
+- **Positions** are in logical pixels (they don't change with display scaling).
+- **`MouseButton`** is `Left`, `Right` or `Middle`.
+- **`Modifiers`** has `shift`, `control` and `alt`.
+- **`ClickEvent::click_count()`** tells a double-click from a single one.
+- **`ScrollWheelEvent::delta`** is in lines; positive scrolls the content up (the wheel turned away from you).
+- **`Keystroke`** has `key` (the key's name: `"a"`, `"Return"`, `"Left"` …), `key_char` (the typed text, if any) and `modifiers`.
+- **`ChangeEvent`** carries `value` (the text), `checked` (checkboxes and radios) and `number` (numbers, ranges, and a select's index). `on_input` and `on_change` both fire when the value changes. [The three looks](../styled-and-blender-components/#form-controls) lists what each control sends.
+
+## Listeners in rsx!
+
+In `rsx!`, `onClick={...}` becomes `.on_click(...)`, and the same for every `on*` name: `onMouseMove`, `onKeyDown`, `onChange` … You can leave out the parameters you don't use; the macro adds `_` for the rest.
+
+```rust
+rsx! {
+ <button onClick={|| println!("saved")}>"Save"</button>
+ <input onInput={|e: &ChangeEvent| println!("typing: {}", e.value)} />
+ <div onClick={cx.listener(|this, _: &ClickEvent, _, cx| { this.open = !this.open; cx.notify(); })} />
+}
+```
+
+## Focus and bubbling
+
+- **Clicking an element focuses it.** Key events go to the focused element, then bubble up through its ancestors.
+- **Most events bubble**: a click on a `<span>` inside a `<button>` reaches the button's `on_click` too. `on_hover` doesn't bubble.
+- **`cx.stop_propagation()`** stops an event from reaching ancestors.
+- **Focus from code:** `window.focus_id("name")` focuses the element with that `.id(...)`, and `window.focused_id()` tells you which one has focus.
+
+```rust
+div().id("canvas-area")
+ .on_key_down(|e: &KeyDownEvent, _, _| {
+ if e.keystroke.key == "Delete" { println!("delete selection"); }
+ })
+```
+
+## The Window API
+
+Every listener (and `render`) gets the `Window`. What it can do:
+
+| Method | What it does |
+| --- | --- |
+| `viewport_size()`, `bounds()` | The content size, in logical pixels |
+| `scale_factor()` | Device pixels per logical pixel |
+| `mouse_position()` | The pointer, in logical pixels |
+| `set_window_title(title)` | Change the title (a `<title>` element does it too) |
+| `focus_id(id)`, `focused_id()` | Move or read keyboard focus |
+| `is_hovered(id)` | Is the element with that `.id` under the pointer? |
+| `scroll_offset(id)`, `set_scroll_offset(id, x, y)` | Read or set a scroll container's position |
+| `refresh()` | Render again |
+| `request_animation_frame()` | Render again on the next display refresh |
+| `set_vsync(false)` | Let animation frames run as fast as the CPU allows (for benchmarks) |
+| `is_gpu()` | Whether this window is drawing on the GPU right now |
+| `is_animating()`, `needs_render()` | Whether CSS animations are running, or a render is pending |
+
+### Animating from code
+
+Call `window.request_animation_frame()` from `render` and the window renders again on the next display refresh. Frames are paced to the display; `set_vsync(false)` lifts the cap.
+
+```rust
+struct Spinner { angle: f32 }
+
+impl Render for Spinner {
+ fn render(&mut self, window: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ self.angle = (self.angle + 3.0) % 360.0;
+ window.request_animation_frame();
+ div().size(px(40.0)).bg(rgb(0x4772b3)).style(format!("rotate: {}deg", self.angle))
+ }
+}
+```
+
+For most motion, a CSS animation or transition is simpler and stops costing CPU when it's done: see [Effects and animations](../effects-and-animations/).
+
+## Painting your own content
+
+`canvas(|bounds, painter| ...)` is an element that paints itself 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` method | Draws |
+| --- | --- |
+| `fill(bounds, color)` | A filled rectangle |
+| `quad(bounds, radius, fill, outline, width)` | A rounded rectangle with a border |
+| `oval(bounds, fill, outline, width)` | An ellipse |
+| `line(points, color, width)` | A polyline |
+| `polygon(points, color)` | A filled polygon |
+| `arc(bounds, start, extent, color)` | A pie slice |
+| `text(x, y, text, size, color)` | A line of text |
+| `image(bounds, image)` | An `Arc<Image>`, scaled to fit |
+| `with_clip(bounds, f)` | Run `f` with drawing clipped to `bounds` |
+
+A canvas is a normal element: size it, style it, give it listeners. For pictures from files, `img().src("file.png")` is simpler; see [Images](../html-elements/#images).
+
+## Next steps
+
+<CardGrid>
+ <Card title="Headless testing" href="docs/rust/headless-testing/" icon="check" kicker="Rust">
+ Simulate clicks, keys and scrolling in a test.
+ </Card>
+ <Card title="Hooks and signals" href="docs/rust/hooks/" icon="zap" kicker="Rust">
+ State without cx.listener or cx.notify.
+ </Card>
+ <Card title="gpui syntax" href="docs/rust/gpui-syntax/" icon="layers" kicker="Rust">
+ Entities, contexts and the app model.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/gpui-syntax.mdx b/website/src/content/docs/rust/gpui-syntax.mdx
new file mode 100644
index 0000000..7cb5c82
--- /dev/null
+++ b/website/src/content/docs/rust/gpui-syntax.mdx
@@ -0,0 +1,225 @@
+---
+title: gpui syntax and the app model
+sidebarLabel: gpui syntax
+description: blenderui follows gpui's app model, Application, Render, entities, cx.listener and div().flex(), so gpui-style code compiles against it. Here's the map, the differences and the numbers.
+section: Rust
+order: 90
+languages: ["rust"]
+sources: ["docs/rust.md", "README.md", "bindings/rust/blenderui/src/window.rs", "bindings/rust/blenderui/src/element.rs", "bindings/rust/bench/common/settings.rs", "bindings/rust/bench/bui-bench/src/bin/bui-settings.rs", "bindings/rust/bench/README.md"]
+---
+
+**gpui builders are one of BUI's two first-class ways to write a Rust UI**, next to `rsx!` markup. Views implement `Render`, elements are built with method chains like `div().flex().gap_2().child(...)`, state lives in the view's fields, and listeners come from `cx.listener(...)`. Every BUI feature is reachable this way; `rsx!` itself compiles down to these same calls.
+
+The syntax and app model follow [gpui](https://www.gpui.rs), the Rust UI crate behind the Zed editor, closely enough that the same source file compiles against blenderui, gpui and gpui-fast. You don't need to know gpui to use it: this page explains the whole model. On top of it you get every HTML element, real CSS and Blender's form widgets.
+
+## A gpui-style app
+
+```rust title="src/main.rs"
+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().styled().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();
+ }))))
+ }
+}
+
+fn main() {
+ Application::new().run(|cx: &mut App| {
+ cx.open_window(WindowOptions::default(), |_, cx| {
+ cx.new(|_| Todo { items: Vec::new(), draft: String::new() })
+ }).unwrap();
+ });
+}
+```
+
+<Figure
+ shot="rust-builder-dashboard"
+ alt="A render-farm dashboard built with gpui-style builders: stat cards in a grid, job rows with progress bars, a node list, a dropdown, a button and a checkbox"
+ caption="A bigger app in the same builder syntax: <code>examples/site_dashboard_builder.rs</code>."
+/>
+
+`cx.notify()` re-renders. Rendering builds a fresh element tree each time; elements with an `.id(...)` keep their state across renders, which is why the `draft` field keeps its text while you type.
+
+## gpui to blenderui
+
+| gpui | blenderui |
+| --- | --- |
+| `Application::new().run(...)` | The same; `Application::headless()` renders off-screen |
+| `cx.open_window(options, build)` returning a window handle | 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` | `Copy` handles into the app's entity slots: `read` (returns `&T`), `update`, `downgrade`; `cx.release(e)` drops a value |
+| `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` and `gpu` |
+| `cx.set_global`, `cx.global` | The same, plus `try_global` and `global_mut` |
+| `cx.stop_propagation()` | The same |
+| `div().flex().gap_2()`, `.when(..)`, `.when_some(..)`, `.map(..)` | The same, from the `Styled` and `FluentBuilder` traits |
+| `canvas(..)` | `canvas(paint)`, with a `Painter` ([Events](../events/#painting-your-own-content)) |
+| `window.request_animation_frame()` | The same, paced to the display |
+
+## Entities
+
+An **entity** is a value owned by the app, which you reach through a handle. Views are entities.
+
+- **`cx.new(|cx| value)`** creates one and returns an `Entity<T>`.
+- **`entity.read(cx)`** returns `&T`; **`entity.update(cx, |value, cx| ...)`** changes it, with a `Context<T>`.
+- **`entity.downgrade()`** gives a `WeakEntity<T>`. Its `update` returns `None` once the value is gone, and `upgrade_in(cx)` turns it back into an `Entity` if it's still alive.
+- **`cx.release(entity)`** drops the value. Weak handles then skip it; strong handles panic if used.
+- Handles are `Copy`. They're indices into an app-owned slot map, so there's no `Rc` or reference counting.
+
+Inside a view, `cx.entity()` and `cx.weak_entity()` give you your own handle, and `cx.listener(...)` wraps a closure so it updates your view when it runs.
+
+## Windows
+
+```rust
+let opts = WindowOptions {
+ window_bounds: Some(WindowBounds::Windowed(Bounds {
+ origin: point(px(100.0), px(100.0)),
+ size: size(px(360.0), px(260.0)),
+ })),
+ titlebar: Some(TitlebarOptions { title: Some("Settings".into()) }),
+ is_resizable: Some(true),
+ window_min_size: Some(size(px(200.0), px(150.0))),
+ gpu: Some(true),
+};
+let win = cx.open_window(opts, |_, cx| cx.new(|_| MyView)).unwrap();
+```
+
+- **`WindowBounds`** is `Windowed`, `Maximized` or `Fullscreen`. Without bounds, a window opens at 1024 × 700; without a title, it's called "BUI".
+- **`gpu: Some(true)`** draws this window on the GPU; `None` follows `Application::gpu` and `BUI_GPU`.
+- **`WindowHandle<V>`** has `root()` (the view's entity) and `update(cx, |view, window, cx| ...)`.
+- **On `App`:** `close_window(id)`, `on_window_closed(|id, cx| ...)`, `notify_all()`, `quit()`. `activate(..)` exists for compatibility and does nothing, because windows come to the front when shown.
+
+The event loop runs until every window is closed.
+
+## Globals
+
+`cx.set_global(value)` stores one value per type; read it with `cx.global::<T>()` (panics if unset), `cx.try_global::<T>()` or `cx.global_mut::<T>()`.
+
+## Talking to the UI thread
+
+BUI runs your UI on one thread. To hand it work from another thread, such as a file loader or a network call, take a `UiSender`:
+
+```rust title="src/main.rs"
+use blenderui::prelude::*;
+
+struct Status { text: String }
+
+impl Render for Status {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ div().styled().p_4().child(self.text.clone())
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ let win = cx.open_window(WindowOptions::default(), |_, cx| {
+ cx.new(|_| Status { text: "Loading…".into() })
+ }).unwrap();
+ let view = win.root(); // an Entity: a Copy handle you can send
+ let ui = cx.ui_sender();
+ std::thread::spawn(move || {
+ let text = std::fs::read_to_string("notes.txt").unwrap_or_default();
+ ui.send(move |cx| view.update(cx, |s, cx| { // runs on the UI thread
+ s.text = text;
+ cx.notify();
+ }));
+ });
+ });
+}
+```
+
+- **`cx.ui_sender()`** returns a `UiSender` you can clone and move to any thread.
+- **`ui.send(|cx| ...)`** queues a closure; the UI loop wakes, runs it with `&mut App`, then re-renders what it changed. It returns `false` once the app has ended.
+- **`.keep_alive(true)`** keeps the event loop running with no windows open, until `cx.quit()`.
+- **`cx.run_pending()`** runs queued work by hand, for a loop that isn't the native one (headless apps driven from another thread).
+
+## Compiling gpui code unchanged
+
+The repository's benchmarks prove the point. [`settings.rs`](https://github.com/ppmpreetham/BUI/blob/main/bindings/rust/bench/common/settings.rs) is a small settings window, a label, a text field, a checkbox, a slider and a button, written once in gpui syntax. It's compiled unchanged against blenderui, Zed's gpui and gpui-fast; each benchmark crate only supplies the imports and `main`:
+
+```rust title="bench/bui-bench/src/bin/bui-settings.rs"
+use blenderui::prelude::*;
+
+include!("../../../common/settings.rs");
+
+fn main() {
+ Application::new().run(|cx: &mut App| {
+ let bounds = Bounds { origin: point(px(100.0), px(100.0)), size: size(px(360.0), px(260.0)) };
+ cx.open_window(WindowOptions { window_bounds: Some(WindowBounds::Windowed(bounds)), ..Default::default() },
+ |_, cx| cx.new(|_| Settings { renders: 0 }))
+ .unwrap();
+ });
+}
+```
+
+gpui has no form widgets, so in that file the controls are styled `div`s. On blenderui you can swap them for real ones (`input()`, `<NumberSlider>` …) whenever you're ready.
+
+## How it compares
+
+All numbers here come from the repository's benchmarks, with their setup. Rerun them yourself with the tools in `bindings/rust/bench` (see [the benchmarks page](../../performance/benchmarks/)).
+
+### Start time
+
+The `settings.rs` window above, compiled against each framework. Measured on a Ryzen 7 5800U laptop (Windows 11, on AC power) before the latest features (ImGui, the Linux GPU renderer, Blender's search and expression code) landed. Median of 10 launches, from process start until the first frame is on screen:
+
+<BenchChart id="start-time" />
+
+<BenchChart id="start-cpu" />
+
+<BenchTable id="startupGpui" />
+
+On the same code, blenderui shows its first frame about 5× sooner than gpui and gpui-fast, spends about 8× less CPU getting there, and on the CPU renderer uses half the memory.
+
+### Animated frames
+
+A window of N rounded, labelled cells that all change every frame, on blenderui (GPU renderer and default software raster), [gpui-fast](https://github.com/longbridge/gpui-fast) 0.1.13 and gpui 0.2.2. Ryzen 7 5800U laptop at 60 Hz, all apps back to back in one session:
+
+<BenchChart id="fps" />
+
+<BenchChart id="cpu-per-frame-cells" />
+
+<BenchTable id="cells3000" />
+
+<BenchTable id="cellsFull" />
+
+The full table, how it was measured and how to rerun it are in [`bindings/rust/bench/README.md`](https://github.com/ppmpreetham/BUI/blob/main/bindings/rust/bench/README.md).
+
+## Where it differs from gpui
+
+- **One element type.** Every element is a `Div`, with a constructor per HTML tag, and CSS applies to all of them.
+- **Entities are `Copy` handles**, and `read` returns `&T` directly. A weak handle upgrades with `upgrade_in(cx)`.
+- **Listeners and closures:** in `rsx!`, listeners may leave out the `(event, window, cx)` parameters.
+- **Extra `WindowOptions`:** `gpu` picks the renderer per window.
+- **HTML and CSS on top:** stylesheets, selectors, Tailwind classes and Blender's widgets are all available from the same builder chain.
+
+<Callout type="joke">
+Same code, two frameworks, one of them draws Blender sliders. No prizes for guessing which.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="BUI for Rust" href="docs/rust/overview/" icon="book" kicker="Rust">
+ The crate at a glance: rendering, text and limits.
+ </Card>
+ <Card title="Events" href="docs/rust/events/" icon="zap" kicker="Rust">
+ Every listener and the Window API.
+ </Card>
+ <Card title="Benchmarks" href="docs/performance/benchmarks/" icon="cpu" kicker="Performance">
+ All the published numbers, with their context.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/headless-testing.mdx b/website/src/content/docs/rust/headless-testing.mdx
new file mode 100644
index 0000000..e912da1
--- /dev/null
+++ b/website/src/content/docs/rust/headless-testing.mdx
@@ -0,0 +1,207 @@
+---
+title: Headless testing
+description: Run your Rust UI without a window, click and type into it from a test, read its pixels, save screenshots and step animations on a virtual clock.
+section: Rust
+order: 80
+languages: ["rust"]
+sources: ["docs/rust.md", "bindings/rust/blenderui/src/window.rs", "bindings/rust/blenderui/tests/headless.rs", "bindings/rust/blenderui/tests/animation.rs", "bindings/rust/blenderui/tests/rsx.rs", "bindings/rust/blenderui/tests/hooks.rs", "bindings/rust/blenderui/tests/parity.rs", "bindings/rust/blenderui/examples/hello.rs"]
+---
+
+The best UI bug is the one your test catches before anyone sees it. **BUI can run your whole app off-screen**: same code, same layout, same pixels, no window. Your tests click buttons, type text, scroll lists and check the result, in plain `cargo test`, on CI machines with no display.
+
+## Your first UI test
+
+Put this in `tests/counter.rs`:
+
+```rust title="tests/counter.rs"
+use blenderui::prelude::*;
+
+struct Counter { count: i32 }
+
+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))
+ .on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
+ this.count += 1;
+ cx.notify();
+ })),
+ )
+ }
+}
+
+#[test]
+fn clicking_plus_counts() {
+ 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);
+ });
+}
+```
+
+Run it with `cargo test`. Here's what each piece does:
+
+- **`Application::headless()`** runs the same code as `Application::new()`, but nothing appears on screen. It's also what you get automatically on a platform without native windows.
+- **`cx.element_bounds(window, "plus")`** finds the element with `.id("plus")` and returns its box in logical pixels.
+- **`cx.simulate_click(window, x, y)`** moves the pointer there, then presses and releases the left button.
+- **`win.root().read(cx)`** gives you your view, so you can check its state.
+
+## Simulating input
+
+| Method | What it does |
+| --- | --- |
+| `simulate_mouse_move(window, x, y)` | Move the pointer, which triggers `:hover` styles and `on_hover` |
+| `simulate_click(window, x, y)` | Move, then press and release the left button |
+| `simulate_scroll(window, x, y, lines)` | Turn the wheel at a point: positive `lines` scroll the content up, negative scroll down |
+| `simulate_key(window, text, keysym)` | Type text, or press a key by its X11 keysym name: `"Return"`, `"BackSpace"`, `"a"` … |
+
+Coordinates are logical pixels. Each call handles the events it caused and re-renders before returning, so you can assert right after it.
+
+```rust
+let field = cx.element_bounds(win.id, "name").unwrap();
+cx.simulate_click(win.id, field.origin.x + 5.0, field.origin.y + 5.0); // focus it
+cx.simulate_key(win.id, "a", "a"); // type "a"
+cx.simulate_key(win.id, "", "Return"); // press Enter
+```
+
+To change your view from a test, as the app would, use `update`:
+
+```rust
+win.root().update(cx, |view, cx| {
+ view.items.remove(0);
+ cx.notify();
+});
+```
+
+`cx.notify_all()` marks every window for a re-render.
+
+## Reading pixels
+
+`cx.draw(window)` renders the window and hands you its pixels: `(width, height, pixels)`, in **device pixels**, each a `u32` as `0x00RRGGBB`.
+
+```rust
+let (w, h, px) = cx.draw(win.id);
+let scale = w as f32 / 300.0; // device pixels per logical pixel
+let at = |x: f32, y: f32| px[(y * scale) as usize * w + (x * scale) as usize];
+assert_eq!(at(10.0, 10.0), 0xff0000); // the red box is where it should be
+```
+
+Divide by your window's logical width to get the scale, as above, so the test passes on HiDPI machines too.
+
+## Saving a screenshot
+
+Turn the pixels into a PNG with the `png` crate. This is how the examples' `--screenshot` flag works (`cargo run --example showcase -- --screenshot a.png`):
+
+```rust
+let (w, h, px) = cx.draw(win.id);
+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("shot.png").expect("create png");
+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().expect("png").write_image_data(&rgba).expect("png");
+```
+
+The image is a real render: the same pixels a native window would show.
+
+## Test animations with a virtual clock
+
+Headless windows run on a **virtual clock** that stands still until you move it. `cx.advance_clock(duration)` moves every window's clock forward, so animations and transitions land on exact values every time:
+
+```rust title="tests/grow.rs"
+use std::time::Duration;
+use blenderui::prelude::*;
+
+struct Page;
+
+impl Render for Page {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ body().child(div().id("a")).child(style().child("
+ body { margin: 0 } div { height: 10px; width: 30px }
+ @keyframes grow { 0% { width: 0 } 50% { width: 100px } 100% { width: 50px } }
+ #a { animation: grow 2s linear }"))
+ }
+}
+
+#[test]
+fn grows_then_settles() {
+ Application::headless().run(|cx| {
+ let win = cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Page)).unwrap();
+ let width = |cx: &mut App| cx.element_bounds(win.id, "a").unwrap().size.width;
+ cx.draw(win.id);
+ assert_eq!(width(cx), 0.0);
+ cx.advance_clock(Duration::from_millis(500));
+ assert_eq!(width(cx), 50.0); // halfway to the 50% keyframe
+ cx.advance_clock(Duration::from_millis(500));
+ assert_eq!(width(cx), 100.0);
+ cx.advance_clock(Duration::from_millis(1100));
+ assert_eq!(width(cx), 30.0); // finished: back to the CSS width
+ cx.draw(win.id);
+ assert!(!cx.window(win.id).unwrap().is_animating());
+ });
+}
+```
+
+`window.is_animating()` tells you whether animations or transitions are still running, and `window.needs_render()` whether a render is pending. Together they make a good "the window is idle" check. On native windows, `advance_clock` adds to real time instead.
+
+## Sizing the test window
+
+`WindowOptions::default()` opens a 1024 × 700 window. Pick a size when layout matters:
+
+```rust
+let opts = WindowOptions {
+ window_bounds: Some(WindowBounds::Windowed(Bounds {
+ origin: point(px(0.0), px(0.0)),
+ size: size(px(300.0), px(200.0)),
+ })),
+ ..Default::default()
+};
+let win = cx.open_window(opts, |_, cx| cx.new(|_| MyView)).unwrap();
+```
+
+`@media` queries and Tailwind breakpoints follow this size, so you can test `md:` layouts by opening a wider window.
+
+## One app at a time
+
+The C kit has global state, so **one `Application` runs at a time per process**. `run` takes a lock, so tests that run in parallel simply queue up; you don't need `--test-threads=1`.
+
+## The repository's own tests
+
+BUI's Rust tests are a good library of working examples. From `bindings/rust`:
+
+```sh
+cargo test # everything
+cargo test --test headless # layout, painting and input
+cargo test --test parity -- --nocapture # print the HTML and CSS coverage report
+```
+
+| File | What it shows |
+| --- | --- |
+| `tests/headless.rs` | Layout, clicks, hover, stylesheets, tables, the canvas painter, incremental frames |
+| `tests/rsx.rs` | `rsx!` control flow, variant attributes, Tailwind attributes |
+| `tests/hooks.rs` | Hooks, context, keys and optional props |
+| `tests/animation.rs` | Keyframes, fill modes, easing, transitions and the virtual clock |
+| `tests/effects.rs` | Filters, transforms, clip paths, masks, blend modes, scroll snap, Blender components |
+| `tests/basic_css.rs`, `tests/modern_css.rs` | Borders, counters, `styled`, variables, grid areas, selectors, at-rules |
+| `tests/parity.rs` | The coverage numbers |
+
+<Callout type="joke">
+Headless mode: all of the UI, none of the window. Like rendering with the viewport set to wireframe and the monitor switched off.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Events" href="docs/rust/events/" icon="zap" kicker="Rust">
+ The listeners your simulated input triggers.
+ </Card>
+ <Card title="Effects and animations" href="docs/rust/effects-and-animations/" icon="sparkles" kicker="Rust">
+ The animations you'll be stepping through.
+ </Card>
+ <Card title="gpui syntax" href="docs/rust/gpui-syntax/" icon="book" kicker="Rust">
+ Views, entities and windows: what your tests open and read.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/hooks.mdx b/website/src/content/docs/rust/hooks.mdx
new file mode 100644
index 0000000..1ec5857
--- /dev/null
+++ b/website/src/content/docs/rust/hooks.mdx
@@ -0,0 +1,255 @@
+---
+title: Hooks and signals
+description: Give components state, derived values, effects and shared context, in Leptos, zopra or dependency-list style, with no cx to thread around.
+section: Rust
+order: 20
+languages: ["rust"]
+sources: ["docs/rust.md", "bindings/rust/blenderui/src/hooks.rs", "bindings/rust/blenderui/src/lib.rs", "bindings/rust/blenderui/tests/hooks.rs", "CHANGELOG.md"]
+---
+
+State is what makes a UI feel alive: a counter that counts, a panel that remembers it's open. **Hooks give a component its own state**, and BUI re-renders the window whenever that state changes. You don't pass `cx` around, you don't wrap anything in `Rc<RefCell<…>>`, and you can write them in the style you know from Leptos or zopra, or with explicit dependency lists.
+
+## Your first hook
+
+A component's body can end in `rsx!` markup or in a gpui builder chain; hooks work the same in both.
+
+<Tabs sync="rust-syntax" label="Rust syntax">
+<Tab label="rsx!">
+
+```rust title="src/main.rs"
+use blenderui::prelude::*;
+
+#[component]
+fn clicker(label: &str) {
+ let (count, set_count) = use_state(0);
+ rsx! {
+ <button onClick={move || set_count(count() + 1)}>
+ {format!("{label}: {}", count())}
+ </button>
+ }
+}
+
+struct App1;
+
+impl Render for App1 {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ rsx! { <body styled><clicker label="Apples" /> <clicker label="Pears" /></body> }
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| App1)).unwrap();
+ });
+}
+```
+
+</Tab>
+<Tab label="gpui builders">
+
+```rust title="src/main.rs"
+use blenderui::prelude::*;
+
+#[component]
+fn clicker(label: &str) {
+ let (count, set_count) = use_state(0);
+ button()
+ .child(format!("{label}: {}", count()))
+ .on_click(move |_, _, _| set_count(count() + 1))
+}
+
+struct App1;
+
+impl Render for App1 {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ // components are used as tags, so place them with a small rsx! block
+ body().styled()
+ .child(rsx! { <clicker label="Apples" /> })
+ .child(rsx! { <clicker label="Pears" /> })
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| App1)).unwrap();
+ });
+}
+```
+
+Without components, builder code usually keeps state in the view's own fields and changes it with `cx.listener(...)` and `cx.notify()`. The [gpui syntax](../gpui-syntax/) page shows that style.
+
+</Tab>
+</Tabs>
+
+- `use_state(0)` returns two closures: a **getter** (`count()`) and a **setter** (`set_count(v)`).
+- Both are `Copy`, so `move ||` closures can capture them freely.
+- Calling the setter re-renders the window. Each `clicker` has its own count: clicking Apples doesn't touch Pears.
+
+## The hooks
+
+| Hook | What it gives you | Also known as |
+| --- | --- | --- |
+| `use_state(v)` | A getter and a setter closure | zopra `use_state` |
+| `use_signal(v)` | A `Signal<T>` owned by the component | zopra `use_signal` |
+| `Signal::new(v)` | A `Signal<T>` that lives until you `dispose()` it | Leptos `RwSignal` |
+| `signal(v)`, `create_signal(v)` | Read and write halves: `(ReadSignal<T>, WriteSignal<T>)` | Leptos |
+| `Memo::new(f)` | A derived value, recomputed when a signal it read changes | Leptos |
+| `Effect::new(f)` | Code that runs after render, and again when a signal it read changes | Leptos |
+| `use_effect(f, deps)`, `use_effect!(f, [a, b])` | Code that runs after render, and again when `deps` change | zopra `use_effect!` |
+| `use_memo(f, deps)` | A cached value, recomputed when `deps` change | |
+| `provide_context(v)`, `use_context()`, `try_use_context()` | A value shared with everything rendered inside | Leptos / zopra context |
+
+All of them are in `blenderui::prelude`, along with `RwSignal`, `ReadSignal`, `WriteSignal` and `Children`.
+
+## Signals
+
+A **signal** is a small `Copy` handle to a value. Reading it is cheap, and writing it re-renders the window that owns it.
+
+```rust
+let name = use_signal(String::from("Cube"));
+
+name.get(); // a clone of the value (T: Clone)
+name.with(|n| n.len()); // look without cloning
+name.set("Sphere".into()); // replace, then re-render
+name.update(|n| n.push_str(".001")); // change in place, then re-render
+let (read, write) = name.split(); // Leptos-style halves
+```
+
+`ReadSignal` has `get` and `with`; `WriteSignal` has `set` and `update`.
+
+- **Inside a component, use `use_signal` (or `signal`).** Its state belongs to the component and is freed when the component stops rendering.
+- **`Signal::new` lives until you call `dispose()`.** Create it outside any render, for example when building your view, and it works as app-wide state: writing it re-renders every window.
+- Using a signal after its component is gone panics with "signal used after its component was dropped".
+
+## Three styles, side by side
+
+Here's the same idea written three ways. They share one store, so you can mix them in one app.
+
+<Tabs>
+<Tab label="zopra">
+
+```rust
+#[component] // lowercase name, &str props
+fn profile(username: &str) {
+ let (likes, set_likes) = use_state(0); // likes(), set_likes(..): no cx
+ use_effect!(move || println!("{} likes", likes()), [likes()]);
+ let theme: Theme = use_context();
+ rsx! {
+ <div class="p-2" data-theme={theme.0} onClick={move || set_likes(likes() + 1)}>
+ {username.to_string()} " " {likes().to_string()}
+ </div>
+ }
+}
+```
+
+</Tab>
+<Tab label="Dependency lists">
+
+```rust
+#[component]
+fn Profile(username: &str) {
+ let (likes, set_likes) = use_state(0);
+ use_effect(move || println!("mounted"), ()); // once, after the first render
+ let label = use_memo(|| format!("{} likes", likes()), likes()); // recomputed when likes changes
+ rsx! { <div onClick={move || set_likes(likes() + 1)}>{username.to_string()} " " {label}</div> }
+}
+```
+
+</Tab>
+<Tab label="Leptos">
+
+```rust
+#[component]
+fn Counter(start: i32) {
+ let (count, set_count) = signal(start);
+ let doubled = Memo::new(move || count.get() * 2); // recomputed when count changes
+ Effect::new(move || println!("count is {}", count.get())); // re-runs when count changes
+ view! {
+ <button onClick={move || set_count.update(|c| *c += 1)}>{doubled.get().to_string()}</button>
+ }
+}
+```
+
+</Tab>
+</Tabs>
+
+The zopra example needs a `Theme` in context; see [Context](#context) below.
+
+## Effects
+
+An **effect** is code that runs *after* a render, for work that isn't drawing: logging, saving a file, starting a timer.
+
+- **`use_effect(f, deps)`** runs `f` after the first render, then again after any render where `deps` differs from last time. Pass `()` to run it once.
+- **`use_effect!(f, [a, b])`** is the zopra spelling. It clones each dependency into a tuple for you.
+- **`Effect::new(f)`** tracks dependencies by itself: it re-runs after any render in which a signal it read has changed. A re-render that changed nothing doesn't re-run it.
+
+Effects run after the render finishes, so they're free to write signals. That schedules another render.
+
+## Derived values
+
+- **`Memo::new(f)`** remembers `f()`'s result and recomputes it only when a signal `f` read has changed. A `Memo` is `Copy`; read it with `.get()`.
+- **`use_memo(f, deps)`** is the dependency-list version: it returns the cached value while `deps` stays equal, and calls `f` again when it changes.
+
+## Context
+
+**Context** shares a value with every component rendered inside the one that provides it, without passing it down as a prop. Values are looked up by type, and the innermost one wins.
+
+```rust
+#[derive(Clone)]
+struct Theme(&'static str);
+
+impl Render for Page {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ provide_context(Theme("dark"));
+ rsx! { <body styled><profile username="Ada" /></body> }
+ }
+}
+```
+
+- `use_context::<T>()` returns a clone. If no parent provided one, it panics with a message naming the type.
+- `try_use_context::<T>()` returns an `Option<T>` instead.
+- Context provided inside a component is visible to its children only, not to its siblings.
+
+## Keys: keep state with the right item
+
+A hook's state is tied to **where it's called** and **in which order components render**. That's fine until a list changes. Remove the first item, and every item after it slides up one position, taking the state of the one before.
+
+Give each component in a list a `key` and its state follows the key instead:
+
+```rust
+rsx! {
+ <body styled>
+ {for name in self.items.clone() { <Row key={name} name={name} /> }}
+ </body>
+}
+```
+
+The repository's test (`tests/hooks.rs`) checks both cases: with keys, removing `"a"` leaves `"b"`'s clicks with `"b"`; without keys, `"c"` inherits them. Nested keys combine, so a keyed row inside a keyed list works as you'd expect.
+
+## Lifetimes and cost
+
+- **State is freed when its component stops rendering.** Hide a component and show it again, and it starts fresh.
+- **No `Rc`, no `RefCell`.** Signals are handles into a per-thread store, which is moved out of its cell while in use, and your code never runs inside it.
+- **Writing a signal re-renders only the window that owns it.** Other windows stay idle.
+
+## Limits
+
+<ComingSoon feature="Async resources (use_resource)">
+There's no `use_resource` yet for loading data asynchronously. For now, do the work on another thread and send the result back with `cx.ui_sender()` (see [gpui syntax](../gpui-syntax/#talking-to-the-ui-thread)), then write a signal or update your view.
+</ComingSoon>
+
+Generic components (`#[component] fn list<T>(...)`) are <ComingSoon inline /> as well.
+
+## Next steps
+
+<CardGrid>
+ <Card title="rsx! and components" href="docs/rust/rsx-and-components/" icon="layers" kicker="Rust">
+ Props, children, optional props and keys.
+ </Card>
+ <Card title="Events" href="docs/rust/events/" icon="zap" kicker="Rust">
+ Clicks, keys, changes and the Window API.
+ </Card>
+ <Card title="Headless testing" href="docs/rust/headless-testing/" icon="check" kicker="Rust">
+ Click your components in a test and assert on the result.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/html-elements.mdx b/website/src/content/docs/rust/html-elements.mdx
new file mode 100644
index 0000000..6903fdb
--- /dev/null
+++ b/website/src/content/docs/rust/html-elements.mdx
@@ -0,0 +1,176 @@
+---
+title: HTML elements
+description: All 113 HTML elements are one Rust type with a constructor per tag. Here's what each kind draws like, and the methods every element shares.
+section: Rust
+order: 30
+languages: ["rust"]
+sources: ["docs/rust.md", "bindings/rust/blenderui/src/html.rs", "bindings/rust/blenderui/src/element.rs", "bindings/rust/blenderui/src/paint.rs", "bindings/rust/blenderui/tests/parity.rs", "bindings/rust/blenderui/examples/showcase.rs"]
+---
+
+Every HTML tag is here: `div()`, `section()`, `table()`, `details()`, `dialog()`, all of them. **That means you can build a Rust UI out of standard HTML elements**, and it lays out and draws the way the HTML and CSS specs say.
+
+<Figure
+ src="images/rust-showcase.png"
+ alt="A dark Blender-style window built from HTML elements: a sidebar of links, a heading, cards, a form, a striped table, nested lists, details sections and a code block"
+ caption="Headings, lists, a table, <code>details</code> and form controls, all plain HTML elements (<code>examples/showcase.rs</code>)."
+ width={900}
+ height={760}
+/>
+
+The trick that keeps it simple: there's **one element type, `Div`**. A tag only changes an element's defaults: what the built-in stylesheet gives it, and whether it becomes a box, a widget or an image.
+
+## One type, every tag
+
+There's a constructor for every element of the [WHATWG HTML index](https://html.spec.whatwg.org/multipage/indices.html#elements-3): **113 elements**, plus `svg()` and `math()` as plain boxes. In `rsx!`, the tag name calls the constructor: `<section>` is `section()`.
+
+```rust
+use blenderui::prelude::*;
+
+fn page() -> Div {
+ article()
+ .child(h1().child("Render settings"))
+ .child(p().child("Samples, ").child(b().child("denoising")).child(", light paths."))
+ .child(ul().child(li().child("Cycles")).child(li().child("EEVEE")))
+}
+```
+
+Because every constructor returns a `Div`, everything on this page and on the [CSS page](../css-and-tailwind/) works on every element.
+
+## What each tag draws like
+
+| Kind | Elements | Drawn 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`, plus `option`, `optgroup`, `datalist` | Form controls: browser-style, or Blender's own widgets ([the three looks](../styled-and-blender-components/)) |
+| 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 drawn (`<style>` and `<title>` are read) |
+| Break | `br`, `wbr` | Line breaks |
+
+Nine of the 113 are widgets. The full list, straight from `html.rs`:
+
+- **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` (and the `svg`, `math` roots)
+- **Widget:** `button`, `input`, `select`, `option`, `optgroup`, `textarea`, `progress`, `meter`, `datalist`
+- **Replaced:** `img`, `iframe`, `embed`, `object`, `video`, `audio`, and `canvas`
+- **Metadata:** `head`, `title`, `base`, `link`, `meta`, `style`, `script`, `template`, `source`, `track`, `area`
+- **Break:** `br`, `wbr`
+
+<Callout type="warning" title="main() vs fn main">
+The `<main>` element's constructor is called `main()`, the same as your program's `fn main`. Inside `fn main`, call it as `blenderui::html::main()`.
+</Callout>
+
+### Custom elements
+
+Unknown names work too, like custom elements in a browser. `custom("my-widget")` or `Div::new("my-widget")` makes an element with no built-in styles, laid out inline like a `<span>` until your CSS says otherwise. In `rsx!`, any tag with a dash does the same: `<my-widget class="block h-1" />`.
+
+### The document
+
+Your view's root is wrapped in `<html><body>` unless it already is one, so `body { margin: 0 }` and the browser defaults behave as you'd expect. Return `html()` with a `head()` when you want a stylesheet and a title up front:
+
+```rust
+html()
+ .child(head().child(title().child("BUI showcase")).child(style().child(CSS)))
+ .child(body().child(/* your page */))
+```
+
+A `<title>` element sets the window title.
+
+## Methods every element has
+
+| Method | What it does |
+| --- | --- |
+| `.child(x)`, `.children(iter)` | Add children: elements, components or text |
+| `.id(..)` | An `id` attribute and an identity that keeps the element's state across renders |
+| `.key(..)` | Identity without the `id` attribute: keeps state, but `#id` selectors don't see it |
+| `.class(..)` | Add classes (adds to any already set) |
+| `.attr(name, value)` | Set any HTML attribute |
+| `.styled()` | Give this subtree Blender's look ([the three looks](../styled-and-blender-components/)) |
+| `.href`, `.value`, `.placeholder`, `.input_type`, `.name`, `.title`, `.src`, `.alt` | Typed attributes that take text |
+| `.checked`, `.disabled`, `.selected`, `.open` | Boolean attributes: `true` sets them, `false` removes them |
+| `.min`, `.max`, `.step` | Number attributes (`f64`) |
+| `.colspan` | Table cell spans (`u32`) |
+
+Text children are `&'static str`, `String` or `SharedString`.
+
+`FluentBuilder` adds conditional building, gpui-style:
+
+```rust
+div()
+ .when(selected, |el| el.class("active"))
+ .when_some(tooltip, |el, t| el.title(t))
+ .when_none(&icon, |el| el.class("no-icon"))
+ .map(|el| if compact { el.p_1() } else { el.p_4() })
+```
+
+### Identity and state
+
+Every render builds a fresh tree, so how does a text field remember what you typed? **Give it an `.id(...)`.** Elements with an id keep their state across renders: scroll position, a text field's contents, a checkbox you clicked, which `<details>` are open. Use `.key(...)` instead when you want the same memory without an `id` attribute that CSS can match.
+
+## Lists
+
+`ul` and `ol` get bullets and numbers from `list-style-type`: `disc`, `circle`, `square`, `decimal`, `lower-alpha`, `upper-roman` and more. Nested lists switch bullets as browsers do (disc, then circle, then square). `list-style-position`, `list-style-image` and `<ol start>` work too.
+
+```rust
+ol().attr("start", "3")
+ .child(li().child("Third"))
+ .child(li().child("Fourth"))
+```
+
+## Details and dialogs
+
+- **`<details>` / `<summary>`**: clicking the summary toggles the details. `.open(true)` sets the starting state, and with an `.id(...)` the open state is remembered across renders.
+- **`<dialog>`** is hidden until you give it `.open(true)`. It then shows as an absolutely positioned box above the page.
+
+```rust
+details().id("render").open(true)
+ .child(summary().child("Render settings"))
+ .child(p().child("Samples, denoising, light paths."))
+```
+
+## Inline text
+
+Text is broken into words that wrap in line boxes, like a browser. Inline elements (`b`, `i`, `a`, `code`, `mark`, `small`, `sub`, `sup` …) style their own words, and inline-blocks and widgets sit on the line with the text. The [layout page](../layout/#inline-text) covers `white-space`, `text-align` and friends.
+
+Two things differ from a browser: inline boxes paint their background per word, and borders and padding on inline elements such as `<kbd>` and `<code>` aren't drawn.
+
+## Tables
+
+<Figure
+ shot="rust-html-plain"
+ alt="An Export Animation page in plain HTML with a browser's default look: a form with a text input, select, number input, range slider and radio buttons, and a table below"
+ caption="A form and a table from plain HTML elements, with no stylesheet beyond a few margins (<code>examples/site_plain_html.rs</code>)."
+/>
+
+`table`, `thead`, `tbody`, `tfoot`, `tr`, `td`, `th`, `caption`, `colgroup` and `col` all work, with `colspan`, `border-spacing`, `border-collapse`, `caption-side` and `empty-cells`. Columns size to their content and line up across rows. [Layout](../layout/#tables) has the details.
+
+```rust
+table()
+ .child(thead().child(tr().child(th().child("Object")).child(th().child("Vertices"))))
+ .child(tbody().children([("Cube", "8"), ("Suzanne", "507")]
+ .map(|(o, v)| tr().child(td().child(o)).child(td().child(v)))))
+```
+
+## Images
+
+- **From a file:** `img().src("file.png")`. PNGs are decoded once and cached.
+- **From pixels:** `img().image_rgba(width, height, rgba)`, with `width * height * 4` bytes, row-major, straight alpha.
+- **Shared pixels:** `img().image(Arc<Image>)` is cheap to pass every frame. `Image::from_png(path)` decodes a file into one.
+
+Images are PNG only and scale with nearest-neighbour sampling. CSS `object-fit`, `object-position` and `background-image: url(...)` work too ([CSS](../css-and-tailwind/)).
+
+`video`, `audio` and `iframe` show a placeholder of their intrinsic size; there's no media playback or embedded browsing <ComingSoon inline />.
+
+To draw your own shapes, use `canvas(...)`: see [painting your own content](../events/#painting-your-own-content).
+
+## Next steps
+
+<CardGrid>
+ <Card title="CSS and Tailwind" href="docs/rust/css-and-tailwind/" icon="sparkles" kicker="Rust">
+ Style any element four ways, with one cascade.
+ </Card>
+ <Card title="The three looks" href="docs/rust/styled-and-blender-components/" icon="monitor" kicker="Rust">
+ Browser controls, styled, and Blender components.
+ </Card>
+ <Card title="Layout" href="docs/rust/layout/" icon="layers" kicker="Rust">
+ Flexbox, grid, tables and positioning.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/layout.mdx b/website/src/content/docs/rust/layout.mdx
new file mode 100644
index 0000000..f6ed6ef
--- /dev/null
+++ b/website/src/content/docs/rust/layout.mdx
@@ -0,0 +1,165 @@
+---
+title: Layout
+description: Block flow, wrapping text, flexbox, grid with named areas, tables, positioning, scrolling and right-to-left text, laid out by taffy like a browser would.
+section: Rust
+order: 55
+languages: ["rust"]
+sources: ["docs/rust.md", "bindings/rust/blenderui/src/layout.rs", "bindings/rust/blenderui/src/style.rs", "bindings/rust/blenderui/tests/headless.rs", "bindings/rust/blenderui/tests/modern_css.rs", "bindings/rust/blenderui/tests/effects.rs", "bindings/rust/blenderui/Cargo.toml"]
+---
+
+Getting boxes to sit where you want is most of UI work. **BUI lays out your elements with the CSS layout rules**: block flow, flexbox, grid and tables, following the W3C specs. Under the hood it's [taffy](https://github.com/DioxusLabs/taffy), the Rust layout engine, with BUI's own line boxes and tables on top.
+
+## Block flow
+
+Elements like `div`, `p` and `section` stack top to bottom, as in a browser. Margins, padding, borders, `box-sizing`, `min-*` / `max-*` sizes and `aspect-ratio` all apply, and so do sizing keywords such as `fit-content` and `stretch`.
+
+<Callout type="note">
+`box-sizing` defaults to `border-box` here, like Tailwind's preflight. Padding and borders fit *inside* the width you set.
+</Callout>
+
+**Floats** place block boxes to the left or right, and `clear` moves the next box below them. Text doesn't wrap around floats yet <ComingSoon inline />.
+
+## Inline text
+
+Text and inline elements become **line boxes**: words that wrap at the container's edge. Inline elements (`b`, `a`, `code`, `mark` …) style their own words, and inline-blocks and widgets sit on the line with the text.
+
+These apply to inline content:
+
+- `white-space`: `normal`, `nowrap`, `pre`, `pre-wrap`, `pre-line`
+- `text-align`, `text-indent`, `letter-spacing`, `word-spacing`
+- `vertical-align: sub | super`, `text-transform`, `text-overflow: ellipsis`
+- `word-break: break-all`, `overflow-wrap: anywhere | break-word`, `tab-size`
+
+`text-align: justify` aligns left for now <ComingSoon inline />.
+
+## Flexbox and grid
+
+<Figure
+ shot="feature-css-grid"
+ alt="A material library laid out with CSS grid: cards of different sizes packed densely, some spanning two rows or columns"
+ caption="<code>repeat(auto-fill, minmax())</code>, row and column spans and <code>grid-auto-flow: dense</code> (<code>examples/site_grid.rs</code>)."
+/>
+
+**Every property of both modules** works: Flexbox 12 of 12 and Grid 23 of 23. That includes `repeat()`, `minmax()`, `fr`, `auto-fill` / `auto-fit`, spans, line placement, **named lines** and **`grid-template-areas`**.
+
+```rust title="A grid with named areas"
+use blenderui::prelude::*;
+
+struct Shell;
+
+impl Render for Shell {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ body().m_0().styled()
+ .child(style().child("
+ .g { display: grid; height: 100vh;
+ grid-template-columns: 160px 1fr;
+ grid-template-rows: 40px 1fr 30px;
+ grid-template-areas: 'head head' 'side main' 'foot foot' }
+ header { grid-area: head } nav { grid-area: side }
+ .main { grid-area: main } footer { grid-area: foot }"))
+ .child(div().class("g")
+ .child(header().child("Header"))
+ .child(nav().child("Outliner"))
+ .child(div().class("main").child("Viewport"))
+ .child(footer().child("Status bar")))
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Shell)).unwrap();
+ });
+}
+```
+
+The same layouts work with methods (`div().flex().flex_col().gap_2()`, `div().grid().grid_cols(3)`) or Tailwind (`class="grid grid-cols-3 gap-4"`).
+
+## Tables
+
+Tables lay out like a browser's auto layout:
+
+- **Columns are as wide as their widest content** and line up across rows.
+- **A table with an auto width shrinks to its columns**, up to the width of its container.
+- **`table-layout: fixed`** takes the column widths from the first row.
+- `colspan`, `border-spacing`, `border-collapse`, `caption-side` and `empty-cells` apply.
+
+```rust
+table().style("border-collapse: collapse; width: 100%")
+ .child(thead().child(tr().child(th().child("Object")).child(th().child("Type"))))
+ .child(tbody()
+ .child(tr().child(td().child("Cube")).child(td().child("Mesh")))
+ .child(tr().child(td().child("Camera")).child(td().child("Camera"))))
+```
+
+One simplification: columns are sized from their widest *single-line* content, a simpler version of browsers' auto layout.
+
+## Positioning
+
+- **`relative`** and **`absolute`**, with every `inset` property (`top`, `left`, `inset-inline-start` …). An absolute box is placed against its nearest positioned ancestor.
+- **`fixed`** boxes are laid out like `absolute` ones, placed against the window.
+- **`z-index`** orders painting and hit testing.
+- **2D transforms** (`translate`, `scale`, `rotate`, `skew`, `matrix`, `transform-origin`, and the individual `rotate`, `scale` and `translate` properties) all draw. Clicks still use the untransformed box. See [Effects](../effects-and-animations/#transforms).
+
+## Overflow and scrolling
+
+- `overflow: hidden` and `clip` clip their content.
+- `overflow: scroll` and `auto` scroll with the mouse wheel (hold <Kbd>Shift</Kbd> to scroll sideways) and show overlay scrollbars.
+- Give a scroll container an `.id(...)` and its scroll position survives re-renders. Read or set it from code with `window.scroll_offset(id)` and `window.set_scroll_offset(id, x, y)`.
+
+### Scroll snapping
+
+`scroll-snap-type` (`x`, `y` or `both`; `mandatory` or `proximity`) on the container and `scroll-snap-align` on its children make scrolling land on a child:
+
+```css
+#pages { height: 100px; overflow-y: scroll; scroll-snap-type: y mandatory }
+.page { height: 100px; scroll-snap-align: start }
+```
+
+With that, one wheel notch moves exactly one page. `scroll-padding`, `scroll-margin` and `scroll-snap-stop` parse but aren't applied yet.
+
+## Container queries
+
+`@container` size queries work, with `container-type` and `container-name`:
+
+```css
+.sidebar { container: side / inline-size }
+@container side (max-width: 150px) { .label { display: none } }
+```
+
+Queries use the container's size from the previous layout. When that size changes, the window simply renders once more.
+
+## Right-to-left text
+
+Hebrew and Arabic runs are reordered inside left-to-right text, using a compact version of the Unicode Bidirectional Algorithm. `direction: rtl` and `unicode-bidi: bidi-override` apply.
+
+<ComingSoon feature="Text shaping">
+Right-to-left text is reordered but not shaped, so Arabic letters don't join yet. OpenType font features need the same shaping step.
+</ComingSoon>
+
+## Lists, details and dialogs
+
+- **Lists:** `list-style-type` (`disc`, `circle`, `square`, `decimal`, `lower-alpha`, `upper-roman` …), `list-style-position`, `list-style-image` and `<ol start>`.
+- **`<details>` / `<summary>`:** clicking the summary toggles the details; `.open(true)` sets the starting state.
+- **`<dialog>`** shows when you give it `.open(true)`.
+
+## How it's fast
+
+Your `render()` builds a fresh element tree every frame, but layout doesn't start from zero. The taffy tree persists between frames and is reconciled by key, so only subtrees that changed are laid out again. The repository's tests check that an incrementally updated frame matches a fresh render pixel for pixel.
+
+<Callout type="joke">
+Centering a div takes one line here: `.flex().items_center().justify_center()`. We checked. Twice.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Effects and animations" href="docs/rust/effects-and-animations/" icon="sparkles" kicker="Rust">
+ Transforms, filters, masks and motion.
+ </Card>
+ <Card title="CSS and Tailwind" href="docs/rust/css-and-tailwind/" icon="layers" kicker="Rust">
+ Every way to write the properties on this page.
+ </Card>
+ <Card title="Headless testing" href="docs/rust/headless-testing/" icon="check" kicker="Rust">
+ Assert on element bounds in a test.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/overview.mdx b/website/src/content/docs/rust/overview.mdx
new file mode 100644
index 0000000..43cb912
--- /dev/null
+++ b/website/src/content/docs/rust/overview.mdx
@@ -0,0 +1,242 @@
+---
+title: BUI for Rust
+sidebarLabel: Overview
+description: The blenderui crate gives Rust HTML, CSS, Tailwind, rsx! markup or gpui-style builders, and hooks, drawn natively with Blender's widgets. Here's the map.
+section: Rust
+order: 5
+languages: ["rust"]
+sources: ["docs/rust.md", "bindings/rust/blenderui/README.md", "bindings/rust/blenderui/src/lib.rs", "bindings/rust/blenderui/Cargo.toml", "bindings/rust/Cargo.toml", "bindings/rust/blenderui/examples/showcase.rs"]
+---
+
+You already know how to build a UI: HTML for structure, CSS for looks, a little state to make it move. **The `blenderui` crate lets you do exactly that in Rust**, and draws the result with Blender's widget code in a native window. No browser, no webview, no JavaScript engine.
+
+Write it in either of two first-class syntaxes: `rsx!`, HTML-like markup with components and hooks, or **gpui builders**, method chains like `div().flex().gap_2()` in the style of the [gpui](https://www.gpui.rs) crate. Style it with CSS, Tailwind classes or typed methods. Then decide, element by element, whether it should look like a web page or like Blender.
+
+<Figure
+ shot="rust-rsx-dashboard"
+ alt="A render-farm dashboard in Rust: a CSS grid of stat cards, job rows with Blender progress bars, a node list, a Blender dropdown, button and checkbox"
+ caption="A render-farm dashboard written with <code>rsx!</code> (<code>examples/site_dashboard.rs</code>). The builder version draws the same pixels."
+/>
+
+## What's in the crate
+
+- **Every HTML element.** All 113 elements of the WHATWG index, from `div()` to `details()` and `dialog()`, plus `svg()` and `math()` as boxes.
+- **Real CSS.** `<style>` sheets, selectors up to Level 4, the cascade, `var()`, `calc()`, flexbox, grid, tables, `@media`, `@container`, `@layer`, animations, transitions, filters and masks.
+- **Tailwind CSS v4.** `class="md:hover:bg-sky-500/50"`, or bare attributes like `<div p-4 bg-[#4772b3]>`. A typo is a compile error that suggests the fix.
+- **`rsx!` and hooks.** HTML-like markup, `#[component]` functions and hooks: `use_state`, `signal`, `Memo`, `Effect`, context.
+- **gpui builders.** `Render`, `div().flex().gap_2()`, `cx.listener(...)`. The same gpui-syntax file compiles against blenderui and the gpui crate.
+- **Blender's widgets.** `<NumberSlider>`, `<Button>`, `<ColorSwatch>` and friends are the real thing, with Blender's interaction rules and Blender's color picker.
+- **Headless testing.** Render off-screen, click, type, scroll and step animations in a normal `cargo test`.
+
+## Two ways to write the same thing
+
+Here's one counter, two spellings. Both are complete, supported ways to write a BUI app: pick whichever reads better to you, and mix them in one app if you like. The tabs remember your choice across the Rust pages.
+
+<Tabs sync="rust-syntax" label="Rust syntax">
+<Tab label="rsx!">
+
+```rust title="src/main.rs"
+use blenderui::prelude::*;
+
+#[component]
+fn counter(label: &str) {
+ let (count, set_count) = use_state(0);
+ rsx! {
+ <div flex items-center gap-3 p-4>
+ <span>{label.to_string()} ": " {count().to_string()}</span>
+ <button onClick={move || set_count(count() + 1)}>"Add one"</button>
+ </div>
+ }
+}
+
+struct Hello;
+
+impl Render for Hello {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ rsx! { <body styled><counter label="Clicks" /></body> }
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Hello)).unwrap();
+ });
+}
+```
+
+</Tab>
+<Tab label="gpui builders">
+
+```rust title="src/main.rs"
+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().styled().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();
+ });
+}
+```
+
+</Tab>
+</Tabs>
+
+- **`rsx!`** keeps state in hooks (`use_state`) inside `#[component]` functions, and listeners can leave out parameters they don't use.
+- **gpui builders** keep state in the view's fields, and `cx.listener(...)` gives the closure `&mut` access to the view; `cx.notify()` renders again.
+
+Both compile to the same calls: `rsx!` is lowered to builder methods at compile time, so there's no runtime parsing and no hidden cost. The [rsx! and components](../rsx-and-components/) page shows every markup rule, and [gpui syntax](../gpui-syntax/) covers the builder side and the app model.
+
+## Three looks, one element type
+
+Every element can look one of three ways, and you choose per subtree:
+
+1. **Plain HTML** looks like a browser: black text on white, Chrome-style form controls.
+2. **`styled`** gives an element and everything inside it Blender's theme (dark by default, or light with `blenderui::set_theme`) and Blender's widgets.
+3. **Blender components** (`Button`, `NumberSlider` …) are always Blender's widgets, wherever you put them.
+
+[The three looks](../styled-and-blender-components/) puts them side by side.
+
+## Get it running
+
+Add the crate from crates.io:
+
+```sh
+cargo add blenderui
+```
+
+The [installation page](../../start/installation/) has the details: you need Rust 1.88 or newer, CMake and a C compiler, because the first build compiles BUI's C kit. To build against another checkout of the C sources, set `BUI_SOURCE_DIR`.
+
+The examples are the fastest way to see what's possible. From a clone of the repository:
+
+```sh
+cd bindings/rust
+cargo run --release --example hello # an rsx! counter, with Tailwind and a slider
+cargo run --example showcase # the window in the screenshot
+cargo run --example showcase -- --screenshot a.png # render it off-screen to a PNG
+cargo run --example forms # the three looks side by side
+cargo run --example counter # the gpui-syntax counter
+cargo test # unit, coverage and headless tests
+```
+
+## Find your way around
+
+| Page | What you'll learn |
+| --- | --- |
+| [rsx! and components](../rsx-and-components/) | Markup, control flow, `#[component]`, props, `key` |
+| [Hooks and signals](../hooks/) | `use_state`, `signal`, `Memo`, `Effect`, context |
+| [HTML elements](../html-elements/) | All 113 elements, the one `Div` type, attributes, images |
+| [CSS and Tailwind](../css-and-tailwind/) | Four ways to style, selectors, the cascade, Tailwind, coverage |
+| [The three looks](../styled-and-blender-components/) | Browser look, `styled`, Blender components, form controls |
+| [Layout](../layout/) | Block, inline, flexbox, grid, tables, positioning, scrolling |
+| [Effects and animations](../effects-and-animations/) | Filters, blend modes, masks, transforms, keyframes, transitions |
+| [Events](../events/) | Listeners, focus, bubbling, the `Window` API, painting your own content |
+| [Headless testing](../headless-testing/) | Off-screen windows, simulated input, screenshots, a virtual clock |
+| [gpui syntax](../gpui-syntax/) | Builder syntax, the app model, entities, and how it compares to the gpui crate |
+
+## Rendering: CPU or GPU
+
+Windows draw with BUI's software raster by default. It draws in parallel bands; `BUI_RASTER_THREADS=1` forces one thread. Ask for the GPU and you get the same pixels with the rasterizing off the CPU:
+
+```rust
+Application::new().gpu(true).run(|cx| { /* every window on the GPU */ });
+// or one window:
+cx.open_window(WindowOptions { gpu: Some(true), ..Default::default() }, build);
+```
+
+- The GPU renderer is **Direct3D 11 on Windows and OpenGL 3.3 on Linux**. Elsewhere, or without a device, windows stay on the software raster.
+- `BUI_GPU=1` or `BUI_GPU=0` overrides both settings.
+- `window.is_gpu()` turns `true` a few frames in, once the device is ready.
+- Both renderers produce the same pixels; the `gpu_parity` test checks it.
+- `BUI_PROFILE=1` prints per-phase frame times for either renderer.
+
+Following Blender's instanced widget batches, every primitive becomes one instance of a single shader. Text runs and images are cached in atlases, and frames render into a persistent target, so only damaged regions redraw.
+
+## Text and fonts
+
+Text uses Blender's UI font, **Inter**, embedded in the library, so it looks the same on every platform. The default family (and `sans-serif`, `system-ui` or any unknown family) is Inter. Named families such as `"Segoe UI"` or `monospace` load from the platform's fonts. `BUI_FONT=path.ttf` replaces the default face, and you can register your own:
+
+```rust
+blenderui::add_font("Brand", false, false, include_bytes!("Brand-Regular.ttf"));
+```
+
+The two `bool`s say whether the face is bold and italic. It returns `false` if the bytes aren't a font.
+
+On the GPU, glyphs are drawn straight from their outlines with Eric Lengyel's [Slug](https://github.com/EricLengyel/Slug) algorithm: one quad per glyph, exact coverage in the pixel shader, no glyph bitmaps. The alternative is a per-glyph bitmap atlas, as Blender does it: about half the GPU work, but bitmaps per size.
+
+| | Slug (default) | Glyph atlas |
+| --- | --- | --- |
+| Build time | `slug` feature (default) | `default-features = false` |
+| Run time | `Application::new().slug(true)` or `blenderui::set_slug(true)` | `.slug(false)` or `set_slug(false)` |
+| Environment (overrides) | `BUI_SLUG=1` | `BUI_SLUG=0` |
+
+The `gdi-text` feature draws text with Windows' GDI engine and system fonts instead.
+
+## How it works
+
+```text
+ 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, native window
+```
+
+- **One implementation per property.** Every style source (methods, `css!`, `.css`, `.style`, sheets, the user-agent sheet, state refinements) becomes CSS declarations applied by one table of property handlers.
+- **Work at compile time.** The property table is a `const`. Style methods and `css!` resolve property names when your program compiles, so a typo is a compile error, and fixed values like `.flex()` are tokenized once per program.
+- **No `Rc` or `RefCell`.** A frame is a set of flat arenas linked by index, owned by the window and reused every frame. Entities are `Copy` handles into an app-owned slot map. The only shared ownership left is `Arc<Image>` for image pixels.
+- **Reuse across frames.** `render()` builds a fresh element tree each frame, but the work behind it is reused: matched selectors are memoized, computed styles are shared, and the layout tree and widget nodes are reconciled by key, so only changed subtrees are laid out again.
+- **`blenderui-sys`** is the raw FFI over the C kit's header (`kit/include/BUI_kit.h`). Its build script builds the kit with CMake and links it statically.
+
+## Limitations at a glance
+
+BUI's Rust side covers a lot, but not everything. Each page lists its own gaps; here they are in one place:
+
+- **Text:** floats place block boxes, but text doesn't wrap around them. Right-to-left text is reordered but not shaped (no Arabic joining). There's no per-glyph fallback between the faces of a `font-family` list. `text-align: justify` aligns left.
+- **Inline boxes** paint their background per word; borders and padding on inline elements (`<kbd>`, `<code>`) aren't drawn.
+- **Widgets draw above page content**, so a `z-index`ed box such as a `<dialog>` over a form field doesn't cover the field.
+- **Images** are PNG only, with nearest-neighbour scaling. `video`, `audio` and `iframe` show a placeholder.
+- **Transforms:** every 2D transform draws, but clicks use the untransformed box. 3D transforms have no effect.
+- **Tables** size columns from their widest single-line content, a simpler version of browsers' auto layout.
+- **Windows** are native on Windows (Win32), Linux (X11) and macOS (Cocoa). The Cocoa host is new and not yet tested on a Mac, and it needs the main thread. The GPU renderer runs on Windows and Linux.
+- **Components:** async resources (`use_resource`) and generic components are <ComingSoon inline />.
+
+<Callout type="joke">
+It's called `Div` because every element is one. Even `<span>`. Especially `<span>`.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="rsx! and components" href="docs/rust/rsx-and-components/" icon="layers" kicker="Rust">
+ HTML-like markup and function components, rule by rule.
+ </Card>
+ <Card title="Hooks and signals" href="docs/rust/hooks/" icon="zap" kicker="Rust">
+ State that re-renders only when it changes.
+ </Card>
+ <Card title="CSS and Tailwind" href="docs/rust/css-and-tailwind/" icon="sparkles" kicker="Rust">
+ Stylesheets, selectors, the cascade and Tailwind classes.
+ </Card>
+ <Card title="Install BUI" href="docs/start/installation/" icon="terminal" kicker="Start here">
+ <code>cargo add blenderui</code>, CMake and a C compiler.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/rsx-and-components.mdx b/website/src/content/docs/rust/rsx-and-components.mdx
new file mode 100644
index 0000000..bd4741e
--- /dev/null
+++ b/website/src/content/docs/rust/rsx-and-components.mdx
@@ -0,0 +1,379 @@
+---
+title: rsx! and components
+description: Write your UI as HTML-like markup in Rust, or as gpui-style builder chains, split it into function components with typed props, and let the compiler catch the mistakes.
+section: Rust
+order: 10
+languages: ["rust"]
+sources: ["docs/rust.md", "bindings/rust/blenderui-macros/src/rsx.rs", "bindings/rust/blenderui-macros/src/component.rs", "bindings/rust/blenderui/src/hooks.rs", "bindings/rust/blenderui/tests/rsx.rs", "bindings/rust/blenderui/tests/hooks.rs", "bindings/rust/blenderui/examples/hello.rs", "CHANGELOG.md"]
+---
+
+**`rsx!` lets you write HTML-like markup right in your Rust code**, with loops, conditions and components, and the compiler checks every piece of it.
+
+There's no runtime parser. `rsx!` is lowered to ordinary builder calls when your program compiles, so `<div class="p-4">` costs exactly what `div().class("p-4")` costs. Those builder calls are the other first-class way to write a BUI UI, **gpui builders**: method chains in the style of the gpui crate. This page shows both side by side; use whichever you prefer, or mix them. `view!` is the same macro as `rsx!` under its Leptos and zopra name.
+
+## A first taste
+
+The same to-do view, written both ways. The tabs remember your choice across the Rust pages.
+
+<Tabs sync="rust-syntax" label="Rust syntax">
+<Tab label="rsx!">
+
+```rust title="src/main.rs"
+use blenderui::prelude::*;
+
+struct Todo {
+ items: Vec<String>,
+ done: bool,
+}
+
+impl Render for Todo {
+ fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
+ let items = self.items.clone();
+ rsx! {
+ <div class="flex flex-col gap-2 p-4">
+ <h1 style="color: #e6a23c">"Today: " {items.len().to_string()} " things"</h1>
+ <ul>{for it in items { <li>{it}</li> }}</ul>
+ {if self.done { <p>all done</p> }}
+ <button onClick={cx.listener(|this, _: &ClickEvent, _, cx| {
+ this.done = true;
+ cx.notify();
+ })}>"Finish"</button>
+ </div>
+ }
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| {
+ cx.new(|_| Todo { items: vec!["Model".into(), "Render".into()], done: false })
+ }).unwrap();
+ });
+}
+```
+
+Everything inside the braces is just Rust: `{items.len().to_string()}` is an expression, `{for ...}` is a loop, `cx.listener` is the usual [listener](../events/).
+
+</Tab>
+<Tab label="gpui builders">
+
+```rust title="src/main.rs"
+use blenderui::prelude::*;
+
+struct Todo {
+ items: Vec<String>,
+ done: bool,
+}
+
+impl Render for Todo {
+ fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
+ div().class("flex flex-col gap-2 p-4")
+ .child(h1().style("color: #e6a23c").child(format!("Today: {} things", self.items.len())))
+ .child(ul().children(self.items.iter().map(|it| li().child(it.clone()))))
+ .when(self.done, |el| el.child(p().child("all done")))
+ .child(button().child("Finish").on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
+ this.done = true;
+ cx.notify();
+ })))
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| {
+ cx.new(|_| Todo { items: vec!["Model".into(), "Render".into()], done: false })
+ }).unwrap();
+ });
+}
+```
+
+Each tag is a function (`div()`, `ul()`, `li()`), each attribute a method (`.class(...)`, `.style(...)`), and `.child(...)` / `.children(...)` add what goes inside. `.when(condition, ...)` adds something only when the condition holds.
+
+</Tab>
+</Tabs>
+
+## Text and children
+
+- **Quoted text** is a child: `<h1>"Hello, " {name}</h1>`.
+- **Bare words** work too. `<p>all done</p>` becomes the text `"all done"`; the words are joined with single spaces, and punctuation sticks to the word before it. Quote anything that has to stay exact.
+- **`{expr}`** adds any value that turns into an element: text (`&'static str`, `String`, `SharedString`), an element or a component. Numbers aren't text on their own, so write `{count.to_string()}`.
+- **`{...iter}`** adds every item of an iterator: `{...self.children}`. In builder style, that's `.children(iter)`.
+
+## Attributes
+
+`rsx!` applies one uniform rule, so the whole element API is reachable from markup:
+
+| You write | It becomes |
+| --- | --- |
+| `<div>`, `<section>` … | `html::div()`, `html::section()` … |
+| `<my-widget>` | `Div::new("my-widget")`, a custom element |
+| `name="text"` | `.attr("name", "text")`, an HTML attribute |
+| `class="…"`, `style="…"`, `id="…"` | `.class(…)`, `.style(…)`, `.id(…)` |
+| `className="…"` | `.class(…)` |
+| `name={expr}` | `.name(expr)`, the builder method of that name |
+| `type={expr}` | `.input_type(expr)` |
+| `data-x={expr}`, `for={expr}` | `.attr("data-x", expr)`, `.attr("for", expr)` |
+| `disabled`, `checked`, `open` (bare) | `.attr("disabled", "")`: HTML boolean attributes stay attributes |
+| `p-4`, `hover:bg-sky-500` (bare) | Tailwind classes ([below](#tailwind-as-attributes)) |
+
+Because `name={expr}` calls *any* method, typed styling works too: `w={px(10.0)}` calls `.w(px(10.0))`, and `hover={|s| s.bg(red())}` calls `.hover(...)`. CamelCase names become snake_case: `onMouseMove` calls `.on_mouse_move`.
+
+For anything else, pass a builder closure where an attribute would go. It receives the element and returns it:
+
+```rust
+rsx! { <div {|el| el.w(px(3.0)).when(wide, |el| el.h(px(20.0)))} /> }
+```
+
+## Event handlers
+
+`onClick={...}` becomes `.on_click(...)`, and the same for every `on*` listener. Listeners take three parameters, `(event, window, cx)`, but in `rsx!` you can leave out the ones you don't need. The macro fills the rest with `_`:
+
+```rust
+rsx! {
+ <div onClick={|| println!("clicked")} /> // no parameters
+ <input onChange={|e: &ChangeEvent| println!("{}", e.value)} /> // just the event
+ <div onClick={cx.listener(|this, _: &ClickEvent, _, cx| cx.notify())} /> // a path or call: as is
+}
+```
+
+The [events page](../events/) lists every listener and its event type.
+
+## Control flow
+
+All three forms go inside braces, and their bodies can be markup directly.
+
+```rust
+rsx! {
+ <ul>{for it in items { <li>{it}</li> }}</ul>
+
+ {if count == 0 { <p>"Nothing yet"</p> } else if count == 1 { <p>"One"</p> } else { <p>"Many"</p> }}
+
+ {match mode {
+ Mode::A => <A />,
+ Mode::B => <span>"b"</span>,
+ }}
+}
+```
+
+- **`for`** maps each item to markup. The closure is `move`, so clone what you need first.
+- **`if`** without an `else` renders nothing when the condition is false.
+- **`match`** arms can be markup, a `{ block }` that ends in markup, or any expression.
+
+## Fragments
+
+`<>...</>` groups children without adding a box. It's an element with `display: contents`, so its children lay out as if they belonged to the parent. When `rsx!` contains more than one top-level node, it wraps them in a fragment for you.
+
+```rust
+rsx! {
+ <>
+ <h2>"Title"</h2>
+ <p>"Body"</p>
+ </>
+}
+```
+
+## Tailwind as attributes
+
+Tailwind utilities can be written as bare attributes. They become classes at compile time:
+
+```rust
+rsx! { <div p-4 w-1/2 bg-[#4772b3] hover:bg-sky-500/50 md:flex -mt-2 text-sm/6 /> }
+```
+
+HTML boolean attributes (`disabled`, `checked`, `hidden`, `open` …), `data-*` and `aria-*` stay attributes, even where Tailwind has a utility of the same name (`hidden`). Anything that looks like a utility but isn't one is a compile error that suggests the fix. Every Tailwind variant also works as an attribute prefix: `hover:class="..."`, `md:dark:hover:style="..."`, `active:bg={rgb(0x4772b3)}`. All of this is on the [CSS and Tailwind](../css-and-tailwind/#tailwind-attributes-in-rsx) page.
+
+## Components
+
+A **component** is a reusable piece of UI with its own inputs (**props**) and, if it likes, its own state. Put `#[component]` on a function and use it as a tag:
+
+```rust title="src/main.rs"
+use blenderui::prelude::*;
+
+#[component]
+fn counter(label: &str) {
+ let (count, set_count) = use_state(0);
+ rsx! {
+ <div flex items-center gap-3 p-4 rounded-xl bg-zinc-800>
+ <span text-zinc-300>{label.to_string()} ": " {count().to_string()}</span>
+ <div px-3 py-1 rounded-md bg-sky-700 hover:bg-sky-500 cursor-pointer
+ onClick={move || set_count(count() + 1)}>
+ "Add one"
+ </div>
+ </div>
+ }
+}
+
+struct Hello;
+
+impl Render for Hello {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ rsx! {
+ <body m-0 p-6 min-h-screen flex flex-col gap-4 bg-zinc-900 text-white>
+ <h1 text-2xl font-bold>"Hello, BUI"</h1>
+ <counter label="Clicks" />
+ <NumberSlider min={0.0} max={10.0} value="5" /> // a real Blender slider
+ </body>
+ }
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Hello)).unwrap();
+ });
+}
+```
+
+<Figure
+ src="images/rust-hello.png"
+ alt="A dark window titled Hello, BUI, with a rounded card reading Clicks: 0 next to a blue Add one button, and a Blender number slider at 5 below it"
+ caption="The code above, from <code>examples/hello.rs</code> (<code>cargo run --release --example hello</code>)."
+ width={420}
+ height={260}
+/>
+
+What `#[component]` does with your function:
+
+- **It becomes a struct with the same name.** Each parameter is a public field, so `fn counter(label: &str)` gives `struct counter { pub label: String }`, plus a props builder that `rsx!` uses.
+- **Upper- and lowercase names both work.** `fn Counter` and `fn profile` are both fine. A lowercase tag in `rsx!` that isn't an HTML element is treated as a component, so give lowercase components names that aren't HTML tags (`profile`, not `header`).
+- **`&str` props are stored as `String`**, and your function body still sees a `&str`. Other borrowed types are a compile error: "use an owned type".
+- **The body is a normal block** that ends in markup, usually an `rsx!`.
+- **Hooks and context work inside it**, scoped to that component: see [Hooks and signals](../hooks/).
+
+### Passing props
+
+- `label="Clicks"` passes a literal. Prop setters take `impl Into<T>`, so a string literal works for a `String` prop.
+- `start={1}` passes an expression. Number and `bool` props take their exact type, so integer literals infer correctly.
+- Boolean shorthand: a bare `<toggle on />` passes `true`.
+
+### Optional props
+
+Make a prop an `Option<T>` and callers may leave it out; it's `None`. `children` may be left out too.
+
+```rust
+#[component]
+fn Row(name: &str, note: Option<String>) {
+ let note = note.unwrap_or_default();
+ rsx! { <div data-note={note}>{name.to_string()}</div> }
+}
+
+// both compile:
+rsx! { <Row name="a" /> }
+rsx! { <Row name="b" note={"plain".to_string()} /> }
+```
+
+Leaving out any other prop is a compile error that names the missing one:
+
+```text
+error: a required prop is missing: ... Row_missing_name
+```
+
+### Children
+
+Add a `children: Children` prop and whatever you put between the tags arrives there. `Children` is a `Vec<AnyElement>`; spread it with `{...children}`:
+
+```rust
+#[component]
+fn Card(title: &str, children: Children) {
+ rsx! {
+ <section class="p-2">
+ <h2>{title.to_string()}</h2>
+ {...children}
+ </section>
+ }
+}
+
+rsx! { <Card title="Settings"><p>"Inside the card"</p></Card> }
+```
+
+### Keys
+
+A component's state is tied to its position among its siblings. In a list that changes, give each component a `key` so its state follows the item instead:
+
+```rust
+rsx! {
+ <ul>{for item in items { <Row key={item.id} name={item.name.clone()} /> }}</ul>
+}
+```
+
+Without keys, removing the first item hands its state to the next one. The [hooks page](../hooks/#keys-keep-state-with-the-right-item) shows it happening.
+
+### Struct components
+
+You can also write a component as a struct that implements `IntoElement`. Add `#[derive(Props)]` and `rsx!` gets the same builder: optional `Option<T>` fields, optional `children`, and the same "missing prop" errors.
+
+```rust
+#[derive(Props)]
+struct Card {
+ title: SharedString,
+ children: Vec<AnyElement>,
+}
+
+impl IntoElement for Card {
+ fn into_any_element(self) -> AnyElement {
+ rsx! {
+ <section class="p-2">
+ <h2>{self.title.clone()}</h2>
+ {...self.children}
+ </section>
+ }
+ .into_any_element()
+ }
+}
+```
+
+## Three component styles
+
+BUI speaks three dialects of the same idea. Mix them freely; they share one hook store.
+
+| Style | Looks like | State |
+| --- | --- | --- |
+| zopra | `#[component] fn profile(username: &str)`, `<profile username="Ada" />` | `let (likes, set_likes) = use_state(0)`, then `likes()` and `set_likes(..)` |
+| Hooks with dependency lists | the same components | `use_state`, `use_effect(f, deps)`, `use_memo(f, deps)` |
+| Leptos | `#[component] fn Counter(start: i32)`, `view! { ... }` | `signal`, `Memo::new`, `Effect::new`, `provide_context` |
+
+## Reusable pieces in builder style
+
+In builder style, a reusable piece of UI is a plain Rust function that returns an element. Its parameters are its props, and its state lives in the view that calls it:
+
+```rust
+fn card(title: &str, body: impl IntoElement) -> Div {
+ section().p_2().child(h2().child(title.to_string())).child(body)
+}
+
+// in render():
+div().child(card("Settings", p().child("Inside the card")))
+```
+
+Keep the state in your view's fields and pass what the piece needs as arguments; listeners made with `cx.listener(...)` update the view. The [gpui syntax](../gpui-syntax/) page covers views, entities and listeners in full. When you want a piece that carries its own hook state, write it as a `#[component]` and drop an `rsx!` into the chain: `.child(rsx! { <counter label="Clicks" /> })`.
+
+## When it doesn't compile
+
+`rsx!` reports problems as ordinary compile errors, pointing at your markup:
+
+- `rsx!: <div> closed by </span>` and `rsx!: <ul> is never closed` for mismatched tags.
+- `` rsx!: `bg-sky-50O` is not a Tailwind utility; did you mean `bg-sky-500` or `bg-sky-50` or `bg-sky-100`? `` for a misspelled utility.
+- `a required prop is missing` for a component, naming the prop.
+- `#[component]: generic components are not supported; use concrete prop types`.
+- A typed value under a variant other than `hover`, `active` or `focus` suggests `variant:class` or `variant:style` instead.
+
+And because the output is plain method calls, a wrong attribute (`<div widht={...}>`) is the compiler telling you `Div` has no method `widht`.
+
+## Limitations
+
+- Generic components (`fn list<T>(...)`) are <ComingSoon inline />. Use concrete prop types for now.
+- Async resources (`use_resource`) are <ComingSoon inline /> too; see [Hooks and signals](../hooks/#limits).
+
+## Next steps
+
+<CardGrid>
+ <Card title="Hooks and signals" href="docs/rust/hooks/" icon="zap" kicker="Rust">
+ Give your components state, effects and context.
+ </Card>
+ <Card title="HTML elements" href="docs/rust/html-elements/" icon="layers" kicker="Rust">
+ Every tag you can write, and what it draws like.
+ </Card>
+ <Card title="CSS and Tailwind" href="docs/rust/css-and-tailwind/" icon="sparkles" kicker="Rust">
+ Variant attributes, stylesheets and "did you mean" errors.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/rust/styled-and-blender-components.mdx b/website/src/content/docs/rust/styled-and-blender-components.mdx
new file mode 100644
index 0000000..37d8419
--- /dev/null
+++ b/website/src/content/docs/rust/styled-and-blender-components.mdx
@@ -0,0 +1,289 @@
+---
+title: Browser look, styled and Blender components
+sidebarLabel: The three looks
+description: Make any part of your Rust UI look like a web page or like Blender, and use Blender's real widgets as components.
+section: Rust
+order: 50
+languages: ["rust"]
+sources: ["docs/rust.md", "bindings/rust/blenderui/src/html.rs", "bindings/rust/blenderui/src/components.rs", "bindings/rust/blenderui/src/element.rs", "bindings/rust/blenderui/src/widgets.rs", "bindings/rust/blenderui/src/events.rs", "bindings/rust/blenderui/examples/forms.rs", "bindings/rust/blenderui/tests/basic_css.rs", "bindings/rust/blenderui/tests/effects.rs"]
+---
+
+Some apps should look like a web page. Some should look like Blender. Most want a bit of both: a clean document with a few Blender sliders in it. **In BUI you choose the look per element**, and the choice flows down to everything inside.
+
+<Figure
+ src="images/rust-forms.png"
+ alt="Three rows of the same form controls. Top, on white: browser-style button, text field, number field, checkbox, radio, slider, dropdown, progress bars, color picker and textarea. Middle, on dark grey: the same controls as Blender widgets. Bottom: Blender components for a button, text field, number slider and checkbox."
+ caption="The same controls three ways, from <code>examples/forms.rs</code> (<code>cargo run --example forms</code>)."
+ width={620}
+ height={620}
+/>
+
+## The three looks
+
+1. **Plain HTML** looks like a browser draws it: black text on white, 16 px, `#0000ee` underlined links, and a web browser's form controls, all in Blender's UI font, Inter.
+2. **Inside `styled`**, an element and everything in it get Blender's look: the `#303030` background, `#e6e6e6` 13 px text, blue links, dark `code` and `pre`, themed tables, fieldsets and dialogs, and Blender's widgets for the form controls.
+3. **Blender components** (`Button`, `NumberSlider`, `ColorSwatch` …) are Blender's widgets always, inside `styled` or not.
+
+Here's how `forms.rs` builds the screenshot above. One function makes the controls; the page shows it twice and then adds the components. The example is written with gpui builders; the `rsx!` tab is the same window in markup.
+
+<Tabs sync="rust-syntax" label="Rust syntax">
+<Tab label="rsx!">
+
+```rust title="src/main.rs"
+use blenderui::prelude::*;
+
+fn controls() -> impl IntoElement {
+ rsx! {
+ <div flex gap-2 items-center p-3>
+ <button>"Button"</button>
+ <input value="Text field" />
+ <input type="number" value="42" />
+ <input type="range" min={0.0} max={10.0} value="6" />
+ </div>
+ }
+}
+
+struct Forms;
+
+impl Render for Forms {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ rsx! {
+ <body m-0 flex flex-col>
+ <h3>"Plain HTML (browser look)"</h3>
+ {controls()}
+ <div styled>
+ <h3>"Inside styled (Blender look)"</h3>
+ {controls()}
+ </div>
+ <h3>"Blender components"</h3>
+ <div flex gap-2 p-3>
+ <Button>"Button"</Button>
+ <TextField value="Text" />
+ <NumberSlider min={0.0} max={10.0} value="6" />
+ <Checkbox checked={true} />
+ </div>
+ </body>
+ }
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Forms)).unwrap();
+ });
+}
+```
+
+</Tab>
+<Tab label="gpui builders">
+
+```rust title="examples/forms.rs (shortened)"
+use blenderui::prelude::*;
+
+fn controls() -> Div {
+ div().flex().gap_2().items_center().p_3()
+ .child(button().child("Button"))
+ .child(input().value("Text field"))
+ .child(input().input_type("number").value("42"))
+ .child(input().input_type("range").min(0.0).max(10.0).value("6"))
+}
+
+struct Forms;
+
+impl Render for Forms {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ body().m_0().flex().flex_col()
+ .child(h3().child("Plain HTML (browser look)"))
+ .child(controls())
+ .child(div().styled().child(h3().child("Inside styled (Blender look)")).child(controls()))
+ .child(h3().child("Blender components"))
+ .child(div().flex().gap_2().p_3()
+ .child(Button().child("Button"))
+ .child(TextField().value("Text"))
+ .child(NumberSlider().min(0.0).max(10.0).value("6"))
+ .child(Checkbox().checked(true)))
+ }
+}
+
+fn main() {
+ Application::new().run(|cx| {
+ cx.open_window(WindowOptions::default(), |_, cx| cx.new(|_| Forms)).unwrap();
+ });
+}
+```
+
+</Tab>
+</Tabs>
+
+## Blender's look with styled
+
+Mark an element `styled` and it, and everything inside it, switches to Blender's built-in stylesheet:
+
+<Tabs sync="rust-syntax" label="Rust syntax">
+<Tab label="rsx!">
+
+```rust
+rsx! { <div styled class="p-4">"Blender look"</div> }
+rsx! { <div styled><div styled="false">"Browser look again"</div></div> } // opt a subtree back out
+```
+
+</Tab>
+<Tab label="gpui builders">
+
+```rust
+div().styled().p_4().child("Blender look")
+div().styled().child(div().attr("styled", "false").child("Browser look again")) // opt a subtree back out
+```
+
+</Tab>
+</Tabs>
+
+- **Your own CSS still wins** over either set of defaults. `styled` only swaps the user-agent stylesheet underneath.
+- **`styled="false"`** turns it back off for a subtree.
+- **What changes:** besides the background, text color and size, `styled` gives `pre` a dark padded block, `blockquote` a blue left bar, `kbd` a border, `mark` Blender's orange, `thead` a darker row, `fieldset` and `dialog` Blender's greys and rounded corners, and `hr` a thin grey line.
+
+Want the whole window in Blender's look? Put `styled` on the root element, as the showcase example does with `html().styled()`.
+
+<Compare left="Plain HTML" right="Inside styled">
+ <div slot="left">
+
+<Figure
+ shot="rust-html-plain"
+ alt="An export form and a table with a browser's default look"
+ caption="<code>examples/site_plain_html.rs</code>"
+/>
+
+ </div>
+ <div slot="right">
+
+<Figure
+ shot="rust-html-styled"
+ alt="The same form and table in Blender's theme, with Blender's widgets"
+ caption="<code>examples/site_styled.rs</code>: the same markup"
+/>
+
+ </div>
+</Compare>
+
+## Blender components
+
+These ten components are Blender's widgets, wherever you put them:
+
+| Component | What you get | Same element as |
+| --- | --- | --- |
+| `Button` | Blender's push button | `button()` |
+| `Checkbox` | Blender's checkbox | `input type="checkbox"` |
+| `Radio` | Blender's radio button, grouped by `name` | `input type="radio"` |
+| `NumberField` | A number field: drag to change, click to step, double-click to type | `input type="number"` |
+| `NumberSlider` | A number slider: the field fills with the value | `input type="range"` |
+| `TextField` | A single-line text field | `input type="text"` |
+| `TextArea` | A multi-line text editor | `textarea()` |
+| `ColorSwatch` | A color swatch that opens Blender's color picker | `input type="color"` |
+| `Dropdown` | A dropdown menu; options are `option()` children | `select()` |
+| `ProgressBar` | A progress bar (`value`, `max`) | `progress()` |
+
+Each one *is* the element it stands for, so every element method and attribute works on it: `min`, `max`, `step`, `value`, `checked`, `placeholder`, `disabled`, `on_change`, `on_click`, styling and so on.
+
+<Tabs sync="rust-syntax" label="Rust syntax">
+<Tab label="rsx!">
+
+```rust
+rsx! {
+ <NumberSlider min={0.0} max={10.0} value="2.5" onChange={|e: &ChangeEvent| println!("{:?}", e.number)} />
+ <Button onClick={|| println!("apply")}>"Apply"</Button>
+ <Dropdown><option>"Cube"</option><option>"Sphere"</option></Dropdown>
+}
+```
+
+</Tab>
+<Tab label="gpui builders">
+
+```rust
+div()
+ .child(NumberSlider().min(0.0).max(10.0).value("2.5")
+ .on_change(|e: &ChangeEvent, _, _| println!("{:?}", e.number)))
+ .child(Button().child("Apply").on_click(|_, _, _| println!("apply")))
+ .child(Dropdown().child(option().child("Cube")).child(option().child("Sphere")))
+```
+
+In builder style the components are functions with capitalized names. Listeners take all three parameters, `(event, window, cx)`.
+
+</Tab>
+</Tabs>
+
+<Figure
+ shot="rust-components"
+ alt="Camera properties built from Blender components: NumberField, NumberSlider, Dropdown, Checkbox, TextField, ColorSwatch, ProgressBar and Button"
+ caption="Blender components from Rust (<code>examples/site_components.rs</code>)."
+/>
+
+## Form controls
+
+Outside `styled`, form elements look and behave like a web browser's: its colors and shapes, typed number fields with spin buttons, a range thumb that jumps to the click. Inside `styled`, and as Blender components, they're Blender's widgets with Blender's interaction rules: drag a number to change it, double-click to type (number fields also take math such as `2*pi`), <Kbd keys="Ctrl+Z" /> to undo, <Kbd>Esc</Kbd> to cancel.
+
+| HTML | Blender widget | What `ChangeEvent` carries |
+| --- | --- | --- |
+| `button()` with text, or `input()` of type `submit`, `button` or `reset` | Button | (use `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` (the index), `value` (the text) |
+| `textarea()` | Multi-line text editor | `value` |
+| `progress()`, `meter()` | Progress bar | (display only) |
+
+### Reading and controlling values
+
+`on_input` and `on_change` both fire when the value changes. Each gets a `ChangeEvent { value, checked, number }`:
+
+<Tabs sync="rust-syntax" label="Rust syntax">
+<Tab label="rsx!">
+
+```rust
+rsx! {
+ <input id="vol" type="range" min={0.0} max={100.0} value={format!("{}", self.volume)}
+ onInput={cx.listener(|this, e: &ChangeEvent, _, cx| {
+ this.volume = e.number;
+ cx.notify();
+ })} />
+}
+```
+
+</Tab>
+<Tab label="gpui builders">
+
+```rust
+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();
+ }))
+```
+
+</Tab>
+</Tabs>
+
+- **Values you pass are pushed to the widget only when they change between renders.** A field the user is typing in isn't reset under their fingers.
+- **To control a field**, keep its value in your state and update it from `on_change`, as above. Give it an `.id(...)` so it keeps its identity across renders.
+- **A `button()` holding elements other than text** is laid out as an ordinary box (style it with CSS) and still gets `on_click`.
+
+<Callout type="warning" title="Widgets sit on top">
+Form widgets draw above page content. A `z-index`ed box, such as a `<dialog>`, over a form field doesn't cover the field.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Events" href="docs/rust/events/" icon="zap" kicker="Rust">
+ Every listener and what its event carries.
+ </Card>
+ <Card title="Blender's widgets in depth" href="docs/concepts/blender-widgets/" icon="sparkles" kicker="Concepts">
+ Scrubbing, snapping, drag-toggle and undo.
+ </Card>
+ <Card title="CSS and Tailwind" href="docs/rust/css-and-tailwind/" icon="layers" kicker="Rust">
+ Style the widgets and everything around them.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/start/installation.mdx b/website/src/content/docs/start/installation.mdx
new file mode 100644
index 0000000..2536312
--- /dev/null
+++ b/website/src/content/docs/start/installation.mdx
@@ -0,0 +1,176 @@
+---
+title: Install BUI
+sidebarLabel: Installation
+description: Get BUI for Python, Rust, JavaScript, C or Dear ImGui. Most people are one command away from a Blender-style window.
+section: Start here
+order: 20
+languages: ["python", "rust", "javascript", "c", "imgui"]
+sources: ["README.md", "docs/getting-started.md", "docs/rust.md", "docs/javascript.md", "docs/imgui.md", "docs/c-api.md", "pyproject.toml"]
+---
+
+Good news first: for Python and JavaScript, installing BUI is one command. Rust is one line in `Cargo.toml`, and C is a normal CMake build.
+
+Pick your language below. The page remembers your choice, so every other page shows the same tab.
+
+## Install
+
+<LangTabs>
+<Tab label="Python">
+
+You need **CPython 3.11 or newer**. Wheels are published for Windows, Linux and macOS, so there's nothing to compile.
+
+```sh
+pip install blenderui
+```
+
+That one package gives you all four Python APIs: tkinter syntax, Qt syntax, the Blender components and Dear ImGui.
+
+Check that it worked:
+
+```sh
+python -c "import blenderui; print(blenderui.__version__)"
+```
+
+<Callout type="note" title="blenderui or bui?">
+The package on PyPI is `blenderui`, and that's the name to import. You'll also see `import bui` in older examples: it's the same code under its original name. An unrelated project owns `bui` on PyPI, so prefer `blenderui` in anything you publish.
+</Callout>
+
+</Tab>
+<Tab label="Rust">
+
+The crate is on [crates.io](https://crates.io/crates/blenderui) as `blenderui`:
+
+```sh
+cargo add blenderui
+```
+
+Or add it to `Cargo.toml` by hand:
+
+```toml title="Cargo.toml"
+[dependencies]
+blenderui = "0.1"
+```
+
+The first build compiles BUI's C kit for you, so you need:
+
+- **Rust 1.88 or newer** (the workspace uses edition 2024).
+- **CMake** and a **C compiler**. On Windows, the default Rust target uses MSVC, so install the Visual Studio Build Tools.
+- On **Linux**, the X11 headers: `libx11-dev` (Debian, Ubuntu) or `libX11-devel` (Fedora). No GL headers are needed.
+
+Try the bundled examples from a clone of the repository:
+
+```sh
+cd bindings/rust
+cargo run --release --example hello
+```
+
+</Tab>
+<Tab label="JavaScript">
+
+You need **Node.js 18 or newer**, or **Bun**. For React:
+
+```sh
+npm install @blender-ui/react react
+# or
+bun add @blender-ui/react react
+```
+
+For the DOM-like API without React:
+
+```sh
+npm install @blender-ui/native
+```
+
+<Callout type="warning" title="Prebuilt for Windows x64">
+The npm packages include a prebuilt native addon for **Windows x64**. On **Linux**, build the addon from source (below); windows are native there too. On **macOS**, JavaScript runs headless for now, because macOS only allows windows on the main thread and BUI runs its own UI thread under Node.
+</Callout>
+
+To build the addon from a clone (Linux, or to hack on BUI), you need what the Rust crate needs: Rust, CMake and a C compiler.
+
+```sh
+cd bindings
+npm install # links the two packages (npm workspaces)
+npm run build # builds the native addon in release mode
+```
+
+</Tab>
+<Tab label="C">
+
+Build from source with CMake. You need **CMake 3.20 or newer** and a **C11 / C++20 compiler** (MSVC, GCC or MinGW-w64, or Clang). On Linux, also the X11 headers.
+
+```sh
+git clone https://github.com/ppmpreetham/BUI && cd BUI
+cmake -S . -B build
+cmake --build build -j 2
+ctest --test-dir build # optional: run the test suites
+```
+
+To use the kit in your own CMake project, add BUI as a subdirectory and link `bui::kit`:
+
+```cmake title="CMakeLists.txt"
+add_subdirectory(BUI)
+target_link_libraries(myapp PRIVATE bui::kit)
+```
+
+Then `#include "BUI_kit.h"`. The hello-world is `examples/kit_hello.c`; build it with `-DBUI_BUILD_EXAMPLES=ON`.
+
+<Callout type="tip">
+The Python bindings build by default too, if CMake finds Python's development headers. Turn them off with `-DBUI_BUILD_PYTHON_BINDINGS=OFF` if you only want C.
+</Callout>
+
+</Tab>
+<Tab label="Dear ImGui">
+
+BUI runs the **real Dear ImGui** (1.93), so existing ImGui code compiles unchanged. Pick your language:
+
+- **Python** comes with `pip install blenderui`. Import it as `blenderui.imgui`. The very first wheels (0.1.0) were published before it; if the import fails, upgrade with `pip install -U blenderui`.
+- **C++**: build BUI with CMake (see the C tab) and link `bui::imgui`. You include `imgui.h` and `imgui_impl_bui.h`. The CMake option `BUI_BUILD_IMGUI` is on whenever a C++ compiler is present.
+- **C**: the same build gives you `cimgui.h` and `cimgui_impl_bui.h` (CMake target `bui_cimgui`).
+- **Rust**: add the `blenderui-imgui` crate. It isn't on crates.io yet (only `blenderui` is), so take it from the repository as a git dependency:
+
+```toml title="Cargo.toml"
+[dependencies]
+blenderui-imgui = { git = "https://github.com/ppmpreetham/BUI" }
+```
+
+Want ImGui's widgets to *be* Blender's widgets? Build with `-DBUI_IMGUI_BLENDER_WIDGETS=ON` in CMake, or enable the `blender-widgets` feature of `blenderui-imgui` in Rust. The rest of the ImGui API is unchanged.
+
+</Tab>
+</LangTabs>
+
+## Platform notes
+
+| | Windows | Linux | macOS |
+| --- | --- | --- | --- |
+| Window | Native (Win32) | Native (X11; Wayland through XWayland) | Native (Cocoa), experimental |
+| Python wheels | Yes | Yes | Yes |
+| Rust | Yes | Yes | Yes, experimental |
+| JavaScript and React | Yes, prebuilt | Yes, build the addon | Headless for now |
+| C, C++, Dear ImGui | Yes | Yes | Yes, experimental |
+| GPU renderer | Direct3D 11 | OpenGL 3.3 | Not yet: CPU raster |
+
+"Experimental" means written but not yet run on a real Mac.
+
+- **macOS** <Badge tone="preview">Experimental</Badge>: the Cocoa window host is a port of Blender's own Cocoa code. It's written but hasn't run on a real Mac yet. Python can use the standard Tk window instead: set `BUI_HOST=tk` (this needs Python's `tkinter`, for example from python.org or `brew install python-tk`).
+- **Linux**: libX11 and libGL load when the first window opens, so BUI imports and renders headless on servers and in containers without them. Where OpenGL is missing, it falls back to the CPU renderer.
+- **HiDPI**: BUI follows the display's scale (per-monitor DPI on Windows, `Xft.dpi` on Linux, Retina on macOS). To force a scale, set `BUI_UI_SCALE=1.5`.
+
+## If something goes wrong
+
+| Symptom | Fix |
+| --- | --- |
+| `ImportError: buipy` | You're probably running from a source checkout without a build. Build first (`cmake --build build`), or set `BUIPY_BUILD_DIR`. The extension must match your Python version. |
+| The window never appears | Start the event loop: `mainloop()`, `app.exec()` or `App.run()`. |
+| Blurry or tiny UI | Set `BUI_UI_SCALE`, for example `BUI_UI_SCALE=1.25`. |
+| `gpu=True` does nothing | Run with `BUI_GPU_DEBUG=1` to see why the GPU device didn't start. Without Direct3D 11 or OpenGL 3.3, BUI stays on the CPU renderer, which draws the same pixels. |
+
+## Next steps
+
+<CardGrid>
+ <Card title="Build your first app" href="docs/tutorials/first-app-python/" icon="sparkles" kicker="Tutorial">
+ A Blender-style panel in Python, explained line by line.
+ </Card>
+ <Card title="See what's coming" href="docs/project/roadmap/" icon="flag" kicker="Project">
+ macOS testing, WebAssembly and more.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/start/introduction.mdx b/website/src/content/docs/start/introduction.mdx
new file mode 100644
index 0000000..5c14634
--- /dev/null
+++ b/website/src/content/docs/start/introduction.mdx
@@ -0,0 +1,98 @@
+---
+title: Welcome to BUI
+sidebarLabel: Introduction
+description: BUI is Blender's user interface as a standalone library. Here's what that means, who it's for, and where to start.
+section: Start here
+order: 10
+sources: ["README.md", "ARCHITECTURE.md", "docs/getting-started.md"]
+---
+
+If you've ever dragged a number in Blender, watched the cursor vanish, and felt the value glide under your hand, you already know what BUI is for. **BUI takes Blender's interface out of Blender and puts it in your app.**
+
+You keep writing UI the way you like: tkinter, Qt-style Python, Rust, React, Dear ImGui or plain C. BUI draws it with Blender's widgets and gives it Blender's interaction rules. No Blender install needed.
+
+<Figure
+ shot="python-components"
+ alt="A real BUI window: a Render Properties editor with a menu bar, side tabs, collapsible panels and sub-panels, number fields, sliders, dropdowns, a color swatch and a progress bar"
+ caption="A real BUI window, built with the Blender components from Python (<code>examples/site/render_props.py</code>)."
+/>
+
+## What BUI is
+
+BUI is a **UI library**: code that draws buttons, fields and panels in a window and tells your program when someone uses them.
+
+At its heart is the **kit**, a small runtime written in C. The kit holds every widget in one tree, lays them out, handles the mouse and keyboard, and draws them the way Blender does. The drawing code is a C port of Blender's own widget code, and the interaction follows Blender's rules.
+
+On top of the kit sit **bindings**: thin layers that let other languages talk to it. Your code builds the widget tree and handles callbacks. Everything else (layout, input, drawing, putting pixels on screen) happens in fast native code.
+
+## Who it's for
+
+- **You have a tkinter app** and wish it looked less like 1998. Run it on BUI, unchanged.
+- **You're building a tool for artists**, and they already know Blender. Give them the panels, sliders and shortcuts their hands expect.
+- **You write Rust or React** and want a native desktop UI without shipping a browser.
+- **You use Dear ImGui** and want it to look and feel like Blender, with one build flag.
+- **You're curious** how a UI toolkit works. The source is readable, and the [Concepts](#how-it-works-in-one-minute) are explained in plain words.
+
+You don't need to know Blender to use BUI. If you do, you'll feel at home.
+
+## The many ways in
+
+Every row below drives the same C kit, so they all get the same widgets and interactions.
+
+<StatusTable columns={["You write", "Status", "You get"]} rows={[
+ ["<strong>tkinter</strong>, even existing programs", "done", "Every tkinter and ttk API, in Blender's look"],
+ ["<strong>Qt-style Python</strong> (<code>QWidget</code>, layouts, <code>clicked.connect</code>)", "partial", "The common subset of Qt widgets"],
+ ["<strong>Blender components</strong> (<code>Panel</code>, <code>NumberSlider</code>, <code>PieMenu</code> …)", "done", "45 native Blender widgets and editors from Python"],
+ ["<strong>Rust</strong> with HTML, CSS, Tailwind, <code>rsx!</code> or gpui-style builders, and hooks", "done", "A web-like framework, drawn natively"],
+ ["<strong>JavaScript or React</strong> on Node.js or Bun", "done", "The same engine, with React's hooks backed by signals"],
+ ["<strong>Dear ImGui</strong> from C++, C, Python or Rust", "done", "The real Dear ImGui, in Blender's theme or with Blender's widgets"],
+ ["<strong>C</strong> (<code>BUI_kit.h</code>)", "done", "The kit itself"],
+]} />
+
+Not sure which to pick? If you already have code, use the row that matches it. If you're starting fresh in Python, the Blender components are the friendliest: the [first-app tutorial](../../tutorials/first-app-python/) uses them.
+
+## What it feels like
+
+These come from Blender and work in every API:
+
+- **Drag to scrub.** Press a number field and drag sideways. The cursor hides and wraps, so you never hit the screen edge. <Kbd>Shift</Kbd> slows it down, <Kbd>Ctrl</Kbd> snaps.
+- **Math in number fields.** Click a Blender number field and type `2*pi` or `90/4`.
+- **Drag across checkboxes** to set them all in one stroke.
+- **Pie menus and menu search.** Typing "ad cu" finds "Add Cube".
+- **Undo everywhere.** <Kbd keys="Ctrl+Z" /> and <Kbd keys="Ctrl+Shift+Z" /> work on every UI edit.
+
+<Callout type="joke">
+BUI is Blender's UI, minus the default cube. You're free to add your own; we won't judge.
+</Callout>
+
+## How it works, in one minute
+
+1. **Your code** (in any language above) creates widgets and says what happens when they change.
+2. **The kit** keeps them in one tree, lays them out and handles input, following Blender's rules.
+3. **The renderer** draws them, on the CPU by default or on the GPU if you ask (Direct3D 11 on Windows, OpenGL 3.3 on Linux).
+4. **Damage rendering** keeps it cheap: a change redraws only the rectangle it touched, and an idle window uses no CPU at all.
+
+## What BUI is not
+
+- **Not Blender.** It contains the parts of Blender's UI code it needs and builds on its own. You don't need Blender installed.
+- **Not a browser.** The Rust and JavaScript sides use HTML and CSS as a *UI language*, but there's no browser engine, no webview and no network.
+- **Not a re-imagining.** The widget drawing is ported from Blender's `interface_widgets.cc`, and Dear ImGui support runs the real Dear ImGui.
+
+BUI is derived from Blender's source code, so it shares Blender's license: GPL-2.0-or-later.
+
+## Where to next
+
+<CardGrid>
+ <Card title="Install BUI" href="docs/start/installation/" icon="terminal" kicker="Start here">
+ One command for Python, Rust and JavaScript; CMake for C.
+ </Card>
+ <Card title="Your first app" href="docs/tutorials/first-app-python/" icon="sparkles" kicker="Tutorial">
+ Build a Blender-style panel in Python, one line at a time.
+ </Card>
+ <Card title="Roadmap" href="docs/project/roadmap/" icon="flag" kicker="Project">
+ What works today, what's partial, and what's coming next.
+ </Card>
+ <Card title="BUI on GitHub" href="https://github.com/ppmpreetham/BUI" icon="github" kicker="Source">
+ Read the code, run the examples, open an issue.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/tutorials/first-app-c.mdx b/website/src/content/docs/tutorials/first-app-c.mdx
new file mode 100644
index 0000000..f6b9e11
--- /dev/null
+++ b/website/src/content/docs/tutorials/first-app-c.mdx
@@ -0,0 +1,175 @@
+---
+title: Your first app, in C
+sidebarLabel: First app (C)
+description: "Read kit_hello.c line by line (a slider and a button in a native window) and learn the kit's five ideas: nodes, properties, geometry managers, the host and the window loop."
+section: Tutorials
+order: 70
+languages: ["c"]
+badges: ["20 minutes", "Intermediate"]
+sources: ["docs/c-api.md", "examples/kit_hello.c", "examples/CMakeLists.txt", "kit/include/BUI_kit.h", "docs/getting-started.md"]
+---
+
+Every BUI app, whatever language it's written in, ends up as calls into one small C library: the **kit**. Using it directly is the most hands-on way to see how BUI works, and it's what you'd use to bring BUI to a new language.
+
+This tutorial reads `examples/kit_hello.c` from top to bottom. It's about 60 lines, and it shows the five ideas the whole kit is built on.
+
+<Callout type="note" title="What you need">
+A clone of the repository, CMake 3.20 or newer and a C11 / C++20 compiler (MSVC, GCC or MinGW-w64, or Clang). On Linux, also the X11 headers. See [installation](../../start/installation/).
+</Callout>
+
+## Build and run it
+
+```sh
+cmake -S . -B build -DBUI_BUILD_EXAMPLES=ON
+cmake --build build --target bui_kit_hello
+```
+
+Then run `bui_kit_hello` from the build folder. A small window opens with a **Size** slider and an **Apply** button. Drag the slider and watch your terminal: every change prints a line, and so does each click.
+
+<Figure
+ src="images/c-kit-hello.png"
+ alt="A small dark window with a Size slider at 2.500 and an Apply button below it"
+ caption="The nodes from <code>kit_hello.c</code>, rendered headless at 320 × 120. (Made with the same kit calls, rendered headless without compiling the example.)"
+ width={320}
+ height={120}
+/>
+
+## The code, line by line
+
+<Steps>
+
+1. **Include the header.**
+
+ ```c
+ #include <stdio.h>
+ #include "BUI_kit.h"
+ ```
+
+ `BUI_kit.h` is the whole public API, and it doubles as the reference: every function has a one-line comment. In CMake, linking `bui::kit` gives you the header and the library.
+
+2. **Write an event callback.**
+
+ ```c
+ static void on_event(void *data, BKNode *node, int kind, void *ref, double a, double b)
+ {
+ if (kind == BK_EV_CLICK) {
+ printf("clicked %s\n", BK_get_str(node, "text"));
+ }
+ else if (kind == BK_EV_CHANGE) {
+ printf("%s = %g\n", BK_get_str(node, "label"), BK_get_num(node, "value"));
+ }
+ }
+ ```
+
+ The kit tells you about everything through **one function**. `node` is the widget it's about, and `kind` says what happened: `BK_EV_CLICK` for a button, `BK_EV_CHANGE` when a value changed. Others include `BK_EV_CALL` (a menu item or hotkey), `BK_EV_RENAME` and `BK_EV_SUBMIT`. `a`, `b` and `ref` carry extra details for some kinds.
+
+3. **Create the root node.**
+
+ ```c
+ BKNode *root = BK_node_new("frame");
+ BK_set_num(root, "padding", 8);
+ ```
+
+ Idea one, **nodes**: everything on screen is a node, made by type name. A `frame` is a container. Others are `slider`, `button`, `checkbox`, `text`, `panel`, `tree`, `canvas` and many more; the header lists them all.
+
+ Idea two, **properties**: you configure nodes by name, with `BK_set_num`, `BK_set_str`, `BK_set_color` and `BK_set_strs`, and read them back with `BK_get_*`. Here, 8 pixels of padding.
+
+4. **Add a slider, packed.**
+
+ ```c
+ BKNode *size = BK_node_new("slider");
+ BK_set_str(size, "label", "Size");
+ BK_set_num(size, "min", 0);
+ BK_set_num(size, "max", 10);
+ BK_set_num(size, "value", 2.5);
+ BK_node_add(root, size, -1); /* -1: append */
+ BK_geom_set_manager(size, BK_GEOM_PACK); /* Tk's packer */
+ BK_geom_set(size, "fill", 1); /* fill x */
+ ```
+
+ - `BK_node_add(parent, child, index)` puts the slider in the frame; `-1` appends.
+ - Idea three, **geometry managers**: a child of a frame is placed by a manager, exactly as in Tk. `BK_GEOM_PACK` is a C port of Tk's packer; `BK_GEOM_GRID` and `BK_GEOM_PLACE` are the other two.
+ - `BK_geom_set` sets the manager's options by name. For the packer, `fill` is 1 for x, 2 for y and 3 for both.
+
+5. **Add a button.**
+
+ ```c
+ BKNode *apply = BK_node_new("button");
+ BK_set_str(apply, "text", "Apply");
+ BK_node_add(root, apply, -1);
+ BK_geom_set_manager(apply, BK_GEOM_PACK);
+ BK_geom_set(apply, "fill", 1);
+ BK_geom_set(apply, "pady0", 6);
+ ```
+
+ The same pattern. `pady0` is the padding above the button (`pady1` would be below), so it sits 6 pixels under the slider.
+
+6. **Make a context and connect your callback.**
+
+ ```c
+ BKContext *ctx = BK_context_new(root);
+ BKHost host = {0};
+ host.emit = on_event;
+ BK_context_set_host(ctx, &host);
+ ```
+
+ Idea four, **the context and the host**. A `BKContext` owns a tree's live state: input, hover, focus, popups and undo. The `BKHost` is how the context talks back to whoever runs it: `emit` for events, plus `request` (please render), `set_cursor`, `warp`, the clipboard and `schedule` for timers.
+
+ You only fill in `emit`. The window you're about to open supplies the rest, and keeps your `emit`.
+
+7. **Open a window and run the loop.**
+
+ ```c
+ if (BK_window_supported()) {
+ BKWindow *win = BK_window_new(ctx, "BUI from C", 320, 120);
+ BK_window_show(win);
+ BK_window_run();
+ BK_window_free(win);
+ }
+ ```
+
+ Idea five, **the window loop**. `BK_window_new` puts the context in a native window: Win32 on Windows, X11 on Linux, Cocoa on macOS (still experimental). `BK_window_run` handles messages until every window is closed. From then on, input goes in, frames come out, and only the changed parts of the window are redrawn, all without leaving C.
+
+8. **Or render without a window.**
+
+ ```c
+ else {
+ BuiRaster *r = BUI_raster_create(320, 120);
+ BK_render(ctx, r, 320, 120, 1);
+ BUI_raster_free(r);
+ }
+ ```
+
+ Where there's no window system, the example renders one frame into a **raster**, an image in memory. `BK_render(ctx, raster, w, h, full)` returns how many regions it redrew; 0 means nothing changed. This is also how you'd test a UI or take a screenshot.
+
+9. **Clean up.**
+
+ ```c
+ BK_context_free(ctx);
+ BK_node_free(root);
+ return 0;
+ ```
+
+ Free the context first, then the tree.
+
+</Steps>
+
+## Going further
+
+- **Drive input yourself.** Without a window, feed the context with `BK_press`, `BK_motion`, `BK_release`, `BK_key` and `BK_wheel`, then call `BK_render`. That's how BUI's own tests work.
+- **Use the GPU.** Call `BUI_gpu_set_default(1)` before opening windows, or `BK_window_set_gpu(win, 1)` for one window. Or set `BUI_GPU=1` without changing code.
+- **Draw your own widget.** A `custom` node draws and handles input itself. Dear ImGui runs on BUI that way.
+
+## Next steps
+
+<CardGrid>
+ <Card title="The C API" href="docs/c/c-api/" icon="book" kicker="C & C++">
+ Every concept in the kit, with the functions that go with it.
+ </Card>
+ <Card title="Embedding BUI" href="docs/c/embedding/" icon="layers" kicker="C & C++">
+ Draw BUI inside your own renderer with render sinks.
+ </Card>
+ <Card title="Dear ImGui" href="docs/tutorials/first-app-imgui/" icon="sparkles" kicker="Tutorial">
+ Prefer immediate mode? Run the real Dear ImGui on the same kit.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/tutorials/first-app-imgui.mdx b/website/src/content/docs/tutorials/first-app-imgui.mdx
new file mode 100644
index 0000000..5b59385
--- /dev/null
+++ b/website/src/content/docs/tutorials/first-app-imgui.mdx
@@ -0,0 +1,157 @@
+---
+title: Your first app, with Dear ImGui
+sidebarLabel: First app (Dear ImGui)
+description: Run the real Dear ImGui on BUI from Python and C++, in Blender's theme, then switch on Blender's widgets with one build flag.
+section: Tutorials
+order: 60
+languages: ["imgui", "python", "cpp"]
+badges: ["10 minutes"]
+sources: ["docs/imgui.md", "examples/imgui_demo.cpp", "bindings/python/bui/imgui.py", "bindings/imgui/CMakeLists.txt", "bindings/imgui/blender/README.md", "CMakeLists.txt", "pyproject.toml"]
+---
+
+Dear ImGui is a popular immediate-mode UI library for tools, editors and debug panels. BUI runs **the real Dear ImGui**, not a look-alike, so your existing ImGui code works unchanged. What changes is everything around it: BUI gives it a native window, draws it with its own renderers, and dresses it in Blender's theme and font.
+
+In this tutorial you'll write a small ImGui window in Python, run ImGui's famous demo from C++, and then see the build where ImGui's widgets **become** Blender's widgets.
+
+<Callout type="note" title="Immediate mode in one paragraph">
+In an **immediate-mode** UI you don't build a tree of widget objects. Instead, a function runs every frame and *calls* the widgets: `if imgui.button("Save"): save()`. The call draws the button and tells you, right there, whether it was clicked. Your own variables are the state.
+</Callout>
+
+## Python: a window in 20 lines
+
+You need `pip install blenderui` ([installation](../../start/installation/)); Dear ImGui comes with it.
+
+<Steps>
+
+1. **Write a frame function.**
+
+ ```py title="imgui_hello.py"
+ import blenderui.imgui as imgui
+
+ state = {"value": 0.5, "name": "Suzanne", "color": (0.28, 0.45, 0.70),
+ "clicks": 0, "demo": False}
+
+ def frame():
+ if state["demo"]:
+ imgui.show_demo_window()
+ imgui.begin("Hello")
+ _, state["value"] = imgui.slider_float("Value", state["value"], 0.0, 1.0)
+ _, state["name"] = imgui.input_text("Name", state["name"])
+ _, state["color"] = imgui.color_edit3("Color", state["color"])
+ if imgui.button("Click me"):
+ state["clicks"] += 1
+ imgui.same_line()
+ imgui.text("clicked %d times" % state["clicks"])
+ _, state["demo"] = imgui.checkbox("Show the demo window", state["demo"])
+ imgui.end()
+
+ if __name__ == "__main__":
+ imgui.run(frame, title="Hello, ImGui", size=(800, 600))
+ ```
+
+2. **Run it.**
+
+ ```sh
+ python imgui_hello.py
+ ```
+
+ Drag the slider, type a name, click the color to open ImGui's picker, and tick the checkbox to open ImGui's whole demo window.
+
+</Steps>
+
+<Figure
+ src="images/imgui-python-hello.png"
+ alt="An ImGui window titled Hello in Blender's dark theme: a Value slider at 0.500, a Name field with Suzanne, a Color row with red, green and blue fields and a swatch, a Click me button, and a Show the demo window checkbox"
+ caption="<code>imgui_hello.py</code>, rendered headless: Dear ImGui's own widgets in Blender's theme and font."
+ width={420}
+ height={210}
+/>
+
+How the Python API reads:
+
+- **Functions are snake_case**: `ImGui::SliderFloat` is `imgui.slider_float`.
+- **In/out values come back**: you pass the current value and get `(changed, new_value)`. That's the pyimgui convention, so pyimgui code ports easily.
+- **`imgui.run(frame, ...)`** opens a BUI window, creates the ImGui context, and calls `frame()` inside each ImGui frame until you close it. If `frame` raises, the window closes and the exception comes out of `run`.
+- **Printf-style functions take one string**: `imgui.text("%d items" % n)`.
+
+## C++: the classic demo
+
+ImGui users know `ShowDemoWindow()`. Here it is on BUI:
+
+```cpp title="main.cpp"
+#include "imgui.h"
+#include "imgui_impl_bui.h"
+
+static void frame(void*) { ImGui::ShowDemoWindow(); }
+
+int main() {
+ ImGui::CreateContext();
+ ImGui_ImplBUI_App* app = ImGui_ImplBUI_CreateApp("Dear ImGui on BUI", 1280, 800, frame, nullptr);
+ ImGui_ImplBUI_RunApp(app); // BUI's message loop until the window closes
+ ImGui_ImplBUI_DestroyApp(app);
+ ImGui::DestroyContext();
+}
+```
+
+- `imgui.h` is Dear ImGui's own header. `imgui_impl_bui.h` is BUI's **backend**: the piece that connects ImGui to a window and a renderer.
+- `ImGui_ImplBUI_CreateApp` opens a window and calls your `frame` function for each ImGui frame. The last argument is a pointer that's handed back to `frame`, for your state.
+- In CMake, link `bui::imgui`.
+
+The repository's fuller version is `examples/imgui_demo.cpp`. Build it from a clone with CMake:
+
+```sh
+cmake -S . -B build
+cmake --build build --target bui_imgui_demo
+```
+
+Then run `bui_imgui_demo` from the build folder. With `--screenshot out.png` it renders a few frames headless and writes a PNG instead of opening a window, and `BUI_GPU=1` draws the window on the GPU.
+
+<Callout type="tip">
+An idle ImGui window on BUI runs no ImGui frames at all: when nothing changes, nothing is redrawn and your `frame` function isn't called.
+</Callout>
+
+## Blender's widgets, with one flag
+
+So far, the widgets are ImGui's, wearing Blender's colors. BUI can go further: build it with `BUI_IMGUI_BLENDER_WIDGETS=ON` and ImGui's widgets are **drawn by BUI's own Blender widget code**: buttons, checkboxes, sliders, number fields, text fields, combos and color edits. Number fields, sliders and checkboxes also follow Blender's interaction rules. Your ImGui code doesn't change.
+
+```sh
+cmake -S . -B build -DBUI_IMGUI_BLENDER_WIDGETS=ON
+cmake --build build --target bui_imgui_demo
+```
+
+In Rust, it's the `blender-widgets` feature of the `blenderui-imgui` crate.
+
+<Compare left="Default build" right="BUI_IMGUI_BLENDER_WIDGETS=ON">
+ <div slot="left">
+
+ <Figure src="images/imgui-python-hello.png" alt="The Hello window with ImGui's own widgets" width={420} height={210} />
+
+ </div>
+ <div slot="right">
+
+ <Figure src="images/imgui-python-hello-blender.png" alt="The same Hello window with Blender's widgets: the slider fills with blue, rounder fields and checkbox" width={420} height={210} />
+
+ </div>
+</Compare>
+
+What you'll notice when you use them:
+
+- **Sliders don't jump** to where you click. Dragging is relative to where you pressed, as in Blender, and <Kbd>Shift</Kbd> moves at a twentieth of the speed.
+- **Drag fields scrub** like Blender's number fields: <Kbd>Shift</Kbd> for precision, <Kbd>Ctrl</Kbd> to snap, and a click (or <Kbd>Ctrl</Kbd>+click) to type a value.
+- **Checkboxes toggle on press**, and you can drag across several to set them all.
+
+The switch also works at run time when the build includes the widgets: `imgui.set_blender_widgets(False)` in Python, `ImGui_ImplBUI_SetBlenderWidgets(false)` in C++. `imgui.has_blender_widgets()` tells you whether your build has them. The wheels on PyPI are built without this option, so in Python you get Blender's widgets from a source build with the flag on.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Dear ImGui in Python" href="docs/imgui/python/" icon="book" kicker="Dear ImGui">
+ The full pyimgui-style API, structs, enums and headless testing.
+ </Card>
+ <Card title="Dear ImGui in C++" href="docs/imgui/cpp/" icon="cpu" kicker="Dear ImGui">
+ The backend, CMake targets and running inside an existing BUI UI.
+ </Card>
+ <Card title="Blender widgets" href="docs/imgui/blender-widgets/" icon="layers" kicker="Dear ImGui">
+ The full mapping table, behaviour differences and the gaps.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/tutorials/first-app-python.mdx b/website/src/content/docs/tutorials/first-app-python.mdx
new file mode 100644
index 0000000..8e530c1
--- /dev/null
+++ b/website/src/content/docs/tutorials/first-app-python.mdx
@@ -0,0 +1,191 @@
+---
+title: Your first app, in Python
+sidebarLabel: First app (Python components)
+description: Build a small Blender-style tool window with BUI's components, one line at a time. About ten minutes, no Blender required.
+section: Tutorials
+order: 10
+languages: ["python"]
+badges: ["10 minutes", "Beginner"]
+sources: ["docs/components.md", "README.md", "examples/components_demo.py", "bindings/python/bui/components/app.py"]
+---
+
+In about ten minutes you'll have a real window with a Blender panel, a slider you can drag, a checkbox, a color picker, a button and a pie menu. It takes about 20 lines of Python, and you'll understand every one of them.
+
+We'll use BUI's **Blender components**: Python classes like `Panel` and `NumberSlider` that map one-to-one to Blender's own widgets.
+
+<Callout type="note" title="What you need">
+Python 3.11 or newer, and BUI installed with `pip install blenderui`. If you haven't done that yet, [install it first](../../start/installation/). Two minutes, tops.
+</Callout>
+
+## The finished app
+
+Here's where we're heading. Don't worry about reading it all now; we'll build it piece by piece.
+
+```py title="first_app.py"
+from blenderui.components import (App, Panel, NumberSlider, Checkbox,
+ ColorSwatch, Button, MenuItem, PieMenu)
+
+def on_size(value):
+ print("size is now", value)
+
+size = NumberSlider("Size", 1.0, min=0, max=10, on_change=on_size,
+ description="How big the object is")
+smooth = Checkbox("Smooth", True)
+color = ColorSwatch("Color", (0.8, 0.3, 0.1, 1.0))
+
+def apply():
+ print("apply:", size.value, smooth.value, color.value)
+
+app = App("My first BUI app", (360, 300),
+ Panel("Object", size, smooth, color),
+ Button("Apply", on_click=apply))
+
+app.bind("q", lambda: PieMenu.show(app.ctx, [MenuItem("Object Mode"),
+ MenuItem("Edit Mode")], "Mode"))
+app.run()
+```
+
+## Build it, step by step
+
+<Steps>
+
+1. **Open an empty window.**
+
+ Create a file called `first_app.py` with three lines:
+
+ ```py title="first_app.py"
+ from blenderui.components import App
+
+ App("My first BUI app", (360, 300)).run()
+ ```
+
+ Run it with `python first_app.py`. An empty, dark window appears.
+
+ - `App` is your window. Its first argument is the title, the second is the size in pixels (width, height).
+ - `.run()` opens the window and starts the **event loop**: the part that waits for clicks and keys and keeps the window alive. Your script stays on this line until you close the window.
+
+2. **Add a panel with a slider.**
+
+ ```py title="first_app.py" ins={1,3-4}
+ from blenderui.components import App, Panel, NumberSlider
+
+ App("My first BUI app", (360, 300),
+ Panel("Object", NumberSlider("Size", 1.0, min=0, max=10))).run()
+ ```
+
+ - A `Panel` is Blender's collapsible box with a title. Everything after the title goes inside it.
+ - A `NumberSlider` is Blender's slider: a label, a starting value (`1.0`) and limits (`min`, `max`).
+
+ Run it again and drag the slider. Then click its header arrow: the panel collapses with Blender's animation.
+
+3. **React when the value changes.**
+
+ Widgets tell you about changes through **callbacks**: functions you hand over, which BUI calls later.
+
+ ```py
+ def on_size(value):
+ print("size is now", value)
+
+ size = NumberSlider("Size", 1.0, min=0, max=10, on_change=on_size,
+ description="How big the object is")
+ ```
+
+ - `on_change=on_size` means "call `on_size` with the new value whenever it changes". Drag the slider and watch your terminal.
+ - `description=` is the tooltip. Hover over the slider for a moment to see it.
+
+ We also gave the slider a name, `size`, so we can read it later.
+
+4. **Add a checkbox and a color.**
+
+ ```py
+ smooth = Checkbox("Smooth", True)
+ color = ColorSwatch("Color", (0.8, 0.3, 0.1, 1.0))
+ ```
+
+ - `Checkbox` takes a label and whether it starts checked.
+ - `ColorSwatch` takes a label and a color as (red, green, blue, alpha), each from 0 to 1. Click it in the app: you get Blender's color picker, with the HSV wheel, a hex field and an eyedropper.
+
+ Put all three in the panel: `Panel("Object", size, smooth, color)`.
+
+5. **Add a button that reads everything.**
+
+ ```py
+ def apply():
+ print("apply:", size.value, smooth.value, color.value)
+ ```
+
+ Every value component has a `.value` you can read (or set) at any time. Pass the function to a button with `Button("Apply", on_click=apply)`, after the panel.
+
+6. **Add a pie menu.**
+
+ ```py
+ app.bind("q", lambda: PieMenu.show(app.ctx, [MenuItem("Object Mode"),
+ MenuItem("Edit Mode")], "Mode"))
+ ```
+
+ - `app.bind("q", ...)` runs a function when you press <Kbd>Q</Kbd> in the window. It understands combinations too, like `"ctrl+s"`.
+ - `PieMenu.show(...)` opens a Blender pie menu at the pointer with the items you give it.
+
+ To call `bind`, we need the app in a variable, so the last lines become `app = App(...)`, then `app.bind(...)`, then `app.run()`. That's the finished file from the top of the page.
+
+</Steps>
+
+## Run it
+
+```sh
+python first_app.py
+```
+
+You'll see one panel titled **Object** with the slider, the checkbox and the color, and an **Apply** button below it.
+
+<Figure
+ src="images/first-app-python.png"
+ alt="The finished first app: an Object panel with a Size slider at 1.000, a checked Smooth checkbox and an orange Color swatch, with an Apply button below"
+ caption="<code>first_app.py</code>, rendered by BUI at its real size (360 × 300). Want to see more parts together? Run <code>examples/components_demo.py</code>."
+ width={360}
+ height={300}
+/>
+
+Now play. Each of these works without a single extra line of code:
+
+- **Drag** the slider. Hold <Kbd>Shift</Kbd> for fine control, <Kbd>Ctrl</Kbd> to snap.
+- **Click** the slider and type `2*pi` or `10/4`, then press <Kbd>Enter</Kbd>.
+- Hover the slider and press <Kbd keys="Ctrl+Wheel" /> to step it, or <Kbd>Backspace</Kbd> to reset it.
+- **Right-click** any value for Copy, Paste and Reset.
+- Press <Kbd keys="Ctrl+Z" /> to undo your last edit, and <Kbd keys="Ctrl+Shift+Z" /> to redo.
+- Press <Kbd>Q</Kbd> for the pie menu, then flick toward a choice.
+
+## What just happened
+
+You described *what* the window contains, and BUI did the rest. Your Python code built a small tree: an app, holding a panel and a button; the panel holding three widgets. That tree went to BUI's C runtime, the **kit**, which:
+
+- laid the widgets out like Blender's properties editor,
+- drew them with a port of Blender's widget code,
+- handled the mouse and keyboard with Blender's rules (everything you just tried), and
+- called your Python functions only when something changed.
+
+When nothing changes, the window costs no CPU at all. When you drag, BUI redraws only the slider, not the whole window.
+
+<Callout type="joke">
+If you pressed <Kbd>Q</Kbd> expecting to quit: that's a pie menu now. You've been Blendered.
+</Callout>
+
+## Where to go from here
+
+- **Change the layout.** Put widgets side by side with `Row(...)`, or line up X/Y/Z fields with `VectorField("Location", (0.0, 1.25, 0.0))`.
+- **Add a menu bar.** Pass `header=MenuBar(...)` to `App`.
+- **Test it without a window.** `app.render_raster()` draws headlessly, and `app.press(...)` / `app.release(...)` simulate input. Handy for tests.
+
+## Next steps
+
+<CardGrid>
+ <Card title="Installation" href="docs/start/installation/" icon="terminal" kicker="Start here">
+ Other languages, platform notes, and what to do if something goes wrong.
+ </Card>
+ <Card title="Blender components" href="docs/python/components/" icon="book" kicker="Python">
+ Layout, the common API, menus and pie menus, explained.
+ </Card>
+ <Card title="Testing without a window" href="docs/python/headless-testing/" icon="zap" kicker="Python">
+ Render, click and drag in a test, then check values and pixels.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/tutorials/first-app-qt.mdx b/website/src/content/docs/tutorials/first-app-qt.mdx
new file mode 100644
index 0000000..7ecb66c
--- /dev/null
+++ b/website/src/content/docs/tutorials/first-app-qt.mdx
@@ -0,0 +1,212 @@
+---
+title: Your first app, in Qt syntax
+sidebarLabel: First app (Qt syntax)
+description: Build a small export dialog with QApplication, layouts and signals, drawn by BUI in Blender's look. No Qt or PySide install needed.
+section: Tutorials
+order: 30
+languages: ["python"]
+badges: ["15 minutes", "Partial API"]
+sources: ["docs/qt.md", "examples/qt_syntax_demo.py", "bindings/python/bui/qtsyntax.py", "SYNTAX_COVERAGE.md"]
+---
+
+If you've written Qt before, you already know how to build this app: a `QApplication`, a few widgets in layouts, and signals connected to slots. BUI runs that style of code on its own engine, so you get Blender's widgets **without installing Qt or PySide**.
+
+By the end you'll have an export dialog where dragging a slider moves a progress bar, and a button that reads every field.
+
+<Callout type="warning" title="Qt syntax is partial">
+The everyday widgets, layouts and signals in this tutorial work and are tested. But measured against Qt's own headers, only about a quarter of the methods on the main widget classes exist so far, and some classes (model/view, docks, toolbars, splitters) are missing. Anything not there raises `AttributeError`; nothing fails silently. The [Qt syntax guide](../../python/qt-syntax/) has the full list.
+</Callout>
+
+<Callout type="note" title="What you need">
+Python 3.11 or newer and `pip install blenderui` ([installation](../../start/installation/)).
+</Callout>
+
+## The finished app
+
+```py title="export_dialog.py"
+import sys
+from blenderui.qtsyntax import (QApplication, QWidget, QVBoxLayout, QHBoxLayout,
+ QFormLayout, QLineEdit, QComboBox, QSlider,
+ QProgressBar, QPushButton, QLabel, Qt)
+
+app = QApplication(sys.argv)
+
+window = QWidget()
+window.setWindowTitle("Export")
+layout = QVBoxLayout(window)
+
+form = QFormLayout()
+name = QLineEdit()
+name.setPlaceholderText("file name")
+kind = QComboBox()
+kind.addItems(["glTF", "FBX", "OBJ"])
+quality = QSlider(Qt.Horizontal)
+quality.setRange(0, 100)
+form.addRow("Name:", name)
+form.addRow("Format:", kind)
+form.addRow("Quality:", quality)
+layout.addLayout(form)
+
+bar = QProgressBar()
+quality.valueChanged.connect(bar.setValue)
+layout.addWidget(bar)
+
+status = QLabel("Ready.")
+layout.addWidget(status)
+
+def export():
+ status.setText("Exporting %s as %s at %d%%" % (
+ name.text() or "untitled", kind.currentText(), quality.value()))
+
+buttons = QHBoxLayout()
+go = QPushButton("Export")
+go.clicked.connect(export)
+cancel = QPushButton("Close")
+cancel.clicked.connect(app.quit)
+buttons.addWidget(go)
+buttons.addWidget(cancel)
+layout.addLayout(buttons)
+
+quality.setValue(75)
+bar.setValue(quality.value())
+window.resize(360, 190)
+window.show()
+sys.exit(app.exec())
+```
+
+<Figure
+ src="images/qt-export.png"
+ alt="The export dialog on BUI: Name, Format and Quality rows, a slider at 75, a progress bar at 75%, a Ready label, and Export and Close buttons"
+ caption="<code>export_dialog.py</code>, drawn by BUI at its real size."
+ width={360}
+ height={190}
+/>
+
+## Build it, step by step
+
+<Steps>
+
+1. **Start the application and a window.**
+
+ ```py title="export_dialog.py"
+ import sys
+ from blenderui.qtsyntax import QApplication, QWidget
+
+ app = QApplication(sys.argv)
+ window = QWidget()
+ window.setWindowTitle("Export")
+ window.resize(360, 190)
+ window.show()
+ sys.exit(app.exec())
+ ```
+
+ - The import is the only line that's different from PySide or PyQt: `blenderui.qtsyntax` instead of `PySide6.QtWidgets`.
+ - `QApplication` must exist before any widget, as in Qt.
+ - `window.show()` asks for the window; `app.exec()` opens it and runs the **event loop**, the part that waits for input. It returns when every window is closed, or when you call `app.quit()`.
+
+2. **Lay out a form.**
+
+ ```py
+ layout = QVBoxLayout(window)
+
+ form = QFormLayout()
+ name = QLineEdit()
+ name.setPlaceholderText("file name")
+ kind = QComboBox()
+ kind.addItems(["glTF", "FBX", "OBJ"])
+ quality = QSlider(Qt.Horizontal)
+ quality.setRange(0, 100)
+ form.addRow("Name:", name)
+ form.addRow("Format:", kind)
+ form.addRow("Quality:", quality)
+ layout.addLayout(form)
+ ```
+
+ - `QVBoxLayout(window)` stacks things vertically and owns the window's contents. Passing the window is the same as calling `window.setLayout(layout)` later.
+ - `QFormLayout.addRow` puts a label next to each field.
+ - On BUI, `QLineEdit` is a Blender text field, `QComboBox` a Blender dropdown and `QSlider` a Blender slider. You'll feel the difference in a moment.
+
+3. **Connect a signal.**
+
+ ```py
+ bar = QProgressBar()
+ quality.valueChanged.connect(bar.setValue)
+ layout.addWidget(bar)
+ ```
+
+ A **signal** is an event a widget announces; a **slot** is any function you connect to it. Here, every time the slider's value changes, BUI calls `bar.setValue` with the new value. Slots can be any Python callable: a method, a function, a `lambda`.
+
+4. **Add a label and buttons.**
+
+ ```py
+ status = QLabel("Ready.")
+ layout.addWidget(status)
+
+ def export():
+ status.setText("Exporting %s as %s at %d%%" % (
+ name.text() or "untitled", kind.currentText(), quality.value()))
+
+ buttons = QHBoxLayout()
+ go = QPushButton("Export")
+ go.clicked.connect(export)
+ cancel = QPushButton("Close")
+ cancel.clicked.connect(app.quit)
+ buttons.addWidget(go)
+ buttons.addWidget(cancel)
+ layout.addLayout(buttons)
+ ```
+
+ `clicked` sends a `checked` argument (a `bool`), as in Qt. `export` takes none, and that's fine: on BUI, a slot that takes fewer arguments than the signal sends simply gets fewer.
+
+5. **Set starting values.**
+
+ ```py
+ quality.setValue(75)
+ bar.setValue(quality.value())
+ ```
+
+ We set the bar too, because the window isn't open yet. In our testing, a `setValue` before the window opens doesn't emit `valueChanged`, so connected slots don't run. Once the window is up, every change does.
+
+</Steps>
+
+## Run it
+
+```sh
+python export_dialog.py
+```
+
+Now try it:
+
+- **Drag the slider** and watch the progress bar follow. Hold <Kbd>Shift</Kbd> to move it slowly.
+- **Click the slider** and type a number, or a sum like `50+25`: it's a Blender slider, so it evaluates math. `QLineEdit` stays a plain text field.
+- **Type a name**, pick a format, and click **Export**: the label updates.
+- Press <Kbd keys="Ctrl+Z" /> to undo an edit.
+
+## How Qt maps onto BUI
+
+There's no Qt underneath. Each Qt widget is a node in BUI's C runtime, the **kit**:
+
+- `QVBoxLayout` and `QHBoxLayout` run on the kit's box layout, written in C, with Qt's rules for stretch factors and spacing.
+- `QGridLayout` and `QFormLayout` run on the kit's grid layout.
+- Signals are plain Python objects.
+- `app.exec()` opens a native window (Win32, X11 or Cocoa), or a Tk-hosted one if you set `BUI_HOST=tk`.
+
+So the layout, input and drawing are fast native code, and your Python only builds the tree and handles signals.
+
+<Callout type="joke">
+No QWidgets were subclassed in the making of this dialog. They'll get their turn in the Qt guide's custom-painting section.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="Qt syntax guide" href="docs/python/qt-syntax/" icon="book" kicker="Python">
+ Every supported class, custom painting with QPainter, and what's still missing.
+ </Card>
+ <Card title="tkinter on BUI" href="docs/tutorials/tkinter-app/" icon="layers" kicker="Tutorial">
+ The tkinter layer is complete: every public name is there.
+ </Card>
+ <Card title="Blender components" href="docs/tutorials/first-app-python/" icon="sparkles" kicker="Tutorial">
+ Blender's own panels, pie menus and node editor, from Python.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/tutorials/first-app-react.mdx b/website/src/content/docs/tutorials/first-app-react.mdx
new file mode 100644
index 0000000..192e87d
--- /dev/null
+++ b/website/src/content/docs/tutorials/first-app-react.mdx
@@ -0,0 +1,154 @@
+---
+title: Your first app, in React
+sidebarLabel: First app (React)
+description: Write a React counter with a Blender slider, run it on Bun or Node.js in a native window, then ship it as one small executable.
+section: Tutorials
+order: 50
+languages: ["javascript"]
+badges: ["15 minutes", "Windows x64 prebuilt"]
+sources: ["docs/javascript.md", "bindings/react/examples/counter.jsx", "bindings/react/examples/counter.js", "bindings/react/README.md", "bindings/react/index.js", "bindings/node/index.js", "bindings/node/cli.js"]
+---
+
+You know React. Here's the twist: the same components, hooks and JSX render into a **native desktop window**, drawn by BUI. There's no browser, no webview and no Electron. When you're done, one command turns the app into a single executable of about 5 MB.
+
+You'll build a counter with a Blender slider, learn the one thing that's different about hooks here (they hold **signals**), and ship it.
+
+<Callout type="warning" title="Platforms">
+The npm packages include a prebuilt native addon for **Windows x64**. On **Linux**, build the addon from source first ([installation](../../start/installation/)); windows are native there too. On **macOS**, JavaScript runs headless for now.
+</Callout>
+
+## Set up
+
+<Steps>
+
+1. **Make a folder and install the packages.**
+
+ ```sh
+ mkdir hello-bui
+ cd hello-bui
+ bun add @blender-ui/react react
+ ```
+
+ With npm, use `npm install @blender-ui/react react`. We'll use **Bun** to run the app because it reads JSX as is. Node.js 18 or newer works too; see [Running on Node.js](#running-on-nodejs).
+
+2. **Write the app.**
+
+ ```jsx title="app.jsx"
+ /** @jsxImportSource @blender-ui/react */
+ import { render, useState, NumberSlider } from '@blender-ui/react'
+
+ function Counter () {
+ const [count, setCount] = useState(0)
+ const [size, setSize] = useState(5)
+ return (
+ <main className="p-6 flex flex-col gap-3">
+ <h1 className="text-xl font-bold">Hello, BUI</h1>
+ <div className="flex items-center gap-3">
+ <span>Clicks: {count}</span>
+ <button onClick={() => setCount(c => c + 1)}>Add one</button>
+ </div>
+ <NumberSlider min={0} max={10} value="5"
+ onChange={e => setSize(e.target.valueAsNumber)} />
+ <span>Size: {size}</span>
+ </main>
+ )
+ }
+
+ const { window } = render(<Counter />, { title: 'Counter', width: 420, height: 260 })
+ window.body.setAttribute('styled', '')
+ window.body.className = 'm-0 min-h-screen bg-[#2b2b2b] text-[#e6e6e6]'
+ ```
+
+3. **Run it.**
+
+ ```sh
+ bun app.jsx
+ ```
+
+ A window opens. Click **Add one**, drag the slider, and watch both numbers follow.
+
+</Steps>
+
+<Figure
+ src="images/react-counter.png"
+ alt="A dark window: the heading Hello, BUI, Clicks: 0 with an Add one button, a Blender number slider at 5, and Size: 5"
+ caption="<code>app.jsx</code> as it first opens, rendered headless by <code>@blender-ui/react</code>."
+ width={420}
+ height={260}
+/>
+
+## What's in the code
+
+- **`/** @jsxImportSource @blender-ui/react */`** tells the JSX compiler to use BUI's runtime for this file. For a whole project, set `"jsxImportSource": "@blender-ui/react"` in `tsconfig.json` or your bundler's JSX options instead.
+- **Host components are HTML elements**, as in React DOM: `<main>`, `<span>`, `<button>`. `className` takes Tailwind classes, and `style` objects work too.
+- **`<NumberSlider>`** is one of the Blender components, the real Blender widget. The others are `Button`, `Checkbox`, `Radio`, `NumberField`, `TextField`, `TextArea`, `ColorSwatch`, `Dropdown` and `ProgressBar`.
+- **`onChange`** fires when the slider's value changes; `e.target.valueAsNumber` holds the number.
+- **`render(element, options)`** opens a window and mounts your component. It returns `{ app, window, root }`.
+- **`styled`** on the body gives the whole page Blender's look. Without it, plain elements look like a browser's.
+
+## The twist: hooks hold signals
+
+`useState` has React's name, arguments and timing, but the value it gives you is a **signal**: a box that knows who's watching it. That changes one thing, for the better:
+
+- **Pass the signal into JSX**, like `{count}` or `{size}`, and a change updates that one text node. `Counter` doesn't re-render at all.
+- **Read `.value` while rendering**, like `count.value > 9`, and the component re-renders when it changes, as with React.
+
+One rule follows from it: **conditions need `.value`**. A signal is an object, so it's always truthy.
+
+```jsx
+{count.value > 0 && <p>You clicked!</p>} // right
+{count > 0 && <p>You clicked!</p>} // works in plain JS, but use .value
+{count && <p>Always shown</p>} // wrong: a signal is always truthy
+```
+
+This is why React on BUI costs about what the plain DOM-like API does: clicking **Add one** changes a single text node, with no new element tree and no diff.
+
+## Running on Node.js
+
+Node doesn't read JSX, so either compile it (any bundler, with `jsxImportSource` set to `@blender-ui/react`) or write the same component with `createElement`, as the repository's `examples/counter.js` does:
+
+```js title="app.js"
+const { render, createElement: h, useState } = require('@blender-ui/react')
+
+function Counter () {
+ const [count, setCount] = useState(0)
+ return h('main', { className: 'p-6 flex flex-col gap-3' },
+ h('span', null, 'Clicks: ', count),
+ h('button', { onClick: () => setCount(c => c + 1) }, 'Add one'))
+}
+
+render(h(Counter), { title: 'Counter', width: 420, height: 260 })
+```
+
+```sh
+node app.js
+```
+
+## Ship it as one file
+
+```sh
+npx bui build app.jsx
+```
+
+This writes `app.exe`: BUI plus the small [QuickJS](https://github.com/quickjs-ng/quickjs) JavaScript engine, with your bundled app appended. For a small React app on Windows x64, the repository measured a 4.9 MB executable that reaches its first frame in 68 ms.
+
+- Bundling needs [Bun](https://bun.sh) installed, even if you run the app on Node. With Bun alone, `bunx bui build app.jsx` works too.
+- Windows builds open no console window. Add `--console` to see your `console.log` output.
+- QuickJS has no Node modules (`fs`, `net` …). If your app needs them, build with `--bun` for a full Bun runtime (about 115 MB).
+- `npx bui run app.jsx` runs on the QuickJS runtime without making an executable.
+
+The prebuilt runtime is for Windows x64. On other platforms, `npm run build` in `bindings/node` builds it from source.
+
+## Next steps
+
+<CardGrid>
+ <Card title="React on BUI" href="docs/javascript/react/" icon="layers" kicker="JavaScript">
+ Host components, JSX setup, Suspense and transitions.
+ </Card>
+ <Card title="Signals" href="docs/javascript/signals/" icon="zap" kicker="JavaScript">
+ Every hook, what it returns, and how updates flow.
+ </Card>
+ <Card title="Standalone executables" href="docs/javascript/standalone-executables/" icon="cpu" kicker="JavaScript">
+ `bui build`, `--bun`, `--console` and `--dev`.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/tutorials/first-app-rust.mdx b/website/src/content/docs/tutorials/first-app-rust.mdx
new file mode 100644
index 0000000..c6d4ed4
--- /dev/null
+++ b/website/src/content/docs/tutorials/first-app-rust.mdx
@@ -0,0 +1,280 @@
+---
+title: Your first app, in Rust
+sidebarLabel: First app (Rust)
+description: Build a counter with a heading, state and a real Blender slider, in rsx! markup or gpui-style builders. Native window, no browser.
+section: Tutorials
+order: 40
+languages: ["rust"]
+badges: ["15 minutes", "Beginner"]
+sources: ["docs/rust.md", "bindings/rust/blenderui/examples/hello.rs", "bindings/rust/blenderui/examples/counter.rs", "bindings/rust/Cargo.toml", "bindings/rust/blenderui/Cargo.toml"]
+---
+
+In this tutorial you'll build a small Rust app with BUI: a heading, a counter with a hover effect, and one of Blender's own number sliders. BUI draws it natively, in a real window, with **no browser and no webview** anywhere. About 40 lines.
+
+BUI gives you **two ways to write the same UI**, and both are first-class. Every step below shows both; pick a tab and the whole page follows.
+
+- **`rsx!`** is HTML-like markup inside a macro: `<div flex gap-3>"Add one"</div>`. Components are functions with hooks for state.
+- **gpui builders** are plain method chains: `div().flex().gap_3().child("Add one")`. State lives in your view struct, and `cx.listener` updates it. It's the style of the [gpui](https://www.gpui.rs) crate, so gpui code compiles against BUI too.
+
+<Callout type="note" title="What you need">
+Rust 1.88 or newer, CMake and a C compiler (on Windows, the Visual Studio Build Tools), and on Linux the X11 headers. The [installation page](../../start/installation/) has the details. The first build compiles BUI's C core, so it takes a minute; later builds are quick.
+</Callout>
+
+## See it run first
+
+If you have a clone of the repository, run the finished `rsx!` version before writing anything:
+
+```sh
+cd bindings/rust
+cargo run --release --example hello
+```
+
+<Figure
+ src="images/rust-hello.png"
+ alt="A dark window titled Hello, BUI: a rounded card reading Clicks: 0 with a blue Add one button, and a Blender number slider at 5 below"
+ caption="<code>hello.rs</code>, rendered headless with <code>--screenshot</code>."
+ width={420}
+ height={260}
+/>
+
+Click **Add one** a few times, then drag the slider. That slider is Blender's: the cursor hides while you drag, <Kbd>Shift</Kbd> slows it down, and you can click it to type a value.
+
+## Build it yourself
+
+<Steps>
+
+1. **Make a project and add BUI.**
+
+ ```sh
+ cargo new hello-bui
+ cd hello-bui
+ cargo add blenderui
+ ```
+
+ The crate is [`blenderui` on crates.io](https://crates.io/crates/blenderui).
+
+2. **Open a window with a view.**
+
+ Replace `src/main.rs` with this:
+
+ <Tabs sync="rust-syntax" label="Rust syntax">
+ <Tab label="rsx!">
+
+ ```rust title="src/main.rs"
+ use blenderui::prelude::*;
+
+ struct Hello;
+
+ impl Render for Hello {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ rsx! {
+ <body m-0 p-6 min-h-screen flex flex-col gap-4 bg-zinc-900 text-white>
+ <h1 text-2xl font-bold>"Hello, BUI"</h1>
+ </body>
+ }
+ }
+ }
+
+ fn main() {
+ Application::new().run(|cx| {
+ let opts = WindowOptions {
+ window_bounds: Some(WindowBounds::Windowed(Bounds {
+ origin: point(px(0.0), px(0.0)),
+ size: size(px(420.0), px(260.0)),
+ })),
+ ..Default::default()
+ };
+ cx.open_window(opts, |_, cx| cx.new(|_| Hello)).unwrap();
+ });
+ }
+ ```
+
+ - `rsx!` is HTML-like markup. The macro turns it into ordinary Rust calls at compile time, so there's no parsing at run time.
+ - The bare words on each tag, like `p-6`, `flex` and `bg-zinc-900`, are **Tailwind classes written as attributes**: short names for one style each (`p-6` is padding, `bg-zinc-900` a dark gray background). A typo such as `bg-zinc-90O` is a compile error that suggests the right name.
+ - Text goes in quotes: `"Hello, BUI"`.
+
+ </Tab>
+ <Tab label="gpui builders">
+
+ ```rust title="src/main.rs"
+ use blenderui::prelude::*;
+
+ struct Hello;
+
+ impl Render for Hello {
+ fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
+ body().m_0().p_6().css("min-height", "100vh").flex().flex_col().gap_4()
+ .bg(rgb(0x18181b)).text_color(white())
+ .child(h1().text_2xl().font_bold().child("Hello, BUI"))
+ }
+ }
+
+ fn main() {
+ Application::new().run(|cx| {
+ let opts = WindowOptions {
+ window_bounds: Some(WindowBounds::Windowed(Bounds {
+ origin: point(px(0.0), px(0.0)),
+ size: size(px(420.0), px(260.0)),
+ })),
+ ..Default::default()
+ };
+ cx.open_window(opts, |_, cx| cx.new(|_| Hello)).unwrap();
+ });
+ }
+ ```
+
+ - Every HTML element has a constructor: `body()`, `h1()`, `div()`, `span()` and so on. They all return the same `Div` type.
+ - Each style is a method: `.p_6()` is padding, `.flex().flex_col()` stacks children in a column, `.bg(rgb(0x18181b))` sets the background. For anything without a method, `.css("property", "value")` sets any CSS property.
+ - `.child(...)` adds a child: another element, or text.
+
+ </Tab>
+ </Tabs>
+
+ Run it with `cargo run --release`. A dark window says hello.
+
+ - A **view** is a struct that implements `Render`. Its `render` method returns the UI.
+ - `Application::new().run(...)` starts the app, and `cx.open_window(...)` opens a 420 × 260 window showing your view. This part is the same in both styles.
+
+3. **Add a counter with state.**
+
+ <Tabs sync="rust-syntax" label="Rust syntax">
+ <Tab label="rsx!">
+
+ Add a **component** above `struct Hello`:
+
+ ```rust
+ #[component]
+ fn counter(label: &str) {
+ let (count, set_count) = use_state(0);
+ rsx! {
+ <div flex items-center gap-3 p-4 rounded-xl bg-zinc-800>
+ <span text-zinc-300>{label.to_string()} ": " {count().to_string()}</span>
+ <div px-3 py-1 rounded-md bg-sky-700 hover:bg-sky-500 cursor-pointer
+ onClick={move || set_count(count() + 1)}>
+ "Add one"
+ </div>
+ </div>
+ }
+ }
+ ```
+
+ - `#[component]` turns the function into a component you can use as a tag. Its parameters become **props**: `label` here.
+ - `use_state(0)` is a **hook**: it keeps a value between renders. It gives you a getter, `count()`, and a setter, `set_count(...)`. Calling the setter re-renders the window.
+ - `{...}` in markup inserts a Rust value. Text children are `String` or `&'static str`, which is why `label` and the count go through `.to_string()`.
+ - `hover:bg-sky-500` changes the color while the pointer is over the element. `onClick` takes a closure, and you can leave out its parameters when you don't need them.
+
+ </Tab>
+ <Tab label="gpui builders">
+
+ Keep the count in the view itself. Give `Hello` a field, and start it at zero in `main`:
+
+ ```rust
+ struct Hello { count: i32 }
+
+ // in main():
+ cx.open_window(opts, |_, cx| cx.new(|_| Hello { count: 0 })).unwrap();
+ ```
+
+ Then build the counter in `render`. It needs the `cx` parameter now, so give it a name:
+
+ ```rust
+ fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
+ let counter = div().flex().items_center().gap_3().p_4().rounded_xl().bg(rgb(0x27272a))
+ .child(span().text_color(rgb(0xd4d4d8)).child(format!("Clicks: {}", self.count)))
+ .child(div().px_3().py_1().rounded_md().bg(rgb(0x0369a1))
+ .hover(|s| s.bg(rgb(0x0ea5e9))).cursor_pointer()
+ .child("Add one")
+ .on_click(cx.listener(|this, _, _, cx| {
+ this.count += 1;
+ cx.notify();
+ })));
+ // ... the body from step 2, with `.child(counter)` after the heading
+ }
+ ```
+
+ - The view's fields are its state. `self.count` is read while rendering.
+ - `cx.listener(...)` wraps a closure so that, when it runs, it gets `&mut` access to your view (`this`). The other parameters are the event, the window and the context.
+ - `cx.notify()` tells BUI the view changed, so it renders again.
+ - `.hover(|s| ...)` takes the styles to apply while the pointer is over the element.
+
+ </Tab>
+ </Tabs>
+
+4. **Show the counter, and add a Blender slider.**
+
+ <Tabs sync="rust-syntax" label="Rust syntax">
+ <Tab label="rsx!">
+
+ Put two lines under the heading in `Hello`'s markup:
+
+ ```rust ins={3-4}
+ <body m-0 p-6 min-h-screen flex flex-col gap-4 bg-zinc-900 text-white>
+ <h1 text-2xl font-bold>"Hello, BUI"</h1>
+ <counter label="Clicks" />
+ <NumberSlider min={0.0} max={10.0} value="5" /> // a real Blender slider
+ </body>
+ ```
+
+ - `<counter label="Clicks" />` uses your component. Lowercase and uppercase component names both work.
+ - `min={0.0}` passes a Rust value; `value="5"` sets an HTML attribute.
+
+ </Tab>
+ <Tab label="gpui builders">
+
+ Add two children after the heading:
+
+ ```rust ins={4-5}
+ body().m_0().p_6().css("min-height", "100vh").flex().flex_col().gap_4()
+ .bg(rgb(0x18181b)).text_color(white())
+ .child(h1().text_2xl().font_bold().child("Hello, BUI"))
+ .child(counter)
+ .child(NumberSlider().min(0.0).max(10.0).value("5")) // a real Blender slider
+ ```
+
+ - Blender components are functions with capitalized names, like `NumberSlider()`, and take the same methods as any element.
+
+ </Tab>
+ </Tabs>
+
+ `NumberSlider` is one of BUI's **Blender components**: capitalized names that are always Blender's real widgets, never a look-alike.
+
+5. **Run it.**
+
+ ```sh
+ cargo run --release
+ ```
+
+ The `rsx!` version is the whole `hello.rs` example, minus its screenshot option. The builder version draws the same window.
+
+</Steps>
+
+<Callout type="tip" title="Tailwind in builder style">
+Builder code can use Tailwind class names too: `div().class(tw!("flex items-center gap-3 hover:bg-sky-500"))`. `tw!` checks the names at compile time, as `rsx!` does. `rsx!` lowers to the same builder calls, so you can mix the two: `.child(rsx! { ... })` in a chain, or `{some_div}` inside markup.
+</Callout>
+
+## What just happened
+
+You described a tree of elements, and BUI did the rest:
+
+- `rsx!` or the builder chain built a tree of elements in plain Rust.
+- BUI turned the styles into CSS, laid the tree out with flexbox, and drew it natively.
+- When you clicked, the new count was stored (by the hook, or in your view's field) and the window rendered again, so the text changed.
+- The slider isn't drawn to look like Blender's; it **is** Blender's number slider, with Blender's interaction rules.
+
+<Callout type="tip" title="Want Blender's look for everything?">
+Plain HTML elements get a browser's default look: black text on white, gray buttons. Add the `styled` attribute (`<div styled>`, or `.styled()` in builder style) to any element and it, and everything inside it, takes Blender's look: the dark background, Blender's text colors, and Blender's widgets for buttons and inputs.
+</Callout>
+
+## Next steps
+
+<CardGrid>
+ <Card title="rsx! and components" href="docs/rust/rsx-and-components/" icon="layers" kicker="Rust">
+ Loops and conditions in markup, optional props, keys and three component styles.
+ </Card>
+ <Card title="Hooks" href="docs/rust/hooks/" icon="zap" kicker="Rust">
+ `use_state`, signals, memos, effects and context.
+ </Card>
+ <Card title="CSS and Tailwind" href="docs/rust/css-and-tailwind/" icon="book" kicker="Rust">
+ Style sheets, selectors and the full Tailwind v4 engine.
+ </Card>
+</CardGrid>
diff --git a/website/src/content/docs/tutorials/tkinter-app.mdx b/website/src/content/docs/tutorials/tkinter-app.mdx
new file mode 100644
index 0000000..7073938
--- /dev/null
+++ b/website/src/content/docs/tutorials/tkinter-app.mdx
@@ -0,0 +1,192 @@
+---
+title: Run a tkinter app on BUI
+sidebarLabel: tkinter app
+description: Take a plain tkinter program, run it on BUI without changing a line, then give it Blender's panels, sliders and number fields on purpose.
+section: Tutorials
+order: 20
+languages: ["python"]
+badges: ["10 minutes", "Beginner"]
+sources: ["docs/tkinter.md", "examples/tk_unchanged_app.py", "README.md", "pyproject.toml", "bindings/python/bui/tksyntax/__init__.py", "bindings/python/bui/tksyntax/__main__.py", "SYNTAX_COVERAGE.md"]
+---
+
+You already have a tkinter app, or you know how to write one. In the next ten minutes you'll run it on BUI **without changing a line**, and it will come out looking and behaving like Blender.
+
+Then you'll learn which tkinter widgets turn into which Blender widgets, so you can design for that look on purpose.
+
+<Callout type="note" title="What you need">
+Python 3.11 or newer and `pip install blenderui` ([installation](../../start/installation/)). To compare against the original look, you also need Python's own `tkinter`, which most Python installs include.
+</Callout>
+
+## The app
+
+Here's a small, ordinary tkinter program: a render-settings form with a text entry, a spin box, a slider, a dropdown, a checkbox and a button. There's no BUI in it anywhere.
+
+```py title="render_settings.py"
+import tkinter as tk
+from tkinter import ttk, messagebox
+
+root = tk.Tk()
+root.title("Render settings")
+
+panel = ttk.LabelFrame(root, text="Output")
+panel.pack(fill="x", padx=6, pady=6)
+
+name = tk.StringVar(value="shot_010")
+samples = tk.IntVar(value=128)
+denoise = tk.BooleanVar(value=True)
+
+ttk.Label(panel, text="Name").grid(row=0, column=0, sticky="e", padx=4, pady=2)
+ttk.Entry(panel, textvariable=name).grid(row=0, column=1, sticky="we", pady=2)
+
+ttk.Label(panel, text="Samples").grid(row=1, column=0, sticky="e", padx=4, pady=2)
+tk.Spinbox(panel, from_=1, to=4096, textvariable=samples).grid(
+ row=1, column=1, sticky="we", pady=2)
+
+ttk.Label(panel, text="Quality").grid(row=2, column=0, sticky="e", padx=4, pady=2)
+quality = tk.Scale(panel, from_=0, to=100, orient="horizontal")
+quality.set(90)
+quality.grid(row=2, column=1, sticky="we", pady=2)
+
+ttk.Label(panel, text="Format").grid(row=3, column=0, sticky="e", padx=4, pady=2)
+fmt = ttk.Combobox(panel, values=("PNG", "JPEG", "OpenEXR"), state="readonly")
+fmt.current(0)
+fmt.grid(row=3, column=1, sticky="we", pady=2)
+
+ttk.Checkbutton(panel, text="Denoise", variable=denoise).grid(
+ row=4, column=1, sticky="w", pady=2)
+panel.columnconfigure(1, weight=1)
+
+def render():
+ messagebox.showinfo("Render", "%s: %d samples, %d%% %s" % (
+ name.get(), samples.get(), quality.get(), fmt.get()))
+
+ttk.Button(root, text="Render", command=render).pack(fill="x", padx=6, pady=(0, 6))
+root.mainloop()
+```
+
+## Run it three ways
+
+<Steps>
+
+1. **Run it the usual way, for comparison.**
+
+ ```sh
+ python render_settings.py
+ ```
+
+ You get the classic Tk window. Close it.
+
+2. **Run it on BUI, unchanged.**
+
+ ```sh
+ blenderui-tk render_settings.py
+ ```
+
+ Same file, same code, but now drawn by BUI. `blenderui-tk` comes with `pip install blenderui`. It makes `import tkinter` (and `tkinter.ttk`, `tkinter.messagebox` and the other submodules) point to BUI, then runs your script. Anything after the script's name is passed to it in `sys.argv`, as usual.
+
+ If the `blenderui-tk` command isn't on your `PATH`, this does the same thing:
+
+ ```sh
+ python -m bui.tksyntax render_settings.py
+ ```
+
+3. **Or switch inside the program.**
+
+ When you'd rather start the app with plain `python`, call `install()` before the first `import tkinter`:
+
+ ```py title="render_settings.py" ins={1-2}
+ import blenderui.tksyntax
+ blenderui.tksyntax.install() # before the first `import tkinter`
+
+ import tkinter as tk
+ from tkinter import ttk, messagebox
+ ```
+
+ From then on, every `import tkinter` in the process, including inside libraries you use, gets BUI.
+
+4. **Or import it by name.**
+
+ For new code that's meant for BUI, import BUI's tkinter directly and skip the switch:
+
+ ```py
+ import blenderui.tksyntax as tk
+ from blenderui.tksyntax import ttk, messagebox
+ ```
+
+ The names and behaviour are tkinter's, so the rest of the file stays the same.
+
+</Steps>
+
+<Figure
+ src="images/tkinter-render-settings.png"
+ alt="The render settings form on BUI: an Output panel with a Name text field, a Samples number field showing 128, a blue Quality slider at 90, a Format dropdown set to PNG, a checked Denoise checkbox, and a Render button"
+ caption="<code>render_settings.py</code> on BUI, unchanged. The <code>LabelFrame</code> became a panel, the <code>Spinbox</code> a number field and the <code>Scale</code> a slider."
+ width={276}
+ height={195}
+/>
+
+## Play with it
+
+None of this needed extra code. It's Blender's behaviour, built into the widgets BUI draws:
+
+- **Drag the Samples field** sideways. The cursor hides and the number scrubs. Hold <Kbd>Shift</Kbd> for fine steps, <Kbd>Ctrl</Kbd> to snap.
+- **Click the Quality slider** and type `75`, or `100/3`, then press <Kbd>Enter</Kbd>. Sliders and number fields are Blender's, so they accept math. A plain `Entry` stays a text field and takes text as typed.
+- **Press <Kbd keys="Ctrl+Z" />** to undo the last edit, and <Kbd keys="Ctrl+Shift+Z" /> to redo.
+- **Press <Kbd>Tab</Kbd>** while editing a field to jump to the next one.
+- **Click Render.** The message box is a Blender-styled dialog, and `showinfo` returns `"ok"` just like tkinter's.
+
+## Which widget becomes what
+
+You don't choose the look: it always comes from Blender's theme. But some tkinter widgets have a natural Blender twin, and BUI uses it:
+
+| You write | You get |
+| --- | --- |
+| `ttk.LabelFrame` | A Blender panel |
+| `tk.Spinbox` | A Blender number field |
+| `tk.Scale`, `ttk.Scale` | A Blender slider |
+| `ttk.Combobox`, `tk.OptionMenu` | A Blender dropdown (enum menu) |
+| `tk.Checkbutton(indicatoron=0)` | A Blender toggle button |
+| `tk.Menu` on the root | A Blender menu bar |
+| `ttk.Scrollbar` | A Blender scroller that speaks Tk's scrollbar protocol |
+
+So if you want a Blender-style tool, reach for `LabelFrame` to group settings and `Spinbox` for numbers. A plain `Entry` holding a number is still just a text field.
+
+Options that only change Tk's own look, like `relief`, `borderwidth`, `highlightthickness`, `activebackground` and `ttk.Style` settings, are accepted and returned by `cget`, but they don't change what's drawn. These do apply: `bg` on frames, canvases and windows, `fg` on text, `font` (size and bold), `cursor`, `width` and `height`, `image` and `state`.
+
+<Callout type="tip" title="GPU rendering">
+With the import-by-name style you can ask for the GPU in code: `tk.Tk(gpu=True)`. For apps you run unchanged, set `BUI_GPU=1` instead. The pixels are the same; the CPU does much less work. If there's no usable GPU, the window stays on the CPU renderer.
+</Callout>
+
+## A bigger example
+
+The repository has a fuller unchanged app with a menu bar, a notebook with three tabs, a `Treeview` table, a `Text` widget with tags and a `Canvas`:
+
+```sh
+blenderui-tk examples/tk_unchanged_app.py
+```
+
+<Figure
+ src="images/tkinter_items.png"
+ alt="An Inventory window on BUI: a File and Edit menu bar, Items, Notes and Canvas tabs, a New item panel with fields, and a table of objects"
+ caption="<code>examples/tk_unchanged_app.py</code>: plain tkinter, no BUI imports."
+ width={386}
+ height={408}
+/>
+
+## If something looks different
+
+BUI follows Tk's rules and checks them against the real tkinter in its tests, so differences are bugs. A few Tk rules surprise people anyway, on any toolkit: `Text.get("1.0", "end")` ends with a newline (use `"end-1c"`), and menus keep a tear-off entry at index 0 unless you pass `tearoff=0`. The [tkinter guide](../../python/tkinter/) lists these, plus the few things BUI can't do (there's no Tcl interpreter, so `root.tk.call` only knows a handful of commands).
+
+## Next steps
+
+<CardGrid>
+ <Card title="tkinter on BUI" href="docs/python/tkinter/" icon="book" kicker="Python">
+ The full guide: module map, behaviour notes, limitations and testing against stdlib tkinter.
+ </Card>
+ <Card title="Blender components" href="docs/tutorials/first-app-python/" icon="sparkles" kicker="Tutorial">
+ Starting fresh? Build with Blender's own widgets instead.
+ </Card>
+ <Card title="Qt syntax" href="docs/tutorials/first-app-qt/" icon="layers" kicker="Tutorial">
+ Prefer <code>QWidget</code> and <code>clicked.connect</code>? Build the same kind of form in Qt style.
+ </Card>
+</CardGrid>
diff --git a/website/src/data/bench.ts b/website/src/data/bench.ts
new file mode 100644
index 0000000..9ebc7e4
--- /dev/null
+++ b/website/src/data/bench.ts
@@ -0,0 +1,497 @@
+// Every benchmark number on the site, in one place. Copied from README.md "Performance"
+// (and docs/javascript.md#performance), with the README's rounding. When the README
+// changes, change it here; the landing page and the MDX pages read from this file.
+//
+// In MDX: <BenchChart id="first-frame" /> a chart, plus an "Open bench" table
+// <BenchTable id="startup" /> just the exact table
+// The ids are the keys of `charts` and `tables` below.
+
+export const machine = "Ryzen 7 5800U laptop, Windows 11, on AC power";
+export const benchCaveat =
+ "Measured before the latest features (ImGui, the Linux GPU renderer, the Blender search and expression code) landed. Your numbers will differ; the tools ship with the repo.";
+
+export const sources = {
+ readme: "README.md#performance",
+ rust: "bindings/rust/bench/README.md",
+ js: "docs/javascript.md#performance",
+} as const;
+
+/** One row of a bar chart. `display` is the text shown (defaults to the value + unit). */
+export interface Bar {
+ label: string;
+ /** Smaller second line under the label, e.g. the renderer. */
+ sub?: string;
+ value: number;
+ display?: string;
+ /** BUI's own bars are drawn in Blender blue; the rest in grey. */
+ ours?: boolean;
+}
+
+export interface Series {
+ name: string;
+ ours?: boolean;
+}
+
+/** A grouped chart: one group per category, one bar per series. `null` = not measured. */
+export interface Group {
+ label: string;
+ sub?: string;
+ values: (number | null)[];
+ display?: (string | null)[];
+}
+
+export interface Table {
+ caption: string;
+ columns: string[];
+ /** Cells may contain <strong>. First cell is the row header. */
+ rows: string[][];
+ /** Column indexes to right-align (numbers). */
+ numeric?: number[];
+ note?: string;
+}
+
+interface ChartBase {
+ title: string;
+ /** What's measured, in one line under the title. */
+ subtitle?: string;
+ unit: string;
+ better: "lower" | "higher";
+ /** The one-glance takeaway, e.g. { value: "40×", text: "sooner first frame than gpui" }. */
+ headline?: { value: string; text: string };
+ /** Id of the exact table in `tables`, revealed by "Open bench". */
+ table: TableId;
+ source: string;
+}
+
+export interface BarSpec extends ChartBase {
+ kind: "bars";
+ bars: Bar[];
+}
+export interface GroupSpec extends ChartBase {
+ kind: "groups";
+ series: Series[];
+ groups: Group[];
+}
+export interface LineSpec extends ChartBase {
+ kind: "line";
+ /** x positions, in order (e.g. cell counts). */
+ x: number[];
+ xLabel: string;
+ lines: { name: string; ours?: boolean; values: number[] }[];
+}
+export type ChartSpec = BarSpec | GroupSpec | LineSpec;
+
+const ratio = (a: number, b: number) => {
+ const r = a / b;
+ return `${r >= 10 ? Math.round(r) : Math.round(r * 10) / 10}×`;
+};
+
+// ---------------------------------------------------------------------------------------
+// The exact tables
+// ---------------------------------------------------------------------------------------
+
+const tablesBase = {
+ startup: {
+ caption: "Start time and battery: the same small settings window, median of 10 launches, process start to first frame",
+ columns: ["App", "Renderer", "Start time", "CPU used to start", "Memory (idle)", "Idle CPU per minute"],
+ numeric: [2, 3, 4, 5],
+ rows: [
+ ["Rust (HTML + CSS)", "CPU", "<strong>38 ms</strong>", "<strong>27 ms</strong>", "<strong>13 MB</strong>", "<strong>0 ms</strong>"],
+ ["", "GPU", "42 ms", "61 ms", "31 MB", "1.8 ms"],
+ ["JavaScript (React, Node.js)", "CPU", "94 ms", "100 ms", "48 MB", "68 ms"],
+ ["", "GPU", "99 ms", "131 ms", "60 MB", "71 ms"],
+ ["Blender components (Python)", "CPU", "112 ms", "86 ms", "23 MB", "0 ms"],
+ ["", "GPU", "116 ms", "125 ms", "32 MB", "1.7 ms"],
+ ["tkinter syntax (Python)", "CPU", "139 ms", "112 ms", "25 MB", "0.2 ms"],
+ ["", "GPU", "159 ms", "157 ms", "43 MB", "2.4 ms"],
+ ["Qt syntax (Python)", "CPU", "156 ms", "123 ms", "27 MB", "0 ms"],
+ ["", "GPU", "161 ms", "160 ms", "36 MB", "1.2 ms"],
+ ["<strong>Same gpui code:</strong> blenderui", "CPU", "<strong>40 ms</strong>", "<strong>27 ms</strong>", "<strong>15 MB</strong>", "<strong>0 ms</strong>"],
+ ["blenderui", "GPU", "43 ms", "60 ms", "31 MB", "2.1 ms"],
+ ["gpui", "GPU", "231 ms", "226 ms", "29 MB", "743 ms"],
+ ["gpui-fast", "GPU", "226 ms", "217 ms", "31 MB", "2.5 ms"],
+ ],
+ note: "Python 3.14 and Node 22. The last rows are one gpui-syntax source file (bindings/rust/bench/common/settings.rs) compiled unchanged against blenderui, gpui and gpui-fast; gpui has no form widgets, so there the controls are styled divs. Battery cost is the CPU time an app causes; memory doesn't count GPU memory.",
+ },
+ cells3000: {
+ caption: "Rust, 3000 animated cells, all apps in the same session",
+ columns: ["", "blenderui (GPU)", "blenderui (CPU)", "gpui-fast", "gpui"],
+ numeric: [1, 2, 3, 4],
+ rows: [
+ ["FPS", "<strong>59.9</strong>", "57.6", "31.5", "19.9"],
+ ["CPU per frame", "<strong>11.6 ms</strong>", "22.0 ms", "31.9 ms + GPU", "50.5 ms + GPU"],
+ ["RAM", "40 MB", "<strong>30 MB</strong>", "65 MB", "77 MB"],
+ ["First frame", "<strong>~5 ms</strong>", "<strong>~5 ms</strong>", "~200 ms", "~220 ms"],
+ ["Idle CPU", "<strong>0 %</strong>", "0–0.9 %", "0–0.4 %", "0.9–1.4 %"],
+ ],
+ note: "gpui-fast's heavy-scene frame rate varies between sessions on this laptop (30–60 fps), so compare within one session.",
+ },
+ cellsFull: {
+ caption: "Rust, full results: 100, 1000 and 3000 animated cells",
+ columns: ["", "blenderui (GPU)", "blenderui (CPU)", "gpui-fast", "gpui"],
+ numeric: [1, 2, 3, 4],
+ rows: [
+ ["FPS, 1000 animated cells", "<strong>60</strong>", "<strong>60</strong>", "49.2", "36.4"],
+ ["CPU per frame, 1000 / 100 cells", "<strong>4.7 / 1.2 ms</strong>", "10.2 / 4.6 ms", "20.5 / 2.7 ms + GPU", "27.7 / 4.7 ms + GPU"],
+ ["Uncapped FPS, 100 / 1000 / 3000 cells", "<strong>1491 / 309 / 94</strong>", "649 / 202 / 76", "-", "-"],
+ ["RAM, 1000 / 100 cells", "35 / 28 MB", "<strong>24 / 21 MB</strong>", "45 / 47 MB", "47 / 40 MB"],
+ ["GPU memory", "19–22 MB", "<strong>none</strong>", "19–24 MB", "16–21 MB"],
+ ],
+ note: "The GPU renderer is off by default: Application::new().gpu(true), tk.Tk(gpu=True), bui.set_gpu(True) or BUI_GPU=1. Its shaders evaluate the software raster's formulas: 10 of 172,800 pixels differ by more than 3/255.",
+ },
+ frameTimes: {
+ caption: "Python and C, the full component demo (520×900)",
+ columns: ["Frame", "Time"],
+ numeric: [1],
+ rows: [
+ ["Complete frame (everything redrawn)", "~0.7 ms"],
+ ["Hover or number-scrub frame (damage only)", "~0.05 ms"],
+ ["Native window: input event → on screen", "~0.06 ms"],
+ ],
+ note: "Dear ImGui's demo window with every section open (27k triangles, 1280×800) is a full software redraw of about 5–8 ms.",
+ },
+ jsStartup: {
+ caption: "JavaScript startup: a small React app that quits after its first frame, median of 12 launches after a warm-up",
+ columns: ["", "First frame", "Launch to exit", "RAM at first frame", "What you ship"],
+ numeric: [1, 2, 3, 4],
+ rows: [
+ ["<strong>QuickJS executable</strong> (bui build)", "<strong>68 ms</strong>", "<strong>104 ms</strong>", "<strong>19 MB</strong>", "<strong>4.9 MB</strong>"],
+ ["Bun executable (bui build --bun)", "79 ms", "147 ms", "35 MB", "114 MB"],
+ ["Bun (bun app.js)", "80 ms", "152 ms", "35 MB", "Bun + your app"],
+ ["Node.js (node app.js)", "108 ms", "187 ms", "45 MB", "Node + your app"],
+ ["Rust (for reference: the benchmark app)", "5 ms", "~92 ms", "", "3.5 MB"],
+ ],
+ note: "First frame is measured from the runtime's start. Launch to exit is wall time measured from outside, including process creation and teardown.",
+ },
+ jsAnim3000: {
+ caption: "JavaScript animation, 3,000 cells: one cell changes per frame, GPU renderer, medians of 3 runs",
+ columns: ["3,000 cells", "FPS", "CPU per frame", "RAM"],
+ numeric: [1, 2, 3],
+ rows: [
+ ["Rust", "59.6", "<strong>12.0 ms</strong>", "<strong>43 MB</strong>"],
+ ["QuickJS: plain JS / React with signals / React with state", "59.1 / 58.7 / 19.7", "16.3 / 14.9 / 51.0 ms", "<strong>56 / 61 / 67 MB</strong>"],
+ ["Bun 1.4: plain JS / React with signals / React with state", "58.8 / 58.4 / 55.8", "13.1 / 13.3 / 20.8 ms", "80 / 85 / 118 MB"],
+ ["Node 22: plain JS / React with signals / React with state", "55.8 / 56.7 / 54.8", "14.4 / 14.0 / 18.9 ms", "88 / 93 / 121 MB"],
+ ],
+ note: "Plain JS uses @blender-ui/native; React with signals renders the grid once; React with state re-renders it every frame. React's production build throughout.",
+ },
+ jsAnim1000: {
+ caption: "JavaScript animation, 1,000 cells",
+ columns: ["1,000 cells", "FPS", "CPU per frame", "RAM"],
+ numeric: [1, 2, 3],
+ rows: [
+ ["Rust", "60", "<strong>4.8 ms</strong>", "<strong>32 MB</strong>"],
+ ["QuickJS: plain JS / React with signals / React with state", "60 / 60 / 56.8", "6.0 / 5.6 / 17.8 ms", "<strong>38 / 40 / 43 MB</strong>"],
+ ["Bun: plain JS / React with signals / React with state", "60 / 60 / 60", "5.2 / 5.2 / 7.5 ms", "58 / 63 / 81 MB"],
+ ["Node: plain JS / React with signals / React with state", "60 / 60 / 60", "5.6 / 5.6 / 6.9 ms", "68 / 71 / 97 MB"],
+ ],
+ },
+} satisfies Record<string, Table>;
+
+const withoutRust = (t: Table, caption: string): Table => ({ ...t, caption, rows: t.rows.filter((r) => !r[0].startsWith("Rust")) });
+
+/** The base tables plus narrower views of them, for pages about one language. */
+export const tables = {
+ ...tablesBase,
+ /** The startup table's last rows: one gpui-syntax file compiled against each library. */
+ startupGpui: {
+ caption: "Start time, the same gpui-syntax file (bindings/rust/bench/common/settings.rs) compiled against each library: median of 10 launches, process start to first frame",
+ columns: ["Same gpui code", ...tablesBase.startup.columns.slice(1)],
+ numeric: tablesBase.startup.numeric,
+ rows: tablesBase.startup.rows.slice(-4).map((r, i) => (i === 0 ? ["<strong>blenderui</strong>", ...r.slice(1)] : r)),
+ note: "gpui has no form widgets, so there the controls are styled divs. Memory doesn't count GPU memory.",
+ },
+ jsStartupJs: withoutRust(tablesBase.jsStartup, tablesBase.jsStartup.caption),
+ jsAnim3000Js: withoutRust(tablesBase.jsAnim3000, tablesBase.jsAnim3000.caption),
+ jsAnim1000Js: withoutRust(tablesBase.jsAnim1000, tablesBase.jsAnim1000.caption),
+} satisfies Record<string, Table>;
+
+export type TableId = keyof typeof tables;
+
+// ---------------------------------------------------------------------------------------
+// Charts
+// ---------------------------------------------------------------------------------------
+
+const gpuiSame = (v: [number, number, number, number], d?: [string, string, string, string]): Bar[] => [
+ { label: "blenderui", sub: "CPU renderer", value: v[0], display: d?.[0], ours: true },
+ { label: "blenderui", sub: "GPU renderer", value: v[1], display: d?.[1], ours: true },
+ { label: "gpui-fast", sub: "GPU", value: v[3], display: d?.[3] },
+ { label: "gpui", sub: "Zed's, GPU", value: v[2], display: d?.[2] },
+];
+
+const cells = (v: [number, number, number, number], d?: [string, string, string, string]): Bar[] => [
+ { label: "blenderui", sub: "GPU renderer", value: v[0], display: d?.[0], ours: true },
+ { label: "blenderui", sub: "CPU renderer", value: v[1], display: d?.[1], ours: true },
+ { label: "gpui-fast", value: v[2], display: d?.[2] },
+ { label: "gpui", value: v[3], display: d?.[3] },
+];
+
+export const charts = {
+ "first-frame": {
+ kind: "bars",
+ title: "First frame",
+ subtitle: "Rust, 3000 animated cells: from launch to the first frame on screen",
+ unit: "ms",
+ better: "lower",
+ headline: { value: ratio(200, 5), text: "sooner on screen than gpui-fast" },
+ bars: cells([5, 5, 200, 220], ["~5 ms", "~5 ms", "~200 ms", "~220 ms"]),
+ table: "cells3000",
+ source: sources.readme,
+ },
+ "start-time": {
+ kind: "bars",
+ title: "Start time, same gpui code",
+ subtitle: "One gpui-syntax file compiled against each library; median of 10 launches",
+ unit: "ms",
+ better: "lower",
+ headline: { value: ratio(226, 40), text: "faster start than gpui-fast" },
+ bars: gpuiSame([40, 43, 231, 226]),
+ table: "startupGpui",
+ source: sources.readme,
+ },
+ "start-cpu": {
+ kind: "bars",
+ title: "CPU used to start, same gpui code",
+ subtitle: "CPU time spent from launch to first frame: what a launch costs the battery",
+ unit: "ms",
+ better: "lower",
+ headline: { value: ratio(217, 27), text: "less CPU to start than gpui-fast" },
+ bars: gpuiSame([27, 60, 226, 217]),
+ table: "startupGpui",
+ source: sources.readme,
+ },
+ "idle-cpu": {
+ kind: "bars",
+ title: "Idle CPU, same gpui code",
+ subtitle: "CPU time per minute while the window sits idle",
+ unit: "ms",
+ better: "lower",
+ headline: { value: "0 ms", text: "idle CPU on the CPU renderer: it sleeps" },
+ bars: gpuiSame([0, 2.1, 743, 2.5]),
+ table: "startupGpui",
+ source: sources.readme,
+ },
+ "memory-start": {
+ kind: "bars",
+ title: "Memory when idle, same gpui code",
+ subtitle: "Resident memory, not counting GPU memory",
+ unit: "MB",
+ better: "lower",
+ headline: { value: "Half", text: "the memory of gpui on the CPU renderer" },
+ bars: gpuiSame([15, 31, 29, 31]),
+ table: "startupGpui",
+ source: sources.readme,
+ },
+ "start-all": {
+ kind: "groups",
+ title: "Start time, every way in",
+ subtitle: "The same small settings window written five ways; median of 10 launches",
+ unit: "ms",
+ better: "lower",
+ series: [
+ { name: "CPU renderer", ours: true },
+ { name: "GPU renderer" },
+ ],
+ groups: [
+ { label: "Rust", sub: "HTML + CSS", values: [38, 42] },
+ { label: "JavaScript", sub: "React, Node.js", values: [94, 99] },
+ { label: "Blender components", sub: "Python", values: [112, 116] },
+ { label: "tkinter syntax", sub: "Python", values: [139, 159] },
+ { label: "Qt syntax", sub: "Python", values: [156, 161] },
+ ],
+ table: "startup",
+ source: sources.readme,
+ },
+ "idle-all": {
+ kind: "bars",
+ title: "Idle CPU, every way in",
+ subtitle: "CPU time per minute while the settings window sits idle, CPU renderer",
+ unit: "ms",
+ better: "lower",
+ headline: { value: "0 ms", text: "while nothing changes" },
+ bars: [
+ { label: "Rust", sub: "HTML + CSS", value: 0, ours: true },
+ { label: "Blender components", sub: "Python", value: 0, ours: true },
+ { label: "Qt syntax", sub: "Python", value: 0, ours: true },
+ { label: "tkinter syntax", sub: "Python", value: 0.2, ours: true },
+ { label: "JavaScript", sub: "React, Node.js event loop", value: 68, ours: true },
+ ],
+ table: "startup",
+ source: sources.readme,
+ },
+ fps: {
+ kind: "bars",
+ title: "Frames per second",
+ subtitle: "Rust, 3000 animated cells, same session",
+ unit: "fps",
+ better: "higher",
+ headline: { value: ratio(59.9, 19.9), text: "the frame rate of gpui" },
+ bars: cells([59.9, 57.6, 31.5, 19.9]),
+ table: "cells3000",
+ source: sources.readme,
+ },
+ "cpu-per-frame": {
+ kind: "bars",
+ title: "CPU per frame",
+ subtitle: "Rust, 3000 animated cells; gpui's numbers don't include its GPU time",
+ unit: "ms",
+ better: "lower",
+ headline: { value: ratio(31.9, 11.6), text: "less CPU per frame than gpui-fast" },
+ bars: cells([11.6, 22.0, 31.9, 50.5], ["11.6 ms", "22.0 ms", "31.9 ms + GPU", "50.5 ms + GPU"]),
+ table: "cells3000",
+ source: sources.readme,
+ },
+ ram: {
+ kind: "bars",
+ title: "RAM",
+ subtitle: "Rust, 3000 animated cells",
+ unit: "MB",
+ better: "lower",
+ headline: { value: ratio(77, 30), text: "less RAM than gpui (CPU renderer)" },
+ bars: cells([40, 30, 65, 77]),
+ table: "cells3000",
+ source: sources.readme,
+ },
+ "cpu-per-frame-cells": {
+ kind: "groups",
+ title: "CPU per frame, 100 and 1000 cells",
+ subtitle: "gpui's numbers don't include its GPU time",
+ unit: "ms",
+ better: "lower",
+ series: [
+ { name: "blenderui GPU", ours: true },
+ { name: "blenderui CPU", ours: true },
+ { name: "gpui-fast" },
+ { name: "gpui" },
+ ],
+ groups: [
+ { label: "100 cells", values: [1.2, 4.6, 2.7, 4.7] },
+ { label: "1000 cells", values: [4.7, 10.2, 20.5, 27.7] },
+ ],
+ table: "cellsFull",
+ source: sources.readme,
+ },
+ "uncapped-fps": {
+ kind: "line",
+ title: "Uncapped frame rate",
+ subtitle: "Frames per second with vsync off, as the scene grows",
+ unit: "fps",
+ better: "higher",
+ x: [100, 1000, 3000],
+ xLabel: "animated cells",
+ lines: [
+ { name: "blenderui GPU", ours: true, values: [1491, 309, 94] },
+ { name: "blenderui CPU", values: [649, 202, 76] },
+ ],
+ table: "cellsFull",
+ source: sources.readme,
+ },
+ "frame-times": {
+ kind: "bars",
+ title: "Frame cost",
+ subtitle: "Python and C, the full component demo (520×900)",
+ unit: "ms",
+ better: "lower",
+ headline: { value: "0.05 ms", text: "for a hover or scrub frame" },
+ bars: [
+ { label: "Complete frame", sub: "everything redrawn", value: 0.7, display: "~0.7 ms", ours: true },
+ { label: "Input to screen", sub: "native window", value: 0.06, display: "~0.06 ms", ours: true },
+ { label: "Hover or scrub", sub: "damage only", value: 0.05, display: "~0.05 ms", ours: true },
+ ],
+ table: "frameTimes",
+ source: sources.readme,
+ },
+ "js-first-frame": {
+ kind: "bars",
+ title: "JavaScript: first frame",
+ subtitle: "A small React app, median of 12 launches",
+ unit: "ms",
+ better: "lower",
+ headline: { value: "4.9 MB", text: "single executable with QuickJS" },
+ bars: [
+ { label: "QuickJS executable", sub: "bui build", value: 68, ours: true },
+ { label: "Bun executable", sub: "bui build --bun", value: 79, ours: true },
+ { label: "Bun", sub: "bun app.js", value: 80, ours: true },
+ { label: "Node.js", sub: "node app.js", value: 108, ours: true },
+ ],
+ table: "jsStartup",
+ source: sources.readme,
+ },
+ "js-cpu-3000": {
+ kind: "groups",
+ title: "JavaScript: CPU per frame, 3,000 cells",
+ subtitle: "One cell changes per frame; GPU renderer",
+ unit: "ms",
+ better: "lower",
+ series: [
+ { name: "Plain JS", ours: true },
+ { name: "React + signals", ours: true },
+ { name: "React + state" },
+ ],
+ groups: [
+ { label: "QuickJS", values: [16.3, 14.9, 51.0] },
+ { label: "Bun 1.4", values: [13.1, 13.3, 20.8] },
+ { label: "Node 22", values: [14.4, 14.0, 18.9] },
+ ],
+ table: "jsAnim3000",
+ source: sources.readme,
+ },
+} satisfies Record<string, ChartSpec>;
+
+export type ChartId = keyof typeof charts;
+
+/**
+ * The landing page's headline comparison: blenderui against gpui and gpui-fast.
+ * `ours` / `theirs` drive the little two-bar comparison under each number.
+ */
+export const highlights = [
+ {
+ value: "~5",
+ unit: "ms",
+ label: "First frame",
+ note: "3000 animated cells",
+ ours: 5,
+ theirs: { name: "gpui-fast", value: 200, display: "~200 ms" },
+ claim: `${ratio(200, 5)} sooner`,
+ chart: "first-frame",
+ },
+ {
+ value: "40",
+ unit: "ms",
+ label: "Start, same code",
+ note: "the same gpui code, compiled three ways",
+ ours: 40,
+ theirs: { name: "gpui", value: 231, display: "231 ms" },
+ claim: `${ratio(231, 40)} faster start`,
+ chart: "start-time",
+ },
+ {
+ value: "11.6",
+ unit: "ms",
+ label: "CPU per frame",
+ note: "3000 cells, GPU renderer",
+ ours: 11.6,
+ theirs: { name: "gpui-fast", value: 31.9, display: "31.9 ms + GPU" },
+ claim: `${ratio(31.9, 11.6)} less CPU`,
+ chart: "cpu-per-frame",
+ },
+ {
+ value: "0",
+ unit: "ms",
+ label: "Idle CPU per minute",
+ note: "it sleeps until something changes",
+ ours: 0,
+ theirs: { name: "gpui", value: 743, display: "743 ms" },
+ claim: "Nothing while idle",
+ chart: "idle-cpu",
+ },
+] as const satisfies readonly {
+ value: string;
+ unit: string;
+ label: string;
+ note: string;
+ ours: number;
+ theirs: { name: string; value: number; display: string };
+ claim: string;
+ chart: ChartId;
+}[];
diff --git a/website/src/layouts/Base.astro b/website/src/layouts/Base.astro
new file mode 100644
index 0000000..656cfc2
--- /dev/null
+++ b/website/src/layouts/Base.astro
@@ -0,0 +1,150 @@
+---
+import "../styles/global.css";
+import { site } from "../config/site";
+import { href } from "../lib/docs";
+
+interface Props {
+ title?: string;
+ description?: string;
+ /** Path of the OG image, relative to the site root. */
+ image?: string;
+ type?: "website" | "article";
+ noindex?: boolean;
+}
+
+const { title, description = site.description, image = "og.png", type = "website", noindex = false } = Astro.props;
+const fullTitle = title ? `${title} · ${site.name}` : site.title;
+const canonical = new URL(Astro.url.pathname, Astro.site);
+const ogImage = new URL(href(image), Astro.site);
+---
+
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>{fullTitle}</title>
+ <meta name="description" content={description} />
+ <link rel="canonical" href={canonical} />
+ {noindex && <meta name="robots" content="noindex" />}
+ <meta name="generator" content={Astro.generator} />
+
+ <link rel="icon" type="image/png" sizes="16x16" href={href("favicon-16.png")} />
+ <link rel="icon" type="image/png" sizes="32x32" href={href("favicon-32.png")} />
+ <link rel="icon" type="image/png" sizes="48x48" href={href("favicon-48.png")} />
+ <link rel="apple-touch-icon" href={href("apple-touch-icon.png")} />
+ <link rel="sitemap" href={href("sitemap-index.xml")} />
+ <meta name="theme-color" content="#fbfbfa" media="(prefers-color-scheme: light)" />
+ <meta name="theme-color" content="#1b1b1b" media="(prefers-color-scheme: dark)" />
+
+ <meta property="og:type" content={type} />
+ <meta property="og:site_name" content={site.name} />
+ <meta property="og:title" content={fullTitle} />
+ <meta property="og:description" content={description} />
+ <meta property="og:url" content={canonical} />
+ <meta property="og:image" content={ogImage} />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:title" content={fullTitle} />
+ <meta name="twitter:description" content={description} />
+ <meta name="twitter:image" content={ogImage} />
+
+ <!-- Pick the theme before the first paint, so there's no flash. -->
+ <script is:inline>
+ (() => {
+ let stored = null;
+ try {
+ stored = localStorage.getItem("bui:theme");
+ } catch {}
+ const dark = stored ? stored === "dark" : matchMedia("(prefers-color-scheme: dark)").matches;
+ const root = document.documentElement;
+ root.dataset.theme = dark ? "dark" : "light";
+ // Scroll-in motion only when JavaScript runs and the reader is fine with motion.
+ root.classList.add("js");
+ if (!matchMedia("(prefers-reduced-motion: reduce)").matches) root.classList.add("motion");
+ })();
+ </script>
+ <slot name="head" />
+ </head>
+ <body class="min-h-dvh">
+ <a class="skip-link" href="#main">Skip to content</a>
+ <slot />
+ <div class="undo-toast" role="status" aria-live="polite" data-undo-toast></div>
+
+ <style is:global>
+ .undo-toast {
+ position: fixed;
+ left: 50%;
+ bottom: 1.5rem;
+ z-index: 90;
+ display: inline-flex;
+ align-items: center;
+ gap: 0.5rem;
+ padding: 0.5rem 0.85rem;
+ font-size: 13px;
+ color: #e8e8e8;
+ background: #232323;
+ border: 1px solid #3d3d3d;
+ box-shadow: 0 18px 40px -16px rgb(0 0 0 / 0.6);
+ opacity: 0;
+ transform: translate(-50%, 0.75rem);
+ pointer-events: none;
+ transition:
+ opacity 180ms ease-out,
+ transform 220ms var(--ease-out);
+ }
+ .undo-toast[data-show] {
+ opacity: 1;
+ transform: translate(-50%, 0);
+ }
+ </style>
+
+ <script>
+ // Scroll-in reveals and charts: add .in once an element is on screen.
+ const targets = document.querySelectorAll<HTMLElement>("[data-reveal], [data-chart]");
+ if (!("IntersectionObserver" in window) || !document.documentElement.classList.contains("motion")) {
+ targets.forEach((el) => el.classList.add("in"));
+ } else {
+ const io = new IntersectionObserver(
+ (entries) => {
+ for (const e of entries) {
+ if (!e.isIntersecting) continue;
+ e.target.classList.add("in");
+ io.unobserve(e.target);
+ }
+ },
+ { rootMargin: "0px 0px -6% 0px", threshold: 0.1 },
+ );
+ targets.forEach((el) => io.observe(el));
+ // Printing or jumping to the end shouldn't leave things invisible.
+ addEventListener("beforeprint", () => targets.forEach((el) => el.classList.add("in")));
+ }
+
+ // Ctrl+Z (Cmd+Z) goes back a page, like undoing the last click. Real undo keeps
+ // working wherever you're typing, and demos that handle Ctrl+Z themselves win.
+ const toast = document.querySelector<HTMLElement>("[data-undo-toast]");
+ let hide = 0;
+ const say = (text: string) => {
+ if (!toast) return;
+ toast.textContent = text;
+ toast.setAttribute("data-show", "");
+ clearTimeout(hide);
+ hide = window.setTimeout(() => toast.removeAttribute("data-show"), 1600);
+ };
+ document.addEventListener("keydown", (e) => {
+ if (e.defaultPrevented || !(e.ctrlKey || e.metaKey) || e.shiftKey || e.altKey || e.key.toLowerCase() !== "z") return;
+ const t = e.target as HTMLElement | null;
+ if (t?.closest("input, textarea, select, [contenteditable]:not([contenteditable='false'])")) return;
+ if (document.querySelector("dialog[open]")) return;
+ e.preventDefault();
+ if (history.length > 1) {
+ say("Undo: back to the previous page");
+ setTimeout(() => history.back(), 140);
+ } else {
+ say("Nothing to undo yet: this is the first page in this tab");
+ }
+ });
+ </script>
+ </body>
+</html>
diff --git a/website/src/layouts/DocsLayout.astro b/website/src/layouts/DocsLayout.astro
new file mode 100644
index 0000000..b45ebcc
--- /dev/null
+++ b/website/src/layouts/DocsLayout.astro
@@ -0,0 +1,188 @@
+---
+import type { MarkdownHeading } from "astro";
+import Base from "./Base.astro";
+import Header from "../components/site/Header.astro";
+import Sidebar from "../components/site/Sidebar.astro";
+import Toc from "../components/site/Toc.astro";
+import SearchPalette from "../components/site/SearchPalette.astro";
+import Icon from "../components/site/Icon.astro";
+import { currentTopLink, languages } from "../config/nav";
+import { site } from "../config/site";
+import { docHref, getNeighbours, href, lastUpdated, repoFile, statusLabel, type Doc } from "../lib/docs";
+
+interface Props {
+ doc: Doc;
+ headings: MarkdownHeading[];
+}
+
+const { doc, headings } = Astro.props;
+const { title, description, section, status, badges, sources } = doc.data;
+const { prev, next } = await getNeighbours(doc);
+const updated = lastUpdated(doc.filePath);
+const editUrl = site.editBase + (doc.filePath?.replace(/^.*src\/content\/docs\//, "") ?? `${doc.id}.mdx`);
+const langNames = doc.data.languages.map((id) => languages.find((l) => l.id === id)?.label ?? id);
+const dateFmt = new Intl.DateTimeFormat("en", { year: "numeric", month: "long", day: "numeric" });
+---
+
+<Base title={title} description={description} type="article">
+ <Header menuTarget="docs-sidebar" current={currentTopLink(section, doc.id)} />
+ <SearchPalette />
+
+ <div class="mx-auto w-full max-w-[1480px] md:grid md:grid-cols-[264px_minmax(0,1fr)] xl:grid-cols-[264px_minmax(0,1fr)_232px]">
+ <aside
+ id="docs-sidebar"
+ data-menu
+ class="fixed inset-x-0 top-(--header-h) bottom-0 z-30 overflow-y-auto overscroll-contain bg-background md:sticky md:top-(--header-h) md:z-auto md:h-[calc(100dvh-var(--header-h))] md:border-r md:border-border md:bg-surface/45"
+ >
+ <Sidebar currentId={doc.id} />
+ </aside>
+ <script is:inline>
+ // Keep the sidebar where the reader left it, and make sure the current page is in view
+ // (centered), before the first paint so nothing jumps.
+ (() => {
+ const aside = document.getElementById("docs-sidebar");
+ if (!aside) return;
+ const key = "bui:sidebar-scroll";
+ try {
+ const saved = sessionStorage.getItem(key);
+ if (saved) aside.scrollTop = +saved;
+ } catch {}
+ const active = aside.querySelector("[aria-current=page]");
+ if (active) {
+ const a = active.getBoundingClientRect();
+ const b = aside.getBoundingClientRect();
+ if (a.top < b.top + 40 || a.bottom > b.bottom - 40) {
+ aside.scrollTop += a.top - b.top - (b.height - a.height) / 2;
+ }
+ }
+ const save = () => {
+ try {
+ sessionStorage.setItem(key, String(aside.scrollTop));
+ } catch {}
+ };
+ addEventListener("pagehide", save);
+ aside.addEventListener("click", save);
+ })();
+ </script>
+
+ <main id="main" class="min-w-0">
+ <article class="mx-auto w-full max-w-[46rem] px-4 pb-20 sm:px-8 lg:px-10">
+ <nav aria-label="Breadcrumb" class="pt-7 text-[13px] text-muted">
+ <ol class="flex flex-wrap items-center gap-1.5">
+ <li><a href={href("docs/start/introduction/")} class="hover:text-foreground">Docs</a></li>
+ <li aria-hidden="true"><Icon name="chevron-right" size={12} /></li>
+ <li>{section}</li>
+ </ol>
+ </nav>
+
+ <header class="mt-4 border-b border-border pb-8 mb-9">
+ <h1 class="text-balance text-[2rem] font-semibold leading-[1.15] tracking-[-0.025em] sm:text-[2.5rem]">{title}</h1>
+ <p class="mt-3 text-pretty text-lg leading-7 text-muted">{description}</p>
+ {
+ (status !== "stable" || badges.length > 0 || langNames.length > 0) && (
+ <ul class="mt-5 flex flex-wrap gap-2" aria-label="About this page">
+ {status !== "stable" && (
+ <li
+ class:list={[
+ "inline-flex h-6 items-center gap-1.5 border px-2 text-xs font-medium",
+ status === "coming-soon" ? "border-(--status-soon) text-(--status-soon)" : "border-(--status-preview) text-(--status-preview)",
+ ]}
+ >
+ <Icon name={status === "coming-soon" ? "hourglass-medium" : "circle-half"} weight="bold" size={12} />
+ {statusLabel[status]}
+ </li>
+ )}
+ {badges.map((b) => (
+ <li class="inline-flex h-6 items-center border border-border px-2 text-xs text-muted">{b}</li>
+ ))}
+ {langNames.map((l) => (
+ <li class="inline-flex h-6 items-center bg-surface-2 px-2 text-xs text-muted">{l}</li>
+ ))}
+ </ul>
+ )
+ }
+ </header>
+
+ <div class="prose" data-prose>
+ <slot />
+ </div>
+
+ {
+ sources.length > 0 && (
+ <aside class="mt-14 border border-border bg-surface px-4 py-3 text-sm" aria-label="Sources">
+ <p class="kicker mb-1.5 inline-flex items-center gap-1.5 text-muted"><Icon name="git-branch" size={13} /> Based on</p>
+ <ul class="flex flex-wrap gap-x-4 gap-y-1">
+ {sources.map((s) => (
+ <li>
+ <a href={repoFile(s)} class="font-mono text-[12.5px] text-link underline-offset-4 hover:underline">
+ {s}
+ </a>
+ </li>
+ ))}
+ </ul>
+ </aside>
+ )
+ }
+
+ <div class="mt-10 flex flex-col gap-2 border-t border-border pt-5 text-sm text-muted sm:flex-row sm:items-center sm:justify-between">
+ <a href={editUrl} class="inline-flex items-center gap-2 hover:text-foreground">
+ <Icon name="pencil-simple-line" size={15} /> Edit this page on GitHub
+ </a>
+ {updated && <p>Last updated <time datetime={updated.toISOString()}>{dateFmt.format(updated)}</time></p>}
+ </div>
+
+ {
+ (prev || next) && (
+ <nav aria-label="Previous and next pages" class="mt-8 grid gap-px border border-border bg-border sm:grid-cols-2">
+ {prev ? (
+ <a href={docHref(prev)} class="group flex flex-col gap-1 bg-background p-5 transition-colors hover:bg-surface">
+ <span class="kicker inline-flex items-center gap-1.5 text-muted">
+ <Icon name="arrow-left" size={12} /> Previous
+ </span>
+ <span class="font-medium group-hover:text-link">{prev.data.title}</span>
+ </a>
+ ) : (
+ <div class="hatch hidden bg-background sm:block" aria-hidden="true" />
+ )}
+ {next ? (
+ <a href={docHref(next)} class="group flex flex-col items-end gap-1 bg-background p-5 text-right transition-colors hover:bg-surface">
+ <span class="kicker inline-flex items-center gap-1.5 text-muted">
+ Next <Icon name="arrow-right" size={12} />
+ </span>
+ <span class="font-medium group-hover:text-link">{next.data.title}</span>
+ </a>
+ ) : (
+ <div class="hatch hidden bg-background sm:block" aria-hidden="true" />
+ )}
+ </nav>
+ )
+ }
+ </article>
+ </main>
+
+ <div class="hidden xl:block">
+ <div class="sticky top-(--header-h) max-h-[calc(100dvh-var(--header-h))] overflow-y-auto px-5 py-8">
+ <Toc headings={headings} />
+ </div>
+ </div>
+ </div>
+
+ <script>
+ // "#" links on headings, and wide tables wrapped so they scroll on phones.
+ const prose = document.querySelector("[data-prose]");
+ prose?.querySelectorAll<HTMLElement>(":scope > h2[id], :scope > h3[id]").forEach((h) => {
+ const a = document.createElement("a");
+ a.href = `#${h.id}`;
+ a.className = "heading-anchor unstyled";
+ a.setAttribute("aria-label", `Link to ${h.textContent}`);
+ a.textContent = "#";
+ h.append(a);
+ });
+ prose?.querySelectorAll(":scope > table").forEach((t) => {
+ const wrap = document.createElement("div");
+ wrap.className = "table-wrap";
+ t.replaceWith(wrap);
+ wrap.append(t);
+ });
+ </script>
+</Base>
diff --git a/website/src/lib/docs.ts b/website/src/lib/docs.ts
new file mode 100644
index 0000000..47e25da
--- /dev/null
+++ b/website/src/lib/docs.ts
@@ -0,0 +1,74 @@
+import { execFileSync } from "node:child_process";
+import { statSync } from "node:fs";
+import { getCollection, type CollectionEntry } from "astro:content";
+import { sections, type SectionLabel } from "../config/nav";
+import { site } from "../config/site";
+
+export type Doc = CollectionEntry<"docs">;
+
+/** Prefix a site-relative path with the configured base (works under a sub-path deploy). */
+export function href(path = ""): string {
+ const base = import.meta.env.BASE_URL.replace(/\/$/, "");
+ if (/^(https?:|mailto:|#)/.test(path)) return path;
+ return `${base}/${path.replace(/^\//, "")}`;
+}
+
+export const docHref = (doc: Doc) => href(`docs/${doc.id}/`);
+
+/** A link to a file in the BUI repository, e.g. repoFile("docs/rust.md"). */
+export const repoFile = (path: string) => site.blobBase + path.replace(/^\//, "");
+
+const sectionIndex = (label: SectionLabel) => sections.findIndex((s) => s.label === label);
+
+let cache: Doc[] | undefined;
+
+/** Every published page, in reading order (section order, then `order`, then title). */
+export async function getDocs(): Promise<Doc[]> {
+ if (cache) return cache;
+ const all = await getCollection("docs", (d) => !d.data.draft);
+ cache = all.sort(
+ (a, b) =>
+ sectionIndex(a.data.section) - sectionIndex(b.data.section) ||
+ a.data.order - b.data.order ||
+ a.data.title.localeCompare(b.data.title),
+ );
+ return cache;
+}
+
+export async function getGroups() {
+ const docs = await getDocs();
+ return sections
+ .map((section) => ({ ...section, docs: docs.filter((d) => d.data.section === section.label) }))
+ .filter((g) => g.docs.length > 0);
+}
+
+export async function getNeighbours(doc: Doc) {
+ const docs = await getDocs();
+ const i = docs.findIndex((d) => d.id === doc.id);
+ return { prev: i > 0 ? docs[i - 1] : undefined, next: i >= 0 && i < docs.length - 1 ? docs[i + 1] : undefined };
+}
+
+/** Last commit date of the source file, or its modification time when it isn't committed yet. */
+export function lastUpdated(filePath: string | undefined): Date | undefined {
+ if (!filePath) return undefined;
+ try {
+ const out = execFileSync("git", ["log", "-1", "--format=%cI", "--", filePath], {
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "ignore"],
+ }).trim();
+ if (out) return new Date(out);
+ } catch {
+ /* not a git checkout: fall through */
+ }
+ try {
+ return statSync(filePath).mtime;
+ } catch {
+ return undefined;
+ }
+}
+
+export const statusLabel = {
+ stable: "Stable",
+ preview: "Preview",
+ "coming-soon": "Coming soon",
+} as const;
diff --git a/website/src/lib/search-text.ts b/website/src/lib/search-text.ts
new file mode 100644
index 0000000..468b79a
--- /dev/null
+++ b/website/src/lib/search-text.ts
@@ -0,0 +1,52 @@
+// Turns an MDX body into plain text for the search index.
+
+export function mdxToText(body: string): string {
+ // Fenced code first, so code lines aren't mistaken for MDX imports. Short blocks are
+ // kept: commands are worth finding.
+ const codes: string[] = [];
+ const withoutCode = body.replace(/```[^\n]*\n([\s\S]*?)```/g, (_, code: string) => {
+ codes.push(code.length < 240 ? code.replace(/[<>{}]/g, " ") : "");
+ return ` @@code${codes.length - 1}@@ `;
+ });
+ return (
+ withoutCode
+ // MDX imports / exports
+ .replace(/^\s*(import|export)\s.*$/gm, "")
+ // JSX comments and expressions
+ .replace(/\{\/\*[\s\S]*?\*\/\}/g, " ")
+ // keep useful attribute text (title="..." label="..." caption="...")
+ .replace(/<[A-Z][\w.]*\b([^>]*)>/g, (_, attrs: string) => {
+ const kept = [...attrs.matchAll(/(?:title|label|caption|description)="([^"]*)"/g)].map((m) => m[1]);
+ return ` ${kept.join(" ")} `;
+ })
+ .replace(/<\/?[A-Za-z][^>]*>/g, " ")
+ // markdown syntax
+ .replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1")
+ .replace(/\[([^\]]*)\]\([^)]*\)/g, "$1")
+ .replace(/^#{1,6}\s+/gm, "")
+ .replace(/^\s*[-*+]\s+/gm, "")
+ .replace(/^\s*\|?[-:| ]+\|?\s*$/gm, " ")
+ .replace(/[*_`>|]/g, " ")
+ .replace(/@@code(\d+)@@/g, (_, i: string) => codes[Number(i)])
+ .replace(/\s+/g, " ")
+ .trim()
+ );
+}
+
+export interface Chunk {
+ /** Heading text, or "" for the part before the first heading. */
+ heading: string;
+ text: string;
+}
+
+/** Splits a body at its ## and ### headings. */
+export function splitByHeadings(body: string): Chunk[] {
+ const lines = body.replace(/```[\s\S]*?```/g, (m) => m.replace(/^#/gm, "​#")).split("\n");
+ const chunks: Chunk[] = [{ heading: "", text: "" }];
+ for (const line of lines) {
+ const m = /^(#{2,3})\s+(.+?)\s*$/.exec(line);
+ if (m) chunks.push({ heading: m[2], text: "" });
+ else chunks[chunks.length - 1].text += line + "\n";
+ }
+ return chunks.map((c) => ({ heading: c.heading, text: mdxToText(c.text.replace(/​/g, "")) }));
+}
diff --git a/website/src/lib/shots.ts b/website/src/lib/shots.ts
new file mode 100644
index 0000000..bdfd0f3
--- /dev/null
+++ b/website/src/lib/shots.ts
@@ -0,0 +1,92 @@
+// Screenshots in public/images/shots/ come in pairs: <name>-dark.png and <name>-light.png
+// (see public/images/shots/INDEX.md when it exists). These helpers find them at build time
+// and fall back to an older image under public/images/ while a shot hasn't been taken yet,
+// so pages never point at a missing file.
+import { existsSync, openSync, readSync, closeSync } from "node:fs";
+import { join } from "node:path";
+
+const PUBLIC = join(process.cwd(), "public");
+
+export interface ImageRef {
+ src: string;
+ width?: number;
+ height?: number;
+}
+
+export interface ThemedRef {
+ light: ImageRef;
+ dark: ImageRef;
+ /** True when this is a real paired shot, false when it's the fallback image. */
+ paired: boolean;
+}
+
+/** PNG / JPEG / WebP size from the file header, or undefined. */
+export function imageSize(publicPath: string): { width: number; height: number } | undefined {
+ const file = join(PUBLIC, publicPath.replace(/^\//, ""));
+ if (!existsSync(file)) return undefined;
+ const buf = Buffer.alloc(64 * 1024);
+ const fd = openSync(file, "r");
+ const n = readSync(fd, buf, 0, buf.length, 0);
+ closeSync(fd);
+ if (buf.readUInt32BE(0) === 0x89504e47) return { width: buf.readUInt32BE(16), height: buf.readUInt32BE(20) };
+ if (buf.toString("ascii", 0, 4) === "RIFF" && buf.toString("ascii", 8, 12) === "WEBP") {
+ const kind = buf.toString("ascii", 12, 16);
+ if (kind === "VP8X") return { width: 1 + buf.readUIntLE(24, 3), height: 1 + buf.readUIntLE(27, 3) };
+ if (kind === "VP8 ") return { width: buf.readUInt16LE(26) & 0x3fff, height: buf.readUInt16LE(28) & 0x3fff };
+ if (kind === "VP8L") {
+ const b = buf.readUInt32LE(21);
+ return { width: (b & 0x3fff) + 1, height: ((b >> 14) & 0x3fff) + 1 };
+ }
+ }
+ if (buf[0] === 0xff && buf[1] === 0xd8) {
+ let i = 2;
+ while (i < n - 9) {
+ if (buf[i] !== 0xff) break;
+ const marker = buf[i + 1];
+ const len = buf.readUInt16BE(i + 2);
+ if (marker >= 0xc0 && marker <= 0xc3) return { height: buf.readUInt16BE(i + 5), width: buf.readUInt16BE(i + 7) };
+ i += 2 + len;
+ }
+ }
+ return undefined;
+}
+
+const exists = (p: string) => existsSync(join(PUBLIC, p));
+
+/**
+ * The size to lay an image out at, in CSS pixels. Everything in images/shots/ is rendered at
+ * 2x (BUI_UI_SCALE=2, see INDEX.md), so it's shown at half its pixel size: sharp on HiDPI
+ * screens and the same size as the window was on a 1x screen.
+ */
+export function displaySize(publicPath: string): { width: number; height: number } | undefined {
+ const size = imageSize(publicPath);
+ if (!size) return undefined;
+ if (/^\/?images\/shots\//.test(publicPath)) return { width: Math.round(size.width / 2), height: Math.round(size.height / 2) };
+ return size;
+}
+
+const ref = (src: string): ImageRef => ({ src, ...displaySize(src) });
+
+/**
+ * A screenshot pair by name: shot("landing-tkinter", "images/tkinter_items.png").
+ * Tries images/shots/<name>-light.png + -dark.png, then a single images/shots/<name>.png,
+ * then the fallback (used for both themes).
+ */
+export function shot(name: string, fallback: string): ThemedRef {
+ const base = `images/shots/${name}`;
+ for (const ext of ["png", "webp", "jpg"]) {
+ const l = `${base}-light.${ext}`;
+ const d = `${base}-dark.${ext}`;
+ if (exists(l) || exists(d)) {
+ const light = ref(exists(l) ? l : d);
+ const dark = ref(exists(d) ? d : l);
+ return { light, dark, paired: exists(l) && exists(d) };
+ }
+ if (exists(`${base}.${ext}`)) {
+ const one = ref(`${base}.${ext}`);
+ return { light: one, dark: one, paired: false };
+ }
+ }
+ const fb = ref(fallback);
+ return { light: fb, dark: fb, paired: false };
+}
diff --git a/website/src/lib/string-search.ts b/website/src/lib/string-search.ts
new file mode 100644
index 0000000..add1aed
--- /dev/null
+++ b/website/src/lib/string-search.ts
@@ -0,0 +1,346 @@
+/* SPDX-FileCopyrightText: 2023 Blender Authors
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later */
+
+/**
+ * Blender's fuzzy string search (blenlib `BLI_string_search`), ported to TypeScript from
+ * the repository's copy in core/intern/string_search.cc. It is what Blender's menu
+ * search (F3) uses, and what BUI's kit uses for menu search and search fields.
+ *
+ * Per query word, in order of preference:
+ * 1. a word of the item starts with it ("cu" -> "Cube") +10 / +9
+ * 2. it matches the initials of several words ("msfv" -> "Mark Sharp from Vertices") +4 / +3
+ * 3. a word matches with a few typos ("tkintr" -> "tkinter") +3 - errors
+ * Every query word must match, words out of order cost 1, and results with the best
+ * score are sorted by weight, then shorter first, then recently picked first.
+ *
+ * Items can be split into groups with " ▸ " ("Python ▸ Qt syntax ▸ Signals"); words in the
+ * main group (the last one, with `mainWords: "last"`) count a little more.
+ *
+ * Port notes (BUI web): strings are JavaScript strings (UTF-16 code points via Array.from)
+ * instead of UTF-8 bytes; everything else follows the C++ line for line where it can.
+ */
+
+const ARROW_SEP = "▸"; // ▸, Blender's UI_MENU_ARROW_SEP
+const UNUSED_WORD = -1;
+
+export function damerauLevenshteinDistance(a: string, b: string): number {
+ const ca = Array.from(a);
+ const cb = Array.from(b);
+ const rowLength = cb.length + 1;
+ let v0 = new Array<number>(rowLength).fill(0);
+ let v1 = new Array<number>(rowLength);
+ let v2 = new Array<number>(rowLength).fill(0);
+ for (let i = 0; i < rowLength; i++) v1[i] = i;
+
+ for (let i = 0; i < ca.length; i++) {
+ v2[0] = i + 1;
+ for (let j = 0; j < cb.length; j++) {
+ let cost = Math.min(v1[j + 1] + 1, v2[j] + 1, v1[j] + (ca[i] !== cb[j] ? 1 : 0));
+ if (i > 0 && j > 0 && ca[i] === cb[j - 1] && ca[i - 1] === cb[j]) {
+ cost = Math.min(cost, v0[j - 1] + 1);
+ }
+ v2[j + 1] = cost;
+ }
+ [v0, v1, v2] = [v1, v2, v0];
+ }
+ return v1[rowLength - 1];
+}
+
+/** Number of errors when `query` fuzzily matches a part of `full`, or -1 when it doesn't. */
+export function getFuzzyMatchErrors(query: string, full: string): number {
+ if (full.includes(query)) return 0;
+
+ const q = Array.from(query);
+ const f = Array.from(full);
+ if (q.length === 1) return -1;
+
+ const maxErrors = q.length <= 1 ? 0 : Math.floor(q.length / 8) + 1;
+ if (q.length - f.length > maxErrors) return -1;
+
+ const windowSize = Math.min(q.length + maxErrors, f.length);
+ const extraChars = Math.max(windowSize - q.length, 0);
+ const maxAcceptableDistance = maxErrors + extraChars;
+
+ let begin = 0;
+ let end = windowSize;
+ for (;;) {
+ let distance = 0;
+ // Expect the first or second character of the query to be right; it saves work.
+ if (f[begin] === q[0] || f[begin] === q[1]) {
+ distance = damerauLevenshteinDistance(query, f.slice(begin, end).join(""));
+ if (distance <= maxAcceptableDistance) return distance;
+ }
+ if (end === f.length) return -1;
+ // A large distance can't shrink quickly: skip ahead a few characters.
+ const offset = Math.max(1, Math.floor(distance / 2));
+ for (let i = 0; i < offset && end < f.length; i++) {
+ begin++;
+ end++;
+ }
+ }
+}
+
+export type MainWords = "first" | "last" | "all";
+
+interface Item<T> {
+ data: T;
+ words: string[];
+ groups: number[];
+ mainGroup: number;
+ mainGroupLength: number;
+ totalLength: number;
+ weight: number;
+ recentTime: number;
+ deprecated: boolean;
+}
+
+/** Splits at spaces, -, _, / and ▸ (which also starts a new group), lower-cased. */
+export function extractNormalizedWords(str: string): { words: string[]; groups: number[] } {
+ const words: string[] = [];
+ const groups: number[] = [];
+ const lower = str.toLowerCase();
+ let group = 0;
+ let current = "";
+ for (const ch of lower) {
+ if (ch === " " || ch === "-" || ch === "_" || ch === "/" || ch === ARROW_SEP) {
+ if (current) {
+ words.push(current);
+ groups.push(group);
+ current = "";
+ }
+ if (ch === ARROW_SEP) group++;
+ } else {
+ current += ch;
+ }
+ }
+ if (current) {
+ words.push(current);
+ groups.push(group);
+ }
+ return { words, groups };
+}
+
+const countMainGroupMatches = (indices: number[], item: Item<unknown>) =>
+ indices.filter((i) => item.groups[i] === item.mainGroup).length;
+
+/**
+ * Matches the query against the first characters of words, in order, skipping words:
+ * "msfv" -> "Mark Sharp from Vertices", "seboulo" -> "select boundary loop".
+ */
+function matchWordInitials(query: string, item: Item<unknown>, wordMatchMap: number[], start = 0): number[] | null {
+ const words = item.words;
+ if (start >= words.length) return null;
+ const matched: number[] = [];
+ const q = Array.from(query);
+ let wordIndex = start;
+ let charIndex = 0;
+ let firstFound = -1;
+
+ for (const qc of q) {
+ for (;;) {
+ if (wordIndex >= words.length) {
+ if (firstFound >= 0) return matchWordInitials(query, item, wordMatchMap, firstFound + 1);
+ return null;
+ }
+ if (wordMatchMap[wordIndex] !== UNUSED_WORD) {
+ wordIndex++;
+ continue;
+ }
+ const word = Array.from(words[wordIndex]);
+ if (charIndex < word.length) {
+ const wc = word[charIndex++];
+ if (qc === wc) {
+ matched.push(wordIndex);
+ if (firstFound === -1) firstFound = wordIndex;
+ break;
+ }
+ }
+ wordIndex++;
+ charIndex = 0;
+ }
+ }
+ const sub = matchWordInitials(query, item, wordMatchMap, firstFound + 1);
+ if (sub && countMainGroupMatches(sub, item) > countMainGroupMatches(matched, item)) return sub;
+ return matched;
+}
+
+function bestWordThatStartsWith(query: string, item: Item<unknown>, wordMatchMap: number[], remaining: string[]): number {
+ // If a later query word also starts with this one, take the shortest word so the later
+ // one still finds its match ("t test" must match "Test").
+ const useShortest = remaining.some((w) => w.startsWith(query));
+ let bestSize = Number.MAX_SAFE_INTEGER;
+ let best = -1;
+ let bestInMain = false;
+ item.words.forEach((word, i) => {
+ if (wordMatchMap[i] !== UNUSED_WORD || !word.startsWith(query)) return;
+ const inMain = item.groups[i] === item.mainGroup;
+ const better = useShortest ? word.length < bestSize : !bestInMain;
+ if (better) {
+ best = i;
+ bestSize = word.length;
+ bestInMain = inMain;
+ }
+ });
+ return best;
+}
+
+function scoreQueryAgainstWords(queryWords: string[], item: Item<unknown>): number | null {
+ const wordMatchMap = new Array<number>(item.words.length).fill(UNUSED_WORD);
+ let total = item.deprecated ? 500 : 1000;
+
+ for (let qi = 0; qi < queryWords.length; qi++) {
+ const qw = queryWords[qi];
+ const w = bestWordThatStartsWith(qw, item, wordMatchMap, queryWords.slice(qi + 1));
+ if (w >= 0) {
+ total += item.groups[w] === item.mainGroup ? 10 : 9;
+ wordMatchMap[w] = qi;
+ continue;
+ }
+ const initials = matchWordInitials(qw, item, wordMatchMap);
+ if (initials) {
+ total += countMainGroupMatches(initials, item) === initials.length ? 4 : 3;
+ for (const i of initials) wordMatchMap[i] = qi;
+ continue;
+ }
+ let fuzzy = -1;
+ let errors = 0;
+ for (let i = 0; i < item.words.length; i++) {
+ if (wordMatchMap[i] !== UNUSED_WORD) continue;
+ const e = getFuzzyMatchErrors(qw, item.words[i]);
+ if (e >= 0) {
+ fuzzy = i;
+ errors = e;
+ break;
+ }
+ }
+ if (fuzzy >= 0) {
+ total += 3 - errors;
+ wordMatchMap[fuzzy] = qi;
+ continue;
+ }
+ return null;
+ }
+
+ // Penalty for query words matched out of order.
+ const order = wordMatchMap.filter((i) => i !== UNUSED_WORD);
+ for (let i = 0; i + 1 < order.length; i++) if (order[i] > order[i + 1]) total -= 1;
+ return total;
+}
+
+/** Recently picked strings, newest with the highest logical time. */
+export interface RecentCache {
+ get(str: string): number | undefined;
+}
+
+export class StringSearch<T> {
+ private items: Item<T>[] = [];
+ private mainWords: MainWords;
+ private recent?: RecentCache;
+
+ constructor(mainWords: MainWords = "last", recent?: RecentCache) {
+ this.mainWords = mainWords;
+ this.recent = recent;
+ }
+
+ /** `weight`: higher wins among equally good matches. */
+ add(str: string, data: T, weight = 0) {
+ const { words, groups } = extractNormalizedWords(str);
+ let mainGroup = 0;
+ if (groups.length) {
+ if (this.mainWords === "last") mainGroup = groups[groups.length - 1];
+ else if (this.mainWords === "all") groups.fill(0);
+ }
+ let mainGroupLength = 0;
+ words.forEach((w, i) => groups[i] === mainGroup && (mainGroupLength += w.length));
+ this.items.push({
+ data,
+ words,
+ groups,
+ mainGroup,
+ mainGroupLength,
+ totalLength: str.length,
+ weight,
+ recentTime: this.recent?.get(str) ?? -1,
+ deprecated: str.includes("eprecated"),
+ });
+ }
+
+ /** Matching items, best first, with their scores. */
+ queryScored(query: string): { data: T; score: number }[] {
+ const { words: queryWords } = extractNormalizedWords(query);
+ const byScore = new Map<number, number[]>();
+ this.items.forEach((item, i) => {
+ const s = scoreQueryAgainstWords(queryWords, item);
+ if (s === null) return;
+ const list = byScore.get(s);
+ list ? list.push(i) : byScore.set(s, [i]);
+ });
+ const scores = [...byScore.keys()].sort((a, b) => b - a);
+ const out: { data: T; score: number }[] = [];
+ for (const score of scores) {
+ let indices = byScore.get(score)!;
+ if (score === scores[0]) {
+ if (query) {
+ // Shorter items are more likely the one you mean; exact matches end up on top.
+ indices.sort((a, b) => {
+ const A = this.items[a], B = this.items[b];
+ return A.mainGroupLength - B.mainGroupLength || A.totalLength - B.totalLength;
+ });
+ indices = stableSort(indices, (a, b) => this.items[b].weight - this.items[a].weight);
+ }
+ // With a short query you probably want something you picked before.
+ if (query.length <= 1) indices = stableSort(indices, (a, b) => this.items[b].recentTime - this.items[a].recentTime);
+ }
+ for (const i of indices) out.push({ data: this.items[i].data, score });
+ }
+ return out;
+ }
+
+ query(query: string): T[] {
+ return this.queryScored(query).map((r) => r.data);
+ }
+}
+
+function stableSort<T>(arr: T[], cmp: (a: T, b: T) => number): T[] {
+ return arr
+ .map((v, i) => [v, i] as const)
+ .sort((a, b) => cmp(a[0], b[0]) || a[1] - b[1])
+ .map(([v]) => v);
+}
+
+/**
+ * Remembers picks in localStorage (Blender keeps them in recent_searches.txt). Every access
+ * is guarded: private windows and blocked storage just mean "no recent picks".
+ */
+export function localRecentCache(key: string, max = 50) {
+ const read = (): string[] => {
+ try {
+ const v = JSON.parse(localStorage.getItem(key) ?? "[]");
+ return Array.isArray(v) ? v.filter((s) => typeof s === "string") : [];
+ } catch {
+ return [];
+ }
+ };
+ let times: Map<string, number> | null = null;
+ return {
+ /** Larger is more recent. */
+ get(str: string) {
+ if (!times) {
+ const list = read();
+ times = new Map(list.map((s, i) => [s, list.length - i]));
+ }
+ return times.get(str);
+ },
+ list: read,
+ remember(str: string) {
+ times = null;
+ try {
+ const list = [str, ...read().filter((s) => s !== str)].slice(0, max);
+ localStorage.setItem(key, JSON.stringify(list));
+ } catch {
+ /* storage unavailable */
+ }
+ },
+ };
+}
diff --git a/website/src/pages/404.astro b/website/src/pages/404.astro
new file mode 100644
index 0000000..171afda
--- /dev/null
+++ b/website/src/pages/404.astro
@@ -0,0 +1,65 @@
+---
+import Base from "../layouts/Base.astro";
+import Header from "../components/site/Header.astro";
+import SearchPalette from "../components/site/SearchPalette.astro";
+import Icon from "../components/site/Icon.astro";
+import { href } from "../lib/docs";
+---
+
+<Base title="Page not found" description="This page doesn't exist." noindex>
+ <Header />
+ <SearchPalette />
+ <main id="main" class="mx-auto flex min-h-[calc(100dvh-var(--header-h))] max-w-3xl flex-col justify-center gap-8 px-5 py-16">
+ <div class="hatch h-10 border-y border-border" aria-hidden="true"></div>
+ <div class="flex flex-col gap-4" data-reveal>
+ <p class="kicker inline-flex items-center gap-2 text-link"><Icon name="arrow-counter-clockwise" weight="bold" size={13} /> Error 404</p>
+ <h1 class="text-balance text-4xl font-light leading-[1.08] tracking-[-0.03em] sm:text-6xl">This page got undone.</h1>
+ <p class="max-w-[54ch] text-pretty text-lg leading-8 text-muted">
+ Press <kbd class="k">Ctrl</kbd>+<kbd class="k">Z</kbd> to undo the undo. (It takes you back to where you were;
+ this whole site works that way.) Or search: the page may have moved.
+ </p>
+ </div>
+ <div class="flex flex-wrap gap-3">
+ <button
+ type="button"
+ data-go-back
+ class="inline-flex h-11 items-center gap-2 bg-primary px-5 text-[15px] font-medium text-white transition-colors hover:bg-primary-hover"
+ >
+ <Icon name="arrow-counter-clockwise" size={16} /> Undo the undo
+ </button>
+ <button
+ type="button"
+ data-search-open
+ class="inline-flex h-11 items-center gap-2 border border-border px-5 text-[15px] transition-colors hover:bg-foreground/5"
+ >
+ <Icon name="magnifying-glass" size={16} /> Search the docs
+ </button>
+ <a href={href("")} class="inline-flex h-11 items-center gap-2 border border-border px-5 text-[15px] transition-colors hover:bg-foreground/5">
+ <Icon name="house" size={16} /> Go home
+ </a>
+ </div>
+ </main>
+</Base>
+
+<style>
+ .k {
+ display: inline-block;
+ min-width: 1.6em;
+ padding: 0 0.4em;
+ font-family: var(--font-sans);
+ font-size: 0.8em;
+ font-weight: 500;
+ text-align: center;
+ color: var(--foreground);
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-bottom-width: 2px;
+ }
+</style>
+
+<script>
+ document.querySelector("[data-go-back]")?.addEventListener("click", () => {
+ if (history.length > 1) history.back();
+ else location.href = document.querySelector<HTMLAnchorElement>("a[aria-label='BUI home']")?.href ?? "/";
+ });
+</script>
diff --git a/website/src/pages/docs/[...slug].astro b/website/src/pages/docs/[...slug].astro
new file mode 100644
index 0000000..0850792
--- /dev/null
+++ b/website/src/pages/docs/[...slug].astro
@@ -0,0 +1,23 @@
+---
+import { render } from "astro:content";
+import DocsLayout from "../../layouts/DocsLayout.astro";
+import * as mdxComponents from "../../components/docs";
+import { getDocs, type Doc } from "../../lib/docs";
+
+export async function getStaticPaths() {
+ const docs = await getDocs();
+ return docs.map((doc) => ({ params: { slug: doc.id }, props: { doc } }));
+}
+
+interface Props {
+ doc: Doc;
+}
+
+const { doc } = Astro.props;
+const { Content, headings } = await render(doc);
+---
+
+<DocsLayout doc={doc} headings={headings}>
+ {/* Every docs component is available in MDX without an import. */}
+ <Content components={mdxComponents} />
+</DocsLayout>
diff --git a/website/src/pages/index.astro b/website/src/pages/index.astro
new file mode 100644
index 0000000..48134c8
--- /dev/null
+++ b/website/src/pages/index.astro
@@ -0,0 +1,133 @@
+---
+import Base from "../layouts/Base.astro";
+import Header from "../components/site/Header.astro";
+import Footer from "../components/site/Footer.astro";
+import SearchPalette from "../components/site/SearchPalette.astro";
+import Icon from "../components/site/Icon.astro";
+import Hero from "../components/landing/Hero.astro";
+import Section from "../components/landing/Section.astro";
+import Ways from "../components/landing/Ways.astro";
+import Feel from "../components/landing/Feel.astro";
+import Performance from "../components/landing/Performance.astro";
+import Platforms from "../components/landing/Platforms.astro";
+import Coming from "../components/landing/Coming.astro";
+import Components from "../components/landing/Components.astro";
+import { href } from "../lib/docs";
+---
+
+<Base>
+ <Header />
+ <SearchPalette />
+
+ <div class="bg-surface pb-10 sm:px-[3%] sm:pt-6">
+ <main id="main" class="mx-auto max-w-[1400px] border-border bg-background sm:border">
+ <Hero />
+
+ <div class="hatch h-10 border-y border-border" aria-hidden="true"></div>
+
+
+ <Section
+ id="performance"
+ kicker="Fast by design"
+ title="Starts in milliseconds, then sleeps"
+ lede="Damage rendering redraws only the widget that changed. On the same gpui code, BUI shows its first frame about 5× sooner than gpui and uses a fraction of the CPU."
+ icon="lightning"
+ >
+ <Performance />
+ </Section>
+
+ <div class="hatch h-10 border-y border-border" aria-hidden="true"></div>
+
+ <Section
+ id="ways"
+ kicker="Pick your way in"
+ title="Write it the way you already write UI"
+ lede="Five languages, a dozen syntaxes, one C runtime. Every snippet comes from the repository's docs and examples."
+ icon="code"
+ >
+ <Ways />
+ </Section>
+
+ <div class="hatch h-10 border-y border-border" aria-hidden="true"></div>
+
+ <Section
+ id="components"
+ kicker="Blender components"
+ title="Blender's own widgets, as components"
+ lede="Not look-alikes: the number fields, sliders, color picker and node editor are ported from Blender's source, behaviour included."
+ icon="sliders-horizontal"
+ >
+ <Components />
+ </Section>
+
+ <div class="hatch h-10 border-y border-border" aria-hidden="true"></div>
+
+ <Section
+ id="feel"
+ kicker="How it feels"
+ title="Blender's interaction rules, in your app"
+ lede="The habits Blender users rely on all day come along for free, in every language BUI speaks."
+ icon="hand-pointing"
+ >
+ <Feel />
+ </Section>
+
+ <div class="hatch h-10 border-y border-border" aria-hidden="true"></div>
+
+ <Section id="platforms" kicker="Platforms" title="Native on Windows and Linux" lede="With macOS written and waiting for its first real Mac.">
+ <Platforms />
+ </Section>
+
+ <div class="hatch h-10 border-y border-border" aria-hidden="true"></div>
+
+ <Section
+ id="coming"
+ kicker="What's coming"
+ title="On the roadmap"
+ lede="Honest status: these aren't built yet. Follow along, or pick one up."
+ >
+ <Coming />
+ <p class="border-t border-border px-5 py-4 text-sm sm:px-8">
+ <a href={href("docs/project/roadmap/")} class="inline-flex items-center gap-1.5 font-medium text-link hover:underline hover:underline-offset-4">
+ The full roadmap <Icon name="arrow-right" size={14} />
+ </a>
+ </p>
+ </Section>
+
+ <section class="relative overflow-hidden border-t border-border bg-stage px-5 py-16 text-foreground sm:px-10 md:py-24" aria-labelledby="cta-title">
+ <div class="cta-hatch absolute inset-0" aria-hidden="true"></div>
+ <div class="relative flex flex-col items-start gap-6 md:flex-row md:items-end md:justify-between">
+ <div class="flex flex-col gap-4">
+ <p class="kicker text-link">Ready when you are</p>
+ <h2 id="cta-title" class="max-w-[18ch] text-balance text-4xl font-light leading-[1.05] tracking-[-0.03em] sm:text-6xl">
+ Blender's UI, minus the default cube.
+ </h2>
+ </div>
+ <div class="flex flex-wrap gap-3">
+ <a
+ href={href("docs/start/installation/")}
+ class="inline-flex h-11 items-center gap-2 bg-primary px-5 text-[15px] font-medium text-primary-ink transition-colors hover:bg-primary-hover"
+ >
+ Install BUI <Icon name="arrow-right" size={16} />
+ </a>
+ <a
+ href={href("docs/start/introduction/")}
+ class="inline-flex h-11 items-center border border-border-strong px-5 text-[15px] transition-colors hover:border-muted hover:bg-surface"
+ >
+ Read the docs
+ </a>
+ </div>
+ </div>
+ </section>
+
+ <Footer />
+ </main>
+ </div>
+</Base>
+
+<style>
+ .cta-hatch {
+ background-image: repeating-linear-gradient(135deg, rgb(71 114 179 / 0.2) 0 1.5px, transparent 1.5px 7px);
+ mask-image: linear-gradient(90deg, transparent 20%, black 100%);
+ }
+</style>
diff --git a/website/src/pages/robots.txt.ts b/website/src/pages/robots.txt.ts
new file mode 100644
index 0000000..184b0b0
--- /dev/null
+++ b/website/src/pages/robots.txt.ts
@@ -0,0 +1,10 @@
+// robots.txt, pointing crawlers at the sitemap for whatever SITE_URL / BASE_PATH the build uses.
+import type { APIRoute } from "astro";
+
+export const GET: APIRoute = ({ site }) => {
+ const base = import.meta.env.BASE_URL.replace(/\/?$/, "/");
+ const sitemap = new URL(`${base}sitemap-index.xml`, site).href;
+ return new Response(`User-agent: *\nAllow: /\n\nSitemap: ${sitemap}\n`, {
+ headers: { "Content-Type": "text/plain; charset=utf-8" },
+ });
+};
diff --git a/website/src/pages/search.json.ts b/website/src/pages/search.json.ts
new file mode 100644
index 0000000..772af04
--- /dev/null
+++ b/website/src/pages/search.json.ts
@@ -0,0 +1,54 @@
+// The static search index, built with the site: /search.json
+import type { APIRoute } from "astro";
+import { render } from "astro:content";
+import { docHref, getDocs } from "../lib/docs";
+import { splitByHeadings } from "../lib/search-text";
+
+export interface SearchRecord {
+ /** Page title */
+ t: string;
+ /** Section heading inside the page ("" for the page itself) */
+ h: string;
+ /** URL, with #anchor for headings */
+ u: string;
+ /** Sidebar section */
+ s: string;
+ /** Text (trimmed) */
+ x: string;
+ /** Page status, when not stable */
+ st?: string;
+}
+
+export const GET: APIRoute = async () => {
+ const records: SearchRecord[] = [];
+ for (const doc of await getDocs()) {
+ const { headings } = await render(doc);
+ const anchors = headings.filter((h) => h.depth === 2 || h.depth === 3);
+ const chunks = splitByHeadings(doc.body ?? "");
+ const url = docHref(doc);
+ const status = doc.data.status === "stable" ? undefined : doc.data.status;
+ chunks.forEach((chunk, i) => {
+ if (i === 0) {
+ records.push({
+ t: doc.data.title,
+ h: "",
+ u: url,
+ s: doc.data.section,
+ x: `${doc.data.description} ${doc.data.languages.join(" ")} ${doc.data.badges.join(" ")} ${chunk.text}`.slice(0, 600),
+ st: status,
+ });
+ return;
+ }
+ const anchor = anchors[i - 1];
+ records.push({
+ t: doc.data.title,
+ h: anchor?.text ?? chunk.heading,
+ u: anchor ? `${url}#${anchor.slug}` : url,
+ s: doc.data.section,
+ x: chunk.text.slice(0, 600),
+ st: status,
+ });
+ });
+ }
+ return new Response(JSON.stringify(records), { headers: { "Content-Type": "application/json; charset=utf-8" } });
+};
diff --git a/website/src/styles/charts.css b/website/src/styles/charts.css
new file mode 100644
index 0000000..53d79c4
--- /dev/null
+++ b/website/src/styles/charts.css
@@ -0,0 +1,134 @@
+/* Charts (src/components/charts). Bars grow in when the chart scrolls into view
+ (.motion + .in, see Base.astro); without JavaScript or with reduced motion they're
+ simply drawn. */
+
+.chart {
+ background: var(--background);
+}
+
+.chart-hatch,
+.chart-bar.is-other {
+ background-image: repeating-linear-gradient(135deg, rgb(255 255 255 / 0.28) 0 1px, transparent 1px 4px);
+}
+[data-theme="dark"] .chart-hatch,
+[data-theme="dark"] .chart-bar.is-other {
+ background-image: repeating-linear-gradient(135deg, rgb(0 0 0 / 0.32) 0 1px, transparent 1px 4px);
+}
+
+.chart-track {
+ position: relative;
+ display: block;
+ height: 1.625rem;
+ /* faint quarter lines */
+ background-image: linear-gradient(90deg, var(--chart-grid) 1px, transparent 1px);
+ background-size: 20.5% 100%;
+ background-position: 0 0;
+}
+.chart-track.is-thin {
+ height: 1.125rem;
+}
+
+.chart-bar {
+ position: absolute;
+ inset: 0 auto 0 0;
+ /* the longest bar takes two thirds of the track, so every value label fits after it */
+ width: calc(var(--p) * var(--scale, 0.66));
+ min-width: 2px;
+ background-color: var(--c, var(--chart-other));
+ transform-origin: left center;
+}
+.chart-bar.is-ours {
+ background-color: var(--c, var(--primary));
+}
+
+.chart-value {
+ position: absolute;
+ top: 50%;
+ left: calc(var(--p) * var(--scale, 0.66) + 0.5rem);
+ transform: translateY(-50%);
+ display: inline-flex;
+ align-items: baseline;
+ gap: 0.5rem;
+ font-size: 12.5px;
+ white-space: nowrap;
+}
+
+.chart-ratio {
+ font-size: 11px;
+ font-weight: 500;
+ color: var(--status-warn);
+}
+
+.chart-headline {
+ border-left: 0;
+}
+
+/* Line chart */
+.chart-grid {
+ stroke: var(--chart-grid);
+ stroke-width: 1;
+}
+.chart-axis {
+ fill: var(--muted);
+ font-size: 11px;
+ font-variant-numeric: tabular-nums;
+}
+.chart-label {
+ fill: var(--muted);
+ font-size: 11.5px;
+ font-variant-numeric: tabular-nums;
+}
+.chart-label.is-ours {
+ fill: var(--foreground);
+ font-weight: 600;
+}
+
+/* "Open bench" */
+.chart-details[open] > summary {
+ color: var(--foreground);
+}
+
+/* ---- motion ---- */
+.motion .chart .chart-bar {
+ transition: transform 900ms var(--ease-out);
+ transition-delay: calc(var(--i, 0) * 60ms + 120ms);
+}
+.motion .chart .chart-value {
+ transition: opacity 500ms ease-out;
+ transition-delay: calc(var(--i, 0) * 60ms + 500ms);
+}
+.motion .chart:not(.in) .chart-bar {
+ transform: scaleX(0);
+}
+.motion .chart:not(.in) .chart-value {
+ opacity: 0;
+}
+
+.chart-path {
+ stroke-dasharray: 1;
+ stroke-dashoffset: 0;
+}
+.motion .chart .chart-path {
+ transition: stroke-dashoffset 1200ms var(--ease-out);
+ transition-delay: calc(var(--i, 0) * 180ms + 150ms);
+}
+.motion .chart:not(.in) .chart-path {
+ stroke-dashoffset: 1;
+}
+.motion .chart .chart-point {
+ transition: opacity 400ms ease-out;
+ transition-delay: calc(var(--i, 0) * 180ms + var(--j, 0) * 250ms + 300ms);
+}
+.motion .chart:not(.in) .chart-point {
+ opacity: 0;
+}
+
+/* Phones: shorter bars so the labels fit; the headline carries the ratio. */
+@media (max-width: 639.98px) {
+ .chart-track {
+ --scale: 0.5;
+ }
+ .chart-ratio {
+ display: none;
+ }
+}
diff --git a/website/src/styles/global.css b/website/src/styles/global.css
new file mode 100644
index 0000000..5a52bfb
--- /dev/null
+++ b/website/src/styles/global.css
@@ -0,0 +1,589 @@
+@import "tailwindcss";
+@import "@fontsource-variable/inter/index.css";
+@import "@fontsource-variable/jetbrains-mono/index.css";
+@import "./charts.css";
+
+/* Dark mode follows <html data-theme="dark">, set before paint by Base.astro. */
+@custom-variant dark (&:where([data-theme="dark"], [data-theme="dark"] *));
+
+/* ------------------------------------------------------------------------
+ Design tokens. Blender's default theme, read for the web.
+ Light is the base; dark comes from the toggle (data-theme) or, without
+ JavaScript, from the system. Keep the two dark blocks in sync.
+ ------------------------------------------------------------------------ */
+:root {
+ color-scheme: light;
+
+ /* Blender's selection blue and its active orange */
+ --primary: #4772b3;
+ --primary-hover: #3d65a3;
+ --primary-ink: #ffffff; /* text on a primary fill */
+ --primary-soft: #e3ebf6; /* a quiet blue surface: current sidebar section, selected rows */
+ --accent: #c94a00;
+ --link: #2f5896; /* primary darkened for body text on light */
+
+ --background: #fbfbfa;
+ --foreground: #161616;
+ --surface: #f2f2f0;
+ --surface-2: #e8e8e5;
+ --muted: #545452;
+ --border: #d3d3cf;
+ --border-strong: #b4b4b0;
+ --border-soft: #e5e5e1;
+ --hatch: rgb(71 114 179 / 0.24);
+ --hatch-soft: rgb(22 22 22 / 0.07);
+ --outline: rgb(0 0 0 / 0.1);
+ --code-bg: #f6f6f4;
+ --scrollbar: #c4c4c0;
+ --shadow: 0 1px 0 rgb(0 0 0 / 0.03), 0 22px 44px -26px rgb(0 0 0 / 0.3);
+ --stage: #eceeef; /* behind screenshots */
+
+ /* charts */
+ --chart-other: #9a9a96;
+ --chart-other-2: #bcbcb8;
+ --chart-other-3: #d5d5d1;
+ --chart-ours-2: #84a4d6;
+ --chart-ours-3: #b8cae7;
+ --chart-grid: rgb(0 0 0 / 0.07);
+
+ /* Blender widget colors for the demos that mimic Blender's UI. Light comes
+ from Blender's "Blender Light" preset, dark from "Blender Dark" (the same
+ XML that kit/intern/kit_theme_presets.c is generated from). */
+ --bl-stage: #a8a8a8; /* behind a demo, like the 3D viewport */
+ --bl-stage-hatch: rgb(255 255 255 / 0.13);
+ --bl-region: #b3b3b3; /* region_bg */
+ --bl-panel: #cccccc; /* panel header / back */
+ --bl-panel-line: rgb(0 0 0 / 0.14);
+ --bl-outline: #999999;
+ --bl-widget: #dbdbdb; /* wcol_regular inner */
+ --bl-widget-hover: #e8e8e8;
+ --bl-sel: #5680c2; /* inner_sel */
+ --bl-text: #1a1a1a;
+ --bl-muted: #4d4d4d;
+ --bl-footer: #999999; /* header_bg */
+ --bl-menu: #c0c0c0; /* wcol_menu_back inner */
+ --bl-menu-outline: #a6a6a6;
+ --bl-menu-text: #1a1a1a;
+ --bl-menu-match: #a34700; /* the matched letters in menu search */
+ --bl-field: #282828; /* wcol_text inner: dark in Blender Light too */
+ --bl-field-text: #dddddd;
+ --bl-pie: #212121; /* wcol_pie_menu inner: dark in Blender Light too */
+ --bl-pie-text: #d9d9d9;
+ --bl-pie-outline: #333333;
+ --bl-pie-ring: #585858;
+ --bl-shadow: rgb(0 0 0 / 0.3);
+
+ --status-stable: #23744a;
+ --status-preview: #8a5700;
+ --status-experimental: #7449ad;
+ --status-soon: #2f5896;
+ --status-warn: #b04000;
+
+ --header-h: 3.5rem;
+ --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
+}
+
+:root[data-theme="dark"] {
+ color-scheme: dark;
+ --primary-hover: #5680c2;
+ --primary-soft: #253041;
+ --accent: #ed5700;
+ --link: #8cb0ea;
+ --background: #1b1b1b;
+ --foreground: #e8e8e8;
+ --surface: #222222;
+ --surface-2: #2b2b2b;
+ --muted: #a6a6a6;
+ --border: #383838;
+ --border-strong: #4c4c4c;
+ --border-soft: #2d2d2d;
+ --hatch: rgb(71 114 179 / 0.42);
+ --hatch-soft: rgb(255 255 255 / 0.06);
+ --outline: rgb(255 255 255 / 0.08);
+ --code-bg: #171717;
+ --scrollbar: #474747;
+ --shadow: 0 1px 0 rgb(255 255 255 / 0.02), 0 24px 50px -24px rgb(0 0 0 / 0.8);
+ --stage: #141414;
+ --chart-other: #6b6b6b;
+ --chart-other-2: #555555;
+ --chart-other-3: #444444;
+ --chart-ours-2: #7d9fd4;
+ --chart-ours-3: #3a5680;
+ --chart-grid: rgb(255 255 255 / 0.07);
+ --status-stable: #6fcf97;
+ --status-preview: #f2c14e;
+ --status-experimental: #c3a1f0;
+ --status-soon: #8cb0ea;
+ --status-warn: #ff9a5c;
+ --bl-stage: #1b1b1b;
+ --bl-stage-hatch: rgb(71 114 179 / 0.16);
+ --bl-region: #303030;
+ --bl-panel: #3d3d3d;
+ --bl-panel-line: #262626;
+ --bl-outline: #1d1d1d;
+ --bl-widget: #545454;
+ --bl-widget-hover: #656565;
+ --bl-sel: #4772b3;
+ --bl-text: #e6e6e6;
+ --bl-muted: #a6a6a6;
+ --bl-footer: #232323;
+ --bl-menu: #282828;
+ --bl-menu-outline: #1d1d1d;
+ --bl-menu-text: #e6e6e6;
+ --bl-menu-match: #ffb27a;
+ --bl-field: #1d1d1d;
+ --bl-field-text: #e6e6e6;
+ --bl-pie: #282828;
+ --bl-pie-text: #e6e6e6;
+ --bl-pie-outline: #1d1d1d;
+ --bl-pie-ring: #545454;
+ --bl-shadow: rgb(0 0 0 / 0.65);
+}
+
+@media (prefers-color-scheme: dark) {
+ :root:not([data-theme]) {
+ color-scheme: dark;
+ --primary-hover: #5680c2;
+ --primary-soft: #253041;
+ --accent: #ed5700;
+ --link: #8cb0ea;
+ --background: #1b1b1b;
+ --foreground: #e8e8e8;
+ --surface: #222222;
+ --surface-2: #2b2b2b;
+ --muted: #a6a6a6;
+ --border: #383838;
+ --border-strong: #4c4c4c;
+ --border-soft: #2d2d2d;
+ --hatch: rgb(71 114 179 / 0.42);
+ --hatch-soft: rgb(255 255 255 / 0.06);
+ --outline: rgb(255 255 255 / 0.08);
+ --code-bg: #171717;
+ --scrollbar: #474747;
+ --shadow: 0 1px 0 rgb(255 255 255 / 0.02), 0 24px 50px -24px rgb(0 0 0 / 0.8);
+ --stage: #141414;
+ --chart-other: #6b6b6b;
+ --chart-other-2: #555555;
+ --chart-other-3: #444444;
+ --chart-ours-2: #7d9fd4;
+ --chart-ours-3: #3a5680;
+ --chart-grid: rgb(255 255 255 / 0.07);
+ --status-stable: #6fcf97;
+ --status-preview: #f2c14e;
+ --status-experimental: #c3a1f0;
+ --status-soon: #8cb0ea;
+ --status-warn: #ff9a5c;
+ --bl-stage: #1b1b1b;
+ --bl-stage-hatch: rgb(71 114 179 / 0.16);
+ --bl-region: #303030;
+ --bl-panel: #3d3d3d;
+ --bl-panel-line: #262626;
+ --bl-outline: #1d1d1d;
+ --bl-widget: #545454;
+ --bl-widget-hover: #656565;
+ --bl-sel: #4772b3;
+ --bl-text: #e6e6e6;
+ --bl-muted: #a6a6a6;
+ --bl-footer: #232323;
+ --bl-menu: #282828;
+ --bl-menu-outline: #1d1d1d;
+ --bl-menu-text: #e6e6e6;
+ --bl-menu-match: #ffb27a;
+ --bl-field: #1d1d1d;
+ --bl-field-text: #e6e6e6;
+ --bl-pie: #282828;
+ --bl-pie-text: #e6e6e6;
+ --bl-pie-outline: #1d1d1d;
+ --bl-pie-ring: #545454;
+ --bl-shadow: rgb(0 0 0 / 0.65);
+ }
+}
+
+@theme inline {
+ --color-background: var(--background);
+ --color-foreground: var(--foreground);
+ --color-surface: var(--surface);
+ --color-surface-2: var(--surface-2);
+ --color-muted: var(--muted);
+ --color-border: var(--border);
+ --color-border-soft: var(--border-soft);
+ --color-border-strong: var(--border-strong);
+ --color-primary: var(--primary);
+ --color-primary-hover: var(--primary-hover);
+ --color-primary-ink: var(--primary-ink);
+ --color-primary-soft: var(--primary-soft);
+ --color-accent: var(--accent);
+ --color-link: var(--link);
+ --color-code: var(--code-bg);
+ --color-stage: var(--stage);
+ --color-bl-stage: var(--bl-stage);
+ --color-bl-region: var(--bl-region);
+ --color-bl-widget: var(--bl-widget);
+ --color-bl-outline: var(--bl-outline);
+ --color-bl-text: var(--bl-text);
+ --color-bl-muted: var(--bl-muted);
+ --font-sans: "Inter Variable", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
+ --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
+}
+
+/* ------------------------------------------------------------------------
+ Base
+ ------------------------------------------------------------------------ */
+html {
+ -webkit-text-size-adjust: 100%;
+ scroll-padding-top: calc(var(--header-h) + 1rem);
+}
+
+@media (prefers-reduced-motion: no-preference) {
+ html {
+ scroll-behavior: smooth;
+ }
+}
+
+body {
+ background: var(--background);
+ color: var(--foreground);
+ font-family: var(--font-sans);
+ font-feature-settings: "cv11", "ss01"; /* Inter's single-storey a off, straight 1 */
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ text-rendering: optimizeLegibility;
+}
+
+::selection {
+ background: color-mix(in oklab, var(--primary) 32%, transparent);
+}
+
+/* In the base layer, so a utility like `outline-none` can opt out (the search field). */
+@layer base {
+ :focus-visible {
+ outline: 2px solid var(--primary);
+ outline-offset: 2px;
+ }
+
+ [data-theme="dark"] :focus-visible {
+ outline-color: #7fa3e0;
+ }
+}
+
+/* Small, square scrollbars everywhere (the sidebar, code blocks, tables), both themes. */
+* {
+ scrollbar-width: thin;
+ scrollbar-color: var(--scrollbar) transparent;
+}
+@supports selector(::-webkit-scrollbar) {
+ * {
+ scrollbar-width: auto;
+ scrollbar-color: auto;
+ }
+ *::-webkit-scrollbar {
+ width: 6px;
+ height: 6px;
+ }
+ *::-webkit-scrollbar-track,
+ *::-webkit-scrollbar-corner {
+ background: transparent;
+ }
+ *::-webkit-scrollbar-thumb {
+ background: var(--scrollbar);
+ border-radius: 0;
+ }
+ *::-webkit-scrollbar-thumb:hover,
+ *::-webkit-scrollbar-thumb:active {
+ background: var(--primary);
+ }
+ *::-webkit-scrollbar-button {
+ display: none;
+ width: 0;
+ height: 0;
+ }
+}
+
+.skip-link {
+ position: absolute;
+ left: 0.5rem;
+ top: -3rem;
+ z-index: 100;
+ padding: 0.5rem 0.75rem;
+ background: var(--primary);
+ color: #fff;
+ font-size: 0.875rem;
+}
+.skip-link:focus {
+ top: 0.5rem;
+}
+
+/* The signature: diagonal hatch dividers */
+.hatch {
+ background-image: repeating-linear-gradient(135deg, var(--hatch) 0 1px, transparent 1px 6px);
+}
+
+.hatch-soft {
+ background-image: repeating-linear-gradient(135deg, var(--hatch-soft) 0 1px, transparent 1px 6px);
+}
+
+.hatch-strong {
+ background-image: repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 4px);
+}
+
+.img-outline {
+ outline: 1px solid var(--outline);
+ outline-offset: -1px;
+}
+
+.tabular {
+ font-variant-numeric: tabular-nums;
+}
+
+.kicker {
+ font-size: 0.6875rem;
+ font-weight: 600;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+}
+
+/* Screenshots that come in light and dark pairs (<ThemedImage>, <Figure dark light>) */
+.themed-light {
+ display: block;
+}
+.themed-dark {
+ display: none;
+}
+:root[data-theme="dark"] .themed-light {
+ display: none;
+}
+:root[data-theme="dark"] .themed-dark {
+ display: block;
+}
+@media (prefers-color-scheme: dark) {
+ :root:not([data-theme]) .themed-light {
+ display: none;
+ }
+ :root:not([data-theme]) .themed-dark {
+ display: block;
+ }
+}
+
+/* ------------------------------------------------------------------------
+ Motion. Things fade up as they scroll in. Only when JavaScript runs and the
+ reader hasn't asked for reduced motion (Base.astro adds .motion to <html>).
+ ------------------------------------------------------------------------ */
+.motion [data-reveal] {
+ opacity: 0;
+ transform: translateY(14px);
+ transition:
+ opacity 700ms var(--ease-out),
+ transform 700ms var(--ease-out);
+ transition-delay: calc(var(--reveal-i, 0) * 70ms);
+}
+.motion [data-reveal].in {
+ opacity: 1;
+ transform: none;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ *,
+ *::before,
+ *::after {
+ animation-duration: 0.01ms !important;
+ animation-iteration-count: 1 !important;
+ transition-duration: 0.01ms !important;
+ scroll-behavior: auto !important;
+ }
+}
+
+/* ------------------------------------------------------------------------
+ Prose (docs pages). Plain Markdown gets these styles automatically.
+ ------------------------------------------------------------------------ */
+.prose {
+ font-size: 1rem;
+ line-height: 1.75;
+ text-wrap: pretty;
+ color: var(--foreground);
+}
+
+.prose > * + * {
+ margin-top: 1.15rem;
+}
+
+.prose :where(h2, h3, h4) {
+ text-wrap: balance;
+ letter-spacing: -0.015em;
+ scroll-margin-top: calc(var(--header-h) + 1.25rem);
+ font-weight: 600;
+ line-height: 1.25;
+}
+
+.prose h2 {
+ margin-top: 3rem;
+ padding-top: 1.75rem;
+ border-top: 1px solid var(--border-soft);
+ font-size: 1.5rem;
+}
+
+.prose > h2:first-child {
+ margin-top: 0;
+}
+
+.prose h3 {
+ margin-top: 2.25rem;
+ font-size: 1.1875rem;
+}
+
+.prose h4 {
+ margin-top: 1.75rem;
+ font-size: 1rem;
+}
+
+.prose :where(h2, h3, h4) + * {
+ margin-top: 0.75rem;
+}
+
+.prose :where(h2, h3, h4) a.heading-anchor {
+ margin-left: 0.4rem;
+ color: var(--muted);
+ opacity: 0;
+ text-decoration: none;
+ transition: opacity 120ms ease-out;
+}
+
+.prose :where(h2, h3, h4):hover a.heading-anchor,
+.prose a.heading-anchor:focus-visible {
+ opacity: 1;
+}
+
+.prose a:not(.unstyled):not(:where(.not-prose, .not-prose *)) {
+ color: var(--link);
+ text-decoration: underline;
+ text-decoration-thickness: 1px;
+ text-underline-offset: 3px;
+ text-decoration-color: color-mix(in oklab, var(--link) 40%, transparent);
+ transition: text-decoration-color 120ms ease-out;
+}
+
+.prose a:not(.unstyled):not(:where(.not-prose, .not-prose *)):hover {
+ text-decoration-color: var(--link);
+}
+
+.prose strong {
+ font-weight: 600;
+}
+
+.prose :where(ul, ol) {
+ padding-left: 1.35rem;
+}
+
+.prose ul {
+ list-style: square;
+}
+
+.prose ul > li::marker {
+ color: var(--primary);
+}
+
+.prose ol {
+ list-style: decimal;
+}
+
+.prose ol > li::marker {
+ color: var(--muted);
+ font-variant-numeric: tabular-nums;
+}
+
+.prose li + li {
+ margin-top: 0.4rem;
+}
+
+.prose li > :where(ul, ol) {
+ margin-top: 0.4rem;
+}
+
+.prose :not(pre) > code {
+ font-family: var(--font-mono);
+ font-size: 0.85em;
+ padding: 0.12em 0.36em;
+ background: var(--surface-2);
+ outline: 1px solid var(--outline);
+ outline-offset: -1px;
+ overflow-wrap: anywhere;
+}
+
+.prose blockquote {
+ padding: 0.25rem 0 0.25rem 1rem;
+ color: var(--muted);
+ background-image: linear-gradient(var(--border-strong), var(--border-strong));
+ background-size: 1px 100%;
+ background-repeat: no-repeat;
+}
+
+.prose hr {
+ border: 0;
+ height: 0.75rem;
+ margin-block: 2.5rem;
+ background-image: repeating-linear-gradient(135deg, var(--hatch) 0 1px, transparent 1px 6px);
+ border-block: 1px solid var(--border);
+}
+
+.prose img {
+ max-width: 100%;
+ height: auto;
+}
+
+/* Tables: bordered; wide ones scroll sideways (DocsLayout wraps them in .table-wrap) */
+.prose > table {
+ border: 1px solid var(--border);
+}
+
+.prose .table-wrap {
+ position: relative;
+ overflow-x: auto;
+ border: 1px solid var(--border);
+}
+
+.prose table:not(:where(.not-prose *)) {
+ width: 100%;
+ border-collapse: collapse;
+ font-size: 0.875rem;
+ line-height: 1.55;
+}
+
+.prose th:not(:where(.not-prose *)) {
+ text-align: left;
+ font-weight: 600;
+ padding: 0.6rem 0.85rem;
+ background: var(--surface);
+ border-bottom: 1px solid var(--border);
+ white-space: nowrap;
+}
+
+.prose td:not(:where(.not-prose *)) {
+ padding: 0.6rem 0.85rem;
+ vertical-align: top;
+ border-bottom: 1px solid var(--border-soft);
+}
+
+.prose tr:last-child td:not(:where(.not-prose *)) {
+ border-bottom: 0;
+}
+
+.prose td[align="right"],
+.prose th[align="right"] {
+ text-align: right;
+ font-variant-numeric: tabular-nums;
+}
+
+/* Expressive Code blocks sit flush with the prose rhythm */
+.prose .expressive-code {
+ margin-top: 1.25rem;
+}
+
+.prose > .expressive-code + * {
+ margin-top: 1.25rem;
+}
+
+/* Mobile drawers (site menu, docs sidebar) open with [data-open] */
+@media (max-width: 767.98px) {
+ [data-menu]:not([data-open]) {
+ display: none;
+ }
+}
diff --git a/website/tsconfig.json b/website/tsconfig.json
new file mode 100644
index 0000000..990abae
--- /dev/null
+++ b/website/tsconfig.json
@@ -0,0 +1,11 @@
+{
+ "extends": "astro/tsconfigs/strict",
+ "include": [".astro/types.d.ts", "**/*"],
+ "exclude": ["dist"],
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["src/*"]
+ }
+ }
+}