View Demo and Doc Site - webui.stoicdreams.com
View Rust WebUI Docs - docs.rs/webui
View on crates.io - crates.io/crates/webui
View on GitHub - github.com/StoicDreams/WebUI
Web UI is a Vanilla JavaScript Web Component library purpose of simplifying and minizing boilerplate code when creating new SPA websites.
The Web UI Rust Crate (WebUI) is also being designed to allow running a Rust language WebAssembly companion that allows communication between your Rust services running in the browser and your JavaScript code and/or Web UI app services.
It is important to note that the purpose of WebUI is to have a separation between Rust code and UI logic. It is our opinion that Rust code should not be managing or building UI (i.e. HTML), but instead should be relegated to performing process intensive or long running tasks in a worker thread.
Web UI is very early in development and is subject to breaking changes at any time while we are in this experimental stage of development.
- Minimize boilerplate code when starting new website projects.
- Define and Adhere to Web UI standards.
- Provide robust component systems for handling common display types, user input and interactions, and data processing.
- Setup boilerplate files for new website project.
- Install WebUI and run
webui
in the root of your website project.
- Install WebUI and run
- Rust code is compiled to wasm and run in Worker thread.
- Rust methods accessible from JavaScript by calling
let result = await webui.worker.send('nameOfMethod', arg1, arg2, etc);
;
- Rust methods accessible from JavaScript by calling
- Implement local Web UI web-component files (JavaScript/CSS/HTML) into WebUI.
- Developers will be able to choose between using a specific version/state of the Web UI files that are stored locally or use the live version on cdn.myfi.ws.
The following instructions are for our developers working on the Rust Web UI solution.
If you're wanting instructions on how to use Web UI to develop websites, whether for new or existing sites, then check out our Web UI documentation and Demo website.
Clone this solution into a folder.
Follow instructions here to install Rust for your system.
Make sure rust is up to date
rustup update
Install Rusts automatic formatting tool.
rustup component add rustfmt
Then you can run this command to apply formatting to your project.
cargo fmt
Install Rusts Clippy linting tool.
rustup component add clippy
Then you can run this command to find additional linting errors.
cargo clippy
Install Trunk executable - this will be used to run your website locally for testing in your browser.
cargo install trunk
Add waxm build target
rustup target add wasm32-unknown-unknown
Install webui executable from local development.
# From the workspace root folder
cargo install --path webui --features all
Delete any starter files that need refeshing (index.html, etc) and run webui
# From the webapp folder
webui
Run trunk serve --open
from your UI project root (e.g. webapp
) to run your site locally.
trunk serve --open
If a major or minor release update is required, then first manually apply the version update to webui/Cargo.toml
, making sure to reset lower versions to 0.
Run this script to increment the patch version and apply the new version to any references / docs.
# From the workspace root folder
.\IncrementVersion.ps1
Publish Latest Updates to crates.io
First, commit any changes to Git.
Then, run the publish command from the webui
folder to publish.
# From the webui folder
cargo publish
This console app provides a single command to:
- Sync static files from webapp to webui
- Increment the Patch version for webui
- Verify tests
- Commit changes
- Push to GitHub
- Publish to crates.io
Install the webuisave
script
# From the workspace root folder
cargo install --path webuisave
Run the script whenever you're ready to save and publish updates.
# From the workspace root folder
webuisave -c "Your commit message"
# Increment minor version
webuisave -c "Your commit message" --minor
# Increment major version
webuisave -c "Your commit message" --major
Erik Gassler - Stoic Dreams - Forging solutions for tomorrow's software development.
Support - Visit Stoic Dreams' GitHub Sponsor page if you would like to provide support to Stoic Dreams.