Go to file
Samuel Guerra e092792ff6 Fixed race condition in `ResponseVar::wait_done`.
The recent change of `Var::wait_update` to an async method caused it to not instantiate the future at the moment the method is called, so the code that double checks if the response is done in `wait_done` no longer covered all conditions.
2024-01-14 20:20:39 -03:00
.cargo Refactored do to be a cargo alias. 2021-11-09 20:18:21 -03:00
.vscode Refactored view-api to use Txt. 2023-11-28 17:04:32 -03:00
TODO Fixed race condition in `ResponseVar::wait_done`. 2024-01-14 20:20:39 -03:00
examples Reduced race condition to a test. 2024-01-14 17:52:16 -03:00
tests Fixed race condition in `ResponseVar::wait_done`. 2024-01-14 20:20:39 -03:00
tools Improved README. Added TODO. 2024-01-10 19:21:58 -03:00
zero-ui fmt 2024-01-13 20:11:02 -03:00
zero-ui-app fmt 2024-01-13 20:11:02 -03:00
zero-ui-app-proc-macros Renamed units to unit. 2023-12-16 11:52:46 -03:00
zero-ui-app_context Removed ContextLocal helper methods that where hiding optimization opportunities. 2024-01-03 12:50:20 -03:00
zero-ui-clone_move Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-color Implemented `tile_origin` for gradients. 2024-01-12 01:40:30 -03:00
zero-ui-color-proc-macros Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-ext-clipboard Refactored clipboard service to synchronize with app updates. 2024-01-13 15:06:13 -03:00
zero-ui-ext-config Implemented strong typed var hook. 2023-12-27 11:38:30 -03:00
zero-ui-ext-font Identified issue when fonts never load. 2024-01-14 00:38:30 -03:00
zero-ui-ext-fs_watcher Implemented strong typed var hook. 2023-12-27 11:38:30 -03:00
zero-ui-ext-image Renamed `to_text` to `to_txt`. 2024-01-06 15:52:23 -03:00
zero-ui-ext-input Keep interactive carets and focused style for selection highlight when the selection toolbar is open. 2024-01-06 00:02:48 -03:00
zero-ui-ext-l10n Simplified ContextualizedVar and removed dependency on it from some non-contextualized vars. 2024-01-03 01:07:53 -03:00
zero-ui-ext-l10n-proc-macros Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-ext-undo Removed ContextLocal helper methods that where hiding optimization opportunities. 2024-01-03 12:50:20 -03:00
zero-ui-ext-window Add access docs. 2024-01-10 17:40:07 -03:00
zero-ui-handle Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-l10n-scraper Implementing main re-exports. 2023-12-11 11:40:28 -03:00
zero-ui-layout Removed ContextLocal helper methods that where hiding optimization opportunities. 2024-01-03 12:50:20 -03:00
zero-ui-state_map Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-task Moved task docs to main crate. 2024-01-09 22:15:20 -03:00
zero-ui-task-proc-macros Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-txt Renamed `to_text` to `to_txt`. 2024-01-06 15:52:23 -03:00
zero-ui-unique_id Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-unit Renamed units to unit. 2023-12-16 11:52:46 -03:00
zero-ui-var Fixed race condition in `ResponseVar::wait_done`. 2024-01-14 20:20:39 -03:00
zero-ui-var-proc-macros Refactored WhenVar to only contextualize when needed. 2024-01-03 18:20:35 -03:00
zero-ui-view Fixed panic recover running in same-process. 2024-01-08 13:02:20 -03:00
zero-ui-view-api Implemented `tile_origin` for gradients. 2024-01-12 01:40:30 -03:00
zero-ui-view-prebuilt Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-wgt Renamed `to_text` to `to_txt`. 2024-01-06 15:52:23 -03:00
zero-ui-wgt-access Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-wgt-ansi_text Renamed `to_text` to `to_txt`. 2024-01-06 15:52:23 -03:00
zero-ui-wgt-button Fixed Button cmd bugs. 2024-01-12 23:09:53 -03:00
zero-ui-wgt-checkerboard Documented checkerboard. 2024-01-12 12:56:56 -03:00
zero-ui-wgt-container Renamed child_insert properties to be shorter. 2023-12-22 11:08:46 -03:00
zero-ui-wgt-data Simplified ContextualizedVar and removed dependency on it from some non-contextualized vars. 2024-01-03 01:07:53 -03:00
zero-ui-wgt-fill Implemented `tile_origin` for gradients. 2024-01-12 01:40:30 -03:00
zero-ui-wgt-filter Renamed color::filters to color::filter. 2023-12-13 17:35:11 -03:00
zero-ui-wgt-grid Fixed grid layout when one dimension is "leftover" and the other is "default". 2023-12-27 00:01:12 -03:00
zero-ui-wgt-image Improved image load example. 2023-12-21 23:43:13 -03:00
zero-ui-wgt-input Fixed cursor showing for widget that is not allowed by the current pointer capture. 2023-12-29 17:33:52 -03:00
zero-ui-wgt-inspector Refactored inspector to actualize inspected variables in the right context. 2024-01-12 20:52:34 -03:00
zero-ui-wgt-layer Selection toolbar now is bound to the viewport. 2024-01-06 00:40:04 -03:00
zero-ui-wgt-link Renamed color::filters to color::filter. 2023-12-13 17:35:11 -03:00
zero-ui-wgt-markdown fmt 2024-01-13 20:11:02 -03:00
zero-ui-wgt-material-icons Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-wgt-menu Fixed Button cmd bugs. 2024-01-12 23:09:53 -03:00
zero-ui-wgt-panel Moved presenter nodes to -wgt crate. 2023-12-15 13:46:47 -03:00
zero-ui-wgt-rule_line Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-wgt-scroll Implemented `tile_origin` for gradients. 2024-01-12 01:40:30 -03:00
zero-ui-wgt-size_offset Added missing lints. 2023-12-10 23:26:30 -03:00
zero-ui-wgt-stack Added docs TODO. 2024-01-09 16:53:30 -03:00
zero-ui-wgt-style Renamed wgt_prelude to prelude_wgt. 2024-01-05 12:45:09 -03:00
zero-ui-wgt-switch Moved switch to own crate. 2023-12-15 01:15:32 -03:00
zero-ui-wgt-text Refactored clipboard service to synchronize with app updates. 2024-01-13 15:06:13 -03:00
zero-ui-wgt-text_input Added config docs. 2024-01-12 16:17:32 -03:00
zero-ui-wgt-toggle Refactored toggle::value to avoid entire implementation being generic. 2024-01-02 16:59:53 -03:00
zero-ui-wgt-tooltip Renamed `map_to_text` to `map_to_txt`. 2024-01-11 21:50:21 -03:00
zero-ui-wgt-transform Added some modules to `prelude::*`. 2023-12-15 18:20:31 -03:00
zero-ui-wgt-undo Implementing main re-exports. 2023-12-11 11:40:28 -03:00
zero-ui-wgt-undo_history Implemented strong typed var hook. 2023-12-27 11:38:30 -03:00
zero-ui-wgt-view Renamed `map_to_text` to `map_to_txt`. 2024-01-11 21:50:21 -03:00
zero-ui-wgt-window Renamed `instance` and `nodes` to `node`, renamed `commands` to `cmd`. 2023-12-15 22:11:38 -03:00
zero-ui-wgt-wrap Renamed units to unit. 2023-12-16 11:52:46 -03:00
.gitattributes More EOF fixes. 2021-09-06 15:22:40 -03:00
.gitignore Ignore Zdump-mono-stats. 2024-01-02 11:47:42 -03:00
.gitmodules Changed webrender to be linked directly from git again. 2023-07-13 15:35:44 -03:00
CHANGELOG.md * Added LICENSE and CHANGELOG. 2021-07-29 18:46:39 -03:00
Cargo.toml Better lto config. 2023-12-31 20:53:11 -03:00
LICENSE * Added LICENSE and CHANGELOG. 2021-07-29 18:46:39 -03:00
README.md Documented cargo features and refactored markdown anchor web Uri to not depend on task::http. 2024-01-13 19:13:38 -03:00
do Refactored do to be a cargo alias. 2021-11-09 20:18:21 -03:00
do.bat Refactored do to be a cargo alias. 2021-11-09 20:18:21 -03:00
do.ps1 Refactored do to be a cargo alias. 2021-11-09 20:18:21 -03:00
git-dependencies.md Changed webrender to be linked directly from git again. 2023-07-13 15:35:44 -03:00
rustfmt.toml Fixed format of dump.rs with "async move" block. 2022-06-07 11:42:29 -03:00

README.md

License Crates.io docs.rs

zero-ui

Zero-Ui is the pure Rust UI framework with batteries included it provides all that you need to create beautiful, fast and responsive multi-platform apps. Ready made highly customizable widgets, automatic focus and accessibility management, responsive layout, data binding, easy localization and async tasks.

Usage

First add this to your Cargo.toml:

[dependencies]
zero-ui = "0.1"
zero-ui-view = "0.1"

Then create your first window:

use zero_ui::prelude::*;

fn main() {
    zero_ui_view::init();
    APP.defaults().run_window(async {
        let size = var(layout::Size::new(800, 600));
        Window! {
            title = size.map(|s| formatx!("Button Example - {s}"));
            size;
            child_align = Align::CENTER;
            child = Button! {
                on_click = hn!(|_| {
                    println!("Button clicked!");
                });
                text::font_size = 28;
                child = Text!("Click Me!");
            }
        }
    })
}

See the API docs front page for more details.

Cargo Features

Zero-Ui provides the following features which can be enabled in your Cargo.toml file:

  • inspector — Instrument each property and widget instance with inspector nodes and extend windows to be inspected on Ctrl+Shift+I.
  • trace_widget — Instrument every widget outer-most node to trace UI methods.
  • trace_wgt_item — Instrument every property and intrinsic node to trace UI methods.
  • deadlock_detection — Spawns a thread on app creation that checks and prints parking_lot deadlocks.
  • http — Enables HTTP tasks, images download.
  • test_util — Test utilities.
  • multi_app — Allows multiple app instances per-process, one app per thread at a time. The LocalContext tracks what app is currently running in each thread and app_local! statics switch to the value of each app depending on the current thread.
  • hyphenation_embed_all — Embed hyphenation dictionaries for all supported languages. If enabled some 2.8MB of data is embedded, you can provide an alternative dictionary source using the Hyphenation::dictionary_source method.
  • dyn_node — Use more dynamic dispatch at the node level by enabling UiNode::cfg_boxed to box.
  • dyn_app_extension — Use dynamic dispatch at the app-extension level.
  • dyn_closure — Box closures at opportune places, such as Var::map, reducing the number of monomorphised types.
  • toml — Enable TOML configs.
  • ron — Enable RON configs.
  • yaml — Enable YAML configs.

These features are enabled by default:

  • debug_default — Enable the dyn_* and inspector features for debug builds only.
  • ipc — Enables pre-build views and connecting to views running in another process.
  • material_icons — Include material icons in the default app.

cargo do

There is a built-in task runner for managing this project, run cargo do help or ./do help for details.

The task runner is implemented as a Rust crate in tools/do-tasks and an alias in .cargo/config.toml, it builds the tool silently in the first run, after it should run without noticeable delay.

Shell script to run do are also provided:

  • cmd.exe: do help.
  • PowerShell: ./do.ps1 help.
  • Bash: /.do help.

cargo do install

The task runner depends on multiple cargo commands, you can run cargo do install to see a list of all required commands and run cargo do install --accept to run the installation commands.

VSCode & Rust Analyzer

Some workspace settings are included in the repository, in particular, rust-analyzer "checkOnSave" and runnables are redirected to the do tool.