dioxus-nox-timer 0.13.0

Headless countdown and stopwatch timer hooks for Dioxus
Documentation
//! # dioxus-nox-timer
//!
//! **⚠️ Disclaimer:** This crate was entirely generated by AI (Claude) as part of a
//! personal learning project. It has not been battle-tested in production and may
//! contain bugs or unsound abstractions. Use at your own risk and exercise extreme
//! caution before depending on it in anything that matters.
//!
//! Headless timer primitives for Dioxus applications: countdown and stopwatch hooks.
//!
//! ## Features
//!
//! - **Wall-clock based** — survives browser tab backgrounding (no `setInterval` drift)
//! - **Cross-platform** — works on web (wasm32), desktop, iOS, and Android
//! - **Headless** — no rendered components, just hooks and state machines
//!
//! ## Quick start
//!
//! ```rust,ignore
//! use dioxus::prelude::*;
//! use dioxus_nox_timer::*;
//!
//! #[component]
//! fn RestTimer() -> Element {
//!     let (remaining, state, controls) = use_countdown(None);
//!
//!     rsx! {
//!         div {
//!             // Recommended ARIA attributes for consumers:
//!             role: "timer",
//!             aria_live: "polite",
//!             "data-timer-state": match *state.read() {
//!                 TimerState::Idle => "idle",
//!                 TimerState::Running => "running",
//!                 TimerState::Paused => "paused",
//!                 TimerState::Complete => "complete",
//!             },
//!             p { "{format_duration(*remaining.read())}" }
//!             button { onclick: move |_| controls.start.call(90), "Start 90s" }
//!             button { onclick: move |_| controls.pause.call(()), "Pause" }
//!             button { onclick: move |_| controls.resume.call(()), "Resume" }
//!         }
//!     }
//! }
//! ```

mod countdown;
mod format;
mod stopwatch;
pub(crate) mod time;
mod types;

#[cfg(test)]
mod tests;

pub use countdown::use_countdown;
pub use format::format_duration;
pub use stopwatch::use_stopwatch;
pub use types::{CountdownControls, TimerState};