Skip to main content

Crate blinc_app

Crate blinc_app 

Source
Expand description

Blinc Application Framework

Clean API for building Blinc applications with layout and rendering.

§Example (Headless Rendering)

use blinc_app::prelude::*;

fn main() -> Result<()> {
    let app = BlincApp::new()?;

    let ui = div()
        .w(400.0).h(300.0)
        .flex_col().gap(4.0).p(4.0)
        .child(
            div().glass()
                .w_full().h(100.0)
                .rounded(16.0)
                .child(text("Hello Blinc!").size(24.0))
        );

    app.render(&ui, &target_view, 400.0, 300.0)?;
}

§Example (Windowed Application)

use blinc_app::prelude::*;
use blinc_app::windowed::{WindowedApp, WindowedContext};

fn main() -> Result<()> {
    WindowedApp::run(WindowConfig::default(), |ctx| {
        div()
            .w(ctx.width).h(ctx.height)
            .bg([0.1, 0.1, 0.15, 1.0])
            .flex_center()
            .child(
                div().glass().rounded(16.0).p(24.0)
                    .child(text("Hello Blinc!").size(32.0))
            )
    })
}

Modules§

blockquote
Blockquote widget for quoted content
button
Ready-to-use Button widget
checkbox
Ready-to-use Checkbox widget
code
Code block widget with syntax highlighting
hr
Horizontal rule widget
link
Link widget for clickable text
overlay_events
Custom event types for overlay state machine
prelude
Prelude module - import everything commonly needed
scroll
Scroll container widget with webkit-style bounce physics
scroll_events
Internal events for scroll animation (not exposed to users)
table
Table element builder for structured data display
text_area
Ready-to-use TextArea widget
text_input
Ready-to-use TextInput widget
windowed
Windowed application runner

Structs§

ActiveMotion
Active motion animation for a node
AnimatedKeyframe
A keyframe animation that automatically registers with the scheduler
AnimatedProperties
Holds animated values for element properties
AnimatedTimeline
A timeline animation that automatically registers with the scheduler
AnimatedValue
An animated value that automatically registers with the scheduler
AnimationBuilder
A builder for declarative animation transitions
AnimationPreset
Pre-built animation presets for common patterns
BackdropConfig
Configuration for overlay backdrop
BlincApp
The main Blinc application
BlincConfig
Blinc application configuration
Blockquote
A blockquote container widget
BlockquoteConfig
Configuration for blockquote styling
BlurStyle
Pure backdrop blur effect configuration
BoundStateful
A bound stateful element that maintains shared storage with an ElementRef
Button
Button widget - wraps Stateful<ButtonState>
ButtonConfig
Button-specific configuration (colors)
Canvas
Canvas element for custom GPU drawing
CanvasBounds
Bounds passed to canvas render callback
ChangeCategory
Categories of changes between two Div elements.
Checkbox
The fully-built checkbox component (Div containing stateful checkbox + optional label)
CheckboxConfig
Checkbox configuration
ChildKeyCounter
Counter for generating stable child keys within a stateful context
Code
Code block widget
CodeConfig
Code block configuration
ComplexSelector
A complex selector is a chain of compound selectors joined by combinators. e.g. #parent:hover > .child:first-child segments: [(parent compound, Some(Child)), (child compound, None)]
CompoundSelector
A compound selector is a sequence of simple selectors with no combinator. e.g. #id.class:hover = [Id(“id”), Class(“class”), State(Hover)]
ContextMenuBuilder
Builder for context menu overlays
CornerConfig
Configuration for a single corner
CornersConfig
Configuration for all four corners
CssAnimation
CSS animation configuration parsed from animation: property
CssKeyframe
A single keyframe stop in an animation
CssKeyframes
A CSS keyframe animation definition
CssParseError
Error type for CSS parsing with context information
CssParseResult
Result of parsing CSS with error collection
CssSelector
A parsed CSS selector with optional state modifier
DebugMode
Debug mode flags for visual debugging
DialogBuilder
Builder for dialog overlays
DiffResult
Result of diffing two Div elements.
DirtyTracker
Dirty tracking for incremental re-renders
Div
A div element builder with GPUI/Tailwind-style methods
DivHash
Content hash for stable element identity matching.
DropdownBuilder
Builder for dropdown overlays
DynRenderProps
Dynamic render props that can hold references to reactive values
ElementAnimation
Animation configuration for element lifecycle
ElementBounds
Computed layout bounds for an element after layout computation
ElementHandle
Handle to a queried element for programmatic manipulation
ElementRef
ElementRegistry
Registry mapping string IDs to layout node IDs
ElementStyle
Visual style properties for an element
EventContext
Context passed to event handlers
EventHandlers
Storage for event handlers on an element
EventRouter
Routes platform input events to layout elements
FlowGraph
A parsed @flow block — the DAG intermediate representation
FlowInput
An input declaration in a flow graph
FlowNode
A processing node in the flow graph
FlowOutput
An output declaration in a flow graph
FontFamily
Font family specification
FontTextMeasurer
A text measurer that uses actual font metrics
GlassMaterial
Glass/vibrancy material that blurs content behind it
GlassPanelDeprecated
A computed glass panel ready for GPU rendering
HandlerRegistry
Global handler registry for the render tree
HitTestResult
Result of a hit test
HrConfig
Configuration for horizontal rule styling
Image
An image element builder
ImageData
Image data for rendering
ImageFilter
Image filter effects
ImageRenderInfo
Image render data extracted from element
InputConstraints
InstanceKey
Generates a stable unique key for component instances.
InteractiveContext
Interactive state manager for layout nodes
JsonHighlighter
A basic JSON syntax highlighter
KeyframeHandle
Handle for interacting with an animated keyframe track
KeyframeProperties
Properties that can be animated in a multi-property keyframe
LayoutAnimationConfigDeprecated
Configuration for which layout properties to animate
LayoutNodeId
LayoutTree
Maps between Blinc node IDs and Taffy node IDs
Link
A hyperlink widget
LinkConfig
Configuration for link styling
ListConfig
Configuration for list styling
ListItem
A list item
MarkdownConfig
Configuration for markdown rendering
MarkdownRenderer
Markdown renderer that converts markdown text to blinc layout elements
MaterialShadow
Shadow configuration for materials
MetallicMaterial
Metallic/reflective material
ModalBuilder
Builder for modal overlays
Motion
Motion container for animations
MotionBindings
Motion bindings for continuous animation driven by AnimatedValue
MotionHandle
Handle to a motion animation for querying its state
MultiKeyframeAnimation
Multi-property keyframe animation
NoState
A no-op state type for dependency-based refreshing without state transitions
NodeRenderState
Dynamic render state for a single node
Notch
A notch element for shapes with concave curves
ObjectPosition
Image alignment within its container
OrderedList
An ordered list container
OverlayAnimation
Animation configuration for overlay enter/exit
OverlayConfig
Configuration for an overlay instance
OverlayContext
Global overlay context singleton
OverlayHandle
Handle to a specific overlay instance for management
PlainHighlighter
A simple highlighter with no rules (plain text)
RadioGroup
The fully-built radio group component (Div containing radio buttons and optional label)
RadioGroupBuilder
Builder for creating RadioGroup components with fluent API. Config is accumulated via builder methods; the actual RadioGroup is built lazily via OnceCell::get_or_init() on first access (build/render_props/children).
RadioGroupConfig
Radio group configuration
ReconcileActions
Actions to take after reconciling a diff.
RenderContext
Internal render context that manages GPU resources and rendering
RenderProps
Visual properties for rendering an element
RenderState
Global render state - updated every frame independently of tree rebuilds
RenderTree
RenderTree - bridges layout computation and rendering
ResolvedRenderProps
Resolved render props with concrete values
RichText
A rich text element with inline formatting support
RustHighlighter
A basic Rust syntax highlighter
SchedulerHandle
A weak handle to the animation scheduler
Scroll
A scrollable container element with bounce physics
ScrollConfig
Configuration for scroll behavior
ScrollOptions
Options for scroll-into-view behavior
ScrollPhysics
Internal physics state for scroll animation
ScrollRef
Reference for programmatic control of a scroll container
ScrollRenderInfo
Information about scroll state for rendering
Shadow
Shadow configuration
SolidMaterial
Solid opaque material (the default)
SpacingRect
Spacing values for padding and margin (all in pixels)
SpringConfig
Configuration for a spring animation
Stack
A stack container where all children are positioned absolutely and stack over each other.
StaggerConfig
Configuration for stagger animations
StateContext
Context for stateful elements providing scoped state management
Stateful
A stateful element with user-defined state type
StatefulBuilder
Builder for creating stateful containers with the new StateContext API
StatefulInner
Internal state for Stateful<S>, wrapped in Arc<Mutex<...>> for event handler access
Stylesheet
A parsed stylesheet containing styles keyed by element ID
Svg
An SVG element builder
SvgData
SVG data for rendering
SyntaxConfig
Configuration for syntax highlighting passed to code elements
TableBuilder
A builder for creating tables with headers and data
TableCell
A table cell wrapper that can hold any content
TaskListItem
A task list item with a checkbox
Text
A text element builder
TextArea
Ready-to-use text area element
TextAreaConfig
TextArea configuration
TextAreaState
TextArea widget state
TextData
Text data for rendering
TextInput
TextInput widget using FSM-driven Stateful for incremental updates
TextInputConfig
TextPosition
Position in a multi-line text (line and column)
TextSelection
Global text selection state
ToastBuilder
Builder for toast overlays
TokenHit
Information about a token hit (for intellisense callbacks)
TokenRule
A single token style rule with regex pattern
UnorderedList
An unordered list container
ValueContext
Context provided to value resolution at render time
WindowConfig
Window configuration
WoodMaterial
Wood grain material (placeholder for future texture support)

Enums§

AnimationDirection
Animation direction
AnimationFillMode
Animation fill mode
AnimationTiming
Animation timing function
BlincError
Errors that can occur in the Blinc application
BlurQuality
Post-processing effect quality levels
ButtonState
Common button interaction states
ButtonVisualState
Common button interaction states
ChildDiff
Result of diffing a single child position.
Combinator
Combinator between compound selectors
Corner
Corner positions for toast notifications
CornerStyle
The type of corner curve
CssElementState
Element state for pseudo-class selectors
CssSeverity
Severity level for parse warnings/errors
CursorStyle
Mouse cursor style for an element
DynFloat
Dynamic f32 value that can also be a spring
DynValue
Dynamic value that can be static, signal, or spring
Easing
Easing function type
ElementEvent
Events that can be programmatically dispatched to elements
ElementTypeId
Element type identifier for downcasting
FlowError
Errors from flow graph validation
FlowExpr
A flow expression — the computation at each node
FlowFunc
Built-in function identifiers for the flow language
FlowInputSource
Source of a flow input value
FlowOutputTarget
Target for a flow output
FlowTarget
Target pipeline for a flow
FlowType
Flow data types
FontWeight
Font weight options
GenericFont
Generic font category for fallback when a named font isn’t available
InputType
LayerEffect
Post-processing effects that can be applied to layers
Length
A length value with its unit
ListMarker
List marker style
LoadingStrategy
Image loading strategy
Material
Material types that can be applied to elements
MotionState
State of a motion animation
MouseButton
Mouse button identifier (matches platform)
ObjectFit
How an image should fit within its container
Overlay
Overlay type for rendering on top of the tree
OverlayKind
Categorizes overlay behavior and default configuration
OverlayPosition
How to position an overlay
OverlayState
State machine for overlay lifecycle
Placeholder
Placeholder configuration for lazy-loaded images
RadioLayout
Layout direction for radio options
RenderLayer
Render layer for separating elements in glass-effect rendering
ScrollBehavior
Scroll animation behavior
ScrollBlock
Vertical scroll alignment
ScrollDirection
Scroll direction for the container
ScrollInline
Horizontal scroll alignment
ScrollState
Scroll container states for webkit-style bounce scroll
SelectionSource
Source of the selected text
SelectorPart
A single part of a compound selector
SlideDirection
Direction for slide animations
StaggerDirection
Direction for stagger animations
StatefulCheckboxState
Checkbox states combining checked status and hover
StructuralPseudo
Structural pseudo-class selectors
StyleAlign
Alignment for align-items and align-self
StyleDisplay
Display mode
StyleFlexDirection
Flex direction
StyleJustify
Justify content values
StyleOverflow
Overflow behavior
StyleVisibility
CSS visibility property
TextAlign
Text alignment options
TextFieldState
Text field focus states
TextVerticalAlign
Vertical alignment for text within its bounding box
ToggleState
Toggle states (on/off)
TokenType
Token type identifier for callbacks
Transform
Unified transform that can represent 2D or 3D transformations
Unit
Tuple conversion for ergonomic unit specification Allows: (16.0, Px) or (4.0, Sp) syntax
UpdateResult
Result of an incremental update attempt

Constants§

CURSOR_BLINK_INTERVAL_MS
Standard cursor blink interval in milliseconds

Traits§

AnimationAccess
Trait for accessing animation values (springs, keyframes, timelines)
ElementBuilder
Trait for types that can build into layout elements
LayoutRenderer
Trait for rendering layout trees with text, SVG, and glass support
NodeState
Trait for node state types
OverlayManagerExt
Extension trait for OverlayManager to create builders
ReactiveAccess
Trait for accessing reactive signal values
StateTransitions
Trait for user-defined state types that can handle event transitions
SyntaxHighlighter
Trait for syntax highlighting implementations

Functions§

b
Create bold text
blockquote
Create a blockquote container
blockquote_with_config
Create a blockquote with custom configuration
button
Create a button with a text label and context-managed state
canvas
Create a canvas element with a render callback
caption
Create caption text (12px, muted, inline)
cell
Create an empty table cell
chained_text
Create a container for chained inline text elements
checkbox
Create a checkbox with reactive checked state
checkbox_labeled
Create a checkbox with label and reactive state
clear_selection
Clear the global text selection
code
Create a code block with the given content
current_motion_key
Get the stable key of the nearest ancestor motion container
diff
Compare two Div elements and produce a DiffResult.
diff_children
Diff children using content-hash-based matching.
diff_elements
Diff two ElementBuilder trait objects.
div
Convenience function to create a new div
elapsed_ms
Get elapsed time in milliseconds since app start (for cursor blinking)
emoji
Create an emoji image element
emoji_sized
Create an emoji image element with custom size
get_overlay_manager
Get the global overlay manager
get_selected_text
Get the currently selected text (convenience function)
global_selection
Get the global text selection state
h1
Create a level-1 heading (32px, bold)
h2
Create a level-2 heading (24px, bold)
h3
Create a level-3 heading (20px, semibold)
h4
Create a level-4 heading (18px, semibold)
h5
Create a level-5 heading (16px, medium)
h6
Create a level-6 heading (14px, medium)
has_focused_text_input
heading
Create a heading with a specific level (1-6)
hr
Create a horizontal rule (divider line)
hr_color
Create a horizontal rule with custom color
hr_thick
Create a horizontal rule with custom thickness
hr_with_bg
Create a horizontal rule with explicit background color for the wrapper
hr_with_config
Create a horizontal rule with custom configuration
image
Alias for img() for those who prefer the full name
img
Convenience function to create a new image element
init_text_measurer
Initialize the global text measurer with font support
init_text_measurer_with_registry
Initialize the global text measurer with a shared font registry
inline_code
Create code-styled inline text with monospace font
is_inside_animating_motion
Check if currently inside an animating motion container
is_inside_motion
Check if currently inside a motion container (regardless of animation state)
label
Create a label (14px, medium weight, inline)
li
Create a list item
link
Create a link with text and URL
markdown
Render markdown to a Div
markdown_light
Render markdown with light theme (for white backgrounds)
markdown_with_config
Render markdown to a Div with custom configuration
motion
Create a motion container
motion_derived
Create a motion container with a key derived from a parent key.
muted
Create muted/secondary text (inline)
notch
Create a new notch element
ol
Create an ordered list
ol_start
Create an ordered list starting at a specific number
overlay_manager
Create a new overlay manager
p
Create a paragraph text element (16px with line height 1.5)
pct
Create a percentage length value
pre
Create a preformatted text block (alias for code)
px
Create a pixel length value
query
Query an element by ID from event handlers
query_motion
Query a motion animation by its stable key
radio_group
Create a radio group with reactive state
reconcile
Apply a diff result to reconcile old into new.
reset_call_counters
Reset all call counters. Call this at the start of each UI build pass.
rich_text
Create a new rich text element with HTML-like markup
rich_text_styled
Create a rich text element from pre-built StyledText
scroll
Create a new scroll container with default bounce physics
scroll_no_bounce
Create a scroll container with bounce disabled
set_selection
Set the global text selection
small
Create small text (12px, inline)
sp
Create a spacing unit length value (4px grid)
span
Create a neutral text span (inline, no wrapping)
stack
Create a stack container where children overlay each other
stateful
Create a new stateful container with automatic key generation
stateful_button
Create a stateful button element with custom styling
stateful_checkbox
Create a stateful checkbox element with custom styling
stateful_from_handleDeprecated
Create a stateful element from a shared state handle (legacy API)
stateful_with_key
Create a stateful container with an explicit key
striped_tr
Create a striped table row
strong
Create bold text (alias for b())
style
Create a new element style
svg
Convenience function to create a new SVG element
system_font_paths
Get the paths to system default fonts, in priority order.
table
Create a table container
task_item
Create a task list item
tbody
Create a table body section
td
Create a table data cell (td)
td_text
Create a data cell with custom text styling
text
Convenience function to create a new text element
text_area
Create a ready-to-use multi-line text area
text_area_state
Create a shared text area state
text_area_state_with_placeholder
Create a shared text area state with placeholder
text_field
Create a text field element
text_input
Create a text input widget By default, uses the config’s default width (200px). Use .w_full() to fill parent width, or .w() to set explicit width.
text_input_state
text_input_state_with_placeholder
tfoot
Create a table footer section
th
Create a table header cell (th)
th_text
Create a header cell with custom text styling
thead
Create a table header section
toggle
Create a toggle element
tr
Create a table row
ul
Create an unordered list
use_shared_state
Get or create a persistent SharedState<S> for the given key.
use_shared_state_with
Get or create a persistent SharedState<S> with a custom initial state.

Type Aliases§

DivRef
Type alias for Div references
EventCallback
Callback for handling events
LayoutAnimation
Type alias for layout animation configuration
OnReadyCallback
Callback type for on_ready notifications when an element is laid out and rendered
OverlayManager
Thread-safe overlay manager
Result
Result type for blinc_app operations
ScrollContainer
A scroll container element with momentum scrolling
SharedAnimatedTimeline
Shared animated timeline that can be cloned and accessed from multiple places
SharedAnimatedValue
Shared animated value type for motion bindings (thread-safe)
SharedElementRegistry
Shared element registry for thread-safe access
SharedKeyframeTrack
Shared keyframe animation that can be cloned and accessed from multiple places
SharedScrollPhysics
Shared handle to scroll physics for external access
SharedState
Shared state handle for Stateful<S> elements
SharedTextAreaState
Shared text area state handle
SharedTextInputState
SharedTextSelection
Thread-safe handle to the global text selection state
StatefulButton
A button element with hover/press states
StatefulCheckbox
A checkbox element with checked/unchecked states
TextField
A text field element with focus states
TextInputState
Toggle
A toggle element (on/off)

Derive Macros§

BlincComponent
Derive macro that generates a unique compile-time key for a component and generates field accessors based on field attributes.