TUI 框架,包含电池
~ Batteries Included Text Based Application Framework ~
yeehaw was born out of a need for an embeddable and reusable element pattern for sophisticated text based applications.
️ Reasons why you need your application to be text-based:
https://github.com/user-attachments/assets/8b1c715a-4a26-4cdc-b3cd-9a8f10dd187e
running this example:
cargo run --release --example showcaseNOTE this example requires steam locomotive (the sl command) to be installed if you want
to see the train. Additionally it should be run from this showcase directory
for the showcase-tab to work (which runs cargo run --release --example showcase).
A hello world example with a label and a reactive button:
…Elements are arranged in a hierarchical manner while retaining semi-autonomy. Events (keyboard/mouse/custom) are routed from the top down (adjusted to be relative to the each destination Element) and responses then propagate back upwards along the Element ownership tree. Parent elements retain general authority over child elements; they determine how the flow of events are channeled and the location and size of child elements. Simple elements are only required to have spatial awareness within the confines provided to them (events are made relative to them by their parents) - although autonomy is still given for them to change their ordering and position within their immediate parent element (with great power comes great responsibility).
In addition to the event-response communication structure elements may directly interact through element-specific hooks (e.g. the button click function on a button element).
The core Element Trait has designed to be extensible for custom event/response kinds enabling developers to create entirely new sub-classes of elements which can reuse the event routing system logic.
Looking to understand more? Checkout:
pub as possible to allow for more experimentation
without requiring forks of the repo. (Eventually put all the excess pub under
an internals feature flag to reduce breaking changes).If you plan on building/experimenting with yeehaw right now, that's great news! I'd like to keep you apprised of some upcoming changes. If you do wish to experiment and or start development on yeehaw I wouldn't be too afraid of these upcoming changes, the majority of foreseeable major refactors have already been completed. While yeehaw is pre-1.0.0 all breaking changes will bd semver minor version upgrades - in other words I don't plan on providing patch updates for bug fixes for minor versions.
I'll try'n help out anyone who needs a hand understanding how to update their code if its been broken by a new release. Additionally a breaking changes doc with upgrade instructions shall be maintained.
HAVE NO FEAR
DynLocationSet
system. It won't change the existing location mechanisms just build on
top of them.DynVal::FULL). Gradients on
angles which are repetitive (DynVal::fixed(..)) work good, however the way
the angle is interpreted will likely change to account for cell dimensions.
Gradients on right-angles (0, 90, 180, 270 degrees) are stable.TL;DR - Elements should provide drawing updates only when actually necessary, also things may be slightly laggy while in debug mode if deeply nested containers are used. Also currently time-base gradients trigger constant recalculation and will substantially increase cpu usage.
The current design of the drawing system favours graphical flexibility over
performance. Each element must implement the Drawing function which in turn
returns DrawUpdate's which can list of individual cell updates. For each
redraw, container elements will then reposition all the draw information of
their respective sub-elements. All this reprocessing which takes place in
container elements is computationally inefficient as it occurs with each redraw
cycle where changes occur. The inefficiency introduced by the current design may
lead to slightly laggy interfaces but primarily only when compiled in debug mode
and if deeply nested containers are used AND if those elements are providing
continuous drawing updates. Use of parallel computation with rayon has been
implemented to help mitigate these inefficiencies. In conclusion, to minimize
the computational burden at render time, Elements should track their own state
and only respond with drawing updates (in fn drawing(..)) when their are
actual state changes which warrant redrawing.
The time based gradient design currently will cause ample CPU recalculations, this will hopefully be improved with time (GPU), but just be aware that if you want to use those sweet sweet time gradient colors it will cost you. If you choose not to use time gradients you will be unaffected by these CPU drains.
Yes! It'd be cool for this repo to become a monolith. I want all sorts of funky widgets in here with first class support from this project (hiding behind feature flags to not gum up the compile times). All ideas will be considered with an open mind, if you'd like to build and element and merge it into yeehaw it'd be an honour, if you'd like to build a element with highly specific needs and the current Element trait is non-satisfactory, let's upgrade it - yeehaw should be able to build any TUI.
Any contribution you intentionally submit for inclusion in the work, as defined in the Apache-2.0 license, shall be Apache-2.0 license, without any additional terms or conditions.
暂无开放 Issues,或尚未同步最近议题。