use lurq::{
  app::Tree,
  layout::{Constraints, layout_result::LayoutResult},
};

use crate::support::run_pass;

pub(super) trait PassLayoutExt {
  fn pass_layout(&mut self, constraints: Constraints) -> Option<LayoutResult>;
}

impl PassLayoutExt for Tree {
  fn pass_layout(&mut self, constraints: Constraints) -> Option<LayoutResult> {
    self.set_layout_constraints_override(Some(constraints));
    run_pass(self);
    let result = self.last_layout().cloned();
    self.set_layout_constraints_override(None);
    result
  }
}

mod absolute_position;
mod borders;
mod column;
mod constraints;
mod edge_cases;
mod flex;
mod flex_constraints;
mod frame;
mod frame_constraints;
mod nested;
mod node_ids;
mod offscreen_clipping;
mod offset;
mod padding;
mod ported_flex;
mod quads;
mod row;
mod scroll;
mod scrollbar_placement;
mod stack;
mod text_centering;
mod theme_typography;
