docs.rs failed to build tairitsu-web-0.4.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
tairitsu-web
Web platform implementations and browser integration for Tairitsu.
Overview
tairitsu-web provides platform implementations for running Tairitsu applications in web browsers. It supports both WIT-backed (Component Model) and direct web-sys backends.
Platform Implementations
WitPlatform
WIT-backed platform using the WebAssembly Component Model.
Features:
- Type-safe WIT bindings
- Opaque handle pattern (u64)
- Efficient handle caching
- Batch DOM operations
Target: wasm32-wasip2
use WitPlatform;
let platform = new?;
platform.mount_vnode_to_app?;
BrowserPlatform
Direct web-sys bindings for native-feeling browser interaction.
Features:
- Direct DOM access via web-sys
- Event handling
- CSS manipulation
- Canvas/WebGL support
Target: wasm32-unknown-unknown
Modules
wit_platform
WIT-backed platform implementation with:
- Opaque handles (
WitElement,WitEvent) - Handle caching for performance
- Event callbacks
- Style operations
handle_cache
Performance optimization for caching DOM handles:
- Style handle caching
- Cache statistics
- Thread-local storage
batch_ops
Batch DOM operations for performance:
- Group style updates
- Group attribute updates
- Reduce WIT round-trips
router
File-system based routing:
- Static routes
- Dynamic routes (
:id) - Wildcard routes (
*) - Middleware support
i18n
Internationalization support:
- Multi-language resources
- Context-based translation
- Pluralization
Feature Flags
wit-bindings: Enable WIT platform (default for wasm32-wasip2)browser: Enable direct browser platformssr: Enable SSR platformrouter: Enable routing modulei18n: Enable i18n module
Usage
Basic Setup
use WitPlatform;
use VNode;
pub extern "C"
Event Handling
use MouseEvent;
button
Styling
use ;
div
Performance
The web package includes several performance optimizations:
- Handle Caching: Reduces WIT calls for repeated style operations
- Batch Operations: Groups DOM updates for efficiency
- Opaque Handles: Lightweight u64 references instead of complex objects
- Event Delegation: Efficient event handling
See Also
- tairitsu-vdom: Virtual DOM implementation
- tairitsu-hooks: Reactive state management
- tairitsu-browser-worlds: WIT definitions
- tairitsu-browser-glue: Browser runtime host