1use cranpose_core::{location_key, MemoryApplier};
4pub use cranpose_core::{Composition, Key};
5pub use cranpose_macros::composable;
6
7mod cursor_animation;
8mod debug;
9mod draw;
10pub mod fling_animation;
11mod focus_dispatch;
12mod key_event;
13pub mod layout;
14mod modifier;
15mod modifier_nodes;
16mod pointer_dispatch;
17mod primitives;
18mod render_state;
19mod renderer;
20pub mod scroll;
21mod subcompose_layout;
22pub mod text;
23pub mod text_field_focus;
24mod text_field_handler;
25mod text_field_input;
26mod text_field_modifier_node;
27pub mod text_layout_result;
28mod text_modifier_node;
29pub mod widgets;
30mod word_boundaries;
31
32pub use text_field_focus::has_focused_field;
34pub use cursor_animation::{
36 is_cursor_visible, next_cursor_blink_time, reset_cursor_blink, start_cursor_blink,
37 stop_cursor_blink, tick_cursor_blink,
38};
39
40pub use cranpose_ui_graphics::{BlurredEdgeTreatment, ColorFilter, Dp, ImageBitmap};
41pub use cranpose_ui_layout::IntrinsicSize;
42pub use draw::{execute_draw_commands, DrawCacheBuilder, DrawCommand};
43pub use focus_dispatch::{
44 active_focus_target, clear_focus_invalidations, has_pending_focus_invalidations,
45 process_focus_invalidations, schedule_focus_invalidation, set_active_focus_target,
46};
47pub use cranpose_foundation::nodes::input::focus::FocusManager;
49pub use layout::{
50 build_semantics_tree_from_layout_tree,
51 core::{
52 Alignment, Arrangement, HorizontalAlignment, LinearArrangement, Measurable, Placeable,
53 VerticalAlignment,
54 },
55 measure_layout, measure_layout_with_options, tree_needs_layout, tree_needs_semantics,
56 LayoutBox, LayoutEngine, LayoutMeasurements, LayoutNodeData, LayoutNodeKind, LayoutTree,
57 MeasureLayoutOptions, SemanticsAction, SemanticsCallback, SemanticsNode, SemanticsRole,
58 SemanticsTree,
59};
60pub use modifier::{
61 collect_modifier_slices, collect_semantics_from_modifier, collect_slices_from_modifier,
62 BlendMode, Brush, Color, CompositingStrategy, CornerRadii, DpOffset, EdgeInsets,
63 FocusDirection, FocusRequester, GraphicsLayer, LayerShape, Modifier, ModifierNodeSlices, Point,
64 PointerEvent, PointerEventKind, PointerInputScope, Rect, RenderEffect, ResolvedBackground,
65 ResolvedModifiers, RoundedCornerShape, RuntimeShader, Shadow, ShadowScope, Size,
66 TransformOrigin,
67};
68pub use modifier_nodes::{
69 AlphaElement, AlphaNode, BackgroundElement, BackgroundNode, ClickableElement, ClickableNode,
70 CornerShapeElement, CornerShapeNode, FillDirection, FillElement, FillNode, OffsetElement,
71 OffsetNode, PaddingElement, PaddingNode, SizeElement, SizeNode,
72};
73pub use pointer_dispatch::{
74 clear_pointer_repasses, has_pending_pointer_repasses, process_pointer_repasses,
75 schedule_pointer_repass,
76};
77pub use primitives::{
78 BasicText, BasicTextField, BasicTextFieldOptions, BitmapPainter, Box, BoxScope, BoxSpec,
79 BoxWithConstraints, BoxWithConstraintsScope, BoxWithConstraintsScopeImpl, Button, Canvas,
80 Column, ColumnSpec, ContentScale, ForEach, Image, Layout, LayoutNode, Painter, Row, RowSpec,
81 Spacer, SubcomposeLayout, Text, DEFAULT_ALPHA,
82};
83pub use cranpose_foundation::lazy::{LazyListItemInfo, LazyListLayoutInfo, LazyListState};
85pub use key_event::{KeyCode, KeyEvent, KeyEventType, Modifiers};
86#[cfg(any(test, feature = "test-helpers"))]
87#[doc(hidden)]
88pub use render_state::reset_render_state_for_tests;
89pub use render_state::{
90 current_density, has_pending_draw_repasses, has_pending_layout_repasses,
91 peek_focus_invalidation, peek_layout_invalidation, peek_pointer_invalidation,
92 peek_render_invalidation, request_focus_invalidation, request_layout_invalidation,
93 request_pointer_invalidation, request_render_invalidation, schedule_draw_repass,
94 schedule_layout_repass, set_density, take_draw_repass_nodes, take_focus_invalidation,
95 take_layout_invalidation, take_layout_repass_nodes, take_pointer_invalidation,
96 take_render_invalidation,
97};
98pub use renderer::{HeadlessRenderer, PaintLayer, RecordedRenderScene, RenderOp};
99pub use scroll::{ScrollElement, ScrollNode, ScrollState};
100#[cfg(feature = "test-helpers")]
102pub use modifier::{last_fling_velocity, reset_last_fling_velocity};
103pub use subcompose_layout::{
104 Constraints, MeasureResult, Placement, SubcomposeLayoutNode, SubcomposeLayoutScope,
105 SubcomposeMeasureScope, SubcomposeMeasureScopeImpl,
106};
107pub use text::{
108 get_cursor_x_for_offset, get_offset_for_position, layout_text, measure_text,
109 measure_text_for_node, measure_text_with_options, measure_text_with_options_for_node,
110 prepare_text_layout, prepare_text_layout_for_node, set_text_measurer, LinkAnnotation,
111 ParagraphStyle, PlatformParagraphStyle, PlatformSpanStyle, PlatformTextStyle,
112 PreparedTextLayout, SpanStyle, StringAnnotation, TextDrawStyle, TextLayoutOptions,
113 TextMeasurer, TextMetrics, TextOverflow, TextShaping, TextStyle,
114};
115pub use text_field_modifier_node::{TextFieldElement, TextFieldModifierNode};
116pub use text_modifier_node::{TextModifierElement, TextModifierNode};
117pub use widgets::clickable_text::ClickableText;
118pub use widgets::lazy_list::{LazyColumn, LazyColumnSpec, LazyRow, LazyRowSpec};
119pub use widgets::linked_text::LinkedText;
120
121pub use debug::{
123 format_layout_tree, format_modifier_chain, format_render_scene, format_screen_summary,
124 install_modifier_chain_trace, log_layout_tree, log_modifier_chain, log_render_scene,
125 log_screen_summary, ModifierChainTraceGuard,
126};
127
128pub type TestComposition = Composition<MemoryApplier>;
130
131pub fn run_test_composition(build: impl FnMut()) -> TestComposition {
133 #[cfg(test)]
134 reset_render_state_for_tests();
135 let mut composition = Composition::new(MemoryApplier::new());
136 composition
137 .render(location_key(file!(), line!(), column!()), build)
138 .expect("initial render succeeds");
139 composition
140}
141
142pub use cranpose_core::MutableState as SnapshotState;
143
144#[cfg(test)]
145#[path = "tests/anchor_async_tests.rs"]
146mod anchor_async_tests;
147
148#[cfg(test)]
149#[path = "tests/async_runtime_full_layout_test.rs"]
150mod async_runtime_full_layout_test;
151
152#[cfg(test)]
153#[path = "tests/cursor_position_tests.rs"]
154mod cursor_position_tests;
155
156#[cfg(test)]
157#[path = "tests/tab_switching_tests.rs"]
158mod tab_switching_tests;
159
160#[cfg(test)]
161#[path = "tests/lazy_list_viewport_tests.rs"]
162mod lazy_list_viewport_tests;
163
164#[cfg(test)]
165#[path = "tests/lazy_list_recompose_tests.rs"]
166mod lazy_list_recompose_tests;