Skip to main content

Crate cranpose_ui

Crate cranpose_ui 

Source
Expand description

High level UI primitives built on top of the Compose core runtime.

Re-exports§

pub use text_field_focus::has_focused_field;
pub use layout::measure_layout;
pub use layout::tree_needs_layout;
pub use layout::LayoutBox;
pub use layout::LayoutEngine;
pub use layout::LayoutMeasurements;
pub use layout::LayoutNodeData;
pub use layout::LayoutNodeKind;
pub use layout::LayoutTree;
pub use layout::SemanticsAction;
pub use layout::SemanticsCallback;
pub use layout::SemanticsNode;
pub use layout::SemanticsRole;
pub use layout::SemanticsTree;
pub use primitives::BasicTextField;
pub use primitives::BasicTextFieldOptions;
pub use primitives::Box;
pub use primitives::BoxScope;
pub use primitives::BoxSpec;
pub use primitives::BoxWithConstraints;
pub use primitives::BoxWithConstraintsScope;
pub use primitives::BoxWithConstraintsScopeImpl;
pub use primitives::Button;
pub use primitives::Column;
pub use primitives::ColumnSpec;
pub use primitives::ForEach;
pub use primitives::Layout;
pub use primitives::Row;
pub use primitives::RowSpec;
pub use primitives::Spacer;
pub use primitives::SubcomposeLayout;
pub use primitives::Text;
pub use scroll::ScrollElement;
pub use scroll::ScrollNode;
pub use scroll::ScrollState;
pub use widgets::lazy_list::LazyColumn;
pub use widgets::lazy_list::LazyColumnSpec;
pub use widgets::lazy_list::LazyRow;
pub use widgets::lazy_list::LazyRowSpec;

Modules§

fling_animation
Fling animation driver for scroll containers.
layout
scroll
Scroll state and node implementation for cranpose.
text_field_focus
Global focus manager for text fields.
text_layout_result
Text layout result with cached glyph positions.
widgets
UI Widget components

Macros§

rememberScrollState
Creates a remembered ScrollState.

Structs§

Alignment
Alignment across both axes used for positioning content within a box.
AlphaElement
Element that creates and updates alpha nodes.
AlphaNode
Node that applies alpha transparency to its content.
BackgroundElement
Element that creates and updates background nodes.
BackgroundNode
Node that draws a background behind its content.
ClickableElement
Element that creates and updates clickable nodes.
ClickableNode
Color
Composition
Constraints
Constraints used during layout measurement.
CornerRadii
CornerShapeElement
Element that creates and updates corner shape nodes.
CornerShapeNode
Node that tracks the latest rounded corner shape.
Dp
Density-independent pixels
DrawCacheBuilder
EdgeInsets
Padding values for each edge of a rectangle.
FillElement
Element that creates and updates fill nodes.
FillNode
Node that fills the maximum available space in one or both dimensions.
FocusManager
Focus manager that tracks and manages focus state across the composition.
GraphicsLayer
HeadlessRenderer
A lightweight renderer that walks the layout tree and materialises paint commands.
KeyEvent
A keyboard input event.
LayoutNode
LazyListItemInfo
Information about a single visible item in a lazy list.
LazyListLayoutInfo
Information about the currently visible items in a lazy list.
LazyListState
State object for lazy list scroll position tracking.
MeasureResult
Result of a measurement operation.
Modifier
A modifier chain that can be applied to composable elements. Modifiers form a persistent tree structure (via CombinedModifier pattern) to enable O(1) composition and structural sharing during recomposition.
ModifierChainTraceGuard
RAII guard returned when installing a modifier chain trace subscriber.
ModifierNodeSlices
Snapshot of modifier node slices that impact draw and pointer subsystems.
Modifiers
Modifier keys state.
OffsetElement
Element that creates and updates offset nodes.
OffsetNode
Node that offsets its content by a fixed (x, y) amount.
PaddingElement
Element that creates and updates padding nodes.
PaddingNode
Node that adds padding around its content.
Placement
Placement information for a measured child.
Point
PointerEvent
Pointer event with consumption tracking for gesture disambiguation.
PointerInputScope
RecordedRenderScene
A collection of render operations for a composed scene.
Rect
ResolvedBackground
ResolvedModifiers
RoundedCornerShape
Size
SizeElement
Element that creates and updates size nodes.
SizeNode
Node that enforces size constraints on its content.
SnapshotState
SubcomposeLayoutNode
Node responsible for orchestrating measure-time subcomposition.
SubcomposeMeasureScopeImpl
Concrete implementation of SubcomposeMeasureScope.
TextFieldElement
Element that creates and updates TextFieldModifierNode instances.
TextFieldModifierNode
Modifier node for editable text fields.
TextMetrics
TextModifierElement
Element that creates and updates TextModifierNode instances.
TextModifierNode
Node that stores text content and handles measurement, drawing, and semantics.

Enums§

Brush
DrawCommand
FillDirection
Direction for fill modifiers (horizontal, vertical, or both).
HorizontalAlignment
Alignment along the horizontal axis.
IntrinsicSize
Specifies how to size a component based on its intrinsic measurements.
KeyCode
Physical key codes for keyboard input.
KeyEventType
Type of keyboard event.
LinearArrangement
Arrangement strategy matching Jetpack Compose’s linear arrangements.
PaintLayer
Layer that a paint operation targets within the rendering pipeline.
PointerEventKind
RenderOp
A rendered operation emitted by the headless renderer stub.
VerticalAlignment
Alignment along the vertical axis.

Traits§

Arrangement
Trait implemented by arrangement strategies that distribute children on an axis.
Measurable
Object capable of measuring a layout child and exposing intrinsic sizes.
Placeable
Result of running a measurement pass for a single child.
SubcomposeLayoutScope
Base trait for measurement scopes.
SubcomposeMeasureScope
Public trait exposed to measure policies for subcomposition.
TextMeasurer

Functions§

active_focus_target
Returns the currently active focus target, if any.
clear_focus_invalidations
Clears all pending focus invalidations without processing them.
clear_pointer_repasses
Clears all pending pointer repasses without processing them.
collect_modifier_slices
Collects modifier node slices directly from a reconciled ModifierNodeChain.
collect_slices_from_modifier
Collects modifier node slices by instantiating a temporary node chain from a Modifier.
current_density
Returns the current density scale factor (logical px per dp).
execute_draw_commands
format_layout_tree
Returns a formatted string representation of the layout tree
format_modifier_chain
Formats the modifier chain using inspector data.
format_render_scene
Returns a formatted string representation of the render scene
get_cursor_x_for_offset
Returns x position for given byte offset. Used for cursor rendering and selection geometry.
get_offset_for_position
Returns byte offset in text for given x position. Used for cursor positioning on click.
has_pending_draw_repasses
Returns true if any draw repasses are pending.
has_pending_focus_invalidations
Returns true if any focus invalidations are pending.
has_pending_layout_repasses
Returns true if any layout repasses are pending.
has_pending_pointer_repasses
Returns true if any pointer repasses are pending.
install_modifier_chain_trace
Installs a callback that receives modifier chain snapshots when debugging is enabled.
is_cursor_visible
Returns whether the cursor should be visible right now.
layout_text
Computes full text layout with cached glyph positions. Returns TextLayoutResult for O(1) position lookups.
log_layout_tree
Logs the current layout tree to stdout with indentation showing hierarchy
log_modifier_chain
Logs the contents of a modifier node chain including capabilities.
log_render_scene
Logs the current render scene to stdout showing all draw operations
log_screen_summary
Logs a compact summary of what’s on screen (counts by type)
measure_text
next_cursor_blink_time
Returns the next cursor blink transition time, if any. Use this for WaitUntil scheduling in the event loop.
peek_focus_invalidation
Returns true if a focus invalidation is pending without clearing it.
peek_layout_invalidation
Returns true if a layout invalidation is pending without clearing it.
peek_pointer_invalidation
Returns true if a pointer invalidation is pending without clearing it.
peek_render_invalidation
Returns true if a render invalidation is pending without clearing it.
process_focus_invalidations
Processes all pending focus invalidations.
process_pointer_repasses
Processes all pending pointer repasses.
request_focus_invalidation
Requests a focus recomposition without affecting layout/draw dirties.
request_layout_invalidation
Requests a global layout re-run.
request_pointer_invalidation
Requests a new pointer-input pass without touching layout or draw dirties.
request_render_invalidation
Requests that the renderer rebuild the current scene.
reset_cursor_blink
Resets cursor to visible and restarts the blink timer. Call this on any input (key press, paste) so cursor stays visible while typing.
run_test_composition
Build a composition with a simple in-memory applier and run the provided closure once.
schedule_draw_repass
Schedules a draw-only repass for a specific node.
schedule_focus_invalidation
Schedules a focus invalidation for the specified node.
schedule_layout_repass
Schedules a layout repass for a specific node.
schedule_pointer_repass
Schedules a pointer repass for the specified node.
set_active_focus_target
Sets the currently active focus target.
set_density
Updates the current density scale factor.
set_text_measurer
start_cursor_blink
Starts the global cursor blink animation. Called when a text field gains focus.
stop_cursor_blink
Stops the global cursor blink animation. Called when no text field is focused.
take_draw_repass_nodes
Takes all pending draw repass node IDs.
take_focus_invalidation
Returns true if a focus invalidation was pending and clears the flag.
take_layout_invalidation
Returns true if a layout invalidation was pending and clears the flag.
take_layout_repass_nodes
Takes all pending layout repass node IDs.
take_pointer_invalidation
Returns true if a pointer invalidation was pending and clears the flag.
take_render_invalidation
Returns true if a render invalidation was pending and clears the flag.
tick_cursor_blink
Advances the cursor blink state if needed. Returns true if a redraw is needed.

Type Aliases§

Key
TestComposition
Convenience alias used in examples and tests.

Attribute Macros§

composable