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
//! Reference layout engine for [Cotis](https://docs.rs/cotis) element trees.
//!
//! `cotis-layout` implements Cotis's [`LayoutManager`](cotis::layout::LayoutManager) and
//! [`LayoutFrameManager`](cotis::layout::LayoutFrameManager) traits. It runs a flexbox-like
//! sizing and positioning pass over a configured element tree and produces a stream of
//! [`RenderCommandOutput`](layout_struct::RenderCommandOutput) values for downstream pipes
//! (typically [`cotis-pipes`](https://docs.rs/cotis-pipes)) and renderers.
//!
//! # Frame lifecycle
//!
//! 1. Create a [`CotisLayoutManager`](preamble::CotisLayoutManager) with the viewport
//! [`Dimensions`](cotis_utils::math::Dimensions).
//! 2. Wire it into a [`CotisApp`](cotis::cotis_app::CotisApp) with a renderer. The renderer
//! supplies a text measurer and window dimensions via [`LayoutManagerCompatible`](cotis::layout::LayoutManagerCompatible).
//! 3. Each frame: `begin_frame()` returns a [`CotisLayoutRun`](preamble::CotisLayoutRun).
//! 4. UI code opens elements through [`ConfigureElements`](cotis::element_configuring::ConfigureElements)
//! (`open_new_element`, `set_config`, `close_element`).
//! 5. Text leaves use [`ConfigureLeafElements`](cotis::element_configuring::ConfigureLeafElements)
//! with [`TextElementConfig`](cotis_defaults::element_configs::text_config::TextElementConfig).
//! 6. `end()` runs layout (fit/grow/shrink, text wrap, positioning) and yields an iterator of
//! [`RenderCommandOutput`](layout_struct::RenderCommandOutput).
//! 7. A pipe such as `CotisLayoutToRenderListPipeForGenerics` converts those commands into
//! renderer-specific draw lists.
//!
//! # Quick start
//!
//! For a runnable desktop demo, use a renderer backend such as
//! [cotis-wgpu](https://github.com/igna-778/cotis-wgpu) or
//! [cotis-raylib](https://github.com/igna-778/cotis-raylib). Local examples under `examples/`
//! mirror the same wiring once ecosystem crates are on crates.io. A minimal setup looks like:
//!
//! ```rust,ignore
//! use cotis::cotis_app::CotisApp;
//! use cotis_layout::preamble::CotisLayoutManager;
//! use cotis_pipes::cotis_layout_pipes::CotisLayoutToRenderListPipeForGenerics;
//! use cotis_utils::math::Dimensions;
//!
//! let dimensions = Dimensions::new(800.0, 600.0);
//! let manager = CotisLayoutManager::new(dimensions);
//! // let app = CotisApp::new(renderer, manager, CotisLayoutToRenderListPipeForGenerics);
//! ```
//!
//! # Modules
//!
//! - [`preamble`] — convenience re-exports: [`CotisLayoutManager`](preamble::CotisLayoutManager), [`CotisLayoutRun`](preamble::CotisLayoutRun),
//! [`TextConfigurable`](preamble::TextConfigurable).
//! - [`layout_traits`] — [`CotisLayoutCompatible`](layout_traits::CotisLayoutCompatible), the bridge trait for custom config types.
//! - [`layout_struct`] — layout output types ([`RenderCommandOutput`](layout_struct::RenderCommandOutput), clip markers,
//! [`TextDrawPayload`](layout_struct::TextDrawPayload)).
//! - [`cotis_traits`] — Cotis trait implementations for the default [`ElementConfig`](cotis_defaults::element_configs::ElementConfig)
//! integration path and element-state query hooks.
//!
//! # Generic config types
//!
//! To use a config type other than `ElementConfig`, implement [`CotisLayoutCompatible`](layout_traits::CotisLayoutCompatible) to map
//! your type into the internal layout style representation, and [`TextConfigurable`](preamble::TextConfigurable) if your type
//! supports text leaves. Built-in wiring for `ElementConfig` lives in [`cotis_traits`].
//!
//! # Inspecting layout state
//!
//! After a frame completes, [`CotisLayoutManager::get_cache_element`](preamble::CotisLayoutManager::get_cache_element) exposes a snapshot of the
//! last layout tree for debugging and hit-testing. [`cotis_traits::secondary_traits`] implements
//! [`cotis_utils::element_state`] query traits on that cache.
//!
//! # Cargo features
//!
//! | Feature | Effect |
//! |---------|--------|
//! | `serialization` | Enables `serde` on render output types and serialization in `cotis`, `cotis-defaults`, and `cotis-utils`. |
pub
pub
pub
/// Entry-point re-exports for the layout manager and frame configurator.
///
/// Most applications use [`CotisLayoutManager`](crate::layout_management::CotisLayoutManager) as the `LayoutManager` type parameter on
/// [`CotisApp`](cotis::cotis_app::CotisApp) and interact with elements each frame through
/// [`CotisLayoutRun`](crate::layout_management::CotisLayoutRun) via the standard Cotis configuring traits (see [`crate::cotis_traits`]).