# yuno
> A deterministic, declarative UI rendering framework built for bare-metal performance and uncompromised control, powered by Rust and Skia.
## The Philosophy
Building complex, animated, and highly interactive graphical interfaces often leads to tangled architectures where state, geometry, and rendering logic leak into one another. `yuno` establishes strict boundaries inspired by robust system design:
1. **Deterministic Spatial Decoupling (The Two-Pass Paradigm)**
A component should never dictate its absolute position. In `yuno`, widgets only express their *intent* (e.g., `Plan::Fill` or `Plan::Fit`). The absolute geometric truth is calculated by an isolated `Layout Planner`. This guarantees that rendering logic and layout algorithms never collide, ensuring predictable execution flows.
2. **Composition over Monoliths**
Complex widgets are not inherited; they are composed. `yuno` treats everything—from a primitive rounded rectangle to a real-time Fast Fourier Transform audio spectrum chart—as equal `Drawable` citizens. They are bound together using deterministic containers like `EdgeLayout` or `BoxLayout`, creating a highly modular visual tree akin to a modern Wayland compositor's scene graph.
3. **Controlled Mutability & Delta-Based Animations**
The graphical tree is shared and inherently complex, which traditionally fights against Rust's strict borrow checker. `yuno` embraces controlled interior mutability. State transitions happen securely within boundaries, while spatial animations are treated as local delta-transformations (matrix translations) on the canvas, preserving pipeline caches and avoiding expensive global layout recalculations.
4. **Direct to Metal**
By leveraging `skia-safe` alongside Vulkan/EGL backends, `yuno` cuts through the abstraction overhead. You are not writing HTML; you are orchestrating raw pixels and vector primitives with maximum runtime efficiency.
## Core Concepts
### 1. `Drawable` and `Plan`
The fundamental trait of the framework. A `Drawable` only needs to know how to paint itself onto a provided `skia_safe::Canvas`.
Before drawing, it submits a `Plan`—a request declaring its preferred sizing constraints on the X and Y axes.
### 2. The `Planner` (Layout Management)
Every `Drawable` internally holds a reference to a `Planner`. When a component is asked to draw, it queries its `Planner` to retrieve its `planned_drawing_area`. The component trusts this bounded absolute area completely, drawing itself precisely within the allocated memory and spatial boundaries.
### 3. `StoryBoard`
The temporal layer. Animations in `yuno` are non-blocking and mathematically precise. Using custom easing functions (like `cubic_in_out`), the `StoryBoard` drives state transitions—such as crossfading audio controls or sliding panels—translating time into floating-point progression metrics without mutating the static layout tree.
## Quick Start
You can quickly run the included video player example to see `yuno` in action:
```bash
cargo run --release --package yuno-player --bin yuno-player -- -sv /path/to/video
```
## Quick Look
Here is a conceptual glimpse of how components are composed in `yuno`:
```rust
use yuno::core::{Drawable, Plan, Layout};
use yuno::layouts::EdgeLayout;
use yuno::widgets::{RoundedRectangle, AudioSpectrumChart};
// Initialize the root layout planner
let root_planner = EdgeLayout::new();
// Create atomic components
let background = RoundedRectangle::new(color::DARK_GREY, 8.0);
let spectrum_analyzer = AudioSpectrumChart::new();
// Bind them together declaratively
// The layout engine strictly dictates the final absolute geometry
root_planner.add_child(
background,
Edges::All,
Margin::zero()
);
root_planner.add_child(
spectrum_analyzer,
Edges::Bottom,
Margin::new(10.0, 10.0, 10.0, 50.0)
);
// During the render loop, widgets safely fetch their calculated area and draw
// No layout recalculation occurs during pure matrix translations