Skip to main content

Crate blinc_layout

Crate blinc_layout 

Source
Expand description

Blinc Layout Engine

Flexbox layout powered by Taffy with GPUI-style builder API.

§Example

use blinc_layout::prelude::*;

let ui = div()
    .flex_col()
    .w(400.0)
    .h(300.0)
    .gap(4.0)
    .p(4.0)
    .child(
        div()
            .flex_row()
            .justify_between()
            .child(text("Title").size(24.0))
            .child(div().square(32.0).rounded(8.0))
    )
    .child(
        div().flex_grow()
    );

let mut tree = RenderTree::from_element(&ui);
tree.compute_layout(800.0, 600.0);

Re-exports§

pub use key::reset_call_counters;
pub use key::InstanceKey;
pub use element::BorderBuilder;
pub use element::BorderSide;
pub use element::BorderSides;
pub use element::CursorStyle;
pub use element::DynRenderProps;
pub use element::ElementBounds;
pub use element::FlowRef;
pub use element::MotionAnimation;
pub use element::MotionKeyframe;
pub use element::RenderLayer;
pub use element::RenderProps;
pub use element::ResolvedRenderProps;
pub use diff::diff;
pub use diff::diff_children;
pub use diff::diff_elements;
pub use diff::reconcile;
pub use diff::ChangeCategory;
pub use diff::ChildDiff;
pub use diff::DiffResult;
pub use diff::DivHash;
pub use diff::ReconcileActions;
pub use event_handler::EventCallback;
pub use event_handler::EventContext;
pub use event_handler::EventHandlers;
pub use event_handler::HandlerRegistry;
pub use event_router::EventRouter;
pub use event_router::HitTestResult;
pub use event_router::MouseButton;
pub use interactive::DirtyTracker;
pub use interactive::InteractiveContext;
pub use interactive::NodeState;
pub use style::LayoutStyle;
pub use tree::LayoutNodeId;
pub use tree::LayoutTree;
pub use tree::TextMeasureContext;
pub use element::GlassMaterial;
pub use element::Material;
pub use element::MaterialShadow;
pub use element::MetallicMaterial;
pub use element::SolidMaterial;
pub use element::WoodMaterial;
pub use div::div;
pub use div::Div;
pub use div::ElementBuilder;
pub use div::ElementTypeId;
pub use div::FontFamily;
pub use div::FontWeight;
pub use div::GenericFont;
pub use div::ImageRenderInfo;
pub use div::StyledTextRenderInfo;
pub use div::StyledTextSpanInfo;
pub use div::TextAlign;
pub use div::TextVerticalAlign;
pub use stack::stack;
pub use stack::Stack;
pub use div::DivRef;
pub use div::ElementRef;
pub use image::emoji;
pub use image::emoji_sized;
pub use image::image;
pub use image::img;
pub use image::Image;
pub use image::ImageFilter;
pub use image::LoadingStrategy;
pub use image::ObjectFit;
pub use image::ObjectPosition;
pub use image::Placeholder;
pub use rich_text::rich_text;
pub use rich_text::rich_text_styled;
pub use rich_text::RichText;
pub use svg::svg;
pub use svg::Svg;
pub use text::text;
pub use text::Text;
pub use renderer::GlassPanel;Deprecated
pub use renderer::ImageData;
pub use renderer::LayoutRenderer;
pub use renderer::OnReadyCallback;
pub use renderer::OnReadyEntry;
pub use renderer::RenderTree;
pub use renderer::RenderTreeDebugStats;
pub use renderer::StyledTextData;
pub use renderer::StyledTextSpan;
pub use renderer::SvgData;
pub use renderer::TextData;
pub use renderer::UpdateResult;
pub use canvas::canvas;
pub use canvas::Canvas;
pub use canvas::CanvasBounds;
pub use canvas::CanvasData;
pub use canvas::CanvasRenderFn;
pub use render_state::create_shared_motion_states;
pub use render_state::get_global_scheduler;
pub use render_state::has_global_scheduler;
pub use render_state::queue_global_motion_exit_cancel;
pub use render_state::queue_global_motion_exit_start;
pub use render_state::queue_global_motion_start;
pub use render_state::set_global_scheduler;
pub use render_state::ActiveMotion;
pub use render_state::CssAnimationStore;
pub use render_state::MotionState;
pub use render_state::NodeRenderState;
pub use render_state::Overlay;
pub use render_state::RenderState;
pub use render_state::SharedMotionStates;
pub use stateful::check_stateful_animations;
pub use stateful::check_stateful_deps;
pub use stateful::clear_stateful_animations;
pub use stateful::clear_stateful_base_updaters;
pub use stateful::clear_stateful_deps;
pub use stateful::has_animating_statefuls;
pub use stateful::has_pending_subtree_rebuilds;
pub use stateful::has_stateful_base_updater;
pub use stateful::peek_needs_redraw;
pub use stateful::queue_prop_update;
pub use stateful::queue_subtree_rebuild;
pub use stateful::request_redraw;
pub use stateful::take_needs_redraw;
pub use stateful::take_pending_prop_updates;
pub use stateful::take_pending_subtree_rebuilds;
pub use stateful::update_stateful_base_props;
pub use stateful::use_shared_state;
pub use stateful::use_shared_state_with;
pub use stateful::PendingSubtreeRebuild;
pub use stateful::SharedState;
pub use stateful::StateTransitions;
pub use stateful::StatefulInner;
pub use animated::AnimatedProperties;
pub use animated::AnimationBuilder;
pub use layout_animation::LayoutAnimation;
pub use layout_animation::LayoutAnimationConfig;Deprecated
pub use layout_animation::LayoutAnimationState;
pub use units::pct;
pub use units::px;
pub use units::sp;
pub use units::Length;
pub use units::Unit;
pub use motion::check_and_clear_exiting;
pub use motion::check_ready_for_enter;
pub use motion::current_motion_key;
pub use motion::is_inside_animating_motion;
pub use motion::is_inside_motion;
pub use motion::motion;
pub use motion::motion_derived;
pub use motion::motion_events;
pub use motion::motion_presence_store;
pub use motion::query_presence_state;
pub use motion::start_exit_for_key;
pub use motion::update_presence_state;
pub use motion::ElementAnimation;
pub use motion::ExitingChild;
pub use motion::Motion;
pub use motion::MotionBindings;
pub use motion::MotionPresenceState;
pub use motion::MotionPresenceStore;
pub use motion::SharedAnimatedValue;
pub use motion::SlideDirection;
pub use motion::StaggerConfig;
pub use motion::StaggerDirection;
pub use text_measure::measure_text;
pub use text_measure::measure_text_with_options;
pub use text_measure::set_text_measurer;
pub use text_measure::TextLayoutOptions;
pub use text_measure::TextMeasurer;
pub use text_measure::TextMetrics;
pub use text_selection::clear_selection;
pub use text_selection::get_selected_text;
pub use text_selection::global_selection;
pub use text_selection::set_selection;
pub use text_selection::SelectionSource;
pub use text_selection::SharedTextSelection;
pub use text_selection::TextSelection;

Modules§

animated
Animation integration for the fluent element API
calc
CSS calc() expression engine
canvas
Canvas element for custom GPU drawing
click_outside
Click-outside detection system
css_parser
CSS subset parser for ElementStyle
diff
Structural Diff and Merge Algorithm for Div Elements
div
GPUI-style div builder with tailwind-style methods
element
Element types and traits for layout-driven UI
element_style
Unified element styling
event_handler
Event handler storage for layout elements
event_router
Event routing from platform input to layout elements
image
Image element builder
interactive
Interactive state management for layout nodes
key
Stable unique key generation for component instances.
layout_animation
Layout animation system for animating bounds changes
markdown
Markdown rendering support for blinc_layout
motion
Motion container for animations
notch
Notch element for shapes with concave curves or sharp steps
overlay_state
Global overlay context singleton
pointer_query
Continuous pointer query system for CSS-driven pointer interaction.
prelude
Prelude module - import everything commonly needed
render_state
RenderState - Dynamic render properties separate from tree structure
renderer
RenderTree bridge connecting layout to rendering
rich_text
Rich text element with inline formatting support
scroll
Scroll container element with webkit-style bounce physics
selector
Element selector and programmatic control API
stack
Stack - Container for overlayed elements
stateful
Stateful elements with user-defined state types
style
Layout style helpers
styled_text
Styled text with multiple color spans
svg
SVG element builder
syntax
Syntax highlighting for code elements
text
Text element builder
text_measure
Text measurement for layout
text_selection
Global text selection state for clipboard support
tree
Layout tree management
typography
Typography helpers for semantic text elements
units
CSS-like units for layout dimensions
visual_animation
Visual Animation System (FLIP-style)
widgets
Ready-to-use widgets with built-in styling and behavior

Macros§

css
CSS-like macro for creating ElementStyle with CSS property names
flow
Define a @flow shader using Rust-like syntax that compiles to a FlowGraph.
style
Rust-friendly macro for creating ElementStyle with builder-like syntax