lurq 0.2.0

A Rust UI toolkit with typed components, retained state, reactive signals, GPU rendering, and DevTools.
Documentation
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub enum Dimension {
  #[default]
  Auto,
  Px(f32),
  Pct(f32),
}

impl Dimension {
  pub fn to_px(&self) -> f32 {
    match self {
      Dimension::Px(v) => *v,
      _ => 0.0,
    }
  }

  pub fn resolve(&self, parent_size: f32) -> f32 {
    match self {
      Dimension::Px(v) => *v,
      Dimension::Pct(pct) => parent_size * pct / 100.0,
      Dimension::Auto => 0.0,
    }
  }
}

impl From<f32> for Dimension {
  fn from(value: f32) -> Self {
    Self::Px(value)
  }
}