fret_ui_kit/primitives/hover_intent.rs
1//! Hover intent (Radix-aligned outcomes).
2//!
3//! Radix components like Tooltip and HoverCard rely on a small "hover intent" policy:
4//! delay-open and/or delay-close based on pointer hover, with deterministic transitions.
5//!
6//! In Fret:
7//!
8//! - `crate::headless::hover_intent` provides the deterministic state machine.
9//! - `crate::declarative::hover_intent` drives it from the runtime clock + schedules frames.
10//!
11//! This module provides a stable, Radix-aligned entry point and keeps component call sites from
12//! reaching into `crate::declarative` directly.
13
14use fret_ui::{ElementContext, UiHost};
15
16pub use crate::headless::hover_intent::{HoverIntentConfig, HoverIntentState, HoverIntentUpdate};
17
18/// Drive hover intent using the UI runtime clock (frame count) and request continuous frames while
19/// delayed transitions are pending.
20pub fn drive<H: UiHost>(
21 cx: &mut ElementContext<'_, H>,
22 hovered: bool,
23 cfg: HoverIntentConfig,
24) -> HoverIntentUpdate {
25 crate::declarative::hover_intent::hover_intent(cx, hovered, cfg)
26}