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§
- Active
Motion - Active motion animation for a node
- Animated
Keyframe - A keyframe animation that automatically registers with the scheduler
- Animated
Properties - Holds animated values for element properties
- Animated
Timeline - A timeline animation that automatically registers with the scheduler
- Animated
Value - An animated value that automatically registers with the scheduler
- Animation
Builder - A builder for declarative animation transitions
- Animation
Preset - Pre-built animation presets for common patterns
- Backdrop
Config - Configuration for overlay backdrop
- Blinc
App - The main Blinc application
- Blinc
Config - Blinc application configuration
- Blockquote
- A blockquote container widget
- Blockquote
Config - Configuration for blockquote styling
- Blur
Style - Pure backdrop blur effect configuration
- Bound
Stateful - A bound stateful element that maintains shared storage with an ElementRef
- Button
- Button widget - wraps
Stateful<ButtonState> - Button
Config - Button-specific configuration (colors)
- Canvas
- Canvas element for custom GPU drawing
- Canvas
Bounds - Bounds passed to canvas render callback
- Change
Category - Categories of changes between two Div elements.
- Checkbox
- The fully-built checkbox component (Div containing stateful checkbox + optional label)
- Checkbox
Config - Checkbox configuration
- Child
KeyCounter - Counter for generating stable child keys within a stateful context
- Code
- Code block widget
- Code
Config - Code block configuration
- Complex
Selector - A complex selector is a chain of compound selectors joined by combinators.
e.g.
#parent:hover > .child:first-childsegments: [(parent compound, Some(Child)), (child compound, None)] - Compound
Selector - A compound selector is a sequence of simple selectors with no combinator.
e.g.
#id.class:hover= [Id(“id”), Class(“class”), State(Hover)] - Context
Menu Builder - Builder for context menu overlays
- Corner
Config - Configuration for a single corner
- Corners
Config - 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
- CssParse
Error - Error type for CSS parsing with context information
- CssParse
Result - Result of parsing CSS with error collection
- CssSelector
- A parsed CSS selector with optional state modifier
- Debug
Mode - Debug mode flags for visual debugging
- Dialog
Builder - Builder for dialog overlays
- Diff
Result - Result of diffing two Div elements.
- Dirty
Tracker - Dirty tracking for incremental re-renders
- Div
- A div element builder with GPUI/Tailwind-style methods
- DivHash
- Content hash for stable element identity matching.
- Dropdown
Builder - Builder for dropdown overlays
- DynRender
Props - Dynamic render props that can hold references to reactive values
- Element
Animation - Animation configuration for element lifecycle
- Element
Bounds - Computed layout bounds for an element after layout computation
- Element
Handle - Handle to a queried element for programmatic manipulation
- Element
Ref - Element
Registry - Registry mapping string IDs to layout node IDs
- Element
Style - Visual style properties for an element
- Event
Context - Context passed to event handlers
- Event
Handlers - Storage for event handlers on an element
- Event
Router - Routes platform input events to layout elements
- Flow
Graph - A parsed
@flowblock — the DAG intermediate representation - Flow
Input - An input declaration in a flow graph
- Flow
Node - A processing node in the flow graph
- Flow
Output - An output declaration in a flow graph
- Font
Family - Font family specification
- Font
Text Measurer - A text measurer that uses actual font metrics
- Glass
Material - Glass/vibrancy material that blurs content behind it
- Glass
Panel Deprecated - A computed glass panel ready for GPU rendering
- Handler
Registry - Global handler registry for the render tree
- HitTest
Result - Result of a hit test
- HrConfig
- Configuration for horizontal rule styling
- Image
- An image element builder
- Image
Data - Image data for rendering
- Image
Filter - Image filter effects
- Image
Render Info - Image render data extracted from element
- Input
Constraints - Instance
Key - Generates a stable unique key for component instances.
- Interactive
Context - Interactive state manager for layout nodes
- Json
Highlighter - A basic JSON syntax highlighter
- Keyframe
Handle - Handle for interacting with an animated keyframe track
- Keyframe
Properties - Properties that can be animated in a multi-property keyframe
- Layout
Animation Config Deprecated - Configuration for which layout properties to animate
- Layout
Node Id - Layout
Tree - Maps between Blinc node IDs and Taffy node IDs
- Link
- A hyperlink widget
- Link
Config - Configuration for link styling
- List
Config - Configuration for list styling
- List
Item - A list item
- Markdown
Config - Configuration for markdown rendering
- Markdown
Renderer - Markdown renderer that converts markdown text to blinc layout elements
- Material
Shadow - Shadow configuration for materials
- Metallic
Material - Metallic/reflective material
- Modal
Builder - Builder for modal overlays
- Motion
- Motion container for animations
- Motion
Bindings - Motion bindings for continuous animation driven by AnimatedValue
- Motion
Handle - Handle to a motion animation for querying its state
- Multi
Keyframe Animation - Multi-property keyframe animation
- NoState
- A no-op state type for dependency-based refreshing without state transitions
- Node
Render State - Dynamic render state for a single node
- Notch
- A notch element for shapes with concave curves
- Object
Position - Image alignment within its container
- Ordered
List - An ordered list container
- Overlay
Animation - Animation configuration for overlay enter/exit
- Overlay
Config - Configuration for an overlay instance
- Overlay
Context - Global overlay context singleton
- Overlay
Handle - Handle to a specific overlay instance for management
- Plain
Highlighter - A simple highlighter with no rules (plain text)
- Radio
Group - The fully-built radio group component (Div containing radio buttons and optional label)
- Radio
Group Builder - 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). - Radio
Group Config - Radio group configuration
- Reconcile
Actions - Actions to take after reconciling a diff.
- Render
Context - Internal render context that manages GPU resources and rendering
- Render
Props - Visual properties for rendering an element
- Render
State - Global render state - updated every frame independently of tree rebuilds
- Render
Tree - RenderTree - bridges layout computation and rendering
- Resolved
Render Props - Resolved render props with concrete values
- Rich
Text - A rich text element with inline formatting support
- Rust
Highlighter - A basic Rust syntax highlighter
- Scheduler
Handle - A weak handle to the animation scheduler
- Scroll
- A scrollable container element with bounce physics
- Scroll
Config - Configuration for scroll behavior
- Scroll
Options - Options for scroll-into-view behavior
- Scroll
Physics - Internal physics state for scroll animation
- Scroll
Ref - Reference for programmatic control of a scroll container
- Scroll
Render Info - Information about scroll state for rendering
- Shadow
- Shadow configuration
- Solid
Material - Solid opaque material (the default)
- Spacing
Rect - Spacing values for padding and margin (all in pixels)
- Spring
Config - Configuration for a spring animation
- Stack
- A stack container where all children are positioned absolutely and stack over each other.
- Stagger
Config - Configuration for stagger animations
- State
Context - Context for stateful elements providing scoped state management
- Stateful
- A stateful element with user-defined state type
- Stateful
Builder - Builder for creating stateful containers with the new StateContext API
- Stateful
Inner - Internal state for
Stateful<S>, wrapped inArc<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
- Syntax
Config - Configuration for syntax highlighting passed to code elements
- Table
Builder - A builder for creating tables with headers and data
- Table
Cell - A table cell wrapper that can hold any content
- Task
List Item - A task list item with a checkbox
- Text
- A text element builder
- Text
Area - Ready-to-use text area element
- Text
Area Config - TextArea configuration
- Text
Area State - TextArea widget state
- Text
Data - Text data for rendering
- Text
Input - TextInput widget using FSM-driven Stateful for incremental updates
- Text
Input Config - Text
Position - Position in a multi-line text (line and column)
- Text
Selection - Global text selection state
- Toast
Builder - Builder for toast overlays
- Token
Hit - Information about a token hit (for intellisense callbacks)
- Token
Rule - A single token style rule with regex pattern
- Unordered
List - An unordered list container
- Value
Context - Context provided to value resolution at render time
- Window
Config - Window configuration
- Wood
Material - Wood grain material (placeholder for future texture support)
Enums§
- Animation
Direction - Animation direction
- Animation
Fill Mode - Animation fill mode
- Animation
Timing - Animation timing function
- Blinc
Error - Errors that can occur in the Blinc application
- Blur
Quality - Post-processing effect quality levels
- Button
State - Common button interaction states
- Button
Visual State - Common button interaction states
- Child
Diff - Result of diffing a single child position.
- Combinator
- Combinator between compound selectors
- Corner
- Corner positions for toast notifications
- Corner
Style - The type of corner curve
- CssElement
State - Element state for pseudo-class selectors
- CssSeverity
- Severity level for parse warnings/errors
- Cursor
Style - 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
- Element
Event - Events that can be programmatically dispatched to elements
- Element
Type Id - Element type identifier for downcasting
- Flow
Error - Errors from flow graph validation
- Flow
Expr - A flow expression — the computation at each node
- Flow
Func - Built-in function identifiers for the flow language
- Flow
Input Source - Source of a flow input value
- Flow
Output Target - Target for a flow output
- Flow
Target - Target pipeline for a flow
- Flow
Type - Flow data types
- Font
Weight - Font weight options
- Generic
Font - Generic font category for fallback when a named font isn’t available
- Input
Type - Layer
Effect - Post-processing effects that can be applied to layers
- Length
- A length value with its unit
- List
Marker - List marker style
- Loading
Strategy - Image loading strategy
- Material
- Material types that can be applied to elements
- Motion
State - State of a motion animation
- Mouse
Button - Mouse button identifier (matches platform)
- Object
Fit - How an image should fit within its container
- Overlay
- Overlay type for rendering on top of the tree
- Overlay
Kind - Categorizes overlay behavior and default configuration
- Overlay
Position - How to position an overlay
- Overlay
State - State machine for overlay lifecycle
- Placeholder
- Placeholder configuration for lazy-loaded images
- Radio
Layout - Layout direction for radio options
- Render
Layer - Render layer for separating elements in glass-effect rendering
- Scroll
Behavior - Scroll animation behavior
- Scroll
Block - Vertical scroll alignment
- Scroll
Direction - Scroll direction for the container
- Scroll
Inline - Horizontal scroll alignment
- Scroll
State - Scroll container states for webkit-style bounce scroll
- Selection
Source - Source of the selected text
- Selector
Part - A single part of a compound selector
- Slide
Direction - Direction for slide animations
- Stagger
Direction - Direction for stagger animations
- Stateful
Checkbox State - Checkbox states combining checked status and hover
- Structural
Pseudo - Structural pseudo-class selectors
- Style
Align - Alignment for align-items and align-self
- Style
Display - Display mode
- Style
Flex Direction - Flex direction
- Style
Justify - Justify content values
- Style
Overflow - Overflow behavior
- Style
Visibility - CSS visibility property
- Text
Align - Text alignment options
- Text
Field State - Text field focus states
- Text
Vertical Align - Vertical alignment for text within its bounding box
- Toggle
State - Toggle states (on/off)
- Token
Type - 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 - Update
Result - Result of an incremental update attempt
Constants§
- CURSOR_
BLINK_ INTERVAL_ MS - Standard cursor blink interval in milliseconds
Traits§
- Animation
Access - Trait for accessing animation values (springs, keyframes, timelines)
- Element
Builder - Trait for types that can build into layout elements
- Layout
Renderer - Trait for rendering layout trees with text, SVG, and glass support
- Node
State - Trait for node state types
- Overlay
Manager Ext - Extension trait for OverlayManager to create builders
- Reactive
Access - Trait for accessing reactive signal values
- State
Transitions - Trait for user-defined state types that can handle event transitions
- Syntax
Highlighter - 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_ handle Deprecated - 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
- Event
Callback - Callback for handling events
- Layout
Animation - Type alias for layout animation configuration
- OnReady
Callback - Callback type for on_ready notifications when an element is laid out and rendered
- Overlay
Manager - Thread-safe overlay manager
- Result
- Result type for blinc_app operations
- Scroll
Container - A scroll container element with momentum scrolling
- Shared
Animated Timeline - Shared animated timeline that can be cloned and accessed from multiple places
- Shared
Animated Value - Shared animated value type for motion bindings (thread-safe)
- Shared
Element Registry - Shared element registry for thread-safe access
- Shared
Keyframe Track - Shared keyframe animation that can be cloned and accessed from multiple places
- Shared
Scroll Physics - Shared handle to scroll physics for external access
- Shared
State - Shared state handle for
Stateful<S>elements - Shared
Text Area State - Shared text area state handle
- Shared
Text Input State - Shared
Text Selection - Thread-safe handle to the global text selection state
- Stateful
Button - A button element with hover/press states
- Stateful
Checkbox - A checkbox element with checked/unchecked states
- Text
Field - A text field element with focus states
- Text
Input State - Toggle
- A toggle element (on/off)
Derive Macros§
- Blinc
Component - Derive macro that generates a unique compile-time key for a component and generates field accessors based on field attributes.