A frontend standard library designed for Rust applications using Leptos and wasm-bindgen. This library provides ergonomic, type-safe abstractions over the verbose web-sys API, reducing boilerplate and improving developer experience.
Provides simple wrappers for global browser objects and logging.
- log, warn, error: Generic logging that works with any Debug type.
- window, document: Convenient access to global objects.
Type-safe wrapper around LocalStorage and SessionStorage using Serde.
- StorageManager: Handles automatic serialization and deserialization.
- local_storage, session_storage: Quick access functions.
Imperative helpers for DOM manipulation that are often needed alongside declarative frameworks.
- set_focus: Sets focus on an element.
- add_class, remove_class, toggle_class: Simplified CSS class management.
- query_selector: Easy access to DOM elements.
Async wrappers for HTTP requests using gloo-net.
- get, post: Typed functions that handle JSON deserialization.
High-level access to modern browser features.
- Clipboard: Async copy and paste functionality.
- URL Management: Get and set query parameters without page reloads.
- Notifications: Simplified permission request and display logic.
RAII-based event handling to prevent memory leaks.
- EventListener: Automatically removes the listener from the target when dropped.
- on_window: Quick registration for global window events.
Simplified wrappers for browser observation APIs.
- IntersectionObserverHandle: Clean interface for lazy-loading and visibility tracking.
Bridges between Leptos signals and browser persistence.
- create_persistent_signal: A signal that automatically syncs its value with LocalStorage.
General purpose frontend helpers.
- debounce: Prevents rapid function execution.
- truncate, capitalize: String manipulation utilities.
Add the library to your dependencies and use the prelude for immediate access to all utilities.
use rigorstd_leptos_wasm_bindgen::prelude::*;
// Example: Persistent state
let (name, set_name) = create_persistent_signal("user_name", "Guest".to_string());
// Example: Imperative DOM
if let Some(el) = query_selector("#input-field") {
set_focus(&el);
}