render_regex 0.0.0

SVG visualization of regex DFAs.
Documentation
//! RenderIntent: fully-resolved visual rendering plan.

use crate::graph::NodeType;
use crate::graph::ShapeHint;

#[derive(Debug, Clone)]
pub struct RenderIntentNode {
    pub id: usize,
    pub label: String,
    pub center: (f64, f64),
    pub radius: f64,
    pub shape: ShapeHint,

    // Visual styling
    pub fill_color: String,
    pub stroke_color: String,
    pub stroke_width: f64,

    // Font
    pub font_size: f64,
    pub font_family: String,
    pub font_color: String,
    pub label_offset: (f64, f64),

    // Semantics
    pub is_accept: bool,
    pub is_start: bool,
    pub node_type: NodeType,
}

#[derive(Debug, Clone)]
pub enum CurveType {
    Straight,
    Loop { angle: f64, offset: f64 },
    Cubic { control1: (f64, f64), control2: (f64, f64) }, // ✅ NEW
}


#[derive(Debug, Clone)]
pub struct RenderIntentEdge {
    pub from: usize,
    pub to: usize,

    // anchor points
    pub from_point: (f64, f64),
    pub to_point: (f64, f64),

    // visual curve
    pub curve: CurveType,
    pub bend_offset: f32,


    // styling
    pub stroke_color: String,
    pub stroke_width: f64,

    // arrow
    pub arrow_size: f64,
    pub arrow_refx: f64,
    pub arrow_fill: String,

    // label
    pub label: String,
    pub label_pos: (f64, f64),
    pub label_font_size: f64,
    pub label_font_color: String,
}

#[derive(Debug, Clone)]
pub struct RenderIntentGraph {
    pub nodes: Vec<RenderIntentNode>,
    pub edges: Vec<RenderIntentEdge>,
    pub width: f64,
    pub height: f64,
}