Crate presentar

Crate presentar 

Source
Expand description

Presentar: WASM-first visualization and rapid application framework.

Built on the Sovereign AI Stack (Trueno, Aprender, Realizar, Pacha).

§Browser Usage (WASM)

import init, { App, log } from './presentar.js';

async function main() {
    await init();
    const app = new App('canvas');
    app.render_json('[{"Rect": {...}}]');
}

Re-exports§

pub use browser::BrowserRouter;
pub use browser::RouteMatch;
pub use browser::RouteMatcher;
pub use presentar_layout as layout;
pub use presentar_widgets as widgets;
pub use presentar_yaml as yaml;

Modules§

accessibility
Accessibility support for screen readers and assistive technology.
animation
Animation system with spring physics, easing, and keyframe support.
binding
Interactive state binding for reactive UI.
brick_widget
Brick-based Widget helpers (PROBAR-SPEC-009)
browser
Browser runtime for Presentar WASM applications.
cache
chart
Chart rendering algorithms for Presentar.
clipboard
Clipboard API for copy, cut, and paste operations.
diff
Widget tree diffing for efficient UI updates.
dnd
Drag and drop system for interactive data transfer.
draw
Draw commands for GPU rendering.
gesture
Gesture recognition from touch/pointer events.
history
lifecycle
Widget lifecycle hooks for mount, update, and unmount callbacks.
shortcut
Keyboard shortcut management system.
simd
SIMD-accelerated operations using Trueno.
streaming
Data streaming and live updates for Presentar.
theme
Theme system for consistent styling.
validation
Declarative validation system for forms and inputs.
virtualization
widget
Widget trait and related types.

Structs§

AccessibilityTree
Accessibility tree for hit testing and navigation.
AccessibilityTreeBuilder
Builder for constructing accessibility trees.
AccessibleNode
An accessible element in the accessibility tree.
AccessibleNodeId
Unique identifier for an accessible node.
AnimColor
Color for animation (RGBA as f32 0-1).
AnimatedProperty
An animated property that smoothly transitions between values.
AnimationController
Controller for managing multiple animations.
AnimationInstance
An animation instance that can be managed by an Animator.
Animator
Manages multiple animations.
ArcGeometry
Arc geometry for pie charts.
BoxStyle
Box style for rectangles and circles.
BrickBudget
Performance budget for a brick.
BrickVerification
Result of verifying brick assertions
BudgetViolation
Budget violation report
CacheBuilder
Builder for cache entries
CacheConfig
Configuration for cache
CacheKey
Unique identifier for a cache entry
CacheMetadata
Cache entry metadata
CacheOptions
Cache entry options
CacheStats
Cache statistics
CatmullRom
Catmull-Rom spline interpolation.
CellLayout
Cell layout information
Checkpoint
Checkpoint in history
CheckpointId
Unique identifier for a checkpoint
Clipboard
Clipboard manager for handling copy/cut/paste operations.
ClipboardData
Data stored in the clipboard.
ClipboardEvent
Event triggered by clipboard changes.
ClipboardHistory
Clipboard history for undo support.
Color
RGBA color with values in the range [0.0, 1.0].
ColorPalette
A color palette for theming.
CommandExecutor
Command executor for synchronous commands.
CommandHistory
Command history manager
CommandId
Unique identifier for a command in history
CompositeCommand
Builder for creating composite commands
Constraints
Layout constraints that specify minimum and maximum sizes.
ContrastCheck
Result of a WCAG contrast check.
CornerRadius
Corner radii for rounded rectangles.
CounterState
A simple counter state for testing.
CubicBezier
Bezier curve segment.
CubicSpline
Cubic spline interpolation (natural spline).
DataCache
In-memory data cache
DataNormalizer
Data normalization for chart rendering.
DataRefreshManager
Manages periodic data refresh for data sources.
DataStream
Data stream manager.
DefaultBrick
Default Brick implementation for simple widgets.
DiffNode
A node in the widget tree for diffing.
DiffResult
Result of diffing two widget trees.
DragData
Data associated with a drag operation.
DragDropManager
Drag and drop manager.
DragId
Unique identifier for a drag operation.
DragPayload
Type-erased payload for drag data.
DragState
State of an active drag operation.
DrawBatch
Draw call batching for GPU efficiency.
DrawTransform
2D transformation matrix.
DropResult
Result of a drop operation.
DropTarget
Configuration for a drop target.
EasedValue
An easing-based animated value.
Effect
Effect hook that runs a callback and optionally cleans up.
EffectManager
Manager for effects with automatic cleanup.
ExecutorConfig
Command executor configuration.
FieldConfig
Configuration for a validated field.
FieldState
Field validation state.
FocusManager
Manages keyboard focus for widgets.
FocusTrap
A focus trap that restricts focus to a subset of widgets.
FormValidator
Form validation state manager.
FrameTimer
Frame timer for 60fps animations.
GestureConfig
Configuration for gesture recognition.
GestureRecognizer
Multi-touch gesture recognizer.
GpuInstance
GPU instance data for batched rendering.
GpuUniforms
Uniforms for the shader.
GpuVertex
GPU vertex data.
GridCell
Grid cell position
GroupId
Unique identifier for a command group
HistogramBins
Histogram binning configuration.
HistoryConfig
Configuration for command history
HitTester
Hit tester for finding accessible elements at a point.
HookId
Unique ID for a lifecycle hook registration.
ItemIndex
Index of an item in a virtualized list
ItemLayout
Item layout information
Keyframe
A keyframe in an animation.
KeyframeTrack
Keyframe animation track.
LayoutResult
Result of laying out a widget.
LifecycleEvent
Event passed to lifecycle callbacks.
LifecycleManager
Manager for widget lifecycle hooks.
LinearInterpolator
Linear interpolation between points.
MaxLength
Maximum length validator.
MemoryRouter
In-memory router for testing.
MemoryStorage
In-memory storage for testing.
MessageBuffer
Message buffer for ordering and deduplication.
MinLength
Minimum length validator.
Modifiers
Modifier keys for keyboard shortcuts.
PathTessellator
Path tessellation for GPU rendering.
Pattern
Pattern validator using regex-like patterns. Note: Uses simple pattern matching, not full regex.
Point
A 2D point with x and y coordinates.
Point2D
2D point for chart calculations.
PointerGestureRecognizer
Pointer gesture recognizer that unifies mouse, touch, and pen input.
PointerId
Pointer identifier for pointer events.
PointerInfo
Information about an active pointer.
Radii
Border radius presets.
Range
Range validator for numeric values.
RateLimiter
Rate limiter for backpressure handling.
ReconnectConfig
Reconnection configuration.
RecordingCanvas
A Canvas implementation that records draw operations as DrawCommands.
Rect
A rectangle defined by position and size.
RefreshTask
A scheduled data refresh task.
Required
Required field validator.
SetValueCommand
Simple value change command
Shadow
Shadow configuration.
Shadows
Shadow presets.
Shortcut
A keyboard shortcut (key + modifiers).
ShortcutBuilder
Builder for creating shortcuts with fluent API.
ShortcutId
Unique ID for a shortcut binding.
ShortcutManager
Manager for keyboard shortcuts.
SimpleBrick
Simple Brick implementation for common use cases.
Size
A 2D size with width and height.
Spacing
Spacing scale.
Spring
A spring-animated value.
SpringAnimation
Spring-based animation for physics-like motion.
SpringConfig
Spring physics configuration.
Store
Store manages state lifecycle with subscriptions and time-travel debugging.
StreamConfig
Configuration for stream connection.
StreamSubscription
Subscription to a data source.
StrokeStyle
Stroke style for path rendering.
TextStyle
Text style for rendering.
Theme
Complete theme definition.
Timer
A timer that fires at regular intervals.
TouchId
Touch identifier for multi-touch tracking.
TouchPoint
Active touch point being tracked.
Transform2D
2D affine transform.
TransitionConfig
Configuration for property transitions.
TreeDiffer
Widget tree differ.
Tween
A tween that interpolates between two values over time.
TypeId
Type identifier for widget types (used for diffing).
Typography
Typography scale.
VirtualGrid
Virtualized grid state
VirtualGridConfig
Configuration for virtualized grid
VirtualList
Virtualized list state
VirtualListConfig
Configuration for virtualized list
VisibleGridRange
Visible grid range
VisibleRange
Visible range information
WidgetId
Unique identifier for a widget instance.

Enums§

AccessibleRole
Accessible role for screen readers.
AnimatedValue
An animated value with easing or spring physics.
AnimationState
Animation state for tracking animation lifecycle.
BrickAssertion
Brick assertion that must be verified at runtime.
BrickError
Yuan Gate: Zero-swallow error handling for bricks
BrickPhase
Rendering phase for budget tracking
CacheEvent
Cache event for notifications
CacheState
Cache entry state
CheckedState
Checked state for checkboxes and radio buttons.
ClipboardFormat
Clipboard data format.
ClipboardOperation
Clipboard operation type.
ClipboardResult
Result of a clipboard operation.
ColorParseError
Error type for color parsing.
Command
Commands for side effects.
CommandResult
Result of executing or undoing a command
ConnectionState
Stream connection state.
CounterMessage
Messages for the counter state.
DiffOp
Operation to apply during reconciliation.
DragDataType
Type of data being dragged.
DragPhase
Current phase of a drag operation.
DrawCommand
Drawing primitive - all rendering reduces to these.
DropEffect
Effect/operation type for a drop.
Easing
Standard easing functions for animations.
EasingFunction
Easing functions for smooth animations.
Event
Input event types.
ExecutionResult
Result of command execution.
FillRule
Fill rule for path filling.
FocusDirection
Focus direction for keyboard navigation.
FontStyle
Font style.
FontWeight
Font weight.
GestureState
State of a gesture.
HistoryEvent
State change notification
Key
Keyboard key identifiers.
LifecyclePhase
Lifecycle phase for widgets.
LineCap
Line cap style.
LineJoin
Line join style.
LiveRegion
Live region type for dynamic content updates.
MouseButton
Mouse button identifiers.
PatternType
Type of pattern to match.
PointerType
Type of pointer device.
RecognizedGesture
State of a recognized gesture.
Sampling
Image sampling mode.
ScrollAlign
Scroll alignment options
ShortcutContext
Context in which a shortcut is active.
ShortcutPriority
Priority for shortcut resolution when multiple match.
StreamMessage
Stream message types for the protocol.
ValidateOn
When to run validation.
ValidationResult
Validation result for a single field.
WidgetKey
A key used to identify widgets across renders.

Traits§

Brick
Core Brick trait - the foundation of the Brick Architecture.
BrickWidgetExt
Extension trait for adding Brick verification to the render pipeline.
CacheSize
Trait for getting size of cached values
Canvas
Canvas trait for paint operations.
HistoryCommand
Trait for undoable commands
Interpolate
Trait for types that can be interpolated.
Interpolator
Interpolation trait for different curve types.
Router
Router trait for navigation commands.
State
Application state trait.
Storage
Storage trait for state persistence commands.
Validator
A validator that can validate a string value.
Widget
Core widget trait that all UI elements implement.

Functions§

commands_to_instances
Convert DrawCommands to GPU instances for batched rendering.
default_executor
Create a default executor with memory-based backends.
diff_trees
Convenience function to diff two trees.

Type Aliases§

AnimationId
Unique identifier for an animation.
BrickResult
Result type for brick operations
CacheCallback
Callback for cache events
HistoryCallback
Callback for history events
PathRef
Reference to a path in the path buffer.
StringCache
Simple string-keyed cache
TensorRef
Reference to a tensor in the tensor buffer.