1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
//! # ui_layout
//!
//! Minimal CSS-like layout engine for UI frameworks.
//! Designed for lightweight, fast, and portable applications (e.g. editors and IDEs).
//!
//! Provides predictable layout behavior for custom GUI frameworks,
//! editors, and experimental rendering engines.
//!
//! ## Getting Started
//!
//! Basic usage follows a simple flow:
//!
//! 1. Create a layout tree
//! 2. Run the layout engine
//! 3. Access computed layout results
//!
//! ```rust
//! use ui_layout::*;
//!
//! let mut root = LayoutNode::new(Style::default());
//!
//! // Compute layout using a viewport size.
//! LayoutEngine::layout(&mut root, 800.0, 600.0);
//! ```
//!
//! ## Core Concepts
//!
//! Layout behavior is configured through [`Style`], which groups
//! commonly used layout properties into focused categories:
//!
//! - [`Display`] — controls layout mode
//! - [`SizeStyle`] — width and height constraints
//! - [`Spacing`] — margin, padding, and borders
//! - [`ItemStyle`] — item-specific flex behavior
//! - `justify_content` / `align_items` — child alignment
//! - `flex_direction`, `row_gap`, `column_gap` — flex container behavior
//!
//! This organization keeps layout rules explicit and easy to reason about.
//!
//! ## Observing Layout Results
//!
//! After layout computation, results are written into each
//! [`LayoutNode`] through its `layout_box` field.
//!
//! The resulting [`LayoutBox`] describes how the node was laid out:
//!
//! - `LayoutBox::None` — no layout result
//! - `LayoutBox::BlockBox(BoxModel)` — standard box layout result
//! - `LayoutBox::InlineBox(InlineBox)` — inline content that may span multiple lines
//!
//! [`BoxModel`] contains absolute rectangles for different regions:
//!
//! - `border_box` — outer box including borders
//! - `padding_box` — inner box including padding
//! - `content_box` — content area
//! - `children_box` — area occupied by child content
//!
//! Inline layouts additionally provide [`LineSpan`] information for
//! observing how a box is split across lines.
//!
//! ## Children
//!
//! Layout trees contain children represented by [`LayoutChild`]:
//!
//! - `LayoutChild::Node` — a normal layout node
//! - `LayoutChild::Fragment` — an inline-level fragment
//! - `LayoutChild::Object` — a custom [`FlowLayouter`] object
//! - `LayoutChild::Custom` — a custom [`BlockLayouter`] object
//!
//! [`ItemFragment`] represents the smallest independently positioned
//! piece of inline content.
//!
//! Common fragment types:
//!
//! - `Fragment` — inline content with dimensions
//! - `LineBreak` — forces a line break
//!
//! During layout, fragments are wrapped in [`FragmentNode`] and assigned
//! placement information, allowing inline content to be split and
//! positioned across multiple lines.
//!
//! ## Custom Objects
//!
//! The [`FlowLayouter`] trait allows custom types to participate directly
//! in layout as inline-level objects. Objects report their intrinsic size
//! via [`FlowLayouter::measure`] and perform inline layout via
//! [`FlowLayouter::layout`].
//!
//! The [`BlockLayouter`] trait allows custom types to participate
//! as block-level components. Components return their border-box
//! [`Rect`](crate::Rect) via [`BlockLayouter::layout`].
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;