slint-ui-templates 0.1.0

Composable Slint UI building blocks — mother-child pattern, token-driven
Documentation
{
  "source": "layout/ratio_solver.rs",
  "items": [
    {
      "name": "Panel",
      "kind": "struct",
      "signature": "pub struct Panel",
      "line": 17,
      "doc": "A resizable panel with a normalized ratio and min/max constraints.\nP an el struct."
    },
    {
      "name": "new",
      "kind": "fn",
      "signature": "pub fn new(id: impl Into<String>, ratio: f32) -> Self",
      "line": 28,
      "doc": "Create a panel with the given id and initial ratio, using default constraints."
    },
    {
      "name": "with_constraint",
      "kind": "fn",
      "signature": "pub fn with_constraint(mut self, min: f32, max: f32) -> Self",
      "line": 33,
      "doc": "Set custom min/max ratio constraints on this panel (builder pattern)."
    },
    {
      "name": "drag",
      "kind": "fn",
      "signature": "pub fn drag(panels: &mut [Panel], handle_idx: usize, delta: f32) -> f32",
      "line": 45,
      "doc": "Apply a drag delta to the handle between panels[handle_idx] and panels[handle_idx + 1].\n\n`delta` is a signed ratio fraction: positive = handle moves right/down.\nBoth neighbors update; sum of all ratios stays at 1.0.\n\nReturns the actual transfer applied (may be smaller than `delta` due to constraints)."
    },
    {
      "name": "normalize",
      "kind": "fn",
      "signature": "pub fn normalize(panels: &mut [Panel])",
      "line": 70,
      "doc": "Normalize panel ratios so they sum to exactly 1.0.\nCall this after constructing panels to ensure invariant holds."
    },
    {
      "name": "check_sum",
      "kind": "fn",
      "signature": "pub fn check_sum(panels: &[Panel]) -> bool",
      "line": 80,
      "doc": "Verify that panel ratios sum to approximately 1.0."
    }
  ]
}