From 90e35a023c064062b665574fc3aec309f9ebb7d5 Mon Sep 17 00:00:00 2001 From: Adam Harris Date: Wed, 21 Oct 2026 14:46:24 -0600 Subject: [PATCH 01/13] feat(dioxus-tui): paint the leaf-dioxus editor into terminal cells A prototype answering whether the Dioxus editor could replace leaf-tui. Dioxus 0.8 has no terminal renderer: dioxus-tui left the Dioxus repo in March 2024 (7cc326488) and Blitz did not keep it. So this keeps Blitz's DOM, styles and layout as the Mac app uses them and replaces only the painter: apps/leaf-dioxus-tui walks the laid-out tree and writes cells. The editor runs unchanged on a windowless DioxusDocument with a stub winit window, crossterm keys handed to Editor::key, clicks as Blitz pointer events. A monospace face at one cell per advance makes the editor's own parley layout count in cells. No change to leaf-dioxus or unit. docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md has the routes, what the prototype does and does not do against leaf-tui, and the decisions left to make. --- apps/leaf-dioxus-tui/.gitignore | 2 + apps/leaf-dioxus-tui/Cargo.lock | 6623 +++++++++++++++++ apps/leaf-dioxus-tui/Cargo.toml | 67 + apps/leaf-dioxus-tui/README.md | 33 + apps/leaf-dioxus-tui/src/main.rs | 412 + apps/leaf-dioxus-tui/src/paint.rs | 647 ++ apps/leaf-dioxus-tui/src/term.rs | 250 + apps/leaf-dioxus-tui/src/window.rs | 206 + docs/proposals/proposals.md | 1 + .../the-leaf-dioxus-editor-in-a-terminal.md | 128 + 10 files changed, 8369 insertions(+) create mode 100644 apps/leaf-dioxus-tui/.gitignore create mode 100644 apps/leaf-dioxus-tui/Cargo.lock create mode 100644 apps/leaf-dioxus-tui/Cargo.toml create mode 100644 apps/leaf-dioxus-tui/README.md create mode 100644 apps/leaf-dioxus-tui/src/main.rs create mode 100644 apps/leaf-dioxus-tui/src/paint.rs create mode 100644 apps/leaf-dioxus-tui/src/term.rs create mode 100644 apps/leaf-dioxus-tui/src/window.rs create mode 100644 docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md diff --git a/apps/leaf-dioxus-tui/.gitignore b/apps/leaf-dioxus-tui/.gitignore new file mode 100644 index 00000000..c716ebb2 --- /dev/null +++ b/apps/leaf-dioxus-tui/.gitignore @@ -0,0 +1,2 @@ +# A standalone workspace with its own target dir, as apps/leaf-dioxus. +/target diff --git a/apps/leaf-dioxus-tui/Cargo.lock b/apps/leaf-dioxus-tui/Cargo.lock new file mode 100644 index 00000000..97dd57c3 --- /dev/null +++ b/apps/leaf-dioxus-tui/Cargo.lock @@ -0,0 +1,6623 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ab_glyph" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" + +[[package]] +name = "accesskit" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad442f58ee04714aaa0ba0a2768c1ea1935b29507bb22ddece8cbbc76db02932" +dependencies = [ + "uuid", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags", + "cc", + "jni 0.22.4", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.21", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "anyrender" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1755d0ef8e00e87b6b825dfbe5a35d34d3b302e97e80a48e93f9cd361fbada06" +dependencies = [ + "kurbo", + "peniko", + "raw-window-handle", + "smallvec", +] + +[[package]] +name = "anyrender_svg" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39327debd1bdca190d086c107825a5dc4c665be31e99e5c0854345a050d08cad" +dependencies = [ + "anyrender", + "image", + "kurbo", + "peniko", + "usvg", +] + +[[package]] +name = "anyrender_vello" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04d545f71a3f13b1099d5787c44cfeb00322cebbebbf90c4f8cdae78bee423f7" +dependencies = [ + "anyrender", + "debug_timer", + "futures-channel", + "kurbo", + "peniko", + "pollster", + "rustc-hash 2.1.3", + "vello", + "wasm-bindgen-futures", + "wgpu 30.0.1", + "wgpu_context", +] + +[[package]] +name = "anyrender_vello_cpu" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a09d9356dd2b2f032345711a350c0e2326a854cb5070f899265bc80fb33884b1" +dependencies = [ + "anyrender", + "bytemuck", + "color", + "debug_timer", + "glifo", + "kurbo", + "peniko", + "pixels_window_renderer", + "vello_common", + "vello_cpu", +] + +[[package]] +name = "app_units" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "467b60e4ee6761cd6fd4e03ea58acefc8eec0d1b1def995c1b3b783fa7be8a60" +dependencies = [ + "num-traits", + "serde", +] + +[[package]] +name = "arboard" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb9553e62312c8756a5979254fc6d7da8bbeb5986a1e17037fab932f7037917" +dependencies = [ + "clipboard-win", + "image", + "log", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "parking_lot", + "percent-encoding", + "windows-sys 0.61.2", + "x11rb", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + +[[package]] +name = "ash" +version = "0.38.0+1.3.281" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f" +dependencies = [ + "libloading", +] + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atomic_refcell" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21e4227379beff4205943696e6c3e0cd809bacdf3f0edd6e3dd153e2269571a4" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec 0.8.0", +] + +[[package]] +name = "bit-set" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ddef2995421ab6a5c779542c81ee77c115206f4ad9d5a8e05f4ff49716a3dd" +dependencies = [ + "bit-vec 0.9.1", +] + +[[package]] +name = "bit-set" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d" +dependencies = [ + "bit-vec 0.9.1", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bit-vec" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "blitz-dom" +version = "0.3.0-beta.4" +source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95" +dependencies = [ + "accesskit", + "anyrender", + "app_units", + "atomic_refcell", + "bitflags", + "blitz-traits", + "color", + "cssparser", + "cursor-icon", + "debug_timer", + "euclid", + "html-escape", + "icu_casemap", + "icu_locale_core", + "icu_properties", + "icu_segmenter", + "image", + "keyboard-types", + "kurbo", + "linebender_resource_handle", + "markup5ever", + "objc2", + "parley", + "percent-encoding", + "rayon", + "selectors", + "skrifa", + "slotmap", + "smallvec", + "stylo", + "stylo_dom", + "stylo_static_prefs", + "stylo_taffy", + "stylo_traits", + "svgtypes", + "taffy", + "thin-vec", + "thread_local", + "url", + "usvg", + "web-time", + "writeable", +] + +[[package]] +name = "blitz-net" +version = "0.3.0-beta.4" +source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95" +dependencies = [ + "blitz-traits", + "data-url", + "reqwest", + "tokio", + "wasm-bindgen-futures", +] + +[[package]] +name = "blitz-paint" +version = "0.3.0-beta.4" +source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95" +dependencies = [ + "anyrender", + "anyrender_svg", + "blitz-dom", + "blitz-traits", + "bytemuck", + "color", + "euclid", + "kurbo", + "parley", + "peniko", + "skrifa", + "smallvec", + "stylo", + "taffy", + "usvg", +] + +[[package]] +name = "blitz-shell" +version = "0.3.0-beta.4" +source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95" +dependencies = [ + "android-activity", + "anyrender", + "atomic_refcell", + "blitz-dom", + "blitz-paint", + "blitz-traits", + "futures-util", + "keyboard-types", + "wasm-bindgen", + "web-sys", + "web-time", + "winit", +] + +[[package]] +name = "blitz-traits" +version = "0.3.0-beta.4" +source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95" +dependencies = [ + "atomic_refcell", + "bitflags", + "bytes", + "cursor-icon", + "http", + "keyboard-types", + "serde", + "smol_str", + "url", +] + +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "borsh" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" +dependencies = [ + "bytes", + "cfg_aliases", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "byteorder-lite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "calloop" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" +dependencies = [ + "bitflags", + "polling", + "rustix 1.1.5", + "tracing", +] + +[[package]] +name = "calloop-wayland-source" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" +dependencies = [ + "calloop", + "rustix 1.1.5", + "wayland-backend", + "wayland-client", +] + +[[package]] +name = "cc" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfb" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" +dependencies = [ + "byteorder", + "fnv", + "uuid", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "clipboard-win" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +dependencies = [ + "error-code", +] + +[[package]] +name = "codespan-reporting" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" +dependencies = [ + "serde", + "termcolor", + "unicode-width", +] + +[[package]] +name = "color" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "color_quant" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" + +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + +[[package]] +name = "const_format" +version = "0.2.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4481a617ad9a412be3b97c5d403fef8ed023103368908b9c50af598ff467cc1e" +dependencies = [ + "const_format_proc_macros", + "konst", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "convert_case" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baaaa0ecca5b51987b9423ccdc971514dd8b0bb7b4060b983d3664dad3f1f89f" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core_detect" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f8f80099a98041a3d1622845c271458a2d73e688351bf3cb999266764b81d48" + +[[package]] +name = "core_maths" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" +dependencies = [ + "libm", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crossterm" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" +dependencies = [ + "bitflags", + "crossterm_winapi", + "mio", + "parking_lot", + "rustix 0.38.44", + "signal-hook", + "signal-hook-mio", + "winapi", +] + +[[package]] +name = "crossterm_winapi" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" +dependencies = [ + "winapi", +] + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "cssparser" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11119743ad110e8c1bdccd930d7f5c30c99e5fc76a7b63ec9807e84eef0c5f59" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.14.0", + "serde", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a" +dependencies = [ + "quote", + "syn 3.0.9", +] + +[[package]] +name = "cursor-icon" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + +[[package]] +name = "darling" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core 0.21.3", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "data-url" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376" + +[[package]] +name = "debug_timer" +version = "0.1.3" +source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95" + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", +] + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", +] + +[[package]] +name = "dioxus" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a20d22ba8ac0eb0267459cfe6dcd3fd57158c37497ef422ba1940c34c5b04524" +dependencies = [ + "dioxus-config-macros", + "dioxus-core", + "dioxus-core-macro", + "dioxus-hooks", + "dioxus-html", + "dioxus-signals", + "dioxus-stores", + "subsecond", +] + +[[package]] +name = "dioxus-asset-resolver" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3405f8b33c91ddb71cd21c103cec7dde122d3c3e81702f59fa54241c996e9ad8" +dependencies = [ + "dioxus-cli-config", + "http", + "infer", + "jni 0.21.1", + "ndk", + "ndk-context", + "ndk-sys", + "percent-encoding", + "thiserror 2.0.21", + "tokio", +] + +[[package]] +name = "dioxus-cli-config" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "594aecf5eaea72c8d6c27fb582cdd882fbbe3d270539888b3e19cdeec0e414b5" + +[[package]] +name = "dioxus-config-macros" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84024d6dfd2ed560c84d874c57435f829daad9edbca907838581e541bebf1224" + +[[package]] +name = "dioxus-const-vec" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d24d174a15ddf07d157f4644d2f6417f66278d1b90b9aeb45f73d86cbdc157" + +[[package]] +name = "dioxus-core" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44545e820910646b5ea476f913892dfc0302c146d1a8481f7fca75d80b8c6b41" +dependencies = [ + "anyhow", + "const_format", + "dioxus-const-vec", + "dioxus-core-macro", + "dioxus-core-template", + "dioxus-core-types", + "futures-channel", + "futures-util", + "generational-box", + "longest-increasing-subsequence", + "rustc-hash 2.1.3", + "rustversion", + "slab", + "slotmap", + "subsecond", + "tracing", + "xxhash-rust", +] + +[[package]] +name = "dioxus-core-macro" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13611b6d67fef8f6638e4658547106eaa15d6b5f0e142bf8bb738345e55a3a1c" +dependencies = [ + "convert_case", + "dioxus-rsx", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "dioxus-core-template" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b111b4b1656abff7b086fc4aee6f1c2fb62473a01a5dba5a94c2024e8640e1c" +dependencies = [ + "dioxus-const-vec", + "xxhash-rust", +] + +[[package]] +name = "dioxus-core-types" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f1dab6f5671686cbf7f95231180d0937b04198bb5beb55753e1cca5b032f875" + +[[package]] +name = "dioxus-document" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "977047888cad56804a70fc89ae59c5e19c112507b18979b48757524bfac2ed73" +dependencies = [ + "dioxus-core", + "dioxus-core-macro", + "dioxus-core-types", + "dioxus-html", + "futures-channel", + "futures-util", + "generational-box", + "lazy-js-bundle", + "serde", + "serde_json", + "tracing", +] + +[[package]] +name = "dioxus-history" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e03ffeb1cc75a1254d3fae17a5b79413041c8a15d8c247a37a2218d23976a630" +dependencies = [ + "dioxus-core", + "tracing", +] + +[[package]] +name = "dioxus-hooks" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d11c3c292681dee1be9c8826e219b1edbaec6f510e867121dc92707384a631a" +dependencies = [ + "dioxus-core", + "dioxus-signals", + "futures-channel", + "futures-util", + "generational-box", + "rustversion", + "slab", + "tracing", +] + +[[package]] +name = "dioxus-html" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c23776aad7ba2effcc0efcb8a4df9adf2f9c3c705fa7695f2efc060ad62681ff" +dependencies = [ + "async-trait", + "bytes", + "dioxus-core", + "dioxus-core-macro", + "dioxus-core-types", + "dioxus-hooks", + "dioxus-html-internal-macro", + "enumset", + "euclid", + "futures-channel", + "futures-util", + "generational-box", + "keyboard-types", + "lazy-js-bundle", + "rustversion", + "tracing", +] + +[[package]] +name = "dioxus-html-internal-macro" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965ae5c5b855cc803b173fa6acbab284057ed0af87f6193f6ab083770756bbb5" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "dioxus-native" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd1cb86fdf731605cbeaf33c8a0a4752ee012f5c6a61ee506ba5963a4a1c8b3" +dependencies = [ + "android-activity", + "anyrender", + "anyrender_vello", + "anyrender_vello_cpu", + "blitz-dom", + "blitz-net", + "blitz-paint", + "blitz-shell", + "blitz-traits", + "cfg-if", + "dioxus-asset-resolver", + "dioxus-cli-config", + "dioxus-core", + "dioxus-document", + "dioxus-history", + "dioxus-html", + "dioxus-native-dom", + "futures-util", + "keyboard-types", + "peniko", + "rustc-hash 2.1.3", + "slotmap", + "tokio", + "webbrowser", + "wgpu_context", + "winit", +] + +[[package]] +name = "dioxus-native-dom" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200d283bd0e6ecdd4a7542e081e44c1bf83f8aba7bc478837b918ff8dc9c0c5f" +dependencies = [ + "blitz-dom", + "blitz-traits", + "dioxus-core", + "dioxus-html", + "futures-util", + "keyboard-types", + "rustc-hash 2.1.3", +] + +[[package]] +name = "dioxus-rsx" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09dff31689498efc0001c8188d549b1ef81775093b269c774fab524bc39405be" +dependencies = [ + "dioxus-core-template", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "rustversion", + "syn 2.0.119", +] + +[[package]] +name = "dioxus-signals" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0093b1cfc9c7e7d9c3ef3fbf79f83ab1de1463f9715fb438328ecefbbfbc7188" +dependencies = [ + "dioxus-core", + "futures-channel", + "futures-util", + "generational-box", + "parking_lot", + "rustc-hash 2.1.3", + "tracing", + "warnings", +] + +[[package]] +name = "dioxus-stores" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5a8a869da06b6137e008b953812f1e131fe5c02ff1ff56a7bb8317b0be93695" +dependencies = [ + "dioxus-core", + "dioxus-signals", + "dioxus-stores-macro", + "generational-box", +] + +[[package]] +name = "dioxus-stores-macro" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f0e94b059e1b809ca044dc1b6556f19e03e9eaaf0476beae486011ef9866bd3" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "dlib" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a" +dependencies = [ + "libloading", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "encoding_rs" +version = "0.8.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e985e0451871ad22fb8d2b6b076e2028a502a0d3950998c2c5c0a4f9b5d9679" +dependencies = [ + "cfg-if", + "core_detect", + "multiversion_no_op", + "rustversion", + "scopeguard", + "simdutf8", +] + +[[package]] +name = "enumset" +version = "1.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccc5801fd11762e24d1e420d01d2ac518f2a2ca4329d4fbb6639f2412b6204e0" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd536557b58c682b217b8fb199afdff47cd3eff260623f19e77074eb073d63a" +dependencies = [ + "darling 0.21.3", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "error-code" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7" + +[[package]] +name = "euclid" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06" +dependencies = [ + "num-traits", + "serde", +] + +[[package]] +name = "fancy-regex" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e24cb5a94bcae1e5408b0effca5cd7172ea3c5755049c5f3af4cd283a165298" +dependencies = [ + "bit-set 0.8.0", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "fancy-regex" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "998b056554fbe42e03ae0e152895cd1a7e1002aec800fdc6635d20270260c46f" +dependencies = [ + "bit-set 0.8.0", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fax" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "fearless_simd" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4beca3cb2444e3304ac30843cc091f44ed58932353cd492ce740067bfce6b12" + +[[package]] +name = "fig" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1912585cea7b84fd1cbacdd0ee85c57b12f54cc46a917145d97a62b95c3eafab" +dependencies = [ + "fig-core", +] + +[[package]] +name = "fig-core" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "310da8e88299b38abe3aadfa1aecce5c46a93dc767ee38900f23e9f630e05290" +dependencies = [ + "fig-kit", +] + +[[package]] +name = "fig-css" +version = "0.1.0" +source = "git+https://github.com/diaryx-org/fig-css?branch=main#d2400882084ed83510f452ded0603cf1d05fc611" +dependencies = [ + "fig", +] + +[[package]] +name = "fig-kit" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0005cbc0579d07474d9a452c76f23cbf55ba6c82dd84c7e7ed5c38ace903a7a" + +[[package]] +name = "find-msvc-tools" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "font-types" +version = "0.12.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "fontconfig-parser" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbc773e24e02d4ddd8395fd30dc147524273a83e54e0f312d986ea30de5f5646" +dependencies = [ + "roxmltree 0.20.0", +] + +[[package]] +name = "fontdb" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905" +dependencies = [ + "fontconfig-parser", + "log", + "memmap2", + "slotmap", + "tinyvec", + "ttf-parser", +] + +[[package]] +name = "fontdb" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2660c5e9157bf76d2db1294e4a9feba604ef610819a3b591088d0d8392a3290f" +dependencies = [ + "fontconfig-parser", + "log", + "memmap2", + "slotmap", + "tinyvec", +] + +[[package]] +name = "fontique" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbf1df16263783918b7da396077521f92b729ef7c429444dfcf03581f1448b77" +dependencies = [ + "hashbrown 0.17.1", + "linebender_resource_handle", + "memmap2", + "objc2", + "objc2-core-foundation", + "objc2-core-text", + "objc2-foundation", + "parlance", + "read-fonts", + "roxmltree 0.21.1", + "smallvec", + "windows", + "windows-core", + "yeslogic-fontconfig-sys", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generational-box" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a83dd38383542a7494b942bde9cd0c5efd919402a19ca78fa323f5d351bb9" +dependencies = [ + "parking_lot", + "tracing", +] + +[[package]] +name = "gethostname" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" +dependencies = [ + "rustix 1.1.5", + "windows-link", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi", +] + +[[package]] +name = "gif" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159" +dependencies = [ + "color_quant", + "weezl", +] + +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + +[[package]] +name = "glifo" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1218dedd5348c1b166ec3b8b3cbca49d2f527bd43b3fa072ea5123c523ed3f" +dependencies = [ + "bytemuck", + "foldhash 0.2.0", + "hashbrown 0.17.1", + "log", + "peniko", + "skrifa", + "smallvec", + "vello_common", +] + +[[package]] +name = "glow" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e" +dependencies = [ + "gl_generator", +] + +[[package]] +name = "gpu-allocator" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795" +dependencies = [ + "ash", + "hashbrown 0.16.1", + "log", + "presser", + "thiserror 2.0.21", + "windows", +] + +[[package]] +name = "gpu-descriptor" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" +dependencies = [ + "bitflags", + "gpu-descriptor-types", + "hashbrown 0.15.5", +] + +[[package]] +name = "gpu-descriptor-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" +dependencies = [ + "bitflags", +] + +[[package]] +name = "guillotiere" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab" +dependencies = [ + "euclid", + "svg_fmt", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "num-traits", + "zerocopy", +] + +[[package]] +name = "harfrust" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" +dependencies = [ + "bitflags", + "bytemuck", + "read-fonts", + "smallvec", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +dependencies = [ + "foldhash 0.2.0", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + +[[package]] +name = "html-escape" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9356095b4b41197bba32173600e1582792cda618f65d12f68e2e77d273413c5" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "icu_casemap" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2edfd120d8445de853cf53a1abec916f638f933a70a6f4bf8f7e2d7b7f884e9" +dependencies = [ + "icu_casemap_data", + "icu_collections", + "icu_locale_core", + "icu_properties", + "icu_provider", + "potential_utf", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_casemap_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "059fcda0fc8d33effc6633a8cf0d8a3c17caf7d7c91918fba9918744f501e4e8" + +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "serde", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "251af8e57c9400e3eb58242fe5b8b1152b2a64fdf4cf632f923c38ccee6f2fa9" +dependencies = [ + "icu_locale_core", + "icu_locale_fallback_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "decf2a22ec8fa68f1a0c1129a3f8583f8f8bc24e8b9ccbe98ead99f62a4dc3a8" + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" +dependencies = [ + "displaydoc", + "icu_locale_core", + "serde", + "stable_deref_trait", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_segmenter" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d07aafccd67af15d02512a6adf5896fbc5ed00f2e99b471d2efa14016db3db" +dependencies = [ + "core_maths", + "icu_collections", + "icu_locale_fallback", + "icu_provider", + "icu_segmenter_data", + "potential_utf", + "smallvec", + "utf8_iter", + "zerovec", +] + +[[package]] +name = "icu_segmenter_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae293c039020f9ec10710af98d29ce6aa2051486638b49c9a6409f3b4a9e98ad" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "image" +version = "0.25.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104" +dependencies = [ + "bytemuck", + "byteorder-lite", + "color_quant", + "gif", + "image-webp", + "moxcms", + "num-traits", + "png", + "tiff", + "zune-core", + "zune-jpeg", +] + +[[package]] +name = "image-webp" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3" +dependencies = [ + "byteorder-lite", + "quick-error", +] + +[[package]] +name = "imagesize" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65b27460c2c92b037f3f94c538ed9a3342f3fdf923606781629ccb35f82d042a" + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "infer" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a588916bfdfd92e71cacef98a63d9b1f0d74d6599980d11894290e7ddefffcf7" +dependencies = [ + "cfb", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "json5" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77a3f1d413a994290ebe4f96047763a84d04a1f31492c51328402986d7fe5fa" +dependencies = [ + "serde", + "ucd-trie", +] + +[[package]] +name = "keyboard-types" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" +dependencies = [ + "bitflags", + "serde", +] + +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + +[[package]] +name = "konst" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128133ed7824fcd73d6e7b17957c5eb7bacb885649bd8c69708b2331a10bcefb" +dependencies = [ + "konst_macro_rules", +] + +[[package]] +name = "konst_macro_rules" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37" + +[[package]] +name = "kurbo" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2" +dependencies = [ + "arrayvec", + "euclid", + "polycool", + "smallvec", +] + +[[package]] +name = "lazy-js-bundle" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c79f0c69caec3210fc12f3cb250f3e2179bb76b52edfec846983c5b236fb68b" + +[[package]] +name = "leaf-core" +version = "0.5.1" +dependencies = [ + "anyhow", + "fig-css", + "syntect", + "twig-asciidoc", + "twig-djot", + "twig-doc", + "twig-html", + "twig-markdown", + "twig-xml", + "two-face", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "leaf-dioxus" +version = "0.0.0" +dependencies = [ + "arboard", + "dioxus", + "dioxus-native", + "image", + "leaf-core", + "leaf-math", + "leaf-mermaid", + "parley", + "tokio", + "unicode-segmentation", + "unicode-width", + "usvg", +] + +[[package]] +name = "leaf-dioxus-tui" +version = "0.5.1" +dependencies = [ + "anyhow", + "blitz-dom", + "blitz-traits", + "crossterm", + "dioxus", + "dioxus-core", + "dioxus-native", + "leaf-core", + "leaf-dioxus", + "libc", + "parley", + "raw-window-handle", + "stylo", + "taffy", + "tokio", + "unicode-segmentation", + "unicode-width", +] + +[[package]] +name = "leaf-math" +version = "0.5.1" +dependencies = [ + "ratex-layout", + "ratex-parser", + "ratex-svg", + "ratex-types", +] + +[[package]] +name = "leaf-mermaid" +version = "0.5.1" +dependencies = [ + "mermaid-rs-renderer", +] + +[[package]] +name = "libc" +version = "0.2.190" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "bitflags", + "libc", + "plain", + "redox_syscall 0.9.4", +] + +[[package]] +name = "linebender_resource_handle" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "litrs" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4744e383959f0db86ede514b809b1c53251889093803c05267acc7d4e7030d70" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "longest-increasing-subsequence" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86" + +[[package]] +name = "malloc_size_of_derive" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f44db74bde26fdf427af23f1d146c211aed857c59e3be750cf2617f6b0b05c94" +dependencies = [ + "proc-macro2", + "syn 2.0.119", + "synstructure 0.13.2", +] + +[[package]] +name = "markup5ever" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab3dc68ac4a0f5719e560136778c1ee716e296030d75dbd4484e37e39e3a842" +dependencies = [ + "log", + "tendril", + "web_atoms", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memfd" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57804b2c9b69967f1536a56f86297e367a33b19e98852ed624b84551cdbc0d90" +dependencies = [ + "rustix 1.1.5", +] + +[[package]] +name = "memmap2" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0" +dependencies = [ + "libc", +] + +[[package]] +name = "mermaid-rs-renderer" +version = "0.3.1" +source = "git+https://github.com/adammharris/mermaid-rs-renderer?branch=diaryx#e6800633b055d6977182ec79a121ebe028c23210" +dependencies = [ + "anyhow", + "fontdb 0.23.0", + "json5", + "once_cell", + "regex", + "serde", + "serde_json", + "thiserror 2.0.21", + "ttf-parser", + "web-time", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "moxcms" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b" +dependencies = [ + "num-traits", + "pxfm", +] + +[[package]] +name = "multiversion_no_op" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743fb55ba31b18fb1ecef6bdc9aa2743314978ac084044301a7eee33fb99a20d" + +[[package]] +name = "naga" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bf919621e7975acb27d881bae2fb993e0d45c8e0446e85e6272971e00dc8df" +dependencies = [ + "arrayvec", + "bit-set 0.9.1", + "bitflags", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.16.1", + "hexf-parse", + "indexmap", + "libm", + "log", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" +dependencies = [ + "arrayvec", + "bit-set 0.10.0", + "bitflags", + "cfg-if", + "cfg_aliases", + "codespan-reporting", + "half", + "hashbrown 0.17.1", + "indexmap", + "libm", + "log", + "naga-types", + "num-traits", + "once_cell", + "rustc-hash 1.1.0", + "spirv", + "thiserror 2.0.21", + "unicode-ident", +] + +[[package]] +name = "naga-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49" +dependencies = [ + "hashbrown 0.17.1", + "indexmap", + "rustc-hash 1.1.0", + "thiserror 2.0.21", +] + +[[package]] +name = "native-tls" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", + "block2", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags", + "dispatch2", + "libc", + "objc2", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-core-video" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" +dependencies = [ + "bitflags", + "objc2-core-foundation", + "objc2-core-graphics", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags", + "block2", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags", + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-metal", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "openssl" +version = "0.10.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "openssl-src" +version = "300.6.1+3.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46eb8fb9fb3b61ce1c0f8a026c4c1a0714d3a9e138e7fbde78753ce2babc3846" +dependencies = [ + "cc", +] + +[[package]] +name = "openssl-sys" +version = "0.9.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" +dependencies = [ + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "orbclient" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01f140a738f180203d7912dfd369936fff2fb0ad6f426c0aa007ed3e2b443e6b" +dependencies = [ + "libredox", +] + +[[package]] +name = "ordered-float" +version = "5.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0" +dependencies = [ + "num-traits", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "parlance" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73072a9470554c8e794778acece2312661218aaabb635600957d952cf01c716e" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "parley" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61bd0c0c1737f0b3d3726dc06b225083af213b61913e4fbae1670613a106c6ce" +dependencies = [ + "fontique", + "hashbrown 0.17.1", + "linebender_resource_handle", + "parlance", + "parley_engine", + "smallvec", +] + +[[package]] +name = "parley_data" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43b63f808f6cc8f4a3b07de0d62a977bddd2e0bb5c232bd9e93ba8ef92e5e4b" +dependencies = [ + "icu_collections", + "icu_properties", +] + +[[package]] +name = "parley_emoji" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c4482d912d7671a7cd2089794f90ef3bb5f5f8c738230fb0fcd50fa020f0ed3" + +[[package]] +name = "parley_engine" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b74c0d373e462e504ad4436710a39f099e18e848e1ee711f70cd2dcd5a69b290" +dependencies = [ + "fontique", + "harfrust", + "hashbrown 0.17.1", + "icu_locale_core", + "icu_normalizer", + "icu_properties", + "icu_segmenter", + "linebender_resource_handle", + "parlance", + "parley_data", + "parley_emoji", + "skrifa", +] + +[[package]] +name = "peniko" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6" +dependencies = [ + "bytemuck", + "color", + "kurbo", + "linebender_resource_handle", + "smallvec", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros 0.11.3", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6" +dependencies = [ + "phf_macros 0.14.0", + "phf_shared 0.14.0", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b585a510fb76fdebead6897982ef2a03a21d8e6cbcca904999742a4afc6ffe" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared 0.11.3", + "rand", +] + +[[package]] +name = "phf_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100" +dependencies = [ + "fastrand", + "phf_shared 0.14.0", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator 0.11.3", + "phf_shared 0.11.3", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pixels" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27af78f16789b973b8b340fe3f68cc2ec9f5e6f4aea64e4d794d5833ac9ca52e" +dependencies = [ + "bytemuck", + "pollster", + "raw-window-handle", + "thiserror 2.0.21", + "ultraviolet", + "wgpu 29.0.4", +] + +[[package]] +name = "pixels_window_renderer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31c2ba47171f8376a1cd74f8d575f1d729c033fc007f59a9da3688c31187264b" +dependencies = [ + "anyrender", + "debug_timer", + "pixels", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + +[[package]] +name = "polycool" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "serde_core", + "writeable", + "zerovec", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proc-macro2-diagnostics" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "version_check", +] + +[[package]] +name = "profiling" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5" + +[[package]] +name = "pxfm" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + +[[package]] +name = "quick-xml" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "range-alloc" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" + +[[package]] +name = "ratex-font" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a7b73531dabe934a3e725ed5c90d18dacf43778b7a208381390943a9a8c24db" +dependencies = [ + "phf 0.11.3", + "ratex-types", +] + +[[package]] +name = "ratex-font-loader" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6542b55c6273b2ca3eb66021da061dfc84bc8303b434e1332218b63728742b7e" +dependencies = [ + "ab_glyph", + "ratex-font", + "ratex-katex-fonts", + "ratex-types", + "ratex-unicode-font", +] + +[[package]] +name = "ratex-katex-fonts" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c915a17fd71c41374d1ec19651a26ca352e757e1342391c2cbc5b825dacaa64b" +dependencies = [ + "rust-embed", +] + +[[package]] +name = "ratex-layout" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1792738e2e36683cd20de742296a5233759565efc8cd03831064a0ccfb1fe0f7" +dependencies = [ + "ratex-font", + "ratex-parser", + "ratex-types", + "serde_json", +] + +[[package]] +name = "ratex-lexer" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f704add86d7bf4c4ecc7767f45ab38a44f1bbfa4b49725b2ae53c32e83b8a61e" +dependencies = [ + "ratex-types", + "serde", + "thiserror 1.0.69", +] + +[[package]] +name = "ratex-parser" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "079ec2e7ac6bc76137a6de093a173d1f901139a51318589ab9ce17139c21a6f0" +dependencies = [ + "fancy-regex 0.14.0", + "ratex-font", + "ratex-lexer", + "ratex-types", + "regex", + "regex-lite", + "serde", + "serde_json", + "thiserror 1.0.69", + "unicode-normalization", +] + +[[package]] +name = "ratex-svg" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a0948b4d4926858332fe04471e861f54103e655a64f74cc1b3eac0c59bf67bb" +dependencies = [ + "ab_glyph", + "base64 0.22.1", + "ratex-font", + "ratex-font-loader", + "ratex-katex-fonts", + "ratex-types", + "ratex-unicode-font", +] + +[[package]] +name = "ratex-types" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cf0be3d050525f0f7d37af55a443d7648c222ccc617639950e3de1f8e6f9900" +dependencies = [ + "serde", +] + +[[package]] +name = "ratex-unicode-font" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c460464b7fba27343b2b391179ac6c86fcffac5116455158e2b08ce80866fd8" +dependencies = [ + "fontdb 0.23.0", + "system-fonts", + "ttf-parser", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-quartz-core", +] + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "read-fonts" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" +dependencies = [ + "bytemuck", + "font-types", + "once_cell", +] + +[[package]] +name = "redox_event" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5018d583d6d2f5499352aea8d177e9067d1eb03ab17c78169d5ba7a30001b15" +dependencies = [ + "bitflags", + "libredox", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_syscall" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-lite" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab834c73d247e67f4fae452806d17d3c7501756d98c8808d7c9c7aa7d18f973" + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "renderdoc-sys" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" + +[[package]] +name = "reqwest" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" +dependencies = [ + "base64 0.23.1", + "bytes", + "encoding_rs", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-tls", + "hyper-util", + "js-sys", + "log", + "mime", + "native-tls", + "percent-encoding", + "pin-project-lite", + "rustls-pki-types", + "serde", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "roxmltree" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" + +[[package]] +name = "roxmltree" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb" +dependencies = [ + "memchr", +] + +[[package]] +name = "rust-embed" +version = "8.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19afa5b4b6a611de00bd1bdae6ae6f39084c9399f0679c3f52d8469cf335cc23" +dependencies = [ + "rust-embed-impl", + "rust-embed-utils", + "walkdir", +] + +[[package]] +name = "rust-embed-impl" +version = "8.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0d8afda6374eac59e066abee06d265247ebbaf3006cf878e2879e8356e34053" +dependencies = [ + "mime_guess", + "proc-macro2", + "quote", + "rust-embed-utils", + "syn 2.0.119", + "walkdir", +] + +[[package]] +name = "rust-embed-utils" +version = "8.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d84e8ba78bd384263e5922f084cbe1b081c3b7e69add59c8fb097b879ba968a" +dependencies = [ + "sha2", + "walkdir", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "safe_arch" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sctk-adwaita" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f8ea028b7cb32e2f577b0a55a7b54cb206376bdb1221bd5c81dcf20b68db1fb" +dependencies = [ + "ab_glyph", + "log", + "memmap2", + "smithay-client-toolkit", + "tiny-skia", +] + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "selectors" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8322aebea94a6cc288ff884e8a49bdbceef60206c400c6c46d22e62fc4fd91a6" +dependencies = [ + "bitflags", + "cssparser", + "derive_more", + "log", + "new_debug_unreachable", + "precomputed-hash", + "rustc-hash 2.1.3", + "servo_arc", + "smallvec", + "to_shmem", + "to_shmem_derive", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "servo_arc" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4eceb519ec34d8290aaf6e46f435102f2bfa63f22b05a144fb16ab266d3b198" +dependencies = [ + "serde", + "stable_deref_trait", +] + +[[package]] +name = "sha2" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-mio" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" +dependencies = [ + "libc", + "mio", + "signal-hook", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "simplecss" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9c6883ca9c3c7c90e888de77b7a5c849c779d25d74a1269b0218b14e8b136c" +dependencies = [ + "log", +] + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "skrifa" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" +dependencies = [ + "bytemuck", + "read-fonts", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slotmap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038" +dependencies = [ + "serde", + "version_check", +] + +[[package]] +name = "smallbitvec" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b0e903ee191d8f7a8fbf0d712c3a1699d19e04ceba5ad1eb673053c7d938a09" + +[[package]] +name = "smallvec" +version = "1.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" + +[[package]] +name = "smithay-client-toolkit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dc9ee14b0fdcb535f9556141bacac070c994a977d2240ee455d7438a617f00" +dependencies = [ + "bitflags", + "calloop", + "calloop-wayland-source", + "cursor-icon", + "log", + "memmap2", + "rustix 1.1.5", + "thiserror 2.0.21", + "wayland-client", + "wayland-csd-frame", + "wayland-cursor", + "wayland-protocols", + "wayland-protocols-experimental", + "wayland-protocols-misc", + "wayland-protocols-wlr", + "wayland-scanner", + "xkeysym", +] + +[[package]] +name = "smol_str" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523" +dependencies = [ + "borsh", + "serde_core", +] + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +dependencies = [ + "float-cmp", +] + +[[package]] +name = "string_cache" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffa8a5dbe8b3f0bbe29d4c3225daafaeead63afdc1b65fc4c01a1384166038e6" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.14.0", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928dcdf75e47626b3617a976ec205d9f057584c371c1f23b782129268d0e6edc" +dependencies = [ + "phf_generator 0.14.0", + "phf_shared 0.14.0", + "proc-macro2", + "quote", +] + +[[package]] +name = "strum" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" + +[[package]] +name = "strum_macros" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab85eea0270ee17587ed4156089e10b9e6880ee688791d45a905f5b1ca36f664" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "stylo" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a255e46af2478628c48daab3774090caabd7812b1dd3ca98801c2b9c53491ed" +dependencies = [ + "app_units", + "arrayvec", + "atomic_refcell", + "bitflags", + "byteorder", + "cssparser", + "derive_more", + "encoding_rs", + "euclid", + "icu_segmenter", + "indexmap", + "itertools", + "itoa", + "log", + "malloc_size_of_derive", + "mime", + "new_debug_unreachable", + "num-derive", + "num-integer", + "num-traits", + "num_cpus", + "parking_lot", + "precomputed-hash", + "rayon", + "rayon-core", + "rustc-hash 2.1.3", + "selectors", + "serde", + "servo_arc", + "smallbitvec", + "smallvec", + "static_assertions", + "string_cache", + "strum", + "strum_macros", + "stylo_atoms", + "stylo_derive", + "stylo_dom", + "stylo_malloc_size_of", + "stylo_static_prefs", + "stylo_traits", + "thin-vec", + "to_shmem", + "to_shmem_derive", + "uluru", + "url", + "void", + "walkdir", + "web_atoms", +] + +[[package]] +name = "stylo_atoms" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee1771588fd747ef16f8b1990061b6f37c7d3251a0f9b74f405a44c0c5fb8966" +dependencies = [ + "string_cache", + "string_cache_codegen", +] + +[[package]] +name = "stylo_derive" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee5c550c2e00a0b3c046bef84a9ee217e04e7c014142eeb96f9e48781c5cfd3" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure 0.13.2", +] + +[[package]] +name = "stylo_dom" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9febcb03f2b669ef06b3e8a5209e6280971ed55cecf83fbf3c0562fcf2aa2ec6" +dependencies = [ + "bitflags", + "stylo_malloc_size_of", +] + +[[package]] +name = "stylo_malloc_size_of" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83ed69d55ee907599f093221004a28371925236f09f20961963020abf38bab6a" +dependencies = [ + "app_units", + "cssparser", + "euclid", + "parking_lot", + "selectors", + "servo_arc", + "smallbitvec", + "smallvec", + "string_cache", + "thin-vec", + "void", +] + +[[package]] +name = "stylo_static_prefs" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6767c48a1590461db79f8b434ccc5a2d65600a3b716751f7999b35ccead1e024" +dependencies = [ + "toml", +] + +[[package]] +name = "stylo_taffy" +version = "0.3.0-beta.4" +source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95" +dependencies = [ + "bitflags", + "stylo", + "stylo_atoms", + "taffy", +] + +[[package]] +name = "stylo_traits" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645d6bfe40eb6e86ebe9f2d2adadcbced41bfa96175de7cb13d4d178d27bc83d" +dependencies = [ + "app_units", + "bitflags", + "cssparser", + "euclid", + "malloc_size_of_derive", + "selectors", + "serde", + "servo_arc", + "stylo_atoms", + "stylo_malloc_size_of", + "thin-vec", + "to_shmem", + "to_shmem_derive", + "url", +] + +[[package]] +name = "subsecond" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f21c1509f00df90c330f868b677ea22a7f7138e7649b0f125e95041bdf84d48f" +dependencies = [ + "js-sys", + "libc", + "libloading", + "memfd", + "memmap2", + "serde", + "subsecond-types", + "thiserror 2.0.21", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "subsecond-types" +version = "0.8.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f9ef2c7a2a28761e9291172753ff82ec56cf46f1d90c808c6bba924f5295057" +dependencies = [ + "serde", +] + +[[package]] +name = "svg_fmt" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0193cc4331cfd2f3d2011ef287590868599a2f33c3e69bc22c1a3d3acf9e02fb" + +[[package]] +name = "svgtypes" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695b5790b3131dafa99b3bbfd25a216edb3d216dad9ca208d4657bfb8f2abc3d" +dependencies = [ + "kurbo", + "siphasher", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "syntect" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "656b45c05d95a5704399aeef6bd0ddec7b2b3531b7c9e900abbf7c4d2190c925" +dependencies = [ + "bincode", + "fancy-regex 0.16.2", + "flate2", + "fnv", + "once_cell", + "regex-syntax", + "serde", + "serde_derive", + "thiserror 2.0.21", + "walkdir", +] + +[[package]] +name = "sys-locale" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" +dependencies = [ + "libc", +] + +[[package]] +name = "system-fonts" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46ba78ea149d4bb0626dacad10aa789eedc83395889890a0e6e7ec69a4577442" +dependencies = [ + "fontdb 0.23.0", + "sys-locale", + "web-sys", +] + +[[package]] +name = "taffy" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8480887e8803986d96a7173729565520d4bbb721ad6b7ad6941a22897207aa" +dependencies = [ + "serde", + "slotmap", + "smallvec", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom", + "once_cell", + "rustix 1.1.5", + "windows-sys 0.61.2", +] + +[[package]] +name = "tendril" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fed54709c5b3a53d09bb1c113ea4f5ceafd1e772ddcb0030a82e1d56c087b08" +dependencies = [ + "new_debug_unreachable", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thin-vec" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6a4b9ba8738cb4a4f399d37e266becfd475e75eb73425b87a05a2f2039ba63e" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "tiny-skia" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ffee5eaaf5527f630fb0e356b90ebdec84d5d18d937c5e440350f88c5a91ea" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca365c3faccca67d06593c5980fa6c57687de727a03131735bb85f01fdeeb9" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "to_shmem" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbf077da8dd01cc18453bd7d9bc3a945c262f5f344562e5f6deb3914b4dd6f14" +dependencies = [ + "cssparser", + "servo_arc", + "smallbitvec", + "smallvec", + "string_cache", + "thin-vec", +] + +[[package]] +name = "to_shmem_derive" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f8e91a023810fd2019648410d00eea13a71f21d849e71d6d9ed936fb8061174" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure 0.13.2", +] + +[[package]] +name = "tokio" +version = "1.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce3335fa71841cda333a58d7615b03901380ecf09d59b3296d21f8bbac0dde4e" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "toml" +version = "1.1.8+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml_datetime" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.25.17+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.1.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_writer" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "ttf-parser" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" +dependencies = [ + "core_maths", +] + +[[package]] +name = "twig-asciidoc" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bbaea0529c2c7e65273c20116a4c6a0730c31e3b3fe49dc741a0d085d40e9ea" +dependencies = [ + "twig-doc", + "twig-kit", +] + +[[package]] +name = "twig-djot" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8619b5a7e9b37e5f25463b25d43424c5afea59b0d0478f0bc45e99744af4203" +dependencies = [ + "twig-doc", + "twig-kit", +] + +[[package]] +name = "twig-doc" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cd6cc20c4f31dd31e5e56dfa7d01f3dbdf5692695b1007e8c54640f9766193f" +dependencies = [ + "twig-kit", +] + +[[package]] +name = "twig-html" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1beb6c0999dc04d89a5a0da40e585cb05a9a7c13ecb19c2e5a65085a147f62ca" +dependencies = [ + "twig-doc", + "twig-kit", +] + +[[package]] +name = "twig-kit" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc21949975c1e3c5ab858d0d104e9d4f4d6000e1dcfa9e46bb7dcc460bba24f" + +[[package]] +name = "twig-markdown" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60ffcae233483874bec0f3c39f8a2480a087d71beb038049a9ee287e0e570745" +dependencies = [ + "twig-doc", + "twig-html", + "twig-kit", +] + +[[package]] +name = "twig-xml" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8634fdd8e854401a1f21aef62ef80e3a87d1723ad59e810f6a633c66bf2c42c6" +dependencies = [ + "twig-doc", + "twig-kit", +] + +[[package]] +name = "two-face" +version = "0.5.2+bat-0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915be7adc2ff6f4338acbf71f3eda0a146f46003b992a1669c674308610efdac" +dependencies = [ + "serde", + "serde_derive", + "syntect", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "ultraviolet" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea519dad475ee0446b8172793c3c327e4fc81dafdaf05aaac510e630000b6296" +dependencies = [ + "wide", +] + +[[package]] +name = "uluru" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c8a2469e56e6e5095c82ccd3afb98dad95f7af7929aab6d8ba8d6e0f73657da" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "unicase" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357cc3acc6a036009fd6c973ed009037c732d60d0b4f6c673e9041497482a28f" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-script" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "unicode-vo" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" + +[[package]] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "usvg" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "977d0a4abdef933f424a99fe09f95576e089b90aebc6f016a3bc813762493e91" +dependencies = [ + "base64 0.23.1", + "data-url", + "flate2", + "fontdb 0.24.0", + "harfrust", + "imagesize", + "kurbo", + "log", + "pico-args", + "roxmltree 0.21.1", + "simplecss", + "siphasher", + "skrifa", + "strict-num", + "svgtypes", + "tiny-skia-path", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "xmlwriter", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc1186384beb7dd8eedea376413fd654937285ea6c9cfbb928dc3043ea4b606" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "vello" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "913abde56cab6131b62c0cc69b1a93b671d3c34b3097beb3714fd1dc93be8115" +dependencies = [ + "bytemuck", + "futures-intrusive", + "log", + "peniko", + "png", + "skrifa", + "static_assertions", + "thiserror 2.0.21", + "vello_encoding", + "vello_shaders", + "wgpu 30.0.1", +] + +[[package]] +name = "vello_common" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73c2fbe53548bcd25c8ff42f75a93770a8611a16b37bee56d7ef7b44e36027f1" +dependencies = [ + "bytemuck", + "fearless_simd", + "guillotiere", + "log", + "peniko", + "png", + "smallvec", + "thiserror 2.0.21", +] + +[[package]] +name = "vello_cpu" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed1fec424fbba6acf6cbc78bb526447eb77590d95f40419d598870fe37535212" +dependencies = [ + "bytemuck", + "glifo", + "hashbrown 0.17.1", + "vello_common", +] + +[[package]] +name = "vello_encoding" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1fb9548d2b46b0f79137b5b1d208ecbd76d432f74e7a2ba838615d117f11532" +dependencies = [ + "bytemuck", + "guillotiere", + "peniko", + "skrifa", + "smallvec", +] + +[[package]] +name = "vello_shaders" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e653222cee49f2571729c3e4b0fa99bc4f826c6bb9487dbb88b825d552b3a27" +dependencies = [ + "bytemuck", + "log", + "naga 30.0.1", + "thiserror 2.0.21", + "vello_encoding", +] + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "warnings" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f68998838dab65727c9b30465595c6f7c953313559371ca8bf31759b3680ad" +dependencies = [ + "pin-project", + "tracing", + "warnings-macro", +] + +[[package]] +name = "warnings-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59195a1db0e95b920366d949ba5e0d3fc0e70b67c09be15ce5abb790106b0571" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b7777d5cc23d0e91404e53ce2d5e8ec7acae3026b16233dba62cd3246457950" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.119", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wayland-backend" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" +dependencies = [ + "cc", + "downcast-rs", + "rustix 1.1.5", + "scoped-tls", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-client" +version = "0.31.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" +dependencies = [ + "bitflags", + "rustix 1.1.5", + "wayland-backend", + "wayland-scanner", +] + +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags", + "cursor-icon", + "wayland-backend", +] + +[[package]] +name = "wayland-cursor" +version = "0.31.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" +dependencies = [ + "rustix 1.1.5", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-protocols" +version = "0.32.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-experimental" +version = "20251230.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c6c3e7178e553d093d46999032bc79aafea9dedd71dd702c8ace7bbc25cf13" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-misc" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-plasma" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" +dependencies = [ + "bitflags", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-scanner", +] + +[[package]] +name = "wayland-scanner" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[package]] +name = "wayland-sys" +version = "0.31.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web_atoms" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7572660c8890448ba236b7376f27e389c6a7e1c70195622faced601f855c0ada" +dependencies = [ + "phf 0.14.0", + "phf_codegen", + "string_cache", + "string_cache_codegen", +] + +[[package]] +name = "webbrowser" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62c35be770821a214dbc362fc26908c853e776c0004294d0b10b8a6bad582f94" +dependencies = [ + "jni 0.22.4", + "log", + "ndk-context", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "url", + "web-sys", +] + +[[package]] +name = "weezl" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" + +[[package]] +name = "wgpu" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76e8840e1ba2881d4cbb18d2147627a56af426ff064c0401eb0c8410c6325d07" +dependencies = [ + "arrayvec", + "bitflags", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "js-sys", + "log", + "naga 29.0.4", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core 29.0.4", + "wgpu-hal 29.0.4", + "wgpu-types 29.0.4", +] + +[[package]] +name = "wgpu" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" +dependencies = [ + "arrayvec", + "bitflags", + "bytemuck", + "cfg-if", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "js-sys", + "log", + "naga 30.0.1", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core 30.0.1", + "wgpu-hal 30.0.1", + "wgpu-types 30.0.1", +] + +[[package]] +name = "wgpu-core" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f519832254e56965a9940c4af57dcb75f702b6f6fa4a0b172f685395843a4d7" +dependencies = [ + "arrayvec", + "bit-set 0.9.1", + "bit-vec 0.9.1", + "bitflags", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.16.1", + "indexmap", + "log", + "naga 29.0.4", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-apple 29.0.4", + "wgpu-core-deps-emscripten 29.0.4", + "wgpu-core-deps-wasm", + "wgpu-core-deps-windows-linux-android 29.0.4", + "wgpu-hal 29.0.4", + "wgpu-naga-bridge 29.0.4", + "wgpu-types 29.0.4", +] + +[[package]] +name = "wgpu-core" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14" +dependencies = [ + "arrayvec", + "bit-set 0.10.0", + "bit-vec 0.9.1", + "bitflags", + "bytemuck", + "cfg_aliases", + "document-features", + "hashbrown 0.17.1", + "indexmap", + "log", + "naga 30.0.1", + "naga-types", + "once_cell", + "parking_lot", + "portable-atomic", + "profiling", + "raw-window-handle", + "rustc-hash 1.1.0", + "smallvec", + "thiserror 2.0.21", + "wgpu-core-deps-apple 30.0.1", + "wgpu-core-deps-emscripten 30.0.1", + "wgpu-core-deps-windows-linux-android 30.0.1", + "wgpu-hal 30.0.1", + "wgpu-naga-bridge 30.0.1", + "wgpu-types 30.0.1", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5e39e26c4c0e07589e67d18546cf79ff45383659fc72fca4dd293358a0347f3" +dependencies = [ + "wgpu-hal 29.0.4", +] + +[[package]] +name = "wgpu-core-deps-apple" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68" +dependencies = [ + "wgpu-hal 30.0.1", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01e09be551dc939498bdd5f6b2c66e55ab275dad25825267a08605a80fc9f0af" +dependencies = [ + "wgpu-hal 29.0.4", +] + +[[package]] +name = "wgpu-core-deps-emscripten" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98b86cf4abf524a902dd35f18ca6a3f08fc2ae9847c8f10b48e30491b1f0b86" +dependencies = [ + "wgpu-hal 30.0.1", +] + +[[package]] +name = "wgpu-core-deps-wasm" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1fb1798be2a912497d4c224f72d39bb0cb34af50e8bcc29865bc339c943059" +dependencies = [ + "wgpu-hal 29.0.4", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e592c1bbef6ad047647ae6e666ebd8cee7a32bb4544d9700ec96cbf73230257" +dependencies = [ + "wgpu-hal 29.0.4", +] + +[[package]] +name = "wgpu-core-deps-windows-linux-android" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f" +dependencies = [ + "wgpu-hal 30.0.1", +] + +[[package]] +name = "wgpu-hal" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ace1c17727311c22a46e4e3faf56ea6de81af99dcc839bdfb54857b94d448d" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set 0.9.1", + "bitflags", + "block2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "glow", + "glutin_wgl_sys", + "gpu-allocator", + "gpu-descriptor", + "hashbrown 0.16.1", + "js-sys", + "khronos-egl", + "libc", + "libloading", + "log", + "naga 29.0.4", + "ndk-sys", + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-metal", + "objc2-quartz-core", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "thiserror 2.0.21", + "wasm-bindgen", + "wayland-sys", + "web-sys", + "wgpu-naga-bridge 29.0.4", + "wgpu-types 29.0.4", + "windows", + "windows-core", + "windows-result", +] + +[[package]] +name = "wgpu-hal" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set 0.10.0", + "bitflags", + "block2", + "bytemuck", + "cfg-if", + "cfg_aliases", + "glow", + "glutin_wgl_sys", + "gpu-allocator", + "hashbrown 0.17.1", + "js-sys", + "khronos-egl", + "libc", + "libloading", + "log", + "naga 30.0.1", + "naga-types", + "ndk-sys", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-metal", + "objc2-quartz-core", + "once_cell", + "ordered-float", + "parking_lot", + "portable-atomic", + "portable-atomic-util", + "profiling", + "range-alloc", + "raw-window-handle", + "raw-window-metal", + "renderdoc-sys", + "smallvec", + "static_assertions", + "thiserror 2.0.21", + "wasm-bindgen", + "wayland-sys", + "web-sys", + "wgpu-naga-bridge 30.0.1", + "wgpu-types 30.0.1", + "windows", + "windows-core", + "windows-result", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95226013f547544b223281cd16a4fb549aa9dcb562adbda0faae4c73ffbbc161" +dependencies = [ + "naga 29.0.4", + "wgpu-types 29.0.4", +] + +[[package]] +name = "wgpu-naga-bridge" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081" +dependencies = [ + "naga 30.0.1", + "wgpu-types 30.0.1", +] + +[[package]] +name = "wgpu-types" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84bf84cd9ca8ca45e2b223a3868f1adf9bfc0c66aeac212e76ee7e40fdadf8f5" +dependencies = [ + "bitflags", + "bytemuck", + "js-sys", + "log", + "raw-window-handle", + "web-sys", +] + +[[package]] +name = "wgpu-types" +version = "30.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" +dependencies = [ + "bitflags", + "bytemuck", + "js-sys", + "log", + "naga-types", + "raw-window-handle", + "static_assertions", + "web-sys", +] + +[[package]] +name = "wgpu_context" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5277f9d30e7087f1eeb0034206dce7d3377e76da017fdceb8aa4faebb1df68e2" +dependencies = [ + "futures-intrusive", + "wgpu 30.0.1", +] + +[[package]] +name = "wide" +version = "0.7.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03" +dependencies = [ + "bytemuck", + "safe_arch", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core", + "windows-link", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winit" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f431156a3e4f0f1b35eaaf37674e55838e3652908c8088f570466274d1902e2b" +dependencies = [ + "bitflags", + "cfg_aliases", + "cursor-icon", + "dpi", + "libc", + "raw-window-handle", + "rustix 1.1.5", + "smol_str", + "tracing", + "winit-android", + "winit-appkit", + "winit-common", + "winit-core", + "winit-orbital", + "winit-uikit", + "winit-wayland", + "winit-web", + "winit-win32", + "winit-x11", +] + +[[package]] +name = "winit-android" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5d60d944a564986b9311e325334cc22e7e4cf726dd0ff7475fd925404215af4" +dependencies = [ + "android-activity", + "bitflags", + "dpi", + "ndk", + "raw-window-handle", + "smol_str", + "tracing", + "winit-core", +] + +[[package]] +name = "winit-appkit" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23343ec0ea7ac6aa72f38009a6ff66fb63bcf6395e0622fba72794d2a762ab42" +dependencies = [ + "bitflags", + "block2", + "dispatch2", + "dpi", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-video", + "objc2-foundation", + "raw-window-handle", + "smol_str", + "tracing", + "winit-common", + "winit-core", +] + +[[package]] +name = "winit-common" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e90422ff1c04502aaaac1dad1d099791c2bbb3fbb3f823019e0ce5cdeee04025" +dependencies = [ + "block2", + "dpi", + "memmap2", + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "smol_str", + "tracing", + "winit-core", + "x11-dl", + "xkbcommon-dl", +] + +[[package]] +name = "winit-core" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8af6307236c51847199950c15cf80e0481a250bb96ce9132f5026df4ad3d0f9" +dependencies = [ + "bitflags", + "cursor-icon", + "dpi", + "keyboard-types", + "raw-window-handle", + "smol_str", + "url", + "web-time", +] + +[[package]] +name = "winit-orbital" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "278a8ae837902a3bc95dd2fd696d680da33f32130eecc29905358c9089cf6c50" +dependencies = [ + "bitflags", + "dpi", + "libredox", + "orbclient", + "raw-window-handle", + "redox_event", + "smol_str", + "tracing", + "winit-core", +] + +[[package]] +name = "winit-uikit" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83315a3ea1739c8466cf23d35e3b0a2cb20c9515d8857666b633afef484740b5" +dependencies = [ + "bitflags", + "block2", + "dispatch2", + "dpi", + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-ui-kit", + "raw-window-handle", + "smol_str", + "tracing", + "winit-common", + "winit-core", +] + +[[package]] +name = "winit-wayland" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b64ceed06de0c45886eef05102106abe1413e703384e337bc57c7e95b71f803" +dependencies = [ + "bitflags", + "calloop", + "cursor-icon", + "dpi", + "foldhash 0.2.0", + "libc", + "memmap2", + "percent-encoding", + "raw-window-handle", + "rustix 1.1.5", + "sctk-adwaita", + "smithay-client-toolkit", + "smol_str", + "tracing", + "wayland-backend", + "wayland-client", + "wayland-protocols", + "wayland-protocols-plasma", + "winit-common", + "winit-core", +] + +[[package]] +name = "winit-web" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f539be45f95cc297bdfb80569aef38d925d64aec4133852a4d3fc5cb3660f1c9" +dependencies = [ + "atomic-waker", + "bitflags", + "concurrent-queue", + "cursor-icon", + "dpi", + "js-sys", + "pin-project", + "raw-window-handle", + "smol_str", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "web-time", + "winit-core", +] + +[[package]] +name = "winit-win32" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25fb480c41df01d351f656cbf3ad74013f8a9d22bb5b2dcab59f9167e7a0b6ec" +dependencies = [ + "bitflags", + "cursor-icon", + "dpi", + "raw-window-handle", + "smol_str", + "tracing", + "unicode-segmentation", + "url", + "windows-sys 0.61.2", + "winit-common", + "winit-core", +] + +[[package]] +name = "winit-x11" +version = "0.31.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb5746cd907e514b7895491a1c6f7d0cb70077f9e16928cd74ae6f987ffd96aa" +dependencies = [ + "bitflags", + "bytemuck", + "calloop", + "cursor-icon", + "dpi", + "libc", + "percent-encoding", + "raw-window-handle", + "rustix 1.1.5", + "smol_str", + "tracing", + "winit-common", + "winit-core", + "x11-dl", + "x11rb", + "xkbcommon-dl", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414" +dependencies = [ + "as-raw-xcb-connection", + "gethostname", + "libc", + "libloading", + "once_cell", + "rustix 1.1.5", + "x11rb-protocol", + "xcursor", +] + +[[package]] +name = "x11rb-protocol" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" + +[[package]] +name = "xcursor" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23" + +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags", + "dlib", + "log", + "once_cell", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" + +[[package]] +name = "xml-rs" +version = "0.8.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" + +[[package]] +name = "xmlwriter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" + +[[package]] +name = "xxhash-rust" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "550a2b930b62486a393c52d5c3b84bff264b28aa437ed64694d31e93b1757af7" + +[[package]] +name = "yeslogic-fontconfig-sys" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8b8abf912b9a29ff112e1671c97c33636903d13a69712037190e6805af4f76" +dependencies = [ + "dlib", + "once_cell", + "pkg-config", +] + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure 0.14.0", +] + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure 0.14.0", +] + +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "serde", + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zune-core" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b" + +[[package]] +name = "zune-jpeg" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296" +dependencies = [ + "zune-core", +] diff --git a/apps/leaf-dioxus-tui/Cargo.toml b/apps/leaf-dioxus-tui/Cargo.toml new file mode 100644 index 00000000..5bc405e2 --- /dev/null +++ b/apps/leaf-dioxus-tui/Cargo.toml @@ -0,0 +1,67 @@ +# A prototype: the leaf-dioxus editor (crates/leaf-dioxus), the same +# component the Mac app draws with Blitz on wgpu, drawn in a terminal instead. +# Blitz still builds the DOM, resolves the styles and lays the page out; a +# painter here walks the laid-out tree and writes character cells where +# blitz-paint would draw pixels. Its own workspace for apps/leaf-dioxus's +# reason: dioxus-native is an alpha, and the Blitz fork is reached by [patch]. +# +# cargo run --manifest-path apps/leaf-dioxus-tui/Cargo.toml -- document.md +[workspace] + +[package] +name = "leaf-dioxus-tui" +version = "0.5.1" +edition = "2024" +publish = false + +[[bin]] +name = "leaf-dtui" +path = "src/main.rs" + +[dependencies] +leaf-dioxus = { path = "../../crates/leaf-dioxus" } +leaf-core = { path = "../../crates/leaf-core", default-features = false, features = ["fs", "syntax"] } +dioxus = { version = "0.8.0-alpha.3", default-features = false, features = [ + "macro", + "html", + "signals", + "hooks", +] } +# The document type and Blitz's DOM, with no renderer: nothing here draws +# pixels. `system-fonts` because the editor and Blitz shape text with parley +# over the system's fonts, and a monospace face's advance is the cell. +dioxus-native = { version = "0.8.0-alpha.3", default-features = false, features = ["system-fonts"] } +dioxus-core = "=0.8.0-alpha.3" +blitz-dom = { version = "=0.3.0-beta.4", default-features = false } +blitz-traits = "=0.3.0-beta.4" +parley = "=0.12.0" +crossterm = "0.28" +raw-window-handle = "0.6" +anyhow = "1" +libc = "0.2" +# Stylo's computed values, read for each box's colours and borders, and the +# taffy layout Blitz puts on each node: the versions the Blitz fork uses. +style = { version = "0.22.0", package = "stylo" } +taffy = { version = "0.15", default-features = false, features = ["std"] } +unicode-width = "0.2" +unicode-segmentation = "1.13" +# The editor's timers. +tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "time"] } + +[profile.dev] +debug = "line-tables-only" + +# Stylo and parley are slow unoptimised; see apps/leaf-dioxus. +[profile.dev.package."*"] +opt-level = 3 + +# The Blitz fork, as apps/leaf-dioxus takes it: every Blitz crate from one +# source, or the graph holds two copies. +[patch.crates-io] +blitz-dom = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" } +blitz-traits = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" } +blitz-shell = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" } +blitz-paint = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" } +blitz-net = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" } +stylo_taffy = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" } +debug_timer = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" } diff --git a/apps/leaf-dioxus-tui/README.md b/apps/leaf-dioxus-tui/README.md new file mode 100644 index 00000000..849b3236 --- /dev/null +++ b/apps/leaf-dioxus-tui/README.md @@ -0,0 +1,33 @@ +# leaf-dioxus-tui + +A prototype: the leaf-dioxus editor (`crates/leaf-dioxus`), the component the +Mac app draws, drawn in a terminal. Blitz builds the DOM, resolves the styles +and lays the page out as it does for a window; `src/paint.rs` walks the laid-out +tree and writes character cells where blitz-paint would draw pixels. + +```sh +cargo run --manifest-path apps/leaf-dioxus-tui/Cargo.toml -- document.md +cargo run --manifest-path apps/leaf-dioxus-tui/Cargo.toml -- --dump document.md # one 80×24 frame as text +cargo run --manifest-path apps/leaf-dioxus-tui/Cargo.toml -- --dump-html document.md # the same, in its colours +``` + +⌃Q quits. On macOS the editor's ⌘ shortcuts are ⌃ here: ⌃S saves, ⌃B is bold. +`LEAF_THEME=light` for a light terminal. `LEAF_TRACE=1 LEAF_DTUI_LOG=` logs +keys and frame timings to the file. + +The case for it, what it does and does not do yet, and what replacing leaf-tui +would take: [the proposal](../../docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md). + +## How it fits together + +- `window.rs`: a winit `Window` that is the terminal, as `apps/leaf-dioxus`'s + `offscreen.rs` is a sheet. The editor asks it for size, scale and theme. +- `main.rs`: the document is `DioxusDocument::new` with no window, as + `apps/leaf-dioxus/src/headless.rs` builds one for tests. Keys go to + `Editor::key`; clicks go to Blitz as pointer events; the wheel goes to + `Editor::scroll`. Each turn is a poll and a `resolve`, then a paint. +- `paint.rs`: the cell painter. A cell is one advance of a monospace face + (Menlo, 16px) wide and one line (1.5 leading, 24px) high, so the editor's own + parley layout counts in cells without knowing it. Each line's clusters take + consecutive cells, so text set larger than a cell still reads. +- `term.rs`: crossterm. A frame is written as the cells that changed. diff --git a/apps/leaf-dioxus-tui/src/main.rs b/apps/leaf-dioxus-tui/src/main.rs new file mode 100644 index 00000000..42406508 --- /dev/null +++ b/apps/leaf-dioxus-tui/src/main.rs @@ -0,0 +1,412 @@ +//! leaf-dtui: the leaf-dioxus editor in a terminal. +//! +//! The Mac app's editor component, unchanged, on a Blitz document with no +//! window: a [`TermWindow`] answers its questions about size and theme, the +//! terminal's keys are handed to [`Editor::key`] as the app hands winit's, +//! clicks and the wheel go to Blitz as pointer events, and each turn the page +//! is resolved and painted into cells ([`paint`]) instead of pixels. +//! +//! The text is set in one monospace face at a size whose advance is one cell +//! wide, and a cell is that advance by one line high, so the editor's own +//! parley layout — wrapping, caret motion, hit-testing — counts in cells +//! without knowing it. +//! +//! ⌃Q quits. On macOS the editor's ⌘ shortcuts are ⌃ here (a terminal never +//! sees ⌘), so ⌃S saves, ⌃B is bold, ⌃Z undoes. + +mod paint; +mod term; +mod window; + +use std::cell::RefCell; +use std::path::PathBuf; +use std::rc::Rc; +use std::sync::Arc; +use std::task::{Context, Waker}; +use std::time::Duration; + +use anyhow::{Context as _, Result}; +use blitz_dom::DocumentConfig; +use blitz_traits::shell::{ColorScheme, Viewport}; +use crossterm::event::{self, Event, MouseButton, MouseEventKind}; +use dioxus::prelude::*; +use dioxus_core::{ScopeId, VirtualDom}; +use dioxus_native::DioxusDocument; +use dioxus_native::winit::window::Window; +use leaf_core::Doc; +use leaf_dioxus::{Appearance, Editor, Host, Look, Request, Status, Type, use_shared_editor}; + +use crate::paint::Metrics; +use crate::window::TermWindow; + +/// The face every cell is set in, and its size in CSS pixels. +const FACE: &str = "Menlo, \"DejaVu Sans Mono\", monospace"; +const SIZE: f32 = 16.0; +/// The line box over the size: one cell high. 1.5, the editor's own +/// leading, makes a cell 24px — the height of its status line, which is then +/// exactly a row. +const LEADING: f32 = 1.5; + +/// Pixel chrome the editor sizes for a window, recut to whole cells. +const TERM_CSS: &str = " +.status { font: 16px Menlo, monospace; border-top: 0; } +.find { font: 16px Menlo, monospace; } +"; + +thread_local! { + static EDITOR: RefCell> = const { RefCell::new(None) }; + static DOC: RefCell>>> = const { RefCell::new(None) }; +} + +struct TermHost; + +impl Host for TermHost { + fn request(&self, ed: &Editor, request: Request) { + if let Request::Save = request { + ed.doc().save(); + ed.refresh(); + } + } +} + +#[allow(non_snake_case)] +fn App() -> Element { + let doc = DOC.with_borrow(|d| d.clone().expect("a document")); + let dark = term::dark(); + let ed = use_shared_editor( + move || doc, + move || Look { + ty: Type { + body: FACE.into(), + mono: FACE.into(), + size: SIZE, + leading: LEADING, + }, + measure: None, + appearance: if dark { + Appearance::Dark + } else { + Appearance::Light + }, + status: Status::Full, + }, + || Rc::new(TermHost) as Rc, + ); + use_hook({ + let ed = ed.clone(); + move || EDITOR.with_borrow_mut(|e| *e = Some(ed)) + }); + rsx! { + {ed.render()} + style { {TERM_CSS} } + } +} + +/// One cell's size: the face's advance, and the line box. +fn metrics() -> Metrics { + use parley::{FontContext, LayoutContext, StyleProperty}; + let mut fcx = FontContext::default(); + let mut lcx: LayoutContext<()> = LayoutContext::new(); + let probe = "0".repeat(100); + let mut b = lcx.ranged_builder(&mut fcx, &probe, 1.0, true); + b.push_default(StyleProperty::FontFamily(parley::FontFamily::Source( + FACE.into(), + ))); + b.push_default(StyleProperty::FontSize(SIZE)); + let mut layout = b.build(&probe); + layout.break_all_lines(None); + Metrics { + cw: layout.width() / 100.0, + ch: SIZE * LEADING, + } +} + +struct Session { + doc: DioxusDocument, + window: Arc, + m: Metrics, + cols: u16, + rows: u16, +} + +impl Session { + fn new(path: PathBuf, cols: u16, rows: u16) -> Result { + enter_runtime(); + let source = Doc::open_or_create(path.clone()) + .with_context(|| format!("opening {}", path.display()))?; + DOC.with_borrow_mut(|d| *d = Some(Rc::new(RefCell::new(source)))); + let m = metrics(); + let (w, h) = px(m, cols, rows); + let window = Arc::new(TermWindow::new(w, h, term::dark())); + let as_dyn: Arc = window.clone(); + let mut doc = DioxusDocument::new(VirtualDom::new(App), DocumentConfig::default()); + doc.vdom + .in_scope(ScopeId::ROOT, move || provide_context(as_dyn)); + doc.inner.borrow_mut().set_viewport(viewport(w, h)); + doc.initial_build(); + let mut s = Self { + doc, + window, + m, + cols, + rows, + }; + s.settle(); + Ok(s) + } + + /// Poll the virtual DOM and lay the page out until it holds still. + fn settle(&mut self) { + for _ in 0..3 { + let changed = + blitz_dom::Document::poll(&mut self.doc, Some(Context::from_waker(Waker::noop()))); + self.doc.inner.borrow_mut().resolve(0.0); + if !changed { + break; + } + } + } + + fn with_editor(&self, f: impl FnOnce(&Editor)) { + let ed = EDITOR.with_borrow(|e| e.clone()); + if let Some(ed) = ed { + self.doc.vdom.in_scope(ScopeId::ROOT, || f(&ed)); + } + } + + fn resize(&mut self, cols: u16, rows: u16) { + self.cols = cols; + self.rows = rows; + let (w, h) = px(self.m, cols, rows); + self.window.resize(w, h); + self.doc.inner.borrow_mut().set_viewport(viewport(w, h)); + self.with_editor(|ed| ed.resize(w, h)); + } + + fn paint(&self) -> paint::Grid { + paint::paint(&self.doc.inner.borrow(), self.m, self.cols, self.rows) + } +} + +/// The editor's timers are tokio's: a runtime on a thread of its own keeps +/// them firing while this one waits on the terminal. Entered once per thread +/// and left entered. +fn enter_runtime() { + use std::sync::OnceLock; + static RT: OnceLock = OnceLock::new(); + thread_local! { static ENTERED: std::cell::Cell = const { std::cell::Cell::new(false) }; } + if ENTERED.get() { + return; + } + let rt = RT.get_or_init(|| { + tokio::runtime::Builder::new_multi_thread() + .worker_threads(1) + .enable_time() + .build() + .expect("a tokio runtime") + }); + std::mem::forget(rt.enter()); + ENTERED.set(true); +} + +fn px(m: Metrics, cols: u16, rows: u16) -> (u32, u32) { + ( + (cols as f32 * m.cw).round() as u32, + (rows as f32 * m.ch).round() as u32, + ) +} + +fn viewport(w: u32, h: u32) -> Viewport { + let scheme = if term::dark() { + ColorScheme::Dark + } else { + ColorScheme::Light + }; + Viewport::new(w, h, 1.0, scheme) +} + +fn main() -> Result<()> { + let mut args: Vec<_> = std::env::args_os().skip(1).collect(); + // `--dump`: one frame, 80 × 24, printed as text — what a test or a + // reader without a terminal to hand can look at. `--dump-html`: the same + // frame as a `
`, in its colours.
+    let dump = args
+        .first()
+        .is_some_and(|a| a == "--dump" || a == "--dump-html");
+    let html = args.first().is_some_and(|a| a == "--dump-html");
+    if dump {
+        args.remove(0);
+    }
+    let path = args
+        .first()
+        .map(PathBuf::from)
+        .context("usage: leaf-dtui [--dump | --dump-html] ")?;
+
+    if dump {
+        let mut s = Session::new(path, 80, 24)?;
+        // Past the word count's settling time, so the status line is whole.
+        std::thread::sleep(Duration::from_millis(500));
+        s.settle();
+        if std::env::var_os("LEAF_DTUI_HTML").is_some() {
+            let doc = s.doc.inner.borrow();
+            eprintln!("{}", doc.root_element().outer_html_pretty());
+        }
+        let grid = s.paint();
+        if html {
+            print!("{}", grid.html());
+        } else {
+            print!("{}", grid.text());
+        }
+        return Ok(());
+    }
+    // Anything written to stderr would land on the screen among the cells.
+    quiet_stderr();
+    let (cols, rows) = crossterm::terminal::size()?;
+    let mut s = Session::new(path, cols, rows)?;
+    let mut out = term::Terminal::enter()?;
+    let result = run(&mut s, &mut out);
+    out.leave()?;
+    result
+}
+
+/// Send stderr to `LEAF_DTUI_LOG`, or nowhere.
+fn quiet_stderr() {
+    use std::os::fd::AsRawFd;
+    let path = std::env::var_os("LEAF_DTUI_LOG").unwrap_or_else(|| "/dev/null".into());
+    if let Ok(f) = std::fs::OpenOptions::new()
+        .create(true)
+        .append(true)
+        .open(path)
+    {
+        // SAFETY: both descriptors are open; stderr is replaced, not closed.
+        unsafe { libc::dup2(f.as_raw_fd(), 2) };
+    }
+}
+
+fn run(s: &mut Session, out: &mut term::Terminal) -> Result<()> {
+    let mut grid = s.paint();
+    out.draw(&grid)?;
+    loop {
+        let mut acted = false;
+        if event::poll(Duration::from_millis(50))? {
+            while {
+                match event::read()? {
+                    Event::Key(k) if term::is_quit(&k) => return Ok(()),
+                    Event::Key(k) => {
+                        if let Some((key, code, mods)) = term::key(&k) {
+                            s.with_editor(|ed| ed.key(key, code, mods));
+                        }
+                    }
+                    Event::Paste(text) => {
+                        for c in text.chars() {
+                            let (key, code, mods) = term::char_key(c);
+                            s.with_editor(|ed| ed.key(key, code, mods));
+                        }
+                    }
+                    Event::Mouse(me) => match me.kind {
+                        MouseEventKind::ScrollDown => {
+                            s.with_editor(|ed| ed.scroll(-3.0 * s.m.ch as f64))
+                        }
+                        MouseEventKind::ScrollUp => {
+                            s.with_editor(|ed| ed.scroll(3.0 * s.m.ch as f64))
+                        }
+                        MouseEventKind::Down(MouseButton::Left)
+                        | MouseEventKind::Up(MouseButton::Left)
+                        | MouseEventKind::Drag(MouseButton::Left) => {
+                            term::pointer(&mut s.doc, s.m, &me);
+                        }
+                        _ => {}
+                    },
+                    Event::Resize(c, r) => s.resize(c, r),
+                    _ => {}
+                }
+                event::poll(Duration::ZERO)?
+            } {}
+            acted = true;
+        }
+        let t0 = std::time::Instant::now();
+        s.settle();
+        if acted || s.window.take_dirty() {
+            let t1 = std::time::Instant::now();
+            let next = s.paint();
+            leaf_dioxus::trace(|| format!("frame: settle {:.1?} paint {:.1?}", t1 - t0, t1.elapsed()));
+            if next != grid {
+                out.draw_diff(&grid, &next)?;
+                grid = next;
+            }
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    /// A directory of the test's own, holding `doc.md` with `source`.
+    fn scratch(source: &str) -> (PathBuf, PathBuf) {
+        use std::sync::atomic::{AtomicUsize, Ordering};
+        static N: AtomicUsize = AtomicUsize::new(0);
+        let n = N.fetch_add(1, Ordering::Relaxed);
+        let dir = std::env::temp_dir().join(format!("agent-leaf-dtui-{}-{n}", std::process::id()));
+        std::fs::create_dir_all(&dir).unwrap();
+        let path = dir.join("doc.md");
+        std::fs::write(&path, source).unwrap();
+        (dir, path)
+    }
+
+    /// A frame of `source`, 80 × 24, as text.
+    fn frame(source: &str) -> String {
+        let (dir, path) = scratch(source);
+        let s = Session::new(path, 80, 24).unwrap();
+        let text = s.paint().text();
+        std::fs::remove_dir_all(&dir).ok();
+        text
+    }
+
+    #[test]
+    fn a_heading_set_larger_than_a_cell_reads_as_one_word() {
+        let f = frame("# Title\n\nBody.\n");
+        // The caret sits before the heading's first letter.
+        assert!(f.lines().any(|l| l.trim() == "▏Title"), "{f}");
+        assert!(f.lines().any(|l| l.trim() == "Body."), "{f}");
+    }
+
+    #[test]
+    fn a_list_item_draws_its_text_once() {
+        let f = frame("Top.\n\n- one\n- two\n  - nested\n");
+        assert!(f.lines().any(|l| l.trim() == "• one"), "{f}");
+        assert!(f.lines().any(|l| l.trim() == "◦ nested"), "{f}");
+    }
+
+    #[test]
+    fn a_table_keeps_its_text_over_its_borders() {
+        let f = frame("Top.\n\n| a | b |\n|---|---|\n| 1 | 2 |\n");
+        let a = f.lines().find(|l| l.contains('a')).unwrap();
+        assert!(a.contains('b'), "{f}");
+        assert!(f.lines().any(|l| l.contains('1') && l.contains('2')), "{f}");
+    }
+
+    #[test]
+    fn the_status_line_is_the_last_row() {
+        let f = frame("Text.\n");
+        let last = f.lines().last().unwrap();
+        assert!(
+            last.contains("doc.md") && last.contains("wysiwyg view"),
+            "{f}"
+        );
+    }
+
+    #[test]
+    fn a_typed_key_lands_at_the_caret() {
+        let (dir, path) = scratch("Text.\n");
+        let mut s = Session::new(path, 80, 24).unwrap();
+        for c in "Hi ".chars() {
+            let (key, code, mods) = term::char_key(c);
+            s.with_editor(|ed| ed.key(key, code, mods));
+        }
+        s.settle();
+        let f = s.paint().text();
+        std::fs::remove_dir_all(&dir).ok();
+        assert!(f.lines().any(|l| l.trim() == "Hi ▏Text."), "{f}");
+    }
+}
diff --git a/apps/leaf-dioxus-tui/src/paint.rs b/apps/leaf-dioxus-tui/src/paint.rs
new file mode 100644
index 00000000..b2301daa
--- /dev/null
+++ b/apps/leaf-dioxus-tui/src/paint.rs
@@ -0,0 +1,647 @@
+//! Blitz's laid-out page, painted into character cells.
+//!
+//! The walk is blitz-paint's (`render.rs`'s `render_element` and
+//! `draw_children`): each element's box at its parent's origin plus its
+//! taffy location, its children shifted back by its scroll, hoisted children
+//! placed by their stacking context, and text read off the parley layout of
+//! each inline root. What differs is the surface: a box's background fills
+//! the cells whose centres it covers, a border is a line of box-drawing
+//! characters, and a glyph cluster is written into the cell its left edge
+//! rounds to. With a monospace face whose advance is [`Metrics::cw`], every
+//! glyph lands in a cell of its own.
+//!
+//! The one element read by name is the editor's caret, `.caret-in`, a
+//! zero-width box with a 2px border: drawn as cells it would be nothing or a
+//! whole column, so it becomes the terminal's own cursor instead.
+
+use std::collections::HashMap;
+
+use blitz_dom::{BaseDocument, Node, NodeData, NodeId};
+use parley::PositionedLayoutItem;
+use style::color::AbsoluteColor;
+use style::computed_values::visibility::T as Visibility;
+use style::properties::ComputedValues;
+use style::values::computed::Overflow;
+use unicode_width::UnicodeWidthStr;
+
+/// One character cell, in CSS pixels.
+#[derive(Clone, Copy, Debug)]
+pub struct Metrics {
+    pub cw: f32,
+    pub ch: f32,
+}
+
+pub type Rgb = (u8, u8, u8);
+
+#[derive(Clone, Debug, PartialEq)]
+pub struct Cell {
+    /// The cluster, or `""` for the second half of a wide one.
+    pub text: String,
+    pub fg: Rgb,
+    pub bg: Rgb,
+    pub bold: bool,
+    pub italic: bool,
+    pub underline: bool,
+}
+
+impl Cell {
+    fn blank(fg: Rgb, bg: Rgb) -> Self {
+        Self {
+            text: " ".into(),
+            fg,
+            bg,
+            bold: false,
+            italic: false,
+            underline: false,
+        }
+    }
+}
+
+#[derive(Clone, Debug, PartialEq)]
+pub struct Grid {
+    pub cols: u16,
+    pub rows: u16,
+    pub cells: Vec,
+    /// Where the caret is, if it is on screen.
+    pub cursor: Option<(u16, u16)>,
+}
+
+impl Grid {
+    pub fn new(cols: u16, rows: u16, fg: Rgb, bg: Rgb) -> Self {
+        Self {
+            cols,
+            rows,
+            cells: vec![Cell::blank(fg, bg); cols as usize * rows as usize],
+            cursor: None,
+        }
+    }
+
+    pub fn get(&self, c: u16, r: u16) -> &Cell {
+        &self.cells[r as usize * self.cols as usize + c as usize]
+    }
+
+    fn at(&mut self, c: i32, r: i32) -> Option<&mut Cell> {
+        if c < 0 || r < 0 || c >= self.cols as i32 || r >= self.rows as i32 {
+            return None;
+        }
+        Some(&mut self.cells[r as usize * self.cols as usize + c as usize])
+    }
+
+    /// The grid's text, a line per row, trailing spaces dropped, and `▏`
+    /// before the cell the caret is in.
+    pub fn text(&self) -> String {
+        let mut out = String::new();
+        for r in 0..self.rows {
+            let mut line = String::new();
+            for c in 0..self.cols {
+                if self.cursor == Some((c, r)) {
+                    line.push('▏');
+                }
+                line.push_str(&self.get(c, r).text);
+            }
+            out.push_str(line.trim_end());
+            out.push('\n');
+        }
+        out
+    }
+}
+
+impl Grid {
+    /// The grid as an HTML `
`, each cell in its colours, the caret's
+    /// cell outlined.
+    pub fn html(&self) -> String {
+        let esc = |t: &str| {
+            t.replace('&', "&")
+                .replace('<', "<")
+                .replace('>', ">")
+        };
+        let hex = |(r, g, b): Rgb| format!("#{r:02x}{g:02x}{b:02x}");
+        let mut out = String::from(
+            "
",
+        );
+        for r in 0..self.rows {
+            // Cells of one style go in one span.
+            let mut run: Option<(String, String)> = None;
+            for c in 0..self.cols {
+                let cell = self.get(c, r);
+                if cell.text.is_empty() {
+                    continue;
+                }
+                let mut style = format!("color:{};background:{}", hex(cell.fg), hex(cell.bg));
+                if cell.bold {
+                    style.push_str(";font-weight:bold");
+                }
+                if cell.italic {
+                    style.push_str(";font-style:italic");
+                }
+                if cell.underline {
+                    style.push_str(";text-decoration:underline");
+                }
+                if self.cursor == Some((c, r)) {
+                    style.push_str(";box-shadow:inset 2px 0 #4a9eff");
+                }
+                match &mut run {
+                    Some((st, text)) if *st == style => text.push_str(&cell.text),
+                    _ => {
+                        if let Some((st, text)) = run.take() {
+                            out.push_str(&format!("{}", esc(&text)));
+                        }
+                        run = Some((style, cell.text.clone()));
+                    }
+                }
+            }
+            if let Some((st, text)) = run {
+                out.push_str(&format!("{}", esc(&text)));
+            }
+            out.push('\n');
+        }
+        out.push_str("
"); + out + } +} + +/// A rectangle in CSS pixels: what a box covers, or what may be drawn on. +#[derive(Clone, Copy, Debug)] +struct Rect { + x0: f32, + y0: f32, + x1: f32, + y1: f32, +} + +impl Rect { + fn intersect(self, o: Rect) -> Rect { + Rect { + x0: self.x0.max(o.x0), + y0: self.y0.max(o.y0), + x1: self.x1.min(o.x1), + y1: self.y1.min(o.y1), + } + } + fn contains(&self, x: f32, y: f32) -> bool { + x >= self.x0 && x < self.x1 && y >= self.y0 && y < self.y1 + } +} + +struct Painter<'a> { + doc: &'a BaseDocument, + m: Metrics, + grid: &'a mut Grid, + root: NodeId, + /// Where each inline box's line put it: its cell and its width in pixels. + inline_cells: HashMap, +} + +/// Paint `doc`, already resolved, into a fresh grid of `cols` × `rows`. +pub fn paint(doc: &BaseDocument, m: Metrics, cols: u16, rows: u16) -> Grid { + let (fg, bg) = page_colors(doc); + let mut grid = Grid::new(cols, rows, fg, bg); + let Some(root) = doc.try_root_element() else { + return grid; + }; + let scroll = doc.viewport_scroll(); + let clip = Rect { + x0: 0.0, + y0: 0.0, + x1: cols as f32 * m.cw, + y1: rows as f32 * m.ch, + }; + let mut p = Painter { + doc, + m, + grid: &mut grid, + root: root.id, + inline_cells: HashMap::new(), + }; + p.element(root.id, (-scroll.x as f32, -scroll.y as f32), clip); + grid +} + +/// The page's colour and background: `html`'s, else `body`'s, as +/// blitz-paint picks the canvas colour. +fn page_colors(doc: &BaseDocument) -> (Rgb, Rgb) { + let mut fg = (220, 220, 220); + let mut bg = (0, 0, 0); + let Some(root) = doc.try_root_element() else { + return (fg, bg); + }; + let body = root + .children + .iter() + .filter_map(|id| doc.get_node(*id)) + .find(|n| { + n.data + .is_element_with_tag_name(&blitz_dom::local_name!("body")) + }); + for node in [Some(root), body].into_iter().flatten() { + if let Some(s) = node.primary_styles() { + let cc = s.clone_color(); + fg = rgb(&cc).0; + let (b, a) = rgb(&s.clone_background_color().resolve_to_absolute(&cc)); + if a > 0.5 { + bg = b; + } + } + } + (fg, bg) +} + +fn rgb(c: &AbsoluteColor) -> (Rgb, f32) { + let [r, g, b, a] = *c + .to_color_space(style::color::ColorSpace::Srgb) + .raw_components(); + let q = |v: f32| (v.clamp(0.0, 1.0) * 255.0).round() as u8; + ((q(r), q(g), q(b)), a) +} + +fn blend(over: Rgb, a: f32, under: Rgb) -> Rgb { + let m = |o: u8, u: u8| (o as f32 * a + u as f32 * (1.0 - a)).round() as u8; + (m(over.0, under.0), m(over.1, under.1), m(over.2, under.2)) +} + +impl Painter<'_> { + fn node(&self, id: NodeId) -> &Node { + &self.doc.tree()[id] + } + + fn render(&mut self, id: NodeId, origin: (f32, f32), clip: Rect) { + match &self.node(id).data { + NodeData::Element(_) | NodeData::AnonymousBlock(_) => self.element(id, origin, clip), + _ => {} + } + } + + fn element(&mut self, id: NodeId, origin: (f32, f32), clip: Rect) { + let doc = self.doc; + let node = &doc.tree()[id]; + if matches!(node.taffy_display(), taffy::Display::None) { + return; + } + let Some(styles) = node.primary_styles() else { + return; + }; + let styles: &ComputedValues = &styles; + if styles.get_inherited_box().visibility != Visibility::Visible + || styles.get_effects().opacity == 0.0 + { + return; + } + let l = node.final_layout(); + let x = origin.0 + l.location.x; + let y = origin.1 + l.location.y; + let bbox = Rect { + x0: x, + y0: y, + x1: x + l.size.width, + y1: y + l.size.height, + }; + + if node + .attr(blitz_dom::local_name!("class")) + .is_some_and(|c| c.split_ascii_whitespace().any(|c| c == "caret-in")) + { + let (cx, cy) = (x, y + l.size.height / 2.0); + if clip.contains(cx, cy) { + let (c, r) = match self.inline_cells.get(&id) { + Some(&(c, r, _)) => (c, r), + None => ( + (cx / self.m.cw).round() as i32, + (cy / self.m.ch).floor() as i32, + ), + }; + if c >= 0 && r >= 0 && c < self.grid.cols as i32 && r < self.grid.rows as i32 { + self.grid.cursor = Some((c as u16, r as u16)); + } + } + return; + } + + self.background(styles, bbox.intersect(clip)); + self.borders(styles, bbox, l, clip); + if node + .data + .is_element_with_tag_name(&blitz_dom::local_name!("img")) + { + let src = node.attr(blitz_dom::local_name!("src")).unwrap_or(""); + let name = src.rsplit('/').next().unwrap_or(src); + let fg = rgb(&styles.clone_color()).0; + self.frame(bbox, clip, fg, &format!("🖼 {name}")); + } + + let ov = styles.get_box(); + let clips = !matches!(ov.overflow_x, Overflow::Visible) + || !matches!(ov.overflow_y, Overflow::Visible); + let pb_left = l.padding.left + l.border.left; + let pb_top = l.padding.top + l.border.top; + let inner_clip = if clips { + clip.intersect(Rect { + x0: x + l.border.left, + y0: y + l.border.top, + x1: bbox.x1 - l.border.right, + y1: bbox.y1 - l.border.bottom, + }) + } else { + clip + }; + let scroll = node.scroll_offset(); + let (sx, sy) = (scroll.x as f32, scroll.y as f32); + + if node.flags.is_inline_root() + && let Some(tl) = node + .element_data() + .and_then(|e| e.inline_layout_data.as_ref()) + { + let tx = x + pb_left - sx; + let ty = y + pb_top - sy + tl.block_offset; + self.text(tl, (tx, ty), inner_clip); + } + + // Children draw from this box's origin, less its scroll. + let base = (x - sx, y - sy); + let scroll_v = doc.viewport_scroll(); + if let Some(sc) = &node.stacking_context { + for h in sc.neg_z_hoisted_children() { + let p = h.position(node.tree(), id); + self.render(h.node_id, (base.0 + p.x, base.1 + p.y), inner_clip); + } + } + let kids: Vec = match &*node.paint_children.borrow() { + Some(k) => k.iter().copied().collect(), + None => Vec::new(), + }; + for kid in kids { + let fixed = + self.node(kid).taffy_position() == taffy::Position::Fixed && id == self.root; + let o = if fixed { + (base.0 + scroll_v.x as f32, base.1 + scroll_v.y as f32) + } else { + base + }; + self.render(kid, o, inner_clip); + } + if let Some(sc) = &node.stacking_context { + for h in sc.pos_z_hoisted_children() { + let p = h.position(node.tree(), id); + self.render(h.node_id, (base.0 + p.x, base.1 + p.y), inner_clip); + } + } + } + + /// A placeholder for what cells cannot show: a box drawn round `b`, + /// `label` on its top edge. + fn frame(&mut self, b: Rect, clip: Rect, fg: Rgb, label: &str) { + let m = self.m; + let c0 = (b.x0 / m.cw).round() as i32; + let c1 = ((b.x1 / m.cw).round() as i32 - 1).max(c0); + let r0 = (b.y0 / m.ch).round() as i32; + let r1 = ((b.y1 / m.ch).round() as i32 - 1).max(r0); + let visible = + |c: i32, r: i32| clip.contains((c as f32 + 0.5) * m.cw, (r as f32 + 0.5) * m.ch); + for r in r0..=r1 { + for c in c0..=c1 { + let ch = match (r == r0, r == r1, c == c0, c == c1) { + (true, _, true, _) => "╭", + (true, _, _, true) => "╮", + (_, true, true, _) => "╰", + (_, true, _, true) => "╯", + (true, _, _, _) | (_, true, _, _) => "─", + (_, _, true, _) | (_, _, _, true) => "│", + _ => continue, + }; + if visible(c, r) + && let Some(cell) = self.grid.at(c, r) + { + cell.text = ch.into(); + cell.fg = fg; + } + } + } + let mut c = c0 + 2; + for g in unicode_segmentation::UnicodeSegmentation::graphemes(label, true) { + let w = UnicodeWidthStr::width(g).max(1) as i32; + if c + w > c1 - 1 { + break; + } + if visible(c, r0) { + if let Some(cell) = self.grid.at(c, r0) { + cell.text = g.into(); + cell.fg = fg; + } + if w == 2 + && let Some(next) = self.grid.at(c + 1, r0) + { + next.text = String::new(); + } + } + c += w; + } + } + + /// Fill the cells whose centres `area` covers. + fn background(&mut self, styles: &ComputedValues, area: Rect) { + let cc = styles.clone_color(); + let (c, a) = rgb(&styles.clone_background_color().resolve_to_absolute(&cc)); + if a < 0.05 { + return; + } + self.fill(area, c, a); + } + + fn fill(&mut self, area: Rect, c: Rgb, a: f32) { + let m = self.m; + let c0 = (area.x0 / m.cw - 0.5).ceil() as i32; + let c1 = (area.x1 / m.cw - 0.5).ceil() as i32; + let r0 = (area.y0 / m.ch - 0.5).ceil() as i32; + let r1 = (area.y1 / m.ch - 0.5).ceil() as i32; + for r in r0..r1 { + for col in c0..c1 { + if a > 0.5 && self.grid.cursor == Some((col as u16, r as u16)) { + self.grid.cursor = None; + } + if let Some(cell) = self.grid.at(col, r) { + // An opaque box covers what was drawn under it. + if a > 0.5 { + *cell = Cell::blank(cell.fg, cell.bg); + } + cell.bg = blend(c, a, cell.bg); + } + } + } + } + + /// Each side with a visible border, as a line of box-drawing characters + /// along the cells that side runs through. + fn borders(&mut self, styles: &ComputedValues, b: Rect, l: &taffy::Layout, clip: Rect) { + use style::values::specified::BorderStyle; + let bs = styles.get_border(); + let cc = styles.clone_color(); + let m = self.m; + let side = |w: f32, st: BorderStyle, col: &style::values::computed::Color| { + if w <= 0.0 || matches!(st, BorderStyle::None | BorderStyle::Hidden) { + return None; + } + let (c, a) = rgb(&col.resolve_to_absolute(&cc)); + (a > 0.05).then_some((c, a)) + }; + let col_of = |x: f32| (x / m.cw).floor() as i32; + let row_of = |y: f32| (y / m.ch).floor() as i32; + let (c0, c1) = (col_of(b.x0), col_of((b.x1 - 0.01).max(b.x0))); + let (r0, r1) = (row_of(b.y0), row_of((b.y1 - 0.01).max(b.y0))); + let put = |g: &mut Grid, c: i32, r: i32, ch: &str, (fg, a): (Rgb, f32)| { + let (px, py) = ((c as f32 + 0.5) * m.cw, (r as f32 + 0.5) * m.ch); + if !clip.contains(px, py) { + return; + } + if let Some(cell) = g.at(c, r) { + cell.text = ch.into(); + cell.fg = blend(fg, a, cell.bg); + } + }; + // A horizontal border gets a row only when the box is tall enough to + // give it one: a table cell a line high keeps its text, not a rule + // drawn through it. + let content_top = row_of(b.y0 + l.border.top + l.padding.top + 0.01); + let content_bottom = row_of((b.y1 - l.border.bottom - l.padding.bottom - 0.01).max(b.y0)); + if let Some(fg) = side(l.border.top, bs.border_top_style, &bs.border_top_color) + .filter(|_| r0 < content_top) + { + for c in c0..=c1 { + put(self.grid, c, r0, "─", fg); + } + } + if let Some(fg) = side( + l.border.bottom, + bs.border_bottom_style, + &bs.border_bottom_color, + ) + .filter(|_| r1 > content_bottom) + { + for c in c0..=c1 { + put(self.grid, c, r1, "─", fg); + } + } + if let Some(fg) = side(l.border.left, bs.border_left_style, &bs.border_left_color) { + for r in r0..=r1 { + put(self.grid, c0, r, "│", fg); + } + } + if let Some(fg) = side( + l.border.right, + bs.border_right_style, + &bs.border_right_color, + ) { + for r in r0..=r1 { + put(self.grid, c1, r, "│", fg); + } + } + } + + /// An inline root's text, its origin at `o`. A line starts in the cell + /// its left edge rounds to, and each cluster after takes the next cell + /// (two for a wide one), so text set larger than a cell — a heading — + /// reads as text rather than spaced-out letters. A gap between runs, and + /// an inline box, take the cells their width rounds to; an inline box's + /// cell is kept for [`Self::element`], which is how the caret finds its + /// column in a heading. + fn text(&mut self, tl: &blitz_dom::node::TextLayout, o: (f32, f32), clip: Rect) { + let m = self.m; + for line in tl.layout.lines() { + let lm = line.metrics(); + let mid = o.1 + (lm.block_min_coord + lm.block_max_coord) / 2.0; + let r = (mid / m.ch).floor() as i32; + // How many of each run's clusters earlier glyph runs drew. + let mut taken: HashMap = HashMap::new(); + // The next free cell, and the x where the last item ended. + let mut col: Option = None; + let mut end_x = 0.0f32; + let place = |x: f32, col: &mut Option, end_x: f32| -> i32 { + match *col { + None => ((o.0 + x) / m.cw).round() as i32, + Some(c) => c + ((x - end_x) / m.cw).round().max(0.0) as i32, + } + }; + for item in line.items() { + let gr = match item { + PositionedLayoutItem::GlyphRun(gr) => gr, + PositionedLayoutItem::InlineBox(b) => { + let c = place(b.x, &mut col, end_x); + self.inline_cells + .insert(NodeId::from_u64(b.id), (c, r, b.width)); + col = Some(c + (b.width / m.cw).round() as i32); + end_x = b.x + b.width; + continue; + } + }; + let mut c = place(gr.offset(), &mut col, end_x); + end_x = gr.offset() + gr.advance(); + let st = self + .doc + .get_node(gr.style().brush.id) + .and_then(|n| n.primary_styles()); + let Some(st) = st else { + col = Some(c); + continue; + }; + let cc = st.clone_color(); + let (fg, fa) = rgb(&cc); + let (bg, ba) = rgb(&st.clone_background_color().resolve_to_absolute(&cc)); + let bold = st.get_font().font_weight.value() >= 600.0; + let italic = st.get_font().font_style != style::values::computed::FontStyle::NORMAL; + let underline = st + .get_text() + .text_decoration_line + .contains(style::values::specified::TextDecorationLine::UNDERLINE); + // A parley run can hold several spans of one face; the glyph + // run is the stretch of it in one style. Its clusters are the + // run's next ones in that style. + let key = gr.run().text_range().start; + let skip = *taken.get(&key).unwrap_or(&0); + let style = gr.style_index(); + let clusters: Vec<_> = gr + .run() + .visual_clusters() + .skip(skip) + .take_while(|c| c.style_index() == style) + .collect(); + taken.insert(key, skip + clusters.len()); + for cluster in clusters { + let s = &tl.text[cluster.text_range()]; + let s = if s.chars().all(char::is_whitespace) { + " " + } else { + s + }; + let w = UnicodeWidthStr::width(s).max(1) as i32; + let at = c; + c += w; + let cx = (at as f32 + 0.5) * m.cw; + if !clip.contains(cx, mid) { + continue; + } + let Some(cell) = self.grid.at(at, r) else { + continue; + }; + if ba > 0.05 { + cell.bg = blend(bg, ba, cell.bg); + } + // Transparent text (a ghost) keeps its place and draws + // nothing. + if fa < 0.3 { + continue; + } + cell.text = s.to_string(); + cell.fg = blend(fg, fa, cell.bg); + cell.bold = bold; + cell.italic = italic; + cell.underline = underline; + if w == 2 + && let Some(next) = self.grid.at(at + 1, r) + { + next.text = String::new(); + } + } + col = Some(c); + } + } + } +} diff --git a/apps/leaf-dioxus-tui/src/term.rs b/apps/leaf-dioxus-tui/src/term.rs new file mode 100644 index 00000000..6b05d892 --- /dev/null +++ b/apps/leaf-dioxus-tui/src/term.rs @@ -0,0 +1,250 @@ +//! The terminal side: raw mode and the alternate screen, a grid written out +//! as the cells that changed, and the terminal's keys and mouse turned into +//! what the editor and Blitz take. + +use std::io::{Stdout, Write, stdout}; +use std::str::FromStr; + +use anyhow::Result; +use blitz_traits::events::{ + BlitzPointerEvent, BlitzPointerId, MouseEventButton, MouseEventButtons, PointerCoords, UiEvent, +}; +use crossterm::event::{ + DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture, KeyCode, + KeyEvent, KeyEventKind, KeyModifiers, MouseEvent, MouseEventKind, +}; +use crossterm::style::{ + Attribute, Color, Print, SetAttribute, SetBackgroundColor, SetForegroundColor, +}; +use crossterm::{cursor, execute, queue, terminal}; +use dioxus::html::{Code, Key, Modifiers, NamedKey}; +use dioxus_native::DioxusDocument; + +use crate::paint::{Cell, Grid, Metrics}; + +/// Dark unless `LEAF_THEME=light` says otherwise; leaf-tui's OSC 11 query +/// is the real answer, and is for later. +pub fn dark() -> bool { + std::env::var("LEAF_THEME").map_or(true, |t| t != "light") +} + +pub struct Terminal { + out: Stdout, +} + +impl Terminal { + pub fn enter() -> Result { + let mut out = stdout(); + terminal::enable_raw_mode()?; + execute!( + out, + terminal::EnterAlternateScreen, + EnableMouseCapture, + EnableBracketedPaste, + terminal::Clear(terminal::ClearType::All) + )?; + Ok(Self { out }) + } + + pub fn leave(&mut self) -> Result<()> { + execute!( + self.out, + DisableBracketedPaste, + DisableMouseCapture, + cursor::Show, + terminal::LeaveAlternateScreen + )?; + terminal::disable_raw_mode()?; + Ok(()) + } + + pub fn draw(&mut self, g: &Grid) -> Result<()> { + queue!(self.out, cursor::Hide)?; + for r in 0..g.rows { + queue!(self.out, cursor::MoveTo(0, r))?; + for c in 0..g.cols { + self.cell(g.get(c, r))?; + } + } + self.finish(g) + } + + pub fn draw_diff(&mut self, old: &Grid, new: &Grid) -> Result<()> { + if old.cols != new.cols || old.rows != new.rows { + return self.draw(new); + } + queue!(self.out, cursor::Hide)?; + for r in 0..new.rows { + let mut at = None; + for c in 0..new.cols { + let cell = new.get(c, r); + if cell == old.get(c, r) { + at = None; + continue; + } + if at != Some(c) { + queue!(self.out, cursor::MoveTo(c, r))?; + } + self.cell(cell)?; + at = Some(c + 1); + } + } + self.finish(new) + } + + fn cell(&mut self, cell: &Cell) -> Result<()> { + // The second half of a wide character: its first half drew it. + if cell.text.is_empty() { + return Ok(()); + } + let rgb = |(r, g, b): (u8, u8, u8)| Color::Rgb { r, g, b }; + queue!( + self.out, + SetAttribute(Attribute::Reset), + SetForegroundColor(rgb(cell.fg)), + SetBackgroundColor(rgb(cell.bg)), + )?; + if cell.bold { + queue!(self.out, SetAttribute(Attribute::Bold))?; + } + if cell.italic { + queue!(self.out, SetAttribute(Attribute::Italic))?; + } + if cell.underline { + queue!(self.out, SetAttribute(Attribute::Underlined))?; + } + queue!(self.out, Print(&cell.text))?; + Ok(()) + } + + fn finish(&mut self, g: &Grid) -> Result<()> { + queue!(self.out, SetAttribute(Attribute::Reset))?; + if let Some((c, r)) = g.cursor { + queue!( + self.out, + cursor::MoveTo(c, r), + cursor::SetCursorStyle::SteadyBar, + cursor::Show + )?; + } + self.out.flush()?; + Ok(()) + } +} + +pub fn is_quit(k: &KeyEvent) -> bool { + k.kind != KeyEventKind::Release + && k.modifiers.contains(KeyModifiers::CONTROL) + && k.code == KeyCode::Char('q') +} + +/// The editor's primary modifier: ⌘ on macOS, where a terminal hands over ⌃ +/// instead, and ⌃ everywhere else. +const PRIMARY: Modifiers = if cfg!(target_os = "macos") { + Modifiers::META +} else { + Modifiers::CONTROL +}; + +/// A terminal key as the editor's `(Key, Code, Modifiers)`, the shape +/// `leaf_dioxus::pressed` makes of winit's. +pub fn key(k: &KeyEvent) -> Option<(Key, Code, Modifiers)> { + if k.kind == KeyEventKind::Release { + return None; + } + let mut mods = Modifiers::empty(); + mods.set(Modifiers::SHIFT, k.modifiers.contains(KeyModifiers::SHIFT)); + mods.set(Modifiers::ALT, k.modifiers.contains(KeyModifiers::ALT)); + mods.set(PRIMARY, k.modifiers.contains(KeyModifiers::CONTROL)); + if k.code == KeyCode::BackTab { + mods.insert(Modifiers::SHIFT); + } + let named = |n| Some((Key::Named(n), Code::Unidentified, mods)); + match k.code { + KeyCode::Char(c) => { + let (key, code, _) = char_key(c); + // ⌃⇧z arrives as `Z` with SHIFT already folded in. + let key = if mods.intersects(PRIMARY) { + match key { + Key::Character(s) => Key::Character(s.to_lowercase()), + k => k, + } + } else { + key + }; + Some((key, code, mods)) + } + KeyCode::Enter => named(NamedKey::Enter), + KeyCode::Backspace => named(NamedKey::Backspace), + KeyCode::Delete => named(NamedKey::Delete), + KeyCode::Tab => named(NamedKey::Tab), + KeyCode::BackTab => named(NamedKey::Tab), + KeyCode::Esc => named(NamedKey::Escape), + KeyCode::Left => named(NamedKey::ArrowLeft), + KeyCode::Right => named(NamedKey::ArrowRight), + KeyCode::Up => named(NamedKey::ArrowUp), + KeyCode::Down => named(NamedKey::ArrowDown), + KeyCode::Home => named(NamedKey::Home), + KeyCode::End => named(NamedKey::End), + KeyCode::PageUp => named(NamedKey::PageUp), + KeyCode::PageDown => named(NamedKey::PageDown), + _ => None, + } +} + +/// A typed character, with the physical key a US layout gives it. +pub fn char_key(c: char) -> (Key, Code, Modifiers) { + if c == '\n' || c == '\r' { + return (Key::Named(NamedKey::Enter), Code::Enter, Modifiers::empty()); + } + let code = if c.is_ascii_alphabetic() { + Code::from_str(&format!("Key{}", c.to_ascii_uppercase())).unwrap_or(Code::Unidentified) + } else if c.is_ascii_digit() { + Code::from_str(&format!("Digit{c}")).unwrap_or(Code::Unidentified) + } else if c == ' ' { + Code::Space + } else { + Code::Unidentified + }; + (Key::Character(c.to_string()), code, Modifiers::empty()) +} + +/// A left-button press, drag or release, as Blitz's pointer events in the +/// cell it fell in: in its left part, so a click on a character puts the +/// caret before it, as a terminal's block cursor reads. +pub fn pointer(doc: &mut DioxusDocument, m: Metrics, me: &MouseEvent) { + let x = (me.column as f32 + 0.3) * m.cw; + let y = (me.row as f32 + 0.5) * m.ch; + let scroll = doc.inner.borrow().viewport_scroll(); + let mut mods = Modifiers::empty(); + mods.set(Modifiers::SHIFT, me.modifiers.contains(KeyModifiers::SHIFT)); + let held = !matches!(me.kind, MouseEventKind::Up(_)); + let event = BlitzPointerEvent { + id: BlitzPointerId::Mouse, + is_primary: true, + coords: PointerCoords { + page_x: x + scroll.x as f32, + page_y: y + scroll.y as f32, + screen_x: x, + screen_y: y, + client_x: x, + client_y: y, + }, + button: MouseEventButton::Main, + buttons: if held { + MouseEventButtons::Primary + } else { + MouseEventButtons::None + }, + mods, + details: Default::default(), + element: Default::default(), + active_pointers: Default::default(), + }; + let ui = match me.kind { + MouseEventKind::Down(_) => UiEvent::PointerDown(event), + MouseEventKind::Up(_) => UiEvent::PointerUp(event), + _ => UiEvent::PointerMove(event), + }; + blitz_dom::Document::handle_ui_event(doc, ui); +} diff --git a/apps/leaf-dioxus-tui/src/window.rs b/apps/leaf-dioxus-tui/src/window.rs new file mode 100644 index 00000000..da7659db --- /dev/null +++ b/apps/leaf-dioxus-tui/src/window.rs @@ -0,0 +1,206 @@ +//! A winit [`Window`] that is a terminal: the editor and Blitz ask their +//! window for its size, its scale and its theme, and ask it to redraw. They +//! need nothing else of winit, so this answers from the terminal's size in +//! cells, multiplied out to CSS pixels by [`crate::cell`], and does nothing +//! else. `apps/leaf-dioxus/src/offscreen.rs` is the same idea for a sheet. + +use std::fmt; +use std::sync::Mutex; +use std::sync::atomic::{AtomicBool, Ordering}; + +use dioxus_native::winit::cursor::Cursor; +use dioxus_native::winit::dpi::{PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size}; +use dioxus_native::winit::error::RequestError; +use dioxus_native::winit::icon::Icon; +use dioxus_native::winit::monitor::{Fullscreen, MonitorHandle}; +use dioxus_native::winit::window::{ + CursorGrabMode, ImeCapabilities, ImeRequest, ImeRequestError, ResizeDirection, Theme, + UserAttentionType, Window, WindowButtons, WindowId, WindowLevel, WindowType, +}; +use raw_window_handle as rwh; + +/// The terminal, as a winit window of `size` pixels at a scale of one. +pub struct TermWindow { + size: Mutex>, + dark: bool, + /// Set by the editor's `request_redraw`, taken by the loop in `main.rs`. + dirty: AtomicBool, + ime: Mutex>, +} + +impl fmt::Debug for TermWindow { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TermWindow") + .field("size", &*self.size.lock().unwrap()) + .finish() + } +} + +impl TermWindow { + pub fn new(width: u32, height: u32, dark: bool) -> Self { + Self { + size: Mutex::new(PhysicalSize::new(width.max(1), height.max(1))), + dark, + dirty: AtomicBool::new(true), + ime: Mutex::new(None), + } + } + + pub fn resize(&self, width: u32, height: u32) { + *self.size.lock().unwrap() = PhysicalSize::new(width.max(1), height.max(1)); + self.dirty.store(true, Ordering::Relaxed); + } + + /// Whether anything asked for a redraw since the last call. + pub fn take_dirty(&self) -> bool { + self.dirty.swap(false, Ordering::Relaxed) + } +} + +impl rwh::HasWindowHandle for TermWindow { + fn window_handle(&self) -> Result, rwh::HandleError> { + Err(rwh::HandleError::NotSupported) + } +} + +impl rwh::HasDisplayHandle for TermWindow { + fn display_handle(&self) -> Result, rwh::HandleError> { + Err(rwh::HandleError::NotSupported) + } +} + +impl Window for TermWindow { + fn window_type(&self) -> WindowType { + WindowType::default() + } + fn id(&self) -> WindowId { + WindowId::from_raw(1) + } + fn scale_factor(&self) -> f64 { + 1.0 + } + fn request_redraw(&self) { + self.dirty.store(true, Ordering::Relaxed); + } + fn pre_present_notify(&self) {} + fn reset_dead_keys(&self) {} + fn surface_position(&self) -> PhysicalPosition { + PhysicalPosition::new(0, 0) + } + fn outer_position(&self) -> Result, RequestError> { + Ok(PhysicalPosition::new(0, 0)) + } + fn set_outer_position(&self, _position: Position) {} + fn surface_size(&self) -> PhysicalSize { + *self.size.lock().unwrap() + } + fn request_surface_size(&self, _size: Size) -> Option> { + None + } + fn outer_size(&self) -> PhysicalSize { + self.surface_size() + } + fn safe_area(&self) -> PhysicalInsets { + PhysicalInsets::new(0, 0, 0, 0) + } + fn set_min_surface_size(&self, _min_size: Option) {} + fn set_max_surface_size(&self, _max_size: Option) {} + fn surface_resize_increments(&self) -> Option> { + None + } + fn set_surface_resize_increments(&self, _increments: Option) {} + fn set_title(&self, _title: &str) {} + fn set_transparent(&self, _transparent: bool) {} + fn set_blur(&self, _blur: bool) {} + fn set_visible(&self, _visible: bool) {} + fn is_visible(&self) -> Option { + Some(true) + } + fn set_resizable(&self, _resizable: bool) {} + fn is_resizable(&self) -> bool { + true + } + fn set_enabled_buttons(&self, _buttons: WindowButtons) {} + fn enabled_buttons(&self) -> WindowButtons { + WindowButtons::all() + } + fn set_minimized(&self, _minimized: bool) {} + fn is_minimized(&self) -> Option { + Some(false) + } + fn set_maximized(&self, _maximized: bool) {} + fn is_maximized(&self) -> bool { + false + } + fn set_fullscreen(&self, _fullscreen: Option) {} + fn fullscreen(&self) -> Option { + None + } + fn set_decorations(&self, _decorations: bool) {} + fn is_decorated(&self) -> bool { + false + } + fn set_window_level(&self, _level: WindowLevel) {} + fn set_window_icon(&self, _window_icon: Option) {} + /// A terminal has no input method to place: its own composes in place. + fn request_ime_update(&self, request: ImeRequest) -> Result<(), ImeRequestError> { + match request { + ImeRequest::Enable(enable) => { + let (caps, _) = enable.into_raw(); + *self.ime.lock().unwrap() = Some(caps); + } + ImeRequest::Disable => *self.ime.lock().unwrap() = None, + _ => {} + } + Ok(()) + } + fn ime_capabilities(&self) -> Option { + *self.ime.lock().unwrap() + } + fn focus_window(&self) {} + fn has_focus(&self) -> bool { + true + } + fn request_user_attention(&self, _request_type: Option) {} + fn set_theme(&self, _theme: Option) {} + fn theme(&self) -> Option { + Some(if self.dark { Theme::Dark } else { Theme::Light }) + } + fn set_content_protected(&self, _protected: bool) {} + fn title(&self) -> String { + String::new() + } + fn set_cursor(&self, _cursor: Cursor) {} + fn set_cursor_position(&self, _position: Position) -> Result<(), RequestError> { + Ok(()) + } + fn set_cursor_grab(&self, _mode: CursorGrabMode) -> Result<(), RequestError> { + Ok(()) + } + fn set_cursor_visible(&self, _visible: bool) {} + fn drag_window(&self) -> Result<(), RequestError> { + Ok(()) + } + fn drag_resize_window(&self, _direction: ResizeDirection) -> Result<(), RequestError> { + Ok(()) + } + fn show_window_menu(&self, _position: Position) {} + fn set_cursor_hittest(&self, _hittest: bool) -> Result<(), RequestError> { + Ok(()) + } + fn current_monitor(&self) -> Option { + None + } + fn available_monitors(&self) -> Box> { + Box::new(std::iter::empty()) + } + fn primary_monitor(&self) -> Option { + None + } + fn rwh_06_display_handle(&self) -> &dyn rwh::HasDisplayHandle { + self + } + fn rwh_06_window_handle(&self) -> &dyn rwh::HasWindowHandle { + self + } +} diff --git a/docs/proposals/proposals.md b/docs/proposals/proposals.md index 10c93842..b3fcbee3 100644 --- a/docs/proposals/proposals.md +++ b/docs/proposals/proposals.md @@ -13,6 +13,7 @@ contents: - '[Directives a host names, inserts and draws](host-directives.md)' - '[Editors inside a document](embedded-editors.md)' - '[A shared, patched winit for the Dioxus work](/docs/proposals/a-shared-patched-winit-for-the-dioxus-work.md)' +- '[The leaf-dioxus editor in a terminal](/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md)' part_of: '[leaf](/README.md)' --- # Proposals diff --git a/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md b/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md new file mode 100644 index 00000000..37d48b21 --- /dev/null +++ b/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md @@ -0,0 +1,128 @@ +--- +title: The leaf-dioxus editor in a terminal +part_of: '[Proposals](/docs/proposals/proposals.md)' +status: draft +created: 2026-10-21 +--- + +# The leaf-dioxus editor in a terminal + +## Status + +`draft`, 2026-10-21. Written with the prototype in `apps/leaf-dioxus-tui`, on +the `dioxus-tui` branch. Nothing is decided. leaf-tui is untouched; replacing it +is Adam's call (see "Decisions to make"). + +## Does Dioxus have a TUI renderer? + +Not any more. Dioxus had one, `dioxus-tui`, on a core called rink (later +`plasmo`) with taffy for layout. Its last crates.io release was +`0.5.0-alpha.0`, on 2024-02-23. Commit `7cc326488` ("Move TUI renderer into +blitz repo", 2024-03-15) took it out of the Dioxus repo before 0.5 shipped. The +Blitz repo has no TUI package today: its `packages/` are the DOM, paint, shell, +net, HTML, the test harness and dioxus-native. So Dioxus 0.8 has no terminal +renderer to use or revive. The `dioxus-tui` code on crates.io is for the 0.4 / +0.5-alpha core and would need porting to 0.8's. + +## The two routes + +**Revive dioxus-tui.** Port rink/plasmo to Dioxus 0.8. It has its own DOM, its +own style subset and its own layout. leaf-dioxus would then need to work on two +DOMs with different CSS support, and the editor depends on Blitz details +(`keys.rs`, `view.rs` record several). Large, and it doubles the surface. + +**Paint Blitz into cells.** Keep Blitz's DOM, Stylo and taffy exactly as the Mac +app uses them, and replace only the last step: walk the laid-out tree and write +cells instead of pixels. This is the prototype. The cost was small because +everything above the painter already existed: + +- `DioxusDocument::new` runs with no window (`apps/leaf-dioxus/src/headless.rs` + already does it for tests). +- The editor needs a winit `Window` only for size, scale, theme and redraw + requests. A stub is enough (`offscreen.rs` already does it for PDF). +- The editor takes keys as `(Key, Code, Modifiers)` through `Editor::key`, so a + crossterm key maps straight in. +- The editor lays out its own text with parley. If the face is monospace and a + cell is one advance wide and one line high, its wrapping, caret motion and + hit-testing count in cells without any change to the editor. + +The prototype is about 1,500 lines in four files: the painter (~650), the +host loop with its tests, the terminal I/O and the +window stub. It needed **no change to +leaf-dioxus or unit**. + +## What the prototype does + +Measured on 2026-10-21 in tmux at 80×24, driving the debug build: + +- Paints headings, paragraphs, bold/italic/underline, links, inline and block + quotes, nested bullet and numbered lists, code blocks with syntax colours, + tables, the selection and the status line, in the light and dark palettes. +- Typing, arrows, Home/End, PageUp/PageDown, ⇧-selection, ⌘ shortcuts as ⌃ + (bold, save), the WYSIWYG reveal of markup at the caret, bracketed paste. +- Mouse click to place the caret, wheel to scroll, caret-follow. +- Saves through `Doc::save`. +- One frame (settle + layout + paint) takes 1–3 ms on a 400-paragraph document. + The process holds about 55 MB resident. +- Five tests paint a document headlessly and check the grid. + +## What it does not do yet + +Against the [leaf-tui inventory](#what-leaf-tui-does) below: + +- **Pictures, formulas and diagrams** draw as a labelled frame. leaf-tui paints + them through kitty, iTerm2 or sixel. Doable: the painter knows each `img` + box's cell rectangle, so ratatui-image (or its encoders) can paint into it. +- **Chrome.** The command palette, context menu, key reference, prompts and + unsaved-changes / changed-on-disk dialogs are leaf-tui's own. Here they + would be Dioxus components (unit's menus and dialogs already exist for the + Mac app) and so shared with it. Not tried: unit is not in the prototype yet. +- **File-watch, New, Save As, read-only, `-w` column width.** Host work, not + rendering. +- **Terminal theme detection.** `LEAF_THEME` only; leaf-tui asks the terminal + (OSC 11). +- **Pixel chrome.** The editor sizes some chrome in pixels (find bar 34px rows, + table cell padding). In cells this rounds: table rules get no row of their + own, so a table shows its column rules only. A terminal stylesheet, or + the editor sizing chrome in lines, would fix this. +- **Emacs ⌃ keys.** On macOS ⌃ stands in for ⌘, so ⌃A/⌃E/⌃K reach the editor + as ⌘A/⌘E/⌘K. leaf-tui keeps both. +- **Wide characters** (CJK, emoji) take two cells, but the editor measures them + with the font's advance, which may not be exactly two cells. Not checked. +- **Not checked at all:** Linux (Menlo is assumed; the face list falls back to + DejaVu Sans Mono), release size and build time, and the IME. + +## What leaf-tui does + +`apps/leaf-tui` (about 8,000 lines) and `crates/leaf-ratatui` (about 6,200) +paint leaf-core's `VisualMap`, a grid of glyphs core lays out for a given +width. It has a centred column with a scrollbar, a status toast, a find and +replace bar, two modal choice dialogs, a nested context menu, a fuzzy command +palette, a one-line prompt and a key reference, all from one table of about 60 +commands. It draws images, display math and large headings through the +terminal's graphics protocol. It watches the file on disk. It has 274 tests, +and CI builds it for four targets and ships it to Homebrew. + +## The argument + +For the replacement: one editor, the one the Mac app uses, in every place. +leaf-ratatui is a second renderer of the same document, with its own input +mapping, its own layout pass and its own tests. A behaviour fixed in +leaf-dioxus is fixed in the terminal too. Its chrome could be unit's. + +Against: the terminal then depends on Dioxus 0.8 alpha, Stylo and the Blitz +fork, which is a much larger build than ratatui: the prototype's lockfile lists 620 +packages (every platform's), where the root workspace's comment counts 141 +that leaf-tui uses. It uses more memory. The graphics-protocol work and +the chrome above would have to be redone on the new base before it matches. + +## Decisions to make + +1. Whether to keep going: images through the graphics protocol next, then + unit's menus and dialogs, then the host features. That is the order that + closes the largest gaps first. +2. Whether the editor should size its chrome in lines when a host asks (a + `Look` option), so a terminal needs no stylesheet patch. +3. Whether the prototype stays its own workspace, like `apps/leaf-dioxus`, or + joins it. +4. Only after it matches leaf-tui: whether it replaces leaf-tui. From 3f8c8833465f2f05a232cf36373e48b5c323ae1b Mon Sep 17 00:00:00 2001 From: Adam Harris Date: Wed, 21 Oct 2026 15:14:33 -0600 Subject: [PATCH 02/13] feat(dioxus-tui): paint pictures, formulas and diagrams with the graphics protocol The painter records each img's box in cells and the rows of it in view; ratatui-image paints the decoded picture over them (kitty, iTerm2, sixel, or half-blocks), cropped when it is part-way off the screen and trimmed under the status line. Files load through leaf-raster as in leaf-tui; formulas and diagrams arrive as SVG data URLs and are rasterised. The terminal output moves to ratatui, which diffs the cells. --- apps/leaf-dioxus-tui/Cargo.lock | 816 +++++++++++++++++++++++---- apps/leaf-dioxus-tui/Cargo.toml | 7 + apps/leaf-dioxus-tui/src/main.rs | 26 +- apps/leaf-dioxus-tui/src/paint.rs | 63 ++- apps/leaf-dioxus-tui/src/pictures.rs | 162 ++++++ apps/leaf-dioxus-tui/src/term.rs | 125 ++-- 6 files changed, 1001 insertions(+), 198 deletions(-) create mode 100644 apps/leaf-dioxus-tui/src/pictures.rs diff --git a/apps/leaf-dioxus-tui/Cargo.lock b/apps/leaf-dioxus-tui/Cargo.lock index 97dd57c3..945354ad 100644 --- a/apps/leaf-dioxus-tui/Cargo.lock +++ b/apps/leaf-dioxus-tui/Cargo.lock @@ -55,7 +55,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" dependencies = [ "android-properties", - "bitflags", + "bitflags 2.13.2", "cc", "jni 0.22.4", "libc", @@ -110,7 +110,7 @@ dependencies = [ "image", "kurbo", "peniko", - "usvg", + "usvg 0.48.1", ] [[package]] @@ -248,6 +248,16 @@ version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" +[[package]] +name = "base64-simd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" +dependencies = [ + "outref", + "vsimd", +] + [[package]] name = "bincode" version = "1.3.3" @@ -296,6 +306,12 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.13.2" @@ -311,7 +327,7 @@ dependencies = [ "anyrender", "app_units", "atomic_refcell", - "bitflags", + "bitflags 2.13.2", "blitz-traits", "color", "cssparser", @@ -333,7 +349,7 @@ dependencies = [ "percent-encoding", "rayon", "selectors", - "skrifa", + "skrifa 0.44.0", "slotmap", "smallvec", "stylo", @@ -346,7 +362,7 @@ dependencies = [ "thin-vec", "thread_local", "url", - "usvg", + "usvg 0.48.1", "web-time", "writeable", ] @@ -378,11 +394,11 @@ dependencies = [ "kurbo", "parley", "peniko", - "skrifa", + "skrifa 0.44.0", "smallvec", "stylo", "taffy", - "usvg", + "usvg 0.48.1", ] [[package]] @@ -410,7 +426,7 @@ version = "0.3.0-beta.4" source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95" dependencies = [ "atomic_refcell", - "bitflags", + "bitflags 2.13.2", "bytes", "cursor-icon", "http", @@ -498,7 +514,7 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" dependencies = [ - "bitflags", + "bitflags 2.13.2", "polling", "rustix 1.1.5", "tracing", @@ -516,6 +532,21 @@ dependencies = [ "wayland-client", ] +[[package]] +name = "cassowary" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.8.0" @@ -574,7 +605,7 @@ checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" dependencies = [ "serde", "termcolor", - "unicode-width", + "unicode-width 0.2.0", ] [[package]] @@ -602,6 +633,20 @@ dependencies = [ "memchr", ] +[[package]] +name = "compact_str" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd622ebbb56a5b2ccb651b32b911cdeb2a9b4b11776b2473bf26a26a286244e" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "rustversion", + "ryu", + "static_assertions", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -678,6 +723,30 @@ dependencies = [ "libm", ] +[[package]] +name = "cosmic-text" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be17b688510d934ce13f48a2beba700e11583e281e0fda99c22bb256a14eda73" +dependencies = [ + "bitflags 2.13.2", + "fontdb 0.23.0", + "harfrust 0.5.2", + "linebender_resource_handle", + "log", + "rangemap", + "rustc-hash 2.1.3", + "self_cell", + "skrifa 0.40.0", + "smol_str", + "swash", + "sys-locale", + "unicode-bidi", + "unicode-linebreak", + "unicode-script", + "unicode-segmentation", +] + [[package]] name = "cpufeatures" version = "0.3.1" @@ -727,7 +796,7 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags", + "bitflags 2.13.2", "crossterm_winapi", "mio", "parking_lot", @@ -811,6 +880,16 @@ dependencies = [ "darling_macro 0.21.3", ] +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core 0.24.1", + "darling_macro 0.24.1", +] + [[package]] name = "darling_core" version = "0.20.11" @@ -837,6 +916,19 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.9", +] + [[package]] name = "darling_macro" version = "0.20.11" @@ -859,6 +951,17 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core 0.24.1", + "quote", + "syn 3.0.9", +] + [[package]] name = "data-url" version = "0.3.2" @@ -1198,7 +1301,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" dependencies = [ - "bitflags", + "bitflags 2.13.2", "objc2", ] @@ -1453,6 +1556,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" +[[package]] +name = "font-types" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b38ad915f6dadd993ced50848a8291a543bd41ca62bc10740d5e64e2ab4cfd7" +dependencies = [ + "bytemuck", +] + [[package]] name = "font-types" version = "0.12.7" @@ -1512,11 +1624,11 @@ dependencies = [ "objc2-core-text", "objc2-foundation", "parlance", - "read-fonts", + "read-fonts 0.41.0", "roxmltree 0.21.1", "smallvec", - "windows", - "windows-core", + "windows 0.62.2", + "windows-core 0.62.2", "yeslogic-fontconfig-sys", ] @@ -1620,6 +1732,17 @@ dependencies = [ "windows-link", ] +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "getrandom" version = "0.4.3" @@ -1663,7 +1786,7 @@ dependencies = [ "hashbrown 0.17.1", "log", "peniko", - "skrifa", + "skrifa 0.44.0", "smallvec", "vello_common", ] @@ -1700,7 +1823,7 @@ dependencies = [ "log", "presser", "thiserror 2.0.21", - "windows", + "windows 0.62.2", ] [[package]] @@ -1709,7 +1832,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b89c83349105e3732062a895becfc71a8f921bb71ecbbdd8ff99263e3b53a0ca" dependencies = [ - "bitflags", + "bitflags 2.13.2", "gpu-descriptor-types", "hashbrown 0.15.5", ] @@ -1720,7 +1843,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdf242682df893b86f33a73828fb09ca4b2d3bb6cc95249707fc684d27484b91" dependencies = [ - "bitflags", + "bitflags 2.13.2", ] [[package]] @@ -1745,15 +1868,28 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "harfrust" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9da2e5ae821f6e96664977bf974d6d6a2d6682f9ccee23e62ec1d134246845f9" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "core_maths", + "read-fonts 0.37.0", + "smallvec", +] + [[package]] name = "harfrust" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9" dependencies = [ - "bitflags", + "bitflags 2.13.2", "bytemuck", - "read-fonts", + "read-fonts 0.41.0", "smallvec", ] @@ -1763,6 +1899,8 @@ version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ + "allocator-api2", + "equivalent", "foldhash 0.1.5", ] @@ -2069,6 +2207,12 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae293c039020f9ec10710af98d29ce6aa2051486638b49c9a6409f3b4a9e98ad" +[[package]] +name = "icy_sixel" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccc0a9c4770bc47b0a933256a496cfb8b6531f753ea9bccb19c6dff0ff7273fc" + [[package]] name = "ident_case" version = "1.0.1" @@ -2109,7 +2253,7 @@ dependencies = [ "image-webp", "moxcms", "num-traits", - "png", + "png 0.18.1", "tiff", "zune-core", "zune-jpeg", @@ -2125,6 +2269,12 @@ dependencies = [ "quick-error", ] +[[package]] +name = "imagesize" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e54e57b4c48b40f7aec75635392b12b3421fa26fe8b4332e63138ed278459c" + [[package]] name = "imagesize" version = "0.15.0" @@ -2141,6 +2291,15 @@ dependencies = [ "hashbrown 0.17.1", ] +[[package]] +name = "indoc" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1" +dependencies = [ + "rustversion", +] + [[package]] name = "infer" version = "0.19.0" @@ -2150,12 +2309,34 @@ dependencies = [ "cfb", ] +[[package]] +name = "instability" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3b5acc1e2fd9375041a388da33d1eb8aed5f7a8c0dd3543e3ea2805adfbe20" +dependencies = [ + "darling 0.24.1", + "indoc", + "proc-macro2", + "quote", + "syn 3.0.9", +] + [[package]] name = "ipnet" version = "2.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.14.0" @@ -2251,7 +2432,7 @@ version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" dependencies = [ - "getrandom", + "getrandom 0.4.3", "libc", ] @@ -2282,7 +2463,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" dependencies = [ - "bitflags", + "bitflags 2.13.2", "serde", ] @@ -2351,7 +2532,7 @@ dependencies = [ "twig-xml", "two-face", "unicode-segmentation", - "unicode-width", + "unicode-width 0.2.0", ] [[package]] @@ -2368,8 +2549,8 @@ dependencies = [ "parley", "tokio", "unicode-segmentation", - "unicode-width", - "usvg", + "unicode-width 0.2.0", + "usvg 0.48.1", ] [[package]] @@ -2385,14 +2566,17 @@ dependencies = [ "dioxus-native", "leaf-core", "leaf-dioxus", + "leaf-raster", "libc", "parley", + "ratatui", + "ratatui-image", "raw-window-handle", "stylo", "taffy", "tokio", "unicode-segmentation", - "unicode-width", + "unicode-width 0.2.0", ] [[package]] @@ -2412,6 +2596,15 @@ dependencies = [ "mermaid-rs-renderer", ] +[[package]] +name = "leaf-raster" +version = "0.5.1" +dependencies = [ + "cosmic-text", + "image", + "resvg", +] + [[package]] name = "libc" version = "0.2.190" @@ -2440,7 +2633,7 @@ version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" dependencies = [ - "bitflags", + "bitflags 2.13.2", "libc", "plain", "redox_syscall 0.9.4", @@ -2497,6 +2690,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3bd0dd2cd90571056fdb71f6275fada10131182f84899f4b2a916e565d81d86" +[[package]] +name = "lru" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown 0.15.5", +] + [[package]] name = "malloc_size_of_derive" version = "0.1.3" @@ -2632,7 +2834,7 @@ checksum = "b2bf919621e7975acb27d881bae2fb993e0d45c8e0446e85e6272971e00dc8df" dependencies = [ "arrayvec", "bit-set 0.9.1", - "bitflags", + "bitflags 2.13.2", "cfg-if", "cfg_aliases", "codespan-reporting", @@ -2658,7 +2860,7 @@ checksum = "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130" dependencies = [ "arrayvec", "bit-set 0.10.0", - "bitflags", + "bitflags 2.13.2", "cfg-if", "cfg_aliases", "codespan-reporting", @@ -2711,7 +2913,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ - "bitflags", + "bitflags 2.13.2", "jni-sys 0.3.1", "log", "ndk-sys", @@ -2818,7 +3020,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" dependencies = [ - "bitflags", + "bitflags 2.13.2", "objc2", "objc2-core-foundation", "objc2-core-graphics", @@ -2831,7 +3033,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ - "bitflags", + "bitflags 2.13.2", "block2", "dispatch2", "objc2", @@ -2843,7 +3045,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" dependencies = [ - "bitflags", + "bitflags 2.13.2", "dispatch2", "libc", "objc2", @@ -2857,7 +3059,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" dependencies = [ - "bitflags", + "bitflags 2.13.2", "objc2-core-foundation", ] @@ -2867,7 +3069,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d425caf1df73233f29fd8a5c3e5edbc30d2d4307870f802d18f00d83dc5141a6" dependencies = [ - "bitflags", + "bitflags 2.13.2", "objc2-core-foundation", "objc2-core-graphics", ] @@ -2884,7 +3086,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ - "bitflags", + "bitflags 2.13.2", "block2", "objc2", "objc2-core-foundation", @@ -2896,7 +3098,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" dependencies = [ - "bitflags", + "bitflags 2.13.2", "objc2", "objc2-core-foundation", ] @@ -2907,7 +3109,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" dependencies = [ - "bitflags", + "bitflags 2.13.2", "block2", "objc2", "objc2-foundation", @@ -2919,7 +3121,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" dependencies = [ - "bitflags", + "bitflags 2.13.2", "objc2", "objc2-core-foundation", "objc2-core-graphics", @@ -2933,7 +3135,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" dependencies = [ - "bitflags", + "bitflags 2.13.2", "objc2", "objc2-core-foundation", "objc2-foundation", @@ -2951,7 +3153,7 @@ version = "0.10.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" dependencies = [ - "bitflags", + "bitflags 2.13.2", "cfg-if", "foreign-types", "libc", @@ -3016,6 +3218,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "outref" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" + [[package]] name = "owned_ttf_parser" version = "0.25.1" @@ -3094,7 +3302,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b74c0d373e462e504ad4436710a39f099e18e848e1ee711f70cd2dcd5a69b290" dependencies = [ "fontique", - "harfrust", + "harfrust 0.12.0", "hashbrown 0.17.1", "icu_locale_core", "icu_normalizer", @@ -3104,9 +3312,15 @@ dependencies = [ "parlance", "parley_data", "parley_emoji", - "skrifa", + "skrifa 0.44.0", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "peniko" version = "0.6.1" @@ -3290,13 +3504,26 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +[[package]] +name = "png" +version = "0.17.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + [[package]] name = "png" version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" dependencies = [ - "bitflags", + "bitflags 2.13.2", "crc32fast", "fdeflate", "flate2", @@ -3358,6 +3585,15 @@ dependencies = [ "zerovec", ] +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -3448,6 +3684,18 @@ version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", "rand_core", ] @@ -3456,6 +3704,9 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] [[package]] name = "range-alloc" @@ -3463,6 +3714,49 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08" +[[package]] +name = "rangemap" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a611d15b50743feb4c76b7d03edcb0e64f399c26961e4efe6975bc398be6aa3d" + +[[package]] +name = "ratatui" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b" +dependencies = [ + "bitflags 2.13.2", + "cassowary", + "compact_str", + "crossterm", + "indoc", + "instability", + "itertools 0.13.0", + "lru", + "paste", + "strum 0.26.3", + "unicode-segmentation", + "unicode-truncate", + "unicode-width 0.2.0", +] + +[[package]] +name = "ratatui-image" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dbebe428e366c230b2251c7091f2a56ec2bf818d96cdc807f6474428ee09040" +dependencies = [ + "base64-simd", + "icy_sixel", + "image", + "rand", + "ratatui", + "rustix 0.38.44", + "thiserror 1.0.69", + "windows 0.58.0", +] + [[package]] name = "ratex-font" version = "0.1.14" @@ -3609,6 +3903,17 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "read-fonts" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5" +dependencies = [ + "bytemuck", + "core_maths", + "font-types 0.11.3", +] + [[package]] name = "read-fonts" version = "0.41.0" @@ -3616,7 +3921,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709" dependencies = [ "bytemuck", - "font-types", + "font-types 0.12.7", "once_cell", ] @@ -3626,7 +3931,7 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5018d583d6d2f5499352aea8d177e9067d1eb03ab17c78169d5ba7a30001b15" dependencies = [ - "bitflags", + "bitflags 2.13.2", "libredox", ] @@ -3636,7 +3941,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags", + "bitflags 2.13.2", ] [[package]] @@ -3645,7 +3950,7 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e" dependencies = [ - "bitflags", + "bitflags 2.13.2", ] [[package]] @@ -3726,6 +4031,32 @@ dependencies = [ "web-sys", ] +[[package]] +name = "resvg" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b563218631706d614e23059436526d005b50ab5f2d506b55a17eb65c5eb83419" +dependencies = [ + "gif", + "image-webp", + "log", + "pico-args", + "rgb", + "svgtypes", + "tiny-skia 0.11.4", + "usvg 0.46.0", + "zune-jpeg", +] + +[[package]] +name = "rgb" +version = "0.8.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4" +dependencies = [ + "bytemuck", +] + [[package]] name = "roxmltree" version = "0.20.0" @@ -3803,7 +4134,7 @@ version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags", + "bitflags 2.13.2", "errno", "libc", "linux-raw-sys 0.4.15", @@ -3816,7 +4147,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" dependencies = [ - "bitflags", + "bitflags 2.13.2", "errno", "libc", "linux-raw-sys 0.12.1", @@ -3838,6 +4169,24 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" +[[package]] +name = "rustybuzz" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3c7c96f8a08ee34eff8857b11b49b07d71d1c3f4e88f8a88d4c9e9f90b1702" +dependencies = [ + "bitflags 2.13.2", + "bytemuck", + "core_maths", + "log", + "smallvec", + "ttf-parser", + "unicode-bidi-mirroring", + "unicode-ccc", + "unicode-properties", + "unicode-script", +] + [[package]] name = "ryu" version = "1.0.23" @@ -3893,7 +4242,7 @@ dependencies = [ "log", "memmap2", "smithay-client-toolkit", - "tiny-skia", + "tiny-skia 0.12.0", ] [[package]] @@ -3902,7 +4251,7 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" dependencies = [ - "bitflags", + "bitflags 2.13.2", "core-foundation", "core-foundation-sys", "libc", @@ -3925,7 +4274,7 @@ version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8322aebea94a6cc288ff884e8a49bdbceef60206c400c6c46d22e62fc4fd91a6" dependencies = [ - "bitflags", + "bitflags 2.13.2", "cssparser", "derive_more", "log", @@ -3938,6 +4287,12 @@ dependencies = [ "to_shmem_derive", ] +[[package]] +name = "self_cell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813" + [[package]] name = "semver" version = "1.0.28" @@ -4103,6 +4458,16 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" +[[package]] +name = "skrifa" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac" +dependencies = [ + "bytemuck", + "read-fonts 0.37.0", +] + [[package]] name = "skrifa" version = "0.44.0" @@ -4110,7 +4475,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68" dependencies = [ "bytemuck", - "read-fonts", + "read-fonts 0.41.0", ] [[package]] @@ -4147,7 +4512,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74dc9ee14b0fdcb535f9556141bacac070c994a977d2240ee455d7438a617f00" dependencies = [ - "bitflags", + "bitflags 2.13.2", "calloop", "calloop-wayland-source", "cursor-icon", @@ -4192,7 +4557,7 @@ version = "0.4.0+sdk-1.4.341.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" dependencies = [ - "bitflags", + "bitflags 2.13.2", ] [[package]] @@ -4241,12 +4606,40 @@ dependencies = [ "quote", ] +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros 0.26.4", +] + [[package]] name = "strum" version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9628de9b8791db39ceda2b119bbe13134770b56c138ec1d3af810d045c04f9bd" +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.119", +] + [[package]] name = "strum_macros" version = "0.28.0" @@ -4268,7 +4661,7 @@ dependencies = [ "app_units", "arrayvec", "atomic_refcell", - "bitflags", + "bitflags 2.13.2", "byteorder", "cssparser", "derive_more", @@ -4276,7 +4669,7 @@ dependencies = [ "euclid", "icu_segmenter", "indexmap", - "itertools", + "itertools 0.14.0", "itoa", "log", "malloc_size_of_derive", @@ -4298,8 +4691,8 @@ dependencies = [ "smallvec", "static_assertions", "string_cache", - "strum", - "strum_macros", + "strum 0.28.0", + "strum_macros 0.28.0", "stylo_atoms", "stylo_derive", "stylo_dom", @@ -4345,7 +4738,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9febcb03f2b669ef06b3e8a5209e6280971ed55cecf83fbf3c0562fcf2aa2ec6" dependencies = [ - "bitflags", + "bitflags 2.13.2", "stylo_malloc_size_of", ] @@ -4382,7 +4775,7 @@ name = "stylo_taffy" version = "0.3.0-beta.4" source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95" dependencies = [ - "bitflags", + "bitflags 2.13.2", "stylo", "stylo_atoms", "taffy", @@ -4395,7 +4788,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "645d6bfe40eb6e86ebe9f2d2adadcbced41bfa96175de7cb13d4d178d27bc83d" dependencies = [ "app_units", - "bitflags", + "bitflags 2.13.2", "cssparser", "euclid", "malloc_size_of_derive", @@ -4454,6 +4847,17 @@ dependencies = [ "siphasher", ] +[[package]] +name = "swash" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e" +dependencies = [ + "skrifa 0.44.0", + "yazi", + "zeno", +] + [[package]] name = "syn" version = "2.0.119" @@ -4563,7 +4967,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom", + "getrandom 0.4.3", "once_cell", "rustix 1.1.5", "windows-sys 0.61.2", @@ -4656,6 +5060,21 @@ dependencies = [ "zune-jpeg", ] +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "png 0.17.16", + "tiny-skia-path 0.11.4", +] + [[package]] name = "tiny-skia" version = "0.12.0" @@ -4667,7 +5086,18 @@ dependencies = [ "bytemuck", "cfg-if", "log", - "tiny-skia-path", + "tiny-skia-path 0.12.0", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", ] [[package]] @@ -4821,7 +5251,7 @@ version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" dependencies = [ - "bitflags", + "bitflags 2.13.2", "bytes", "futures-util", "http", @@ -5011,12 +5441,30 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" +[[package]] +name = "unicode-bidi-mirroring" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfa6e8c60bb66d49db113e0125ee8711b7647b5579dc7f5f19c42357ed039fe" + +[[package]] +name = "unicode-ccc" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce61d488bcdc9bc8b5d1772c404828b17fc481c0a582b5581e95fb233aef503e" + [[package]] name = "unicode-ident" version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + [[package]] name = "unicode-normalization" version = "0.1.25" @@ -5026,6 +5474,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + [[package]] name = "unicode-script" version = "0.5.8" @@ -5038,6 +5492,17 @@ version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" +[[package]] +name = "unicode-truncate" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" +dependencies = [ + "itertools 0.13.0", + "unicode-segmentation", + "unicode-width 0.1.14", +] + [[package]] name = "unicode-vo" version = "0.1.0" @@ -5046,9 +5511,15 @@ checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" [[package]] name = "unicode-width" -version = "0.2.2" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "unicode-xid" @@ -5069,6 +5540,33 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "usvg" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e419dff010bb12512b0ae9e3d2f318dfbdf0167fde7eb05465134d4e8756076f" +dependencies = [ + "base64 0.22.1", + "data-url", + "flate2", + "fontdb 0.23.0", + "imagesize 0.14.0", + "kurbo", + "log", + "pico-args", + "roxmltree 0.21.1", + "rustybuzz", + "simplecss", + "siphasher", + "strict-num", + "svgtypes", + "tiny-skia-path 0.11.4", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "xmlwriter", +] + [[package]] name = "usvg" version = "0.48.1" @@ -5079,18 +5577,18 @@ dependencies = [ "data-url", "flate2", "fontdb 0.24.0", - "harfrust", - "imagesize", + "harfrust 0.12.0", + "imagesize 0.15.0", "kurbo", "log", "pico-args", "roxmltree 0.21.1", "simplecss", "siphasher", - "skrifa", + "skrifa 0.44.0", "strict-num", "svgtypes", - "tiny-skia-path", + "tiny-skia-path 0.12.0", "unicode-bidi", "unicode-script", "unicode-vo", @@ -5129,8 +5627,8 @@ dependencies = [ "futures-intrusive", "log", "peniko", - "png", - "skrifa", + "png 0.18.1", + "skrifa 0.44.0", "static_assertions", "thiserror 2.0.21", "vello_encoding", @@ -5149,7 +5647,7 @@ dependencies = [ "guillotiere", "log", "peniko", - "png", + "png 0.18.1", "smallvec", "thiserror 2.0.21", ] @@ -5175,7 +5673,7 @@ dependencies = [ "bytemuck", "guillotiere", "peniko", - "skrifa", + "skrifa 0.44.0", "smallvec", ] @@ -5204,6 +5702,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "vsimd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" + [[package]] name = "walkdir" version = "2.5.0" @@ -5326,7 +5830,7 @@ version = "0.31.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" dependencies = [ - "bitflags", + "bitflags 2.13.2", "rustix 1.1.5", "wayland-backend", "wayland-scanner", @@ -5338,7 +5842,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" dependencies = [ - "bitflags", + "bitflags 2.13.2", "cursor-icon", "wayland-backend", ] @@ -5360,7 +5864,7 @@ version = "0.32.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6" dependencies = [ - "bitflags", + "bitflags 2.13.2", "wayland-backend", "wayland-client", "wayland-scanner", @@ -5372,7 +5876,7 @@ version = "20251230.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91c6c3e7178e553d093d46999032bc79aafea9dedd71dd702c8ace7bbc25cf13" dependencies = [ - "bitflags", + "bitflags 2.13.2", "wayland-backend", "wayland-client", "wayland-protocols", @@ -5385,7 +5889,7 @@ version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8" dependencies = [ - "bitflags", + "bitflags 2.13.2", "wayland-backend", "wayland-client", "wayland-protocols", @@ -5398,7 +5902,7 @@ version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91" dependencies = [ - "bitflags", + "bitflags 2.13.2", "wayland-backend", "wayland-client", "wayland-protocols", @@ -5411,7 +5915,7 @@ version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234" dependencies = [ - "bitflags", + "bitflags 2.13.2", "wayland-backend", "wayland-client", "wayland-protocols", @@ -5502,7 +6006,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76e8840e1ba2881d4cbb18d2147627a56af426ff064c0401eb0c8410c6325d07" dependencies = [ "arrayvec", - "bitflags", + "bitflags 2.13.2", "bytemuck", "cfg-if", "cfg_aliases", @@ -5532,7 +6036,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e" dependencies = [ "arrayvec", - "bitflags", + "bitflags 2.13.2", "bytemuck", "cfg-if", "cfg_aliases", @@ -5564,7 +6068,7 @@ dependencies = [ "arrayvec", "bit-set 0.9.1", "bit-vec 0.9.1", - "bitflags", + "bitflags 2.13.2", "bytemuck", "cfg_aliases", "document-features", @@ -5598,7 +6102,7 @@ dependencies = [ "arrayvec", "bit-set 0.10.0", "bit-vec 0.9.1", - "bitflags", + "bitflags 2.13.2", "bytemuck", "cfg_aliases", "document-features", @@ -5696,7 +6200,7 @@ dependencies = [ "arrayvec", "ash", "bit-set 0.9.1", - "bitflags", + "bitflags 2.13.2", "block2", "bytemuck", "cfg-if", @@ -5735,9 +6239,9 @@ dependencies = [ "web-sys", "wgpu-naga-bridge 29.0.4", "wgpu-types 29.0.4", - "windows", - "windows-core", - "windows-result", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-result 0.4.1", ] [[package]] @@ -5750,7 +6254,7 @@ dependencies = [ "arrayvec", "ash", "bit-set 0.10.0", - "bitflags", + "bitflags 2.13.2", "block2", "bytemuck", "cfg-if", @@ -5791,9 +6295,9 @@ dependencies = [ "web-sys", "wgpu-naga-bridge 30.0.1", "wgpu-types 30.0.1", - "windows", - "windows-core", - "windows-result", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-result 0.4.1", ] [[package]] @@ -5822,7 +6326,7 @@ version = "29.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84bf84cd9ca8ca45e2b223a3868f1adf9bfc0c66aeac212e76ee7e40fdadf8f5" dependencies = [ - "bitflags", + "bitflags 2.13.2", "bytemuck", "js-sys", "log", @@ -5836,7 +6340,7 @@ version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286" dependencies = [ - "bitflags", + "bitflags 2.13.2", "bytemuck", "js-sys", "log", @@ -5897,6 +6401,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core 0.58.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows" version = "0.62.2" @@ -5904,7 +6418,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" dependencies = [ "windows-collections", - "windows-core", + "windows-core 0.62.2", "windows-future", "windows-numerics", ] @@ -5915,7 +6429,20 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" dependencies = [ - "windows-core", + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement 0.58.0", + "windows-interface 0.58.0", + "windows-result 0.2.0", + "windows-strings 0.1.0", + "windows-targets 0.52.6", ] [[package]] @@ -5924,11 +6451,11 @@ version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "windows-implement", - "windows-interface", + "windows-implement 0.60.2", + "windows-interface 0.59.3", "windows-link", - "windows-result", - "windows-strings", + "windows-result 0.4.1", + "windows-strings 0.5.1", ] [[package]] @@ -5937,11 +6464,22 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ - "windows-core", + "windows-core 0.62.2", "windows-link", "windows-threading", ] +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "windows-implement" version = "0.60.2" @@ -5953,6 +6491,17 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "windows-interface" version = "0.59.3" @@ -5976,10 +6525,19 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ - "windows-core", + "windows-core 0.62.2", "windows-link", ] +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-result" version = "0.4.1" @@ -5989,6 +6547,16 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result 0.2.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows-strings" version = "0.5.1" @@ -6161,7 +6729,7 @@ version = "0.31.0-beta.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f431156a3e4f0f1b35eaaf37674e55838e3652908c8088f570466274d1902e2b" dependencies = [ - "bitflags", + "bitflags 2.13.2", "cfg_aliases", "cursor-icon", "dpi", @@ -6189,7 +6757,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5d60d944a564986b9311e325334cc22e7e4cf726dd0ff7475fd925404215af4" dependencies = [ "android-activity", - "bitflags", + "bitflags 2.13.2", "dpi", "ndk", "raw-window-handle", @@ -6204,7 +6772,7 @@ version = "0.31.0-beta.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23343ec0ea7ac6aa72f38009a6ff66fb63bcf6395e0622fba72794d2a762ab42" dependencies = [ - "bitflags", + "bitflags 2.13.2", "block2", "dispatch2", "dpi", @@ -6246,7 +6814,7 @@ version = "0.31.0-beta.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8af6307236c51847199950c15cf80e0481a250bb96ce9132f5026df4ad3d0f9" dependencies = [ - "bitflags", + "bitflags 2.13.2", "cursor-icon", "dpi", "keyboard-types", @@ -6262,7 +6830,7 @@ version = "0.31.0-beta.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "278a8ae837902a3bc95dd2fd696d680da33f32130eecc29905358c9089cf6c50" dependencies = [ - "bitflags", + "bitflags 2.13.2", "dpi", "libredox", "orbclient", @@ -6279,7 +6847,7 @@ version = "0.31.0-beta.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83315a3ea1739c8466cf23d35e3b0a2cb20c9515d8857666b633afef484740b5" dependencies = [ - "bitflags", + "bitflags 2.13.2", "block2", "dispatch2", "dpi", @@ -6300,7 +6868,7 @@ version = "0.31.0-beta.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b64ceed06de0c45886eef05102106abe1413e703384e337bc57c7e95b71f803" dependencies = [ - "bitflags", + "bitflags 2.13.2", "calloop", "cursor-icon", "dpi", @@ -6329,7 +6897,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f539be45f95cc297bdfb80569aef38d925d64aec4133852a4d3fc5cb3660f1c9" dependencies = [ "atomic-waker", - "bitflags", + "bitflags 2.13.2", "concurrent-queue", "cursor-icon", "dpi", @@ -6351,7 +6919,7 @@ version = "0.31.0-beta.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25fb480c41df01d351f656cbf3ad74013f8a9d22bb5b2dcab59f9167e7a0b6ec" dependencies = [ - "bitflags", + "bitflags 2.13.2", "cursor-icon", "dpi", "raw-window-handle", @@ -6370,7 +6938,7 @@ version = "0.31.0-beta.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb5746cd907e514b7895491a1c6f7d0cb70077f9e16928cd74ae6f987ffd96aa" dependencies = [ - "bitflags", + "bitflags 2.13.2", "bytemuck", "calloop", "cursor-icon", @@ -6448,7 +7016,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" dependencies = [ - "bitflags", + "bitflags 2.13.2", "dlib", "log", "once_cell", @@ -6479,6 +7047,12 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "550a2b930b62486a393c52d5c3b84bff264b28aa437ed64694d31e93b1757af7" +[[package]] +name = "yazi" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5" + [[package]] name = "yeslogic-fontconfig-sys" version = "6.0.1" @@ -6513,6 +7087,12 @@ dependencies = [ "synstructure 0.14.0", ] +[[package]] +name = "zeno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524" + [[package]] name = "zerocopy" version = "0.8.63" diff --git a/apps/leaf-dioxus-tui/Cargo.toml b/apps/leaf-dioxus-tui/Cargo.toml index 5bc405e2..bcfe93ca 100644 --- a/apps/leaf-dioxus-tui/Cargo.toml +++ b/apps/leaf-dioxus-tui/Cargo.toml @@ -35,7 +35,14 @@ dioxus-core = "=0.8.0-alpha.3" blitz-dom = { version = "=0.3.0-beta.4", default-features = false } blitz-traits = "=0.3.0-beta.4" parley = "=0.12.0" +# The terminal: ratatui's cell buffer and its diff, on crossterm — the +# versions leaf-tui uses, which ratatui-image 9 is built for. crossterm = "0.28" +ratatui = "0.29" +# Pictures, formulas and diagrams through kitty, iTerm2 or sixel, or +# half-blocks; decoded and rasterised by leaf-raster, as leaf-tui does. +ratatui-image = { version = "9", default-features = false, features = ["crossterm"] } +leaf-raster = { path = "../../crates/leaf-raster" } raw-window-handle = "0.6" anyhow = "1" libc = "0.2" diff --git a/apps/leaf-dioxus-tui/src/main.rs b/apps/leaf-dioxus-tui/src/main.rs index 42406508..91ca2387 100644 --- a/apps/leaf-dioxus-tui/src/main.rs +++ b/apps/leaf-dioxus-tui/src/main.rs @@ -15,6 +15,7 @@ //! sees ⌘), so ⌃S saves, ⌃B is bold, ⌃Z undoes. mod paint; +mod pictures; mod term; mod window; @@ -34,7 +35,9 @@ use dioxus_core::{ScopeId, VirtualDom}; use dioxus_native::DioxusDocument; use dioxus_native::winit::window::Window; use leaf_core::Doc; -use leaf_dioxus::{Appearance, Editor, Host, Look, Request, Status, Type, use_shared_editor}; +use leaf_dioxus::{ + Appearance, Editor, Host, Look, Request, Status, Type, trace, use_shared_editor, +}; use crate::paint::Metrics; use crate::window::TermWindow; @@ -329,9 +332,9 @@ fn run(s: &mut Session, out: &mut term::Terminal) -> Result<()> { if acted || s.window.take_dirty() { let t1 = std::time::Instant::now(); let next = s.paint(); - leaf_dioxus::trace(|| format!("frame: settle {:.1?} paint {:.1?}", t1 - t0, t1.elapsed())); + trace(|| format!("frame: settle {:.1?} paint {:.1?}", t1 - t0, t1.elapsed())); if next != grid { - out.draw_diff(&grid, &next)?; + out.draw(&next)?; grid = next; } } @@ -409,4 +412,21 @@ mod tests { std::fs::remove_dir_all(&dir).ok(); assert!(f.lines().any(|l| l.trim() == "Hi ▏Text."), "{f}"); } + + #[test] + fn a_picture_is_recorded_and_the_status_line_covers_its_last_row() { + let png = concat!(env!("CARGO_MANIFEST_DIR"), "/../../leaf-gpui.png"); + let (dir, path) = scratch(&format!("Top.\n\n![shot]({png})\n")); + let s = Session::new(path, 80, 12).unwrap(); + let g = s.paint(); + std::fs::remove_dir_all(&dir).ok(); + let [p] = &g.pictures[..] else { + panic!("one picture: {:?}", g.pictures) + }; + assert!(p.src.starts_with("file://"), "{p:?}"); + // Taller than the screen: shown from its top down to the status + // line, the last row. + assert!(p.row + p.rows as i32 > 12, "{p:?}"); + assert_eq!(p.shown, (p.row, 11), "{p:?}"); + } } diff --git a/apps/leaf-dioxus-tui/src/paint.rs b/apps/leaf-dioxus-tui/src/paint.rs index b2301daa..e06c02ea 100644 --- a/apps/leaf-dioxus-tui/src/paint.rs +++ b/apps/leaf-dioxus-tui/src/paint.rs @@ -64,6 +64,22 @@ pub struct Grid { pub cells: Vec, /// Where the caret is, if it is on screen. pub cursor: Option<(u16, u16)>, + /// The pictures, formulas and diagrams, for `pictures.rs` to paint over + /// the frames drawn for them. + pub pictures: Vec, +} + +/// An `img`'s box in cells. Its whole box, which may run off the screen, +/// and the rows of it in view, which a box drawn later may have covered. +#[derive(Clone, Debug, PartialEq)] +pub struct Picture { + pub src: String, + pub col: i32, + pub row: i32, + pub cols: u16, + pub rows: u16, + /// The rows in view, `top..bottom`; empty when none is. + pub shown: (i32, i32), } impl Grid { @@ -73,6 +89,7 @@ impl Grid { rows, cells: vec![Cell::blank(fg, bg); cols as usize * rows as usize], cursor: None, + pictures: Vec::new(), } } @@ -323,9 +340,17 @@ impl Painter<'_> { .is_element_with_tag_name(&blitz_dom::local_name!("img")) { let src = node.attr(blitz_dom::local_name!("src")).unwrap_or(""); - let name = src.rsplit('/').next().unwrap_or(src); + // A file by its name; a formula or diagram (an SVG `data:` URL) + // by its alt text, if it has one. + let name = match src.strip_prefix("data:") { + Some(_) => node + .attr(blitz_dom::local_name!("alt")) + .unwrap_or("picture"), + None => src.rsplit('/').next().unwrap_or(src), + }; let fg = rgb(&styles.clone_color()).0; self.frame(bbox, clip, fg, &format!("🖼 {name}")); + self.picture(src, bbox, clip); } let ov = styles.get_box(); @@ -387,6 +412,27 @@ impl Painter<'_> { } } + /// Record an `img` at `b`, drawn to cells as [`Self::frame`] does. + fn picture(&mut self, src: &str, b: Rect, clip: Rect) { + let m = self.m; + let col = (b.x0 / m.cw).round() as i32; + let row = (b.y0 / m.ch).round() as i32; + let cols = ((b.x1 / m.cw).round() as i32 - col).max(1); + let rows = ((b.y1 / m.ch).round() as i32 - row).max(1); + let top = row.max((clip.y0 / m.ch).round() as i32).max(0); + let bottom = (row + rows) + .min((clip.y1 / m.ch).round() as i32) + .min(self.grid.rows as i32); + self.grid.pictures.push(Picture { + src: src.to_string(), + col, + row, + cols: cols as u16, + rows: rows as u16, + shown: (top, bottom.max(top)), + }); + } + /// A placeholder for what cells cannot show: a box drawn round `b`, /// `label` on its top edge. fn frame(&mut self, b: Rect, clip: Rect, fg: Rgb, label: &str) { @@ -453,6 +499,21 @@ impl Painter<'_> { let c1 = (area.x1 / m.cw - 0.5).ceil() as i32; let r0 = (area.y0 / m.ch - 0.5).ceil() as i32; let r1 = (area.y1 / m.ch - 0.5).ceil() as i32; + // An opaque box across a picture's whole width covers the rows of + // it that it spans: the status line over a picture at the bottom. + if a > 0.5 && r0 < r1 { + for p in &mut self.grid.pictures { + if c0 > p.col || c1 < p.col + p.cols as i32 { + continue; + } + let (top, bottom) = p.shown; + if r0 <= top && r1 > top { + p.shown.0 = r1.min(bottom); + } else if r0 < bottom && r1 >= bottom { + p.shown.1 = r0.max(top); + } + } + } for r in r0..r1 { for col in c0..c1 { if a > 0.5 && self.grid.cursor == Some((col as u16, r as u16)) { diff --git a/apps/leaf-dioxus-tui/src/pictures.rs b/apps/leaf-dioxus-tui/src/pictures.rs new file mode 100644 index 00000000..c017cd65 --- /dev/null +++ b/apps/leaf-dioxus-tui/src/pictures.rs @@ -0,0 +1,162 @@ +//! Pictures, formulas and diagrams, painted with the terminal's graphics +//! protocol over the cells of the box Blitz laid out for them. +//! +//! The painter finds each `img` and records its box in cells +//! ([`crate::paint::Picture`]); it has already drawn a labelled frame there, +//! which stays when the picture cannot be read. Here each source is decoded +//! once — a `file://` URL through leaf-raster, as leaf-tui reads a picture, +//! and a `data:image/svg+xml` URL (a formula or a diagram, which leaf-dioxus +//! typesets to SVG) rasterised — and handed to ratatui-image, which speaks +//! kitty, iTerm2 or sixel where the terminal does and half-blocks where it +//! does not. +//! +//! A picture partly scrolled off the screen is cropped to its rows in view, +//! so it scrolls with the text instead of jumping whole to stay inside it. + +use std::collections::HashMap; +use std::path::PathBuf; + +use leaf_raster::image::DynamicImage; +use ratatui::Frame; +use ratatui::layout::Rect; +use ratatui::widgets::Clear; +use ratatui_image::picker::{Picker, ProtocolType}; +use ratatui_image::protocol::StatefulProtocol; +use ratatui_image::{Resize, StatefulImage}; + +use crate::paint::{Grid, Picture}; + +/// How many encoded crops to keep before starting again: each scroll step of +/// a partly visible picture is a new crop. +const PROTOCOLS_MAX: usize = 64; + +/// How many pixels an SVG is drawn at per CSS pixel: a terminal's cell is +/// about twice the size of the cell the editor measures in. +const SVG_SCALE: f32 = 2.0; + +pub struct Pictures { + picker: Picker, + /// Each source, decoded, or `None` when it would not decode. + decoded: HashMap>, + /// Each crop of a source, encoded for the terminal: keyed by the source, + /// the first row in view and how many rows are. + encoded: HashMap<(String, u16, u16), StatefulProtocol>, +} + +impl Pictures { + /// Half-blocks until [`Pictures::query`] has asked the terminal. + pub fn new() -> Self { + Self { + picker: Picker::halfblocks(), + decoded: HashMap::new(), + encoded: HashMap::new(), + } + } + + /// Ask the terminal what it can draw. In raw mode: the answers are + /// escape sequences on stdin. + pub fn query(&mut self) { + if let Ok(picker) = Picker::from_query_stdio() { + self.picker = picker; + } + } + + pub fn protocol(&self) -> ProtocolType { + self.picker.protocol_type() + } + + /// Paint every picture in `grid` that decodes over its cells. + pub fn paint(&mut self, f: &mut Frame, grid: &Grid) { + if self.encoded.len() > PROTOCOLS_MAX { + self.encoded.clear(); + } + for p in &grid.pictures { + self.paint_one(f, grid, p); + } + } + + fn paint_one(&mut self, f: &mut Frame, grid: &Grid, p: &Picture) { + let (top, bottom) = p.shown; + let (left, right) = (p.col.max(0), (p.col + p.cols as i32).min(grid.cols as i32)); + if top >= bottom || left >= right { + return; + } + let Some(img) = self + .decoded + .entry(p.src.clone()) + .or_insert_with(|| decode(&p.src)) + .as_ref() + else { + return; + }; + let skip = (top - p.row) as u16; + let shown = (bottom - top) as u16; + let key = (p.src.clone(), skip, shown); + let picker = &self.picker; + let proto = self.encoded.entry(key).or_insert_with(|| { + let img = if shown == p.rows { + img.clone() + } else { + let h = img.height() as f32; + let y0 = (h * skip as f32 / p.rows as f32).round() as u32; + let y1 = (h * (skip + shown) as f32 / p.rows as f32).round() as u32; + img.crop_imm(0, y0, img.width(), (y1 - y0).max(1)) + }; + picker.new_resize_protocol(img) + }); + let rect = Rect::new(left as u16, top as u16, (right - left) as u16, shown); + f.render_widget(Clear, rect); + f.render_stateful_widget(StatefulImage::new().resize(Resize::Fit(None)), rect, proto); + } +} + +/// A picture's source as pixels: a `file://` URL, or an SVG `data:` URL. +fn decode(src: &str) -> Option { + if let Some(path) = src.strip_prefix("file://") { + let path = PathBuf::from(percent_decode(path)?); + return leaf_raster::load_image(&path); + } + if let Some(rest) = src.strip_prefix("data:image/svg+xml") { + let (_, body) = rest.split_once(',')?; + let svg = percent_decode(body)?; + return leaf_raster::rasterize_svg(svg.as_bytes(), SVG_SCALE); + } + None +} + +/// `%XX` escapes back to bytes, read as UTF-8. +fn percent_decode(s: &str) -> Option { + let b = s.as_bytes(); + let mut out = Vec::with_capacity(b.len()); + let mut i = 0; + while i < b.len() { + if b[i] == b'%' && i + 2 < b.len() { + let hex = std::str::from_utf8(&b[i + 1..i + 3]).ok()?; + out.push(u8::from_str_radix(hex, 16).ok()?); + i += 3; + } else { + out.push(b[i]); + i += 1; + } + } + String::from_utf8(out).ok() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn escapes_decode_and_the_rest_stays() { + assert_eq!(percent_decode("a%20b%3Cc").as_deref(), Some("a b bool { } pub struct Terminal { - out: Stdout, + term: ratatui::Terminal>, + pictures: Pictures, } impl Terminal { @@ -41,16 +42,22 @@ impl Terminal { terminal::EnterAlternateScreen, EnableMouseCapture, EnableBracketedPaste, - terminal::Clear(terminal::ClearType::All) + cursor::SetCursorStyle::SteadyBar, )?; - Ok(Self { out }) + let mut pictures = Pictures::new(); + pictures.query(); + crate::trace(|| format!("graphics: {:?}", pictures.protocol())); + let mut term = ratatui::Terminal::new(CrosstermBackend::new(out))?; + term.clear()?; + Ok(Self { term, pictures }) } pub fn leave(&mut self) -> Result<()> { execute!( - self.out, + self.term.backend_mut(), DisableBracketedPaste, DisableMouseCapture, + cursor::SetCursorStyle::DefaultUserShape, cursor::Show, terminal::LeaveAlternateScreen )?; @@ -58,78 +65,44 @@ impl Terminal { Ok(()) } + /// Draw `g`: its cells, then its pictures over them. ratatui writes only + /// the cells that changed since the last frame. pub fn draw(&mut self, g: &Grid) -> Result<()> { - queue!(self.out, cursor::Hide)?; - for r in 0..g.rows { - queue!(self.out, cursor::MoveTo(0, r))?; - for c in 0..g.cols { - self.cell(g.get(c, r))?; - } - } - self.finish(g) - } - - pub fn draw_diff(&mut self, old: &Grid, new: &Grid) -> Result<()> { - if old.cols != new.cols || old.rows != new.rows { - return self.draw(new); - } - queue!(self.out, cursor::Hide)?; - for r in 0..new.rows { - let mut at = None; - for c in 0..new.cols { - let cell = new.get(c, r); - if cell == old.get(c, r) { - at = None; - continue; - } - if at != Some(c) { - queue!(self.out, cursor::MoveTo(c, r))?; + let pictures = &mut self.pictures; + self.term.draw(|f| { + let area = f.area(); + let buf = f.buffer_mut(); + for r in 0..g.rows.min(area.height) { + for c in 0..g.cols.min(area.width) { + let cell = g.get(c, r); + let out = &mut buf[(c, r)]; + // The second half of a wide character: its first half + // drew it, and ratatui skips this cell. + out.set_symbol(if cell.text.is_empty() { + " " + } else { + &cell.text + }); + out.set_fg(rgb(cell.fg)); + out.set_bg(rgb(cell.bg)); + let mut m = Modifier::empty(); + m.set(Modifier::BOLD, cell.bold); + m.set(Modifier::ITALIC, cell.italic); + m.set(Modifier::UNDERLINED, cell.underline); + out.modifier = m; } - self.cell(cell)?; - at = Some(c + 1); } - } - self.finish(new) - } - - fn cell(&mut self, cell: &Cell) -> Result<()> { - // The second half of a wide character: its first half drew it. - if cell.text.is_empty() { - return Ok(()); - } - let rgb = |(r, g, b): (u8, u8, u8)| Color::Rgb { r, g, b }; - queue!( - self.out, - SetAttribute(Attribute::Reset), - SetForegroundColor(rgb(cell.fg)), - SetBackgroundColor(rgb(cell.bg)), - )?; - if cell.bold { - queue!(self.out, SetAttribute(Attribute::Bold))?; - } - if cell.italic { - queue!(self.out, SetAttribute(Attribute::Italic))?; - } - if cell.underline { - queue!(self.out, SetAttribute(Attribute::Underlined))?; - } - queue!(self.out, Print(&cell.text))?; + pictures.paint(f, g); + if let Some((c, r)) = g.cursor { + f.set_cursor_position((c, r)); + } + })?; Ok(()) } +} - fn finish(&mut self, g: &Grid) -> Result<()> { - queue!(self.out, SetAttribute(Attribute::Reset))?; - if let Some((c, r)) = g.cursor { - queue!( - self.out, - cursor::MoveTo(c, r), - cursor::SetCursorStyle::SteadyBar, - cursor::Show - )?; - } - self.out.flush()?; - Ok(()) - } +fn rgb((r, g, b): (u8, u8, u8)) -> Color { + Color::Rgb(r, g, b) } pub fn is_quit(k: &KeyEvent) -> bool { From b8930633d44927023e5305a491d68515ec94fba9 Mon Sep 17 00:00:00 2001 From: Adam Harris Date: Wed, 21 Oct 2026 15:45:52 -0600 Subject: [PATCH 03/13] feat(dioxus): a Type can set every run at the body size, for a host on a grid Type::uniform, off by default, sets headings and super- and subscripts at the body size in every view, as the source view already does: the editor's parley layout and the stylesheet agree, a heading bold but no larger. A terminal host needs it, where text larger than a cell cannot be drawn and a click must land on the character drawn under it. Type gains a field, so a Type written out field by field needs it added (the Mac app's Settings::ty does, with `uniform: false`). --- apps/leaf-dioxus/src/settings.rs | 1 + crates/leaf-dioxus/src/text.rs | 29 ++++++++++++++++++++++++++++- crates/leaf-dioxus/src/view.rs | 8 ++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/apps/leaf-dioxus/src/settings.rs b/apps/leaf-dioxus/src/settings.rs index 34311ecd..562072ac 100644 --- a/apps/leaf-dioxus/src/settings.rs +++ b/apps/leaf-dioxus/src/settings.rs @@ -201,6 +201,7 @@ impl Settings { mono: family(MONO_FACES, &self.mono, "monospace"), size: self.size.px() * zoom, leading: self.spacing.ratio(), + uniform: false, } } diff --git a/crates/leaf-dioxus/src/text.rs b/crates/leaf-dioxus/src/text.rs index f8e9363c..58fe88c1 100644 --- a/crates/leaf-dioxus/src/text.rs +++ b/crates/leaf-dioxus/src/text.rs @@ -46,6 +46,11 @@ pub struct Type { pub size: f32, /// The line box over the size: CSS's unitless `line-height`. pub leading: f32, + /// Every run at the body size, in every view: a heading bold but no + /// larger, a superscript on the line — what the source view always does. + /// For a host whose surface is a grid, a terminal's, where text larger + /// than a cell cannot be drawn and a click must land where it is drawn. + pub uniform: bool, } impl Default for Type { @@ -56,6 +61,7 @@ impl Default for Type { mono: "Menlo, monospace".into(), size: 16.0, leading: 1.5, + uniform: false, } } } @@ -248,7 +254,7 @@ impl Fonts { ty.leading, ))); for (r, range) in runs.iter().zip(&ranges) { - for property in style_of(&r.class, kind == Kind::Source, ty) { + for property in style_of(&r.class, kind == Kind::Source || ty.uniform, ty) { b.push(property, range.clone()); } // An inline formula: its atom glyph takes no room, and its @@ -333,6 +339,9 @@ fn style_of(class: &str, uniform: bool, ty: &Type) -> Vec f32 { let mut size = ty.size; + if ty.uniform { + return size; + } for c in class.split(' ') { size = match c { "h1" => ty.size * 2.0, @@ -625,6 +634,24 @@ mod tests { ); } + #[test] + fn a_uniform_type_sets_a_heading_at_the_body_size() { + let ty = Type { + uniform: true, + ..Type::default() + }; + let mut f = Fonts::new(ty.clone()); + let heading = f.layout(&row(vec![run("Title", "g h1 b")]), 600.0, Kind::Prose); + let body = f.layout(&row(vec![run("Title", "g b")]), 600.0, Kind::Prose); + assert!( + (heading.height - ty.line()).abs() < 0.5, + "{}", + heading.height + ); + assert_eq!(heading.height, body.height); + assert!(crate::view::css(&ty).contains(".leaf .h1, .leaf .h2")); + } + #[test] fn a_family_emoji_is_one_two_column_character() { let family = "👨‍👩‍👧"; diff --git a/crates/leaf-dioxus/src/view.rs b/crates/leaf-dioxus/src/view.rs index 7e69addb..41a04cae 100644 --- a/crates/leaf-dioxus/src/view.rs +++ b/crates/leaf-dioxus/src/view.rs @@ -53,6 +53,7 @@ pub fn css(ty: &Type) -> String { mono, size, leading, + uniform, } = ty; let quote = ty.quote_indent(); let mut css = format!( @@ -79,6 +80,12 @@ body {{ position: relative; }} .leaf .tcell.end {{ text-align: right; }} {CHROME}{REST}" ); + // Every run at the body size, as `text.rs` measures them (`Type::uniform`). + if *uniform { + css.push_str( + ".leaf .h1, .leaf .h2, .leaf .h3, .leaf .sup, .leaf .sub { font-size: 1em; vertical-align: baseline; }", + ); + } if std::env::var_os("LEAF_OUTLINE").is_some() { css.push_str(".leaf .line { outline: 1px solid #f00; } .leaf .line > span { outline: 1px solid #0a0; }"); } @@ -379,6 +386,7 @@ mod tests { mono: "Monaco, monospace".into(), size: 19.0, leading: 1.75, + uniform: false, }; let css = css(&ty); assert!( From d25fb6cbae401d96e00afc16b03c4a6a4450fb32 Mon Sep 17 00:00:00 2001 From: Adam Harris Date: Wed, 21 Oct 2026 15:45:58 -0600 Subject: [PATCH 04/13] feat(dioxus-tui): unit's menus and dialogs, the file watch, and leaf-tui's flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The page is under unit's root in its new cell density, as the Mac app's is under its root, and every key reaches unit first. From one command table: the command menu (⌃P or F10), each item showing its keys, and the context menu on a right-click. The Link and Save As prompts are unit dialogs; quitting with unsaved changes and a save over a file changed on disk ask through unit's action sheet, answered from the keyboard. A clean document reloads an outside write once the file stands still, as leaf-tui's does. -r reads only and -w N sets the column, and the terminal is asked whether it is light or dark. The painter draws borders over a box's children, with corners, and a horizontal side only in a row it owns that nothing is written in; a thin filled box is a rule. Clicks are shifted as the text's start is rounded, and every run is at the body size (Type::uniform), so a click lands on the character drawn under it. The loop repaints after a timer changes the page, and follows the terminal's size every turn. --- apps/leaf-dioxus-tui/Cargo.lock | 42 +++ apps/leaf-dioxus-tui/Cargo.toml | 5 + apps/leaf-dioxus-tui/README.md | 45 ++- apps/leaf-dioxus-tui/src/chrome.rs | 198 +++++++++++++ apps/leaf-dioxus-tui/src/commands.rs | 186 +++++++++++++ apps/leaf-dioxus-tui/src/files.rs | 198 +++++++++++++ apps/leaf-dioxus-tui/src/main.rs | 402 ++++++++++++++++++++++++--- apps/leaf-dioxus-tui/src/paint.rs | 116 +++++--- apps/leaf-dioxus-tui/src/term.rs | 82 ++++-- 9 files changed, 1171 insertions(+), 103 deletions(-) create mode 100644 apps/leaf-dioxus-tui/src/chrome.rs create mode 100644 apps/leaf-dioxus-tui/src/commands.rs create mode 100644 apps/leaf-dioxus-tui/src/files.rs diff --git a/apps/leaf-dioxus-tui/Cargo.lock b/apps/leaf-dioxus-tui/Cargo.lock index 945354ad..6ba74c15 100644 --- a/apps/leaf-dioxus-tui/Cargo.lock +++ b/apps/leaf-dioxus-tui/Cargo.lock @@ -2574,9 +2574,11 @@ dependencies = [ "raw-window-handle", "stylo", "taffy", + "terminal-colorsaurus", "tokio", "unicode-segmentation", "unicode-width 0.2.0", + "unit", ] [[package]] @@ -4991,6 +4993,32 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal-colorsaurus" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a46bb5364467da040298c573c8a95dbf9a512efc039630409a03126e3703e90" +dependencies = [ + "cfg-if", + "libc", + "memchr", + "mio", + "terminal-trx", + "windows-sys 0.61.2", + "xterm-color", +] + +[[package]] +name = "terminal-trx" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3f27d9a8a177e57545481faec87acb45c6e854ed1e5a3658ad186c106f38ed" +dependencies = [ + "cfg-if", + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "thin-vec" version = "0.2.21" @@ -5527,6 +5555,14 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "unit" +version = "0.0.0" +source = "git+https://github.com/diaryx-org/unit?branch=dioxus-tui#e8ff6d2a1bee4616c686dfbb29eb682f017f665a" +dependencies = [ + "dioxus", +] + [[package]] name = "url" version = "2.5.8" @@ -7041,6 +7077,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" +[[package]] +name = "xterm-color" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7008a9d8ba97a7e47d9b2df63fcdb8dade303010c5a7cd5bf2469d4da6eba673" + [[package]] name = "xxhash-rust" version = "0.8.19" diff --git a/apps/leaf-dioxus-tui/Cargo.toml b/apps/leaf-dioxus-tui/Cargo.toml index bcfe93ca..a03e1f53 100644 --- a/apps/leaf-dioxus-tui/Cargo.toml +++ b/apps/leaf-dioxus-tui/Cargo.toml @@ -43,6 +43,11 @@ ratatui = "0.29" # half-blocks; decoded and rasterised by leaf-raster, as leaf-tui does. ratatui-image = { version = "9", default-features = false, features = ["crossterm"] } leaf-raster = { path = "../../crates/leaf-raster" } +# The menus and dialogs round the editor, as the Mac app draws them. On its +# `dioxus-tui` branch, which adds the cell density, until that merges. +# "Is this terminal dark or light?", asked as leaf-tui asks it. +terminal-colorsaurus = "1" +unit = { git = "https://github.com/diaryx-org/unit", branch = "dioxus-tui" } raw-window-handle = "0.6" anyhow = "1" libc = "0.2" diff --git a/apps/leaf-dioxus-tui/README.md b/apps/leaf-dioxus-tui/README.md index 849b3236..5de7c48a 100644 --- a/apps/leaf-dioxus-tui/README.md +++ b/apps/leaf-dioxus-tui/README.md @@ -1,19 +1,29 @@ # leaf-dioxus-tui A prototype: the leaf-dioxus editor (`crates/leaf-dioxus`), the component the -Mac app draws, drawn in a terminal. Blitz builds the DOM, resolves the styles -and lays the page out as it does for a window; `src/paint.rs` walks the laid-out -tree and writes character cells where blitz-paint would draw pixels. +Mac app draws, drawn in a terminal, with unit's menus and dialogs round it as +the Mac app has them. Blitz builds the DOM, resolves the styles and lays the +page out as it does for a window; `src/paint.rs` walks the laid-out tree and +writes character cells where blitz-paint would draw pixels. ```sh cargo run --manifest-path apps/leaf-dioxus-tui/Cargo.toml -- document.md +cargo run --manifest-path apps/leaf-dioxus-tui/Cargo.toml -- -r -w 60 document.md # read-only, a 60-character column cargo run --manifest-path apps/leaf-dioxus-tui/Cargo.toml -- --dump document.md # one 80×24 frame as text cargo run --manifest-path apps/leaf-dioxus-tui/Cargo.toml -- --dump-html document.md # the same, in its colours ``` -⌃Q quits. On macOS the editor's ⌘ shortcuts are ⌃ here: ⌃S saves, ⌃B is bold. -`LEAF_THEME=light` for a light terminal. `LEAF_TRACE=1 LEAF_DTUI_LOG=` logs -keys and frame timings to the file. +- ⌃P or F10 opens the command menu, which lists every command with its keys. + A right-click opens the context menu. +- ⌃Q quits, and asks first when there are unsaved changes. +- On macOS the editor's ⌘ shortcuts are ⌃ here (a terminal never sees ⌘): ⌃S + saves, ⌃B is bold, ⌃Z undoes. ⌃K stays the editor's delete to the end of + the line. +- `-w N` sets the column to N characters, 0 to the terminal's width; the + default is 80, as leaf-tui's. +- The terminal is asked whether it is light or dark; `LEAF_THEME=light|dark` + overrides the answer. +- `LEAF_TRACE=1 LEAF_DTUI_LOG=` logs keys and frame timings to the file. The case for it, what it does and does not do yet, and what replacing leaf-tui would take: [the proposal](../../docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md). @@ -23,11 +33,20 @@ would take: [the proposal](../../docs/proposals/the-leaf-dioxus-editor-in-a-term - `window.rs`: a winit `Window` that is the terminal, as `apps/leaf-dioxus`'s `offscreen.rs` is a sheet. The editor asks it for size, scale and theme. - `main.rs`: the document is `DioxusDocument::new` with no window, as - `apps/leaf-dioxus/src/headless.rs` builds one for tests. Keys go to - `Editor::key`; clicks go to Blitz as pointer events; the wheel goes to - `Editor::scroll`. Each turn is a poll and a `resolve`, then a paint. + `apps/leaf-dioxus/src/headless.rs` builds one for tests. Every key goes to + unit first, then to the command menu and Quit, then to `Editor::key`; the + mouse goes to Blitz as pointer events, the wheel to `Editor::scroll`. Each + turn is a poll and a `resolve`, then a paint. - `paint.rs`: the cell painter. A cell is one advance of a monospace face - (Menlo, 16px) wide and one line (1.5 leading, 24px) high, so the editor's own - parley layout counts in cells without knowing it. Each line's clusters take - consecutive cells, so text set larger than a cell still reads. -- `term.rs`: crossterm. A frame is written as the cells that changed. + (Menlo, 16px) wide and one line (1.5 leading, 24px) high, and the editor's + `Type::uniform` sets every run at that size, so the editor's own parley + layout counts in cells without knowing it. +- `pictures.rs`: pictures, formulas and diagrams through the terminal's + graphics protocol (ratatui-image), over the cells of their boxes. +- `chrome.rs` and `commands.rs`: unit's root in its cell density + (`Density::Cell`), the context menu, the command menu built from one + command table, the Link prompt, and the question before quitting. +- `files.rs`: Save and Save As, the question before a save writes over a + file changed on disk, and the watch that reloads a clean document — leaf-tui's + rules, over the same leaf-core calls. +- `term.rs`: crossterm and ratatui. A frame is written as the cells that changed. diff --git a/apps/leaf-dioxus-tui/src/chrome.rs b/apps/leaf-dioxus-tui/src/chrome.rs new file mode 100644 index 00000000..557c608b --- /dev/null +++ b/apps/leaf-dioxus-tui/src/chrome.rs @@ -0,0 +1,198 @@ +//! Everything round the editor, drawn by unit in the page's overlay as the +//! Mac app's are: the context menu, the command menu, the Link prompt, and +//! the question before quitting with unsaved changes. +//! +//! unit's root is in its cell density (`Density::Cell`): every row of a menu +//! or a dialog is one cell high, set in the editor's monospace face. Its +//! choices are queued ([`take`]) and carried out by the main loop, never +//! inside the event that made them — a click on a menu item arrives while +//! Blitz is dispatching, and an editor command then would be a re-entry. + +use std::cell::{Cell, RefCell}; +use std::rc::Rc; + +use leaf_dioxus::{Context, Editor, Footnote, Host, Request}; +use unit::{ActionSheet, Answer, Dialog, Entry, Item, SheetAction, Unit}; + +use crate::commands::{self, Command}; + +/// What a choice asks of the main loop. +#[derive(Clone, Debug, PartialEq)] +pub enum Pending { + Command(Command), + /// Save, asking where or whether first if it must (`files.rs`). + Save, + SaveTo(std::path::PathBuf), + /// Write over the file that changed on disk. + Overwrite, + /// Take the file that changed on disk, losing the edits. + Reload, + FollowFootnote, + OpenLink, + CopyLink, + InsertLink(String), + SaveAndQuit, + QuitNow, +} + +thread_local! { + static UNIT: Cell> = const { Cell::new(None) }; + static QUEUE: RefCell> = const { RefCell::new(Vec::new()) }; + /// Where the pointer last pressed, in CSS pixels: where a context menu + /// opens. + static POINTER: Cell<(f64, f64)> = const { Cell::new((16.0, 24.0)) }; +} + +pub fn set_unit(unit: Unit) { + UNIT.set(Some(unit)); +} + +pub fn unit() -> Option { + UNIT.get() +} + +pub fn set_pointer(at: (f64, f64)) { + POINTER.set(at); +} + +pub fn queue(p: Pending) { + QUEUE.with_borrow_mut(|q| q.push(p)); +} + +/// What has been chosen since the last call. +pub fn take() -> Vec { + QUEUE.with_borrow_mut(std::mem::take) +} + +/// The terminal's host: Save, opening a link, and the context menu. +pub struct TermHost; + +impl Host for TermHost { + /// Save and Save As go by way of the main loop, which may have to ask + /// first (`files.rs`). + fn request(&self, _ed: &Editor, request: Request) { + match request { + Request::Save => queue(Pending::Save), + Request::SaveAs => queue(Pending::Command(Command::SaveAs)), + _ => {} + } + } + + /// A URL to the system's opener, detached from the terminal. + fn open(&self, what: &str) { + let opener = if cfg!(target_os = "macos") { + "open" + } else { + "xdg-open" + }; + let _ = std::process::Command::new(opener) + .arg(what) + .stdin(std::process::Stdio::null()) + .stdout(std::process::Stdio::null()) + .stderr(std::process::Stdio::null()) + .spawn(); + } + + fn context_menu(&self, cx: &Context) { + let Some(unit) = unit() else { return }; + // The menu's lines, `None` a separator, then its entries. + let mut lines: Vec, Pending)>> = Vec::new(); + match cx.footnote { + Some(Footnote::GoToNote) => { + lines.push(Some(("Go to Note", None, Pending::FollowFootnote))) + } + Some(Footnote::BackToReference) => { + lines.push(Some(("Back to Reference", None, Pending::FollowFootnote))) + } + None => {} + } + if cx.link { + lines.push(Some(("Open Link", None, Pending::OpenLink))); + lines.push(Some(("Edit Link…", None, Pending::Command(Command::Link)))); + lines.push(Some(("Copy Link", None, Pending::CopyLink))); + } + if !lines.is_empty() { + lines.push(None); + } + let edit = commands::table() + .into_iter() + .find(|(t, _)| *t == "Edit") + .map(|(_, l)| l) + .unwrap_or_default(); + for (label, keys, c) in edit.into_iter().flatten() { + let wanted = match label { + "Cut" | "Copy" => cx.selection, + "Paste" | "Paste as Plain Text" | "Select All" => true, + _ => false, + }; + if wanted { + lines.push(Some((label, keys, Pending::Command(c)))); + } + } + let mut picks = Vec::new(); + let entries: Vec = lines + .into_iter() + .map(|l| match l { + None => Entry::Separator, + Some((label, keys, p)) => { + picks.push(p); + let i = Item::new(picks.len() - 1, label); + match keys { + Some(k) => i.shortcut(k).into(), + None => i.into(), + } + } + }) + .collect(); + let picks = Rc::new(picks); + let at = POINTER.get(); + unit.open_menu(entries, at, 0.0, move |i| { + if let Some(p) = picks.get(i) { + queue(p.clone()); + } + }); + } +} + +/// The command menu, at the top left, its first item highlighted: it was +/// opened by a key, and the arrows go on from there. +pub fn command_menu(unit: &Unit) { + let (entries, commands) = commands::menu(); + unit.open_menu(entries, (0.0, 0.0), 0.0, move |i| { + if let Some(c) = commands.get(i) { + queue(Pending::Command(c.clone())); + } + }); + unit.hot_first(); +} + +/// Ask for a link's destination, seeded with the link at the caret. +pub fn prompt_link(unit: &Unit, current: String) { + let dialog = Dialog::new("Link") + .message("The address the selected text links to.") + .field(current, "https://") + .buttons("OK", "Cancel"); + unit.open_dialog(dialog, |answer| { + if let Answer::Ok(dest) = answer + && !dest.trim().is_empty() + { + queue(Pending::InsertLink(dest.trim().to_string())); + } + }); +} + +/// Save, don't save, or stay: asked before quitting with unsaved changes. +pub fn confirm_quit(unit: &Unit, name: &str) { + let sheet = ActionSheet::new(vec![ + SheetAction::new(0, "Save"), + SheetAction::new(1, "Don't Save").destructive(), + ]) + .title(format!("Save the changes to {name}?")) + .message("Your changes are lost if you don't save them.") + .cancel("Cancel"); + unit.open_actions(sheet, |choice| match choice { + Some(0) => queue(Pending::SaveAndQuit), + Some(1) => queue(Pending::QuitNow), + _ => {} + }); +} diff --git a/apps/leaf-dioxus-tui/src/commands.rs b/apps/leaf-dioxus-tui/src/commands.rs new file mode 100644 index 00000000..5b5caf32 --- /dev/null +++ b/apps/leaf-dioxus-tui/src/commands.rs @@ -0,0 +1,186 @@ +//! What the terminal app can be asked to do, as one table: the command menu +//! (⌃P or F10) is built from it, each item showing the keys that do the same +//! thing, so the menu is the key reference too. leaf-tui's palette, menus +//! and key reference come from one table the same way. +//! +//! Most commands are the editor's own key bindings (leaf-dioxus's +//! `input.rs`), carried as the chord they stand for and replayed through +//! [`leaf_dioxus::Editor::key`] when chosen, as the Mac app's commands are: +//! a command is defined once, and no menu can disagree with the keyboard. + +use dioxus::html::{Code, Key, Modifiers, NamedKey}; +use unit::{Entry, Item}; + +use crate::term::PRIMARY; + +#[derive(Clone, Debug, PartialEq)] +pub enum Command { + /// Press this chord: an editor command, as the keyboard has it. + Chord(Key, Code, Modifiers), + /// Ask for a link's destination, and make or change the link. + Link, + /// Ask for a path, and save the document there. + SaveAs, + /// Leave, asking first if there are unsaved changes. + Quit, +} + +const SHIFT: Modifiers = Modifiers::SHIFT; +const ALT: Modifiers = Modifiers::ALT; +/// On Apple the editor's paragraph chords are ⌃ with a digit, which no +/// terminal sends: they are the menu's alone. +const CTRL: Modifiers = Modifiers::CONTROL; + +fn chord(c: &str, code: Code, mods: Modifiers) -> Command { + Command::Chord(Key::Character(c.into()), code, mods) +} + +/// The keys a terminal reader presses for `mods` and `key`: ⌃ for the +/// editor's primary modifier, which is the only one a terminal sends. +fn keys(mods: Modifiers, key: &str) -> String { + let mut s = String::new(); + if mods.contains(ALT) { + s.push('⌥'); + } + if mods.contains(SHIFT) { + s.push('⇧'); + } + if mods.contains(PRIMARY) { + s.push('⌃'); + } + s.push_str(key); + s +} + +/// One line of the table: a label, the keys shown beside it, the command. +type Line = (&'static str, Option, Command); + +fn line(label: &'static str, c: &str, code: Code, mods: Modifiers) -> Line { + let shown = (!mods.contains(CTRL) || PRIMARY == CTRL).then(|| keys(mods, &c.to_uppercase())); + (label, shown, chord(c, code, mods)) +} + +/// The table: each submenu's title and its lines, `None` a separator. +pub fn table() -> Vec<(&'static str, Vec>)> { + let p = PRIMARY; + vec![ + ( + "File", + vec![ + Some(line("Save", "s", Code::KeyS, p)), + Some(("Save As…", None, Command::SaveAs)), + None, + Some(("Quit", Some(keys(p, "Q")), Command::Quit)), + ], + ), + ( + "Edit", + vec![ + Some(line("Undo", "z", Code::KeyZ, p)), + Some(line("Redo", "z", Code::KeyZ, p | SHIFT)), + None, + Some(line("Cut", "x", Code::KeyX, p)), + Some(line("Copy", "c", Code::KeyC, p)), + Some(line("Paste", "v", Code::KeyV, p)), + Some(line("Paste as Plain Text", "v", Code::KeyV, p | SHIFT)), + Some(line("Select All", "a", Code::KeyA, p)), + None, + Some(line("Find…", "f", Code::KeyF, p)), + Some(line("Find and Replace…", "f", Code::KeyF, p | ALT)), + Some(line("Find Next", "g", Code::KeyG, p)), + Some(line("Find Previous", "g", Code::KeyG, p | SHIFT)), + ], + ), + ( + "Format", + vec![ + Some(line("Bold", "b", Code::KeyB, p)), + Some(line("Italic", "i", Code::KeyI, p)), + Some(line("Underline", "u", Code::KeyU, p)), + Some(line("Code", "c", Code::KeyC, p | SHIFT)), + Some(line("Highlight", "m", Code::KeyM, p | SHIFT)), + Some(line("Strikethrough", "x", Code::KeyX, p | SHIFT)), + None, + Some(("Link…", None, Command::Link)), + ], + ), + ( + "Paragraph", + vec![ + Some(line("Body", "0", Code::Digit0, CTRL)), + Some(line("Heading 1", "1", Code::Digit1, CTRL)), + Some(line("Heading 2", "2", Code::Digit2, CTRL)), + Some(line("Heading 3", "3", Code::Digit3, CTRL)), + Some(line("Heading 4", "4", Code::Digit4, CTRL)), + Some(line("Heading 5", "5", Code::Digit5, CTRL)), + Some(line("Heading 6", "6", Code::Digit6, CTRL)), + None, + Some(line("Code Block", "c", Code::KeyC, p | ALT)), + Some(line("Task", "l", Code::KeyL, p | SHIFT)), + Some(line("Task Done", "u", Code::KeyU, p | SHIFT)), + None, + Some(( + "Indent", + Some("Tab".into()), + Command::Chord(Key::Named(NamedKey::Tab), Code::Tab, Modifiers::empty()), + )), + Some(( + "Outdent", + Some("⇧Tab".into()), + Command::Chord(Key::Named(NamedKey::Tab), Code::Tab, SHIFT), + )), + ], + ), + ( + "View", + vec![Some(line("Source or WYSIWYG", "e", Code::KeyE, p))], + ), + ] +} + +/// The command menu, and the command each item's id stands for. +pub fn menu() -> (Vec, Vec) { + let mut commands = Vec::new(); + let entries = table() + .into_iter() + .map(|(title, lines)| { + let items = lines + .into_iter() + .map(|l| match l { + None => Entry::Separator, + Some((label, shown, c)) => { + commands.push(c); + let item = Item::new(commands.len() - 1, label); + match shown { + Some(k) => item.shortcut(k).into(), + None => item.into(), + } + } + }) + .collect(); + Entry::submenu(title, items) + }) + .collect(); + (entries, commands) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn every_item_has_its_command() { + let (entries, commands) = menu(); + assert_eq!(entries.len(), table().len()); + let lines: usize = table() + .iter() + .map(|(_, l)| l.iter().flatten().count()) + .sum(); + assert_eq!(commands.len(), lines); + } + + #[test] + fn a_shortcut_reads_as_a_terminal_types_it() { + assert_eq!(keys(PRIMARY | SHIFT, "Z"), "⇧⌃Z"); + } +} diff --git a/apps/leaf-dioxus-tui/src/files.rs b/apps/leaf-dioxus-tui/src/files.rs new file mode 100644 index 00000000..b35f1f98 --- /dev/null +++ b/apps/leaf-dioxus-tui/src/files.rs @@ -0,0 +1,198 @@ +//! The file behind the document: Save and Save As, the question before a +//! save writes over somebody else's change, and the watch that notices one. +//! +//! The rules are leaf-tui's (`apps/leaf-tui/src/main.rs`, `tick_disk` and +//! `attempt_save`), over the same leaf-core calls: +//! +//! - A **clean** document catches up with its file by itself — once the file +//! has stopped moving, so a write is never taken half done — as one undo +//! step. +//! - A **dirty** one says so once, and a save asks: Overwrite, Reload, or +//! Cancel. +//! - An untitled document's save is a Save As. + +use std::path::PathBuf; +use std::time::{Instant, SystemTime}; + +use leaf_core::{DiskState, Doc}; +use leaf_dioxus::Editor; +use unit::{ActionSheet, Answer, Dialog, SheetAction, Unit}; + +use crate::chrome::{Pending, queue}; + +/// How often the file is looked at. +pub const POLL: std::time::Duration = std::time::Duration::from_millis(500); + +/// What the watch last saw of the file. +#[derive(Default)] +pub struct Watch { + stamp: Option<(SystemTime, u64)>, + /// The file moved on the last look: wait for it to stand still. + settling: bool, + /// The file is ahead of a dirty document: said once, asked at the save. + ahead: bool, + last: Option, +} + +fn stamp(doc: &Doc) -> Option<(SystemTime, u64)> { + let meta = std::fs::metadata(&doc.path).ok()?; + Some((meta.modified().ok()?, meta.len())) +} + +impl Watch { + pub fn new(doc: &Doc) -> Self { + Self { + stamp: stamp(doc), + ..Self::default() + } + } + + /// After our own save, the file looks as we left it. + pub fn saw_save(&mut self, doc: &Doc) { + self.stamp = stamp(doc); + self.settling = false; + self.ahead = false; + } + + /// One look, if it is time for one: whether anything changed on screen. + pub fn tick(&mut self, ed: &Editor) -> bool { + if self.last.is_some_and(|at| at.elapsed() < POLL) { + return false; + } + self.last = Some(Instant::now()); + let mut doc = ed.doc(); + if doc.is_untitled() { + return false; + } + let now = stamp(&doc); + let moved = now != self.stamp; + self.stamp = now; + if !(moved || self.settling || (self.ahead && !doc.dirty)) { + return false; + } + match doc.disk_state() { + DiskState::Changed if doc.dirty => { + self.ahead = true; + self.settling = false; + if moved { + doc.status = Some("file changed on disk — saving will ask".into()); + drop(doc); + ed.refresh(); + return true; + } + false + } + DiskState::Changed if moved => { + self.settling = true; + false + } + DiskState::Changed => { + self.settling = false; + self.ahead = false; + let before = doc.revision(); + doc.reload(); + let changed = doc.revision() != before; + if changed { + doc.status = Some("reloaded from disk".into()); + } + drop(doc); + ed.refresh(); + changed + } + DiskState::Missing => { + self.ahead = false; + self.settling = false; + if moved { + doc.status = Some(format!("{} is no longer on disk", doc.file_name())); + drop(doc); + ed.refresh(); + return true; + } + false + } + _ => { + self.ahead = false; + self.settling = false; + false + } + } + } +} + +/// What a save should do now. +pub enum Save { + /// Write the file. + Write, + /// Ask where: the document has no file. + AskWhere, + /// Ask first: the file changed since leaf last read or wrote it. + AskOverwrite, + /// Refuse: the document is only to be read. + ReadOnly, +} + +pub fn plan(doc: &Doc) -> Save { + if doc.read_only() { + Save::ReadOnly + } else if doc.is_untitled() { + Save::AskWhere + } else if doc.disk_state() == DiskState::Changed { + Save::AskOverwrite + } else { + Save::Write + } +} + +/// Ask for a path to save to, seeded with the document's own. +pub fn prompt_save_as(unit: &Unit, current: String) { + let dialog = Dialog::new("Save As") + .message("The file to save the document to.") + .field(current, "notes.md") + .buttons("Save", "Cancel"); + unit.open_dialog(dialog, |answer| { + if let Answer::Ok(path) = answer + && !path.trim().is_empty() + { + queue(Pending::SaveTo(expand(path.trim()))); + } + }); +} + +/// `~` at the start of a typed path is the home directory, as in a shell. +fn expand(path: &str) -> PathBuf { + match (path.strip_prefix("~/"), std::env::var_os("HOME")) { + (Some(rest), Some(home)) => PathBuf::from(home).join(rest), + _ => PathBuf::from(path), + } +} + +/// The file changed under unsaved edits: overwrite it, take it, or neither. +/// Cancel is where the keys start: overwriting is not what a stray Return +/// should do. +pub fn confirm_overwrite(unit: &Unit, name: &str) { + let mut sheet = ActionSheet::new(vec![ + SheetAction::new(0, "Overwrite").destructive(), + SheetAction::new(1, "Reload"), + ]) + .title(format!("{name} changed on disk")) + .message("Overwrite it with your version, or reload it and lose your changes?") + .cancel("Cancel"); + sheet.hot = Some(sheet.actions.len()); + unit.open_actions(sheet, |choice| match choice { + Some(0) => queue(Pending::Overwrite), + Some(1) => queue(Pending::Reload), + _ => {} + }); +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_tilde_is_home() { + let home = std::env::var("HOME").unwrap(); + assert_eq!(expand("~/a.md"), PathBuf::from(home).join("a.md")); + assert_eq!(expand("/x/a.md"), PathBuf::from("/x/a.md")); + } +} diff --git a/apps/leaf-dioxus-tui/src/main.rs b/apps/leaf-dioxus-tui/src/main.rs index 91ca2387..3580ab2a 100644 --- a/apps/leaf-dioxus-tui/src/main.rs +++ b/apps/leaf-dioxus-tui/src/main.rs @@ -11,9 +11,17 @@ //! parley layout — wrapping, caret motion, hit-testing — counts in cells //! without knowing it. //! -//! ⌃Q quits. On macOS the editor's ⌘ shortcuts are ⌃ here (a terminal never -//! sees ⌘), so ⌃S saves, ⌃B is bold, ⌃Z undoes. +//! Round the editor is unit's root, in its cell density: the context menu, +//! the command menu and the dialogs are unit's (`chrome.rs`), as the Mac +//! app's are, and every key reaches unit before the editor. +//! +//! ⌃Q quits; ⌃P or F10 opens the command menu. On macOS the editor's ⌘ +//! shortcuts are ⌃ here (a terminal never sees ⌘), so ⌃S saves, ⌃B is bold, +//! ⌃Z undoes. +mod chrome; +mod commands; +mod files; mod paint; mod pictures; mod term; @@ -29,15 +37,17 @@ use std::time::Duration; use anyhow::{Context as _, Result}; use blitz_dom::DocumentConfig; use blitz_traits::shell::{ColorScheme, Viewport}; -use crossterm::event::{self, Event, MouseButton, MouseEventKind}; +use crossterm::event::{self, Event, MouseEventKind}; use dioxus::prelude::*; use dioxus_core::{ScopeId, VirtualDom}; use dioxus_native::DioxusDocument; use dioxus_native::winit::window::Window; use leaf_core::Doc; -use leaf_dioxus::{ - Appearance, Editor, Host, Look, Request, Status, Type, trace, use_shared_editor, -}; +use leaf_dioxus::{Appearance, Editor, Host, Look, Status, Type, trace, use_shared_editor}; +use unit::{Density, Keys, Theme, UnitRoot, use_unit}; + +use crate::chrome::{Pending, TermHost}; +use crate::commands::Command; use crate::paint::Metrics; use crate::window::TermWindow; @@ -51,27 +61,44 @@ const SIZE: f32 = 16.0; const LEADING: f32 = 1.5; /// Pixel chrome the editor sizes for a window, recut to whole cells. +/// +/// And each visual line's box reaches into the column's right padding. The +/// editor breaks the lines itself and hangs a trailing space past the +/// column, as parley does; Blitz, though, broke a quote's line between its +/// bar (an inline box) and its text when the space did not fit, `white-space: +/// pre` notwithstanding — a line of the column's exact width, which cells +/// make common, came out as two rows. The room keeps it one. const TERM_CSS: &str = " .status { font: 16px Menlo, monospace; border-top: 0; } .find { font: 16px Menlo, monospace; } +.leaf .line { margin-right: -16px; } "; -thread_local! { - static EDITOR: RefCell> = const { RefCell::new(None) }; - static DOC: RefCell>>> = const { RefCell::new(None) }; +/// What the command line asked for. +#[derive(Clone, Copy, Debug, PartialEq)] +struct Options { + read_only: bool, + /// The column's width in characters; `None` fills the terminal. + measure: Option, } -struct TermHost; - -impl Host for TermHost { - fn request(&self, ed: &Editor, request: Request) { - if let Request::Save = request { - ed.doc().save(); - ed.refresh(); +impl Default for Options { + /// leaf-tui's: an 80-character column, editable. + fn default() -> Self { + Self { + read_only: false, + measure: Some(80.0), } } } +thread_local! { + static OPTIONS: std::cell::Cell = std::cell::Cell::new(Options::default()); + static QUIT: std::cell::Cell = const { std::cell::Cell::new(false) }; + static EDITOR: RefCell> = const { RefCell::new(None) }; + static DOC: RefCell>>> = const { RefCell::new(None) }; +} + #[allow(non_snake_case)] fn App() -> Element { let doc = DOC.with_borrow(|d| d.clone().expect("a document")); @@ -84,8 +111,9 @@ fn App() -> Element { mono: FACE.into(), size: SIZE, leading: LEADING, + uniform: true, }, - measure: None, + measure: OPTIONS.get().measure, appearance: if dark { Appearance::Dark } else { @@ -99,12 +127,36 @@ fn App() -> Element { let ed = ed.clone(); move || EDITOR.with_borrow_mut(|e| *e = Some(ed)) }); + // unit in the editor's face, its page background left to the editor's. + let mut theme = Theme { + font: FACE, + heading_font: FACE, + ..Theme::default() + }; + theme.light.bg = "transparent"; + theme.dark.bg = "transparent"; + let appearance = if dark { + unit::Appearance::Dark + } else { + unit::Appearance::Light + }; rsx! { - {ed.render()} - style { {TERM_CSS} } + UnitRoot { keys: Keys::Host, density: Density::Cell, appearance, theme, + KeepUnit {} + {ed.render()} + style { {TERM_CSS} } + } } } +/// Hands the page's unit to the chrome, which gives it every key first. +#[allow(non_snake_case)] +fn KeepUnit() -> Element { + let unit = use_unit(); + use_hook(|| chrome::set_unit(unit)); + rsx! {} +} + /// One cell's size: the face's advance, and the line box. fn metrics() -> Metrics { use parley::{FontContext, LayoutContext, StyleProperty}; @@ -127,6 +179,7 @@ fn metrics() -> Metrics { struct Session { doc: DioxusDocument, window: Arc, + watch: RefCell, m: Metrics, cols: u16, rows: u16, @@ -135,8 +188,13 @@ struct Session { impl Session { fn new(path: PathBuf, cols: u16, rows: u16) -> Result { enter_runtime(); - let source = Doc::open_or_create(path.clone()) + let mut source = Doc::open_or_create(path.clone()) .with_context(|| format!("opening {}", path.display()))?; + if OPTIONS.get().read_only { + source.set_read_only(true); + source.status = Some("read-only".into()); + } + let watch = RefCell::new(files::Watch::new(&source)); DOC.with_borrow_mut(|d| *d = Some(Rc::new(RefCell::new(source)))); let m = metrics(); let (w, h) = px(m, cols, rows); @@ -147,9 +205,14 @@ impl Session { .in_scope(ScopeId::ROOT, move || provide_context(as_dyn)); doc.inner.borrow_mut().set_viewport(viewport(w, h)); doc.initial_build(); + if let Some(unit) = chrome::unit() { + doc.vdom + .in_scope(ScopeId::ROOT, || unit.set_viewport(w as f64, h as f64)); + } let mut s = Self { doc, window, + watch, m, cols, rows, @@ -158,16 +221,21 @@ impl Session { Ok(s) } - /// Poll the virtual DOM and lay the page out until it holds still. - fn settle(&mut self) { + /// Poll the virtual DOM and lay the page out until it holds still: + /// whether anything changed — a timer's work, such as the word count, + /// changes the page with no input to show for it. + fn settle(&mut self) -> bool { + let mut any = false; for _ in 0..3 { let changed = blitz_dom::Document::poll(&mut self.doc, Some(Context::from_waker(Waker::noop()))); self.doc.inner.borrow_mut().resolve(0.0); + any |= changed; if !changed { break; } } + any } fn with_editor(&self, f: impl FnOnce(&Editor)) { @@ -184,6 +252,149 @@ impl Session { self.window.resize(w, h); self.doc.inner.borrow_mut().set_viewport(viewport(w, h)); self.with_editor(|ed| ed.resize(w, h)); + self.with_unit(|u| u.set_viewport(w as f64, h as f64)); + } + + fn with_unit(&self, f: impl FnOnce(&unit::Unit) -> T) -> Option { + let unit = chrome::unit()?; + Some(self.doc.vdom.in_scope(ScopeId::ROOT, || f(&unit))) + } + + /// A key, to unit first — an open menu or dialog takes it, and a dialog's + /// field takes typed text — then the command menu and Quit, then the + /// editor. + fn key(&self, key: dioxus::html::Key, code: dioxus::html::Code, mods: dioxus::html::Modifiers) { + use dioxus::html::{Key, Modifiers, NamedKey}; + let typed = match &key { + Key::Character(t) if !mods.intersects(Modifiers::META | Modifiers::CONTROL) => { + Some(t.clone()) + } + _ => None, + }; + trace(|| format!("host key {key:?} {code:?} {mods:?}")); + let taken = self + .with_unit(|u| match &typed { + Some(t) if u.is_open() => u.text(t), + _ => u.key(&key, mods), + }) + .unwrap_or(false); + if taken { + return; + } + let primary = mods.contains(term::PRIMARY); + let letter = |c: &str| matches!(&key, Key::Character(k) if k.eq_ignore_ascii_case(c)); + if matches!(key, Key::Named(NamedKey::F10)) || (primary && letter("p")) { + self.with_unit(chrome::command_menu); + } else if primary && letter("q") { + self.run_pending(Pending::Command(Command::Quit)); + } else { + self.with_editor(|ed| ed.key(key, code, mods)); + } + } + + /// Carry out a choice; `true` to quit. + fn run_pending(&self, p: Pending) -> bool { + let mut quit = false; + match p { + Pending::Command(Command::Chord(k, c, m)) => self.with_editor(|ed| ed.key(k, c, m)), + Pending::Command(Command::Link) => { + let current = editor() + .and_then(|ed| ed.doc().link_destination_at_caret()) + .unwrap_or_default(); + self.with_unit(|u| chrome::prompt_link(u, current)); + } + Pending::Command(Command::Quit) => { + let (dirty, name) = editor() + .map(|ed| { + let d = ed.doc(); + (d.dirty, d.file_name()) + }) + .unwrap_or((false, String::new())); + if dirty { + self.with_unit(|u| chrome::confirm_quit(u, &name)); + } else { + quit = true; + } + } + Pending::FollowFootnote => self.with_editor(|ed| { + ed.follow_footnote(); + }), + Pending::OpenLink => self.with_editor(|ed| { + ed.open_link(); + }), + Pending::CopyLink => self.with_editor(|ed| ed.copy_link()), + Pending::InsertLink(dest) => self.with_editor(|ed| { + ed.doc().insert_link(&dest); + ed.refresh(); + }), + Pending::Save => { + self.save(); + } + Pending::Command(Command::SaveAs) => { + let current = editor().map(|ed| ed.doc().path.display().to_string()); + self.with_unit(|u| files::prompt_save_as(u, current.unwrap_or_default())); + } + Pending::SaveTo(path) => self.with_editor(|ed| { + ed.doc().save_as(path); + self.watch.borrow_mut().saw_save(&ed.doc()); + ed.refresh(); + }), + Pending::Overwrite => self.with_editor(|ed| { + ed.doc().save(); + self.watch.borrow_mut().saw_save(&ed.doc()); + ed.refresh(); + }), + Pending::Reload => self.with_editor(|ed| { + ed.doc().reload(); + self.watch.borrow_mut().saw_save(&ed.doc()); + ed.refresh(); + }), + // Quit only once the save has gone through without a question; + // one that asks (where to, or whether to overwrite) stays. + Pending::SaveAndQuit => { + quit = self.save() && !editor().is_some_and(|ed| ed.doc().dirty) + } + Pending::QuitNow => quit = true, + } + if quit { + QUIT.set(true); + } + quit + } + + /// Save, or ask what the save needs first: whether it wrote. + fn save(&self) -> bool { + let Some(ed) = editor() else { return false }; + let plan = files::plan(&ed.doc()); + match plan { + files::Save::Write => { + self.with_editor(|ed| { + ed.doc().save(); + self.watch.borrow_mut().saw_save(&ed.doc()); + ed.refresh(); + }); + return true; + } + files::Save::AskWhere => { + self.with_unit(|u| files::prompt_save_as(u, String::new())); + } + files::Save::AskOverwrite => { + let name = ed.doc().file_name(); + self.with_unit(|u| files::confirm_overwrite(u, &name)); + } + files::Save::ReadOnly => self.with_editor(|ed| { + ed.doc().status = Some("read-only".into()); + ed.refresh(); + }), + } + false + } + + /// One look at the file, when it is time: whether the page changed. + fn tick_watch(&self) -> bool { + let mut changed = false; + self.with_editor(|ed| changed = self.watch.borrow_mut().tick(ed)); + changed } fn paint(&self) -> paint::Grid { @@ -212,6 +423,10 @@ fn enter_runtime() { ENTERED.set(true); } +fn editor() -> Option { + EDITOR.with_borrow(|e| e.clone()) +} + fn px(m: Metrics, cols: u16, rows: u16) -> (u32, u32) { ( (cols as f32 * m.cw).round() as u32, @@ -230,6 +445,28 @@ fn viewport(w: u32, h: u32) -> Viewport { fn main() -> Result<()> { let mut args: Vec<_> = std::env::args_os().skip(1).collect(); + // leaf-tui's flags: `-r` reads only, `-w N` sets the column to N + // characters (0 fills the terminal). + let mut opts = Options::default(); + let mut i = 0; + while i < args.len() { + match args[i].to_str() { + Some("-r" | "--read-only") => { + opts.read_only = true; + args.remove(i); + } + Some("-w" | "--width") if i + 1 < args.len() => { + let n: f32 = args[i + 1] + .to_str() + .and_then(|n| n.parse().ok()) + .context("-w takes a number of characters")?; + opts.measure = (n > 0.0).then_some(n); + args.drain(i..i + 2); + } + _ => i += 1, + } + } + OPTIONS.set(opts); // `--dump`: one frame, 80 × 24, printed as text — what a test or a // reader without a terminal to hand can look at. `--dump-html`: the same // frame as a `
`, in its colours.
@@ -243,7 +480,7 @@ fn main() -> Result<()> {
     let path = args
         .first()
         .map(PathBuf::from)
-        .context("usage: leaf-dtui [--dump | --dump-html] ")?;
+        .context("usage: leaf-dtui [--dump | --dump-html] [-r] [-w N] ")?;
 
     if dump {
         let mut s = Session::new(path, 80, 24)?;
@@ -264,6 +501,7 @@ fn main() -> Result<()> {
     }
     // Anything written to stderr would land on the screen among the cells.
     quiet_stderr();
+    term::ask_theme();
     let (cols, rows) = crossterm::terminal::size()?;
     let mut s = Session::new(path, cols, rows)?;
     let mut out = term::Terminal::enter()?;
@@ -294,16 +532,20 @@ fn run(s: &mut Session, out: &mut term::Terminal) -> Result<()> {
         if event::poll(Duration::from_millis(50))? {
             while {
                 match event::read()? {
-                    Event::Key(k) if term::is_quit(&k) => return Ok(()),
                     Event::Key(k) => {
                         if let Some((key, code, mods)) = term::key(&k) {
-                            s.with_editor(|ed| ed.key(key, code, mods));
+                            s.key(key, code, mods);
                         }
                     }
                     Event::Paste(text) => {
-                        for c in text.chars() {
-                            let (key, code, mods) = term::char_key(c);
-                            s.with_editor(|ed| ed.key(key, code, mods));
+                        if !s
+                            .with_unit(|u| u.is_open() && u.text(&text))
+                            .unwrap_or(false)
+                        {
+                            for c in text.chars() {
+                                let (key, code, mods) = term::char_key(c);
+                                s.with_editor(|ed| ed.key(key, code, mods));
+                            }
                         }
                     }
                     Event::Mouse(me) => match me.kind {
@@ -313,22 +555,53 @@ fn run(s: &mut Session, out: &mut term::Terminal) -> Result<()> {
                         MouseEventKind::ScrollUp => {
                             s.with_editor(|ed| ed.scroll(3.0 * s.m.ch as f64))
                         }
-                        MouseEventKind::Down(MouseButton::Left)
-                        | MouseEventKind::Up(MouseButton::Left)
-                        | MouseEventKind::Drag(MouseButton::Left) => {
+                        _ => {
+                            if let MouseEventKind::Down(_) = me.kind {
+                                chrome::set_pointer((
+                                    me.column as f64 * s.m.cw as f64,
+                                    me.row as f64 * s.m.ch as f64,
+                                ));
+                            }
                             term::pointer(&mut s.doc, s.m, &me);
                         }
-                        _ => {}
                     },
-                    Event::Resize(c, r) => s.resize(c, r),
+                    // Asked below, every turn.
+                    Event::Resize(..) => {}
                     _ => {}
                 }
                 event::poll(Duration::ZERO)?
             } {}
             acted = true;
         }
+        // The terminal's size, asked each turn rather than trusted to its
+        // resize events: one that arrives while the start-up queries read
+        // stdin is lost, and a window that grows just after it opens (a new
+        // terminal window settling) would keep the old frame.
+        let (c, r) = crossterm::terminal::size()?;
+        if (c, r) != (s.cols, s.rows) {
+            s.resize(c, r);
+            out.clear()?;
+            acted = true;
+        }
+        if s.tick_watch() {
+            acted = true;
+        }
         let t0 = std::time::Instant::now();
-        s.settle();
+        if s.settle() {
+            acted = true;
+        }
+        // What the menus and dialogs chose, now the events are over.
+        let chosen = chrome::take();
+        if !chosen.is_empty() {
+            for p in chosen {
+                s.run_pending(p);
+            }
+            s.settle();
+            acted = true;
+        }
+        if QUIT.get() {
+            return Ok(());
+        }
         if acted || s.window.take_dirty() {
             let t1 = std::time::Instant::now();
             let next = s.paint();
@@ -429,4 +702,65 @@ mod tests {
         assert!(p.row + p.rows as i32 > 12, "{p:?}");
         assert_eq!(p.shown, (p.row, 11), "{p:?}");
     }
+
+    #[test]
+    fn the_command_menu_opens_over_the_page() {
+        let (dir, path) = scratch("Text.\n");
+        let mut s = Session::new(path, 80, 24).unwrap();
+        let (key, code, _) = term::char_key('p');
+        s.key(key, code, term::PRIMARY);
+        s.settle();
+        let open = s.with_unit(|u| u.is_open()).unwrap();
+        let f = s.paint().text();
+        std::fs::remove_dir_all(&dir).ok();
+        assert!(open, "the menu opened");
+        assert!(f.contains("File") && f.contains("Paragraph"), "{f}");
+    }
+
+    #[test]
+    fn quitting_with_unsaved_changes_asks_and_the_keys_answer() {
+        use dioxus::html::{Code, Key, Modifiers, NamedKey};
+        let (dir, path) = scratch("Text.\n");
+        let mut s = Session::new(path, 80, 24).unwrap();
+        let (key, code, mods) = term::char_key('x');
+        s.key(key, code, mods);
+        s.settle();
+        let (key, code, _) = term::char_key('q');
+        s.key(key, code, term::PRIMARY);
+        s.settle();
+        assert!(s.with_unit(|u| u.is_open()).unwrap(), "the sheet is open");
+        assert!(s.paint().text().contains("Save the changes to doc.md?"));
+        let down = || {
+            (
+                Key::Named(NamedKey::ArrowDown),
+                Code::ArrowDown,
+                Modifiers::empty(),
+            )
+        };
+        for (k, c, m) in [down(), down()] {
+            s.key(k, c, m);
+        }
+        s.key(Key::Named(NamedKey::Enter), Code::Enter, Modifiers::empty());
+        s.settle();
+        let chosen = chrome::take();
+        std::fs::remove_dir_all(&dir).ok();
+        assert_eq!(chosen, vec![Pending::QuitNow]);
+    }
+
+    #[test]
+    fn a_clean_document_takes_an_outside_write_once_it_stands_still() {
+        let (dir, path) = scratch("First.\n");
+        let mut s = Session::new(path.clone(), 80, 24).unwrap();
+        std::fs::write(&path, "First.\n\nWritten outside.\n").unwrap();
+        // The look that notices waits; the next takes it.
+        for _ in 0..2 {
+            std::thread::sleep(files::POLL + Duration::from_millis(50));
+            s.tick_watch();
+        }
+        s.settle();
+        let f = s.paint().text();
+        std::fs::remove_dir_all(&dir).ok();
+        assert!(f.contains("Written outside."), "{f}");
+        assert!(f.contains("reloaded from disk"), "{f}");
+    }
 }
diff --git a/apps/leaf-dioxus-tui/src/paint.rs b/apps/leaf-dioxus-tui/src/paint.rs
index e06c02ea..4a31cd28 100644
--- a/apps/leaf-dioxus-tui/src/paint.rs
+++ b/apps/leaf-dioxus-tui/src/paint.rs
@@ -10,9 +10,11 @@
 //! rounds to. With a monospace face whose advance is [`Metrics::cw`], every
 //! glyph lands in a cell of its own.
 //!
-//! The one element read by name is the editor's caret, `.caret-in`, a
-//! zero-width box with a 2px border: drawn as cells it would be nothing or a
-//! whole column, so it becomes the terminal's own cursor instead.
+//! The elements read by name are the carets — the editor's `.caret-in`, a
+//! zero-width box with a 2px border, and unit's `.unit-caret` in a dialog's
+//! field, a 1px box: drawn as cells either would be nothing or a whole
+//! column, so each becomes the terminal's own cursor instead, the one
+//! painted last (a dialog's, over the editor) winning.
 
 use std::collections::HashMap;
 
@@ -313,10 +315,10 @@ impl Painter<'_> {
             y1: y + l.size.height,
         };
 
-        if node
-            .attr(blitz_dom::local_name!("class"))
-            .is_some_and(|c| c.split_ascii_whitespace().any(|c| c == "caret-in"))
-        {
+        if node.attr(blitz_dom::local_name!("class")).is_some_and(|c| {
+            c.split_ascii_whitespace()
+                .any(|c| c == "caret-in" || c == "unit-caret")
+        }) {
             let (cx, cy) = (x, y + l.size.height / 2.0);
             if clip.contains(cx, cy) {
                 let (c, r) = match self.inline_cells.get(&id) {
@@ -334,7 +336,6 @@ impl Painter<'_> {
         }
 
         self.background(styles, bbox.intersect(clip));
-        self.borders(styles, bbox, l, clip);
         if node
             .data
             .is_element_with_tag_name(&blitz_dom::local_name!("img"))
@@ -410,6 +411,13 @@ impl Painter<'_> {
                 self.render(h.node_id, (base.0 + p.x, base.1 + p.y), inner_clip);
             }
         }
+        // The border last, over the children: in pixels a child stays inside
+        // its parent's border, but rounded to cells a child's background can
+        // reach the border's cells — a menu's highlighted item would rub out
+        // the menu's sides.
+        if l.border.left + l.border.right + l.border.top + l.border.bottom > 0.0 {
+            self.borders(styles, bbox, l, clip);
+        }
     }
 
     /// Record an `img` at `b`, drawn to cells as [`Self::frame`] does.
@@ -490,6 +498,24 @@ impl Painter<'_> {
         if a < 0.05 {
             return;
         }
+        // A box too thin to cover a cell's centre but a cell wide — a menu's
+        // separator, a rule — is a line through the row it sits in, drawn
+        // only over cells nothing else is drawn in.
+        let m = self.m;
+        if area.y1 - area.y0 < m.ch / 2.0 && area.x1 - area.x0 >= m.cw {
+            let r = ((area.y0 + area.y1) / 2.0 / m.ch).floor() as i32;
+            let c0 = (area.x0 / m.cw).round() as i32;
+            let c1 = (area.x1 / m.cw).round() as i32;
+            for col in c0..c1 {
+                if let Some(cell) = self.grid.at(col, r)
+                    && cell.text == " "
+                {
+                    cell.text = "─".into();
+                    cell.fg = blend(c, a, cell.bg);
+                }
+            }
+            return;
+        }
         self.fill(area, c, a);
     }
 
@@ -558,41 +584,61 @@ impl Painter<'_> {
                 cell.fg = blend(fg, a, cell.bg);
             }
         };
-        // A horizontal border gets a row only when the box is tall enough to
-        // give it one: a table cell a line high keeps its text, not a rule
-        // drawn through it.
-        let content_top = row_of(b.y0 + l.border.top + l.padding.top + 0.01);
-        let content_bottom = row_of((b.y1 - l.border.bottom - l.padding.bottom - 0.01).max(b.y0));
-        if let Some(fg) = side(l.border.top, bs.border_top_style, &bs.border_top_color)
-            .filter(|_| r0 < content_top)
-        {
-            for c in c0..=c1 {
-                put(self.grid, c, r0, "─", fg);
-            }
-        }
-        if let Some(fg) = side(
+        // A horizontal side gets its row only when nothing is written in it
+        // between the sides: a table cell a line high, or a button, keeps
+        // its text rather than a rule drawn through it.
+        let free = |g: &Grid, r: i32| {
+            r0 < r1
+                && (c0 + 1..c1).all(|c| {
+                    c < 0 || r < 0 || c >= g.cols as i32 || r >= g.rows as i32 || {
+                        let t = &g.get(c as u16, r as u16).text;
+                        t == " " || t == "─"
+                    }
+                })
+        };
+        // And only in a row the box owns: its top edge in the row's upper
+        // half, its bottom edge in the lower. A table cell's bottom border
+        // a few pixels into the next row's text is not that row's.
+        let frac = |y: f32| y / m.ch - (y / m.ch).floor();
+        let top_free = free(self.grid, r0) && frac(b.y0) < 0.5;
+        let bottom_free = free(self.grid, r1) && frac((b.y1 - 0.01).max(b.y0)) >= 0.5;
+        let top =
+            side(l.border.top, bs.border_top_style, &bs.border_top_color).filter(|_| top_free);
+        let bottom = side(
             l.border.bottom,
             bs.border_bottom_style,
             &bs.border_bottom_color,
         )
-        .filter(|_| r1 > content_bottom)
-        {
-            for c in c0..=c1 {
-                put(self.grid, c, r1, "─", fg);
+        .filter(|_| bottom_free);
+        let left = side(l.border.left, bs.border_left_style, &bs.border_left_color);
+        let right = side(
+            l.border.right,
+            bs.border_right_style,
+            &bs.border_right_color,
+        );
+        for (fg, r) in [(top, r0), (bottom, r1)] {
+            if let Some(fg) = fg {
+                for c in c0..=c1 {
+                    put(self.grid, c, r, "─", fg);
+                }
             }
         }
-        if let Some(fg) = side(l.border.left, bs.border_left_style, &bs.border_left_color) {
-            for r in r0..=r1 {
-                put(self.grid, c0, r, "│", fg);
+        for (fg, c) in [(left, c0), (right, c1)] {
+            if let Some(fg) = fg {
+                for r in r0..=r1 {
+                    put(self.grid, c, r, "│", fg);
+                }
             }
         }
-        if let Some(fg) = side(
-            l.border.right,
-            bs.border_right_style,
-            &bs.border_right_color,
-        ) {
-            for r in r0..=r1 {
-                put(self.grid, c1, r, "│", fg);
+        // Where two drawn sides meet, a corner.
+        for (h, v, c, r, ch) in [
+            (top, left, c0, r0, "┌"),
+            (top, right, c1, r0, "┐"),
+            (bottom, left, c0, r1, "└"),
+            (bottom, right, c1, r1, "┘"),
+        ] {
+            if let (Some(fg), Some(_)) = (h, v) {
+                put(self.grid, c, r, ch, fg);
             }
         }
     }
diff --git a/apps/leaf-dioxus-tui/src/term.rs b/apps/leaf-dioxus-tui/src/term.rs
index 40a6d7fe..15c47bce 100644
--- a/apps/leaf-dioxus-tui/src/term.rs
+++ b/apps/leaf-dioxus-tui/src/term.rs
@@ -11,7 +11,7 @@ use blitz_traits::events::{
 };
 use crossterm::event::{
     DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture, KeyCode,
-    KeyEvent, KeyEventKind, KeyModifiers, MouseEvent, MouseEventKind,
+    KeyEvent, KeyEventKind, KeyModifiers, MouseButton, MouseEvent, MouseEventKind,
 };
 use crossterm::{cursor, execute, terminal};
 use dioxus::html::{Code, Key, Modifiers, NamedKey};
@@ -22,10 +22,28 @@ use ratatui::style::{Color, Modifier};
 use crate::paint::{Grid, Metrics};
 use crate::pictures::Pictures;
 
-/// Dark unless `LEAF_THEME=light` says otherwise; leaf-tui's OSC 11 query
-/// is the real answer, and is for later.
+thread_local! {
+    static DARK: std::cell::Cell> = const { std::cell::Cell::new(None) };
+}
+
+/// Whether the terminal is dark: `LEAF_THEME=light|dark` if set, else the
+/// answer [`ask_theme`] got, else dark — leaf-tui's order.
 pub fn dark() -> bool {
-    std::env::var("LEAF_THEME").map_or(true, |t| t != "light")
+    match std::env::var("LEAF_THEME").as_deref() {
+        Ok("light") => false,
+        Ok("dark") => true,
+        _ => DARK.get().unwrap_or(true),
+    }
+}
+
+/// Ask the terminal whether it is light or dark (an `OSC 11` query, with a
+/// timeout, which terminal-colorsaurus answers from the controlling tty
+/// without stealing a keystroke), before anything is drawn to its colours.
+pub fn ask_theme() {
+    if let Ok(palette) = terminal_colorsaurus::color_palette(Default::default()) {
+        let dark = palette.theme_mode() == terminal_colorsaurus::ThemeMode::Dark;
+        DARK.set(Some(dark));
+    }
 }
 
 pub struct Terminal {
@@ -65,6 +83,12 @@ impl Terminal {
         Ok(())
     }
 
+    /// Forget what is on screen: the next draw writes every cell.
+    pub fn clear(&mut self) -> Result<()> {
+        self.term.clear()?;
+        Ok(())
+    }
+
     /// Draw `g`: its cells, then its pictures over them. ratatui writes only
     /// the cells that changed since the last frame.
     pub fn draw(&mut self, g: &Grid) -> Result<()> {
@@ -105,15 +129,9 @@ fn rgb((r, g, b): (u8, u8, u8)) -> Color {
     Color::Rgb(r, g, b)
 }
 
-pub fn is_quit(k: &KeyEvent) -> bool {
-    k.kind != KeyEventKind::Release
-        && k.modifiers.contains(KeyModifiers::CONTROL)
-        && k.code == KeyCode::Char('q')
-}
-
 /// The editor's primary modifier: ⌘ on macOS, where a terminal hands over ⌃
 /// instead, and ⌃ everywhere else.
-const PRIMARY: Modifiers = if cfg!(target_os = "macos") {
+pub const PRIMARY: Modifiers = if cfg!(target_os = "macos") {
     Modifiers::META
 } else {
     Modifiers::CONTROL
@@ -129,6 +147,11 @@ pub fn key(k: &KeyEvent) -> Option<(Key, Code, Modifiers)> {
     mods.set(Modifiers::SHIFT, k.modifiers.contains(KeyModifiers::SHIFT));
     mods.set(Modifiers::ALT, k.modifiers.contains(KeyModifiers::ALT));
     mods.set(PRIMARY, k.modifiers.contains(KeyModifiers::CONTROL));
+    // ⌃K is the editor's own ⌃ chord on Apple (delete to the line's end),
+    // as in leaf-tui; ⌘K has nothing to lose to it.
+    if k.code == KeyCode::Char('k') && k.modifiers == KeyModifiers::CONTROL {
+        mods = Modifiers::CONTROL;
+    }
     if k.code == KeyCode::BackTab {
         mods.insert(Modifiers::SHIFT);
     }
@@ -161,6 +184,9 @@ pub fn key(k: &KeyEvent) -> Option<(Key, Code, Modifiers)> {
         KeyCode::End => named(NamedKey::End),
         KeyCode::PageUp => named(NamedKey::PageUp),
         KeyCode::PageDown => named(NamedKey::PageDown),
+        KeyCode::F(n) => Key::from_str(&format!("F{n}"))
+            .ok()
+            .map(|k| (k, Code::Unidentified, mods)),
         _ => None,
     }
 }
@@ -182,16 +208,34 @@ pub fn char_key(c: char) -> (Key, Code, Modifiers) {
     (Key::Character(c.to_string()), code, Modifiers::empty())
 }
 
-/// A left-button press, drag or release, as Blitz's pointer events in the
+/// A press, a drag, a release or a move, as Blitz's pointer events in the
 /// cell it fell in: in its left part, so a click on a character puts the
-/// caret before it, as a terminal's block cursor reads.
+/// caret before it, as a terminal's block cursor reads. A move with no
+/// button down is the hover a menu highlights its items by.
 pub fn pointer(doc: &mut DioxusDocument, m: Metrics, me: &MouseEvent) {
-    let x = (me.column as f32 + 0.3) * m.cw;
+    // The editor's text starts `PAD` in, which the painter rounds to a
+    // whole cell; a click is shifted the same way, so it lands on the
+    // character drawn under it.
+    let pad = leaf_dioxus::PAD as f32;
+    let shift = pad - (pad / m.cw).round() * m.cw;
+    let x = (me.column as f32 + 0.3) * m.cw + shift;
     let y = (me.row as f32 + 0.5) * m.ch;
     let scroll = doc.inner.borrow().viewport_scroll();
     let mut mods = Modifiers::empty();
     mods.set(Modifiers::SHIFT, me.modifiers.contains(KeyModifiers::SHIFT));
-    let held = !matches!(me.kind, MouseEventKind::Up(_));
+    let button = match me.kind {
+        MouseEventKind::Down(b) | MouseEventKind::Up(b) | MouseEventKind::Drag(b) => b,
+        _ => MouseButton::Left,
+    };
+    let (button, held) = match button {
+        MouseButton::Left => (MouseEventButton::Main, MouseEventButtons::Primary),
+        MouseButton::Right => (MouseEventButton::Secondary, MouseEventButtons::Secondary),
+        MouseButton::Middle => (MouseEventButton::Auxiliary, MouseEventButtons::Auxiliary),
+    };
+    let buttons = match me.kind {
+        MouseEventKind::Down(_) | MouseEventKind::Drag(_) => held,
+        _ => MouseEventButtons::None,
+    };
     let event = BlitzPointerEvent {
         id: BlitzPointerId::Mouse,
         is_primary: true,
@@ -203,12 +247,8 @@ pub fn pointer(doc: &mut DioxusDocument, m: Metrics, me: &MouseEvent) {
             client_x: x,
             client_y: y,
         },
-        button: MouseEventButton::Main,
-        buttons: if held {
-            MouseEventButtons::Primary
-        } else {
-            MouseEventButtons::None
-        },
+        button,
+        buttons,
         mods,
         details: Default::default(),
         element: Default::default(),

From a91b3ed4a1a82771e0b73eaf8a152abb111090c2 Mon Sep 17 00:00:00 2001
From: Adam Harris 
Date: Wed, 21 Oct 2026 15:47:27 -0600
Subject: [PATCH 05/13] docs(proposals): the terminal prototype after pictures,
 unit's chrome and the file features

---
 .../the-leaf-dioxus-editor-in-a-terminal.md   | 129 +++++++++++-------
 1 file changed, 80 insertions(+), 49 deletions(-)

diff --git a/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md b/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md
index 37d48b21..2cd4a350 100644
--- a/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md
+++ b/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md
@@ -10,8 +10,11 @@ created: 2026-10-21
 ## Status
 
 `draft`, 2026-10-21. Written with the prototype in `apps/leaf-dioxus-tui`, on
-the `dioxus-tui` branch. Nothing is decided. leaf-tui is untouched; replacing it
-is Adam's call (see "Decisions to make").
+the `dioxus-tui` branch, with unit's `dioxus-tui` branch beside it. Decided by
+Adam on 2026-10-21: keep going (decision 1 below), in the order proposed —
+pictures, then unit's menus and dialogs, then the file features. All three
+rounds are in; "What it does not do yet" is what is left. leaf-tui is
+untouched; replacing it is still Adam's call.
 
 ## Does Dioxus have a TUI renderer?
 
@@ -46,51 +49,77 @@ everything above the painter already existed:
   cell is one advance wide and one line high, its wrapping, caret motion and
   hit-testing count in cells without any change to the editor.
 
-The prototype is about 1,500 lines in four files: the painter (~650), the
-host loop with its tests, the terminal I/O and the
-window stub. It needed **no change to
-leaf-dioxus or unit**.
+The first prototype was about 1,500 lines in four files and needed no change
+to leaf-dioxus or unit. With pictures, chrome and files it is about 2,700
+lines in eight, with tests, and two small changes outside it:
 
-## What the prototype does
+- **leaf-dioxus:** `Type::uniform`, which sets every run at the body size, as
+  the source view already does. Without it the editor lays a heading out at
+  twice the size the painter can draw it, and a click on a heading lands on
+  the wrong character.
+- **unit (branch `dioxus-tui`):** `Density::Cell`, a density whose menu rows,
+  separators and controls are each one cell high, with the menu's margin and
+  overlap per density so it stays on the grid; `Unit::hot_first` made public;
+  and keyboard choice for an action sheet (↑/↓/Tab, Return), which is useful
+  on a desktop too.
 
-Measured on 2026-10-21 in tmux at 80×24, driving the debug build:
+## What the prototype does
 
-- Paints headings, paragraphs, bold/italic/underline, links, inline and block
-  quotes, nested bullet and numbered lists, code blocks with syntax colours,
-  tables, the selection and the status line, in the light and dark palettes.
-- Typing, arrows, Home/End, PageUp/PageDown, ⇧-selection, ⌘ shortcuts as ⌃
-  (bold, save), the WYSIWYG reveal of markup at the caret, bracketed paste.
-- Mouse click to place the caret, wheel to scroll, caret-follow.
-- Saves through `Doc::save`.
-- One frame (settle + layout + paint) takes 1–3 ms on a 400-paragraph document.
-  The process holds about 55 MB resident.
-- Five tests paint a document headlessly and check the grid.
+Measured on 2026-10-21 in tmux at 80×24 and in Ghostty, driving the debug
+build:
+
+- **Text:** headings (bold at the body size), paragraphs, bold, italic,
+  underline, links, quotes, nested bullet and numbered lists, code blocks with
+  syntax colours, tables, rules, the selection and the status line, in the
+  light and dark palettes. The terminal is asked which it is (OSC 11), as
+  leaf-tui asks.
+- **Pictures, formulas and diagrams** through ratatui-image: kitty, iTerm2 or
+  sixel where the terminal has it (Ghostty drew a picture at full resolution
+  through kitty), half-blocks where it does not (tmux). A picture part-way off
+  the screen is cropped to its rows in view, and the status line stays on top.
+- **Editing:** typing, arrows, Home/End, PageUp/PageDown, ⇧-selection, the ⌘
+  shortcuts as ⌃ (⌃K stays the editor's delete to the line's end), the
+  WYSIWYG reveal of markup at the caret, bracketed paste, find (⌃F).
+- **Mouse:** a click places the caret on the character under it, a drag
+  selects, the wheel scrolls, a right-click opens the context menu, and menu
+  items highlight on hover.
+- **Chrome, from unit:** the command menu (⌃P or F10), built from one command
+  table, each item with its keys, so it is the key reference too; the context
+  menu (Open, Edit and Copy Link, Cut, Copy, Paste, Select All); the Link and
+  Save As prompts; the Save / Don't Save / Cancel question before quitting.
+  All of them are unit's, as the Mac app's are, in its cell density.
+- **Files:** Save and Save As; a save over a file changed on disk asks
+  Overwrite / Reload / Cancel; a clean document reloads an outside write once
+  the file stands still; a dirty one says so once. `-r` reads only, and `-w N`
+  sets the column (80 by default, 0 fills), as in leaf-tui.
+- **Cost:** a frame (settle, layout, paint) takes 1–3 ms on a 400-paragraph
+  document. The process holds about 55 MB resident.
+- **Tests:** 14 in the prototype, painting documents headlessly and checking
+  the grid, the pictures, the menus, the quit question and the file watch.
 
 ## What it does not do yet
 
 Against the [leaf-tui inventory](#what-leaf-tui-does) below:
 
-- **Pictures, formulas and diagrams** draw as a labelled frame. leaf-tui paints
-  them through kitty, iTerm2 or sixel. Doable: the painter knows each `img`
-  box's cell rectangle, so ratatui-image (or its encoders) can paint into it.
-- **Chrome.** The command palette, context menu, key reference, prompts and
-  unsaved-changes / changed-on-disk dialogs are leaf-tui's own. Here they
-  would be Dioxus components (unit's menus and dialogs already exist for the
-  Mac app) and so shared with it. Not tried: unit is not in the prototype yet.
-- **File-watch, New, Save As, read-only, `-w` column width.** Host work, not
-  rendering.
-- **Terminal theme detection.** `LEAF_THEME` only; leaf-tui asks the terminal
-  (OSC 11).
-- **Pixel chrome.** The editor sizes some chrome in pixels (find bar 34px rows,
-  table cell padding). In cells this rounds: table rules get no row of their
-  own, so a table shows its column rules only. A terminal stylesheet, or
-  the editor sizing chrome in lines, would fix this.
-- **Emacs ⌃ keys.** On macOS ⌃ stands in for ⌘, so ⌃A/⌃E/⌃K reach the editor
-  as ⌘A/⌘E/⌘K. leaf-tui keeps both.
-- **Wide characters** (CJK, emoji) take two cells, but the editor measures them
-  with the font's advance, which may not be exactly two cells. Not checked.
+- **Pixel chrome in the editor.** The find bar's rows are a Rust constant of
+  34px, so the bar takes two terminal rows; table cells are padded in pixels,
+  so a table gets its column rules but not its row rules. Decision 2 below.
+- **What leaf-tui adds that leaf-dioxus has no part of:** New, the scrollbar,
+  hover previews, the large-heading rasters, the `::embed` directive card,
+  the table commands in a menu, and a fuzzy palette (the command menu is a
+  menu, not a search). Each is host work or a small widget change.
+- **Emacs ⌃ keys** beyond ⌃K. On macOS ⌃ stands in for ⌘, so ⌃A and ⌃E reach
+  the editor as ⌘A and ⌘E.
+- **Start-up** takes about two seconds in the debug build, and keys typed
+  while the terminal's graphics query is out can be lost.
 - **Not checked at all:** Linux (Menlo is assumed; the face list falls back to
-  DejaVu Sans Mono), release size and build time, and the IME.
+  DejaVu Sans Mono), sixel and iTerm2 (only kitty and half-blocks were seen),
+  wide characters' cells, release size and build time, the IME, and CI (the
+  prototype is its own workspace and no CI job builds it).
+- **A Blitz behaviour found on the way:** Blitz broke a line between a quote's
+  bar (an inline box) and its text, though the line is `white-space: pre`,
+  when a trailing space did not fit. The prototype gives each line room to
+  avoid it; the Mac app could meet it in a rare case. Not reported upstream.
 
 ## What leaf-tui does
 
@@ -111,18 +140,20 @@ mapping, its own layout pass and its own tests. A behaviour fixed in
 leaf-dioxus is fixed in the terminal too. Its chrome could be unit's.
 
 Against: the terminal then depends on Dioxus 0.8 alpha, Stylo and the Blitz
-fork, which is a much larger build than ratatui: the prototype's lockfile lists 620
-packages (every platform's), where the root workspace's comment counts 141
-that leaf-tui uses. It uses more memory. The graphics-protocol work and
-the chrome above would have to be redone on the new base before it matches.
+fork, which is a much larger build than ratatui: the prototype's lockfile lists
+more than 600 packages (every platform's), where the root workspace's comment
+counts 141 that leaf-tui uses. It uses more memory, and starts slower. And
+unit's cell density is a third way unit draws, to be kept working.
 
 ## Decisions to make
 
-1. Whether to keep going: images through the graphics protocol next, then
-   unit's menus and dialogs, then the host features. That is the order that
-   closes the largest gaps first.
+1. ~~Whether to keep going~~: yes (Adam, 2026-10-21). The three rounds are
+   done; what is left is listed above.
 2. Whether the editor should size its chrome in lines when a host asks (a
-   `Look` option), so a terminal needs no stylesheet patch.
-3. Whether the prototype stays its own workspace, like `apps/leaf-dioxus`, or
-   joins it.
-4. Only after it matches leaf-tui: whether it replaces leaf-tui.
+   `Look` option), so the find bar and table padding fit the grid. The
+   `uniform` type is the first piece of it.
+3. Whether unit's `dioxus-tui` branch (the cell density, keyboard choice on
+   an action sheet) merges into unit's main.
+4. Whether the prototype stays its own workspace, like `apps/leaf-dioxus`, or
+   joins it, and whether CI builds and tests it.
+5. Only after it matches leaf-tui: whether it replaces leaf-tui.

From 0f3ba520a634505a1c46c82552ca00dd9fd80a2c Mon Sep 17 00:00:00 2001
From: Adam Harris 
Date: Wed, 21 Oct 2026 15:57:01 -0600
Subject: [PATCH 06/13] fix(dioxus-tui): a menu or dialog over a picture is
 drawn over it

A graphics-protocol picture is painted after the cells, over its whole
box, so a context menu or the command menu opened over a picture was
hidden under it. Only a box across the picture's full width (the status
line) trimmed it. Now any opaque box drawn after a picture covers it
there: the picture keeps the largest rectangle the box leaves uncovered,
above, below or beside it, and is cropped to it on both axes.
---
 apps/leaf-dioxus-tui/src/main.rs     | 36 +++++++++++
 apps/leaf-dioxus-tui/src/paint.rs    | 97 ++++++++++++++++++++++++----
 apps/leaf-dioxus-tui/src/pictures.rs | 33 +++++++---
 3 files changed, 143 insertions(+), 23 deletions(-)

diff --git a/apps/leaf-dioxus-tui/src/main.rs b/apps/leaf-dioxus-tui/src/main.rs
index 3580ab2a..86f8926c 100644
--- a/apps/leaf-dioxus-tui/src/main.rs
+++ b/apps/leaf-dioxus-tui/src/main.rs
@@ -763,4 +763,40 @@ mod tests {
         assert!(f.contains("Written outside."), "{f}");
         assert!(f.contains("reloaded from disk"), "{f}");
     }
+
+    #[test]
+    fn a_menu_opened_over_a_picture_is_not_painted_over() {
+        let png = concat!(env!("CARGO_MANIFEST_DIR"), "/../../leaf-gpui.png");
+        let (dir, path) = scratch(&format!("Top.\n\n![shot]({png})\n"));
+        let mut s = Session::new(path, 80, 24).unwrap();
+        let (key, code, _) = term::char_key('p');
+        s.key(key, code, term::PRIMARY);
+        s.settle();
+        let g = s.paint();
+        std::fs::remove_dir_all(&dir).ok();
+        let [p] = &g.pictures[..] else {
+            panic!("one picture: {:?}", g.pictures)
+        };
+        // Every cell of the menu's labels lies outside what the picture
+        // still paints.
+        let inside = |c: i32, r: i32| {
+            (p.shown_cols.0..p.shown_cols.1).contains(&c) && (p.shown.0..p.shown.1).contains(&r)
+        };
+        let mut seen = 0;
+        for r in 0..g.rows {
+            let line: String = (0..g.cols).map(|c| g.get(c, r).text.clone()).collect();
+            for label in ["File", "Edit", "Paragraph"] {
+                if let Some(at) = line.find(label) {
+                    seen += 1;
+                    let c = line[..at].chars().count() as i32;
+                    assert!(!inside(c, r as i32), "{label} at {c},{r} under {p:?}");
+                }
+            }
+        }
+        assert_eq!(seen, 3, "{}", g.text());
+        assert!(
+            p.shown.0 < p.shown.1,
+            "some of the picture still shows: {p:?}"
+        );
+    }
 }
diff --git a/apps/leaf-dioxus-tui/src/paint.rs b/apps/leaf-dioxus-tui/src/paint.rs
index 4a31cd28..064e2411 100644
--- a/apps/leaf-dioxus-tui/src/paint.rs
+++ b/apps/leaf-dioxus-tui/src/paint.rs
@@ -72,7 +72,9 @@ pub struct Grid {
 }
 
 /// An `img`'s box in cells. Its whole box, which may run off the screen,
-/// and the rows of it in view, which a box drawn later may have covered.
+/// and the part of it in view: a rectangle, since a graphics-protocol
+/// picture is one, cut back by whatever opaque box was drawn over it later
+/// — a menu, a dialog, the status line ([`Picture::cover`]).
 #[derive(Clone, Debug, PartialEq)]
 pub struct Picture {
     pub src: String,
@@ -82,6 +84,42 @@ pub struct Picture {
     pub rows: u16,
     /// The rows in view, `top..bottom`; empty when none is.
     pub shown: (i32, i32),
+    /// The columns in view, `left..right`.
+    pub shown_cols: (i32, i32),
+}
+
+impl Picture {
+    /// An opaque box over cells `c0..c1` × `r0..r1`, drawn after the
+    /// picture, covers it there. Cells are drawn under a graphics-protocol
+    /// picture, never over it, so the picture keeps the largest rectangle the
+    /// box leaves uncovered — above it, below it, or to either side — and
+    /// what the box covers shows the box.
+    pub fn cover(&mut self, c0: i32, c1: i32, r0: i32, r1: i32) {
+        let (top, bottom) = self.shown;
+        let (left, right) = self.shown_cols;
+        if c1 <= left || c0 >= right || r1 <= top || r0 >= bottom {
+            return;
+        }
+        let rest = [
+            (left, right, top, r0),
+            (left, right, r1, bottom),
+            (left, c0, top, bottom),
+            (c1, right, top, bottom),
+        ];
+        let area = |&(l, r, t, b): &(i32, i32, i32, i32)| (r - l).max(0) * (b - t).max(0);
+        let best = rest
+            .iter()
+            .max_by_key(|x| area(x))
+            .copied()
+            .unwrap_or_default();
+        if area(&best) == 0 {
+            self.shown = (top, top);
+            self.shown_cols = (left, left);
+        } else {
+            self.shown_cols = (best.0, best.1);
+            self.shown = (best.2, best.3);
+        }
+    }
 }
 
 impl Grid {
@@ -431,6 +469,10 @@ impl Painter<'_> {
         let bottom = (row + rows)
             .min((clip.y1 / m.ch).round() as i32)
             .min(self.grid.rows as i32);
+        let left = col.max((clip.x0 / m.cw).round() as i32).max(0);
+        let right = (col + cols)
+            .min((clip.x1 / m.cw).round() as i32)
+            .min(self.grid.cols as i32);
         self.grid.pictures.push(Picture {
             src: src.to_string(),
             col,
@@ -438,6 +480,7 @@ impl Painter<'_> {
             cols: cols as u16,
             rows: rows as u16,
             shown: (top, bottom.max(top)),
+            shown_cols: (left, right.max(left)),
         });
     }
 
@@ -525,19 +568,10 @@ impl Painter<'_> {
         let c1 = (area.x1 / m.cw - 0.5).ceil() as i32;
         let r0 = (area.y0 / m.ch - 0.5).ceil() as i32;
         let r1 = (area.y1 / m.ch - 0.5).ceil() as i32;
-        // An opaque box across a picture's whole width covers the rows of
-        // it that it spans: the status line over a picture at the bottom.
-        if a > 0.5 && r0 < r1 {
+        // An opaque box drawn after a picture covers it where they meet.
+        if a > 0.5 && r0 < r1 && c0 < c1 {
             for p in &mut self.grid.pictures {
-                if c0 > p.col || c1 < p.col + p.cols as i32 {
-                    continue;
-                }
-                let (top, bottom) = p.shown;
-                if r0 <= top && r1 > top {
-                    p.shown.0 = r1.min(bottom);
-                } else if r0 < bottom && r1 >= bottom {
-                    p.shown.1 = r0.max(top);
-                }
+                p.cover(c0, c1, r0, r1);
             }
         }
         for r in r0..r1 {
@@ -752,3 +786,40 @@ impl Painter<'_> {
         }
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    fn picture() -> Picture {
+        Picture {
+            src: String::new(),
+            col: 0,
+            row: 0,
+            cols: 40,
+            rows: 20,
+            shown: (0, 20),
+            shown_cols: (0, 40),
+        }
+    }
+
+    #[test]
+    fn a_box_over_a_picture_leaves_it_the_largest_part_uncovered() {
+        // A wide menu at the top: more is left below it than beside it.
+        let mut p = picture();
+        p.cover(0, 30, 0, 4);
+        assert_eq!((p.shown, p.shown_cols), ((4, 20), (0, 40)));
+        // A tall narrow one at the left: the right of it is kept.
+        let mut p = picture();
+        p.cover(0, 8, 0, 20);
+        assert_eq!((p.shown, p.shown_cols), ((0, 20), (8, 40)));
+        // One beside the picture leaves it whole.
+        let mut p = picture();
+        p.cover(40, 50, 0, 20);
+        assert_eq!((p.shown, p.shown_cols), ((0, 20), (0, 40)));
+        // One over all of it hides it.
+        let mut p = picture();
+        p.cover(0, 40, 0, 20);
+        assert_eq!(p.shown.0, p.shown.1);
+    }
+}
diff --git a/apps/leaf-dioxus-tui/src/pictures.rs b/apps/leaf-dioxus-tui/src/pictures.rs
index c017cd65..e9ffbda0 100644
--- a/apps/leaf-dioxus-tui/src/pictures.rs
+++ b/apps/leaf-dioxus-tui/src/pictures.rs
@@ -34,13 +34,16 @@ const PROTOCOLS_MAX: usize = 64;
 /// about twice the size of the cell the editor measures in.
 const SVG_SCALE: f32 = 2.0;
 
+/// A source, and the rows and columns of its box in view: `(first, count)`.
+type Crop = (String, (u16, u16), (u16, u16));
+
 pub struct Pictures {
     picker: Picker,
     /// Each source, decoded, or `None` when it would not decode.
     decoded: HashMap>,
     /// Each crop of a source, encoded for the terminal: keyed by the source,
-    /// the first row in view and how many rows are.
-    encoded: HashMap<(String, u16, u16), StatefulProtocol>,
+    /// and the first row and column in view and how many of each are.
+    encoded: HashMap,
 }
 
 impl Pictures {
@@ -77,7 +80,8 @@ impl Pictures {
 
     fn paint_one(&mut self, f: &mut Frame, grid: &Grid, p: &Picture) {
         let (top, bottom) = p.shown;
-        let (left, right) = (p.col.max(0), (p.col + p.cols as i32).min(grid.cols as i32));
+        let (left, right) = p.shown_cols;
+        let (bottom, right) = (bottom.min(grid.rows as i32), right.min(grid.cols as i32));
         if top >= bottom || left >= right {
             return;
         }
@@ -89,22 +93,31 @@ impl Pictures {
         else {
             return;
         };
+        // The part of the box in view, as fractions of the whole box, cut
+        // from the picture in the same proportions.
         let skip = (top - p.row) as u16;
         let shown = (bottom - top) as u16;
-        let key = (p.src.clone(), skip, shown);
+        let skip_cols = (left - p.col) as u16;
+        let shown_cols = (right - left) as u16;
+        let key = (p.src.clone(), (skip, shown), (skip_cols, shown_cols));
         let picker = &self.picker;
         let proto = self.encoded.entry(key).or_insert_with(|| {
-            let img = if shown == p.rows {
+            let img = if (shown, shown_cols) == (p.rows, p.cols) {
                 img.clone()
             } else {
-                let h = img.height() as f32;
-                let y0 = (h * skip as f32 / p.rows as f32).round() as u32;
-                let y1 = (h * (skip + shown) as f32 / p.rows as f32).round() as u32;
-                img.crop_imm(0, y0, img.width(), (y1 - y0).max(1))
+                let cut = |len: u32, from: u16, n: u16, of: u16| {
+                    let len = len as f32;
+                    let a = (len * from as f32 / of as f32).round() as u32;
+                    let b = (len * (from + n) as f32 / of as f32).round() as u32;
+                    (a, (b.saturating_sub(a)).max(1))
+                };
+                let (y, h) = cut(img.height(), skip, shown, p.rows);
+                let (x, w) = cut(img.width(), skip_cols, shown_cols, p.cols);
+                img.crop_imm(x, y, w, h)
             };
             picker.new_resize_protocol(img)
         });
-        let rect = Rect::new(left as u16, top as u16, (right - left) as u16, shown);
+        let rect = Rect::new(left as u16, top as u16, shown_cols, shown);
         f.render_widget(Clear, rect);
         f.render_stateful_widget(StatefulImage::new().resize(Resize::Fit(None)), rect, proto);
     }

From d8358014e4c2a370173864c7ceb7c588495d1bd0 Mon Sep 17 00:00:00 2001
From: Adam Harris 
Date: Wed, 21 Oct 2026 18:40:15 -0600
Subject: [PATCH 07/13] refactor(dioxus-tui): paint through blitz-tui, from the
 Blitz fork
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The painter, the terminal, the pictures' protocol and the winit window stub
move to blitz-tui, a package on diaryx-org/blitz's tui branch, which runs
any Blitz document. What stays is leaf's: the editor and unit's chrome, the
command table, the file rules, ⌃ as ⌘ for the editor's shortcuts, the caret
classes, the click shift by the editor's padding, and leaf-raster as the
picture decoder. Every Blitz crate now comes from the tui branch.

Behavioural-change: a table's bottom border is drawn; a horizontal border takes the row boundary nearest it.
---
 apps/leaf-dioxus-tui/Cargo.lock      |  81 ++-
 apps/leaf-dioxus-tui/Cargo.toml      |  50 +-
 apps/leaf-dioxus-tui/README.md       |  30 +-
 apps/leaf-dioxus-tui/src/main.rs     |  65 +--
 apps/leaf-dioxus-tui/src/paint.rs    | 825 ---------------------------
 apps/leaf-dioxus-tui/src/pictures.rs | 122 +---
 apps/leaf-dioxus-tui/src/term.rs     | 250 ++------
 apps/leaf-dioxus-tui/src/window.rs   | 206 -------
 8 files changed, 167 insertions(+), 1462 deletions(-)
 delete mode 100644 apps/leaf-dioxus-tui/src/paint.rs
 delete mode 100644 apps/leaf-dioxus-tui/src/window.rs

diff --git a/apps/leaf-dioxus-tui/Cargo.lock b/apps/leaf-dioxus-tui/Cargo.lock
index 6ba74c15..bf587ab9 100644
--- a/apps/leaf-dioxus-tui/Cargo.lock
+++ b/apps/leaf-dioxus-tui/Cargo.lock
@@ -176,7 +176,7 @@ dependencies = [
  "objc2-foundation",
  "parking_lot",
  "percent-encoding",
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
  "x11rb",
 ]
 
@@ -321,7 +321,7 @@ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
 [[package]]
 name = "blitz-dom"
 version = "0.3.0-beta.4"
-source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95"
+source = "git+https://github.com/diaryx-org/blitz?branch=tui#f4595f39fbfd201aaad006887c19e2251321fd2e"
 dependencies = [
  "accesskit",
  "anyrender",
@@ -370,7 +370,7 @@ dependencies = [
 [[package]]
 name = "blitz-net"
 version = "0.3.0-beta.4"
-source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95"
+source = "git+https://github.com/diaryx-org/blitz?branch=tui#f4595f39fbfd201aaad006887c19e2251321fd2e"
 dependencies = [
  "blitz-traits",
  "data-url",
@@ -382,7 +382,7 @@ dependencies = [
 [[package]]
 name = "blitz-paint"
 version = "0.3.0-beta.4"
-source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95"
+source = "git+https://github.com/diaryx-org/blitz?branch=tui#f4595f39fbfd201aaad006887c19e2251321fd2e"
 dependencies = [
  "anyrender",
  "anyrender_svg",
@@ -404,7 +404,7 @@ dependencies = [
 [[package]]
 name = "blitz-shell"
 version = "0.3.0-beta.4"
-source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95"
+source = "git+https://github.com/diaryx-org/blitz?branch=tui#f4595f39fbfd201aaad006887c19e2251321fd2e"
 dependencies = [
  "android-activity",
  "anyrender",
@@ -423,7 +423,7 @@ dependencies = [
 [[package]]
 name = "blitz-traits"
 version = "0.3.0-beta.4"
-source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95"
+source = "git+https://github.com/diaryx-org/blitz?branch=tui#f4595f39fbfd201aaad006887c19e2251321fd2e"
 dependencies = [
  "atomic_refcell",
  "bitflags 2.13.2",
@@ -436,6 +436,31 @@ dependencies = [
  "url",
 ]
 
+[[package]]
+name = "blitz-tui"
+version = "0.3.0-beta.4"
+source = "git+https://github.com/diaryx-org/blitz?branch=tui#f4595f39fbfd201aaad006887c19e2251321fd2e"
+dependencies = [
+ "blitz-dom",
+ "blitz-traits",
+ "crossterm",
+ "image",
+ "keyboard-types",
+ "parley",
+ "ratatui",
+ "ratatui-image",
+ "raw-window-handle",
+ "resvg 0.48.1",
+ "smol_str",
+ "stylo",
+ "taffy",
+ "terminal-colorsaurus",
+ "unicode-segmentation",
+ "unicode-width 0.2.0",
+ "usvg 0.48.1",
+ "winit",
+]
+
 [[package]]
 name = "block-buffer"
 version = "0.12.1"
@@ -971,7 +996,7 @@ checksum = "be1e0bca6c3637f992fc1cc7cbc52a78c1ef6db076dbf1059c4323d6a2048376"
 [[package]]
 name = "debug_timer"
 version = "0.1.3"
-source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95"
+source = "git+https://github.com/diaryx-org/blitz?branch=tui#f4595f39fbfd201aaad006887c19e2251321fd2e"
 
 [[package]]
 name = "derive_more"
@@ -1415,7 +1440,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
 dependencies = [
  "libc",
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
 ]
 
 [[package]]
@@ -1823,7 +1848,7 @@ dependencies = [
  "log",
  "presser",
  "thiserror 2.0.21",
- "windows 0.62.2",
+ "windows 0.58.0",
 ]
 
 [[package]]
@@ -2560,6 +2585,7 @@ dependencies = [
  "anyhow",
  "blitz-dom",
  "blitz-traits",
+ "blitz-tui",
  "crossterm",
  "dioxus",
  "dioxus-core",
@@ -2568,16 +2594,7 @@ dependencies = [
  "leaf-dioxus",
  "leaf-raster",
  "libc",
- "parley",
- "ratatui",
- "ratatui-image",
- "raw-window-handle",
- "stylo",
- "taffy",
- "terminal-colorsaurus",
  "tokio",
- "unicode-segmentation",
- "unicode-width 0.2.0",
  "unit",
 ]
 
@@ -2604,7 +2621,7 @@ version = "0.5.1"
 dependencies = [
  "cosmic-text",
  "image",
- "resvg",
+ "resvg 0.46.0",
 ]
 
 [[package]]
@@ -4050,6 +4067,21 @@ dependencies = [
  "zune-jpeg",
 ]
 
+[[package]]
+name = "resvg"
+version = "0.48.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67e3803f97b999e80cbf7c6ecdd07a8102204d92e1633cf48783720c521196bd"
+dependencies = [
+ "bytemuck",
+ "log",
+ "pico-args",
+ "rgb",
+ "svgtypes",
+ "tiny-skia 0.12.0",
+ "usvg 0.48.1",
+]
+
 [[package]]
 name = "rgb"
 version = "0.8.53"
@@ -4153,7 +4185,7 @@ dependencies = [
  "errno",
  "libc",
  "linux-raw-sys 0.12.1",
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
 ]
 
 [[package]]
@@ -4775,7 +4807,7 @@ dependencies = [
 [[package]]
 name = "stylo_taffy"
 version = "0.3.0-beta.4"
-source = "git+https://github.com/diaryx-org/blitz?branch=leaf#d78620c598e07a51050f8e700620df8778470c95"
+source = "git+https://github.com/diaryx-org/blitz?branch=tui#f4595f39fbfd201aaad006887c19e2251321fd2e"
 dependencies = [
  "bitflags 2.13.2",
  "stylo",
@@ -4855,7 +4887,7 @@ version = "0.2.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e"
 dependencies = [
- "skrifa 0.44.0",
+ "skrifa 0.40.0",
  "yazi",
  "zeno",
 ]
@@ -4972,7 +5004,7 @@ dependencies = [
  "getrandom 0.4.3",
  "once_cell",
  "rustix 1.1.5",
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
 ]
 
 [[package]]
@@ -5114,6 +5146,7 @@ dependencies = [
  "bytemuck",
  "cfg-if",
  "log",
+ "png 0.18.1",
  "tiny-skia-path 0.12.0",
 ]
 
@@ -6428,7 +6461,7 @@ version = "0.1.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
 dependencies = [
- "windows-sys 0.61.2",
+ "windows-sys 0.59.0",
 ]
 
 [[package]]
diff --git a/apps/leaf-dioxus-tui/Cargo.toml b/apps/leaf-dioxus-tui/Cargo.toml
index a03e1f53..a7ea54f4 100644
--- a/apps/leaf-dioxus-tui/Cargo.toml
+++ b/apps/leaf-dioxus-tui/Cargo.toml
@@ -1,9 +1,10 @@
 # A prototype: the leaf-dioxus editor (crates/leaf-dioxus), the same
 # component the Mac app draws with Blitz on wgpu, drawn in a terminal instead.
-# Blitz still builds the DOM, resolves the styles and lays the page out; a
-# painter here walks the laid-out tree and writes character cells where
-# blitz-paint would draw pixels. Its own workspace for apps/leaf-dioxus's
-# reason: dioxus-native is an alpha, and the Blitz fork is reached by [patch].
+# Blitz still builds the DOM, resolves the styles and lays the page out;
+# blitz-tui, in the Blitz fork, walks the laid-out tree and writes character
+# cells where blitz-paint would draw pixels. Its own workspace for
+# apps/leaf-dioxus's reason: dioxus-native is an alpha, and the Blitz fork is
+# reached by [patch].
 #
 #     cargo run --manifest-path apps/leaf-dioxus-tui/Cargo.toml -- document.md
 [workspace]
@@ -34,29 +35,20 @@ dioxus-native = { version = "0.8.0-alpha.3", default-features = false, features
 dioxus-core = "=0.8.0-alpha.3"
 blitz-dom = { version = "=0.3.0-beta.4", default-features = false }
 blitz-traits = "=0.3.0-beta.4"
-parley = "=0.12.0"
-# The terminal: ratatui's cell buffer and its diff, on crossterm — the
-# versions leaf-tui uses, which ratatui-image 9 is built for.
+# The painter, the terminal and its input: Blitz's page as character cells,
+# pictures through the graphics protocol. On the fork's `tui` branch, until
+# it merges into `leaf`.
+blitz-tui = { git = "https://github.com/diaryx-org/blitz", branch = "tui", features = ["winit"] }
+# The terminal's events, as blitz-tui reads them.
 crossterm = "0.28"
-ratatui = "0.29"
-# Pictures, formulas and diagrams through kitty, iTerm2 or sixel, or
-# half-blocks; decoded and rasterised by leaf-raster, as leaf-tui does.
-ratatui-image = { version = "9", default-features = false, features = ["crossterm"] }
+# Pictures, formulas and diagrams decoded and rasterised by leaf-raster, as
+# leaf-tui does, for blitz-tui to draw.
 leaf-raster = { path = "../../crates/leaf-raster" }
 # The menus and dialogs round the editor, as the Mac app draws them. On its
 # `dioxus-tui` branch, which adds the cell density, until that merges.
-# "Is this terminal dark or light?", asked as leaf-tui asks it.
-terminal-colorsaurus = "1"
 unit = { git = "https://github.com/diaryx-org/unit", branch = "dioxus-tui" }
-raw-window-handle = "0.6"
 anyhow = "1"
 libc = "0.2"
-# Stylo's computed values, read for each box's colours and borders, and the
-# taffy layout Blitz puts on each node: the versions the Blitz fork uses.
-style = { version = "0.22.0", package = "stylo" }
-taffy = { version = "0.15", default-features = false, features = ["std"] }
-unicode-width = "0.2"
-unicode-segmentation = "1.13"
 # The editor's timers.
 tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "time"] }
 
@@ -67,13 +59,13 @@ debug = "line-tables-only"
 [profile.dev.package."*"]
 opt-level = 3
 
-# The Blitz fork, as apps/leaf-dioxus takes it: every Blitz crate from one
-# source, or the graph holds two copies.
+# The Blitz fork, every Blitz crate from one source, or the graph holds two
+# copies. The `tui` branch: `leaf`, and blitz-tui on it.
 [patch.crates-io]
-blitz-dom = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" }
-blitz-traits = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" }
-blitz-shell = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" }
-blitz-paint = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" }
-blitz-net = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" }
-stylo_taffy = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" }
-debug_timer = { git = "https://github.com/diaryx-org/blitz", branch = "leaf" }
+blitz-dom = { git = "https://github.com/diaryx-org/blitz", branch = "tui" }
+blitz-traits = { git = "https://github.com/diaryx-org/blitz", branch = "tui" }
+blitz-shell = { git = "https://github.com/diaryx-org/blitz", branch = "tui" }
+blitz-paint = { git = "https://github.com/diaryx-org/blitz", branch = "tui" }
+blitz-net = { git = "https://github.com/diaryx-org/blitz", branch = "tui" }
+stylo_taffy = { git = "https://github.com/diaryx-org/blitz", branch = "tui" }
+debug_timer = { git = "https://github.com/diaryx-org/blitz", branch = "tui" }
diff --git a/apps/leaf-dioxus-tui/README.md b/apps/leaf-dioxus-tui/README.md
index 5de7c48a..83db2097 100644
--- a/apps/leaf-dioxus-tui/README.md
+++ b/apps/leaf-dioxus-tui/README.md
@@ -3,8 +3,10 @@
 A prototype: the leaf-dioxus editor (`crates/leaf-dioxus`), the component the
 Mac app draws, drawn in a terminal, with unit's menus and dialogs round it as
 the Mac app has them. Blitz builds the DOM, resolves the styles and lays the
-page out as it does for a window; `src/paint.rs` walks the laid-out tree and
-writes character cells where blitz-paint would draw pixels.
+page out as it does for a window; blitz-tui, a package in the Blitz fork
+(`diaryx-org/blitz`, branch `tui`), walks the laid-out tree and writes
+character cells where blitz-paint would draw pixels. This app is what leaf
+adds to it.
 
 ```sh
 cargo run --manifest-path apps/leaf-dioxus-tui/Cargo.toml -- document.md
@@ -30,23 +32,29 @@ would take: [the proposal](../../docs/proposals/the-leaf-dioxus-editor-in-a-term
 
 ## How it fits together
 
-- `window.rs`: a winit `Window` that is the terminal, as `apps/leaf-dioxus`'s
-  `offscreen.rs` is a sheet. The editor asks it for size, scale and theme.
+From blitz-tui: the painter, the terminal (cells, and pictures through the
+graphics protocol), the terminal's keys and mouse as Blitz's events, and
+`TermWindow`, a winit `Window` that is the terminal, as `apps/leaf-dioxus`'s
+`offscreen.rs` is a sheet; the editor asks it for size, scale and theme.
+Here:
+
 - `main.rs`: the document is `DioxusDocument::new` with no window, as
   `apps/leaf-dioxus/src/headless.rs` builds one for tests. Every key goes to
   unit first, then to the command menu and Quit, then to `Editor::key`; the
   mouse goes to Blitz as pointer events, the wheel to `Editor::scroll`. Each
   turn is a poll and a `resolve`, then a paint.
-- `paint.rs`: the cell painter. A cell is one advance of a monospace face
-  (Menlo, 16px) wide and one line (1.5 leading, 24px) high, and the editor's
-  `Type::uniform` sets every run at that size, so the editor's own parley
-  layout counts in cells without knowing it.
-- `pictures.rs`: pictures, formulas and diagrams through the terminal's
-  graphics protocol (ratatui-image), over the cells of their boxes.
+  A cell is one advance of a monospace face (Menlo, 16px) wide and one line
+  (1.5 leading, 24px) high, and the editor's `Type::uniform` sets every run
+  at that size, so the editor's own parley layout counts in cells without
+  knowing it. The editor's caret and unit's are named to the painter by
+  class, and become the terminal's cursor.
+- `pictures.rs`: pictures, formulas and diagrams read by leaf-raster, as
+  leaf-tui reads them, for blitz-tui to draw.
 - `chrome.rs` and `commands.rs`: unit's root in its cell density
   (`Density::Cell`), the context menu, the command menu built from one
   command table, the Link prompt, and the question before quitting.
 - `files.rs`: Save and Save As, the question before a save writes over a
   file changed on disk, and the watch that reloads a clean document — leaf-tui's
   rules, over the same leaf-core calls.
-- `term.rs`: crossterm and ratatui. A frame is written as the cells that changed.
+- `term.rs`: the editor's keys (⌃ as ⌘ on macOS, ⌃K kept), the theme in
+  leaf-tui's order, and clicks shifted onto the editor's text.
diff --git a/apps/leaf-dioxus-tui/src/main.rs b/apps/leaf-dioxus-tui/src/main.rs
index 86f8926c..737cf925 100644
--- a/apps/leaf-dioxus-tui/src/main.rs
+++ b/apps/leaf-dioxus-tui/src/main.rs
@@ -4,7 +4,8 @@
 //! window: a [`TermWindow`] answers its questions about size and theme, the
 //! terminal's keys are handed to [`Editor::key`] as the app hands winit's,
 //! clicks and the wheel go to Blitz as pointer events, and each turn the page
-//! is resolved and painted into cells ([`paint`]) instead of pixels.
+//! is resolved and painted into cells (blitz-tui's `paint`) instead of
+//! pixels.
 //!
 //! The text is set in one monospace face at a size whose advance is one cell
 //! wide, and a cell is that advance by one line high, so the editor's own
@@ -22,10 +23,8 @@
 mod chrome;
 mod commands;
 mod files;
-mod paint;
 mod pictures;
 mod term;
-mod window;
 
 use std::cell::RefCell;
 use std::path::PathBuf;
@@ -49,8 +48,7 @@ use unit::{Density, Keys, Theme, UnitRoot, use_unit};
 use crate::chrome::{Pending, TermHost};
 use crate::commands::Command;
 
-use crate::paint::Metrics;
-use crate::window::TermWindow;
+use blitz_tui::{Metrics, PaintOptions, TermWindow};
 
 /// The face every cell is set in, and its size in CSS pixels.
 const FACE: &str = "Menlo, \"DejaVu Sans Mono\", monospace";
@@ -157,29 +155,20 @@ fn KeepUnit() -> Element {
     rsx! {}
 }
 
-/// One cell's size: the face's advance, and the line box.
-fn metrics() -> Metrics {
-    use parley::{FontContext, LayoutContext, StyleProperty};
-    let mut fcx = FontContext::default();
-    let mut lcx: LayoutContext<()> = LayoutContext::new();
-    let probe = "0".repeat(100);
-    let mut b = lcx.ranged_builder(&mut fcx, &probe, 1.0, true);
-    b.push_default(StyleProperty::FontFamily(parley::FontFamily::Source(
-        FACE.into(),
-    )));
-    b.push_default(StyleProperty::FontSize(SIZE));
-    let mut layout = b.build(&probe);
-    layout.break_all_lines(None);
-    Metrics {
-        cw: layout.width() / 100.0,
-        ch: SIZE * LEADING,
-    }
+/// How the page is painted: a cell of the editor's face, and the carets
+/// that are the terminal's cursor — the editor's `.caret-in` and unit's
+/// `.unit-caret` in a dialog's field.
+fn paint_options() -> PaintOptions {
+    let mut opts = PaintOptions::new(Metrics::measure(FACE, SIZE, LEADING));
+    opts.cursor_classes = vec!["caret-in".into(), "unit-caret".into()];
+    opts
 }
 
 struct Session {
     doc: DioxusDocument,
     window: Arc,
     watch: RefCell,
+    look: PaintOptions,
     m: Metrics,
     cols: u16,
     rows: u16,
@@ -196,8 +185,9 @@ impl Session {
         }
         let watch = RefCell::new(files::Watch::new(&source));
         DOC.with_borrow_mut(|d| *d = Some(Rc::new(RefCell::new(source))));
-        let m = metrics();
-        let (w, h) = px(m, cols, rows);
+        let look = paint_options();
+        let m = look.metrics;
+        let (w, h) = m.px(cols, rows);
         let window = Arc::new(TermWindow::new(w, h, term::dark()));
         let as_dyn: Arc = window.clone();
         let mut doc = DioxusDocument::new(VirtualDom::new(App), DocumentConfig::default());
@@ -213,6 +203,7 @@ impl Session {
             doc,
             window,
             watch,
+            look,
             m,
             cols,
             rows,
@@ -248,7 +239,7 @@ impl Session {
     fn resize(&mut self, cols: u16, rows: u16) {
         self.cols = cols;
         self.rows = rows;
-        let (w, h) = px(self.m, cols, rows);
+        let (w, h) = self.m.px(cols, rows);
         self.window.resize(w, h);
         self.doc.inner.borrow_mut().set_viewport(viewport(w, h));
         self.with_editor(|ed| ed.resize(w, h));
@@ -397,8 +388,13 @@ impl Session {
         changed
     }
 
-    fn paint(&self) -> paint::Grid {
-        paint::paint(&self.doc.inner.borrow(), self.m, self.cols, self.rows)
+    fn paint(&self) -> blitz_tui::Grid {
+        blitz_tui::paint(&self.doc.inner.borrow(), &self.look, self.cols, self.rows)
+    }
+
+    fn draw(&self, out: &mut blitz_tui::Terminal, grid: &blitz_tui::Grid) -> Result<()> {
+        out.draw(grid, &self.doc.inner.borrow())?;
+        Ok(())
     }
 }
 
@@ -427,13 +423,6 @@ fn editor() -> Option {
     EDITOR.with_borrow(|e| e.clone())
 }
 
-fn px(m: Metrics, cols: u16, rows: u16) -> (u32, u32) {
-    (
-        (cols as f32 * m.cw).round() as u32,
-        (rows as f32 * m.ch).round() as u32,
-    )
-}
-
 fn viewport(w: u32, h: u32) -> Viewport {
     let scheme = if term::dark() {
         ColorScheme::Dark
@@ -504,7 +493,7 @@ fn main() -> Result<()> {
     term::ask_theme();
     let (cols, rows) = crossterm::terminal::size()?;
     let mut s = Session::new(path, cols, rows)?;
-    let mut out = term::Terminal::enter()?;
+    let mut out = term::enter()?;
     let result = run(&mut s, &mut out);
     out.leave()?;
     result
@@ -524,9 +513,9 @@ fn quiet_stderr() {
     }
 }
 
-fn run(s: &mut Session, out: &mut term::Terminal) -> Result<()> {
+fn run(s: &mut Session, out: &mut blitz_tui::Terminal) -> Result<()> {
     let mut grid = s.paint();
-    out.draw(&grid)?;
+    s.draw(out, &grid)?;
     loop {
         let mut acted = false;
         if event::poll(Duration::from_millis(50))? {
@@ -607,7 +596,7 @@ fn run(s: &mut Session, out: &mut term::Terminal) -> Result<()> {
             let next = s.paint();
             trace(|| format!("frame: settle {:.1?} paint {:.1?}", t1 - t0, t1.elapsed()));
             if next != grid {
-                out.draw(&next)?;
+                s.draw(out, &next)?;
                 grid = next;
             }
         }
diff --git a/apps/leaf-dioxus-tui/src/paint.rs b/apps/leaf-dioxus-tui/src/paint.rs
deleted file mode 100644
index 064e2411..00000000
--- a/apps/leaf-dioxus-tui/src/paint.rs
+++ /dev/null
@@ -1,825 +0,0 @@
-//! Blitz's laid-out page, painted into character cells.
-//!
-//! The walk is blitz-paint's (`render.rs`'s `render_element` and
-//! `draw_children`): each element's box at its parent's origin plus its
-//! taffy location, its children shifted back by its scroll, hoisted children
-//! placed by their stacking context, and text read off the parley layout of
-//! each inline root. What differs is the surface: a box's background fills
-//! the cells whose centres it covers, a border is a line of box-drawing
-//! characters, and a glyph cluster is written into the cell its left edge
-//! rounds to. With a monospace face whose advance is [`Metrics::cw`], every
-//! glyph lands in a cell of its own.
-//!
-//! The elements read by name are the carets — the editor's `.caret-in`, a
-//! zero-width box with a 2px border, and unit's `.unit-caret` in a dialog's
-//! field, a 1px box: drawn as cells either would be nothing or a whole
-//! column, so each becomes the terminal's own cursor instead, the one
-//! painted last (a dialog's, over the editor) winning.
-
-use std::collections::HashMap;
-
-use blitz_dom::{BaseDocument, Node, NodeData, NodeId};
-use parley::PositionedLayoutItem;
-use style::color::AbsoluteColor;
-use style::computed_values::visibility::T as Visibility;
-use style::properties::ComputedValues;
-use style::values::computed::Overflow;
-use unicode_width::UnicodeWidthStr;
-
-/// One character cell, in CSS pixels.
-#[derive(Clone, Copy, Debug)]
-pub struct Metrics {
-    pub cw: f32,
-    pub ch: f32,
-}
-
-pub type Rgb = (u8, u8, u8);
-
-#[derive(Clone, Debug, PartialEq)]
-pub struct Cell {
-    /// The cluster, or `""` for the second half of a wide one.
-    pub text: String,
-    pub fg: Rgb,
-    pub bg: Rgb,
-    pub bold: bool,
-    pub italic: bool,
-    pub underline: bool,
-}
-
-impl Cell {
-    fn blank(fg: Rgb, bg: Rgb) -> Self {
-        Self {
-            text: " ".into(),
-            fg,
-            bg,
-            bold: false,
-            italic: false,
-            underline: false,
-        }
-    }
-}
-
-#[derive(Clone, Debug, PartialEq)]
-pub struct Grid {
-    pub cols: u16,
-    pub rows: u16,
-    pub cells: Vec,
-    /// Where the caret is, if it is on screen.
-    pub cursor: Option<(u16, u16)>,
-    /// The pictures, formulas and diagrams, for `pictures.rs` to paint over
-    /// the frames drawn for them.
-    pub pictures: Vec,
-}
-
-/// An `img`'s box in cells. Its whole box, which may run off the screen,
-/// and the part of it in view: a rectangle, since a graphics-protocol
-/// picture is one, cut back by whatever opaque box was drawn over it later
-/// — a menu, a dialog, the status line ([`Picture::cover`]).
-#[derive(Clone, Debug, PartialEq)]
-pub struct Picture {
-    pub src: String,
-    pub col: i32,
-    pub row: i32,
-    pub cols: u16,
-    pub rows: u16,
-    /// The rows in view, `top..bottom`; empty when none is.
-    pub shown: (i32, i32),
-    /// The columns in view, `left..right`.
-    pub shown_cols: (i32, i32),
-}
-
-impl Picture {
-    /// An opaque box over cells `c0..c1` × `r0..r1`, drawn after the
-    /// picture, covers it there. Cells are drawn under a graphics-protocol
-    /// picture, never over it, so the picture keeps the largest rectangle the
-    /// box leaves uncovered — above it, below it, or to either side — and
-    /// what the box covers shows the box.
-    pub fn cover(&mut self, c0: i32, c1: i32, r0: i32, r1: i32) {
-        let (top, bottom) = self.shown;
-        let (left, right) = self.shown_cols;
-        if c1 <= left || c0 >= right || r1 <= top || r0 >= bottom {
-            return;
-        }
-        let rest = [
-            (left, right, top, r0),
-            (left, right, r1, bottom),
-            (left, c0, top, bottom),
-            (c1, right, top, bottom),
-        ];
-        let area = |&(l, r, t, b): &(i32, i32, i32, i32)| (r - l).max(0) * (b - t).max(0);
-        let best = rest
-            .iter()
-            .max_by_key(|x| area(x))
-            .copied()
-            .unwrap_or_default();
-        if area(&best) == 0 {
-            self.shown = (top, top);
-            self.shown_cols = (left, left);
-        } else {
-            self.shown_cols = (best.0, best.1);
-            self.shown = (best.2, best.3);
-        }
-    }
-}
-
-impl Grid {
-    pub fn new(cols: u16, rows: u16, fg: Rgb, bg: Rgb) -> Self {
-        Self {
-            cols,
-            rows,
-            cells: vec![Cell::blank(fg, bg); cols as usize * rows as usize],
-            cursor: None,
-            pictures: Vec::new(),
-        }
-    }
-
-    pub fn get(&self, c: u16, r: u16) -> &Cell {
-        &self.cells[r as usize * self.cols as usize + c as usize]
-    }
-
-    fn at(&mut self, c: i32, r: i32) -> Option<&mut Cell> {
-        if c < 0 || r < 0 || c >= self.cols as i32 || r >= self.rows as i32 {
-            return None;
-        }
-        Some(&mut self.cells[r as usize * self.cols as usize + c as usize])
-    }
-
-    /// The grid's text, a line per row, trailing spaces dropped, and `▏`
-    /// before the cell the caret is in.
-    pub fn text(&self) -> String {
-        let mut out = String::new();
-        for r in 0..self.rows {
-            let mut line = String::new();
-            for c in 0..self.cols {
-                if self.cursor == Some((c, r)) {
-                    line.push('▏');
-                }
-                line.push_str(&self.get(c, r).text);
-            }
-            out.push_str(line.trim_end());
-            out.push('\n');
-        }
-        out
-    }
-}
-
-impl Grid {
-    /// The grid as an HTML `
`, each cell in its colours, the caret's
-    /// cell outlined.
-    pub fn html(&self) -> String {
-        let esc = |t: &str| {
-            t.replace('&', "&")
-                .replace('<', "<")
-                .replace('>', ">")
-        };
-        let hex = |(r, g, b): Rgb| format!("#{r:02x}{g:02x}{b:02x}");
-        let mut out = String::from(
-            "
",
-        );
-        for r in 0..self.rows {
-            // Cells of one style go in one span.
-            let mut run: Option<(String, String)> = None;
-            for c in 0..self.cols {
-                let cell = self.get(c, r);
-                if cell.text.is_empty() {
-                    continue;
-                }
-                let mut style = format!("color:{};background:{}", hex(cell.fg), hex(cell.bg));
-                if cell.bold {
-                    style.push_str(";font-weight:bold");
-                }
-                if cell.italic {
-                    style.push_str(";font-style:italic");
-                }
-                if cell.underline {
-                    style.push_str(";text-decoration:underline");
-                }
-                if self.cursor == Some((c, r)) {
-                    style.push_str(";box-shadow:inset 2px 0 #4a9eff");
-                }
-                match &mut run {
-                    Some((st, text)) if *st == style => text.push_str(&cell.text),
-                    _ => {
-                        if let Some((st, text)) = run.take() {
-                            out.push_str(&format!("{}", esc(&text)));
-                        }
-                        run = Some((style, cell.text.clone()));
-                    }
-                }
-            }
-            if let Some((st, text)) = run {
-                out.push_str(&format!("{}", esc(&text)));
-            }
-            out.push('\n');
-        }
-        out.push_str("
"); - out - } -} - -/// A rectangle in CSS pixels: what a box covers, or what may be drawn on. -#[derive(Clone, Copy, Debug)] -struct Rect { - x0: f32, - y0: f32, - x1: f32, - y1: f32, -} - -impl Rect { - fn intersect(self, o: Rect) -> Rect { - Rect { - x0: self.x0.max(o.x0), - y0: self.y0.max(o.y0), - x1: self.x1.min(o.x1), - y1: self.y1.min(o.y1), - } - } - fn contains(&self, x: f32, y: f32) -> bool { - x >= self.x0 && x < self.x1 && y >= self.y0 && y < self.y1 - } -} - -struct Painter<'a> { - doc: &'a BaseDocument, - m: Metrics, - grid: &'a mut Grid, - root: NodeId, - /// Where each inline box's line put it: its cell and its width in pixels. - inline_cells: HashMap, -} - -/// Paint `doc`, already resolved, into a fresh grid of `cols` × `rows`. -pub fn paint(doc: &BaseDocument, m: Metrics, cols: u16, rows: u16) -> Grid { - let (fg, bg) = page_colors(doc); - let mut grid = Grid::new(cols, rows, fg, bg); - let Some(root) = doc.try_root_element() else { - return grid; - }; - let scroll = doc.viewport_scroll(); - let clip = Rect { - x0: 0.0, - y0: 0.0, - x1: cols as f32 * m.cw, - y1: rows as f32 * m.ch, - }; - let mut p = Painter { - doc, - m, - grid: &mut grid, - root: root.id, - inline_cells: HashMap::new(), - }; - p.element(root.id, (-scroll.x as f32, -scroll.y as f32), clip); - grid -} - -/// The page's colour and background: `html`'s, else `body`'s, as -/// blitz-paint picks the canvas colour. -fn page_colors(doc: &BaseDocument) -> (Rgb, Rgb) { - let mut fg = (220, 220, 220); - let mut bg = (0, 0, 0); - let Some(root) = doc.try_root_element() else { - return (fg, bg); - }; - let body = root - .children - .iter() - .filter_map(|id| doc.get_node(*id)) - .find(|n| { - n.data - .is_element_with_tag_name(&blitz_dom::local_name!("body")) - }); - for node in [Some(root), body].into_iter().flatten() { - if let Some(s) = node.primary_styles() { - let cc = s.clone_color(); - fg = rgb(&cc).0; - let (b, a) = rgb(&s.clone_background_color().resolve_to_absolute(&cc)); - if a > 0.5 { - bg = b; - } - } - } - (fg, bg) -} - -fn rgb(c: &AbsoluteColor) -> (Rgb, f32) { - let [r, g, b, a] = *c - .to_color_space(style::color::ColorSpace::Srgb) - .raw_components(); - let q = |v: f32| (v.clamp(0.0, 1.0) * 255.0).round() as u8; - ((q(r), q(g), q(b)), a) -} - -fn blend(over: Rgb, a: f32, under: Rgb) -> Rgb { - let m = |o: u8, u: u8| (o as f32 * a + u as f32 * (1.0 - a)).round() as u8; - (m(over.0, under.0), m(over.1, under.1), m(over.2, under.2)) -} - -impl Painter<'_> { - fn node(&self, id: NodeId) -> &Node { - &self.doc.tree()[id] - } - - fn render(&mut self, id: NodeId, origin: (f32, f32), clip: Rect) { - match &self.node(id).data { - NodeData::Element(_) | NodeData::AnonymousBlock(_) => self.element(id, origin, clip), - _ => {} - } - } - - fn element(&mut self, id: NodeId, origin: (f32, f32), clip: Rect) { - let doc = self.doc; - let node = &doc.tree()[id]; - if matches!(node.taffy_display(), taffy::Display::None) { - return; - } - let Some(styles) = node.primary_styles() else { - return; - }; - let styles: &ComputedValues = &styles; - if styles.get_inherited_box().visibility != Visibility::Visible - || styles.get_effects().opacity == 0.0 - { - return; - } - let l = node.final_layout(); - let x = origin.0 + l.location.x; - let y = origin.1 + l.location.y; - let bbox = Rect { - x0: x, - y0: y, - x1: x + l.size.width, - y1: y + l.size.height, - }; - - if node.attr(blitz_dom::local_name!("class")).is_some_and(|c| { - c.split_ascii_whitespace() - .any(|c| c == "caret-in" || c == "unit-caret") - }) { - let (cx, cy) = (x, y + l.size.height / 2.0); - if clip.contains(cx, cy) { - let (c, r) = match self.inline_cells.get(&id) { - Some(&(c, r, _)) => (c, r), - None => ( - (cx / self.m.cw).round() as i32, - (cy / self.m.ch).floor() as i32, - ), - }; - if c >= 0 && r >= 0 && c < self.grid.cols as i32 && r < self.grid.rows as i32 { - self.grid.cursor = Some((c as u16, r as u16)); - } - } - return; - } - - self.background(styles, bbox.intersect(clip)); - if node - .data - .is_element_with_tag_name(&blitz_dom::local_name!("img")) - { - let src = node.attr(blitz_dom::local_name!("src")).unwrap_or(""); - // A file by its name; a formula or diagram (an SVG `data:` URL) - // by its alt text, if it has one. - let name = match src.strip_prefix("data:") { - Some(_) => node - .attr(blitz_dom::local_name!("alt")) - .unwrap_or("picture"), - None => src.rsplit('/').next().unwrap_or(src), - }; - let fg = rgb(&styles.clone_color()).0; - self.frame(bbox, clip, fg, &format!("🖼 {name}")); - self.picture(src, bbox, clip); - } - - let ov = styles.get_box(); - let clips = !matches!(ov.overflow_x, Overflow::Visible) - || !matches!(ov.overflow_y, Overflow::Visible); - let pb_left = l.padding.left + l.border.left; - let pb_top = l.padding.top + l.border.top; - let inner_clip = if clips { - clip.intersect(Rect { - x0: x + l.border.left, - y0: y + l.border.top, - x1: bbox.x1 - l.border.right, - y1: bbox.y1 - l.border.bottom, - }) - } else { - clip - }; - let scroll = node.scroll_offset(); - let (sx, sy) = (scroll.x as f32, scroll.y as f32); - - if node.flags.is_inline_root() - && let Some(tl) = node - .element_data() - .and_then(|e| e.inline_layout_data.as_ref()) - { - let tx = x + pb_left - sx; - let ty = y + pb_top - sy + tl.block_offset; - self.text(tl, (tx, ty), inner_clip); - } - - // Children draw from this box's origin, less its scroll. - let base = (x - sx, y - sy); - let scroll_v = doc.viewport_scroll(); - if let Some(sc) = &node.stacking_context { - for h in sc.neg_z_hoisted_children() { - let p = h.position(node.tree(), id); - self.render(h.node_id, (base.0 + p.x, base.1 + p.y), inner_clip); - } - } - let kids: Vec = match &*node.paint_children.borrow() { - Some(k) => k.iter().copied().collect(), - None => Vec::new(), - }; - for kid in kids { - let fixed = - self.node(kid).taffy_position() == taffy::Position::Fixed && id == self.root; - let o = if fixed { - (base.0 + scroll_v.x as f32, base.1 + scroll_v.y as f32) - } else { - base - }; - self.render(kid, o, inner_clip); - } - if let Some(sc) = &node.stacking_context { - for h in sc.pos_z_hoisted_children() { - let p = h.position(node.tree(), id); - self.render(h.node_id, (base.0 + p.x, base.1 + p.y), inner_clip); - } - } - // The border last, over the children: in pixels a child stays inside - // its parent's border, but rounded to cells a child's background can - // reach the border's cells — a menu's highlighted item would rub out - // the menu's sides. - if l.border.left + l.border.right + l.border.top + l.border.bottom > 0.0 { - self.borders(styles, bbox, l, clip); - } - } - - /// Record an `img` at `b`, drawn to cells as [`Self::frame`] does. - fn picture(&mut self, src: &str, b: Rect, clip: Rect) { - let m = self.m; - let col = (b.x0 / m.cw).round() as i32; - let row = (b.y0 / m.ch).round() as i32; - let cols = ((b.x1 / m.cw).round() as i32 - col).max(1); - let rows = ((b.y1 / m.ch).round() as i32 - row).max(1); - let top = row.max((clip.y0 / m.ch).round() as i32).max(0); - let bottom = (row + rows) - .min((clip.y1 / m.ch).round() as i32) - .min(self.grid.rows as i32); - let left = col.max((clip.x0 / m.cw).round() as i32).max(0); - let right = (col + cols) - .min((clip.x1 / m.cw).round() as i32) - .min(self.grid.cols as i32); - self.grid.pictures.push(Picture { - src: src.to_string(), - col, - row, - cols: cols as u16, - rows: rows as u16, - shown: (top, bottom.max(top)), - shown_cols: (left, right.max(left)), - }); - } - - /// A placeholder for what cells cannot show: a box drawn round `b`, - /// `label` on its top edge. - fn frame(&mut self, b: Rect, clip: Rect, fg: Rgb, label: &str) { - let m = self.m; - let c0 = (b.x0 / m.cw).round() as i32; - let c1 = ((b.x1 / m.cw).round() as i32 - 1).max(c0); - let r0 = (b.y0 / m.ch).round() as i32; - let r1 = ((b.y1 / m.ch).round() as i32 - 1).max(r0); - let visible = - |c: i32, r: i32| clip.contains((c as f32 + 0.5) * m.cw, (r as f32 + 0.5) * m.ch); - for r in r0..=r1 { - for c in c0..=c1 { - let ch = match (r == r0, r == r1, c == c0, c == c1) { - (true, _, true, _) => "╭", - (true, _, _, true) => "╮", - (_, true, true, _) => "╰", - (_, true, _, true) => "╯", - (true, _, _, _) | (_, true, _, _) => "─", - (_, _, true, _) | (_, _, _, true) => "│", - _ => continue, - }; - if visible(c, r) - && let Some(cell) = self.grid.at(c, r) - { - cell.text = ch.into(); - cell.fg = fg; - } - } - } - let mut c = c0 + 2; - for g in unicode_segmentation::UnicodeSegmentation::graphemes(label, true) { - let w = UnicodeWidthStr::width(g).max(1) as i32; - if c + w > c1 - 1 { - break; - } - if visible(c, r0) { - if let Some(cell) = self.grid.at(c, r0) { - cell.text = g.into(); - cell.fg = fg; - } - if w == 2 - && let Some(next) = self.grid.at(c + 1, r0) - { - next.text = String::new(); - } - } - c += w; - } - } - - /// Fill the cells whose centres `area` covers. - fn background(&mut self, styles: &ComputedValues, area: Rect) { - let cc = styles.clone_color(); - let (c, a) = rgb(&styles.clone_background_color().resolve_to_absolute(&cc)); - if a < 0.05 { - return; - } - // A box too thin to cover a cell's centre but a cell wide — a menu's - // separator, a rule — is a line through the row it sits in, drawn - // only over cells nothing else is drawn in. - let m = self.m; - if area.y1 - area.y0 < m.ch / 2.0 && area.x1 - area.x0 >= m.cw { - let r = ((area.y0 + area.y1) / 2.0 / m.ch).floor() as i32; - let c0 = (area.x0 / m.cw).round() as i32; - let c1 = (area.x1 / m.cw).round() as i32; - for col in c0..c1 { - if let Some(cell) = self.grid.at(col, r) - && cell.text == " " - { - cell.text = "─".into(); - cell.fg = blend(c, a, cell.bg); - } - } - return; - } - self.fill(area, c, a); - } - - fn fill(&mut self, area: Rect, c: Rgb, a: f32) { - let m = self.m; - let c0 = (area.x0 / m.cw - 0.5).ceil() as i32; - let c1 = (area.x1 / m.cw - 0.5).ceil() as i32; - let r0 = (area.y0 / m.ch - 0.5).ceil() as i32; - let r1 = (area.y1 / m.ch - 0.5).ceil() as i32; - // An opaque box drawn after a picture covers it where they meet. - if a > 0.5 && r0 < r1 && c0 < c1 { - for p in &mut self.grid.pictures { - p.cover(c0, c1, r0, r1); - } - } - for r in r0..r1 { - for col in c0..c1 { - if a > 0.5 && self.grid.cursor == Some((col as u16, r as u16)) { - self.grid.cursor = None; - } - if let Some(cell) = self.grid.at(col, r) { - // An opaque box covers what was drawn under it. - if a > 0.5 { - *cell = Cell::blank(cell.fg, cell.bg); - } - cell.bg = blend(c, a, cell.bg); - } - } - } - } - - /// Each side with a visible border, as a line of box-drawing characters - /// along the cells that side runs through. - fn borders(&mut self, styles: &ComputedValues, b: Rect, l: &taffy::Layout, clip: Rect) { - use style::values::specified::BorderStyle; - let bs = styles.get_border(); - let cc = styles.clone_color(); - let m = self.m; - let side = |w: f32, st: BorderStyle, col: &style::values::computed::Color| { - if w <= 0.0 || matches!(st, BorderStyle::None | BorderStyle::Hidden) { - return None; - } - let (c, a) = rgb(&col.resolve_to_absolute(&cc)); - (a > 0.05).then_some((c, a)) - }; - let col_of = |x: f32| (x / m.cw).floor() as i32; - let row_of = |y: f32| (y / m.ch).floor() as i32; - let (c0, c1) = (col_of(b.x0), col_of((b.x1 - 0.01).max(b.x0))); - let (r0, r1) = (row_of(b.y0), row_of((b.y1 - 0.01).max(b.y0))); - let put = |g: &mut Grid, c: i32, r: i32, ch: &str, (fg, a): (Rgb, f32)| { - let (px, py) = ((c as f32 + 0.5) * m.cw, (r as f32 + 0.5) * m.ch); - if !clip.contains(px, py) { - return; - } - if let Some(cell) = g.at(c, r) { - cell.text = ch.into(); - cell.fg = blend(fg, a, cell.bg); - } - }; - // A horizontal side gets its row only when nothing is written in it - // between the sides: a table cell a line high, or a button, keeps - // its text rather than a rule drawn through it. - let free = |g: &Grid, r: i32| { - r0 < r1 - && (c0 + 1..c1).all(|c| { - c < 0 || r < 0 || c >= g.cols as i32 || r >= g.rows as i32 || { - let t = &g.get(c as u16, r as u16).text; - t == " " || t == "─" - } - }) - }; - // And only in a row the box owns: its top edge in the row's upper - // half, its bottom edge in the lower. A table cell's bottom border - // a few pixels into the next row's text is not that row's. - let frac = |y: f32| y / m.ch - (y / m.ch).floor(); - let top_free = free(self.grid, r0) && frac(b.y0) < 0.5; - let bottom_free = free(self.grid, r1) && frac((b.y1 - 0.01).max(b.y0)) >= 0.5; - let top = - side(l.border.top, bs.border_top_style, &bs.border_top_color).filter(|_| top_free); - let bottom = side( - l.border.bottom, - bs.border_bottom_style, - &bs.border_bottom_color, - ) - .filter(|_| bottom_free); - let left = side(l.border.left, bs.border_left_style, &bs.border_left_color); - let right = side( - l.border.right, - bs.border_right_style, - &bs.border_right_color, - ); - for (fg, r) in [(top, r0), (bottom, r1)] { - if let Some(fg) = fg { - for c in c0..=c1 { - put(self.grid, c, r, "─", fg); - } - } - } - for (fg, c) in [(left, c0), (right, c1)] { - if let Some(fg) = fg { - for r in r0..=r1 { - put(self.grid, c, r, "│", fg); - } - } - } - // Where two drawn sides meet, a corner. - for (h, v, c, r, ch) in [ - (top, left, c0, r0, "┌"), - (top, right, c1, r0, "┐"), - (bottom, left, c0, r1, "└"), - (bottom, right, c1, r1, "┘"), - ] { - if let (Some(fg), Some(_)) = (h, v) { - put(self.grid, c, r, ch, fg); - } - } - } - - /// An inline root's text, its origin at `o`. A line starts in the cell - /// its left edge rounds to, and each cluster after takes the next cell - /// (two for a wide one), so text set larger than a cell — a heading — - /// reads as text rather than spaced-out letters. A gap between runs, and - /// an inline box, take the cells their width rounds to; an inline box's - /// cell is kept for [`Self::element`], which is how the caret finds its - /// column in a heading. - fn text(&mut self, tl: &blitz_dom::node::TextLayout, o: (f32, f32), clip: Rect) { - let m = self.m; - for line in tl.layout.lines() { - let lm = line.metrics(); - let mid = o.1 + (lm.block_min_coord + lm.block_max_coord) / 2.0; - let r = (mid / m.ch).floor() as i32; - // How many of each run's clusters earlier glyph runs drew. - let mut taken: HashMap = HashMap::new(); - // The next free cell, and the x where the last item ended. - let mut col: Option = None; - let mut end_x = 0.0f32; - let place = |x: f32, col: &mut Option, end_x: f32| -> i32 { - match *col { - None => ((o.0 + x) / m.cw).round() as i32, - Some(c) => c + ((x - end_x) / m.cw).round().max(0.0) as i32, - } - }; - for item in line.items() { - let gr = match item { - PositionedLayoutItem::GlyphRun(gr) => gr, - PositionedLayoutItem::InlineBox(b) => { - let c = place(b.x, &mut col, end_x); - self.inline_cells - .insert(NodeId::from_u64(b.id), (c, r, b.width)); - col = Some(c + (b.width / m.cw).round() as i32); - end_x = b.x + b.width; - continue; - } - }; - let mut c = place(gr.offset(), &mut col, end_x); - end_x = gr.offset() + gr.advance(); - let st = self - .doc - .get_node(gr.style().brush.id) - .and_then(|n| n.primary_styles()); - let Some(st) = st else { - col = Some(c); - continue; - }; - let cc = st.clone_color(); - let (fg, fa) = rgb(&cc); - let (bg, ba) = rgb(&st.clone_background_color().resolve_to_absolute(&cc)); - let bold = st.get_font().font_weight.value() >= 600.0; - let italic = st.get_font().font_style != style::values::computed::FontStyle::NORMAL; - let underline = st - .get_text() - .text_decoration_line - .contains(style::values::specified::TextDecorationLine::UNDERLINE); - // A parley run can hold several spans of one face; the glyph - // run is the stretch of it in one style. Its clusters are the - // run's next ones in that style. - let key = gr.run().text_range().start; - let skip = *taken.get(&key).unwrap_or(&0); - let style = gr.style_index(); - let clusters: Vec<_> = gr - .run() - .visual_clusters() - .skip(skip) - .take_while(|c| c.style_index() == style) - .collect(); - taken.insert(key, skip + clusters.len()); - for cluster in clusters { - let s = &tl.text[cluster.text_range()]; - let s = if s.chars().all(char::is_whitespace) { - " " - } else { - s - }; - let w = UnicodeWidthStr::width(s).max(1) as i32; - let at = c; - c += w; - let cx = (at as f32 + 0.5) * m.cw; - if !clip.contains(cx, mid) { - continue; - } - let Some(cell) = self.grid.at(at, r) else { - continue; - }; - if ba > 0.05 { - cell.bg = blend(bg, ba, cell.bg); - } - // Transparent text (a ghost) keeps its place and draws - // nothing. - if fa < 0.3 { - continue; - } - cell.text = s.to_string(); - cell.fg = blend(fg, fa, cell.bg); - cell.bold = bold; - cell.italic = italic; - cell.underline = underline; - if w == 2 - && let Some(next) = self.grid.at(at + 1, r) - { - next.text = String::new(); - } - } - col = Some(c); - } - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn picture() -> Picture { - Picture { - src: String::new(), - col: 0, - row: 0, - cols: 40, - rows: 20, - shown: (0, 20), - shown_cols: (0, 40), - } - } - - #[test] - fn a_box_over_a_picture_leaves_it_the_largest_part_uncovered() { - // A wide menu at the top: more is left below it than beside it. - let mut p = picture(); - p.cover(0, 30, 0, 4); - assert_eq!((p.shown, p.shown_cols), ((4, 20), (0, 40))); - // A tall narrow one at the left: the right of it is kept. - let mut p = picture(); - p.cover(0, 8, 0, 20); - assert_eq!((p.shown, p.shown_cols), ((0, 20), (8, 40))); - // One beside the picture leaves it whole. - let mut p = picture(); - p.cover(40, 50, 0, 20); - assert_eq!((p.shown, p.shown_cols), ((0, 20), (0, 40))); - // One over all of it hides it. - let mut p = picture(); - p.cover(0, 40, 0, 20); - assert_eq!(p.shown.0, p.shown.1); - } -} diff --git a/apps/leaf-dioxus-tui/src/pictures.rs b/apps/leaf-dioxus-tui/src/pictures.rs index e9ffbda0..445c5f39 100644 --- a/apps/leaf-dioxus-tui/src/pictures.rs +++ b/apps/leaf-dioxus-tui/src/pictures.rs @@ -1,130 +1,18 @@ -//! Pictures, formulas and diagrams, painted with the terminal's graphics -//! protocol over the cells of the box Blitz laid out for them. -//! -//! The painter finds each `img` and records its box in cells -//! ([`crate::paint::Picture`]); it has already drawn a labelled frame there, -//! which stays when the picture cannot be read. Here each source is decoded -//! once — a `file://` URL through leaf-raster, as leaf-tui reads a picture, -//! and a `data:image/svg+xml` URL (a formula or a diagram, which leaf-dioxus -//! typesets to SVG) rasterised — and handed to ratatui-image, which speaks -//! kitty, iTerm2 or sixel where the terminal does and half-blocks where it -//! does not. -//! -//! A picture partly scrolled off the screen is cropped to its rows in view, -//! so it scrolls with the text instead of jumping whole to stay inside it. +//! Pictures, formulas and diagrams as leaf-tui reads them, for blitz-tui to +//! paint with the terminal's graphics protocol: a `file://` URL through +//! leaf-raster, and a `data:image/svg+xml` URL (a formula or a diagram, +//! which leaf-dioxus typesets to SVG) rasterised by it. -use std::collections::HashMap; use std::path::PathBuf; use leaf_raster::image::DynamicImage; -use ratatui::Frame; -use ratatui::layout::Rect; -use ratatui::widgets::Clear; -use ratatui_image::picker::{Picker, ProtocolType}; -use ratatui_image::protocol::StatefulProtocol; -use ratatui_image::{Resize, StatefulImage}; - -use crate::paint::{Grid, Picture}; - -/// How many encoded crops to keep before starting again: each scroll step of -/// a partly visible picture is a new crop. -const PROTOCOLS_MAX: usize = 64; /// How many pixels an SVG is drawn at per CSS pixel: a terminal's cell is /// about twice the size of the cell the editor measures in. const SVG_SCALE: f32 = 2.0; -/// A source, and the rows and columns of its box in view: `(first, count)`. -type Crop = (String, (u16, u16), (u16, u16)); - -pub struct Pictures { - picker: Picker, - /// Each source, decoded, or `None` when it would not decode. - decoded: HashMap>, - /// Each crop of a source, encoded for the terminal: keyed by the source, - /// and the first row and column in view and how many of each are. - encoded: HashMap, -} - -impl Pictures { - /// Half-blocks until [`Pictures::query`] has asked the terminal. - pub fn new() -> Self { - Self { - picker: Picker::halfblocks(), - decoded: HashMap::new(), - encoded: HashMap::new(), - } - } - - /// Ask the terminal what it can draw. In raw mode: the answers are - /// escape sequences on stdin. - pub fn query(&mut self) { - if let Ok(picker) = Picker::from_query_stdio() { - self.picker = picker; - } - } - - pub fn protocol(&self) -> ProtocolType { - self.picker.protocol_type() - } - - /// Paint every picture in `grid` that decodes over its cells. - pub fn paint(&mut self, f: &mut Frame, grid: &Grid) { - if self.encoded.len() > PROTOCOLS_MAX { - self.encoded.clear(); - } - for p in &grid.pictures { - self.paint_one(f, grid, p); - } - } - - fn paint_one(&mut self, f: &mut Frame, grid: &Grid, p: &Picture) { - let (top, bottom) = p.shown; - let (left, right) = p.shown_cols; - let (bottom, right) = (bottom.min(grid.rows as i32), right.min(grid.cols as i32)); - if top >= bottom || left >= right { - return; - } - let Some(img) = self - .decoded - .entry(p.src.clone()) - .or_insert_with(|| decode(&p.src)) - .as_ref() - else { - return; - }; - // The part of the box in view, as fractions of the whole box, cut - // from the picture in the same proportions. - let skip = (top - p.row) as u16; - let shown = (bottom - top) as u16; - let skip_cols = (left - p.col) as u16; - let shown_cols = (right - left) as u16; - let key = (p.src.clone(), (skip, shown), (skip_cols, shown_cols)); - let picker = &self.picker; - let proto = self.encoded.entry(key).or_insert_with(|| { - let img = if (shown, shown_cols) == (p.rows, p.cols) { - img.clone() - } else { - let cut = |len: u32, from: u16, n: u16, of: u16| { - let len = len as f32; - let a = (len * from as f32 / of as f32).round() as u32; - let b = (len * (from + n) as f32 / of as f32).round() as u32; - (a, (b.saturating_sub(a)).max(1)) - }; - let (y, h) = cut(img.height(), skip, shown, p.rows); - let (x, w) = cut(img.width(), skip_cols, shown_cols, p.cols); - img.crop_imm(x, y, w, h) - }; - picker.new_resize_protocol(img) - }); - let rect = Rect::new(left as u16, top as u16, shown_cols, shown); - f.render_widget(Clear, rect); - f.render_stateful_widget(StatefulImage::new().resize(Resize::Fit(None)), rect, proto); - } -} - /// A picture's source as pixels: a `file://` URL, or an SVG `data:` URL. -fn decode(src: &str) -> Option { +pub fn decode(src: &str) -> Option { if let Some(path) = src.strip_prefix("file://") { let path = PathBuf::from(percent_decode(path)?); return leaf_raster::load_image(&path); diff --git a/apps/leaf-dioxus-tui/src/term.rs b/apps/leaf-dioxus-tui/src/term.rs index 15c47bce..ffc252b4 100644 --- a/apps/leaf-dioxus-tui/src/term.rs +++ b/apps/leaf-dioxus-tui/src/term.rs @@ -1,26 +1,12 @@ -//! The terminal side: raw mode and the alternate screen, a grid written out -//! as the cells that changed, and the terminal's keys and mouse turned into -//! what the editor and Blitz take. - -use std::io::{Stdout, stdout}; -use std::str::FromStr; +//! What leaf adds to blitz-tui's terminal: the theme leaf-tui's way, the +//! editor's keys, the pictures leaf-raster reads, and clicks shifted onto +//! the editor's text. use anyhow::Result; -use blitz_traits::events::{ - BlitzPointerEvent, BlitzPointerId, MouseEventButton, MouseEventButtons, PointerCoords, UiEvent, -}; -use crossterm::event::{ - DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture, KeyCode, - KeyEvent, KeyEventKind, KeyModifiers, MouseButton, MouseEvent, MouseEventKind, -}; -use crossterm::{cursor, execute, terminal}; -use dioxus::html::{Code, Key, Modifiers, NamedKey}; +use blitz_tui::Metrics; +use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers, MouseEvent}; +use dioxus::html::{Code, Key, Modifiers}; use dioxus_native::DioxusDocument; -use ratatui::backend::CrosstermBackend; -use ratatui::style::{Color, Modifier}; - -use crate::paint::{Grid, Metrics}; -use crate::pictures::Pictures; thread_local! { static DARK: std::cell::Cell> = const { std::cell::Cell::new(None) }; @@ -36,97 +22,20 @@ pub fn dark() -> bool { } } -/// Ask the terminal whether it is light or dark (an `OSC 11` query, with a -/// timeout, which terminal-colorsaurus answers from the controlling tty -/// without stealing a keystroke), before anything is drawn to its colours. +/// Ask the terminal whether it is light or dark, before anything is drawn +/// to its colours. pub fn ask_theme() { - if let Ok(palette) = terminal_colorsaurus::color_palette(Default::default()) { - let dark = palette.theme_mode() == terminal_colorsaurus::ThemeMode::Dark; + if let Some(dark) = blitz_tui::ask_dark() { DARK.set(Some(dark)); } } -pub struct Terminal { - term: ratatui::Terminal>, - pictures: Pictures, -} - -impl Terminal { - pub fn enter() -> Result { - let mut out = stdout(); - terminal::enable_raw_mode()?; - execute!( - out, - terminal::EnterAlternateScreen, - EnableMouseCapture, - EnableBracketedPaste, - cursor::SetCursorStyle::SteadyBar, - )?; - let mut pictures = Pictures::new(); - pictures.query(); - crate::trace(|| format!("graphics: {:?}", pictures.protocol())); - let mut term = ratatui::Terminal::new(CrosstermBackend::new(out))?; - term.clear()?; - Ok(Self { term, pictures }) - } - - pub fn leave(&mut self) -> Result<()> { - execute!( - self.term.backend_mut(), - DisableBracketedPaste, - DisableMouseCapture, - cursor::SetCursorStyle::DefaultUserShape, - cursor::Show, - terminal::LeaveAlternateScreen - )?; - terminal::disable_raw_mode()?; - Ok(()) - } - - /// Forget what is on screen: the next draw writes every cell. - pub fn clear(&mut self) -> Result<()> { - self.term.clear()?; - Ok(()) - } - - /// Draw `g`: its cells, then its pictures over them. ratatui writes only - /// the cells that changed since the last frame. - pub fn draw(&mut self, g: &Grid) -> Result<()> { - let pictures = &mut self.pictures; - self.term.draw(|f| { - let area = f.area(); - let buf = f.buffer_mut(); - for r in 0..g.rows.min(area.height) { - for c in 0..g.cols.min(area.width) { - let cell = g.get(c, r); - let out = &mut buf[(c, r)]; - // The second half of a wide character: its first half - // drew it, and ratatui skips this cell. - out.set_symbol(if cell.text.is_empty() { - " " - } else { - &cell.text - }); - out.set_fg(rgb(cell.fg)); - out.set_bg(rgb(cell.bg)); - let mut m = Modifier::empty(); - m.set(Modifier::BOLD, cell.bold); - m.set(Modifier::ITALIC, cell.italic); - m.set(Modifier::UNDERLINED, cell.underline); - out.modifier = m; - } - } - pictures.paint(f, g); - if let Some((c, r)) = g.cursor { - f.set_cursor_position((c, r)); - } - })?; - Ok(()) - } -} - -fn rgb((r, g, b): (u8, u8, u8)) -> Color { - Color::Rgb(r, g, b) +/// blitz-tui's terminal, reading pictures as leaf-tui does. +pub fn enter() -> Result { + let mut term = blitz_tui::Terminal::enter()?; + term.set_decoder(Box::new(crate::pictures::decode)); + crate::trace(|| format!("graphics: {:?}", term.pictures().protocol())); + Ok(term) } /// The editor's primary modifier: ⌘ on macOS, where a terminal hands over ⌃ @@ -138,126 +47,43 @@ pub const PRIMARY: Modifiers = if cfg!(target_os = "macos") { }; /// A terminal key as the editor's `(Key, Code, Modifiers)`, the shape -/// `leaf_dioxus::pressed` makes of winit's. +/// `leaf_dioxus::pressed` makes of winit's: ⌃ as [`PRIMARY`]. pub fn key(k: &KeyEvent) -> Option<(Key, Code, Modifiers)> { if k.kind == KeyEventKind::Release { return None; } - let mut mods = Modifiers::empty(); - mods.set(Modifiers::SHIFT, k.modifiers.contains(KeyModifiers::SHIFT)); - mods.set(Modifiers::ALT, k.modifiers.contains(KeyModifiers::ALT)); - mods.set(PRIMARY, k.modifiers.contains(KeyModifiers::CONTROL)); + let e = blitz_tui::input::key(k)?; + let mut mods = e.modifiers; + if mods.contains(Modifiers::CONTROL) { + mods.remove(Modifiers::CONTROL); + mods.insert(PRIMARY); + } // ⌃K is the editor's own ⌃ chord on Apple (delete to the line's end), // as in leaf-tui; ⌘K has nothing to lose to it. if k.code == KeyCode::Char('k') && k.modifiers == KeyModifiers::CONTROL { mods = Modifiers::CONTROL; } - if k.code == KeyCode::BackTab { - mods.insert(Modifiers::SHIFT); - } - let named = |n| Some((Key::Named(n), Code::Unidentified, mods)); - match k.code { - KeyCode::Char(c) => { - let (key, code, _) = char_key(c); - // ⌃⇧z arrives as `Z` with SHIFT already folded in. - let key = if mods.intersects(PRIMARY) { - match key { - Key::Character(s) => Key::Character(s.to_lowercase()), - k => k, - } - } else { - key - }; - Some((key, code, mods)) - } - KeyCode::Enter => named(NamedKey::Enter), - KeyCode::Backspace => named(NamedKey::Backspace), - KeyCode::Delete => named(NamedKey::Delete), - KeyCode::Tab => named(NamedKey::Tab), - KeyCode::BackTab => named(NamedKey::Tab), - KeyCode::Esc => named(NamedKey::Escape), - KeyCode::Left => named(NamedKey::ArrowLeft), - KeyCode::Right => named(NamedKey::ArrowRight), - KeyCode::Up => named(NamedKey::ArrowUp), - KeyCode::Down => named(NamedKey::ArrowDown), - KeyCode::Home => named(NamedKey::Home), - KeyCode::End => named(NamedKey::End), - KeyCode::PageUp => named(NamedKey::PageUp), - KeyCode::PageDown => named(NamedKey::PageDown), - KeyCode::F(n) => Key::from_str(&format!("F{n}")) - .ok() - .map(|k| (k, Code::Unidentified, mods)), - _ => None, - } + // ⌃⇧z arrives as `Z` with SHIFT already folded in. + let key = match e.key { + Key::Character(s) if mods.intersects(PRIMARY) => Key::Character(s.to_lowercase()), + k => k, + }; + Some((key, e.code, mods)) } /// A typed character, with the physical key a US layout gives it. pub fn char_key(c: char) -> (Key, Code, Modifiers) { - if c == '\n' || c == '\r' { - return (Key::Named(NamedKey::Enter), Code::Enter, Modifiers::empty()); - } - let code = if c.is_ascii_alphabetic() { - Code::from_str(&format!("Key{}", c.to_ascii_uppercase())).unwrap_or(Code::Unidentified) - } else if c.is_ascii_digit() { - Code::from_str(&format!("Digit{c}")).unwrap_or(Code::Unidentified) - } else if c == ' ' { - Code::Space - } else { - Code::Unidentified - }; - (Key::Character(c.to_string()), code, Modifiers::empty()) + let e = blitz_tui::input::char_key(c); + (e.key, e.code, e.modifiers) } -/// A press, a drag, a release or a move, as Blitz's pointer events in the -/// cell it fell in: in its left part, so a click on a character puts the -/// caret before it, as a terminal's block cursor reads. A move with no -/// button down is the hover a menu highlights its items by. +/// A press, a drag, a release or a move, to Blitz. The editor's text starts +/// `PAD` in, which the painter rounds to a whole cell; a click is shifted +/// the same way, so it lands on the character drawn under it. pub fn pointer(doc: &mut DioxusDocument, m: Metrics, me: &MouseEvent) { - // The editor's text starts `PAD` in, which the painter rounds to a - // whole cell; a click is shifted the same way, so it lands on the - // character drawn under it. - let pad = leaf_dioxus::PAD as f32; - let shift = pad - (pad / m.cw).round() * m.cw; - let x = (me.column as f32 + 0.3) * m.cw + shift; - let y = (me.row as f32 + 0.5) * m.ch; - let scroll = doc.inner.borrow().viewport_scroll(); - let mut mods = Modifiers::empty(); - mods.set(Modifiers::SHIFT, me.modifiers.contains(KeyModifiers::SHIFT)); - let button = match me.kind { - MouseEventKind::Down(b) | MouseEventKind::Up(b) | MouseEventKind::Drag(b) => b, - _ => MouseButton::Left, - }; - let (button, held) = match button { - MouseButton::Left => (MouseEventButton::Main, MouseEventButtons::Primary), - MouseButton::Right => (MouseEventButton::Secondary, MouseEventButtons::Secondary), - MouseButton::Middle => (MouseEventButton::Auxiliary, MouseEventButtons::Auxiliary), - }; - let buttons = match me.kind { - MouseEventKind::Down(_) | MouseEventKind::Drag(_) => held, - _ => MouseEventButtons::None, - }; - let event = BlitzPointerEvent { - id: BlitzPointerId::Mouse, - is_primary: true, - coords: PointerCoords { - page_x: x + scroll.x as f32, - page_y: y + scroll.y as f32, - screen_x: x, - screen_y: y, - client_x: x, - client_y: y, - }, - button, - buttons, - mods, - details: Default::default(), - element: Default::default(), - active_pointers: Default::default(), - }; - let ui = match me.kind { - MouseEventKind::Down(_) => UiEvent::PointerDown(event), - MouseEventKind::Up(_) => UiEvent::PointerUp(event), - _ => UiEvent::PointerMove(event), - }; - blitz_dom::Document::handle_ui_event(doc, ui); + let shift = m.shift(leaf_dioxus::PAD as f32); + let ui = blitz_tui::input::mouse(&doc.inner.borrow(), me, m, shift); + if let Some(ui) = ui { + blitz_dom::Document::handle_ui_event(doc, ui); + } } diff --git a/apps/leaf-dioxus-tui/src/window.rs b/apps/leaf-dioxus-tui/src/window.rs deleted file mode 100644 index da7659db..00000000 --- a/apps/leaf-dioxus-tui/src/window.rs +++ /dev/null @@ -1,206 +0,0 @@ -//! A winit [`Window`] that is a terminal: the editor and Blitz ask their -//! window for its size, its scale and its theme, and ask it to redraw. They -//! need nothing else of winit, so this answers from the terminal's size in -//! cells, multiplied out to CSS pixels by [`crate::cell`], and does nothing -//! else. `apps/leaf-dioxus/src/offscreen.rs` is the same idea for a sheet. - -use std::fmt; -use std::sync::Mutex; -use std::sync::atomic::{AtomicBool, Ordering}; - -use dioxus_native::winit::cursor::Cursor; -use dioxus_native::winit::dpi::{PhysicalInsets, PhysicalPosition, PhysicalSize, Position, Size}; -use dioxus_native::winit::error::RequestError; -use dioxus_native::winit::icon::Icon; -use dioxus_native::winit::monitor::{Fullscreen, MonitorHandle}; -use dioxus_native::winit::window::{ - CursorGrabMode, ImeCapabilities, ImeRequest, ImeRequestError, ResizeDirection, Theme, - UserAttentionType, Window, WindowButtons, WindowId, WindowLevel, WindowType, -}; -use raw_window_handle as rwh; - -/// The terminal, as a winit window of `size` pixels at a scale of one. -pub struct TermWindow { - size: Mutex>, - dark: bool, - /// Set by the editor's `request_redraw`, taken by the loop in `main.rs`. - dirty: AtomicBool, - ime: Mutex>, -} - -impl fmt::Debug for TermWindow { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("TermWindow") - .field("size", &*self.size.lock().unwrap()) - .finish() - } -} - -impl TermWindow { - pub fn new(width: u32, height: u32, dark: bool) -> Self { - Self { - size: Mutex::new(PhysicalSize::new(width.max(1), height.max(1))), - dark, - dirty: AtomicBool::new(true), - ime: Mutex::new(None), - } - } - - pub fn resize(&self, width: u32, height: u32) { - *self.size.lock().unwrap() = PhysicalSize::new(width.max(1), height.max(1)); - self.dirty.store(true, Ordering::Relaxed); - } - - /// Whether anything asked for a redraw since the last call. - pub fn take_dirty(&self) -> bool { - self.dirty.swap(false, Ordering::Relaxed) - } -} - -impl rwh::HasWindowHandle for TermWindow { - fn window_handle(&self) -> Result, rwh::HandleError> { - Err(rwh::HandleError::NotSupported) - } -} - -impl rwh::HasDisplayHandle for TermWindow { - fn display_handle(&self) -> Result, rwh::HandleError> { - Err(rwh::HandleError::NotSupported) - } -} - -impl Window for TermWindow { - fn window_type(&self) -> WindowType { - WindowType::default() - } - fn id(&self) -> WindowId { - WindowId::from_raw(1) - } - fn scale_factor(&self) -> f64 { - 1.0 - } - fn request_redraw(&self) { - self.dirty.store(true, Ordering::Relaxed); - } - fn pre_present_notify(&self) {} - fn reset_dead_keys(&self) {} - fn surface_position(&self) -> PhysicalPosition { - PhysicalPosition::new(0, 0) - } - fn outer_position(&self) -> Result, RequestError> { - Ok(PhysicalPosition::new(0, 0)) - } - fn set_outer_position(&self, _position: Position) {} - fn surface_size(&self) -> PhysicalSize { - *self.size.lock().unwrap() - } - fn request_surface_size(&self, _size: Size) -> Option> { - None - } - fn outer_size(&self) -> PhysicalSize { - self.surface_size() - } - fn safe_area(&self) -> PhysicalInsets { - PhysicalInsets::new(0, 0, 0, 0) - } - fn set_min_surface_size(&self, _min_size: Option) {} - fn set_max_surface_size(&self, _max_size: Option) {} - fn surface_resize_increments(&self) -> Option> { - None - } - fn set_surface_resize_increments(&self, _increments: Option) {} - fn set_title(&self, _title: &str) {} - fn set_transparent(&self, _transparent: bool) {} - fn set_blur(&self, _blur: bool) {} - fn set_visible(&self, _visible: bool) {} - fn is_visible(&self) -> Option { - Some(true) - } - fn set_resizable(&self, _resizable: bool) {} - fn is_resizable(&self) -> bool { - true - } - fn set_enabled_buttons(&self, _buttons: WindowButtons) {} - fn enabled_buttons(&self) -> WindowButtons { - WindowButtons::all() - } - fn set_minimized(&self, _minimized: bool) {} - fn is_minimized(&self) -> Option { - Some(false) - } - fn set_maximized(&self, _maximized: bool) {} - fn is_maximized(&self) -> bool { - false - } - fn set_fullscreen(&self, _fullscreen: Option) {} - fn fullscreen(&self) -> Option { - None - } - fn set_decorations(&self, _decorations: bool) {} - fn is_decorated(&self) -> bool { - false - } - fn set_window_level(&self, _level: WindowLevel) {} - fn set_window_icon(&self, _window_icon: Option) {} - /// A terminal has no input method to place: its own composes in place. - fn request_ime_update(&self, request: ImeRequest) -> Result<(), ImeRequestError> { - match request { - ImeRequest::Enable(enable) => { - let (caps, _) = enable.into_raw(); - *self.ime.lock().unwrap() = Some(caps); - } - ImeRequest::Disable => *self.ime.lock().unwrap() = None, - _ => {} - } - Ok(()) - } - fn ime_capabilities(&self) -> Option { - *self.ime.lock().unwrap() - } - fn focus_window(&self) {} - fn has_focus(&self) -> bool { - true - } - fn request_user_attention(&self, _request_type: Option) {} - fn set_theme(&self, _theme: Option) {} - fn theme(&self) -> Option { - Some(if self.dark { Theme::Dark } else { Theme::Light }) - } - fn set_content_protected(&self, _protected: bool) {} - fn title(&self) -> String { - String::new() - } - fn set_cursor(&self, _cursor: Cursor) {} - fn set_cursor_position(&self, _position: Position) -> Result<(), RequestError> { - Ok(()) - } - fn set_cursor_grab(&self, _mode: CursorGrabMode) -> Result<(), RequestError> { - Ok(()) - } - fn set_cursor_visible(&self, _visible: bool) {} - fn drag_window(&self) -> Result<(), RequestError> { - Ok(()) - } - fn drag_resize_window(&self, _direction: ResizeDirection) -> Result<(), RequestError> { - Ok(()) - } - fn show_window_menu(&self, _position: Position) {} - fn set_cursor_hittest(&self, _hittest: bool) -> Result<(), RequestError> { - Ok(()) - } - fn current_monitor(&self) -> Option { - None - } - fn available_monitors(&self) -> Box> { - Box::new(std::iter::empty()) - } - fn primary_monitor(&self) -> Option { - None - } - fn rwh_06_display_handle(&self) -> &dyn rwh::HasDisplayHandle { - self - } - fn rwh_06_window_handle(&self) -> &dyn rwh::HasWindowHandle { - self - } -} From 69e1a0a48971319d54a069dd2da2d5349a82dffc Mon Sep 17 00:00:00 2001 From: Adam Harris Date: Wed, 21 Oct 2026 18:40:15 -0600 Subject: [PATCH 08/13] docs(proposals): the terminal renderer moves to the Blitz fork as blitz-tui --- .../the-leaf-dioxus-editor-in-a-terminal.md | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md b/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md index 2cd4a350..ab4d1dd4 100644 --- a/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md +++ b/docs/proposals/the-leaf-dioxus-editor-in-a-terminal.md @@ -16,6 +16,11 @@ pictures, then unit's menus and dialogs, then the file features. All three rounds are in; "What it does not do yet" is what is left. leaf-tui is untouched; replacing it is still Adam's call. +Also decided by Adam, 2026-10-21: the renderer goes in the Blitz fork. It is +now `blitz-tui`, a package on the fork's `tui` branch beside blitz-paint and +blitz-shell, which runs any Blitz document, a Dioxus app included; the +prototype here is what leaf adds to it ([Where the renderer lives](#where-the-renderer-lives)). + ## Does Dioxus have a TUI renderer? Not any more. Dioxus had one, `dioxus-tui`, on a core called rink (later @@ -50,8 +55,10 @@ everything above the painter already existed: hit-testing count in cells without any change to the editor. The first prototype was about 1,500 lines in four files and needed no change -to leaf-dioxus or unit. With pictures, chrome and files it is about 2,700 -lines in eight, with tests, and two small changes outside it: +to leaf-dioxus or unit. With pictures, chrome and files it came to about +2,700 lines in eight, with tests. The painter, the terminal and the input are +now blitz-tui's (about 2,000 lines with its tests); what stays here is about +1,500. Two small changes outside it: - **leaf-dioxus:** `Type::uniform`, which sets every run at the body size, as the source view already does. Without it the editor lays a heading out at @@ -63,6 +70,33 @@ lines in eight, with tests, and two small changes outside it: and keyboard choice for an action sheet (↑/↓/Tab, Return), which is useful on a desktop too. +## Where the renderer lives + +In the Blitz fork, `diaryx-org/blitz`, as `packages/blitz-tui` on the `tui` +branch (from `leaf`). It is a renderer in Blitz's terms, not an engine: it +replaces blitz-paint and blitz-shell, and keeps the DOM, Stylo and taffy, so +it changes with Blitz's paint tree in the same repository. It is not an +anyrender backend, which would get only shapes and glyph runs: drawing text +a cell to a character and borders only on free rows needs the boxes and +lines. + +- **Generic:** the painter, a `Grid` of cells; the terminal, with pictures + from the image data Blitz loaded, an SVG `data:` URL, or the host's decoder; + the terminal's keys and mouse as Blitz's events, with a key's text, so a + focused element's handlers get it; `run`, which drives any + `blitz_dom::Document`; and `TermWindow` (the `winit` feature). + `examples/tui_counter` is a Dioxus counter whose clicks and keys work + through it, tested headlessly. +- **Leaf's, here:** the editor and unit's chrome, the command table, the file + rules, ⌃ as ⌘ for the editor's shortcuts, the caret classes, the shift of a + click by the editor's padding, and leaf-raster as the picture decoder. +- **Not done for other apps:** the text and caret of `` and + `