use dendryform_core::{
Color, ConnectorStyle, ContainerBorder, LegendEntry, Node, NodeId, TierLayout,
};
#[derive(Debug, Clone, PartialEq)]
pub struct ViewportHint {
pub width: f32,
pub padding_x: f32,
pub padding_top: f32,
pub padding_bottom: f32,
}
impl Default for ViewportHint {
fn default() -> Self {
Self {
width: 1100.0,
padding_x: 32.0,
padding_top: 48.0,
padding_bottom: 64.0,
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct HeaderGeometry {
pub title_text: String,
pub title_accent: String,
pub subtitle: String,
}
#[derive(Debug, Clone, PartialEq)]
pub struct NodeGeometry<'a> {
pub node: &'a Node,
pub grid_column: usize,
pub grid_row: usize,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ConnectorGeometry {
pub style: ConnectorStyle,
pub label: Option<String>,
pub is_internal: bool,
}
#[derive(Debug, Clone, PartialEq)]
pub struct FlowLabelsGeometry {
pub items: Vec<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ContainerGeometry<'a> {
pub label: String,
pub border: ContainerBorder,
pub label_color: Color,
pub layers: Vec<LayerGeometry<'a>>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TierGeometry<'a> {
pub id: NodeId,
pub label: Option<String>,
pub layout: TierLayout,
pub columns: usize,
pub nodes: Vec<NodeGeometry<'a>>,
pub container: Option<ContainerGeometry<'a>>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum LayerGeometry<'a> {
Tier(TierGeometry<'a>),
Connector(ConnectorGeometry),
FlowLabels(FlowLabelsGeometry),
}
#[derive(Debug, Clone, PartialEq)]
pub struct LegendGeometry {
pub entries: Vec<LegendEntry>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct LayoutPlan<'a> {
pub viewport: ViewportHint,
pub header: HeaderGeometry,
pub layers: Vec<LayerGeometry<'a>>,
pub legend: LegendGeometry,
}