4 releases
new 0.1.3 | Jan 9, 2025 |
---|---|
0.1.2 | Jan 9, 2025 |
0.1.1 | Jan 9, 2025 |
0.1.0 | Jan 8, 2025 |
#50 in Rendering
33 downloads per month
48KB
885 lines
Library of Components for Generating Non-Interactive Pages/Cards/Files/Content
Components
- Container
- Text
- As text (in HTML
<div>
) - As link (HTML only,
<a>
)
- As text (in HTML
- Icon
Available Renders
- HTML (custom implementation)
- PNG (conversion from SVG)
- PDF (Skia)
- SVG (Skia)
- Leptos
Goals
- Provide the minimal required support for renderer-specific features
- Ensure maximum compatibility of element properties across all renderers
- Offer a minimally comfortable set of components
Non-Goals
- Full support for all available properties in all renderers
- Interactivity (e.g., CSS animations)
- Script support for HTML
Specific style
create rustfmt.toml
and add this:
[skip_macro_invocations]
[[vstack]]
[[hstack]]
Example (HTML)
use zen_rs::{
aspects::Align, components::{github::github_outlined, h::mono_text_xl, Components}, layouts::html::HtmlBuilder, vstack
};
fn main() {
let cc = complited_component();
let html = HtmlBuilder::default().component(cc).build_as_html();
std::fs::write("gh_not_ph.html", html).unwrap();
}
fn gh_not_ph() -> impl Into<Components> {
vstack!(
vstack!(
vstack!(
github_outlined();
mono_text_xl("gh");
mono_text_xl("not ph")
)
.background_color((30, 200, 100, 100))
.gap(4)
.padding(16)
.align_content(zen_rs::aspects::Align::Center)
.flex()
)
.flex()
.border((2, (255, 255, 255, 100), 18))
)
.flex()
.width_full()
.height_full()
.align_items(Align::Center)
.align_content(Align::Center)
.background_color((0, 0, 0, 100))
}
what we got
Contributing
If you would like to contribute, feel free to open an issue in the repository.
License
This project is licensed under the MIT License.
Dependencies
~1.7–4MB
~85K SLoC